make the logic for disabling buttons consistent
parent
27b6d23e13
commit
ceef37472e
|
@ -98,16 +98,17 @@ for (const element of TH) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable_btn(t) {
|
function disable_btn(t) {
|
||||||
|
if (t.classList.contains('disabled')) {
|
||||||
|
setTimeout(() => {
|
||||||
|
t.disabled = true;
|
||||||
|
}, 0.0000000000000000001);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
t.classList.remove("disabled");
|
||||||
|
t.disabled = false;
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
t.classList.add('disabled');
|
t.classList.add('disabled');
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
t.disabled = true;
|
|
||||||
}, 0.0000000000000000001);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
t.classList.remove("disabled");
|
|
||||||
t.disabled = false;
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function register_new_elements(e) {
|
function register_new_elements(e) {
|
||||||
|
|
|
@ -160,10 +160,8 @@ function post_reply(id){
|
||||||
} else {
|
} else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
btn.disabled = false;
|
||||||
btn.disabled = false;
|
btn.classList.remove('disabled');
|
||||||
btn.classList.remove('disabled');
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
xhr[0].send(xhr[1]);
|
xhr[0].send(xhr[1]);
|
||||||
}
|
}
|
||||||
|
@ -213,10 +211,8 @@ function comment_edit(id){
|
||||||
else {
|
else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
btn.disabled = false;
|
||||||
btn.disabled = false;
|
btn.classList.remove('disabled');
|
||||||
btn.classList.remove('disabled');
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
xhr[0].send(xhr[1]);
|
xhr[0].send(xhr[1]);
|
||||||
}
|
}
|
||||||
|
@ -323,13 +319,11 @@ function handle_action(type, cid, thing) {
|
||||||
} else {
|
} else {
|
||||||
showToast(false, getMessageFromJsonData(false, data));
|
showToast(false, getMessageFromJsonData(false, data));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
for (const btn of btns)
|
||||||
for (const btn of btns)
|
{
|
||||||
{
|
btn.disabled = false;
|
||||||
btn.disabled = false;
|
btn.classList.remove('disabled');
|
||||||
btn.classList.remove('disabled');
|
}
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
xhr.send(form)
|
xhr.send(form)
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,6 @@ function postToast(t, url, data, extraActionsOnSuccess, method="POST") {
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
xhr[0].send(xhr[1]);
|
xhr[0].send(xhr[1]);
|
||||||
|
|
||||||
if (!isShopConfirm)
|
|
||||||
{
|
|
||||||
setTimeout(() => {
|
|
||||||
t.disabled = false;
|
|
||||||
t.classList.remove("disabled");
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function postToastReload(t, url, method="POST") {
|
function postToastReload(t, url, method="POST") {
|
||||||
|
|
|
@ -29,8 +29,6 @@ function transferCoins(t, mobile=false) {
|
||||||
el.classList.add('d-none');
|
el.classList.add('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disabled = true;
|
|
||||||
|
|
||||||
let amount = parseInt(document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value);
|
let amount = parseInt(document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value);
|
||||||
let transferred = amount - Math.ceil(amount*TRANSFER_TAX);
|
let transferred = amount - Math.ceil(amount*TRANSFER_TAX);
|
||||||
let username = document.getElementById('username').innerHTML;
|
let username = document.getElementById('username').innerHTML;
|
||||||
|
@ -46,8 +44,6 @@ function transferCoins(t, mobile=false) {
|
||||||
document.getElementById("profile-coins-amount").innerText = parseInt(document.getElementById("profile-coins-amount").innerText) + transferred;
|
document.getElementById("profile-coins-amount").innerText = parseInt(document.getElementById("profile-coins-amount").innerText) + transferred;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(_ => this.disabled = false, 2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferBux(t, mobile=false) {
|
function transferBux(t, mobile=false) {
|
||||||
|
@ -55,8 +51,6 @@ function transferBux(t, mobile=false) {
|
||||||
el.classList.add('d-none');
|
el.classList.add('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disabled = true;
|
|
||||||
|
|
||||||
let amount = parseInt(document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value);
|
let amount = parseInt(document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value);
|
||||||
let username = document.getElementById('username').innerHTML
|
let username = document.getElementById('username').innerHTML
|
||||||
|
|
||||||
|
@ -71,8 +65,6 @@ function transferBux(t, mobile=false) {
|
||||||
document.getElementById("profile-bux-amount").innerText = parseInt(document.getElementById("profile-bux-amount").innerText) + amount;
|
document.getElementById("profile-bux-amount").innerText = parseInt(document.getElementById("profile-bux-amount").innerText) + amount;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(_ => this.disabled = false, 2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage(form) {
|
function sendMessage(form) {
|
||||||
|
|
Loading…
Reference in New Issue