add remove button and clear input after add booster
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (pull_request) Successful in 2m42s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (pull_request) Successful in 2m42s
				
			This commit is contained in:
		
							parent
							
								
									58ea73a116
								
							
						
					
					
						commit
						fe9f19af1c
					
				@ -1033,6 +1033,17 @@ function updateInventory() {
 | 
			
		||||
                    const input = document.createElement("input");
 | 
			
		||||
                    const a = document.createElement("a");
 | 
			
		||||
 | 
			
		||||
                    const removeButton = document.createElement("a");
 | 
			
		||||
                    removeButton.title = loc("code_remove");
 | 
			
		||||
                    removeButton.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
 | 
			
		||||
                    removeButton.href = "#";
 | 
			
		||||
                    removeButton.onclick = function (event) {
 | 
			
		||||
                        event.preventDefault();
 | 
			
		||||
                        setBooster(ItemType, 0);
 | 
			
		||||
                    };
 | 
			
		||||
                    removeButton.classList.add("me-2");
 | 
			
		||||
                    td.appendChild(removeButton);
 | 
			
		||||
 | 
			
		||||
                    a.href = "#";
 | 
			
		||||
                    a.onclick = event => {
 | 
			
		||||
                        event.preventDefault();
 | 
			
		||||
@ -1053,7 +1064,7 @@ function updateInventory() {
 | 
			
		||||
                    td.appendChild(a);
 | 
			
		||||
 | 
			
		||||
                    const submit = () => {
 | 
			
		||||
                        if (doChangeBoosterExpiry(ItemType, input.value)) {
 | 
			
		||||
                        if (doChangeBoosterExpiry(ItemType, input)) {
 | 
			
		||||
                            inlineForm.style.display = "none";
 | 
			
		||||
                            input.value = "";
 | 
			
		||||
                            a.style.display = "inline";
 | 
			
		||||
@ -2099,7 +2110,7 @@ function handleModularSelection(category) {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setBooster(ItemType, ExpiryDate) {
 | 
			
		||||
function setBooster(ItemType, ExpiryDate, callback) {
 | 
			
		||||
    revalidateAuthz(() => {
 | 
			
		||||
        $.post({
 | 
			
		||||
            url: "/custom/setBooster?" + window.authz,
 | 
			
		||||
@ -2112,6 +2123,7 @@ function setBooster(ItemType, ExpiryDate) {
 | 
			
		||||
            ])
 | 
			
		||||
        }).done(function () {
 | 
			
		||||
            updateInventory();
 | 
			
		||||
            if (callback) callback();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -2123,17 +2135,18 @@ function doAcquireBoosters() {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    const ExpiryDate = Date.now() / 1000 + 3 * 24 * 60 * 60; // default 3 days
 | 
			
		||||
    setBooster(uniqueName, ExpiryDate);
 | 
			
		||||
    setBooster(uniqueName, ExpiryDate, () => {
 | 
			
		||||
        $("#acquire-type-Boosters").val("");
 | 
			
		||||
        updateInventory();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function doChangeBoosterExpiry(ItemType, ExpiryDateInput) {
 | 
			
		||||
    console.log("Changing booster expiry for", ItemType, "to", ExpiryDateInput);
 | 
			
		||||
    console.log("Changing booster expiry for", ItemType, "to", ExpiryDateInput.value);
 | 
			
		||||
    // cast local datetime string to unix timestamp
 | 
			
		||||
    const ExpiryDate = new Date(ExpiryDateInput).getTime() / 1000;
 | 
			
		||||
    const ExpiryDate = new Date(ExpiryDateInput.value).getTime() / 1000;
 | 
			
		||||
    if (isNaN(ExpiryDate)) {
 | 
			
		||||
        $("#expiry-date-" + ItemType)
 | 
			
		||||
            .addClass("is-invalid")
 | 
			
		||||
            .focus();
 | 
			
		||||
        ExpiryDateInput.addClass("is-invalid").focus();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    setBooster(ItemType, ExpiryDate);
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `Rang erhöhen`,
 | 
			
		||||
    code_rankDown: `Rang verringern`,
 | 
			
		||||
    code_count: `Anzahl`,
 | 
			
		||||
    code_changeExpiry: `[UNTRANSLATED] Change Expiry Time`,
 | 
			
		||||
    code_focusAllUnlocked: `Alle Fokus-Schulen sind bereits freigeschaltet.`,
 | 
			
		||||
    code_focusUnlocked: `|COUNT| neue Fokus-Schulen freigeschaltet! Ein Inventar-Update wird benötigt, damit die Änderungen im Spiel sichtbar werden. Die Sternenkarte zu besuchen, sollte der einfachste Weg sein, dies auszulösen.`,
 | 
			
		||||
    code_addModsConfirm: `Bist du sicher, dass du |COUNT| Mods zu deinem Account hinzufügen möchtest?`,
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `Rank up`,
 | 
			
		||||
    code_rankDown: `Rank down`,
 | 
			
		||||
    code_count: `Count`,
 | 
			
		||||
    code_changeExpiry: `Change Expiry Time`,
 | 
			
		||||
    code_focusAllUnlocked: `All focus schools are already unlocked.`,
 | 
			
		||||
    code_focusUnlocked: `Unlocked |COUNT| new focus schools! An inventory update will be needed for the changes to be reflected in-game. Visiting the navigation should be the easiest way to trigger that.`,
 | 
			
		||||
    code_addModsConfirm: `Are you sure you want to add |COUNT| mods to your account?`,
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `Subir de rango`,
 | 
			
		||||
    code_rankDown: `Bajar de rango`,
 | 
			
		||||
    code_count: `Cantidad`,
 | 
			
		||||
    code_changeExpiry: `[UNTRANSLATED] Change Expiry Time`,
 | 
			
		||||
    code_focusAllUnlocked: `Todas las escuelas de enfoque ya están desbloqueadas.`,
 | 
			
		||||
    code_focusUnlocked: `¡Desbloqueadas |COUNT| nuevas escuelas de enfoque! Se necesita una actualización del inventario para reflejar los cambios en el juego. Visitar la navegación debería ser la forma más sencilla de activarlo.`,
 | 
			
		||||
    code_addModsConfirm: `¿Estás seguro de que deseas agregar |COUNT| modificadores a tu cuenta?`,
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `Monter de rang`,
 | 
			
		||||
    code_rankDown: `Baisser de rang`,
 | 
			
		||||
    code_count: `Quantité`,
 | 
			
		||||
    code_changeExpiry: `[UNTRANSLATED] Change Expiry Time`,
 | 
			
		||||
    code_focusAllUnlocked: `Les écoles de Focus sont déjà déverrouillées.`,
 | 
			
		||||
    code_focusUnlocked: `|COUNT| écoles de Focus déverrouillées ! Synchronisation de l'inventaire nécessaire.`,
 | 
			
		||||
    code_addModsConfirm: `Ajouter |COUNT| mods à l'inventaire ?`,
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `Повысить Ранг`,
 | 
			
		||||
    code_rankDown: `Понизить Ранг`,
 | 
			
		||||
    code_count: `Количество`,
 | 
			
		||||
    code_changeExpiry: `[UNTRANSLATED] Change Expiry Time`,
 | 
			
		||||
    code_focusAllUnlocked: `Все школы фокуса уже разблокированы.`,
 | 
			
		||||
    code_focusUnlocked: `Разблокировано |COUNT| новых школ фокуса! Для отображения изменений в игре потребуется обновление инвентаря. Посещение навигации — самый простой способ этого добиться.`,
 | 
			
		||||
    code_addModsConfirm: `Вы уверены, что хотите добавить |COUNT| модов на ваш аккаунт?`,
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ dict = {
 | 
			
		||||
    code_rankUp: `[UNTRANSLATED] Rank up`,
 | 
			
		||||
    code_rankDown: `[UNTRANSLATED] Rank down`,
 | 
			
		||||
    code_count: `数量`,
 | 
			
		||||
    code_changeExpiry: `更改逾期时间`,
 | 
			
		||||
    code_focusAllUnlocked: `所有专精学派均已解锁。`,
 | 
			
		||||
    code_focusUnlocked: `已解锁 |COUNT| 个新专精学派!需要游戏内仓库更新才能生效,您可以通过访问星图来触发仓库更新。`,
 | 
			
		||||
    code_addModsConfirm: `确定要向账户添加 |COUNT| 张MOD吗?`,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user