Last active
August 29, 2015 14:18
-
-
Save norcalli/bc7fb4f7b451e6d6819e to your computer and use it in GitHub Desktop.
Button presser
This file contains hidden or 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 tens_el = document.getElementById("thebutton-s-10s"); | |
| var secs_el = document.getElementById("thebutton-s-1s"); | |
| var secs = function() { return 10*+tens_el.innerText + +secs_el.innerText; } | |
| var b = document.getElementById("thebutton"); | |
| function pressIt() { b.click(); } | |
| function tooLate() { | |
| var t = new Date(); | |
| t.setSeconds(t.getSeconds() + 2) | |
| return t.getDate() == 2; | |
| } | |
| var it; | |
| function checkIt() { | |
| if (secs() <= 55 || tooLate()) { | |
| console.log("I PUSHED IT: ALERT, I PUSHED IT. FUCK I DID IT."); | |
| pressIt(); | |
| clearInterval(it); | |
| } | |
| } | |
| it = setInterval(checkIt, 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment