Skip to content

Commit f26707a

Browse files
authored
Fix levelups add mobile tap (#234)
1 parent 676d93c commit f26707a

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/assets/js/script.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,22 @@ function unlockEgg(eggId) {
147147
updateGameUI();
148148
}
149149
}
150-
151150
/**
152151
* UNIVERSAL EGG UNLOCKER
153-
* First trigger of any secret adds +1 to Level progress
152+
* Grants exactly one level per unique secret type.
154153
*/
155154
function triggerSecretUnlock(effectType) {
156-
if (effectType === 'matrix') initMatrix();
157-
else if (effectType === 'konami') activateKonami();
158-
else if (effectType === 'gravity') triggerGravity(null);
155+
// 1. Run the Visuals (These run every time)
156+
if (effectType === 'matrix') {
157+
initMatrix();
158+
} else if (effectType === 'konami') {
159+
activateKonami();
160+
} else if (effectType === 'gravity') {
161+
triggerGravity(null);
162+
}
159163

164+
// 2. Grant Level (Only runs the VERY first time for each ID)
165+
// IDs are static: 'secret_matrix', 'secret_konami', 'secret_gravity'
160166
unlockEgg(`secret_${effectType}`);
161167
}
162168

@@ -232,6 +238,7 @@ function scrollToRandomUser() {
232238
surpriseClickCount++;
233239
if (surpriseClickCount >= 5) {
234240
surpriseClickCount = 0;
241+
// This now checks for 'secret_matrix' and won't level up twice
235242
triggerSecretUnlock('matrix');
236243
}
237244

@@ -356,6 +363,23 @@ function closeMatrix() {
356363
}
357364

358365
document.addEventListener('DOMContentLoaded', () => {
366+
// Secret: Triple-tap the copyright year in the footer to open Dev Tools on mobile
367+
const footerYear = document.getElementById('current-year');
368+
let tapCount = 0;
369+
370+
if (footerYear) {
371+
footerYear.addEventListener('touchstart', () => {
372+
tapCount++;
373+
if (tapCount === 3) {
374+
const devPanel = document.getElementById('dev-tools');
375+
devPanel.classList.toggle('hidden');
376+
playSound('secret');
377+
tapCount = 0;
378+
}
379+
// Reset count if they stop tapping for 1 second
380+
setTimeout(() => { tapCount = 0; }, 1000);
381+
});
382+
}
359383
applyTheme(localStorage.getItem('theme') || 'light');
360384
updateGameUI();
361385
});

0 commit comments

Comments
 (0)