Twitter.com Show More Tweets Auto-Loader

When you are trying to load lots of Tweets on Twitter you may end up pressing the "HOME"+"END" key combination repeatedly. This script is a workaround for this behaviour. To begin auto-loader double-click anywhere on the page. To disable auto-loader double-click anywhere on the page.

当前为 2016-07-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Twitter.com Show More Tweets Auto-Loader
  3. // @namespace https://github.com/their
  4. // @version 1
  5. // @include https://twitter.com/*
  6. // @author DS
  7. // @description When you are trying to load lots of Tweets on Twitter you may end up pressing the "HOME"+"END" key combination repeatedly. This script is a workaround for this behaviour. To begin auto-loader double-click anywhere on the page. To disable auto-loader double-click anywhere on the page.
  8. // @grant none
  9. // ==/UserScript==
  10. // On dbl click
  11. var t = {
  12. global_on_off: false,
  13. which_scroll: 0,
  14. }
  15. window.ondblclick = function() {
  16. if (!t.global_on_off) {
  17. t.global_on_off = true;
  18. scroll();
  19. } else {
  20. t.global_on_off = false;
  21. }
  22. }
  23. // scroll
  24. function scroll() {
  25. if (!t.global_on_off) {
  26. return; // Quits
  27. }
  28. if (t.which_scroll === 0)
  29. document.body.firstChild.scrollIntoView();
  30. else
  31. document.getElementsByClassName('spinner')[0].scrollIntoView(); // Not...Footer, -footer
  32. t.which_scroll = (t.which_scroll === 0) ? 1 : 0;
  33. window.setTimeout(scroll, 600);
  34. }