Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/_includes/footer.njk
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,34 @@
</div>

<div class="grid grid-cols-2 gap-1.5 mb-2">
<button onclick="triggerSecretUnlock('matrix')" class="py-1.5 bg-green-500/5 hover:bg-green-500/20 text-green-500 text-[8px] border border-green-500/20 rounded transition-all">
<button onclick="triggerSecretUnlock('matrix')" class="override-btn py-1.5 bg-green-500/5 hover:bg-green-500/20 text-green-500 text-[8px] border border-green-500/20 rounded transition-all">
MATRIX
</button>
<button onclick="triggerSecretUnlock('konami')" class="py-1.5 bg-yellow-500/5 hover:bg-yellow-500/20 text-yellow-500 text-[8px] border border-yellow-500/20 rounded transition-all">
<button onclick="triggerSecretUnlock('konami')" class="override-btn py-1.5 bg-yellow-500/5 hover:bg-yellow-500/20 text-yellow-500 text-[8px] border border-yellow-500/20 rounded transition-all">
KONAMI
</button>
<button onclick="triggerSecretUnlock('gravity')" class="py-1.5 bg-red-500/5 hover:bg-red-500/20 text-red-500 text-[8px] border border-red-500/20 rounded transition-all">
<button onclick="triggerSecretUnlock('gravity')" class="override-btn py-1.5 bg-red-500/5 hover:bg-red-500/20 text-red-500 text-[8px] border border-red-500/20 rounded transition-all">
GRAVITY
</button>
<button onclick="triggerSecretUnlock('badge_click')" class="py-1.5 bg-purple-500/5 hover:bg-purple-500/20 text-purple-400 text-[8px] border border-purple-500/20 rounded transition-all">
<button onclick="triggerSecretUnlock('badge_click')" class="override-btn py-1.5 bg-purple-500/5 hover:bg-purple-500/20 text-purple-400 text-[8px] border border-purple-500/20 rounded transition-all">
BADGE_XP
</button>
</div>

<div class="space-y-1 mb-2">
<button onclick="addExperience(5); playSound('click');" class="w-full flex justify-between px-2 py-1 bg-cyan-500/5 text-cyan-400 text-[8px] border border-cyan-500/20 rounded">
<button onclick="addExperience(5); playSound('click');" class="override-btn w-full flex justify-between px-2 py-1 bg-cyan-500/5 text-cyan-400 text-[8px] border border-cyan-500/20 rounded">
<span>💎 SKILL_MINER</span>
<span class="opacity-50">+5</span>
</button>
<button onclick="addExperience(15); playSound('restore');" class="w-full flex justify-between px-2 py-1 bg-pink-500/5 text-pink-400 text-[8px] border border-pink-500/20 rounded">
<button onclick="addExperience(15); playSound('restore');" class="override-btn w-full flex justify-between px-2 py-1 bg-pink-500/5 text-pink-400 text-[8px] border border-pink-500/20 rounded">
<span>🛠️ SYS_OPTIMIZE</span>
<span class="opacity-50">+15</span>
</button>
<button onclick="triggerMagicXP(); playSound('levelUp');" class="w-full flex justify-between px-2 py-1.5 bg-gradient-to-r from-purple-600/20 to-blue-600/20 text-purple-400 text-[8px] border border-purple-500/30 rounded hover:from-purple-600/40 hover:to-blue-600/40 transition-all group">
<button onclick="triggerMagicXP(); playSound('levelUp');" class="override-btn w-full flex justify-between px-2 py-1.5 bg-gradient-to-r from-purple-600/20 to-blue-600/20 text-purple-400 text-[8px] border border-purple-500/30 rounded hover:from-purple-600/40 hover:to-blue-600/40 transition-all group">
<span>✨ CAST_MAGIC_XP</span>
<span class="group-hover:animate-pulse">+50 XP</span>
</button>
<button onclick="toggleScreenshotMode()" class="w-full flex justify-between px-2 py-1 bg-white/5 text-slate-400 text-[8px] border border-white/10 rounded">
<button onclick="toggleScreenshotMode()" class="override-btn w-full flex justify-between px-2 py-1 bg-white/5 text-slate-400 text-[8px] border border-white/10 rounded">
<span>📸 SCREENSHOT</span>
<span class="opacity-50">[5 Seconds]</span>
</button>
Expand All @@ -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;"
>
<button
onclick="jumpToLevel()"
class="flex-1 bg-accent/20 hover:bg-accent/40 text-accent text-[10px] font-black py-1 rounded transition-all border border-accent/40 uppercase"
class="override-btn flex-1 bg-accent/20 hover:bg-accent/40 text-accent text-[10px] font-black py-1 rounded transition-all border border-accent/40 uppercase"
style="height: 30px !important;"
>
EXECUTE
Expand All @@ -106,11 +107,11 @@
</div>

<div class="flex gap-1.5 pt-2 border-t border-white/10">
<button id="self-destruct-btn" onclick="startSelfDestruct()" class="flex-1 py-1.5 bg-red-600/10 hover:bg-red-600/30 text-red-500 text-[8px] border border-red-500/30 rounded flex justify-center gap-1">
<button id="self-destruct-btn" onclick="startSelfDestruct()" class="override-btn flex-1 py-1.5 bg-red-600/10 hover:bg-red-600/30 text-red-500 text-[8px] border border-red-500/30 rounded flex justify-center gap-1">
<span id="destruct-text">DESTRUCT</span>
<span id="destruct-timer"></span>
</button>
<button onclick="localStorage.clear(); location.reload();" class="px-2 py-1.5 bg-blue-600/10 hover:bg-blue-600/30 text-blue-400 text-[8px] border border-blue-500/20 rounded uppercase">
<button onclick="localStorage.clear(); location.reload();" class="override-btn px-2 py-1.5 bg-blue-600/10 hover:bg-blue-600/30 text-blue-400 text-[8px] border border-blue-500/20 rounded uppercase">
Reset
</button>
</div>
Expand Down
86 changes: 70 additions & 16 deletions src/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,23 @@ 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';
[523.25, 659.25, 783.99, 1046.50].forEach((freq, i) => {
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') {
Expand Down Expand Up @@ -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));
Expand All @@ -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.`);
}
}
Expand All @@ -682,13 +684,31 @@ 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');

localStorage.setItem('devToolsVisible', !isOpening);
playSound(isOpening ? 'secret' : 'click');

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]) {
Expand All @@ -703,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(() => {
Expand Down Expand Up @@ -803,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
*/
Expand Down
Loading