-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
48 lines (39 loc) · 1.63 KB
/
script.js
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
const emojis = ["💁", "🙆", "🙇", "🙋", "🙍", "🙎", "🙅", "🤦", "🧘", "🤷", "💃", "🕺", "🧑🎓", "👩🏫", "👨🏫", "🧑💼", "👩🔬", "👨🔬"];
const emojiDisplay = document.getElementById('emoji-display');
const askBtn = document.getElementById('ask-btn');
const clearBtn = document.getElementById('clear-btn');
const helpBtn = document.getElementById('help-btn');
const helpModal = document.getElementById('help-modal');
const closeBtn = document.getElementsByClassName('close')[0];
const disclaimerBtn = document.getElementById('disclaimer-btn');
const disclaimerModal = document.getElementById('disclaimer-modal');
const closeDisclaimerBtn = document.getElementsByClassName('close-disclaimer')[0];
askBtn.addEventListener('click', () => {
const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
emojiDisplay.textContent = randomEmoji;
});
clearBtn.addEventListener('click', () => {
emojiDisplay.textContent = '🔮';
});
helpBtn.addEventListener('click', () => {
helpModal.style.display = 'block';
});
closeBtn.addEventListener('click', () => {
helpModal.style.display = 'none';
});
window.addEventListener('click', (event) => {
if (event.target == helpModal) {
helpModal.style.display = 'none';
}
});
disclaimerBtn.addEventListener('click', () => {
disclaimerModal.style.display = 'block';
});
closeDisclaimerBtn.addEventListener('click', () => {
disclaimerModal.style.display = 'none';
});
window.addEventListener('click', (event) => {
if (event.target == disclaimerModal) {
disclaimerModal.style.display = 'none';
}
});