diff options
| -rw-r--r-- | chrome-extension/bg.js | 47 | ||||
| -rw-r--r-- | chrome-extension/manifest.json | 14 | ||||
| -rw-r--r-- | chrome-extension/options.html | 24 | ||||
| -rw-r--r-- | chrome-extension/options.js | 19 | ||||
| -rw-r--r-- | firefox-addon/README.md | 0 | ||||
| -rw-r--r-- | firefox-addon/doc/main.md | 0 | ||||
| -rw-r--r-- | firefox-addon/lib/main.js | 26 | ||||
| -rw-r--r-- | firefox-addon/package.json | 23 | ||||
| -rw-r--r-- | firefox-addon/test/test-main.js | 12 |
9 files changed, 0 insertions, 165 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); - } - }); - } -}); - - diff --git a/chrome-extension/manifest.json b/chrome-extension/manifest.json deleted file mode 100644 index a8ebd0a..0000000 --- a/chrome-extension/manifest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "Webpage Logger", - "version": "0.1", - "description": "Notify a callback URL", - "manifest_version": 2, - "background": { - "scripts": ["bg.js"] - }, - "permissions": [ - "tabs", - "storage" - ], - "options_page": "options.html" -} diff --git a/chrome-extension/options.html b/chrome-extension/options.html deleted file mode 100644 index b09837d..0000000 --- a/chrome-extension/options.html +++ /dev/null @@ -1,24 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>Webpage Logger Options</title> - <style> - body { - margin-left: 2em; - font-family: sans-serif - } - </style> -</head> -<body> - <h2>Webpage Logger</h2> - <label> - Callback URL: <input id="callback" type="text"> - </label> - <br> - <label> - Browser Key: <input id="key" type="text"> - </label> - <script src='options.js'></script> -</body> -</html> diff --git a/chrome-extension/options.js b/chrome-extension/options.js deleted file mode 100644 index 6f8a780..0000000 --- a/chrome-extension/options.js +++ /dev/null @@ -1,19 +0,0 @@ -function save() { - var data = {}; - data[this.id] = this.value; - chrome.storage.local.set(data); -} - -function restore_options() { - chrome.storage.local.get({ - callback: 'http://localhost:8080', - key: 'chrome' - }, function(options) { - document.getElementById('callback').value = options.callback; - document.getElementById('key').value = options.key; - }); -} - -document.getElementById('callback').addEventListener('change', save); -document.getElementById('key').addEventListener('change', save); -document.addEventListener('DOMContentLoaded', restore_options); diff --git a/firefox-addon/README.md b/firefox-addon/README.md deleted file mode 100644 index e69de29..0000000 --- a/firefox-addon/README.md +++ /dev/null diff --git a/firefox-addon/doc/main.md b/firefox-addon/doc/main.md deleted file mode 100644 index e69de29..0000000 --- a/firefox-addon/doc/main.md +++ /dev/null diff --git a/firefox-addon/lib/main.js b/firefox-addon/lib/main.js deleted file mode 100644 index cc8845e..0000000 --- a/firefox-addon/lib/main.js +++ /dev/null @@ -1,26 +0,0 @@ -var windows = require("sdk/windows").browserWindows; -var tabs = require("sdk/tabs"); -var Request = require("sdk/request").Request; -var prefs = require("sdk/simple-prefs").prefs; -var XMLHttpRequest = require("sdk/net/xhr").XMLHttpRequest; - -function log(url, title){ - 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.send(data); -} - -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 ); -windows.on("activate", function () { logTab(tabs.activeTab) }); -windows.on("deactivate", function () { log(null, null) }); diff --git a/firefox-addon/package.json b/firefox-addon/package.json deleted file mode 100644 index 6c89753..0000000 --- a/firefox-addon/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "url-logger", - "title": "URL Logger", - "id": "jid1-KLw59UduPgRwag", - "description": "Notify a callback url whenever a page is loaded/shown.", - "author": "Thibaut Horel <thibaut@horel.org>", - "license": "MPL 2.0", - "version": "0.1", - "preferences": [{ - "name": "callbackUrl", - "type": "string", - "title": "CallbackĀ URL", - "description": "URL to be notified on page load/show.", - "value": "http://localhost:8080" - }, - { - "name": "key", - "type": "string", - "title": "Browser key", - "description": "Key to identify the browser.", - "value": "firefox" - }] -} diff --git a/firefox-addon/test/test-main.js b/firefox-addon/test/test-main.js deleted file mode 100644 index 147f98a..0000000 --- a/firefox-addon/test/test-main.js +++ /dev/null @@ -1,12 +0,0 @@ -var main = require("./main"); - -exports["test main"] = function(assert) { - assert.pass("Unit test running!"); -}; - -exports["test main async"] = function(assert, done) { - assert.pass("async Unit test running!"); - done(); -}; - -require("sdk/test").run(exports); |
