aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--css/popup.css7
-rw-r--r--js/background.js16
-rw-r--r--js/popup.js14
-rw-r--r--manifest.json2
-rw-r--r--popup.html3
5 files changed, 38 insertions, 4 deletions
diff --git a/css/popup.css b/css/popup.css
index 1f0069c..85768c1 100644
--- a/css/popup.css
+++ b/css/popup.css
@@ -29,4 +29,11 @@ button {
color:red;
height:13px;
font-size:12px;
+}
+
+label {
+ display:inline-block;
+ position: relative;
+ top:5px;
+ margin-top:4px;
} \ No newline at end of file
diff --git a/js/background.js b/js/background.js
index c025281..d1a939e 100644
--- a/js/background.js
+++ b/js/background.js
@@ -6,7 +6,7 @@ function log(msg) {
console.log('REDIRECTOR: ' + msg);
}
}
-log.enabled = true;
+log.enabled = false;
//Redirects partitioned by request type, so we have to run through
//the minimum number of redirects for each request.
@@ -120,7 +120,12 @@ function monitorChanges(changes, namespace) {
if (changes.redirects) {
log('Redirects have changed, setting up listener again');
setUpRedirectListener();
- }
+ }
+
+ if (changes.logging) {
+ log('Logging settings have changed, updating...');
+ updateLogging();
+ }
}
chrome.storage.onChanged.addListener(monitorChanges);
@@ -222,6 +227,13 @@ chrome.runtime.onMessage.addListener(
//First time setup
updateIcon();
+function updateLogging() {
+ chrome.storage.local.get({logging:false}, function(obj) {
+ log.enabled = obj.logging;
+ });
+}
+updateLogging();
+
chrome.storage.local.get({disabled:false}, function(obj) {
if (!obj.disabled) {
setUpRedirectListener();
diff --git a/js/popup.js b/js/popup.js
index 0467286..6658fc0 100644
--- a/js/popup.js
+++ b/js/popup.js
@@ -14,6 +14,20 @@ angular.module('popupApp', []).controller('PopupCtrl', ['$scope', function($s) {
$s.disabled = !obj.disabled;
$s.$apply();
});
+ };
+
+
+ storage.get({logging:false}, function(obj) {
+ $s.logging = obj.logging;
+ $s.$apply();
+ });
+
+ $s.toggleLogging = function() {
+ storage.get({logging:false}, function(obj) {
+ storage.set({logging:!obj.logging});
+ $s.logging = !obj.logging;
+ $s.$apply();
+ });
};
$s.openRedirectorSettings = function() {
diff --git a/manifest.json b/manifest.json
index 0a78d57..e3128f1 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"manifest_version": 2,
"name": "Redirector",
"description": "Automatically redirect pages based on user-defined rules. E.g. always redirect an article url to its printer-friendly version.",
- "version": "3.1.0",
+ "version": "3.1.1",
"icons": { "16": "images/icon-active-16.png",
"32": "images/icon-active-32.png",
diff --git a/popup.html b/popup.html
index db72080..90407a3 100644
--- a/popup.html
+++ b/popup.html
@@ -11,6 +11,7 @@
<h1>REDIRECTOR</h1>
<div class="disabled"><span ng-show="disabled">Disabled</span></div>
<button ng-click="toggleDisabled()">{{disabled ? 'Enable Redirector' : 'Disable Redirector'}}</button>
- <button ng-click="openRedirectorSettings()">Edit Redirects</button>
+ <button ng-click="openRedirectorSettings()">Edit Redirects</button>
+ <label><input type="checkbox" ng-model="logging" ng-click="toggleLogging()" /> Logging enabled</label>
</body>
</html>