Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter Tweets Deleter (com.vsubhash.js.twitter_tweets_deleter) is a User Script that will automatically deletes tweets on a Twitter page, one after another. This script can be installed in Firfox browsers using the Greasemonkey add-on. WARNING: Remember to disabe this script after you have finished deleting your tweets. Otherwise, newer tweets …
// ==UserScript==
// @name Twitter Tweets Deleter
// @namespace com.vsubhash.js.twitter_tweets_deleter
// @description Deletes all tweets one-by-one
// @version 2018
// @grant none
// ==/UserScript==
document.addEventListener("DOMContentLoaded", startDeletingTweets, false);
var iVsJsTimeout1, iVsJsTimeout2, bFoundRetweet = false;
function startDeletingTweets() {
window.setTimeout(findDropDownMenu, 3*1000);
}
function findDropDownMenu() {
console.error("Searching for drop-down menus");
var oButtons = document.getElementsByClassName("ProfileTweet-action");
console.error("Found a drop-down menu");
oButtons[0].className="dropdown open";
window.setTimeout(clickOnDeleteOption, 3*1000);
}
function clickOnDeleteOption() {
try {
console.error("Finding the delete option");
document.getElementsByClassName("js-actionDelete")[0].getElementsByTagName("button")[0].click();
console.error("Clicked the delete option");
window.setTimeout(clickOnDeleteConfirmButton, 3*1000);
} catch (e) {
console.error("TTD Error: " + e)
}
}
function clickOnDeleteConfirmButton() {
console.error("Finding the delete confirmation button");
document.getElementsByClassName("delete-action")[0].click();
console.error("Clicked the delete confirmation button");
window.setTimeout(function() { location.reload(); }, 3*1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.