Fix easter egg trigger: 7 quick taps on non-interactive area

Long press on the logo link was unreliable. Switch to detecting 7 rapid
taps on any non-link/button area within 2 seconds — works on mobile and
desktop without conflicting with navigation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chris 2026-06-06 21:15:26 -04:00
parent 2002d7f35a
commit 066364d2b7

View File

@ -37,30 +37,23 @@
}
var active = false;
var pressTimer = null;
var tapCount = 0;
var tapTimer = null;
function startPress() {
pressTimer = setTimeout(function () {
if (!active) launch();
}, 600);
}
// 7 quick taps on any non-interactive part of the page triggers it
document.addEventListener('click', function (e) {
if (active) return;
if (e.target.closest('a, button, input, select, textarea, label')) return;
function cancelPress() {
clearTimeout(pressTimer);
}
tapCount++;
clearTimeout(tapTimer);
tapTimer = setTimeout(function () { tapCount = 0; }, 2000);
// Long-press on the navbar brand (logo area)
document.addEventListener('mousedown', function (e) {
if (e.target.closest('.navbar-brand')) startPress();
if (tapCount >= 7) {
tapCount = 0;
launch();
}
});
document.addEventListener('mouseup', cancelPress);
document.addEventListener('mouseleave', cancelPress);
document.addEventListener('touchstart', function (e) {
if (e.target.closest('.navbar-brand')) startPress();
}, { passive: true });
document.addEventListener('touchend', cancelPress);
document.addEventListener('touchmove', cancelPress);
function launch() {
active = true;