Commit 999a03e4 authored by Aarni Koskela's avatar Aarni Koskela

Wait for DOMContentLoaded until checking whether localization should be disabled

Refs https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9955#issuecomment-1546587143
parent 9080af56
...@@ -137,7 +137,11 @@ function download_localization() { ...@@ -137,7 +137,11 @@ function download_localization() {
document.body.removeChild(element); document.body.removeChild(element);
} }
if(hasLocalization()) { document.addEventListener("DOMContentLoaded", function () {
if (!hasLocalization()) {
return;
}
onUiUpdate(function (m) { onUiUpdate(function (m) {
m.forEach(function (mutation) { m.forEach(function (mutation) {
mutation.addedNodes.forEach(function (node) { mutation.addedNodes.forEach(function (node) {
...@@ -146,8 +150,6 @@ if(hasLocalization()) { ...@@ -146,8 +150,6 @@ if(hasLocalization()) {
}); });
}) })
document.addEventListener("DOMContentLoaded", function () {
processNode(gradioApp()) processNode(gradioApp())
if (localization.rtl) { // if the language is from right to left, if (localization.rtl) { // if the language is from right to left,
...@@ -167,5 +169,4 @@ if(hasLocalization()) { ...@@ -167,5 +169,4 @@ if(hasLocalization()) {
}); });
})).observe(gradioApp(), { childList: true }); })).observe(gradioApp(), { childList: true });
} }
}) })
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment