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