fix: Do not reset loading animation (#1056)

This commit is contained in:
Kroese 2025-10-12 01:51:17 +02:00 committed by GitHub
parent 06650e916a
commit 25227944b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,6 +93,12 @@ function processInfo() {
}
}
function extractContent(s) {
var span = document.createElement('span');
span.innerHTML = s;
return span.textContent || span.innerText;
};
function setInfo(msg, loading, error) {
try {
@ -119,9 +125,17 @@ function setInfo(msg, loading, error) {
spin.style.visibility = 'hidden';
}
var p = "<p class=\"loading\">";
loading = !!loading;
if (loading) {
msg = "<p class=\"loading\">" + msg + "</p>";
msg = p + msg + "</p>";
}
if (msg.includes(p)) {
if (el.innerHTML.includes(p)) {
el.getElementsByClassName('loading')[0].textContent = extractContent(msg);
return true;
}
}
el.innerHTML = msg;