Created
May 28, 2011 17:32
-
-
Save anonymous/997052 to your computer and use it in GitHub Desktop.
dan teng
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
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