Last active
December 8, 2019 17:15
-
-
Save pretentiousgit/e92bfc6aed260fb95d6ebc5ed1747aad to your computer and use it in GitHub Desktop.
Slack Deletron plugin to automate item deletion
This file contains hidden or 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
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