diff --git a/main-site/easter-egg.js b/main-site/easter-egg.js index 698542d..2db1bc9 100644 --- a/main-site/easter-egg.js +++ b/main-site/easter-egg.js @@ -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;