chore(webui): give feedback via toasts instead of alerts #1269
@ -593,6 +593,7 @@
 | 
			
		||||
                <button class="btn btn-primary mt-3" onclick="doImport();" data-loc="import_submit"></button>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="toast-container position-fixed bottom-0 end-0 p-3"></div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <datalist id="datalist-Suits"></datalist>
 | 
			
		||||
    <datalist id="datalist-SpaceSuits"></datalist>
 | 
			
		||||
 | 
			
		||||
@ -707,7 +707,7 @@ function maxRankAllEquipment(categories) {
 | 
			
		||||
                return sendBatchGearExp(batchData);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            alert(loc("code_noEquipmentToRankUp"));
 | 
			
		||||
            toast(loc("code_noEquipmentToRankUp"));
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -740,6 +740,7 @@ function sendBatchGearExp(data) {
 | 
			
		||||
            contentType: "application/json",
 | 
			
		||||
            data: JSON.stringify(data)
 | 
			
		||||
        }).done(() => {
 | 
			
		||||
            toast(loc("code_succRankUp"));
 | 
			
		||||
            updateInventory();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
@ -822,7 +823,7 @@ function doAcquireMiscItems() {
 | 
			
		||||
                }
 | 
			
		||||
            ])
 | 
			
		||||
        }).done(function () {
 | 
			
		||||
            alert(loc("code_succAdded"));
 | 
			
		||||
            toast(loc("code_succAdded"));
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -1019,9 +1020,9 @@ function doUnlockAllFocusSchools() {
 | 
			
		||||
                await unlockFocusSchool(upgradeType);
 | 
			
		||||
            }
 | 
			
		||||
            if (Object.keys(missingFocusUpgrades).length == 0) {
 | 
			
		||||
                alert(loc("code_focusAllUnlocked"));
 | 
			
		||||
                toast(loc("code_focusAllUnlocked"));
 | 
			
		||||
            } else {
 | 
			
		||||
                alert(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
 | 
			
		||||
                toast(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
@ -1155,7 +1156,7 @@ function doImport() {
 | 
			
		||||
                inventory: JSON.parse($("#import-inventory").val())
 | 
			
		||||
            })
 | 
			
		||||
        }).then(function () {
 | 
			
		||||
            alert(loc("code_succImport"));
 | 
			
		||||
            toast(loc("code_succImport"));
 | 
			
		||||
            updateInventory();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
@ -1192,3 +1193,20 @@ function doQuestUpdate(operation) {
 | 
			
		||||
        updateInventory();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function toast(text) {
 | 
			
		||||
    const toast = document.createElement("div");
 | 
			
		||||
    toast.className = "toast align-items-center text-bg-primary border-0";
 | 
			
		||||
    const div = document.createElement("div");
 | 
			
		||||
    div.className = "d-flex";
 | 
			
		||||
    const body = document.createElement("div");
 | 
			
		||||
    body.className = "toast-body";
 | 
			
		||||
    body.textContent = text;
 | 
			
		||||
    div.appendChild(body);
 | 
			
		||||
    const button = document.createElement("button");
 | 
			
		||||
    button.className = "btn-close btn-close-white me-2 m-auto";
 | 
			
		||||
    button.setAttribute("data-bs-dismiss", "toast");
 | 
			
		||||
    div.appendChild(button);
 | 
			
		||||
    toast.appendChild(div);
 | 
			
		||||
    new bootstrap.Toast(document.querySelector(".toast-container").appendChild(toast)).show();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ dict = {
 | 
			
		||||
    code_renamePrompt: `Neuen benutzerdefinierten Namen eingeben:`,
 | 
			
		||||
    code_remove: `Entfernen`,
 | 
			
		||||
    code_addItemsConfirm: `Bist du sicher, dass du |COUNT| Gegenstände zu deinem Account hinzufügen möchtest?`,
 | 
			
		||||
    code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
 | 
			
		||||
    code_noEquipmentToRankUp: `Keine Ausstattung zum Rangaufstieg verfügbar.`,
 | 
			
		||||
    code_succAdded: `Erfolgreich hinzugefügt.`,
 | 
			
		||||
    code_buffsNumber: `Anzahl der Buffs`,
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ dict = {
 | 
			
		||||
    code_renamePrompt: `Enter new custom name:`,
 | 
			
		||||
    code_remove: `Remove`,
 | 
			
		||||
    code_addItemsConfirm: `Are you sure you want to add |COUNT| items to your account?`,
 | 
			
		||||
    code_succRankUp: `Successfully ranked up.`,
 | 
			
		||||
    code_noEquipmentToRankUp: `No equipment to rank up.`,
 | 
			
		||||
    code_succAdded: `Successfully added.`,
 | 
			
		||||
    code_buffsNumber: `Number of buffs`,
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ dict = {
 | 
			
		||||
    code_renamePrompt: `Nouveau nom :`,
 | 
			
		||||
    code_remove: `Retirer`,
 | 
			
		||||
    code_addItemsConfirm: `Ajouter |COUNT| items à l'inventaire ?`,
 | 
			
		||||
    code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
 | 
			
		||||
    code_noEquipmentToRankUp: `No equipment to rank up.`,
 | 
			
		||||
    code_succAdded: `Ajouté.`,
 | 
			
		||||
    code_buffsNumber: `Nombre de buffs`,
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ dict = {
 | 
			
		||||
    code_renamePrompt: `Введите новое имя:`,
 | 
			
		||||
    code_remove: `Удалить`,
 | 
			
		||||
    code_addItemsConfirm: `Вы уверены, что хотите добавить |COUNT| предметов на ваш аккаунт?`,
 | 
			
		||||
    code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
 | 
			
		||||
    code_noEquipmentToRankUp: `Нет снаряжения для повышения ранга.`,
 | 
			
		||||
    code_succAdded: `Успешно добавлено.`,
 | 
			
		||||
    code_buffsNumber: `Количество усилений`,
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ dict = {
 | 
			
		||||
    code_renamePrompt: `输入新的自定义名称:`,
 | 
			
		||||
    code_remove: `移除`,
 | 
			
		||||
    code_addItemsConfirm: `确定要向账户添加 |COUNT| 件物品吗?`,
 | 
			
		||||
    code_succRankUp: `[UNTRANSLATED] Successfully ranked up.`,
 | 
			
		||||
    code_noEquipmentToRankUp: `没有可升级的装备。`,
 | 
			
		||||
    code_succAdded: `已成功添加。`,
 | 
			
		||||
    code_buffsNumber: `增益数量`,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user