XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix(webui): always update config_data when changing a value (#4339)

Closes #4338 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4339 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

95f79476
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +16 -7
Modified static/webui/script.js +16 -7
@@ -3433,36 +3433,45 @@ document.querySelectorAll(".config-form .input-group").forEach(grp => {
3433 3433 });
3434 3434
3435 3435 function doSaveConfigInt(id) {
3436 const value = parseInt(document.getElementById(id).value);
3436 3437 $.post({
3437 3438 url: "/custom/setConfig?" + window.authz,
3438 3439 contentType: "application/json",
3439 3440 data: JSON.stringify({
3440 [id]: parseInt(document.getElementById(id).value)
3441 [id]: value
3441 3442 })
3443 }).done(function () {
3444 config_data[id] = value;
3442 3445 });
3443 3446 }
3444 3447
3445 3448 function doSaveConfigFloat(id) {
3449 const value = parseFloat(document.getElementById(id).value);
3446 3450 $.post({
3447 3451 url: "/custom/setConfig?" + window.authz,
3448 3452 contentType: "application/json",
3449 3453 data: JSON.stringify({
3450 [id]: parseFloat(document.getElementById(id).value)
3454 [id]: value
3451 3455 })
3456 }).done(function () {
3457 config_data[id] = value;
3452 3458 });
3453 3459 }
3454 3460
3455 3461 function doSaveConfigStringArray(id) {
3462 const value = document
3463 .getElementById(id)
3464 .getAttribute("data-tags-value")
3465 .split(", ")
3466 .filter(x => x);
3456 3467 $.post({
3457 3468 url: "/custom/setConfig?" + window.authz,
3458 3469 contentType: "application/json",
3459 3470 data: JSON.stringify({
3460 [id]: document
3461 .getElementById(id)
3462 .getAttribute("data-tags-value")
3463 .split(", ")
3464 .filter(x => x)
3471 [id]: value
3465 3472 })
3473 }).done(function () {
3474 config_data[id] = value;
3466 3475 });
3467 3476 }
3468 3477