Last active
June 16, 2023 18:20
-
-
Save timmc/fb2f482886d67c22cf03e2793f1309b5 to your computer and use it in GitHub Desktop.
Script to delete all reddit comments on the *current page* when viewing own comment history. Quick and dirty approach if you don't have more than a few hundred comments.
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
function deleteAllOnPage(comments, index) { | |
var id = comments[index] | |
if (!id) return | |
console.debug('wiping ' + id) | |
$.ajax({ | |
type: 'POST', | |
url: '/api/editusertext', | |
data: { | |
thing_id: id, | |
text: ' ', | |
id: 'any', | |
uh: r.config.modhash, | |
renderstyle: 'html' | |
}, | |
success: function successEdit() { | |
console.debug('deleting ' + id) | |
$.ajax({ | |
type: 'POST', | |
url: '/api/del', | |
data: { | |
executed: 'deleted', | |
id: id, | |
renderstyle: 'html', | |
uh: r.config.modhash | |
}, | |
success: function successDel() { | |
deleteAllOnPage(comments, index + 1) | |
}, | |
error: function errorDel() { | |
console.error('Failed to delete ' + id, arguments) | |
} | |
}) | |
}, | |
error: function errorEdit() { | |
console.error('Failed to delete ' + id, arguments) | |
} | |
}) | |
} | |
deleteAllOnPage($('.comment').map(function(){ return $(this).data('fullname') }), 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unhiding everything on the page: