mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-21 07:30:02 +08: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 })
|
|
});
|