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): hide non-applicable elements when updating detailedView (#3942)

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

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

代码差异

1 个文件 +26 -2
Modified static/webui/script.js +26 -2
@@ -3763,7 +3763,10 @@ single.getRoute("#detailedView-route").on("beforeload", async function () {
3763 3763 });
3764 3764
3765 3765 async function populateDetailedViewRoute() {
3766 const [data, itemMap] = await Promise.all([awaitAuthz().then(getInventoryData), window.itemListPromise]);
3766 const [data, itemMap] = await Promise.all([
3767 inventory_data ? Promise.resolve(inventory_data) : awaitAuthz().then(getInventoryData),
3768 window.itemListPromise
3769 ]);
3767 3770
3768 3771 const urlParams = new URLSearchParams(window.location.search);
3769 3772 const oid = urlParams.get("itemId");
@@ -3777,12 +3780,14 @@ async function populateDetailedViewRoute() {
3777 3780 const pipeIndex = item.ItemName.indexOf("|");
3778 3781 if (pipeIndex != -1) {
3779 3782 $("#detailedView-title").text(item.ItemName.substr(1 + pipeIndex) + " " + itemName);
3783 document.querySelector("#detailedView-route .text-body-secondary").textContent = "";
3780 3784 } else {
3781 3785 $("#detailedView-title").text(item.ItemName);
3782 3786 $("#detailedView-route .text-body-secondary").text(itemName);
3783 3787 }
3784 3788 } else {
3785 3789 $("#detailedView-title").text(itemName);
3790 document.querySelector("#detailedView-route .text-body-secondary").textContent = "";
3786 3791 }
3787 3792
3788 3793 if (category != "Upgrades") {
@@ -3852,6 +3857,9 @@ async function populateDetailedViewRoute() {
3852 3857 wrapper.appendChild(label);
3853 3858 buttonsCard.appendChild(wrapper);
3854 3859 }
3860 } else {
3861 document.getElementById("equipmentFeatures-card").classList.add("d-none");
3862 document.getElementById("equipmentFeaturesButtons-card").innerHTML = "";
3855 3863 }
3856 3864
3857 3865 if (category == "Suits") {
@@ -4015,7 +4023,14 @@ async function populateDetailedViewRoute() {
4015 4023 }
4016 4024 }
4017 4025 }
4018 } else if (["LongGuns", "Pistols", "Melee", "SpaceGuns", "SpaceMelee"].includes(category)) {
4026 } else {
4027 document.getElementById("loadout-card").classList.add("d-none");
4028 document.getElementById("archonShards-card").classList.add("d-none");
4029 document.getElementById("edit-suit-invigorations-card").classList.add("d-none");
4030 document.getElementById("umbraEchoes-card").classList.add("d-none");
4031 }
4032
4033 if (["LongGuns", "Pistols", "Melee", "SpaceGuns", "SpaceMelee"].includes(category)) {
4019 4034 document.getElementById("valenceBonus-card").classList.remove("d-none");
4020 4035 document.getElementById("valenceBonus-innateDamage").value = "";
4021 4036 document.getElementById("valenceBonus-procent").value = 25;
@@ -4026,7 +4041,10 @@ async function populateDetailedViewRoute() {
4026 4041 document.getElementById("valenceBonus-innateDamage").value = buff.Tag ?? "";
4027 4042 document.getElementById("valenceBonus-procent").value = Math.round(buffValue * 1000) / 10;
4028 4043 }
4044 } else {
4045 document.getElementById("valenceBonus-card").classList.add("d-none");
4029 4046 }
4047
4030 4048 if (U5Mods.includes(item.ItemType)) {
4031 4049 document.getElementById("u5ModEdit-card").classList.remove("d-none");
4032 4050 const oldFitsSelect = document.getElementById("u5ModEdit-fits");
@@ -4061,7 +4079,10 @@ async function populateDetailedViewRoute() {
4061 4079 createUpgradeInput(upgradeFields, itemMap, item.ItemType, up);
4062 4080 });
4063 4081 createUpgradeInput(upgradeFields, itemMap, item.ItemType, null);
4082 } else {
4083 document.getElementById("u5ModEdit-card").classList.add("d-none");
4064 4084 }
4085
4065 4086 if (modularWeapons.includes(item.ItemType)) {
4066 4087 document.getElementById("modularParts-card").classList.remove("d-none");
4067 4088 const form = document.getElementById("modularParts-form");
@@ -4089,6 +4110,9 @@ async function populateDetailedViewRoute() {
4089 4110 changeButton.setAttribute("data-loc", "cheats_changeButton");
4090 4111 changeButton.innerHTML = loc("cheats_changeButton");
4091 4112 form.appendChild(changeButton);
4113 } else {
4114 document.getElementById("modularParts-card").classList.add("d-none");
4115 document.getElementById("modularParts-form").innerHTML = "";
4092 4116 }
4093 4117 } else {
4094 4118 single.loadRoute("/webui/inventory");