Spaces:
Running
Running
Update static/application.js
Browse files- static/application.js +20 -13
static/application.js
CHANGED
@@ -274,19 +274,26 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
274 |
const audio = new Audio(audioSrc);
|
275 |
audio.play();
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
message.appendChild(icon);
|
292 |
}
|
|
|
274 |
const audio = new Audio(audioSrc);
|
275 |
audio.play();
|
276 |
|
277 |
+
let isMuted = false;
|
278 |
+
let audio = new Audio(audioSrc);
|
279 |
+
audio.play();
|
280 |
+
|
281 |
+
icon.addEventListener("click", () => {
|
282 |
+
if (isMuted) {
|
283 |
+
// Recreate audio to force replay
|
284 |
+
audio = new Audio(audioSrc);
|
285 |
+
audio.play();
|
286 |
+
isMuted = false;
|
287 |
+
icon.classList.replace("fa-volume-xmark", "fa-volume-high");
|
288 |
+
icon.title = "Click to mute";
|
289 |
+
} else {
|
290 |
+
audio.pause();
|
291 |
+
isMuted = true;
|
292 |
+
icon.classList.replace("fa-volume-high", "fa-volume-xmark");
|
293 |
+
icon.title = "Click to unmute";
|
294 |
+
}
|
295 |
+
});
|
296 |
+
|
297 |
|
298 |
message.appendChild(icon);
|
299 |
}
|