Configure the buttons for works by hiding them.
当前为
// ==UserScript==
// @name [AO3] Better Work Buttons
// @namespace https://greasyfork.org/en/users/1138163-dreambones
// @version 0.5.1
// @description Configure the buttons for works by hiding them.
// @author DREAMBONES
// @match http*://archiveofourown.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=archiveofourown.org
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Configure here! Set to "true" if you want the button hidden, "false" if you want it to be seen.
var hideTopButtons = {
"Entire Work": false,
"Previous Chapter": false,
"Next Chapter": false,
"Chapter Index": false,
"Bookmark": false,
"Mark as Read": false,
"Comments": false,
"Hide Creator's Style": false,
"Share": false,
"Subscribe": false,
"Download": false
}
var hideBottomButtons = {
"Top": false,
"Kudos": false,
"Bookmark": false,
"Mark as Read": false,
"Comments": false,
}
//Config ends here!
var topButtons = {
"Entire Work": "li.chapter.entire",
"Previous Chapter": "li.chapter.previous",
"Next Chapter": "li.chapter.next",
"Chapter Index": "li[class='chapter']",
"Bookmark": "li[class='bookmark']",
"Mark as Read": "li[class='mark']",
"Comments": "li[class='comments']",
"Hide Creator's Style": "li[class='style']",
"Share": "li[class='share']",
"Subscribe": "li[class='subscribe']",
"Download": "li[class='download']"
}
var bottomButtons = {
"Top": "li > a[href='#main']",
"Kudos": "li > form[id='new_kudo']",
"Bookmark": "li > a[href='#bookmark-form']",
"Mark as Read": "li > a[href$='mark_as_read']",
"Comments": "li > a[href^='/comments/']",
}
var domainRe = /https?:\/\/archiveofourown\.org\/works\/\d+/i
if (domainRe.test(document.URL)) {
var topBts = document.querySelector("ul.work.navigation.actions");
var botBts = document.querySelector("ul[class='actions'][role='navigation']");
for (let key in hideTopButtons) {
if (hideTopButtons.hasOwnProperty(key)) {
if (hideTopButtons[key] == true) {
try {
let button = topBts.querySelector(topButtons[key]);
button.remove();
}
catch (TypeError) { null; }
}
}
}
for (let key in hideBottomButtons) {
if (hideBottomButtons.hasOwnProperty(key)) {
if (hideBottomButtons[key] == true) {
try {
let button = botBts.querySelector(bottomButtons[key]).parentElement;
button.remove();
}
catch (TypeError) { null; }
}
}
}
}
})();