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

Unified Diff: ui/accessibility/extensions/colorenhancer/src/common.js

Issue 984833004: Add color enhancer as a chromium accessibility extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More docs. Created 5 years, 9 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: ui/accessibility/extensions/colorenhancer/src/common.js
diff --git a/ui/accessibility/extensions/colorenhancer/src/common.js b/ui/accessibility/extensions/colorenhancer/src/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5a91d435a48446b259b22f3845720284a491421
--- /dev/null
+++ b/ui/accessibility/extensions/colorenhancer/src/common.js
@@ -0,0 +1,54 @@
+// Copyright 2015 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.
+
+// TODO(wnwen): Move most of these functions to their own page rather than
+// common, which should be shared with content script.
+
+/**
+ * TODO(wnwen): Remove this and use actual web API.
+ */
+function $(id) {
+ return document.getElementById(id);
+}
+
+
+/**
+ * TODO(wnwen): Remove this, it's terrible.
+ */
+function siteFromUrl(url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return a.hostname;
+}
+
+
+/**
+ * The filter should not apply to these URLs.
+ *
+ * @param {string} url The URL to check.
+ */
+function isDisallowedUrl(url) {
+ return url.indexOf('chrome') == 0 || url.indexOf('about') == 0;
+}
+
+
+/**
+ * Whether extension is loaded unpacked or from Chrome Webstore.
+ */
+function isDevMode = function() {
+ return !('update_url' in chrome.runtime.getManifest());
+}
+
+
+/**
+ * Easily turn on/off console logs.
+ *
+ * @param {*} message The message to potentially pass to {@code console.log}.
+ */
+var debugPrint;
+if (isDevMode()) {
+ debugPrint = console.log;
+} else {
+ debugPrint = function() {};
+}
« no previous file with comments | « ui/accessibility/extensions/colorenhancer/src/background.js ('k') | ui/accessibility/extensions/colorenhancer/src/cvd.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698