aboutsummaryrefslogtreecommitdiffstats
path: root/chrome-extension/options.js
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-07-10 23:10:27 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2014-07-10 23:10:27 -0400
commit839b1245a2137fc3c4474b4ed8d04590b4245611 (patch)
tree02e125523ed235bd5f4ee5fb086dc8e4fd89d41e /chrome-extension/options.js
parente53a6e3c651a3191e24b05ff9d69e871632ddbf8 (diff)
downloadbrowsing-activity-tracker-839b1245a2137fc3c4474b4ed8d04590b4245611.tar.gz
[Chrome extension] Add option handling
Diffstat (limited to 'chrome-extension/options.js')
-rw-r--r--chrome-extension/options.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome-extension/options.js b/chrome-extension/options.js
new file mode 100644
index 0000000..6f8a780
--- /dev/null
+++ b/chrome-extension/options.js
@@ -0,0 +1,19 @@
+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);