-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (46 loc) · 1.28 KB
/
script.js
File metadata and controls
59 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// script.js
var audio = document.getElementById("myAudio");
audio.onended = function() {
audio.play(); // Restart the audio when it ends
};
function toggleSound() {
if (audio.paused) {
audio.play();
} else {
audio.pause();
}
}
// function playSoundAndAlert() {
// if (!isPlaying) {
// audio.play();
// isPlaying = true;
// showCustomDialog();
// } else {
// audio.pause();
// isPlaying = false;
// }
// }
// function myfunction(note, done) {
// var box = $("#ready");
// box.find(".message").text(note);
// box.find(".btn").unbind().click(function() {
// box.hide();
// });
// box.find(".btn").click(done); box.show();
// }
// function showCustomDialog() {
// var modal = document.createElement("div");
// modal.className = "custom-modal";
// modal.innerHTML = "Caw! Click here to stop the audio";
// modal.onclick = function() {
// closeModal();
// };
// document.body.appendChild(modal);
// }
// function closeModal() {
// var modal = document.querySelector(".custom-modal");
// if (modal) {
// document.body.removeChild(modal);
// playSoundAndAlert(); // Pause the audio when the custom dialog is clicked
// }
// }