Last active
August 29, 2015 14:07
-
-
Save baptx/e68d8bb62779571a13ef to your computer and use it in GitHub Desktop.
Twitter timeline scroll
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
// 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