diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-11 17:56:26 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-11 17:56:26 -0400 |
| commit | d3e4668fa2073176f2ae66e19fea12469f661f5f (patch) | |
| tree | 11c9be3b9bb3c992310d172e99600e0c20cd8c89 /chrome-extension/bg.js | |
| parent | 78b5f6a8b869de9a15352ab35d5c40e440a3c141 (diff) | |
| download | tracker-d3e4668fa2073176f2ae66e19fea12469f661f5f.tar.gz | |
Move browser extensions to another repository
Diffstat (limited to 'chrome-extension/bg.js')
| -rw-r--r-- | chrome-extension/bg.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/chrome-extension/bg.js b/chrome-extension/bg.js deleted file mode 100644 index f0cd265..0000000 --- a/chrome-extension/bg.js +++ /dev/null @@ -1,47 +0,0 @@ -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", options.callback); - var data = "url=" + encodeURIComponent(url); - data += "&time=" + Date.now(); - data += "&title=" + encodeURIComponent(title); - data += "&key=" + options.key; - xhr.send(data); -} - -chrome.tabs.onActivated.addListener(function (activeInfo) { - chrome.tabs.get(activeInfo.tabId, function(tab) { - if (tab.status === "complete") { - log(tab.url, tab.title); - } - }); -}); - -chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { - if (changeInfo.status === "complete" && tab.active) { - log(tab.url, tab.title); - } -}); - -chrome.windows.onFocusChanged.addListener(function (windowId) { - if (windowId == chrome.windows.WINDOW_ID_NONE) { - log(null, null); - } else { - chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { - if (tabs[0].status === "complete") { - log(tabs[0].url, tabs[0].title); - } - }); - } -}); - - |
