Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4919)

Unified Diff: chrome/common/extensions/docs/examples/api/notifications/options.js

Issue 8309001: Adding `content_security_policy` to a few sample extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: License and whitespace. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/api/notifications/options.js
diff --git a/chrome/common/extensions/docs/examples/api/notifications/options.js b/chrome/common/extensions/docs/examples/api/notifications/options.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f5e6a29a3b72f5e3cebfcdea8f4ada14aac5881
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/notifications/options.js
@@ -0,0 +1,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;
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698