Advertisement
Strahan

Unwatch resources @ SpigotMC

Jul 17th, 2021
1,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         SpigotMC - Unwatch resources
  3. // @namespace    http://www.sylvcraft.com
  4. // @version      0.1
  5. // @description  Allows you to easily unwatch all resources on a page
  6. // @author       Strahan
  7. // @match        https://www.spigotmc.org/resources/watched
  8. // @icon         https://www.google.com/s2/favicons?domain=spigotmc.org
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. var button = document.createElement("button");
  13. button.innerHTML = "Unwatch All";
  14. button.style.padding = "5px 10px";
  15. button.style.float = "right";
  16. button.onclick = function() { unwatchAll(); };
  17.  
  18. var h1 = document.getElementsByTagName("h1")[0];
  19. h1.appendChild(button);
  20.  
  21. function unwatchAll() {
  22.     var inputs = document.getElementsByTagName("input");
  23.     for (var x=0; x<inputs.length; x++) {
  24.         if (inputs[x].type != "checkbox") continue;
  25.  
  26.         inputs[x].checked = true;
  27.     }
  28.  
  29.     for (x=0; x<document.forms.length; x++) {
  30.         var sel = document.forms[x].do;
  31.         if (sel == null) continue;
  32.  
  33.         sel.value = 'stop';
  34.         document.forms[x].submit();
  35.         break;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement