您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes excessive spacing between paragraphs on AO3.
当前为
// ==UserScript== // @name AO3 Fix Paragraph Spacing // @namespace ao3-remove-double-spacing // @version 1.6 // @description Removes excessive spacing between paragraphs on AO3. // @author yuube // @match http*://*.archiveofourown.org/* // @icon https://www.google.com/s2/favicons?domain=archiveofourown.org // @grant none // ==/UserScript== (function () { 'use strict'; function hasMedia (el) { var mediaWhitelist = [ 'IMG', 'EMBED', 'IFRAME', 'VIDEO' ]; var whitelisted = false; mediaWhitelist.forEach(item => { if (el.tagName === item || el.querySelector(item)) { whitelisted = true; }; }); return whitelisted }; function naturallyEmpty (el) { var emptyWhitelist = [ 'HR' ]; var whitelisted = false; var tagName = el.tagName; emptyWhitelist.forEach(item => { if (tagName === item || el.querySelector(item)) { whitelisted = true; }; }); if (tagName === 'BR') { whitelisted = true }; return whitelisted }; function removeEmptyElement (el) { var content = el.textContent && el.textContent.trim() if (!content) { if (hasMedia(el) || naturallyEmpty(el)) { return } el.remove(); } }; var parent = document.querySelectorAll('.userstuff'); parent.forEach(userstuff => { // Commonly empty elements ['p', 'div', 'span', ':empty'].forEach(el => { userstuff.querySelectorAll(el).forEach(removeEmptyElement); }); // <br>s with non-text siblings userstuff.querySelectorAll('br').forEach(el => { var previous = el.previousSibling; var next = el.nextSibling; if (previous.nodeType !== 3 && next.nodeType !== 3) { el.remove(); }; }); }); })();