Twitter Tweet Auto Open

Auto-open tweets if scrolled to top of page

  1. // ==UserScript==
  2. // @name Twitter Tweet Auto Open
  3. // @namespace flowconsult.at
  4. // @version 0.1
  5. // @description Auto-open tweets if scrolled to top of page
  6. // @match https://twitter.com/*
  7. // @copyright Rafael Gattringer
  8. // @license GPL version 3 or any later version; www.gnu.org/copyleft/gpl.htm
  9. // ==/UserScript==
  10.  
  11. var timeoutID;
  12.  
  13. timer();
  14.  
  15. window.onscroll = function ()
  16. {
  17. checkPosition();
  18. }
  19.  
  20. function checkPosition()
  21. {
  22. if(window.pageYOffset <= 140)
  23. {
  24. openTweet();
  25. }
  26. }
  27.  
  28. function openTweet()
  29. {
  30. var newtweetsbar = document.querySelector(".new-tweets-bar");
  31. if (newtweetsbar) { newtweetsbar.click(); }
  32. }
  33.  
  34. function timer()
  35. {
  36. checkPosition();
  37. timeoutID = window.setTimeout(timer, 1000);
  38. }