master
Aevann1 2021-09-28 00:00:28 +02:00
parent e40cdbcec6
commit 48b8534db7
1 changed files with 25 additions and 1 deletions

View File

@ -43,7 +43,31 @@
{% block desktopUserBanner %}
<!-- Desktop -->
<script src="/assets/js/userpage.js"></script>>
<script src="/assets/js/userpage2.js"></script>>
<script>
function transferCoins(mobile=false) {
let t = event.target;
t.disabled = true;
let amount = parseInt(document.getElementById("coins-transfer-amount").value);
let transferred = amount - Math.ceil(amount*TRANSFER_TAX);
post_toast_callback("/@{{u.username}}/transfer_coins",
{"amount": document.getElementById(mobile ? "coins-transfer-amount-mobile" : "coins-transfer-amount").value},
(xhr) => {
if(xhr.status == 200) {
document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - amount;
document.getElementById("profile-coins-amount-mobile").innerText = parseInt(document.getElementById("profile-coins-amount-mobile").innerText) + transferred;
document.getElementById("profile-coins-amount").innerText = parseInt(document.getElementById("profile-coins-amount").innerText) + transferred;
}
}
);
setTimeout(_ => t.disabled = false, 2000);
}
</script>
<textarea id="userid" style="display: none;">{% if u.song %}{{u.id}}{% else %}nosong{% endif %}</textarea>
<div class="row d-none d-md-block">