aboutsummaryrefslogtreecommitdiffstats
path: root/chrome-extension/bg.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome-extension/bg.js')
-rw-r--r--chrome-extension/bg.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome-extension/bg.js b/chrome-extension/bg.js
index 8a74e89..f0cd265 100644
--- a/chrome-extension/bg.js
+++ b/chrome-extension/bg.js
@@ -1,10 +1,20 @@
+var options = {};
+
+chrome.storage.local.get({callback: 'http://localhost:8080', key: 'chrome'}, function(o) { options = o; });
+
+chrome.storage.onChanged.addListener(function(changes) {
+ for (key in changes) {
+ options[key] = changes[key].newValue;
+ }
+});
+
function log(url, title){
var xhr = new XMLHttpRequest();
- xhr.open("POST", "http://localhost:8080");
+ xhr.open("POST", options.callback);
var data = "url=" + encodeURIComponent(url);
data += "&time=" + Date.now();
data += "&title=" + encodeURIComponent(title);
- data += "&key=" + "chromium";
+ data += "&key=" + options.key;
xhr.send(data);
}
@@ -33,3 +43,5 @@ chrome.windows.onFocusChanged.addListener(function (windowId) {
});
}
});
+
+