aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome-extension/bg.js16
-rw-r--r--firefox-addon/lib/main.js12
2 files changed, 14 insertions, 14 deletions
diff --git a/chrome-extension/bg.js b/chrome-extension/bg.js
index f0cd265..4b39611 100644
--- a/chrome-extension/bg.js
+++ b/chrome-extension/bg.js
@@ -1,20 +1,20 @@
-var options = {};
+var prefs = {};
-chrome.storage.local.get({callback: 'http://localhost:8080', key: 'chrome'}, function(o) { options = o; });
+chrome.storage.local.get({callback: 'http://localhost:8080', key: 'chrome'}, function(o) { prefs = o; });
chrome.storage.onChanged.addListener(function(changes) {
for (key in changes) {
- options[key] = changes[key].newValue;
+ prefs[key] = changes[key].newValue;
}
});
function log(url, title){
+ var data = JSON.stringify({
+ url: url, time: Date.now(),
+ title: title, key: prefs.key
+ });
var xhr = new XMLHttpRequest();
- xhr.open("POST", options.callback);
- var data = "url=" + encodeURIComponent(url);
- data += "&time=" + Date.now();
- data += "&title=" + encodeURIComponent(title);
- data += "&key=" + options.key;
+ xhr.open("POST", prefs.callback);
xhr.send(data);
}
diff --git a/firefox-addon/lib/main.js b/firefox-addon/lib/main.js
index cc8845e..5814792 100644
--- a/firefox-addon/lib/main.js
+++ b/firefox-addon/lib/main.js
@@ -5,12 +5,12 @@ var prefs = require("sdk/simple-prefs").prefs;
var XMLHttpRequest = require("sdk/net/xhr").XMLHttpRequest;
function log(url, title){
+ var data = JSON.stringify({
+ url: url, time: Date.now(),
+ title: title, key: prefs.key
+ });
var xhr = new XMLHttpRequest();
- xhr.open("POST", prefs.callbackUrl);
- var data = "url=" + encodeURIComponent(url);
- data += "&time=" + Date.now();
- data += "&title=" + encodeURIComponent(title);
- data += "&key=" + encodeURIComponent(prefs.key);
+ xhr.open("POST", prefs.callback);
xhr.send(data);
}
@@ -18,7 +18,7 @@ function logTab(tab) {
if (tab.id === tabs.activeTab.id) {
log(tab.url, tab.title);
}
-};
+}
tabs.on("activate", function () { logTab(tabs.activeTab) });
tabs.on("pageshow", logTab );