Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter timeline scroll
// Scroll Twitter home (worked for profiles too before a Twitter update)
/*var target_tweet = document.getElementById("stream-items-id");
var target_fail = document.getElementsByClassName("stream-fail-container")[0];*/
// Scroll Twitter profiles
var target_tweet = document.getElementsByClassName("GridTimeline-items")[0];
var target_fail = document.getElementsByClassName("GridTimeline-failure")[0];
var height = target_tweet.scrollHeight;
var observer = new MutationObserver(function(mutations) {
for (var i = 0; mutations[i]; i++)
window.scrollBy(0, height);
});
var config = { attributes: true, childList: true, characterData: true }
observer.observe(target_tweet, config);
observer.observe(target_fail, config);
window.scrollBy(0, height);
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.