simplify/improve the element query
All checks were successful
Build / build (pull_request) Successful in 1m31s
All checks were successful
Build / build (pull_request) Successful in 1m31s
This commit is contained in:
parent
782b9a8275
commit
daf492bf2f
@ -1984,16 +1984,14 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
|
||||
$(".config-admin-show").removeClass("d-none");
|
||||
Object.entries(json).forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
var x = document.getElementById(`${key}`);
|
||||
if (x != null) {
|
||||
if (x.type == "checkbox") {
|
||||
x.checked = value;
|
||||
} else if (x.classList.contains("tags-input")) {
|
||||
x.value = value.join(", ");
|
||||
x.oninput();
|
||||
} else {
|
||||
x.value = value ?? x.getAttribute("data-default");
|
||||
}
|
||||
var elm = document.getElementById(key);
|
||||
if (elm.type == "checkbox") {
|
||||
elm.checked = value;
|
||||
} else if (elm.classList.contains("tags-input")) {
|
||||
elm.value = value.join(", ");
|
||||
elm.oninput();
|
||||
} else {
|
||||
elm.value = value ?? elm.getAttribute("data-default");
|
||||
}
|
||||
});
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user