baptx

twitter_timeline_scroll

Dec 30th, 2012
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Scroll Twitter home (worked for profiles too before a Twitter update)
  2. /*var target_tweet = document.getElementById("stream-items-id");
  3. var target_fail = document.getElementsByClassName("stream-fail-container")[0];*/
  4.  
  5. // Scroll Twitter profiles
  6. var target_tweet = document.getElementsByClassName("GridTimeline-items")[0];
  7. var target_fail = document.getElementsByClassName("GridTimeline-failure")[0];
  8.  
  9. var height = target_tweet.scrollHeight;
  10. var observer = new MutationObserver(function(mutations) {
  11.     for (var i = 0; mutations[i]; i++)
  12.         window.scrollBy(0, height);
  13. });
  14. var config = { attributes: true, childList: true, characterData: true }
  15. observer.observe(target_tweet, config);
  16. observer.observe(target_fail, config);
  17. window.scrollBy(0, height);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×