Skip to content

Instantly share code, notes, and snippets.

@baptx
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baptx/e68d8bb62779571a13ef to your computer and use it in GitHub Desktop.
Save baptx/e68d8bb62779571a13ef to your computer and use it in GitHub Desktop.
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