forked from rDrama/rDrama
add commas for coins and mbux
parent
e378e6cf07
commit
0fe765c391
|
@ -12,15 +12,15 @@ function initializeGame() {
|
||||||
|
|
||||||
function updatePlayerCurrencies(updated) {
|
function updatePlayerCurrencies(updated) {
|
||||||
if (updated.coins) {
|
if (updated.coins) {
|
||||||
document.getElementById("user-coins-amount").textContent = updated.coins;
|
document.getElementById("user-coins-amount").textContent = formatter.format(updated.coins);
|
||||||
document.getElementById("user-coins-amount-mobile").textContent = updated.coins;
|
document.getElementById("user-coins-amount-mobile").textContent = formatter.format(updated.coins);
|
||||||
document.getElementById("user-coins-amount-casino").textContent = updated.coins;
|
document.getElementById("user-coins-amount-casino").textContent = formatter.format(updated.coins);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated.marseybux) {
|
if (updated.marseybux) {
|
||||||
document.getElementById("user-bux-amount").textContent = updated.marseybux;
|
document.getElementById("user-bux-amount").textContent = formatter.format(updated.marseybux);
|
||||||
document.getElementById("user-bux-amount-mobile").textContent = updated.marseybux;
|
document.getElementById("user-bux-amount-mobile").textContent = formatter.format(updated.marseybux);
|
||||||
document.getElementById("user-bux-amount-casino").textContent = updated.marseybux;
|
document.getElementById("user-bux-amount-casino").textContent = formatter.format(updated.marseybux);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -796,3 +796,9 @@ function toggleElement(id, id2) {
|
||||||
document.getElementById(id).classList.toggle('d-none');
|
document.getElementById(id).classList.toggle('d-none');
|
||||||
document.getElementById(id2).focus()
|
document.getElementById(id2).focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatter = new Intl.NumberFormat('en-US');
|
||||||
|
function change_currency(id, amount) {
|
||||||
|
const el = document.getElementById(id)
|
||||||
|
el.textContent = formatter.format(parseInt(el.textContent.replaceAll(',', '')) + amount);
|
||||||
|
}
|
||||||
|
|
|
@ -29,11 +29,10 @@ function transferCoins(t, mobile=false) {
|
||||||
"reason": document.getElementById(mobile ? "coin-transfer-reason-mobile" : "coin-transfer-reason").value
|
"reason": document.getElementById(mobile ? "coin-transfer-reason-mobile" : "coin-transfer-reason").value
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
const newcoins = parseInt(document.getElementById("user-coins-amount").textContent) - amount;
|
change_currency("user-coins-amount", -amount)
|
||||||
document.getElementById("user-coins-amount").textContent = newcoins;
|
change_currency("user-coins-amount-mobile", -amount)
|
||||||
document.getElementById("user-coins-amount-mobile").textContent = newcoins;
|
change_currency("profile-coins-amount", amount)
|
||||||
document.getElementById("profile-coins-amount-mobile").textContent = parseInt(document.getElementById("profile-coins-amount-mobile").textContent) + transferred;
|
change_currency("profile-coins-amount-mobile", amount)
|
||||||
document.getElementById("profile-coins-amount").textContent = parseInt(document.getElementById("profile-coins-amount").textContent) + transferred;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +53,10 @@ function transferBux(t, mobile=false) {
|
||||||
"reason": document.getElementById(mobile ? "bux-transfer-reason-mobile" : "bux-transfer-reason").value
|
"reason": document.getElementById(mobile ? "bux-transfer-reason-mobile" : "bux-transfer-reason").value
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
const newbux = parseInt(document.getElementById("user-bux-amount").textContent) - amount;
|
change_currency("user-bux-amount", -amount)
|
||||||
document.getElementById("user-bux-amount").textContent = newbux;
|
change_currency("user-bux-amount-mobile", -amount)
|
||||||
document.getElementById("user-bux-amount-mobile").textContent = newbux;
|
change_currency("profile-bux-amount", amount)
|
||||||
document.getElementById("profile-bux-amount-mobile").textContent = parseInt(document.getElementById("profile-bux-amount-mobile").textContent) + amount;
|
change_currency("profile-bux-amount-mobile", amount)
|
||||||
document.getElementById("profile-bux-amount").textContent = parseInt(document.getElementById("profile-bux-amount").textContent) + amount;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<img id="wagerCoinsImg" loading="lazy" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" alt="coin" data-bs-toggle="tooltip"
|
<img id="wagerCoinsImg" loading="lazy" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" alt="coin" data-bs-toggle="tooltip"
|
||||||
data-bs-placement="bottom" title="Coin">
|
data-bs-placement="bottom" title="Coin">
|
||||||
</label>
|
</label>
|
||||||
<span id="user-coins-amount-casino">{{v.coins}}</span>
|
<span id="user-coins-amount-casino">{{v.coins|commas}}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="unbreakable">
|
<span class="unbreakable">
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<img id="wagerMarseybuxImg" loading="lazy" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" alt="marseybux" data-bs-toggle="tooltip"
|
<img id="wagerMarseybuxImg" loading="lazy" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" alt="marseybux" data-bs-toggle="tooltip"
|
||||||
data-bs-placement="bottom" title="Marseybux">
|
data-bs-placement="bottom" title="Marseybux">
|
||||||
</label>
|
</label>
|
||||||
<span id="user-bux-amount-casino">{{v.marseybux}}</span>
|
<span id="user-bux-amount-casino">{{v.marseybux|commas}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -341,9 +341,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="text-left pl-2" id="header--username--outerdiv">
|
<div class="text-left pl-2" id="header--username--outerdiv">
|
||||||
<div style="color: #{{v.name_color}}" class="text-small font-weight-bold"><span id="header--username" {% if v.patron %}class="patron" style="background-color:#{{v.name_color}}"{% endif %} {% if v.pride_username(v) %}pride_username{% endif %}>{{v.username}}</span></div>
|
<div style="color: #{{v.name_color}}" class="text-small font-weight-bold"><span id="header--username" {% if v.patron %}class="patron" style="background-color:#{{v.name_color}}"{% endif %} {% if v.pride_username(v) %}pride_username{% endif %}>{{v.username}}</span></div>
|
||||||
<div class="header--currency"><img loading="lazy" alt="coins" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" title="Coins"><span id="user-coins-amount">{{v.coins}}</span>{% if not FEATURES['MARSEYBUX'] %} Coin{{macros.plural(v.coins)}}{% endif %}</div>
|
<div class="header--currency"><img loading="lazy" alt="coins" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" title="Coins"><span id="user-coins-amount">{{v.coins|commas}}</span>{% if not FEATURES['MARSEYBUX'] %} Coin{{macros.plural(v.coins)}}{% endif %}</div>
|
||||||
{% if FEATURES['MARSEYBUX'] %}
|
{% if FEATURES['MARSEYBUX'] %}
|
||||||
<div class="header--currency"><img loading="lazy" alt="marseybux" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" title="Marseybux"><span id="user-bux-amount">{{v.marseybux}}</span></div>
|
<div class="header--currency"><img loading="lazy" alt="marseybux" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" title="Marseybux"><span id="user-bux-amount">{{v.marseybux|commas}}</span></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -420,12 +420,12 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<div class="header--currency ml-2 pl-1 my-2">
|
<div class="header--currency ml-2 pl-1 my-2">
|
||||||
<img loading="lazy" alt="coins" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" title="Coins">
|
<img loading="lazy" alt="coins" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8" title="Coins">
|
||||||
<span id="user-coins-amount-mobile">{{v.coins}}</span>
|
<span id="user-coins-amount-mobile">{{v.coins|commas}}</span>
|
||||||
</div>
|
</div>
|
||||||
{% if FEATURES['MARSEYBUX'] %}
|
{% if FEATURES['MARSEYBUX'] %}
|
||||||
<div class="header--currency">
|
<div class="header--currency">
|
||||||
<img loading="lazy" alt="marseybux" class="ml-3" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" title="Marseybux">
|
<img loading="lazy" alt="marseybux" class="ml-3" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8" title="Marseybux">
|
||||||
<span id="user-bux-amount-mobile">{{v.marseybux}}</span>
|
<span id="user-bux-amount-mobile">{{v.marseybux|commas}}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -106,11 +106,11 @@
|
||||||
<a class="mx-1" href="/@{{u.username}}/muting" id="profile--muting">mutes {{u.mute_count}} user{{'s' if u.mute_count != 1 else ''}}</a>
|
<a class="mx-1" href="/@{{u.username}}/muting" id="profile--muting">mutes {{u.mute_count}} user{{'s' if u.mute_count != 1 else ''}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id="profile-coins-amount">{{u.coins}}</span>
|
<span id="profile-coins-amount">{{u.coins|commas}}</span>
|
||||||
<img loading="lazy" alt="coins" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Coins" height="20" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8">
|
<img loading="lazy" alt="coins" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Coins" height="20" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8">
|
||||||
|
|
||||||
{% if FEATURES['MARSEYBUX'] %}
|
{% if FEATURES['MARSEYBUX'] %}
|
||||||
<span id="profile-bux-amount">{{u.marseybux}}</span>
|
<span id="profile-bux-amount">{{u.marseybux|commas}}</span>
|
||||||
<img loading="lazy" alt="marseybux" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Marseybux" height="20" width="46" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8">
|
<img loading="lazy" alt="marseybux" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Marseybux" height="20" width="46" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -421,11 +421,11 @@
|
||||||
<a class="mx-1" href="/@{{u.username}}/muting" id="profile-mobile--muting">mutes {{u.mute_count}} user{{'s' if u.mute_count != 1 else ''}}</a>
|
<a class="mx-1" href="/@{{u.username}}/muting" id="profile-mobile--muting">mutes {{u.mute_count}} user{{'s' if u.mute_count != 1 else ''}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id="profile-coins-amount-mobile" class="font-weight-bold">{{u.coins}}</span>
|
<span id="profile-coins-amount-mobile" class="font-weight-bold">{{u.coins|commas}}</span>
|
||||||
<img loading="lazy" alt="coins" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Coins" height="15" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8">
|
<img loading="lazy" alt="coins" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Coins" height="15" src="{{SITE_FULL_IMAGES}}/i/coins.webp?x=8">
|
||||||
|
|
||||||
{% if FEATURES['MARSEYBUX'] %}
|
{% if FEATURES['MARSEYBUX'] %}
|
||||||
<span id="profile-bux-amount-mobile" class="font-weight-bold">{{u.marseybux}}</span>
|
<span id="profile-bux-amount-mobile" class="font-weight-bold">{{u.marseybux|commas}}</span>
|
||||||
<img loading="lazy" alt="marseybux" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Marseybux" height="15" width="35" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8">
|
<img loading="lazy" alt="marseybux" class="ml-1 mb-1 mr-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Marseybux" height="15" width="35" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=8">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
u.username ~ "'s profile" %}
|
u.username ~ "'s profile" %}
|
||||||
|
|
||||||
{% set description %}
|
{% set description %}
|
||||||
{{u.coins}} coins - Joined {{u.created_date}} -
|
{{u.coins|commas}} coins - Joined {{u.created_date}} -
|
||||||
{%- if u.stored_subscriber_count >=1 and not u.is_private -%}
|
{%- if u.stored_subscriber_count >=1 and not u.is_private -%}
|
||||||
{{u.stored_subscriber_count}} Followers -
|
{{u.stored_subscriber_count}} Followers -
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
Loading…
Reference in New Issue