From 080f516f53102ea1efd84a3e926a813e2109c778 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Sun, 16 Aug 2026 23:43:48 +0100 Subject: [PATCH] Vote page: let the last progress segment fill before moving on --- static/js/vote.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/static/js/vote.js b/static/js/vote.js index fcdcab2..b255c0c 100644 --- a/static/js/vote.js +++ b/static/js/vote.js @@ -34,6 +34,10 @@ function lsGet(k) { try { return localStorage.getItem(k); } catch { return null; function lsSet(k, v) { try { localStorage.setItem(k, v); } catch { /* private mode */ } } +// the segment fill in app.css takes .5 s, plus a beat to see the ring complete +const FILL_MS = 650; +let landing = false; + function renderDots(n) { const box = $("#dots"); paintRing(box, n, required, 150); @@ -140,7 +144,7 @@ function stopScanner() { } function onScan(token) { - if (sent.has(token)) return; + if (landing || sent.has(token)) return; sent.add(token); submitToken(token); } @@ -169,7 +173,11 @@ function handleScan(r) { $("#code").focus(); break; case "enrolled": - enrolled(); + // the 5th code answers "enrolled" straight away: fill the last segment and let it land first + if (landing) break; + landing = true; + renderDots(required); + setTimeout(() => { landing = false; enrolled(); }, FILL_MS); break; case "closed": block("Inscriptions closes."); @@ -332,11 +340,11 @@ function collectPresence(n) { $("#p-msg").textContent = ""; dlg.showModal(); const sc = makeScanner($("#p-video"), (t) => { - if (got.includes(t)) return; + if (got.length >= n || got.includes(t)) return; got.push(t); paint(); navigator.vibrate?.(15); - if (got.length >= n) finish(got); + if (got.length >= n) setTimeout(() => finish(got), FILL_MS); }); let done, finished = false; const result = new Promise((res) => { done = res; });