Skip to content

Instantly share code, notes, and snippets.

@aholmes
Created February 1, 2015 22:46
Show Gist options
  • Save aholmes/d286e977408554f97bc3 to your computer and use it in GitHub Desktop.
Save aholmes/d286e977408554f97bc3 to your computer and use it in GitHub Desktop.
Delete old reddit posts
// Change this to the URL of your profile where you'd like to start deleting posts.
var startUrl = 'http://www.reddit.com/user/YOUR_USER_NAME/?count=100&after=WHATEVER_THE_TAG_IS';
function reload(cb)
{
var newdoc=undefined;
$.ajax(startUrl).success(function(data)
{
newdoc=$(data);
cb(newdoc.find('.del-button .option .yes'));
});
}
function deletePosts(delLinks)
{
var rtimeout=undefined;
delLinks.each(function(i,e)
{
(function(e)
{
window.setTimeout(function()
{
e.click();
}, 500 * i);
})(e);
if (rtimeout) { window.clearTimeout(rtimeout); }
rtimeout = window.setTimeout(function() { reload(deletePosts); }, (500 * i) + 500);
});
}
reload(deletePosts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment