Fix /shop purchase confirmation buttons.

master
Snakes 2022-08-10 17:28:45 -04:00
parent 484788bbc1
commit f2030077f0
Signed by: Snakes
GPG Key ID: E745A82778055C7E
4 changed files with 16 additions and 16 deletions

View File

@ -5274,6 +5274,10 @@ li > .sidebar {
width: 13rem;
}
.shop-table-actions a {
display: flex;
}
.userbanner {
object-fit: cover !important;
}

View File

@ -178,7 +178,9 @@ if (document.readyState === "complete" ||
}
function post_toast(t, url, button1, button2, classname) {
if (t.id != "buy1-go" && t.id != "buy2-go")
let isShopConfirm = t.id.startsWith('buy1-go') || t.id.startsWith('buy2-go');
if (!isShopConfirm)
{
t.disabled = true;
t.classList.add("disabled");
@ -212,7 +214,7 @@ function post_toast(t, url, button1, button2, classname) {
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
}
if (t.id != "buy1-go" && t.id != "buy2-go")
if (!isShopConfirm)
{
setTimeout(() => {
t.disabled = false;

View File

@ -27,12 +27,6 @@
{% endblock %}
{% block content %}
<style>
#buy1, #buy1-go, #buy2, #buy2-go {
display: flex;
}
</style>
{% if error %}
<div class="alert alert-danger alert-dismissible fade show my-3" role="alert">
<i class="fas fa-exclamation-circle my-auto"></i>
@ -85,14 +79,14 @@
<td class="shop-table-owned">{{a['owned']}}</td>
{% set kind = a['kind'] %}
<td class="shop-table-actions">
{% if a['kind'] != "benefactor" %}
<a id="buy1" class="btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy1-go').classList.remove('d-none')"><span class="m-auto">Buy</span></a>
<a id="buy1-go" class="d-none btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}')"><span class="m-auto">Are you sure?</span></a>
{% if kind != "benefactor" %}
<a id="buy1-{{loop.index}}" class="btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy1-go-{{loop.index}}').classList.remove('d-none')"><span class="m-auto">Buy</span></a>
<a id="buy1-go-{{loop.index}}" class="d-none btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}')"><span class="m-auto">Are you sure?</span></a>
{% endif %}
{% if FEATURES['PROCOINS'] %}
{% if a['kind'] != "grass" %}
<a id="buy2" class="marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy2-go').classList.remove('d-none')""><span class="m-auto">Buy with MBux</span></a>
<a id="buy2-go" class="d-none marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}?mb=true')"><span class="m-auto">Are you sure?</span></a>
{% if kind != "grass" %}
<a id="buy2-{{loop.index}}" class="marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy2-go-{{loop.index}}').classList.remove('d-none')"><span class="m-auto">Buy with MBux</span></a>
<a id="buy2-go-{{loop.index}}" class="d-none marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}?mb=true')"><span class="m-auto">Are you sure?</span></a>
{% endif %}
{% endif %}
</td>

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 440,
'css/main.css': 441,
'css/catalog.css': 2,
'css/4chan.css': 61,
@ -17,7 +17,7 @@ set CACHE_VER = {
'css/win98.css': 63,
'js/award_modal.js': 254,
'js/bootstrap.js': 276,
'js/bootstrap.js': 277,
'js/category_modal.js': 200,
'js/comments+submission_listing.js': 265,
'js/submission_listing.js': 261,