Puts the "Marked for Later" button on the home page of AO3.
< 脚本 Put Marked for Later Button on AO3 Home 的反馈
Changes:
// ==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.
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.