aboutsummaryrefslogtreecommitdiff
path: root/js/background.js
diff options
context:
space:
mode:
authorEinar Egilsson <einar@einaregilsson.com>2015-09-23 10:58:44 +0000
committerEinar Egilsson <einar@einaregilsson.com>2015-09-23 10:58:44 +0000
commit354b7325e453c3fa259ecd9a07b4634d09cf5afe (patch)
treeb137bf64bfe82e06d99e83c234875d8f08ecad3f /js/background.js
parent96560ba904512a429378531c65c70ecaceb9b241 (diff)
Build correctly for Firefox + allow to turn on logging
Diffstat (limited to 'js/background.js')
-rw-r--r--js/background.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/js/background.js b/js/background.js
index 40998f7..81bf405 100644
--- a/js/background.js
+++ b/js/background.js
@@ -1,6 +1,13 @@
//This is the background script. It is responsible for actually redirecting requests,
//as well as monitoring changes in the redirects and the disabled status and reacting to them.
+function log(msg) {
+ if (log.enabled) {
+ console.log('REDIRECTOR: ' + msg);
+ }
+}
+log.enabled = false;
+
//TODO: Better browser detection...
var isFirefox = false;
@@ -8,6 +15,7 @@ var isFirefox = false;
if (typeof chrome == 'undefined') {
isFirefox = true;
var firefoxShim = require('./firefox/background-shim');
+ firefoxShim.setLogger(log);
chrome = firefoxShim.chrome;
Redirect = firefoxShim.Redirect;
}
@@ -25,13 +33,6 @@ var ignoreNextRequest = {
};
-function log(msg) {
- if (log.enabled) {
- console.log('REDIRECTOR: ' + msg);
- }
-}
-log.enabled = true;
-
function setIcon(image) {
var data = {
path: {