Add feedback that spotting is happening. #154

This commit is contained in:
Ian Renton
2026-09-27 14:11:21 +01:00
parent 27bd8a6b44
commit 277191b026
9 changed files with 32 additions and 16 deletions
+12
View File
@@ -150,6 +150,9 @@ function loadCredentials(providerName) {
// Method called to add a spot to the server
function addSpot() {
try {
$("#result-bad").empty();
setSubmitting(true);
// Save settings (this will save "your call" for future use)
saveSettings();
@@ -214,6 +217,7 @@ function addSpot() {
}, 2000);
},
error: function (result) {
setSubmitting(false);
if (window._recaptchaWidgetId !== undefined) {
grecaptcha.reset(window._recaptchaWidgetId);
}
@@ -225,11 +229,19 @@ function addSpot() {
}
});
} catch (error) {
setSubmitting(false);
showAddSpotError(error);
}
return false;
}
// Show or hide the "in progress" state on the Spot button.
function setSubmitting(submitting) {
$("#add-spot-submit").prop("disabled", submitting);
$("#add-spot-spinner").toggle(submitting);
$("#add-spot-submit-text").text(submitting ? "Spotting..." : "Spot");
}
// Show an "add spot" error.
function showAddSpotError(text) {
const div = $("<div class='alert alert-danger alert-dismissible fade show mb-0 mt-4' role='alert'></div>");