From 1c2e865495ae22aa5241a6ca9e55aeadd9034bdc Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 27 Feb 2023 19:49:30 +0200 Subject: [PATCH] update currency values when buying awards from the award modal --- files/assets/js/award_modal.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index d4db64322..405876f7e 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -91,7 +91,11 @@ function vote(type, id, dir) { xhr[0].send(xhr[1]); } +let global_price; + function pick(kind, price, coins, marseybux) { + global_price = price; + price = parseInt(price) coins = parseInt(coins) marseybux = parseInt(marseybux) @@ -146,6 +150,9 @@ function buy(mb) { let ownednum = Number(owned.textContent) + 1; owned.textContent = ownednum } + + const currency = mb ? "bux" : "coins"; + document.getElementById(`user-${currency}-amount`).innerText = parseInt(document.getElementById(`user-${currency}-amount`).innerText) - global_price; } };