stable-diffusion-webui/script.js
AUTOMATIC f3d83fd68a add read access to settings for jsavascript
add an option to disable lightbox modal
2022-09-18 22:25:18 +03:00

25 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 })
});