返回提交历史
Modified
package-lock.json
+4
-4
Modified
package.json
+1
-1
Modified
src/controllers/custom/getItemListsController.ts
+4
-2
Modified
static/webui/script.js
+16
-11
XFEstudio/XFESpaceNinjaServer
chore(webui): exclude always available items from datalist (#2783)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2783 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
6c2b7a61
代码差异
4 个文件
+25
-18
@@ -17,7 +17,7 @@
17
17
"morgan": "^1.10.0",
18
18
"ncp": "^2.0.0",
19
19
"undici": "^7.10.0",
20
"warframe-public-export-plus": "^0.5.88",
20
"warframe-public-export-plus": "^0.5.89",
21
21
"warframe-riven-info": "^0.1.2",
22
22
"winston": "^3.17.0",
23
23
"winston-daily-rotate-file": "^5.0.0",
@@ -5532,9 +5532,9 @@
5532
5532
}
5533
5533
},
5534
5534
"node_modules/warframe-public-export-plus": {
5535
"version": "0.5.88",
5536
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.88.tgz",
5537
"integrity": "sha512-uX766+MYDY3pMncu/23Dp9VZvrUe8pdWRWMcxfUbXg29aYO2GqipimHaFtw+vfrY06YAE8nbFkCWhFL3oPDPGw=="
5535
"version": "0.5.89",
5536
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.89.tgz",
5537
"integrity": "sha512-a6dM1MirzofSsuv3LlRQHFLSSIGKPVSN93dcXSDmA3njsWqOGjJJdWyXqcyxxYw8rEB8CNowSHst/MUmKvKlRg=="
5538
5538
},
5539
5539
"node_modules/warframe-riven-info": {
5540
5540
"version": "0.1.2",
@@ -35,7 +35,7 @@
35
35
"morgan": "^1.10.0",
36
36
"ncp": "^2.0.0",
37
37
"undici": "^7.10.0",
38
"warframe-public-export-plus": "^0.5.88",
38
"warframe-public-export-plus": "^0.5.89",
39
39
"warframe-riven-info": "^0.1.2",
40
40
"winston": "^3.17.0",
41
41
"winston-daily-rotate-file": "^5.0.0",
@@ -36,6 +36,7 @@ interface ListedItem {
36
36
partType?: string;
37
37
chainLength?: number;
38
38
parazon?: boolean;
39
alwaysAvailable?: boolean;
39
40
}
40
41
41
42
interface ItemLists {
@@ -455,8 +456,9 @@ const getItemListsController: RequestHandler = (req, response) => {
455
456
456
457
for (const [uniqueName, item] of Object.entries(ExportFlavour)) {
457
458
res.FlavourItems.push({
458
uniqueName: uniqueName,
459
name: getString(item.name, lang)
459
uniqueName,
460
name: getString(item.name, lang),
461
alwaysAvailable: item.alwaysAvailable
460
462
});
461
463
}
462
464
@@ -594,10 +594,12 @@ function fetchItemList() {
594
594
} else if (item.uniqueName.includes("ColourPicker")) {
595
595
item.name = loc("code_itemColorPalette").split("|ITEM|").join(item.name);
596
596
}
597
const option = document.createElement("option");
598
option.setAttribute("data-key", item.uniqueName);
599
option.value = item.name;
600
document.getElementById("datalist-" + type).appendChild(option);
597
if (!item.alwaysAvailable) {
598
const option = document.createElement("option");
599
option.setAttribute("data-key", item.uniqueName);
600
option.value = item.name;
601
document.getElementById("datalist-" + type).appendChild(option);
602
}
601
603
itemMap[item.uniqueName] = { ...item, type };
602
604
});
603
605
} else {
@@ -993,12 +995,12 @@ function updateInventory() {
993
995
document.getElementById("FlavourItems-list").innerHTML = "";
994
996
data.FlavourItems.forEach(item => {
995
997
const datalist = document.getElementById("datalist-FlavourItems");
996
if (!data.FlavourItems.some(x => x.ItemType == item.uniqueName)) {
997
if (!datalist.querySelector(`option[value="${item.uniqueName}"]`)) {
998
if (!data.FlavourItems.some(x => x.ItemType == item.ItemType)) {
999
if (!datalist.querySelector(`option[data-key="${item.ItemType}"]`)) {
998
1000
reAddToItemList(itemMap, "FlavourItems", item.ItemType);
999
1001
}
1000
1002
}
1001
const optionToRemove = datalist.querySelector(`option[value="${item.ItemType}"]`);
1003
const optionToRemove = datalist.querySelector(`option[data-key="${item.ItemType}"]`);
1002
1004
optionToRemove?.remove();
1003
1005
1004
1006
const tr = document.createElement("tr");
@@ -3408,10 +3410,13 @@ function doAddCurrency(currency) {
3408
3410
}
3409
3411
3410
3412
function reAddToItemList(itemMap, datalist, itemType) {
3411
const option = document.createElement("option");
3412
option.setAttribute("data-key", itemType);
3413
option.value = itemMap[itemType]?.name ?? itemType;
3414
document.getElementById("datalist-" + datalist).appendChild(option);
3413
const item = itemMap[itemType];
3414
if (!item?.alwaysAvailable) {
3415
const option = document.createElement("option");
3416
option.setAttribute("data-key", itemType);
3417
option.value = item?.name ?? itemType;
3418
document.getElementById("datalist-" + datalist).appendChild(option);
3419
}
3415
3420
}
3416
3421
3417
3422
function doQuestUpdate(operation, itemType) {