forked from MarseyWorld/MarseyWorld
disable "give award" button when number of owned selected awards goes to 0
parent
cda0b3592c
commit
e3a8f5eda6
|
@ -142,8 +142,8 @@ function buy(mb) {
|
||||||
if (success) {
|
if (success) {
|
||||||
document.getElementById('giveaward').disabled=false;
|
document.getElementById('giveaward').disabled=false;
|
||||||
let owned = document.getElementById(`${kind}-owned`)
|
let owned = document.getElementById(`${kind}-owned`)
|
||||||
let ownednum = Number(owned.textContent);
|
let ownednum = Number(owned.textContent) + 1;
|
||||||
owned.textContent = ownednum + 1
|
owned.textContent = ownednum
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -161,8 +161,10 @@ function giveaward(t) {
|
||||||
(xhr) => {
|
(xhr) => {
|
||||||
if(xhr.status == 200) {
|
if(xhr.status == 200) {
|
||||||
let owned = document.getElementById(`${kind}-owned`)
|
let owned = document.getElementById(`${kind}-owned`)
|
||||||
let ownednum = Number(owned.textContent);
|
let ownednum = Number(owned.textContent) - 1;
|
||||||
owned.textContent = ownednum - 1
|
owned.textContent = ownednum
|
||||||
|
if (ownednum == 0)
|
||||||
|
document.getElementById('giveaward').disabled=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue