Created
October 4, 2018 16:19
-
-
Save mfurlend/e131fe9daaecc59b65af671be8d216db to your computer and use it in GitHub Desktop.
webtorrent-desktop batch delete scripts
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
//Delete all | |
let delete_buttons = Array.from(document.getElementsByClassName('delete')) | |
while (delete_buttons.length > 0) { | |
let button = delete_buttons.pop(); | |
button.click(); | |
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click()); | |
} | |
// Delete paused | |
let delete_buttons = Array.from(document.getElementsByClassName('delete')).filter(o=>o.parentNode.parentNode.childNodes[0].childNodes[1].childNodes[0].classList.contains('paused')) | |
while (delete_buttons.length > 0) { | |
let button = delete_buttons.pop(); | |
button.click(); | |
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click()); | |
} | |
// Delete seeding | |
let delete_buttons = Array.from(document.getElementsByClassName('delete')).filter(o=>o.parentNode.parentNode.childNodes[0].childNodes[1].childNodes[0].classList.contains('seeding')) | |
while (delete_buttons.length > 0) { | |
let button = delete_buttons.pop(); | |
button.click(); | |
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click()); | |
} | |
// Delete non-downloading | |
let delete_buttons = Array.from(document.getElementsByClassName('delete')).filter(o=>!o.parentNode.parentNode.childNodes[0].childNodes[1].childNodes[0].classList.contains('downloading')) | |
while (delete_buttons.length > 0) { | |
let button = delete_buttons.pop(); | |
button.click(); | |
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click()); | |
} | |
// Delete all, keep top | |
let delete_buttons = Array.from(document.getElementsByClassName('delete')) | |
while (delete_buttons.length > 1) { | |
let button = delete_buttons.pop(); | |
button.click(); | |
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click()); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment