Put Marked for Later Button on AO3 Home

Puts the "Marked for Later" button on the home page of AO3.

< 脚本 Put Marked for Later Button on AO3 Home 的反馈

评价:一般 - 脚本能用,但还有一些问题

§
发布于:2025-07-31

Despite button showing up before search on desktop, it is actually next child in DOM tree, which makes it appear after search in mobile interface.

§
发布于:2025-08-01
编辑于:2025-08-01

Changes:

  • Inserts link before search bar (works on mobile)
  • Uses regular DOM api instead of jQuery (jQuery requirement removed)
  • Runs a little bit earlier (document-end instead of document-idle)
  • Doesn't have redundant matches
  • Strict mode
// ==UserScript==
// @name         Put Marked for Later Button on AO3 Home
// @namespace    https://greasyfork.org/en/users/773998
// @version      0.3
// @description  Puts the "Marked for Later" button on the home page of AO3.
// @author       JaneBuzJane
// @match        http://archiveofourown.org/*
// @match        https://archiveofourown.org/*
// @run-at       document-end
// @grant        none
// @downloadURL https://update.greasyfork.org/scripts/426732/Put%20Marked%20for%20Later%20Button%20on%20AO3%20Home.user.js
// @updateURL https://update.greasyfork.org/scripts/426732/Put%20Marked%20for%20Later%20Button%20on%20AO3%20Home.meta.js
// ==/UserScript==

"use strict";
const url = greeting.querySelector('a').href+"/readings?show=to-read";

document.querySelector("ul.primary.navigation.actions .search").insertAdjacentHTML("beforebegin", '<li class="dropdown"><a href="'+url+'"">Marked for Later</a></li>');

Notes: While document-end is called right after DOMContentLoaded and before document-idle, onreadystatechange with readyState="interactive" (which .ready() is) happens before even that, which I assume you wanted, happens before document-end and doesn't require all deferred scripts to run. However AO3 doesn't have them, so it doesn't matter.

发布留言

登录以发布留言。