From 5f7fb1ecd2f1b0d4d99d9e75d95bd614508dc649 Mon Sep 17 00:00:00 2001 From: mbolli Date: Wed, 13 Mar 2024 11:06:29 +0100 Subject: [PATCH] JS: fix submit button loading state when daemon is running (fixes #104) --- frontend/js/nfsen-ng.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/js/nfsen-ng.js b/frontend/js/nfsen-ng.js index f579936..b3f6bf4 100644 --- a/frontend/js/nfsen-ng.js +++ b/frontend/js/nfsen-ng.js @@ -341,9 +341,11 @@ $(document).ready(function() { var setButtonLoading = function($button, setTo = true) { $button.toggleClass('disabled', setTo); - if (setTo === false && $button.data('old-text') !== undefined) { - $button.html($button.data('old-text')); - $button.data('old-text', undefined); + if (setTo === false) { + if ($button.data('old-text') !== undefined) { + $button.html($button.data('old-text')); + $button.data('old-text', undefined); + } } else { $button.data('old-text', $button.html()); $button.html(' Loading…');