length setting, some deconj fixes
This commit is contained in:
1 parent
86bb4d4c0d
commit
d8246c59f8
4 files changed
+22
-14
No files matched your search
+9
-2
@@ -2,16 +2,17 @@ function restoreListeners()
|
||||
{
|
||||
document.querySelector("#enabled").addEventListener("change", setOptions);
|
||||
document.querySelector("#compact").addEventListener("change", setOptions);
|
||||
document.querySelector("#length").addEventListener("change", setOptions);
|
||||
}
|
||||
function removeListeners()
|
||||
{
|
||||
document.querySelector("#enabled").removeEventListener("change", setOptions);
|
||||
document.querySelector("#compact").removeEventListener("change", setOptions);
|
||||
document.querySelector("#length").removeEventListener("change", setOptions);
|
||||
}
|
||||
|
||||
async function restoreOptions()
|
||||
{
|
||||
restoreListeners();
|
||||
try
|
||||
{
|
||||
let enabled = (await browser.storage.local.get("enabled")).enabled;
|
||||
@@ -20,12 +21,17 @@ async function restoreOptions()
|
||||
let compact = (await browser.storage.local.get("compact")).compact;
|
||||
if(compact == undefined)
|
||||
compact = true;
|
||||
let length = (await browser.storage.local.get("length")).length;
|
||||
if(length == undefined)
|
||||
length = 25;
|
||||
removeListeners();
|
||||
document.querySelector("#enabled").checked = enabled?true:false;
|
||||
document.querySelector("#compact").checked = compact?true:false;
|
||||
restoreListeners();
|
||||
document.querySelector("#length").value = length?length:25;
|
||||
}
|
||||
catch (error){}
|
||||
removeListeners();
|
||||
restoreListeners();
|
||||
}
|
||||
|
||||
function setOptions()
|
||||
@@ -34,6 +40,7 @@ function setOptions()
|
||||
{
|
||||
enabled: document.querySelector("#enabled").checked,
|
||||
compact: document.querySelector("#compact").checked,
|
||||
length: parseInt(document.querySelector("#length").value),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user