Add debug logging to easter egg trigger
This commit is contained in:
parent
181195dbbc
commit
75b20e6ca2
@ -41,29 +41,43 @@
|
||||
var tapTimer = null;
|
||||
var lastTouch = 0;
|
||||
|
||||
function registerTap() {
|
||||
if (active) return;
|
||||
function registerTap(source, target) {
|
||||
if (active) { console.log('[🎈 easter egg] already active, ignoring'); return; }
|
||||
tapCount++;
|
||||
clearTimeout(tapTimer);
|
||||
tapTimer = setTimeout(function () { tapCount = 0; }, 3000);
|
||||
tapTimer = setTimeout(function () {
|
||||
console.log('[🎈 easter egg] tap window expired, resetting count');
|
||||
tapCount = 0;
|
||||
}, 3000);
|
||||
console.log('[🎈 easter egg] tap ' + tapCount + '/5 via ' + source + ' on <' + (target.tagName || '?').toLowerCase() + '>');
|
||||
if (tapCount >= 5) {
|
||||
tapCount = 0;
|
||||
console.log('[🎈 easter egg] launching!');
|
||||
launch();
|
||||
}
|
||||
}
|
||||
|
||||
// touchstart for mobile (fires immediately, not affected by scroll)
|
||||
document.addEventListener('touchstart', function (e) {
|
||||
if (e.target.closest('input, select, textarea')) return;
|
||||
if (e.target.closest('input, select, textarea')) {
|
||||
console.log('[🎈 easter egg] touchstart ignored — form element');
|
||||
return;
|
||||
}
|
||||
lastTouch = Date.now();
|
||||
registerTap();
|
||||
registerTap('touch', e.target);
|
||||
}, { 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();
|
||||
if (Date.now() - lastTouch < 500) {
|
||||
console.log('[🎈 easter egg] click deduplicated (touch fired recently)');
|
||||
return;
|
||||
}
|
||||
if (e.target.closest('input, select, textarea')) {
|
||||
console.log('[🎈 easter egg] click ignored — form element');
|
||||
return;
|
||||
}
|
||||
registerTap('click', e.target);
|
||||
});
|
||||
|
||||
function launch() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user