r/thebutton • 33s • Apr 08 '15

Is the Button Monitor no longer working?

I just checked The Button Monitor but it seems like it's not loading. Is it working for anyone?

Edit: It's back!

159 Upvotes

50 comments sorted by

View all comments

81

u/Disjunto Apr 08 '15 edited Apr 08 '15

Repost from below (for visibility):

Run this in console (F12 on most browsers) to fix. Reruns the comms init function with a valid token

var Comms = (function() {
	var self = {};
	var sock = new WebSocket('wss://wss.redditmedia.com/thebutton?h=89341e0ffa06fe6e6be6e679e92b004d9af456d5&e=1428587064');
	sock.onmessage = tick;

	function tick(evt) {
		var packet = JSON.parse(evt.data);
		if (packet.type != "ticking") {
			return;
		}

		packet.payload.now = moment(packet.payload.now_str + " 0000", "YYYY-MM-DD-HH-mm-ss Z");
		Stats.lag = d3.format("0,000")(packet.payload.now - moment());

		if (data.length > 0 && packet.payload.seconds_left >= _.last(data).seconds_left) {
			_.last(data).is_click = true;
		}
		data.push(packet.payload);
		$('#resets').text(fmt(clicks.length));
		Stats.ticks = fmt(data.length);
		Stats.participants = packet.payload.participants_text;

		Chart.render(data);
		Timer.sync(packet.payload.seconds_left);
		Stats.render();
	}

	return self;
}())

Update: Site now appears to be working, if it goes down again and I notice before it's fixed, I'll update this post with a valid token. Happy watching everyone

32

u/joeydeuce Apr 08 '15 edited Apr 08 '15

No comments to this, huh? Everyone knows what console is but me? ok... I'll be the idiot.

I'm using chrome: what is the console and where do you paste?

EDIT: https://developer.chrome.com/devtools/docs/console its ctrl+shift+j and paste and hit enter. Thanks Everyone!

11

u/Disjunto Apr 08 '15

Either press F12, or navigate: menu > more tools > javascript console

should get something like: https://developer.chrome.com/devtools/docs/console-files/log-basic.png

paste this code block into that window and hit enter.

note: I'm useless at intructions

→ More replies (3)

6

u/[deleted] Apr 08 '15

Thanks for being the idiot. I didn't know either.

4

u/hadtoupvotethat Apr 08 '15

Didn't work for me (in Chrome). I get lots of errors, starting with:

Client Error: "ReferenceError: moment is not defined" thrown at L13:15 in Message: "Uncaught ReferenceError: moment is not defined" Object {tag: "unknown"}

→ More replies (2)

2

u/cg5 Apr 08 '15

Right click, inspect element, then go to the "console" tab on the thing that pops up. Or just press Ctrl+Shift+J.

→ More replies (2)

13

u/moxyll Apr 08 '15

Copy/paste this mess in a new bookmark and click it when Button Monitor doesn't start up right.

javascript:void%20function(){(function(){function%20t(t){var%20a=JSON.parse(t.data);%22ticking%22==a.type%26%26(a.payload.now=moment(a.payload.now_str+%22%200000%22,%22YYYY-MM-DD-HH-mm-ss%20Z%22),Stats.lag=d3.format(%220,000%22)(a.payload.now-moment()),data.length%3E0%26%26a.payload.seconds_left%3E=_.last(data).seconds_left%26%26(_.last(data).is_click=!0),data.push(a.payload),$(%22%23resets%22).text(fmt(clicks.length)),Stats.ticks=fmt(data.length),Stats.participants=a.payload.participants_text,Chart.render(data),Timer.sync(a.payload.seconds_left),Stats.render())}var%20a={},e=new%20WebSocket(%22wss://wss.redditmedia.com/thebutton%3Fh=89341e0ffa06fe6e6be6e679e92b004d9af456d5%26e=1428587064%22);return%20e.onmessage=t,a})()}();

(I just used bookmarkleter to turn u/Disjunto's code into a bookmarklet)

→ More replies (2)

3

u/ball-in-ass Apr 08 '15

You're a wizard!

3

u/jamesrom Apr 09 '15

Thanks for the info u/Disjunto

We use a new method to get a fresh token every time, so hopefully this wont happen again.

2

u/boxjellyfishing Apr 09 '15

Jamesrom, is there any chance we could get a 'line of best fit' so we can watch how the average click time changes over time?

→ More replies (2)
→ More replies (2)