r/thebutton • 59s • Apr 23 '15

Using /u/timhuge's method I made a script that displays a timer that's synced with the server so you can get the number you want

Gif of it working: link

/u/timhuge's original thread: link

Installation: Copy the following code into a bookmark and run when you're on /r/thebutton

javascript:$('<span id="count">??</div>').insertBefore(".thebutton-container:first"),$("#count").css({"background-color":"#888","min-width":"48px","max-width":"48px",height:"48px",color:"#ffffff","border-radius":"48px","text-align":"center","font-size":"32px","font-family":"verdana,arial,helvetica,sans-serif","vertical-align":"middle","line-height":"48px","font-weight":"normal",border:"none",outline:"none",display:"block",position:"relative","float":"left","margin-top":"20px"}),r.thebutton._websocket.on({"message:ticking":function(o){o.seconds_left>51&&$("#count").css("background-color","#820080"),o.seconds_left<=51&&o.seconds_left>42&&$("#count").css("background-color","#0083C7"),o.seconds_left<=41&&o.seconds_left>32&&$("#count").css("background-color","#02be01"),o.seconds_left<=31&&o.seconds_left>22&&$("#count").css("background-color","#E5D900"),o.seconds_left<=21&&o.seconds_left>12&&$("#count").css("background-color","#e59500"),o.seconds_left<=11&&$("#count").css("background-color","#e50000"),$("#count").text(o.seconds_left),document.title="["+o.seconds_left+"] the button"}});        

Enjoy.

Also, my coding skills are pretty much garbage, so any suggestions to improve the code would be appreciated :p

36 Upvotes

14 comments sorted by

View all comments

3

u/[deleted] Apr 23 '15

ELI5 how to copy that into a bookmark? I am using Firefox, latest version. Thanks!!!!

1

u/xanbo 60s Apr 25 '15

Click OP's link to u/timhuge's original thread.

1

u/artemus_gordon 0s May 05 '15

It only works with Chrome.