Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // ==UserScript==
  2. // @name fast-torrent tool
  3. // @version 1
  4. // @grant none
  5. // ==/UserScript==
  6.  
  7. function sleep(ms) {
  8. return new Promise(resolve => setTimeout(resolve, ms));
  9. }
  10.  
  11. async function main() {
  12. let button = null;
  13. do {
  14. await sleep(100);
  15. button = document.querySelector("div.upload-header div.c7");
  16. } while (button == null);
  17.  
  18. button.onclick = function() {
  19. const panels = document.querySelectorAll("div.torrent-row div.torrent-info");
  20. const hidden = panels.length > 0 ? panels[0].classList.contains("hidden") : false;
  21. for (const panel of panels) {
  22. if (hidden)
  23. panel.classList.remove("hidden");
  24. else
  25. panel.classList.add("hidden");
  26. }
  27. };
  28. }
  29. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement