forked from summerblue/chrome-phphub-notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
25 lines (22 loc) · 773 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
function renderOptions() {
var config = getConfig();
document.querySelector('#feature-2-enable').checked = config['feature-2-enable'];
document.querySelector('#feature-2-interval').value = config['feature-2-interval'];
renderOptionsStates();
}
function renderOptionsStates() {
document.querySelector('#feature-2-interval').disabled = !(document.querySelector('#feature-2-enable').checked);
}
function storeConfig() {
localStorage.gm_config = JSON.stringify({
'feature-2-enable': document.querySelector('#feature-2-enable').checked,
'feature-2-interval': document.querySelector('#feature-2-interval').value
});
}
window.onload = function() {
renderOptions();
document.onchange = function() {
storeConfig();
renderOptionsStates();
};
}