-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (27 loc) · 741 Bytes
/
Copy pathscript.js
File metadata and controls
32 lines (27 loc) · 741 Bytes
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
let clickCount = 0;
let isPlaying = false;
const buzzer = document.getElementById('buzzer');
const counter = document.getElementById('counter');
const originalText = buzzer.textContent;
buzzer.addEventListener('click', () => {
if (isPlaying) return;
clickCount++;
if (clickCount === 15) {
isPlaying = true;
buzzer.textContent = 'ULTIMATE FAAH';
const audio = new Audio('ultimate-faah.mp3');
audio.play();
audio.onended = () => {
isPlaying = false;
buzzer.textContent = originalText;
clickCount = 0;
counter.textContent = clickCount;
};
} else {
const audio = new Audio('faah.mp3');
audio.play();
}
if (!isPlaying) {
counter.textContent = clickCount;
}
});