-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
36 lines (28 loc) · 1 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
window.onload = function () {
function restore_options() {
var option = localStorage.getItem('option');
if (!option) option = "close";
document.getElementById("option").value = option;
var state = localStorage.getItem('state');
if (!state) state = "maximized";
document.getElementById("state").value = state;
var cookies = localStorage.getItem('cookies');
if (!cookies) cookies = "allow";
document.getElementById("cookies").value = cookies;
}
// save the setting
document.getElementById("save").onclick = function () {
var option = document.getElementById("option").value;
localStorage.setItem('option', option);
var state = document.getElementById("state").value;
localStorage.setItem('state', state);
var cookies = document.getElementById("cookies").value;
localStorage.setItem('cookies', cookies);
var status = document.getElementById('status');
status.textContent = 'Settings saved!';
setTimeout(function () {
status.textContent = '';
}, 750);
};
restore_options();
};