mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-15 15:13:45 +03:00
f3d83fd68a
add an option to disable lightbox modal
26 lines
635 B
JavaScript
26 lines
635 B
JavaScript
function gradioApp(){
|
|
return document.getElementsByTagName('gradio-app')[0].shadowRoot;
|
|
}
|
|
|
|
uiUpdateCallbacks = []
|
|
function onUiUpdate(callback){
|
|
uiUpdateCallbacks.push(callback)
|
|
}
|
|
|
|
function uiUpdate(root){
|
|
uiUpdateCallbacks.forEach(function(x){
|
|
try {
|
|
x()
|
|
} catch (e) {
|
|
(console.error || console.log).call(console, e.message, e);
|
|
}
|
|
})
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
var mutationObserver = new MutationObserver(function(m){
|
|
uiUpdate(gradioApp());
|
|
});
|
|
mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
|
|
});
|