1// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5/* 6 Grays out or [whatever the opposite of graying out is called] the option 7 field. 8*/ 9function ghost(isDeactivated) { 10 options.style.color = isDeactivated ? 'graytext' : 'black'; 11 // The label color. 12 options.frequency.disabled = isDeactivated; // The control manipulability. 13} 14 15window.addEventListener('load', function() { 16 // Initialize the option controls. 17 options.isActivated.checked = JSON.parse(localStorage.isActivated); 18 // The display activation. 19 options.frequency.value = localStorage.frequency; 20 // The display frequency, in minutes. 21 22 if (!options.isActivated.checked) { ghost(true); } 23 24 // Set the display activation and frequency. 25 options.isActivated.onchange = function() { 26 localStorage.isActivated = options.isActivated.checked; 27 ghost(!options.isActivated.checked); 28 }; 29 30 options.frequency.onchange = function() { 31 localStorage.frequency = options.frequency.value; 32 }; 33}); 34