Skip to content

Instantly share code, notes, and snippets.

@erikvold
Created August 31, 2013 03:01
Show Gist options
  • Select an option

  • Save erikvold/6395985 to your computer and use it in GitHub Desktop.

Select an option

Save erikvold/6395985 to your computer and use it in GitHub Desktop.
Deletes your tweets and retweets.
// ==UserScript==
// @id twitter.com-5b386b3d-0070-1b41-8d9d-843c35933093@erikvold
// @name Tweet Deleter
// @version 1.0
// @namespace erikvold
// @author Erik Vold
// @description
// @include https://twitter.com/erikvold
// @run-at document-load
// ==/UserScript==
function removeRetweets() {
let retweets = GM_xpath({
paths: ['//div[not(@data-name="erikvold")]//a[contains(@class, "undo-retweet")]'],
all: true
});
//alert(retweets.length);
retweets.forEach(function(a) {
if (!/cannot-retweet/.test(a.previousSibling.previousSibling.getAttribute('class'))) {
a.click();
}
});
}
function deleteNext() {
GM_xpath('//div[@data-name="erikvold"]//a[contains(@class, "js-action-del")]').click();
setTimeout(function() {
GM_xpath('//div[@id="delete-tweet-dialog-dialog"]//button[contains(@class, "btn primary-btn delete-action")]').click();
deleteNext();
}, 1000);
}
removeRetweets();
deleteNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment