summaryrefslogtreecommitdiffstats
path: root/chrome-extension/options.js
blob: 6f8a780b3bdf32ce4bd01d4727f472234b54d6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);