Commit 2e1b61e5 authored by AUTOMATIC1111's avatar AUTOMATIC1111

change condition for scheduleAfterScriptsCallbacks() to properly reflect the...

change condition for scheduleAfterScriptsCallbacks() to properly reflect the needed amount of search fields
parent f293dbbf
......@@ -622,10 +622,13 @@ function scheduleAfterScriptsCallbacks() {
}, 200);
}
document.addEventListener("DOMContentLoaded", function() {
onUiLoaded(function() {
var mutationObserver = new MutationObserver(function(m) {
if (!executedAfterScripts &&
gradioApp().querySelectorAll("[id$='_extra_search']").length >= 6) {
let existingSearchfields = gradioApp().querySelectorAll("[id$='_extra_search']").length;
let neededSearchfields = gradioApp().querySelectorAll("[id$='_extra_tabs'] > .tab-nav > button").length - 2;
if (!executedAfterScripts && existingSearchfields >= neededSearchfields) {
mutationObserver.disconnect();
executedAfterScripts = true;
scheduleAfterScriptsCallbacks();
}
......
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