-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.js
85 lines (73 loc) · 2.65 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//sidebar
function side (open) {
if (open) {
document.getElementById("side").classList.add("show");
document.getElementById("setting").classList.remove("show");
} else {
document.getElementById("side").classList.remove("show");
}
}
//setting
function setting (open) {
if (open) {
document.getElementById("setting").classList.add("show");
document.getElementById("side").classList.remove("show");
} else {
document.getElementById("setting").classList.remove("show");
}
}
//sidebar and setting close on click
var main = document.getElementById("main");
main.addEventListener("click", function(){
if(document.getElementById("setting").className == "show") {
document.getElementById("setting").classList.remove("show");
}
if(document.getElementById("side").className == "show") {
document.getElementById("side").classList.remove("show");
}
});
//search bar
function search() {
var input, filter, section, li, a, i, txtValue;
input = document.getElementById("search");
filter = input.value.toUpperCase();
section = document.getElementById("modules");
li = section.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
var r = document.querySelector(':root');
document.getElementById("dark").classList.add("active-theme");
//dark theme
function dark() {
r.style.setProperty('--bg', '#1a1d21');
r.style.setProperty('--lightbg', '#292d33');
r.style.setProperty('--lighterbg', '#3b3f45');
r.style.setProperty('--shadow', 'rgba(0, 0, 0, 0.4)');
r.style.setProperty('--grey2', '#c9c7c7');
r.style.setProperty('--grey3', '#c9c7c7');
r.style.setProperty('--blackbluedark', '#1d3258');
r.style.setProperty('--themeFontColor', 'white');
document.getElementById("dark").classList.add("active-theme");
document.getElementById("light").classList.remove("active-theme");
}
//light theme
function light() {
r.style.setProperty('--bg', '#f0f0f0');
r.style.setProperty('--lightbg', '#e0dede');
r.style.setProperty('--lighterbg', '#cccccc');
r.style.setProperty('--shadow', 'rgba(0, 0, 0, 0.2)');
r.style.setProperty('--grey2', 'grey');
r.style.setProperty('--grey3', 'black');
r.style.setProperty('--blackbluedark', '#3a5d94');
r.style.setProperty('--themeFontColor', 'black');
document.getElementById("dark").classList.remove("active-theme");
document.getElementById("light").classList.add("active-theme");
}