From 3295214bf35b33bb139dfb08e25fa346b4d0e4de Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 10 Oct 2023 21:23:14 +0300 Subject: [PATCH] dont grey out the "buy" button in shop --- files/assets/js/core.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 7cfda27dd..a673e50e6 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -33,8 +33,12 @@ function createXhrWithFormKey(url, form=new FormData(), method='POST') { } function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) { - t.disabled = true; - t.classList.add("disabled"); + const is_shop = t.id && t.id.startsWith('buy-') + + if (!is_shop) { + t.disabled = true; + t.classList.add("disabled"); + } let form = new FormData(); if (typeof data === 'object' && data !== null) { @@ -46,7 +50,7 @@ function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) { xhr[0].onload = function() { const success = xhr[0].status >= 200 && xhr[0].status < 300; - if (!(extraActionsOnSuccess == reload && success)) { + if (!(extraActionsOnSuccess == reload && success && !is_shop)) { t.disabled = false; t.classList.remove("disabled"); }