diff options
author | Indrajith K L | 2025-07-02 00:28:45 +0530 |
---|---|---|
committer | Indrajith K L | 2025-07-02 00:28:45 +0530 |
commit | b0241787eada6d21612c57571b011bea863f01f1 (patch) | |
tree | b32a6cca04ed01d4804e597eba91c13936e69f18 /player.js | |
parent | db6f27849f4ccec94f22618ab7f220974a4b1e58 (diff) | |
download | retrowave-player-master.tar.gz retrowave-player-master.tar.bz2 retrowave-player-master.zip |
* 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
Diffstat (limited to 'player.js')
-rw-r--r-- | player.js | 60 |
1 files changed, 55 insertions, 5 deletions
@@ -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) { |