aboutsummaryrefslogtreecommitdiff
path: root/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'script.js')
-rw-r--r--script.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/script.js b/script.js
index 8b3b67e3..21960d91 100644
--- a/script.js
+++ b/script.js
@@ -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
+}