Created
June 6, 2019 21:46
-
-
Save hinst/8579428dacecd052355bf139fc9904d8 to your computer and use it in GitHub Desktop.
fast-torrent tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name fast-torrent tool | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function main() { | |
let button = null; | |
do { | |
await sleep(100); | |
button = document.querySelector("div.upload-header div.c7"); | |
} while (button == null); | |
button.onclick = function() { | |
const panels = document.querySelectorAll("div.torrent-row div.torrent-info"); | |
const hidden = panels.length > 0 ? panels[0].classList.contains("hidden") : false; | |
for (const panel of panels) { | |
if (hidden) | |
panel.classList.remove("hidden"); | |
else | |
panel.classList.add("hidden"); | |
} | |
}; | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment