This commit is contained in:
Aevann1 2022-01-17 22:32:10 +02:00
parent 255bc5ca6b
commit 5ba095f6be
2 changed files with 8 additions and 27 deletions

View file

@ -80,9 +80,13 @@ function awardModal(link) {
target.action = link;
}
function bruh(kind) {
document.getElementById('buy1').disabled=false;
document.getElementById('buy2').disabled=false;
function pick(kind) {
let buy1 = document.getElementById('buy1')
if (kind == "grass") buy1.disabled=true;
else buy1.disabled=false;
let buy2 = document.getElementById('buy2')
if (kind == "benefactor") buy2.disabled=true;
else buy2.disabled=false;
let ownednum = Number(document.getElementById(`${kind}-owned`).textContent);
document.getElementById('giveaward').disabled = (ownednum == 0);
document.getElementById('kind').value=kind;
@ -98,29 +102,6 @@ function bruh(kind) {
}
}
function bruh2(kind) {
console.log(kind)
let buy1 = document.getElementById('buy1')
if (kind == "grass") buy1.disabled=true;
else buy1.disabled=false;
let buy2 = document.getElementById('buy1')
if (kind == "benefactor") buy2.disabled=true;
else buy2.disabled=false;
document.getElementById('giveaward').disabled=true;
document.getElementById('kind').value=kind;
let picked = document.getElementsByClassName('picked')[0]
if (picked) picked.classList.remove('picked')
document.getElementById(kind).classList.toggle('picked')
if (kind == "flairlock") {
document.getElementById('notelabel').innerHTML = "New flair:";
document.getElementById('note').placeholder = "Insert new flair here, or leave empty to add 1 day to the duration of the current flair";
}
else {
document.getElementById('notelabel').innerHTML = "Note (optional):";
document.getElementById('note').placeholder = "Note to include in award notification";
}
}
function buy(mb) {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
const kind = document.getElementById('kind').value;

View file

@ -13,7 +13,7 @@
<input autocomplete="off" type="hidden" name="formkey", value="{{v.formkey}}">
<div class="card-columns award-columns awards-wrapper">
{% for award in v.user_awards %}
<a role="button" id="{{award.kind}}" class="card" onclick="bruh('{{award.kind}}')">
<a role="button" id="{{award.kind}}" class="card" onclick="pick('{{award.kind}}')">
<i class="{{award.icon}} {{award.color}}"></i>
<div class="pt-2" style="font-weight: bold; font-size: 14px; color:#E1E1E1">{{award.title}}</div>
<div class="text-muted"><span id="{{award.kind}}-owned">{{award.owned}}</span> owned</div>