diff options
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,9 +1,11 @@ -function gradioApp(){ - return document.getElementsByTagName('gradio-app')[0].shadowRoot; +function gradioApp() { + const elems = document.getElementsByTagName('gradio-app') + const gradioShadowRoot = elems.length == 0 ? null : elems[0].shadowRoot + return !!gradioShadowRoot ? gradioShadowRoot : document; } function get_uiCurrentTab() { - return gradioApp().querySelector('.tabs button:not(.border-transparent)') + return gradioApp().querySelector('#tabs button:not(.border-transparent)') } function get_uiCurrentTabContent() { @@ -82,4 +84,4 @@ function uiElementIsVisible(el) { } } return isVisible; -}
\ No newline at end of file +} |