Add AO3 Mark for Later Button to works list

Puts the "Marked for Later" button in a fic blurb when browsing AO3.

< Feedback on Add AO3 Mark for Later Button to works list

Review: OK - script works, but has bugs

§
Posted: 10.11.2021.

Love this, but I'm also using this script (https://greasyfork.org/en/scripts/36467-ao3-links-to-last-chapter-and-entire-works), so it adds multiple mark for later buttons (one for the work link, one for the last chapter link, and one for the entire work link). Is there a way to make it so it just adds a button for the main link?

JaneBuzJaneAuthor
§
Posted: 03.01.2022.

Love this, but I'm also using this script (https://greasyfork.org/en/scripts/36467-ao3-links-to-last-chapter-and-entire-works), so it adds multiple mark for later buttons (one for the work link, one for the last chapter link, and one for the entire work link). Is there a way to make it so it just adds a button for the main link?



Hey there,

Thanks for using my script! The behavior you're seeing actually isn't a bug - the script is doing exactly what it's supposed to do, but it's displaying it oddly because of the other script's behavior. The way my script works is it scrapes the header element in each work "box" for a link to the fic, then adds a button for each link it finds (which is usually only one - the link in the title). Since the script you linked adds multiple links to that header element, the script is showing a button for each of those links.

The best I can think of for a quick fix would be to change a little bit of both the script you linked and my script, though it'll change where the "Entire Work" and "Last Chapter" links and where this button appears, so I understand if you're not interested in that kind of a fix.

First, in my script, go to the part that says

"float: left; clear: right;" and change float: left to float: right. This makes the button appear on the right side instead of the left.

Next, in the script you linked, we'll make the Entire Work and Last Chapter links move to where the Mark for Later button was previously. This is so my script doesn't scrape three title links.

At the beginning of Vannius' script, look for the part near the beginning that says

const titleTag = headerTag.firstElementChild.firstElementChild; Directly below that, add:

const statsTag = article.getElementsByClassName('stats')[0];

Then, at the very bottom, replace titleTag.parentNode.insertBefore(fragment, titleTag.nextSibling); with statsTag.parentNode.insertBefore(fragment, statsTag.nextSibling);.

Making those three changes results in something like this:



Again, it's not ideal - and I know that it would change the muscle memory of where you click - but my script is pretty "dirty" and depends on there not being any changes to the DOM, which means that when other scripts do change the DOM, it doesn't always play nicely.

Post reply

Sign in to post a reply.