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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

chore(webui): give feedback via toasts instead of alerts (#1269)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1269

aa95074e
Sainan <sainan@calamity.inc>
提交于

代码差异

7 个文件 +29 -5
Modified static/webui/index.html +1 -0
@@ -593,6 +593,7 @@
593 593 <button class="btn btn-primary mt-3" onclick="doImport();" data-loc="import_submit"></button>
594 594 </div>
595 595 </div>
596 <div class="toast-container position-fixed bottom-0 end-0 p-3"></div>
596 597 </div>
597 598 <datalist id="datalist-Suits"></datalist>
598 599 <datalist id="datalist-SpaceSuits"></datalist>
Modified static/webui/script.js +23 -5
@@ -707,7 +707,7 @@ function maxRankAllEquipment(categories) {
707 707 return sendBatchGearExp(batchData);
708 708 }
709 709
710 alert(loc("code_noEquipmentToRankUp"));
710 toast(loc("code_noEquipmentToRankUp"));
711 711 });
712 712 });
713 713 }
@@ -740,6 +740,7 @@ function sendBatchGearExp(data) {
740 740 contentType: "application/json",
741 741 data: JSON.stringify(data)
742 742 }).done(() => {
743 toast(loc("code_succRankUp"));
743 744 updateInventory();
744 745 });
745 746 });
@@ -822,7 +823,7 @@ function doAcquireMiscItems() {
822 823 }
823 824 ])
824 825 }).done(function () {
825 alert(loc("code_succAdded"));
826 toast(loc("code_succAdded"));
826 827 });
827 828 });
828 829 }
@@ -1019,9 +1020,9 @@ function doUnlockAllFocusSchools() {
1019 1020 await unlockFocusSchool(upgradeType);
1020 1021 }
1021 1022 if (Object.keys(missingFocusUpgrades).length == 0) {
1022 alert(loc("code_focusAllUnlocked"));
1023 toast(loc("code_focusAllUnlocked"));
1023 1024 } else {
1024 alert(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
1025 toast(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
1025 1026 }
1026 1027 });
1027 1028 });
@@ -1155,7 +1156,7 @@ function doImport() {
1155 1156 inventory: JSON.parse($("#import-inventory").val())
1156 1157 })
1157 1158 }).then(function () {
1158 alert(loc("code_succImport"));
1159 toast(loc("code_succImport"));
1159 1160 updateInventory();
1160 1161 });
1161 1162 });
@@ -1192,3 +1193,20 @@ function doQuestUpdate(operation) {
1192 1193 updateInventory();
1193 1194 });
1194 1195 }
1196
1197 function toast(text) {
1198 const toast = document.createElement("div");
1199 toast.className = "toast align-items-center text-bg-primary border-0";
1200 const div = document.createElement("div");
1201 div.className = "d-flex";
1202 const body = document.createElement("div");
1203 body.className = "toast-body";
1204 body.textContent = text;
1205 div.appendChild(body);
1206 const button = document.createElement("button");
1207 button.className = "btn-close btn-close-white me-2 m-auto";
1208 button.setAttribute("data-bs-dismiss", "toast");
1209 div.appendChild(button);
1210 toast.appendChild(div);
1211 new bootstrap.Toast(document.querySelector(".toast-container").appendChild(toast)).show();
1212 }
Modified static/webui/translations/de.js +1 -0
@@ -26,6 +26,7 @@ dict = {
26 26 code_renamePrompt: `Neuen benutzerdefinierten Namen eingeben:`,
27 27 code_remove: `Entfernen`,
28 28 code_addItemsConfirm: `Bist du sicher, dass du |COUNT| Gegenstände zu deinem Account hinzufügen möchtest?`,
29 code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
29 30 code_noEquipmentToRankUp: `Keine Ausstattung zum Rangaufstieg verfügbar.`,
30 31 code_succAdded: `Erfolgreich hinzugefügt.`,
31 32 code_buffsNumber: `Anzahl der Buffs`,
Modified static/webui/translations/en.js +1 -0
@@ -25,6 +25,7 @@ dict = {
25 25 code_renamePrompt: `Enter new custom name:`,
26 26 code_remove: `Remove`,
27 27 code_addItemsConfirm: `Are you sure you want to add |COUNT| items to your account?`,
28 code_succRankUp: `Successfully ranked up.`,
28 29 code_noEquipmentToRankUp: `No equipment to rank up.`,
29 30 code_succAdded: `Successfully added.`,
30 31 code_buffsNumber: `Number of buffs`,
Modified static/webui/translations/fr.js +1 -0
@@ -26,6 +26,7 @@ dict = {
26 26 code_renamePrompt: `Nouveau nom :`,
27 27 code_remove: `Retirer`,
28 28 code_addItemsConfirm: `Ajouter |COUNT| items à l'inventaire ?`,
29 code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
29 30 code_noEquipmentToRankUp: `No equipment to rank up.`,
30 31 code_succAdded: `Ajouté.`,
31 32 code_buffsNumber: `Nombre de buffs`,
Modified static/webui/translations/ru.js +1 -0
@@ -26,6 +26,7 @@ dict = {
26 26 code_renamePrompt: `Введите новое имя:`,
27 27 code_remove: `Удалить`,
28 28 code_addItemsConfirm: `Вы уверены, что хотите добавить |COUNT| предметов на ваш аккаунт?`,
29 code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
29 30 code_noEquipmentToRankUp: `Нет снаряжения для повышения ранга.`,
30 31 code_succAdded: `Успешно добавлено.`,
31 32 code_buffsNumber: `Количество усилений`,
Modified static/webui/translations/zh.js +1 -0
@@ -26,6 +26,7 @@ dict = {
26 26 code_renamePrompt: `输入新的自定义名称:`,
27 27 code_remove: `移除`,
28 28 code_addItemsConfirm: `确定要向账户添加 |COUNT| 件物品吗?`,
29 code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
29 30 code_noEquipmentToRankUp: `没有可升级的装备。`,
30 31 code_succAdded: `已成功添加。`,
31 32 code_buffsNumber: `增益数量`,