From a8ea8d1364662b6471e803422b8d09ee0233dd54 Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 6 May 2024 21:49:49 +0200 Subject: [PATCH] feat(webui): add "Remove" option for owned warframes & weapons (#172) --- static/webui/script.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/static/webui/script.js b/static/webui/script.js index 52ff2ce3..0a3de30c 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -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(); + }); +}