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
This commit is contained in:
60
player.js
60
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) {
|
||||
|
||||
Reference in New Issue
Block a user