ao3 adjust line breaks

insert or delete line breaks

目前为 2016-06-21 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name ao3 adjust line breaks
  3. // @namespace https://greasyfork.org/en/users/36620
  4. // @version 1.0
  5. // @description insert or delete line breaks
  6. // @author scriptfairy
  7. // @include /https?://archiveofourown\.org/works/\d+/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function($) {
  12. function doubleBreak() {
  13. var Break = $('#chapters').html().replace(/<br>/g,'<br><br>');
  14. $('#chapters').html(Break);
  15. }
  16. function deSpace() {
  17. $('<style>').text('#chapters br+br {display:none;}').appendTo($('head'));
  18. var nbsp = $('#chapters').html().replace(/&nbsp;/g, ' ');
  19. $('#chapters').html(nbsp);
  20. }
  21. $('<style>').text('.text-spacing {float: right; font-size: small; padding: 10px;}').appendTo($('head'));
  22. $('#chapters').before('<div class="text-spacing"><a class="double-break">insert line breaks</a> | <a class="de-space">remove line breaks</a></div>');
  23. $('.text-spacing .double-break').click(function() {
  24. doubleBreak();
  25. });
  26. $('.text-spacing .de-space').click(function() {
  27. deSpace();
  28. });
  29.  
  30. })(window.jQuery);