commas everywhere
parent
a3b73bd459
commit
cbff460407
|
@ -119,28 +119,28 @@ function updateBlackjackTable(state) {
|
||||||
if (gameCompleted) {
|
if (gameCompleted) {
|
||||||
switch (state.status) {
|
switch (state.status) {
|
||||||
case 'BLACKJACK':
|
case 'BLACKJACK':
|
||||||
updateResult(`Blackjack: Received ${state.payout} ${currency}`, "warning");
|
updateResult(`Blackjack: Received ${commas(state.payout)} ${currency}`, "warning");
|
||||||
break;
|
break;
|
||||||
case 'WON':
|
case 'WON':
|
||||||
if (state.status_split === 'LOST') {
|
if (state.status_split === 'LOST') {
|
||||||
updateResult(`Won and Lost: Received 0 ${currency}`, "success");
|
updateResult(`Won and Lost: Received 0 ${currency}`, "success");
|
||||||
}
|
}
|
||||||
else if (state.status_split === 'PUSHED') {
|
else if (state.status_split === 'PUSHED') {
|
||||||
updateResult(`Won and PUSHED: Received ${state.payout} ${currency}`, "success");
|
updateResult(`Won and PUSHED: Received ${commas(state.payout)} ${currency}`, "success");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
updateResult(`Won: Received ${state.payout} ${currency}`, "success");
|
updateResult(`Won: Received ${commas(state.payout)} ${currency}`, "success");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PUSHED':
|
case 'PUSHED':
|
||||||
if (state.status_split === 'WON') {
|
if (state.status_split === 'WON') {
|
||||||
updateResult(`Won and PUSHED: Received ${state.payout} ${currency}`, "success");
|
updateResult(`Won and PUSHED: Received ${commas(state.payout)} ${currency}`, "success");
|
||||||
}
|
}
|
||||||
else if (state.status_split === 'LOST') {
|
else if (state.status_split === 'LOST') {
|
||||||
updateResult(`Lost and Pushed: Lost ${state.wager.amount} ${currency}`, "danger");
|
updateResult(`Lost and Pushed: Lost ${commas(state.wager.amount)} ${currency}`, "danger");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
updateResult(`Pushed: Received ${state.wager.amount} ${currency}`, "success");
|
updateResult(`Pushed: Received ${commas(state.wager.amount)} ${currency}`, "success");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -149,14 +149,14 @@ function updateBlackjackTable(state) {
|
||||||
updateResult(`Won and Lost: Received 0 ${currency}`, "success");
|
updateResult(`Won and Lost: Received 0 ${currency}`, "success");
|
||||||
}
|
}
|
||||||
else if (state.status_split === 'PUSHED') {
|
else if (state.status_split === 'PUSHED') {
|
||||||
updateResult(`Lost and Pushed: Lost ${state.wager.amount} ${currency}`, "danger");
|
updateResult(`Lost and Pushed: Lost ${commas(state.wager.amount)} ${currency}`, "danger");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lost = state.wager.amount;
|
let lost = state.wager.amount;
|
||||||
if (state.player_doubled_down || state.has_player_split) {
|
if (state.player_doubled_down || state.has_player_split) {
|
||||||
lost *= 2;
|
lost *= 2;
|
||||||
}
|
}
|
||||||
updateResult(`Lost ${lost} ${currency}`, "danger");
|
updateResult(`Lost ${commas(lost)} ${currency}`, "danger");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -172,7 +172,7 @@ function updateBlackjackTable(state) {
|
||||||
|
|
||||||
|
|
||||||
if (state.status === 'PLAYING' || (state.has_player_split && state.status_split === 'PLAYING')) {
|
if (state.status === 'PLAYING' || (state.has_player_split && state.status_split === 'PLAYING')) {
|
||||||
updateResult(`${state.has_player_split ? state.wager.amount * 2 : state.wager.amount} ${currency} are at stake`, "success");
|
updateResult(`${commas(state.has_player_split ? state.wager.amount * 2 : state.wager.amount)} ${currency} are at stake`, "success");
|
||||||
} else {
|
} else {
|
||||||
enableWager();
|
enableWager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,7 +798,6 @@ function toggleElement(id, id2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatter = new Intl.NumberFormat('en-US');
|
const formatter = new Intl.NumberFormat('en-US');
|
||||||
function change_currency(id, amount) {
|
function commas(number) {
|
||||||
const el = document.getElementById(id)
|
return formatter.format(number)
|
||||||
el.textContent = formatter.format(parseInt(el.textContent.replaceAll(',', '')) + amount);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ function updateBux(mobile=false) {
|
||||||
if (amount > 0) document.getElementById("bux-transfer-taxed" + suf).textContent = amount;
|
if (amount > 0) document.getElementById("bux-transfer-taxed" + suf).textContent = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function change_currency(id, amount) {
|
||||||
|
const el = document.getElementById(id)
|
||||||
|
el.textContent = commas(parseInt(el.textContent.replaceAll(',', '')) + amount);
|
||||||
|
}
|
||||||
|
|
||||||
function transferCoins(t, mobile=false) {
|
function transferCoins(t, mobile=false) {
|
||||||
close_inline_emoji_modal();
|
close_inline_emoji_modal();
|
||||||
|
|
||||||
|
|
|
@ -511,15 +511,15 @@ class Comment(Base):
|
||||||
body = f"<span id='blackjack-{self.id}' class='ml-2'><em>{player_hand} vs. {dealer_hand}</em>"
|
body = f"<span id='blackjack-{self.id}' class='ml-2'><em>{player_hand} vs. {dealer_hand}</em>"
|
||||||
|
|
||||||
if blackjack_status == 'push':
|
if blackjack_status == 'push':
|
||||||
body += f"<strong class='ml-2'>Pushed. Refunded {wager} {currency_kind}.</strong>"
|
body += f"<strong class='ml-2'>Pushed. Refunded {commas(wager)} {currency_kind}.</strong>"
|
||||||
elif blackjack_status == 'bust':
|
elif blackjack_status == 'bust':
|
||||||
body += f"<strong class='ml-2'>Bust. Lost {wager} {currency_kind}.</strong>"
|
body += f"<strong class='ml-2'>Bust. Lost {commas(wager)} {currency_kind}.</strong>"
|
||||||
elif blackjack_status == 'lost':
|
elif blackjack_status == 'lost':
|
||||||
body += f"<strong class='ml-2'>Lost {wager} {currency_kind}.</strong>"
|
body += f"<strong class='ml-2'>Lost {commas(wager)} {currency_kind}.</strong>"
|
||||||
elif blackjack_status == 'won':
|
elif blackjack_status == 'won':
|
||||||
body += f"<strong class='ml-2'>Won {wager} {currency_kind}.</strong>"
|
body += f"<strong class='ml-2'>Won {commas(wager)} {currency_kind}.</strong>"
|
||||||
elif blackjack_status == 'blackjack':
|
elif blackjack_status == 'blackjack':
|
||||||
body += f"<strong class='ml-2'>Blackjack! Won {floor(wager * 3/2)} {currency_kind}.</strong>"
|
body += f"<strong class='ml-2'>Blackjack! Won {commas(floor(wager * 3/2))} {currency_kind}.</strong>"
|
||||||
|
|
||||||
if is_insured == "1":
|
if is_insured == "1":
|
||||||
body += " <em class='text-success'>Insured.</em>"
|
body += " <em class='text-success'>Insured.</em>"
|
||||||
|
|
|
@ -1067,8 +1067,8 @@ class User(Base):
|
||||||
'hat': self.hat_active(v)[0],
|
'hat': self.hat_active(v)[0],
|
||||||
'bannerurl': self.banner_url,
|
'bannerurl': self.banner_url,
|
||||||
'bio_html': self.bio_html_eager,
|
'bio_html': self.bio_html_eager,
|
||||||
'coins': self.coins,
|
'coins': commas(self.coins),
|
||||||
'marseybux': self.marseybux,
|
'marseybux': commas(self.marseybux),
|
||||||
'post_count': self.real_post_count(v),
|
'post_count': self.real_post_count(v),
|
||||||
'comment_count': self.real_comment_count(v),
|
'comment_count': self.real_comment_count(v),
|
||||||
'badges': [[x.path, x.text, x.until] for x in self.ordered_badges(v)],
|
'badges': [[x.path, x.text, x.until] for x in self.ordered_badges(v)],
|
||||||
|
|
|
@ -1153,3 +1153,6 @@ if not IS_LOCALHOST:
|
||||||
|
|
||||||
with open("includes/content-security-policy", "w") as f:
|
with open("includes/content-security-policy", "w") as f:
|
||||||
f.write(f'add_header Content-Security-Policy "{csp}";')
|
f.write(f'add_header Content-Security-Policy "{csp}";')
|
||||||
|
|
||||||
|
def commas(number):
|
||||||
|
return "{:,}".format(number)
|
||||||
|
|
|
@ -103,13 +103,13 @@ def build_symbols(for_payout):
|
||||||
|
|
||||||
def build_text(wager_value, result, currency):
|
def build_text(wager_value, result, currency):
|
||||||
if result == 0:
|
if result == 0:
|
||||||
return f'Lost {wager_value} {currency}'
|
return f'Lost {commas(wager_value)} {currency}'
|
||||||
elif result == 1:
|
elif result == 1:
|
||||||
return 'Broke Even'
|
return 'Broke Even'
|
||||||
elif result == 12:
|
elif result == 12:
|
||||||
return f'Jackpot! Won {wager_value * (result-1)} {currency}'
|
return f'Jackpot! Won {commas(wager_value * (result-1))} {currency}'
|
||||||
else:
|
else:
|
||||||
return f'Won {wager_value * (result-1)} {currency}'
|
return f'Won {commas(wager_value * (result-1))} {currency}'
|
||||||
|
|
||||||
|
|
||||||
def determine_payout():
|
def determine_payout():
|
||||||
|
|
|
@ -103,8 +103,8 @@ def expand_art(url):
|
||||||
return f"{SITE_FULL_IMAGES}/asset_submissions/art/original/{id}.webp"
|
return f"{SITE_FULL_IMAGES}/asset_submissions/art/original/{id}.webp"
|
||||||
|
|
||||||
@app.template_filter("commas")
|
@app.template_filter("commas")
|
||||||
def commas(number):
|
def commas_filter(number):
|
||||||
return "{:,}".format(number)
|
return commas(number)
|
||||||
|
|
||||||
def current_registered_users():
|
def current_registered_users():
|
||||||
return "{:,}".format(g.db.query(User).count())
|
return "{:,}".format(g.db.query(User).count())
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<img width="{% if log.currency == 'coins' %}30{% else %}40{% endif %}" alt="{{log.currency}}" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/{{log.currency}}.webp?x=8" title="{{log.currency.title()}}">
|
<img width="{% if log.currency == 'coins' %}30{% else %}40{% endif %}" alt="{{log.currency}}" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/{{log.currency}}.webp?x=8" title="{{log.currency.title()}}">
|
||||||
</td>
|
</td>
|
||||||
<td class="unbreakable">
|
<td class="unbreakable">
|
||||||
<b class="bank-statement-amount">{% if log.amount > 0 %}+{% endif %}{{log.amount}}</b>
|
<b class="bank-statement-amount">{% if log.amount > 0 %}+{% endif %}{{log.amount | commas}}</b>
|
||||||
<div class="text-gray-500">
|
<div class="text-gray-500">
|
||||||
<span class="font-weight-normal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{log.created_utc}}')">
|
<span class="font-weight-normal" data-bs-toggle="tooltip" data-bs-placement="bottom" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{log.created_utc}}')">
|
||||||
{{log.age_string}}
|
{{log.age_string}}
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="font-weight-normal">{{log.reason | safe}}</td>
|
<td class="font-weight-normal">{{log.reason | safe}}</td>
|
||||||
<td class="unbreakable font-weight-bold">{{log.balance}}</td>
|
<td class="unbreakable font-weight-bold">{{log.balance | commas}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue