nelle-observer/frontend/public/scripts/sound.js

82 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-10-30 19:59:07 -06:00
const clickSound = new Audio("/assets/sounds/ui/zapsplat_button_click_2.mp3");
2024-09-02 15:42:14 -06:00
const hoverSound = new Audio(
2024-10-30 19:59:07 -06:00
"/assets/sounds/ui/zapsplat_button_click_bright_2.mp3",
2024-09-02 15:42:14 -06:00
);
2024-09-05 00:48:32 -06:00
const phonewaveSound = new Audio(
2024-10-30 19:59:07 -06:00
"/assets/sounds/sciadv/phonewave/phonewave.ogg",
2024-09-05 00:48:32 -06:00
);
const startLeapSound = new Audio(
2024-10-30 19:59:07 -06:00
"/assets/sounds/sciadv/phonewave/begin-leap.ogg",
2024-09-05 00:48:32 -06:00
);
2024-09-02 15:42:14 -06:00
2024-08-12 01:15:48 -06:00
// Sound effects
function PlaySound(soundobj) {
2024-09-02 15:42:14 -06:00
const thisSound = document.getElementById(soundobj);
thisSound.play();
2024-08-18 01:12:47 -06:00
}
function StopSound(soundobj) {
2024-09-02 15:42:14 -06:00
const thisSound = document.getElementById(soundobj);
thisSound.pause();
thisSound.currentTime = 0;
2024-08-18 01:12:47 -06:00
}
const buttons = document.querySelectorAll("button");
const links = document.querySelectorAll("a");
const image = document.querySelectorAll("img");
2024-09-05 00:48:32 -06:00
const phonewave = document.getElementById("phonewave");
2024-08-18 01:12:47 -06:00
// biome-ignore lint/complexity/noForEach: <explanation>
links.forEach((a) => {
a.addEventListener("click", () => {
2024-09-02 15:42:14 -06:00
clickSound.play();
});
2024-09-02 15:46:26 -06:00
/*
2024-09-02 15:42:14 -06:00
a.addEventListener("mouseover", () => {
hoverSound.play();
2024-08-18 01:12:47 -06:00
});
2024-09-02 15:46:26 -06:00
*/
2024-08-18 01:12:47 -06:00
});
// biome-ignore lint/complexity/noForEach: <explanation>
buttons.forEach((button) => {
button.addEventListener("click", () => {
2024-09-02 15:42:14 -06:00
clickSound.play();
});
/*
button.addEventListener("mouseover", () => {
hoverSound.play();
});
button.addEventListener("momouseoutuseover", () => {
hoverSound.stop();
2024-08-18 01:12:47 -06:00
});
2024-09-02 15:42:14 -06:00
*/
2024-08-18 01:12:47 -06:00
});
// biome-ignore lint/complexity/noForEach: <explanation>
image.forEach((button) => {
button.addEventListener("click", () => {
2024-09-02 15:42:14 -06:00
clickSound.play();
});
/*
button.addEventListener("mouseover", () => {
hoverSound.play();
});
button.addEventListener("mouseout", () => {
hoverSound.stop();
2024-08-18 01:12:47 -06:00
});
2024-09-02 15:42:14 -06:00
*/
2024-08-18 01:12:47 -06:00
});
2024-09-05 00:48:32 -06:00
phonewave.addEventListener("click", () => {
phonewaveSound.play();
setTimeout(() => {
startLeapSound.play();
setTimeout(() => {
2024-09-05 00:49:55 -06:00
window.location.href = "https://applianceri.ng/next?host=nelle.observer";
2024-09-05 00:48:32 -06:00
return;
}, 8000);
return;
}, 10000);
2024-10-30 19:59:07 -06:00
});