-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (50 loc) · 1.52 KB
/
script.js
File metadata and controls
59 lines (50 loc) · 1.52 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
if (localStorage.getItem('darkMode') === null) {
localStorage.setItem('darkMode', 'false');
}
changeStatus();
function toogleDarkmode() {
const themeChanger = document.getElementsByClassName('theme-button')[0];
if (themeChanger.innerHTML == 'Dark' || localStorage.getItem('darkMode') == false) {
themeChanger.innerHTML = 'Light';
localStorage.setItem('darkMode', 'true');
setTheme();
} else {
themeChanger.innerHTML = 'Dark';
localStorage.setItem('darkMode', 'false');
unsetTheme();
}
}
function changeStatus() {
const themeButton = document.querySelector('.theme-button');
if (localStorage.getItem('darkMode') === 'true') {
setTheme();
themeButton.innerHTML = 'Light';
} else {
unsetTheme();
}
}
function setTheme() {
if (document.body.className == 'division-page') {
document.body.className = 'division-page casual-dark';
} else {
document.body.className = 'fancy-dark';
}
}
function unsetTheme() {
if (document.body.className == 'division-page casual-dark' || document.body.className == 'division-page') {
document.body.className = 'division-page';
} else {
document.body.className = '';
}
}
const radios = document.querySelectorAll('input[name="konfirmasi"]');
const textareaPengalaman = document.querySelector('textarea#pengalaman');
for (const radio of radios) {
radio.addEventListener('change', (_) => {
if (radio.id == 'yes') {
textareaPengalaman.style.display = 'block';
} else {
textareaPengalaman.style.display = 'none';
}
});
}