mirror of
https://github.com/isledecomp/isle.pizza.git
synced 2026-01-11 02:31:16 +00:00
Use pause instead of mute
This commit is contained in:
parent
7c4a858767
commit
553a714591
16
app.js
16
app.js
@ -30,22 +30,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
// --- Sound Toggle ---
|
||||
function updateSoundEmojiState() {
|
||||
soundToggleEmoji.textContent = audio.muted ? '🔇' : '🔊';
|
||||
soundToggleEmoji.title = audio.muted ? 'Unmute Audio' : 'Mute Audio';
|
||||
soundToggleEmoji.textContent = audio.paused ? '🔇' : '🔊';
|
||||
soundToggleEmoji.title = audio.paused ? 'Play Audio' : 'Pause Audio';
|
||||
}
|
||||
|
||||
if (audio && soundToggleEmoji) {
|
||||
updateSoundEmojiState();
|
||||
soundToggleEmoji.addEventListener('click', function () {
|
||||
audio.muted = !audio.muted;
|
||||
if (!audio.muted) {
|
||||
if (audio.paused) {
|
||||
audio.currentTime = 0;
|
||||
audio.play();
|
||||
} else {
|
||||
audio.pause();
|
||||
}
|
||||
|
||||
updateSoundEmojiState();
|
||||
});
|
||||
audio.addEventListener('volumechange', updateSoundEmojiState);
|
||||
audio.addEventListener('play', updateSoundEmojiState);
|
||||
audio.addEventListener('pause', updateSoundEmojiState);
|
||||
}
|
||||
|
||||
// --- Control Image Hover ---
|
||||
@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
runGameButton.addEventListener('click', function () {
|
||||
if (!Module.running) return;
|
||||
audio.muted = true;
|
||||
audio.pause();
|
||||
updateSoundEmojiState();
|
||||
this.src = this.dataset.on;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<div id="top-content">
|
||||
<div class="video-container">
|
||||
<img id="install-video" width="260" height="260" src="install.webp" alt="Install Game">
|
||||
<audio id="install-audio" loop muted preload="none">
|
||||
<audio id="install-audio" loop preload="none">
|
||||
<source src="install.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio tag.
|
||||
</audio>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user