-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
20 lines (18 loc) · 858 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
foreground: document.querySelector('#foreground').checked,
suppressConfirm: document.querySelector('#suppress-confirm').checked,
markRead: document.querySelector('#mark-read').checked,
openSaved: document.querySelector('#open-saved').checked,
});
}
async function restoreOptions() {
const storage = await browser.storage.local.get();
document.querySelector('#foreground').checked = storage.foreground;
document.querySelector('#suppress-confirm').checked = storage.suppressConfirm;
document.querySelector('#mark-read').checked = storage.markRead;
document.querySelector('#open-saved').checked = storage.openSaved;
}
document.addEventListener('DOMContentLoaded', restoreOptions);
document.querySelector('form').addEventListener('submit', saveOptions);