forked from orbitbot/chrome-extensions-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
33 lines (28 loc) · 1.18 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
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/*
Grays out or [whatever the opposite of graying out is called] the option
field.
*/
function ghost(isDeactivated) {
options.style.color = isDeactivated ? 'graytext' : 'black';
// The label color.
options.frequency.disabled = isDeactivated; // The control manipulability.
}
window.addEventListener('load', function() {
// Initialize the option controls.
options.isActivated.checked = JSON.parse(localStorage.isActivated);
// The display activation.
options.frequency.value = localStorage.frequency;
// The display frequency, in minutes.
if (!options.isActivated.checked) { ghost(true); }
// Set the display activation and frequency.
options.isActivated.onchange = function() {
localStorage.isActivated = options.isActivated.checked;
ghost(!options.isActivated.checked);
};
options.frequency.onchange = function() {
localStorage.frequency = options.frequency.value;
};
});