From b0241787eada6d21612c57571b011bea863f01f1 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Wed, 2 Jul 2025 00:28:45 +0530 Subject: Fixes and Features * Fixes ENTER button doesn't close the intro modal * Implements glitch effect for Terminal * Pressing ENTER button on intro modal will now close the modal --- player.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'player.js') diff --git a/player.js b/player.js index 37fb33f..3e3bd0d 100644 --- a/player.js +++ b/player.js @@ -143,13 +143,30 @@ initProgressBar(); }); + document.getElementById("enterButton")?.addEventListener("click", async () => { + var hydra = new Hydra({ detectAudio: false }); + modalEl.classList.remove("open"); + + // Show the music player and progress bar with a slight delay for better effect + setTimeout(() => { + showPlayerInterface(); + }, 300); // Small delay to let the modal close animation start + + getMusic().then(() => { + playMusic(); + }); + initHydra(); + initControls(); + initProgressBar(); + }); + document.getElementById("history").addEventListener("click", () => { downloadHistory(); }); // Handle modal exit clicks (background and close button) document.addEventListener("click", (event) => { - if (event.target.classList.contains("modal-exit") || event.target.id === "initButton") { + if (event.target.classList.contains("modal-exit") || event.target.id === "initButton" || event.target.id === "enterButton") { // Only trigger if modal is actually open if (modalEl.classList.contains("open")) { setTimeout(() => { @@ -193,6 +210,24 @@ case "t": toggleTerminal(); break; + case "Enter": + if (modalEl.classList.contains("open")) { + var hydra = new Hydra({ detectAudio: false }); + modalEl.classList.remove("open"); + + // Show the music player and progress bar with a slight delay for better effect + setTimeout(() => { + showPlayerInterface(); + }, 300); // Small delay to let the modal close animation start + + getMusic().then(() => { + playMusic(); + }); + initHydra(); + initControls(); + initProgressBar(); + } + break; } }); @@ -1411,14 +1446,29 @@ https://retrowave.ru/${musicData.streamUrl} } function toggleTerminal() { - terminalOverlay.classList.toggle("hidden"); - if (!terminalOverlay.classList.contains("hidden")) { - terminalInput.focus(); + if (terminalOverlay.classList.contains("hidden") || !terminalOverlay.classList.contains("open")) { + openTerminal(); + } else { + closeTerminal(); } } + function openTerminal() { + terminalOverlay.classList.remove("hidden"); + terminalOverlay.classList.remove("closing"); + terminalOverlay.classList.add("open"); + terminalInput.focus(); + } + function closeTerminal() { - terminalOverlay.classList.add("hidden"); + terminalOverlay.classList.remove("open"); + terminalOverlay.classList.add("closing"); + + // Wait for animation to complete before hiding + setTimeout(() => { + terminalOverlay.classList.add("hidden"); + terminalOverlay.classList.remove("closing"); + }, 800); // Match the animation duration } function addTerminalLine(text, isCommand = false) { -- cgit v1.2.3