Created
February 27, 2018 21:12
-
-
Save cameronscott137/0c89af5ba0742121124ab9d77bd71c07 to your computer and use it in GitHub Desktop.
Clear your Twitter Timeline
This file contains 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
// 1) Automatically scroll to the very bottom of your timeline. This script will scroll as far as it can on any given page. | |
// If, after five seconds, it can't scroll any further down the page, it will alert you that it's finished. | |
// However, this may just mean that your timeline is slow to load. Make sure you're actually at the bottom of your timeline before proceeding to step 2 | |
var interval; | |
var body = document.body; | |
var bottom; | |
var current; | |
interval = setInterval(function() { | |
bottom = body.scrollHeight; // Height | |
current = window.innerHeight + document.documentElement.scrollTop; | |
window.scrollTo(0, document.body.scrollHeight); | |
console.log('Started scrolling!'); | |
if (bottom - current <= 10) { | |
clearInterval(interval); | |
alert('Finished scrolling!'); | |
} | |
}, 5000); | |
// 1a) If you need to STOP the scrolling process: | |
clearInterval(interval); | |
// 2) Unclick all retweeeted tweets. | |
var retweets = document.querySelectorAll(".retweeted .js-actionRetweet"); | |
Array.prototype.forEach.call(retweets, child => { | |
child.click(); | |
}); | |
// 3) Delete each original tweet, and click the double-confirm modal that appears. | |
var originalTweets = document.querySelectorAll(".js-original-tweet .js-actionDelete .dropdown-link"); | |
Array.prototype.forEach.call(originalTweets, child => { | |
child.click(); | |
document.querySelector(".modal-container .delete-action").click(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment