This post has been de-listed (Author was flagged for spam)
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So I got a lot of feedback from you guys on my last post, and I've since updated my button-press script. It now injects itself into the existing reddit "thebutton" websocket callback, and patiently waits to press the button at the appropriate time. Since I'm injecting it, I have to add in a bunch more code to not break existing functionality, so it's a lot harder to read. But for those of you with curiosity or mistrust, here it is for you to read:
r.thebutton.redditorPressTime = 1;
r.thebutton.redditorSafety = true;
r.thebutton.redditorFinished = false;
r.thebutton._websocket._events["message:ticking"][0].callback = function(e) {
if (!r.thebutton._started) {
var t = $("#thebutton").parent();
t.is(".not-active, .locked") && t.removeClass("denied not-active").addClass("active locked"), r.thebutton._started = !0, r.thebutton._countdownInterval = window.setInterval(r.thebutton._countdown, 10)
}
var n = e.seconds_left;
if (!r.thebutton.redditorFinished) {
if (n <= r.thebutton.redditorPressTime) {
if (r.thebutton.redditorSafety) {
console.log("Would press at " n " seconds!");
} else {
console.log("Pressing at " n " seconds!");
$("#thebutton").parent().click();
$("#thebutton").click();
r.thebutton.redditorFinished = true;
}
}
}
this._tickTime = e.now_str, this._msgSecondsLeft = n, this._tickMac = e.tick_mac;
var i = e.participants_text,
s = n * 1e3;
s > r.thebutton._lastMsLeft && this.pulse2(), r.thebutton._lastMsLeft = s, r.thebutton._msLeft = n * 1e3, r.thebutton._countdownInterval || (this._countdownInterval = window.setInterval(r.thebutton._countdown, 10)), r.debug(n " seconds remaining"), r.debug(i " users have pushed the button"), $("#thebutton-timer").val(parseInt(e.seconds_left, 10)), $(".thebutton-participants").text(e.participants_text)
};
r.thebutton.redditorPressTime = prompt("Please enter your desired time: [1-60]");
alert("NOTE: This script will not do anything until you turn the safety off. Type \"safetyOff()\" in the js console to arm the script.");
function safetyOff() {
console.log("Removing the safeties! Script is now live! Firing click at " r.thebutton.redditorPressTime " seconds!");
r.thebutton.redditorSafety = false;
}
So the important bit here is, do this in the JS Console instead of through the url as I suggested last time. It's a three-step process: wait for the button page to finish loading, paste the script in place, and when you're ready, call the "safetyOff()" function call in the console.
For easy copying, see the gist on GitHub.
As you can see, I'm still a non-presser. But I would appreciate those who have a target time and don't want to leave it to chance to try out my script and give me feedback.
Subreddit
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/thebutton/c...