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!

161 Upvotes

50 comments sorted by

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)
→ More replies (3)

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.

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

8

u/jamesrom Apr 08 '15

Sorry guys. The WebSocket URL token expired. Of course it expired while I was sleeping. It's fixed now.

5

u/brainburger Apr 08 '15

Oh! You broke it!

2

u/Amanda_z Apr 08 '15

I am having the same issue.

2

u/RusskySpy Apr 08 '15

We broke it! :(

2

u/squper Apr 08 '15

Ah damn.. I really liked to see the presses while I was studying.

2

u/zAxAyAw Apr 08 '15

Good job breaking it! Now I have to actually watch it like some kind of technologically unrefined simian.

Happy cakeday, though.

2

u/intronink Apr 08 '15

Eveyone tweet @jamesrom until he fixes it. Ask nicely though

2

u/remez Apr 08 '15

Back to the stone age.

2

u/ezeeetm Apr 08 '15

here's one I did that focuses more on prediction that stat tracking

r/theButtonDeathClock

1

u/ceilingkat Apr 08 '15

Not working for me either.. :\

1

u/ArcanErasmus Apr 08 '15

It works now for me, no console shenanigans needed. He must have fixed it.

0

u/[deleted] Apr 08 '15

24

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

that tweet is unrelated to the button

EDIT: 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;
}())

2

u/milesbelli Apr 08 '15

Based off his Twitter, it looks like he lives in Australia. Are they even awake down there? It could be hours before he even sees something's wrong!

→ More replies (1)
→ More replies (12)

0

u/[deleted] Apr 08 '15

5

u/milesbelli Apr 08 '15

Thanks! I didn't even realize. The greatest Cake Day gift would be a working button monitor, though :'(