From 181195dbbc0ade24761355a4fed5228534a64051 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 6 Jun 2026 21:23:05 -0400 Subject: [PATCH] Fix easter egg trigger: use touchstart on mobile, 5 taps in 3s click events are unreliable on mobile due to scroll handling. Use touchstart (fires immediately) for mobile and click for desktop with deduplication. Lower threshold to 5 taps, widen window to 3 seconds. Co-Authored-By: Claude Sonnet 4.6 --- main-site/easter-egg.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main-site/easter-egg.js b/main-site/easter-egg.js index 2db1bc9..3693d5e 100644 --- a/main-site/easter-egg.js +++ b/main-site/easter-egg.js @@ -39,20 +39,31 @@ var active = false; var tapCount = 0; var tapTimer = null; + var lastTouch = 0; - // 7 quick taps on any non-interactive part of the page triggers it - document.addEventListener('click', function (e) { + function registerTap() { if (active) return; - if (e.target.closest('a, button, input, select, textarea, label')) return; - tapCount++; clearTimeout(tapTimer); - tapTimer = setTimeout(function () { tapCount = 0; }, 2000); - - if (tapCount >= 7) { + tapTimer = setTimeout(function () { tapCount = 0; }, 3000); + if (tapCount >= 5) { tapCount = 0; launch(); } + } + + // touchstart for mobile (fires immediately, not affected by scroll) + document.addEventListener('touchstart', function (e) { + if (e.target.closest('input, select, textarea')) return; + lastTouch = Date.now(); + registerTap(); + }, { passive: true }); + + // click for desktop (deduplicated from touch events) + document.addEventListener('click', function (e) { + if (Date.now() - lastTouch < 500) return; // already counted via touchstart + if (e.target.closest('input, select, textarea')) return; + registerTap(); }); function launch() {