Hide play/pause once someone has run out

At a flag the game is over and togglePause is inert anyway — pauseNow
needs RUN, resumeNow needs PAUSE — so the button was there without being
able to do anything. It joins the other two visibility rules in render():
vacant at IDLE or FLAG. Reset stays, being the way out of a finished
game, and the bar comes down to Reset, score and sound.

Checked the whole state machine: shown while running and while paused,
vacant before a game's first tap and at a flag, and pausing and resuming
still work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 20:20:30 +02:00
co-authored by Claude Opus 5
parent 998009629b
commit 9815b04e35
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -69,8 +69,8 @@ everything works except installation and the service worker.
included. Opening either sheet pauses automatically. The settings sheet leaves
it paused — everything in there resets the clocks anyway — while the score
sheet picks the turn back up when you close it, so glancing at the score
doesn't cost you a tap on play. It's absent before each game's first tap, with
no clock running to freeze.
doesn't cost you a tap on play. It's absent whenever there's no clock running
to freeze: before each game's first tap, and once someone has run out of time.
Both buttons keep their space in the bar while they're away, so nothing shifts
under your thumb — the same as the gear.
+3 -1
View File
@@ -811,7 +811,9 @@
var pristine = matchPristine();
btnSettings.classList.toggle("btn--vacant", !pristine);
btnReset.classList.toggle("btn--vacant", pristine); // nothing played to reset
btnPlay.classList.toggle("btn--vacant", st.phase === IDLE); // nothing running to pause
// nothing running to pause: before a game's first tap, and after a flag,
// where togglePause is inert anyway — the game is over, Reset is the way out
btnPlay.classList.toggle("btn--vacant", st.phase === IDLE || st.phase === FLAG);
}
function loop(){ render(); requestAnimationFrame(loop); }
+1 -1
View File
@@ -1,5 +1,5 @@
/* Cache-first: once installed the clock never touches the network again. */
const CACHE = "bgclock-v16";
const CACHE = "bgclock-v17";
const FILES = [
"./",
"./index.html",