diff options
author | Einar Egilsson <einar@einaregilsson.com> | 2014-09-07 17:50:28 +0000 |
---|---|---|
committer | Einar Egilsson <einar@einaregilsson.com> | 2014-09-07 17:50:28 +0000 |
commit | dfd5078d9e5789cac8e6e823803c93689be950ad (patch) | |
tree | 57c1c68f8b6c757c769090f96d09e014356d645a /chrome | |
parent | e2c1cd613cdfaaf4ae57d9024234748f30a3e80c (diff) | |
parent | dfa02f353906d63ee67d1924e5e4c39f615663a5 (diff) |
Merge branch 'master' of https://github.com/einaregilsson/Redirector
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/js/browserOverlay.js | 2 | ||||
-rw-r--r-- | chrome/js/redirect.js | 13 | ||||
-rw-r--r-- | chrome/js/redirector.js | 5 | ||||
-rw-r--r-- | chrome/redirector.html | 1 |
4 files changed, 10 insertions, 11 deletions
diff --git a/chrome/js/browserOverlay.js b/chrome/js/browserOverlay.js index ed1ab73..019505f 100644 --- a/chrome/js/browserOverlay.js +++ b/chrome/js/browserOverlay.js @@ -18,7 +18,7 @@ var RedirectorOverlay = { this.changedPrefs(this.prefs); this.prefs.addListener(this); document.addEventListener('keypress', function(event) { - if ((event.charCode == 114) && event.altKey) { //alt+r + if ((RedirectorOverlay.prefs.enableShortcutKey) && (event.charCode == 114) && event.altKey) { //alt+r RedirectorOverlay.toggleEnabled(); } }, true); diff --git a/chrome/js/redirect.js b/chrome/js/redirect.js index 4a05ef8..eab14f8 100644 --- a/chrome/js/redirect.js +++ b/chrome/js/redirect.js @@ -202,11 +202,14 @@ Redirect.prototype = { } var resultUrl = this.redirectUrl; for (var i = 1; i < matches.length; i++) { - resultUrl = resultUrl.replace(new RegExp('\\$' + i, 'gi'), - this.unescapeMatches ? unescape(matches[i]) : - this.escapeMatches ? encodeURIComponent(matches[i]) : - matches[i] - ); + var repl = matches[i] || ''; + if (this.unescapeMatches) { + repl = unescape(repl); + } + if (this.escapeMatches) { + repl = encodeURIComponent(repl); + } + resultUrl = resultUrl.replace(new RegExp('\\$' + i, 'gi'), repl); } this._rxInclude.lastIndex = 0; return resultUrl; diff --git a/chrome/js/redirector.js b/chrome/js/redirector.js index 78974bd..86e07a2 100644 --- a/chrome/js/redirector.js +++ b/chrome/js/redirector.js @@ -303,11 +303,6 @@ Redirector = { if (redirectsFile.exists()) { this.importRedirects(redirectsFile); } - - //RedirectorProxy.start(this._prefs.proxyServerPort); - //Redirector.debug('Registering as Proxy Filter'); - //var pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService(Ci.nsIProtocolProxyService); - //pps.registerFilter(this, 0); }, _loadStrings : function() { diff --git a/chrome/redirector.html b/chrome/redirector.html index 68300c1..eb0baa7 100644 --- a/chrome/redirector.html +++ b/chrome/redirector.html @@ -31,6 +31,7 @@ <input type="checkbox" id="enable-redirector" data-pref="enabled" /><label>Enabled</label><br /> <input type="checkbox" id="show-status-bar-icon" data-pref="showStatusBarIcon"/><label>Statusbar icon</label><br /> <input type="checkbox" id="show-context-menu" data-pref="showContextMenu"/><label>Context menu</label><br /> + <input type="checkbox" id="enable-shortcut-key" data-pref="enableShortcutKey"/><label>Enable/Disable via Alt-r</label><br /> <input type="checkbox" id="enable-debug-output" data-pref="debugEnabled"/><label>Debug output</label><br /> <div class="button-row"> <button id="close">Close</button> |