remotes/1693045480750635534/spooky-22
Aevann1 2021-11-19 01:47:30 +02:00
parent d0ff33ba63
commit 8db4d1abc8
1 changed files with 22 additions and 25 deletions

View File

@ -17,11 +17,8 @@
{% if v %}
<script src="/assets/js/userpage.js?v=61"></script>
{% endif %}
{% if v and not v.patron %}
<script>
const TRANSFER_TAX = 0.03;
const TRANSFER_TAX = {% if v.patron}0{% else %}0.03{% endif %};
function updateTax(mobile=false) {
let suf = mobile ? "-mobile" : "";
@ -31,9 +28,30 @@
}
document.getElementById("coins-transfer-taxed" + suf).innerText = amount - Math.ceil(amount*TRANSFER_TAX);
}
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>
{% endif %}
<title>{{u.username}}'s profile - {{'SITE_NAME' | app_config}}</title>
{% if u.is_private %}
<meta name="robots" content="noindex">
@ -60,27 +78,6 @@
{% block desktopUserBanner %}
<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);
}
{% if u.song %}
var audio = new Audio('/songs/{{u.id}}');
audio.loop=true;