Skip to content

Instantly share code, notes, and snippets.

@crowbarsolutions
Last active January 25, 2018 17:58
Show Gist options
  • Save crowbarsolutions/4f78735c6e50d5b93724deba1ab47322 to your computer and use it in GitHub Desktop.
Save crowbarsolutions/4f78735c6e50d5b93724deba1ab47322 to your computer and use it in GitHub Desktop.
Delete Reddit Comments
- 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
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