forked from jonathanKingston/new-container-tab
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.js
More file actions
27 lines (24 loc) · 742 Bytes
/
options.js
File metadata and controls
27 lines (24 loc) · 742 Bytes
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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/
*
* © 2021 Roy Orbison
* */
const excludeRadio = document.forms.prefs.elements.restriction,
exclKey = 'excludeDefault',
store = browser.storage.sync;
store.get(exclKey).then(res => {
excludeRadio.forEach(option => {
option.disabled = false;
option.checked = option.value == +(res && res[exclKey] || 0);
option.addEventListener('change', function() {
if (option.checked) {
const upd = {
[exclKey]: +option.value
};
store.set(upd)
.catch(() => excludeRadio.checked = !upd[exclKey]);
}
});
});
});