From 80e062c08464da7286ff6170904135358ea25a01 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 29 May 2026 19:14:15 -0400 Subject: [PATCH] =?UTF-8?q?zebra-audio:=20puppet=20reveal=20counts=20our?= =?UTF-8?q?=20own=20clicks=20=E2=80=94=20mobile=20taps=20work=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trigger was event.detail === 3, the native UI triple-click counter, which mouse triple-clicks increment but mobile taps do not, so the easter egg was unreachable on phones. Count 3 clicks within 800ms ourselves; desktop triple-click still satisfies it (still 3 click events), and finger taps now reveal the console. --- web/zebra-audio.html | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/web/zebra-audio.html b/web/zebra-audio.html index a1ea82b..2e2c41e 100644 --- a/web/zebra-audio.html +++ b/web/zebra-audio.html @@ -603,9 +603,17 @@ function puppetStop(){ * this inline script — wire them once the rest of the document exists */ function wirePuppet(){ const seal = $('pi-seal'); - /* native triple-click = three clicks on the same node (event.detail === 3) */ - if (seal) seal.addEventListener('click', (e) => { - if (e.detail === 3){ try { getSelection().removeAllRanges(); } catch(_){} revealPuppet(); } + /* 3 clicks within 800ms reveals the console. counting our own clicks (rather + * than checking event.detail === 3) means mobile taps work too — touch click + * events do not increment the native UI detail counter. desktop triple-click + * also fires 3 click events, so the same code path covers both. */ + let sealClicks = 0, sealTimer = null; + if (seal) seal.addEventListener('click', () => { + try { getSelection().removeAllRanges(); } catch(_){} + if (sealTimer) clearTimeout(sealTimer); + sealClicks++; + if (sealClicks >= 3){ sealClicks = 0; revealPuppet(); return; } + sealTimer = setTimeout(() => { sealClicks = 0; }, 800); }); const speak = $('puppet-speak'); if (speak) speak.addEventListener('click', () => { puppeting ? puppetStop() : puppetSpeak(); }); const close = $('puppet-close'); if (close) close.addEventListener('click', () => { puppetStop(); $('puppet').hidden = true; }); @@ -644,8 +652,8 @@ else wirePuppet();