Change function name; add code to hide, show and change text for the 'fetching translations/romanizations' text
This commit is contained in:
@@ -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"
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user