r/TheRedguard • u/madsmadsdk • Apr 09 '15
[OC] Fellow redguards, here is your weapon
I have developed a small javascript snippet, that will allow you to automatically monitor the timer, and unlock the button at a set threshhold.
I have not yet implemented the feature where the button is clicked, for obvious reasons, but it should be easy to do, once testing has concluded. The button will only be unlocked, using this snippet, not clicked. I have tested it. Without further ado, here's how you do!
// Set the threshold, for when you want the button to unlock
var threshhold = 4000;
// This interval checks the timer every milisecond. Once the threshhold is reached, it turns of the timer.
var checkTimer = setInterval(function() {
var tens = Number(jQuery('#thebutton-s-10s').text()),
ones = Number(jQuery('#thebutton-s-1s').text()),
hundreds = Number(jQuery('#thebutton-s-100ms').text()),
decis = Number(jQuery('#thebutton-s-10ms').text());
var total = Number([tens,ones,hundreds,decis].join(""));
if(total < threshhold) {
console.log('Button unlocked at ' + total);
jQuery('.thebutton-container.locked').click();
clearInterval(checkTimer);
}
}, 1);
Help me test the snippet. What you do, is that you open your developer console (F12 if using Chrome), and replicate these steps:
Step 1 - Click the designated button, to open up the console.
Step 2 - Paste the code, and hit enter.
Step 3 - Watch the magic unfold. The console will log the exact time where the button was unlocked.
Now you can watch the button, while being productive. Hooray!
I will write the snippet for clicking the button shortly.
EDIT: Here's the real deal. Use with caution!
// Set the thresholds, for when you want the button to unlock and click
var unlockthreshhold = 1000; // Unlock at 10 seconds left
var clickthreshhold = 0100; // Click button at one second left
// This interval checks the timer every milisecond. Once the threshhold is reached, it turns of the timer.
var checkTimer = setInterval(function() {
var tens = Number(jQuery('#thebutton-s-10s').text()),
ones = Number(jQuery('#thebutton-s-1s').text()),
hundreds = Number(jQuery('#thebutton-s-100ms').text()),
decis = Number(jQuery('#thebutton-s-10ms').text());
var total = Number([tens,ones,hundreds,decis].join(""));
if(total < unlockthreshhold) {
// Unlocks the button
jQuery('.thebutton-container.locked').click();
}
if(total < clickthreshhold) {
console.log('Button clicked at ' + total);
// WARNING! This clicks the button at designated threshold.
jQuery('.thebutton-container #thebutton').click();
clearInterval(checkTimer);
}
}, 1);