initialize modal state from options
This commit is contained in:
parent
2f35b1c6be
commit
931e5aebb3
1 changed files with 19 additions and 1 deletions
|
@ -82,7 +82,6 @@ function showGalleryImage(){
|
||||||
|
|
||||||
function modalZoomToggle(event){
|
function modalZoomToggle(event){
|
||||||
modalImage = gradioApp().getElementById("modalImage");
|
modalImage = gradioApp().getElementById("modalImage");
|
||||||
console.log(modalImage)
|
|
||||||
if( !modalImage.classList.contains('modalImageFullscreen') ){
|
if( !modalImage.classList.contains('modalImageFullscreen') ){
|
||||||
modalImage.classList.add('modalImageFullscreen');
|
modalImage.classList.add('modalImageFullscreen');
|
||||||
}else{
|
}else{
|
||||||
|
@ -102,6 +101,25 @@ onUiUpdate(function(){
|
||||||
if(fullImg_preview != null){
|
if(fullImg_preview != null){
|
||||||
fullImg_preview.forEach(galleryImageHandler);
|
fullImg_preview.forEach(galleryImageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Object.keys(opts).length != 0) return;
|
||||||
|
|
||||||
|
json_elem = gradioApp().getElementById('settings_json')
|
||||||
|
if(json_elem == null) return;
|
||||||
|
|
||||||
|
textarea = json_elem.querySelector('textarea')
|
||||||
|
jsdata = textarea.value
|
||||||
|
opts = JSON.parse(jsdata)
|
||||||
|
|
||||||
|
if(!window.lightbox_settings_applied){
|
||||||
|
window.lightbox_settings_applied = true;
|
||||||
|
if(opts.js_modal_lightbox_initialy_zoomed){
|
||||||
|
var imageModal = gradioApp().getElementById('modalImage');
|
||||||
|
if(imageModal){
|
||||||
|
imageModal.className = 'modalImageFullscreen';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
|
Loading…
Reference in a new issue