From 50a476edad546bcca1614a84a1d5a0e39f5e7e0f Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Fri, 28 Mar 2025 14:41:02 -0500 Subject: [PATCH] Change function name; add code to hide, show and change text for the 'fetching translations/romanizations' text --- updateTranslations.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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" }); }