blob: c9e43aeb4fbff24ea21f7db260512468fcb232df (
plain)
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
|
var Settings = {
toggle: (state) => {
if (state) {
options.scrollTo(0, 0);
overlay.classList.add("shown")
options.classList.add("shown")
return
} else if (! state) {
if (state != undefined) {
overlay.classList.remove("shown")
options.classList.remove("shown")
return
}
}
options.scrollTo(0, 0);
overlay.classList.toggle("shown")
options.classList.toggle("shown")
},
apply: () => {},
reloadSwitches: () => {
let switches = document.querySelectorAll(".switch");
for (let i = 0; i < switches.length; i++) {
switches[i].setAttribute("onclick", `Settings.switch(${i})`);
}
},
switch: (element) => {
let switches = document.querySelectorAll(".switch");
element = switches[element];
if (element.classList.contains("on")) {
element.classList.add("off");
element.classList.remove("on");
} else {
element.classList.add("on");
element.classList.remove("off");
}
Settings.reloadSwitches();
}
}
Settings.reloadSwitches();
|