Yet another JavaScript timer

blah

brah
Joined
Dec 30, 2007
Messages
2,139
Location
.
Here it is.

It's 40.2 kb.

Okay, so I've made another timer. It's kinda different from all other currently available timers I know of. Here's why:

  • The timer is almost entirely keyboard-controlled.
  • There are 9 events, each event has two modes: Speed and blindfolded.
  • Hit 1 for Square-1, 2 to 7 for 2x2x2 to 7x7x7, 8 for Megaminx and 9 for Pyraminx.
  • Hit the same number repeatedly to toggle between speed and blindfolded mode of that event. Switching events will NOT erase time logs of any other event.
  • In speed mode, hit the spacebar to start the timer, hit any key to stop the timer.
  • In blindfolded mode, hit the spacebar to start both the main timer and the memorization timer, hit any key to stop the memorization timer, hit any key again to stop the main timer.
  • Timer starts when the spacebar is released and stops when any key is hit (same as qqTimer).
  • In blindfolded mode, when the memorization timer stops, the screen flashes black and white 3 times to provide visual feedback. (Customizable, explained in post #29 of this thread.)
  • IMPORTANT: You can only switch events (a) when the timer is not running and (b) one second after the timer stops. (Customizable, explained in post #29 of this thread.)
  • In speed mode, once the timer stops, hit O or P for OLL parity or PLL parity, hit both keys in any order for double parity, hitting the same key repeatedly toggles it on or off.
  • In blindfolded mode, once the timer stops, hit P for parity, hitting it repeatedly toggles it on or off.
  • In speed mode, once the timer stops, hit A, E, F, G, H, J, R, N, T, U, V, Y or Z for the PLL you got. For PLLs with more than one "type", for example A(a) and A(b), hit the same key repeatedly to cycle between different "types". Hit X to nullify the PLL, hit S for a PLL skip.
  • In both modes, once the timer stops, hit D for a DNF, hit it again for a +2, hit it again to nullify the penalty.
  • In both modes, when the timer is not running, hit backspace or delete to delete the last time. (Some browsers have backspace as the hotkey to return to the last page, and Macs don't have delete keys.)
  • Clicking on any time in the time log deletes that time.
  • In both modes, when the timer is not running, hit escape to reset the time log for that mode for that event. It will not reset the time logs for any other mode or event, if you want to do this, you can hit F5 ;)
  • In both modes, when the timer is not running, hit L to highlight the last scramble and "lowlight" the current scramble. Hitting L again turns this off.
  • In both modes, when the timer is not running, hit Q repeatedly to toggle between showing the time log in simple format and in detailed format (with scrambles and solve #).
  • Hovering the cursor over the best/worst average of 5 "lowlights" all the times in the time log and leaves the best/worst 5 times the same color.
  • Hovering the cursor over the best/worst average of 12 "lowlights" all the times in the time log and highlights the best/worst 12 times.
  • Hovering the cursor over any single time in the time log displays the "hovering average" at that point, and lowlights all times but the rolling averages of 5 and 12 at that point.
  • In both modes, there is a DNF calculator that calculates the % of solves that are DNFs.
  • In both modes, there is a parity calculator that calculates the % of occurrence of each type of parity.
  • In blindfolded mode, there is a memorization:execution time ratio calculator.
  • Read post #29 of this thread for customization of the timer.
  • All stats are made into a very nice copy-and-paste-anywhere format.
  • There are some other miscellaneous stuff not mentioned here, like there's a standard deviation calculator and some other stuff, but these should be pretty trivial once you start using the timer.

The Pyraminx scrambler isn't added yet. The 2x2x2 scrambler currently generates 25 random moves. I'll add the optimal random state scrambler soon. All other scramblers are official WCA scramblers taken directly from the WCA regulations page.

I hope there aren't any more bugs or problems with this. I've tried to make the code as readable as possible so others could help fix bad code. I've only learned JavaScript for a week, so yeah :o Please tell me if there's anything wrong with the timer, thanks :)

Edit: Unfortunately, I've only tested this in Firefox in Linux Ubuntu because that's the only thing I have, so I'm gonna need lotsa feedback from other guys using other OSes and other browsers, yup.
 
Last edited:
Nice but it has a similar bug to qqs:
I notice if the timer is running, and I press the spacebar to stop it and I hold it for longer than a second or so, when I release, it starts the timer again.
which should be a straightforward fix.

Perhaps add a "help" menu somewhere too, as a reference for what keystrokes do what ;)

All in all, very nice, and especially impressive considering you've only been working with javascript for a week or so.
 
I like this timer! It looks really really nice, it's easy to handle, though I think you need to read about the keyboard-stuff (maybe you could include a tiny tiny questionmark somewhere so that people would be linked to this thread, because I don't think people would figure out that you can tell the timer which PLL you had (for example)).
The Last Scramble-Thing is cool, all those calculated %s, and I like the special memo-timer in blindfolded.

I've tried to make the code as readable as possible so others could help fix bad code. I've only learned JavaScript for a week, so yeah :o Please tell me if there's anything wrong with the timer, thanks :)

Nononono, you wouldn't want me to help you fixing bad code, and I can't anyway... ;) Programming is like a mystery to me. :) But I can tell you what I think might be wrong:

Say I solved 7 cubes, and I press Q, I get the detailed time-log, but only with the first solve and it's scramble.
If I have around 16 solves in the log and press Q, it works, and I can see all the times and scrambles in detail.
Am I the only one with this problem?
 
Nice but it has a similar bug to qqs:
I notice if the timer is running, and I press the spacebar to stop it and I hold it for longer than a second or so, when I release, it starts the timer again.
which should be a straightforward fix.

Perhaps add a "help" menu somewhere too, as a reference for what keystrokes do what ;)

All in all, very nice, and especially impressive considering you've only been working with javascript for a week or so.
That's not the timer's problem in my experience, I believe it's your computer. I've tried going to my computer keyboard settings and disabled the "key presses repeat when key is held down" option, and the problem disappeared, so you might wanna try that :)

Yeah I've been meaning to add that help menu for a while now, but I haven't had the time these days, just moved into college, got a lot of stuff to do, I'll do that when I get a little more free time in a week or two.

I like this timer! It looks really really nice, it's easy to handle, though I think you need to read about the keyboard-stuff (maybe you could include a tiny tiny questionmark somewhere so that people would be linked to this thread, because I don't think people would figure out that you can tell the timer which PLL you had (for example)).
The Last Scramble-Thing is cool, all those calculated %s, and I like the special memo-timer in blindfolded.

I've tried to make the code as readable as possible so others could help fix bad code. I've only learned JavaScript for a week, so yeah :o Please tell me if there's anything wrong with the timer, thanks :)

Nononono, you wouldn't want me to help you fixing bad code, and I can't anyway... ;) Programming is like a mystery to me. :) But I can tell you what I think might be wrong:

Say I solved 7 cubes, and I press Q, I get the detailed time-log, but only with the first solve and it's scramble.
If I have around 16 solves in the log and press Q, it works, and I can see all the times and scrambles in detail.
Am I the only one with this problem?
I guess so. Anyone else have this problem? I tried it and it worked fine on mine. You might wanna printscreen the thing and post it here so I can see the before/after you hit Q and hopefully figure out what's wrong.

I've only tested this in Firefox in Linux Ubuntu, because it's the only thing I have right now :(

can't I change the timer color?
I searched, but couldn't find...
Oh yeah, that, I'll add an option to change it later, forgot about that :o
 
Nice but it has a similar bug to qqs:
I notice if the timer is running, and I press the spacebar to stop it and I hold it for longer than a second or so, when I release, it starts the timer again.
which should be a straightforward fix.
That's not the timer's problem in my experience, I believe it's your computer. I've tried going to my computer keyboard settings and disabled the "key presses repeat when key is held down" option, and the problem disappeared, so you might wanna try that :)
Now that you point it out, I guess it is due to that.

I'd still consider it a bug though - the issue will appear on most computers using their defaut system settings, and the user won't know what to do about it. I'm not going to turn off that setting just to make the timer work properly... ;)
 
I love how you added the 'Q' function! I'd definitely use this for averages of 12, perhaps more, but honestly I'd still use CCT for big averages..say 50 or 100 cos you can save the session and very conveniently view the RA of 5/12 from the table..

Anyway, this is as good as it gets for 40kb and I think it's a great as it is now.
 
Works pretty well in Chrome, using WinXP.
Nice timer, I also am the kind of minimalistic coder and user. I also like the customizable code, anyway, it is a waste of code in most cases. For a one-week project, nice nonetheless!
 
I can't wait for time logging. I'm just too lazy to copy all those times to a notepad or something and save it. It makes my computer a little messy with all those files. Which is why I like CCT.
 
I did a screen-print.
One the right it says I solved 5 cubes, but it only shows the first solve when I press Q...
 

Attachments

  • testtimer10.jpg
    testtimer10.jpg
    144.4 KB · Views: 22
My only problem is that when I press the space bar my browser tries to scroll down and hides half the timer every time. I do have a small screen, though, and my browser always has issues like that. (chrome, winXP, btw)
 
I did a screen-print.
One the right it says I solved 5 cubes, but it only shows the first solve when I press Q...

This problem seems to happen to IE only. Tested in on Safari, Firefox, Opera and IE (winXP) - only IE gave that result. All others were working as supposed to.

EDIT: You might want to change title to something else than "test timer 10", lol.
 
Last edited:
Works pretty well in Chrome, using WinXP.
Nice timer, I also am the kind of minimalistic coder and user. I also like the customizable code, anyway, it is a waste of code in most cases. For a one-week project, nice nonetheless!
Well, you can help me out here, because the only thing I know is if/else and for :o Seriously, that's all I know :p
 
25. It was the 2008 WCA regulations, so I guess it's not "a bit too much". I still don't have the time I need to go through the optimal scrambler code :( So you'd have to use that for now, sorry.
 
Back
Top