mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
jumbo patch
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
function gradioApp() {
|
||||
const elems = document.getElementsByTagName('gradio-app')
|
||||
const elem = elems.length == 0 ? document : elems[0]
|
||||
|
||||
if (elem !== document) elem.getElementById = function(id){ return document.getElementById(id) }
|
||||
return elem.shadowRoot ? elem.shadowRoot : elem
|
||||
}
|
||||
@@ -34,12 +33,10 @@ function onOptionsChanged(callback){
|
||||
}
|
||||
|
||||
function runCallback(x, m){
|
||||
try {
|
||||
x(m)
|
||||
} catch (e) {
|
||||
(console.error || console.log).call(console, e.message, e);
|
||||
}
|
||||
try { x(m)
|
||||
} catch (e) { (console.error || console.log).call(console, e.message, e); }
|
||||
}
|
||||
|
||||
function executeCallbacks(queue, m) {
|
||||
queue.forEach(function(x){runCallback(x, m)})
|
||||
}
|
||||
@@ -52,7 +49,6 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
executedOnLoaded = true;
|
||||
executeCallbacks(uiLoadedCallbacks);
|
||||
}
|
||||
|
||||
executeCallbacks(uiUpdateCallbacks, m);
|
||||
const newTab = get_uiCurrentTab();
|
||||
if ( newTab && ( newTab !== uiCurrentTab ) ) {
|
||||
@@ -75,9 +71,7 @@ document.addEventListener('keydown', function(e) {
|
||||
}
|
||||
if (handled) {
|
||||
button = get_uiCurrentTabContent().querySelector('button[id$=_generate]');
|
||||
if (button) {
|
||||
button.click();
|
||||
}
|
||||
if (button) button.click();
|
||||
e.preventDefault();
|
||||
}
|
||||
})
|
||||
@@ -87,18 +81,11 @@ document.addEventListener('keydown', function(e) {
|
||||
*/
|
||||
function uiElementIsVisible(el) {
|
||||
let isVisible = !el.closest('.\\!hidden');
|
||||
if ( ! isVisible ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isVisible) return false;
|
||||
while( isVisible = el.closest('.tabitem')?.style.display !== 'none' ) {
|
||||
if ( ! isVisible ) {
|
||||
return false;
|
||||
} else if ( el.parentElement ) {
|
||||
el = el.parentElement
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if ( ! isVisible ) return false;
|
||||
else if ( el.parentElement ) el = el.parentElement
|
||||
else break;
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user