This commit is contained in:
cilame 2021-10-11 12:43:26 +08:00
parent 660d1f0a52
commit 5300a40f9d

View File

@ -48,4 +48,27 @@ function _mk_html(input, clsname){
// Array.from(document.getElementsByClassName('getsets-e2')).map(function(e){e.style.display='none'})
_mk_html(getsets, 'getsets')
_mk_html(funcs, 'funcs')
_mk_html(funcs, 'funcs')
document.querySelectorAll("input").forEach(function(v){
chrome.storage.sync.get([v.dataset.key], function (result) {
if (v.type == 'checkbox'){
v.checked = result[v.dataset.key];
}
if (v.type == 'text'){
v.value = result[v.dataset.key] || '';
}
})
v.addEventListener("change", function (e) {
if (v.type == 'checkbox'){
chrome.storage.sync.set({
[e.target.dataset.key]: e.target.checked
})
}
if (v.type == 'text'){
chrome.storage.sync.set({
[e.target.dataset.key]: e.target.value
})
}
})
})