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:
parent
2002d7f35a
commit
066364d2b7
@ -37,30 +37,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var active = false;
|
var active = false;
|
||||||
var pressTimer = null;
|
var tapCount = 0;
|
||||||
|
var tapTimer = null;
|
||||||
|
|
||||||
function startPress() {
|
// 7 quick taps on any non-interactive part of the page triggers it
|
||||||
pressTimer = setTimeout(function () {
|
document.addEventListener('click', function (e) {
|
||||||
if (!active) launch();
|
if (active) return;
|
||||||
}, 600);
|
if (e.target.closest('a, button, input, select, textarea, label')) return;
|
||||||
|
|
||||||
|
tapCount++;
|
||||||
|
clearTimeout(tapTimer);
|
||||||
|
tapTimer = setTimeout(function () { tapCount = 0; }, 2000);
|
||||||
|
|
||||||
|
if (tapCount >= 7) {
|
||||||
|
tapCount = 0;
|
||||||
|
launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelPress() {
|
|
||||||
clearTimeout(pressTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Long-press on the navbar brand (logo area)
|
|
||||||
document.addEventListener('mousedown', function (e) {
|
|
||||||
if (e.target.closest('.navbar-brand')) startPress();
|
|
||||||
});
|
});
|
||||||
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() {
|
function launch() {
|
||||||
active = true;
|
active = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user