-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
31 lines (24 loc) · 1020 Bytes
/
options.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
function saveOptions(e) {
e.preventDefault();
browser.storage.sync.set({
groups: document.querySelector("#hidden-groups").value,
uploaders: document.querySelector("#hidden-uploaders").value
});
}
function restoreOptions() {
function setCurrentChoiceGroups(result) {
document.querySelector("#hidden-groups").value = result.groups || "";
}
function setCurrentChoiceUploaders(result) {
document.querySelector("#hidden-uploaders").value = result.uploaders || "";
}
function onError(error) {
console.log(`Error: ${error}`);
}
let getting_groups = browser.storage.sync.get("groups");
getting_groups.then(setCurrentChoiceGroups, onError);
let getting_uploaders = browser.storage.sync.get("uploaders");
getting_uploaders.then(setCurrentChoiceUploaders, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);