forked from ErikBoesen/BWNT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
28 lines (25 loc) · 838 Bytes
/
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
var format = document.getElementById('format'),
showDate = document.getElementById('showDate'),
cycle = document.getElementById('cycle'),
theme = document.getElementById('theme');
format.checked = JSON.parse(localStorage.format);
showDate.checked = JSON.parse(localStorage.showDate);
cycle.checked = JSON.parse(localStorage.cycle);
for (i = 0; i < theme.children.length; i++) {
var child = theme.children[i];
if (child.value == localStorage.theme) {
child.selected = true;
break;
}
}
setInterval(function() {
localStorage.format = format.checked;
localStorage.showDate = showDate.checked;
localStorage.cycle = cycle.checked;
localStorage.theme = theme.children[theme.selectedIndex].value;
if (cycle.checked) {
theme.parentElement.style.opacity = 0.5;
} else {
theme.parentElement.style.opacity = 1;
}
}, 50);