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

chore(webui): consistently use safe navigation when indexing itemMap (#3189)

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

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

代码差异

1 个文件 +5 -5
Modified static/webui/script.js +5 -5
@@ -1223,7 +1223,7 @@ function updateInventory() {
1223 1223 td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
1224 1224 if (!item.Completed) {
1225 1225 td.textContent +=
1226 " | " + loc("code_stage") + ": [" + stage + "/" + itemMap[item.ItemType].chainLength + "]";
1226 " | " + loc("code_stage") + ": [" + stage + "/" + itemMap[item.ItemType]?.chainLength + "]";
1227 1227 } else {
1228 1228 td.textContent += " | " + loc("code_completed");
1229 1229 }
@@ -1262,7 +1262,7 @@ function updateInventory() {
1262 1262 a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"/></svg>`;
1263 1263 td.appendChild(a);
1264 1264 }
1265 if (itemMap[item.ItemType].chainLength > stage && !item.Completed) {
1265 if (itemMap[item.ItemType]?.chainLength > stage && !item.Completed) {
1266 1266 const a = document.createElement("a");
1267 1267 a.href = "#";
1268 1268 a.onclick = function (event) {
@@ -1273,7 +1273,7 @@ function updateInventory() {
1273 1273 a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>`;
1274 1274 td.appendChild(a);
1275 1275 }
1276 if (stage > 0 && itemMap[item.ItemType].chainLength > 1) {
1276 if (stage > 0 && itemMap[item.ItemType]?.chainLength > 1) {
1277 1277 const a = document.createElement("a");
1278 1278 a.href = "#";
1279 1279 a.onclick = function (event) {
@@ -1285,9 +1285,9 @@ function updateInventory() {
1285 1285 td.appendChild(a);
1286 1286 }
1287 1287 if (
1288 itemMap[item.ItemType].chainLength > stage &&
1288 itemMap[item.ItemType]?.chainLength > stage &&
1289 1289 !item.Completed &&
1290 itemMap[item.ItemType].chainLength > 1
1290 itemMap[item.ItemType]?.chainLength > 1
1291 1291 ) {
1292 1292 const a = document.createElement("a");
1293 1293 a.href = "#";