Greasy Fork is available in English.
insert or delete line breaks
当前为
// ==UserScript==
// @name ao3 adjust line breaks
// @namespace http://greasyfork.icu/en/users/36620
// @version 1.0
// @description insert or delete line breaks
// @author scriptfairy
// @include /https?://archiveofourown\.org/works/\d+/
// @grant none
// ==/UserScript==
(function($) {
function doubleBreak() {
var Break = $('#chapters').html().replace(/<br>/g,'<br><br>');
$('#chapters').html(Break);
}
function deSpace() {
$('<style>').text('#chapters br+br {display:none;}').appendTo($('head'));
var nbsp = $('#chapters').html().replace(/ /g, ' ');
$('#chapters').html(nbsp);
}
$('<style>').text('.text-spacing {float: right; font-size: small; padding: 10px;}').appendTo($('head'));
$('#chapters').before('<div class="text-spacing"><a class="double-break">insert line breaks</a> | <a class="de-space">remove line breaks</a></div>');
$('.text-spacing .double-break').click(function() {
doubleBreak();
});
$('.text-spacing .de-space').click(function() {
deSpace();
});
})(window.jQuery);