|
|
|
|
|
by PaulJulius
4082 days ago
|
|
Some code you can write in the console to click the button at a certain time: sec10s = document.getElementById("thebutton-s-10s");
sec1s = document.getElementById("thebutton-s-1s");
sec10ms = document.getElementById("thebutton-s-10ms");
sec100ms = document.getElementById("thebutton-s-100ms");
button = document.getElementById("thebutton");
time = function() {
return sec10s.innerHTML +
sec1s.innerHTML; // +
//sec10ms.innerHTML +
//sec100ms.innerHTML;
};
pressAt = function(timeStr) {
return function() {
if (time() == timeStr) {
button.click();
}
};
};
setInterval(pressAt("00"), 100);
But even with setInterval set to 1, this won't get called every millisecond, so you can't get accuracy to the second decimal point, not that there's really any need to. (It turns out setInterval has a minimum delay. setTimeout's minimum delay is 4ms and likely setInterval's minimum delay is the same.) Just set this up and leave your computer running for the next few months and you ought to get it eventually. |
|
var buttonSocket = new WebSocket("wss://wss.redditmedia.com/thebutton?h=3b85664277e270cfd024faee2cc021a359a8af73&e=1429012932");
buttonSocket.onmessage = function (event) { console.log(event.data); }
data is just plain json in the form {"type": "ticking", "payload": {"participants_text": "715,197", "tick_mac": "e2dc885fe4836cad86f9cd7670645871e11401f4", "seconds_left": 50.0, "now_str": "2015-04-13-12-33-44"}}
That lets you know what the seconds are on the server and you can calculate your own ms (it looks like they do it client side too), just remember that timeouts are not guaranteed to fire exactly at the time you set since it's a single thread. Maybe a webworker could come in handy here but the event triggerd by a message would still be subject to delay if something else wanted to run. requestAnimationFrame is another place you could look or if you can scrape together the details you need to send the button press you could run something in node with more accurate timing.