Twitter Tweets Deleter 2016 – User JS for Opera 12.x and Firefox

This User JS will automatically delete all tweets in a Twitter account. Make sure you don’t let it run by mistake.

// ==UserScript==
// @name Twitter Tweets Deleter
// @namespace com.vsubhash.js.twitter.tweets.deleter
// @description Deletes all tweets one-by-one
// @version 1
// @grant none
// ==/UserScript==
document.addEventListener("DOMContentLoaded", startDeletingTweets, false); 
 
 
var iVsJsTimeout1, iVsJsTimeout2, bFoundRetweet = false; 
 

function startDeletingTweets() {
  window.setInterval(find_A_DotDot_Button, 12000);
}


function find_A_DotDot_Button() {
  console.error("Finding the dot-dot button");
  var i, oButtons = document.getElementsByTagName("span");
  
  for (i = 0; i  0) { window.clearTimeout(iVsJsTimeout1); }        
      iVsJsTimeout1 = window.setTimeout(click_Delete_MenuOption, 3000);
      break;
    }
  }
}

function click_Delete_MenuOption() {
  var i, oDeleteMenuButtons = document.getElementsByTagName("button"), bFoundOne = false;
  
  for (i = 0; i  0) { window.clearTimeout(iVsJsTimeout2); }        
        iVsJsTimeout2 = window.setTimeout(click_Delete_Button, 3000);
        bFoundOne = true;
        break; 
      }
    }
  }
  if (!bFoundOne) {
    var oRetweetButtons = document.getElementsByTagName("span");
    for (i = 0; i < oRetweetButtons.length; i++) {
      if (oRetweetButtons[i].className == "Icon Icon--retweet") {
        console.error("found retweet");
        oRetweetButtons[i].click();
        location.reload();
        break;
      }
    }
  }
}

function click_Delete_Button() {
  var i, oDeleteButtons = document.getElementsByTagName("button");
  
  for (i = 0; i < oDeleteButtons.length; i++) {
    if (oDeleteButtons[i].className == "btn primary-btn delete-action") {
      if (oDeleteButtons[i].textContent == "Delete") {
        console.error("Found a delete confirm button");
        oDeleteButtons[i].click();
        break;
      }
    }
  }
}
Advertisements
This entry was posted in news and tagged , , . Bookmark the permalink.