diff --git a/updateTranslations.js b/updateTranslations.js index ebe73b7..4e3a42b 100644 --- a/updateTranslations.js +++ b/updateTranslations.js @@ -1,5 +1,6 @@ -function hideText(request) { +function hideTranslationsAndShowText(request) { document.querySelectorAll(".translationText, .romanizationText").forEach(element => element.style.visibility = 'hidden') + document.getElementById("fetchingText").style.visibility = "visible"; } function updateTranslations(response) { @@ -14,6 +15,7 @@ function updateTranslations(response) { // bar used to track translations, and then remove it in the 'resolved' handler. const elem = document.getElementById("loading-screen") elem.classList.toggle("loading") + document.getElementById("fetchingText").textContent = "Fetching romanizations..." fetch("/romanize", { method: "POST", body: response @@ -29,5 +31,7 @@ function updateTranslations(response) { }); // Show elements again document.querySelectorAll(".translationText, .romanizationText").forEach(element => element.style.visibility = 'visible') + document.getElementById("fetchingText").textContent = "Fetching translations..." // Restore the original text content + document.getElementById("fetchingText").style.visibility = "hidden" }); }