-
Notifications
You must be signed in to change notification settings - Fork 3
/
menu.js
42 lines (32 loc) · 1.2 KB
/
menu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function () {
function onError(error) {
console.log(`Error: ${error}`);
}
function onGot(item) {
// document.getElementById('links').checked = item.params.links;
// document.getElementById('schema').checked = item.params.schema;
document.getElementById('selection').checked = item.params.selection;
}
var getting = browser.storage.sync.get("params");
getting.then(onGot, onError);
document.addEventListener('change', function (e) {
browser.storage.sync.set({
params: {
links: false, // document.getElementById('links').checked,
schema: false, // document.getElementById('schema').checked,
selection: document.getElementById('selection').checked,
}
});
browser.tabs.query({active: true, currentWindow: true})
.then(function (tabs) {
var i, l = tabs.length;
for (i = 0; i < l; i++) {
browser.tabs.sendMessage(tabs[i].id, {
command: "edam-popovers:update",
});
}
})
.catch(function (err) {
});
});
})();