Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name SpigotMC - Unwatch resources
- // @namespace http://www.sylvcraft.com
- // @version 0.1
- // @description Allows you to easily unwatch all resources on a page
- // @author Strahan
- // @match https://www.spigotmc.org/resources/watched
- // @icon https://www.google.com/s2/favicons?domain=spigotmc.org
- // @grant none
- // ==/UserScript==
- var button = document.createElement("button");
- button.innerHTML = "Unwatch All";
- button.style.padding = "5px 10px";
- button.style.float = "right";
- button.onclick = function() { unwatchAll(); };
- var h1 = document.getElementsByTagName("h1")[0];
- h1.appendChild(button);
- function unwatchAll() {
- var inputs = document.getElementsByTagName("input");
- for (var x=0; x<inputs.length; x++) {
- if (inputs[x].type != "checkbox") continue;
- inputs[x].checked = true;
- }
- for (x=0; x<document.forms.length; x++) {
- var sel = document.forms[x].do;
- if (sel == null) continue;
- sel.value = 'stop';
- document.forms[x].submit();
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement