-
Notifications
You must be signed in to change notification settings - Fork 1
/
optionSettings.js
98 lines (90 loc) · 3.08 KB
/
optionSettings.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
86
87
88
89
90
91
92
93
94
95
96
97
98
export default function optionSettings() {
// OPTIONS SETTINGS
// STEPDOWN
const stepDownCheck = document.getElementById("step-down");
if (localStorage.stepDown === undefined) {
localStorage.stepDown = false;
} else {
stepDownCheck.checked = JSON.parse(localStorage.stepDown);
}
stepDownCheck.addEventListener("click", () => {
localStorage.stepDown = stepDownCheck.checked;
});
// FLATTEN
const flattenCheck = document.getElementById("flatten");
if (localStorage.flatten === undefined) {
localStorage.flatten = false;
} else {
flattenCheck.checked = JSON.parse(localStorage.flatten);
}
flattenCheck.addEventListener("click", () => {
localStorage.flatten = flattenCheck.checked;
});
// PALI
const paliCheck = document.getElementById("pali");
if (localStorage.pali === undefined) {
localStorage.pali = true;
paliCheck.checked = true;
} else {
paliCheck.checked = JSON.parse(localStorage.pali);
}
paliCheck.addEventListener("click", () => {
localStorage.pali = paliCheck.checked;
});
// enjambment
const enjambmentCheck = document.getElementById("enjambment");
if (localStorage.enjambment === undefined) {
localStorage.enjambment = false;
} else {
enjambmentCheck.checked = JSON.parse(localStorage.enjambment);
}
enjambmentCheck.addEventListener("click", () => {
localStorage.enjambment = enjambmentCheck.checked;
});
// English first
const englishFirstCheck = document.getElementById("english-first");
if (localStorage.englishFirst === undefined) {
localStorage.englishFirst = false;
} else {
englishFirstCheck.checked = JSON.parse(localStorage.englishFirst);
}
englishFirstCheck.addEventListener("click", () => {
localStorage.englishFirst = englishFirstCheck.checked;
});
// HTML page wrapper
const htmlPageWrapperCheck = document.getElementById("html-page-wrapper");
if (localStorage.htmlPageWrapper === undefined) {
localStorage.htmlPageWrapper = false;
} else {
htmlPageWrapperCheck.checked = JSON.parse(localStorage.htmlPageWrapper);
}
htmlPageWrapperCheck.addEventListener("click", () => {
localStorage.htmlPageWrapper = htmlPageWrapperCheck.checked;
});
// include refrence numbers
const includeRefrenceCheck = document.getElementById("include-refrence");
if (localStorage.includeRefrence === undefined) {
localStorage.includeRefrence = false;
} else {
includeRefrenceCheck.checked = JSON.parse(localStorage.includeRefrence);
}
includeRefrenceCheck.addEventListener("click", () => {
localStorage.includeRefrence = includeRefrenceCheck.checked;
});
// LOCAL
const localCheck = document.getElementById("local");
if (localStorage.local === undefined) {
localStorage.local = true;
localCheck.checked = true;
} else {
localCheck.checked = JSON.parse(localStorage.local);
}
localCheck.addEventListener("click", () => {
localStorage.local = localCheck.checked;
});
if (!/index.html/.test(location)) {
localStorage.local = false;
const localOption = document.getElementById("local-option");
localOption.remove();
}
}