返回提交历史
Modified
static/webui/script.js
+20
-13
XFEstudio/SpaceNinjaServer
chore(webui): make add mods behave more like adding items (#1732)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1732 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
26f37f58
代码差异
1 个文件
+20
-13
@@ -1260,21 +1260,28 @@ function doAcquireMod() {
1260
1260
$("#mod-to-acquire").addClass("is-invalid").focus();
1261
1261
return;
1262
1262
}
1263
revalidateAuthz(() => {
1264
$.post({
1265
url: "/custom/addItems?" + window.authz,
1266
contentType: "application/json",
1267
data: JSON.stringify([
1268
{
1269
ItemType: uniqueName,
1270
ItemCount: parseInt($("#mod-count").val())
1263
const count = parseInt($("#mod-count").val());
1264
if (count != 0) {
1265
revalidateAuthz(() => {
1266
$.post({
1267
url: "/custom/addItems?" + window.authz,
1268
contentType: "application/json",
1269
data: JSON.stringify([
1270
{
1271
ItemType: uniqueName,
1272
ItemCount: count
1273
}
1274
])
1275
}).done(function () {
1276
if (count > 0) {
1277
toast(loc("code_succAdded"));
1278
} else {
1279
toast(loc("code_succRemoved"));
1271
1280
}
1272
])
1273
}).done(function () {
1274
document.getElementById("mod-to-acquire").value = "";
1275
updateInventory();
1281
updateInventory();
1282
});
1276
1283
});
1277
});
1284
}
1278
1285
}
1279
1286
1280
1287
const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id);