Skip to content

Instantly share code, notes, and snippets.

@hinst
Created June 6, 2019 21:46
Show Gist options
  • Save hinst/8579428dacecd052355bf139fc9904d8 to your computer and use it in GitHub Desktop.
Save hinst/8579428dacecd052355bf139fc9904d8 to your computer and use it in GitHub Desktop.
fast-torrent tool
// ==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