From bf1f3b8daf22a79ef15708edbbfb623157de1307 Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:05:30 +0100 Subject: Rely on opts being pre-populated --- javascript/imageviewer.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'javascript') diff --git a/javascript/imageviewer.js b/javascript/imageviewer.js index 564f8eb0..20531fd4 100644 --- a/javascript/imageviewer.js +++ b/javascript/imageviewer.js @@ -97,19 +97,12 @@ function galleryImageHandler(e){ } onUiUpdate(function(){ - fullImg_preview = gradioApp().querySelectorAll('img.w-full') - if(fullImg_preview != null){ - fullImg_preview.forEach(galleryImageHandler); - } - - if(Object.keys(opts).length != 0) return; - - json_elem = gradioApp().getElementById('settings_json') - if(json_elem == null) return; + fullImg_preview = gradioApp().querySelectorAll('img.w-full') + if(fullImg_preview != null){ + fullImg_preview.forEach(galleryImageHandler); + } - textarea = json_elem.querySelector('textarea') - jsdata = textarea.value - opts = JSON.parse(jsdata) + if(Object.keys(opts).length == 0) return; if(!window.lightbox_settings_applied){ window.lightbox_settings_applied = true; -- cgit v1.2.1