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.
5 // TODO(wnwen): Move most of these functions to their own page rather than
6 // common, which should be shared with content script.
9 * TODO(wnwen): Remove this and use actual web API.
12 return document.getElementById(id);
17 * TODO(wnwen): Remove this, it's terrible.
19 function siteFromUrl(url) {
20 var a = document.createElement('a');
27 * The filter should not apply to these URLs.
29 * @param {string} url The URL to check.
31 function isDisallowedUrl(url) {
32 return url.indexOf('chrome') == 0 || url.indexOf('about') == 0;
37 * Whether extension is loaded unpacked or from Chrome Webstore.
39 function isDevMode = function() {
40 return !('update_url' in chrome.runtime.getManifest());
45 * Easily turn on/off console logs.
47 * @param {*} message The message to potentially pass to {@code console.log}.
51 debugPrint = console.log;
53 debugPrint = function() {};