feat(webui): add "Remove" option for owned warframes & weapons (#172)
This commit is contained in:
		
							parent
							
								
									abe139151a
								
							
						
					
					
						commit
						a8ea8d1364
					
				@ -83,6 +83,16 @@ function updateInventory() {
 | 
			
		||||
                        };
 | 
			
		||||
                        a.textContent = "Make Rank 30";
 | 
			
		||||
                        td.appendChild(a);
 | 
			
		||||
                        td.innerHTML += " · ";
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        const a = document.createElement("a");
 | 
			
		||||
                        a.href = "#";
 | 
			
		||||
                        a.onclick = function () {
 | 
			
		||||
                            disposeOfGear("Suits", item.ItemId.$oid);
 | 
			
		||||
                        };
 | 
			
		||||
                        a.textContent = "Remove";
 | 
			
		||||
                        td.appendChild(a);
 | 
			
		||||
                    }
 | 
			
		||||
                    tr.appendChild(td);
 | 
			
		||||
                }
 | 
			
		||||
@ -109,6 +119,16 @@ function updateInventory() {
 | 
			
		||||
                            };
 | 
			
		||||
                            a.textContent = "Make Rank 30";
 | 
			
		||||
                            td.appendChild(a);
 | 
			
		||||
                            td.innerHTML += " · ";
 | 
			
		||||
                        }
 | 
			
		||||
                        {
 | 
			
		||||
                            const a = document.createElement("a");
 | 
			
		||||
                            a.href = "#";
 | 
			
		||||
                            a.onclick = function () {
 | 
			
		||||
                                disposeOfGear(category, item.ItemId.$oid);
 | 
			
		||||
                            };
 | 
			
		||||
                            a.textContent = "Remove";
 | 
			
		||||
                            td.appendChild(a);
 | 
			
		||||
                        }
 | 
			
		||||
                        tr.appendChild(td);
 | 
			
		||||
                    }
 | 
			
		||||
@ -197,3 +217,23 @@ function addGearExp(category, oid, xp) {
 | 
			
		||||
        updateInventory();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function disposeOfGear(category, oid) {
 | 
			
		||||
    const data = {
 | 
			
		||||
        SellCurrency: "SC_RegularCredits",
 | 
			
		||||
        SellPrice: 0,
 | 
			
		||||
        Items: {}
 | 
			
		||||
    };
 | 
			
		||||
    data.Items[category] = [
 | 
			
		||||
        {
 | 
			
		||||
            String: oid
 | 
			
		||||
        }
 | 
			
		||||
    ];
 | 
			
		||||
    $.post({
 | 
			
		||||
        url: "/api/sell.php?accountId=" + window.accountId,
 | 
			
		||||
        contentType: "text/plain",
 | 
			
		||||
        data: JSON.stringify(data)
 | 
			
		||||
    }).done(function () {
 | 
			
		||||
        updateInventory();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user