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");
|
$(".config-admin-show").removeClass("d-none");
|
||||||
Object.entries(json).forEach(entry => {
|
Object.entries(json).forEach(entry => {
|
||||||
const [key, value] = entry;
|
const [key, value] = entry;
|
||||||
var x = document.getElementById(`${key}`);
|
var elm = document.getElementById(key);
|
||||||
if (x != null) {
|
if (elm.type == "checkbox") {
|
||||||
if (x.type == "checkbox") {
|
elm.checked = value;
|
||||||
x.checked = value;
|
} else if (elm.classList.contains("tags-input")) {
|
||||||
} else if (x.classList.contains("tags-input")) {
|
elm.value = value.join(", ");
|
||||||
x.value = value.join(", ");
|
elm.oninput();
|
||||||
x.oninput();
|
|
||||||
} else {
|
} else {
|
||||||
x.value = value ?? x.getAttribute("data-default");
|
elm.value = value ?? elm.getAttribute("data-default");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user