-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
28 lines (23 loc) · 904 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
const defaultBlurStrength = 8;
function saveOptions(e) {
e.preventDefault();
browser.storage.sync.set({
blur: document.querySelector("#blurrange").value
});
}
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#blurrange").value = result.blur || defaultBlurStrength;
document.querySelector("#strength").textContent = result.blur || defaultBlurStrength;
}
function onError(error) {
console.log(`Error: ${error}`);
}
let getting = browser.storage.sync.get("blur");
getting.then(setCurrentChoice, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);
document.querySelector("#blurrange").addEventListener("input", (event) => {
document.querySelector("#strength").textContent = event.target.value;
});