-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoptions.js
43 lines (40 loc) · 1.56 KB
/
options.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
"use strict";
function initOptionsPage() {
$("#jsTreeTheme-Menu").val(window.localStorage.getItem("jsTree_theme"));
$("#jsTreeTheme-Dots")[0].checked = Boolean(window.localStorage.getItem("jsTree_themeDots"));
$("#jsTreeTheme-Stripes")[0].checked = Boolean(window.localStorage.getItem("jsTree_themeStripes"));
$("#hideApps")[0].checked = Boolean(window.localStorage.getItem("hideApps"));
$("#jsTreeTheme-Menu").change(function(ev) {
let jsTree_theme = $(ev.target).val();
if (!jsTree_theme || jsTree_theme.trim() === "") {
window.localStorage.removeItem("jsTree_theme");
return;
}
window.localStorage.setItem("jsTree_theme", jsTree_theme);
});
$("#jsTreeTheme-Dots").change(ev => {
const showDots = $(ev.target)[0];
if (showDots.checked) {
window.localStorage.setItem("jsTree_themeDots", 1);
} else {
window.localStorage.removeItem("jsTree_themeDots");
}
});
$("#jsTreeTheme-Stripes").change(ev => {
const stripesInput = $(ev.target)[0];
if (stripesInput.checked) {
window.localStorage.setItem("jsTree_themeStripes", 1);
} else {
window.localStorage.removeItem("jsTree_themeStripes");
}
});
$("#hideApps").change(ev => {
const hideApps = $(ev.target)[0];
if (hideApps.checked) {
window.localStorage.setItem("hideApps", 1);
} else {
window.localStorage.removeItem("hideApps");
}
});
}
$(document).ready(initOptionsPage);