From 0bbd05c8b858504948b83ebd41f411e2ba8ec745 Mon Sep 17 00:00:00 2001 From: AlexisinGit <136088944+AlexisinGit@users.noreply.github.com> Date: Wed, 24 Sep 2025 02:38:53 +0800 Subject: [PATCH] account-cheats button emit payload --- static/webui/script.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/static/webui/script.js b/static/webui/script.js index 40b68999..d2560902 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -3218,10 +3218,9 @@ function doIntrinsicsUnlockAll() { }); } -document.querySelectorAll("#account-cheats input[type=checkbox], #account-cheats input[type=number]").forEach(elm => { +document.querySelectorAll("#account-cheats input[type=checkbox]").forEach(elm => { elm.onchange = function () { revalidateAuthz().then(() => { - const value = elm.type === "checkbox" ? elm.checked : elm.value; $.post({ url: "/custom/setAccountCheat?" + window.authz, contentType: "application/json", @@ -3234,6 +3233,32 @@ document.querySelectorAll("#account-cheats input[type=checkbox], #account-cheats }; }); +document.querySelectorAll("#account-cheats .input-group").forEach(grp => { + const input = grp.querySelector("input"); + const btn = grp.querySelector("button"); + input.oninput = input.onchange = function () { + btn.classList.remove("btn-secondary"); + btn.classList.add("btn-primary"); + }; + btn.onclick = function () { + btn.classList.remove("btn-primary"); + btn.classList.add("btn-secondary"); + const input = btn.closest(".input-group").querySelector('input[type="number"]'); + if (!input) return; + revalidateAuthz().then(() => { + const value = input.value; + $.post({ + url: "/custom/setAccountCheat?" + window.authz, + contentType: "application/json", + data: JSON.stringify({ + key: input.id, + value: value + }) + }); + }); + }; +}); + document.querySelectorAll("#guild-cheats input[type=checkbox]").forEach(elm => { elm.onchange = function () { revalidateAuthz().then(() => {