您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows removal and re-addition of line breaks on AO3 work pages.
// ==UserScript== // @name AO3 Spacing Adjuster // @namespace http://tampermonkey.net/ // @version 1.0 // @description Allows removal and re-addition of line breaks on AO3 work pages. // @author futureaceofkarasuno // @match https?://archiveofourown\.org/.*works/\d+/ // @grant none // ==/UserScript== (function() { 'use strict'; // Function to remove extra line breaks function removeLineBreaks() { var chapterContent = document.getElementById('chapters'); if (chapterContent) { chapterContent.innerHTML = chapterContent.innerHTML.replace(/<br>\s*<br>/g, '<br>'); } } // Function to add extra line breaks function addLineBreaks() { var chapterContent = document.getElementById('chapters'); if (chapterContent) { chapterContent.innerHTML = chapterContent.innerHTML.replace(/<br>/g, '<br><br>'); } } // Create the dropdown menu var menu = document.createElement('div'); menu.innerHTML = ` <div class="ao3ft-menu" style="position: fixed; top: 20px; right: 20px; background-color: white; border: 1px solid black; padding: 5px; z-index: 1000;"> <select id="ao3ft-select"> <option value="">Select Format Option</option> <option value="removeLB">Remove Line Breaks</option> <option value="addLB">Add Line Breaks</option> </select> </div> `; document.body.appendChild(menu); // Append the menu to the body // Add event listener to the select element document.getElementById('ao3ft-select').addEventListener('change', function() { var selectedOption = this.value; if (selectedOption === 'removeLB') { removeLineBreaks(); } else if (selectedOption === 'addLB') { addLineBreaks(); } }); })();