Greasy Fork is available in English.

AO3 Spacing Adjuster

Allows removal and re-addition of line breaks on AO3 work pages.

Tekijä
futureaceofkarasuno
Päivittäiset asennukset
0
Asennuskerrat
8
Arvostelut
0 0 0
Versio
1.0
Luotu
24.3.2024
Päivitetty
24.3.2024
Lisenssi
N/A
Käytössä

This script is adapted from scriptfairy's Ao3 tweak formatting script--it wasn't working for me, so I decided to just rewrite it and simplify the code by removing the elements that didn't work or do anything when I tried to use them on my browser. It allows the user to remove the extra spaces between paragraphs on Ao3 and add them back in if you decide you want. This script adds a floating dropdown menu to the top right of AO3 work pages. It offers two options: to remove or add line breaks in the text. Here’s the breakdown of the main parts:

Dropdown Menu Creation: A div element containing a select dropdown is created and styled to appear at the top right of the page. This menu provides the user with the format options.

Functionality for Removing and Adding Line Breaks: Two functions, removeLineBreaks and addLineBreaks, are defined to manipulate the HTML content within the 'chapters' element, either by removing extra line breaks (converting two consecutive
tags into one) or by adding them (doubling each
tag).

Event Listener: An event listener is attached to the dropdown menu. It triggers the appropriate function based on the user’s selection, applying the desired formatting change to the page content immediately.