show prices of "0 owned" awards

pull/216/head
Aevann 2023-10-26 19:13:24 +03:00
parent 5c4f25e237
commit aeee820c33
3 changed files with 22 additions and 10 deletions

View File

@ -6182,7 +6182,7 @@ audio, video {
display: inline-block;
}
.header--currency img {
.header--currency img, .award-currency {
max-height: 13px;
}
@ -6867,6 +6867,10 @@ div.markdown {
}
}
.award-owned * {
vertical-align: middle;
}
.hole-banner-update-section .hole-settings-subsection {
margin-bottom: 1em;
}

View File

@ -178,14 +178,17 @@ function giveaward(t) {
},
() => {
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent);
let ownednum = Number(owned.textContent) - 1;
owned.textContent = ownednum
let ownedblock = document.getElementById(`${kind}-owned-block`)
if (ownednum) {
ownednum -= 1
owned.textContent = ownednum
if (ownednum)
document.getElementById('award_price').textContent = `${ownednum} owned`;
else
document.getElementById('award_price').textContent = `Price: ${global_price} coins/marseybux`;
ownedblock.innerHTML = `<span>${ownednum} owned</span>`;
document.getElementById('award_price').textContent = `${ownednum} owned`;
}
else {
ownedblock.innerHTML = `${global_price} <img loading="lazy" alt="coins" class="mr-1 ml-1 award-currency" data-bs-toggle="tooltip" data-bs-placement="bottom" src="${SITE_FULL_IMAGES}/i/rDrama/coins.webp?x=6" title="Coins">/<img loading="lazy" alt="marseybux" class="mr-1 ml-1 award-currency" data-bs-toggle="tooltip" data-bs-placement="bottom" src="${SITE_FULL_IMAGES}/i/marseybux.webp?x=6" title="Marseybux">`
document.getElementById('award_price').textContent = `Price: ${global_price} coins/marseybux`;
}
}
);

View File

@ -25,8 +25,13 @@
<div data-bs-toggle="tooltip" data-bs-placement="bottom" title="Price: {{price}} coins/marseybux - {{award.description}}" id="{{award.kind}}" data-positive="{{award.positive}}" data-nonce="{{g.nonce}}" data-onclick="pick('{{award.kind}}', {{price}}, {{v.coins}}, {{v.marseybux}})">
<i class="{{award.icon}} {{award.color}}"></i>
<div class="pt-1 award-name">{{award.title}}</div>
<div class="text-muted award-owned">
<span id="{{award.kind}}-owned">{{award.owned}}</span> owned
<span id="{{award.kind}}-owned" class="d-none">{{award.owned}}</span>
<div id="{{award.kind}}-owned-block" class="text-muted award-owned">
{% if award.owned %}
<span>{{award.owned}} owned</span>
{% else %}
<span>{{price}}</span> <img loading="lazy" alt="coins" class="mr-1 ml-1 award-currency" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/rDrama/coins.webp?x=6" title="Coins">/<img loading="lazy" alt="marseybux" class="mr-1 ml-1 award-currency" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{SITE_FULL_IMAGES}}/i/marseybux.webp?x=6" title="Marseybux">
{% endif %}
</div>
</div>
{% endfor %}