Last active
July 17, 2018 02:59
-
-
Save lbj96347/bb6584065bf53ec43ec84d02158bc73e to your computer and use it in GitHub Desktop.
Slack Deletron Batch Delete
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
var i = 0; | |
var job = self.setInterval("deleteFile()", 1000); | |
function deleteFile() { | |
i = i + 1; | |
if ( i == 90 ){ | |
job = window.clearInterval(job) | |
}else{ | |
try | |
{ | |
//在这里运行代码 | |
document.getElementsByClassName("Button Button__Large File__Button")[i].click() | |
} | |
catch(err) | |
{ | |
//在这里处理错误 | |
console.log(err) | |
job = window.clearInterval(job) | |
setTimeout( function(){ | |
i = 0; | |
job = self.setInterval("deleteFile()", 1000); | |
}, 2000); | |
} | |
} | |
} | |
/* | |
How to use? | |
1. Login Slack Deletron; | |
2. Filter all files those you wanna remove in your Slack group; | |
3. Slack Deletron and turn on console in Chrome or Safari; | |
4. Copy the script to console and press ENTER; | |
Tricky Tips | |
In line-5 code 90 means the script will stop running when files hit 90. If your files number is not over 90, you can change the number that you want. | |
If you saw some errors pop from console, just refresh the page the copy & paste the script again. I didn't make some execption handler in this script. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment