Skip to content

Instantly share code, notes, and snippets.

@cwgem
Created February 17, 2013 07:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cwgem/4970592 to your computer and use it in GitHub Desktop.
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).
// ==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