forked from mobislan/TabAutoClose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.js
31 lines (24 loc) · 948 Bytes
/
settings.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
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);
function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
close_regex: document.querySelector("#close_regex").value,
reload_regex: document.querySelector("#reload_regex").value
});
}
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#close_regex").value = result.close_regex || "Request blocked";
}
function setCurrentChoice2(result) {
document.querySelector("#reload_regex").value = result.reload_regex || "Request blocked";
}
function onError(error) {
console.log(`Error: ${error}`);
}
var getting = browser.storage.local.get("close_regex");
getting.then(setCurrentChoice, onError);
var getting2 = browser.storage.local.get("reload_regex");
getting2.then(setCurrentChoice2, onError);
}