-
Notifications
You must be signed in to change notification settings - Fork 13
/
options.js
62 lines (48 loc) · 1.66 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var scalename = "scale";
var fieldscalename = "fieldscale";
var ioscompatname = "ioscompat";
var fieldioscompatname = "fieldioscompat";
var usefontname = "usefont";
var fieldusefontname = "fieldusefont";
var blacklistname = "blacklist";
var fieldblacklistname = "fieldblacklist";
function loadOptions() {
var scale = document.getElementById(fieldscalename);
var value = localStorage[scalename];
scale.value = value;
var ioscompat = document.getElementById(fieldioscompatname);
value = localStorage[ioscompatname];
ioscompat.checked = (value == "true");
var usefont = document.getElementById(fieldusefontname);
value = localStorage[usefontname];
usefont.checked = (value == "true");
var blacklist = document.getElementById(fieldblacklistname);
value = localStorage[blacklistname];
blacklist.value = value;
}
function saveOptions() {
var scale = document.getElementById(fieldscalename);
var value = scale.value;
localStorage[scalename] = value;
var ioscompat = document.getElementById(fieldioscompatname);
value = ioscompat.checked;
localStorage[ioscompatname] = value;
var usefont = document.getElementById(fieldusefontname);
value = usefont.checked;
localStorage[usefontname] = value;
var blacklist = document.getElementById(fieldblacklistname);
value = blacklist.value;
localStorage[blacklistname] = value;
window.close();
}
function cancelOptions() {
window.close();
}
function init() {
var save = document.getElementById("buttonsave");
save.addEventListener("click", saveOptions);
var cancel = document.getElementById("buttoncancel");
cancel.addEventListener("click", cancelOptions);
loadOptions();
}
document.body.addEventListener("load", init());