Skip to content

Instantly share code, notes, and snippets.

@karmankertesz
Created September 30, 2016 23:23
Show Gist options
  • Save karmankertesz/aac6051ca1f3eb4f89406fe0191f0d52 to your computer and use it in GitHub Desktop.
Save karmankertesz/aac6051ca1f3eb4f89406fe0191f0d52 to your computer and use it in GitHub Desktop.
/* JS script to delete Reddit comments.
If you have RES installed you can have more items on one page, it's easier.
https://www.reddit.com/r/RESAnnouncements/
Open you comments page:
https://www.reddit.com/user/<username>/comments/
Copy and paste this to the Console, it will overwrite and delete all comments:
You can run the same script on the Submitted items page, but they will be only deleted,
the script won't edit them one by one to overwrite the content. This shouldn't be a problem
as the public content and the submitter username is changed to [removed] when a submission is deleted.
*/
var str = 'This comment has been overwritten'
var time = 0,
interval = 2000
$('.edit-usertext').click()
$('.md textarea').val(str);
var save = $('.usertext-buttons .save')
var delButton = $('.del-button .option .yes')
var promiseArray = []
save.each(function () {
time += interval
promiseArray.push(new Promise((resolve, reject) => {
setTimeout(() => {
console.log('editing');
$(this).click()
resolve()
}, time)
}))
})
promiseArray = promiseArray || [Promise.resolve()]
Promise.all(promiseArray)
.then(() => {
var time = 0,
interval = 800;
delButton.each(function() {
time += interval
setTimeout(() => {
console.log('deleting');
$(this).click()
}, time)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment