Created
February 17, 2013 07:51
-
-
Save cwgem/4970592 to your computer and use it in GitHub Desktop.
This is a Firefox greasemonkey script that will "click" the new tweets bar after a set interval. It will not do so unless you're scrolled all the way to the top (so as not to distract by pushing content down).
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
// ==UserScript== | |
// @name Twitter Auto Click | |
// @namespace http://www.github.com/cwgem/twitter-auto-click | |
// @description Click the new tweet banner unless the user is not scrolled to the top | |
// @include https://twitter.com/ | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function checkScrolledToTop() { | |
var timeline = document.getElementById('timeline'); | |
var clientTop = timeline.getBoundingClientRect().top; | |
var elementTop = timeline.offsetTop; | |
return clientTop == elementTop; | |
} | |
window.setInterval( function() { | |
var tweetbar = document.getElementsByClassName('new-tweets-bar'); | |
if (tweetbar.length != 0 && checkScrolledToTop()) { | |
tweetbar[0].click(); | |
} | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment