Skip to content

Instantly share code, notes, and snippets.

@pretentiousgit
Last active December 8, 2019 17:15
Show Gist options
  • Save pretentiousgit/e92bfc6aed260fb95d6ebc5ed1747aad to your computer and use it in GitHub Desktop.
Save pretentiousgit/e92bfc6aed260fb95d6ebc5ed1747aad to your computer and use it in GitHub Desktop.
Slack Deletron plugin to automate item deletion
let arr = Array.from(document.querySelectorAll('.File__Button'));
console.log(arr.length);
(function loopClick (i) {
setTimeout(function () {
console.log('loop i', i)
if(arr[i - 1]){
arr[i - 1].click()
arr = Array.from(document.querySelectorAll('.File__Button'));
}
if(arr.length < 7) {
console.log('arr length error', arr);
// arr[0].click();
for (const a of document.querySelectorAll(".Button")) {
if (a.textContent.includes("Get Files")) {
a.click();
console.log('reload');
if(Array.from(document.querySelectorAll('.File__Button')).length > 0){
console.log("there's more");
} else {
console.log("still nothing");
}
}
}
}
if (i > 0) {
if (--i) loopClick(i);
}
}, 550)
})(arr.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment