Permalink
Browse files

Delay advancing hints after manual advances

  • Loading branch information...
1 parent 2774ec7 commit 689c2acf0b0c0f96aa9d46ab7115983d4e087f85 @nmalkin committed Apr 6, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/frontend/startup.coffee
@@ -190,13 +190,21 @@ $(document).ready ->
showHint hint
# Rotate hints every 15 seconds
+ timeoutReset = false
setInterval (->
- showHint ++hint % HINTS.length
+ if timeoutReset # There was a manual advance.
+ timeoutReset = false # Wait an extra cycle.
+ else # Show next hint
+ showHint ++hint % HINTS.length
), 1000*15
# ...or when the user advances them manually
- $(PREVIOUS_HINT).click -> showHint ((--hint % HINTS.length) + HINTS.length) % HINTS.length
- $(NEXT_HINT).click -> showHint ++hint % HINTS.length
+ $(PREVIOUS_HINT).click ->
+ timeoutReset = true
+ showHint ((--hint % HINTS.length) + HINTS.length) % HINTS.length
+ $(NEXT_HINT).click ->
+ timeoutReset = true
+ showHint ++hint % HINTS.length
importRooms = () ->

0 comments on commit 689c2ac

Please sign in to comment.