Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2011 17:32
Show Gist options
  • Save anonymous/997052 to your computer and use it in GitHub Desktop.
Save anonymous/997052 to your computer and use it in GitHub Desktop.
dan teng
var pull = (function(){
var target = document.getElementById("feedTabs").getElementsByTagName('a')[0],
event, timer;
return {
every: function(duration) {
timer && this.stop();
timer = setInterval(function(){
event = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
target.dispatchEvent(event);
}, ~~duration * 1000 || 2000);
},
cancel: function(){
timer && clearInterval(timer);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment