aboutsummaryrefslogtreecommitdiff
path: root/player.js
diff options
context:
space:
mode:
authorIndrajith K L2025-07-02 00:28:45 +0530
committerIndrajith K L2025-07-02 00:28:45 +0530
commitb0241787eada6d21612c57571b011bea863f01f1 (patch)
treeb32a6cca04ed01d4804e597eba91c13936e69f18 /player.js
parentdb6f27849f4ccec94f22618ab7f220974a4b1e58 (diff)
downloadretrowave-player-b0241787eada6d21612c57571b011bea863f01f1.tar.gz
retrowave-player-b0241787eada6d21612c57571b011bea863f01f1.tar.bz2
retrowave-player-b0241787eada6d21612c57571b011bea863f01f1.zip
Fixes and FeaturesHEADmaster
* 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.js60
1 files changed, 55 insertions, 5 deletions
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) {