Last active
January 25, 2018 17:58
-
-
Save crowbarsolutions/4f78735c6e50d5b93724deba1ab47322 to your computer and use it in GitHub Desktop.
Delete Reddit Comments
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
- Using your favorite browser, goto your reddit profile page and open the comments list | |
- Open the browser developer tools (F12) | |
- Paste the code in this gist into the console and hit enter | |
- Observe how comments are deleted one by one | |
- When all comments on the page have been deleted, refresh the page and execute the script again on the remaining comments |
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 deleteBtnSelector = "a.CommentFlatList__item.RestrictedFlatlistButton", | |
confirmBtnSelector = ".RestrictedFlatlistButton__flatListToggle > a:nth-child(2)", | |
timeInterval = 1200; | |
function doSetTimeout(elem, interval) { setTimeout(function() { elem.click(); }, interval); } | |
var deleteBtnArr = document.querySelectorAll(deleteBtnSelector); | |
for(var i = 0; i < deleteBtnArr.length; i++) { deleteBtnArr[i].click(); }; | |
var confirmBtnArr = document.querySelectorAll(confirmBtnSelector); | |
for(var j = 0; j < confirmBtnArr.length; j++) { doSetTimeout(confirmBtnArr[j], j * timeInterval); }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment