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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 // TODO(wnwen): Move most of these functions to their own page rather than
6 // common, which should be shared with content script.
7
8 /**
9 * TODO(wnwen): Remove this and use actual web API.
10 */
11 function $(id) {
12 return document.getElementById(id);
13 }
14
15
16 /**
17 * TODO(wnwen): Remove this, it's terrible.
18 */
19 function siteFromUrl(url) {
20 var a = document.createElement('a');
21 a.href = url;
22 return a.hostname;
23 }
24
25
26 /**
27 * The filter should not apply to these URLs.
28 *
29 * @param {string} url The URL to check.
30 */
31 function isDisallowedUrl(url) {
32 return url.indexOf('chrome') == 0 || url.indexOf('about') == 0;
33 }
34
35
36 /**
37 * Whether extension is loaded unpacked or from Chrome Webstore.
38 */
39 function isDevMode = function() {
40 return !('update_url' in chrome.runtime.getManifest());
41 }
42
43
44 /**
45 * Easily turn on/off console logs.
46 *
47 * @param {*} message The message to potentially pass to {@code console.log}.
48 */
49 var debugPrint;
50 if (isDevMode()) {
51 debugPrint = console.log;
52 } else {
53 debugPrint = function() {};
54 }
OLDNEW
« 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