Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/r/thebutton
// Super-simple console script to push the button only when the timer gets low
var h;
var armed = false;
var lowestSoFar = 9999999999;
h = setInterval(function() {
if (r.thebutton._msLeft <= 0) {
console.log('Game over :-/');
clearInterval(h);
return;
}
if (r.thebutton._msLeft < lowestSoFar) {
lowestSoFar = r.thebutton._msLeft;
console.log('New low: ' + lowestSoFar / 1000 + ' seconds');
}
// Arm the button with 10 seconds left
if (!armed && r.thebutton._msLeft < 10000) {
$("#thebutton").parent().trigger('click');
armed = true;
console.log('BUTTON IS ARMED - READY FOR CLICK')
}
// Click the button with 5 seconds left
if (r.thebutton._msLeft < 5000) {
$("#thebutton").trigger('click');
console.log('CLICKED!');
}
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.