f3d83fd68a
add an option to disable lightbox modal
25 lines
635 B
JavaScript
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 })
|
|
});
|