From 0e9e967283ce1319893f50f542e7ebfe8c713191 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Tue, 27 Jan 2026 05:15:57 +1000 Subject: [PATCH 1/2] Focus on d overrides --- src/_includes/footer.njk | 23 ++++++++++++----------- src/assets/js/script.js | 26 ++++++++++++++++++++------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/_includes/footer.njk b/src/_includes/footer.njk index d95ede8..1c31795 100644 --- a/src/_includes/footer.njk +++ b/src/_includes/footer.njk @@ -52,34 +52,34 @@
- - - -
- - - - @@ -93,11 +93,12 @@ placeholder="0" min="0" max="200" + class="override-btn" style="background-color: #000 !important; color: #00ffcc !important; border: 1px solid #00ffcc !important; width: 60px !important; height: 30px !important; font-size: 14px !important; padding: 0 5px !important; border-radius: 4px !important;" >
- -
diff --git a/src/assets/js/script.js b/src/assets/js/script.js index cc244f0..c02d390 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -682,13 +682,27 @@ window.addEventListener('keydown', (e) => { if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; if (key === 'd') { - const devPanel = document.getElementById('dev-tools'); - if (devPanel) { - const isHidden = devPanel.classList.toggle('hidden'); - localStorage.setItem('devToolsVisible', !isHidden); - playSound(isHidden ? 'click' : 'secret'); + e.preventDefault(); + + const systemDash = document.getElementById('dev-tools'); // Adjust ID as needed + const isOpening = systemDash.classList.contains('hidden'); + + if (isOpening) { + document.getElementById('matrix-console-container').classList.add('hidden'); + systemDash.classList.remove('hidden'); + + // Wait 100-150ms for the animation/display to settle + setTimeout(() => { + // Find the first interactive element (button or link) + const firstControl = systemDash.querySelector('button, a, input'); + if (firstControl) { + firstControl.focus(); + } + }, 150); + } else { + systemDash.classList.add('hidden'); + document.body.focus(); // Return focus to the page } - return; } if (key === konamiCode[konamiPosition]) { From 0f300c433c0ff7cb91c1bae4c0da2e62328118f3 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Tue, 27 Jan 2026 05:55:34 +1000 Subject: [PATCH 2/2] Fix sounds --- src/assets/js/script.js | 60 ++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index c02d390..b7043d4 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -299,11 +299,11 @@ function playSound(type) { else if (type === 'levelUp') { osc.type = 'square'; osc.frequency.setValueAtTime(440, now); - osc.frequency.exponentialRampToValueAtTime(880, now + 0.2); + osc.frequency.exponentialRampToValueAtTime(880, now + 0.4); gain.gain.setValueAtTime(0.15, now); - gain.gain.exponentialRampToValueAtTime(0.01, now + 0.4); + gain.gain.exponentialRampToValueAtTime(0.01, now + 1.0); osc.start(now); - osc.stop(now + 0.4); + osc.stop(now + 1.5); } else if (type === 'secret') { osc.type = 'triangle'; @@ -311,11 +311,11 @@ function playSound(type) { const s = audioCtx.createOscillator(); const g = audioCtx.createGain(); s.connect(g); g.connect(audioCtx.destination); - s.frequency.setValueAtTime(freq, now + i * 0.1); - g.gain.setValueAtTime(0.07, now + i * 0.1); - g.gain.exponentialRampToValueAtTime(0.01, now + i * 0.1 + 0.1); - s.start(now + i * 0.1); - s.stop(now + i * 0.1 + 0.1); + s.frequency.setValueAtTime(freq, now + i * 0.3); + g.gain.setValueAtTime(0.07, now + i * 0.3); + g.gain.exponentialRampToValueAtTime(0.01, now + i * 0.3 + 0.3); + s.start(now + i * 0.3); + s.stop(now + i * 0.3 + 0.3); }); } else if (type === 'restore') { @@ -655,6 +655,7 @@ function triggerSecretUnlock(type) { // 3. Only process XP and Save if it's the first time if (isNewUnlock) { + playSound('secret'); // Update the array and save to localStorage unlockedEggs.push(eggId); localStorage.setItem('unlockedEggs', JSON.stringify(unlockedEggs)); @@ -670,6 +671,7 @@ function triggerSecretUnlock(type) { console.log(`✨ Secret Unlocked: ${eggId}`); } else { + playSound('click'); console.log(`Secret ${eggId} already discovered. No extra XP granted.`); } } @@ -687,7 +689,11 @@ window.addEventListener('keydown', (e) => { const systemDash = document.getElementById('dev-tools'); // Adjust ID as needed const isOpening = systemDash.classList.contains('hidden'); + localStorage.setItem('devToolsVisible', !isOpening); + playSound(isOpening ? 'secret' : 'click'); + if (isOpening) { + document.getElementById('matrix-console-container').classList.add('hidden'); systemDash.classList.remove('hidden'); @@ -717,13 +723,12 @@ window.addEventListener('keydown', (e) => { }); function activateKonami() { - playSound('secret'); document.documentElement.classList.add('konami-roll'); setTimeout(() => document.documentElement.classList.remove('konami-roll'), 2000); } function activateGravityEffect() { - playSound('secret'); + document.body.classList.add('glitch-shake'); setTimeout(() => { @@ -817,6 +822,41 @@ function closeMatrix() { window.removeEventListener('keydown', handleMatrixEsc); } + +let hasTriggeredFirstLevel = false; // Prevents the sound from spamming every click + +function triggerBadgeLevelUp() { + const badge = document.getElementById('level-badge'); + + // 1. Visual Pop Animation + if (badge) { + badge.classList.remove('animate-badge-pop'); + void badge.offsetWidth; // Force reflow to restart animation + badge.classList.add('animate-badge-pop'); + } + + // 2. Secret Sound & Level Logic + if (!hasTriggeredFirstLevel) { + // Play your secret sound + playSound('secret'); + + // Force a level up for the "first time" experience + addExperience(45); // Assuming 45 XP = 1 Level + + hasTriggeredFirstLevel = true; + + // Push a special "Easter Egg" message to the Matrix Console + if (typeof matrixConsoleLog === 'function') { + matrixConsoleLog(currentLevel); + } + } +} + +// Attach to the badge click +document.getElementById('level-badge').addEventListener('click', triggerBadgeLevelUp); + + + /** * 7. SELF DESTRUCT ENGINE */