aboutsummaryrefslogtreecommitdiff
path: root/script.js
diff options
context:
space:
mode:
author48DESIGN <github@48design.de>2022-09-27 08:05:19 +0200
committerGitHub <noreply@github.com>2022-09-27 08:05:19 +0200
commite4145c84537b563a4b0ad7d225764f8c446479b5 (patch)
tree7a3aa1a9e22632eeb29bab969bd1cf61f8c9ca0f /script.js
parent2846ca57028cca1a9ce9cee66d2500b4ac38a9c6 (diff)
parentc0b1177a3203091ca43f2d08f24dd821f1237612 (diff)
Merge branch 'master' into notification-sound
Diffstat (limited to 'script.js')
-rw-r--r--script.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/script.js b/script.js
index 7f26e23b..cf989605 100644
--- a/script.js
+++ b/script.js
@@ -39,3 +39,24 @@ document.addEventListener("DOMContentLoaded", function() {
});
mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
});
+
+/**
+ * checks that a UI element is not in another hidden element or tab content
+ */
+function uiElementIsVisible(el) {
+ let isVisible = !el.closest('.\\!hidden');
+ if ( ! isVisible ) {
+ return false;
+ }
+
+ while( isVisible = el.closest('.tabitem')?.style.display !== 'none' ) {
+ if ( ! isVisible ) {
+ return false;
+ } else if ( el.parentElement ) {
+ el = el.parentElement
+ } else {
+ break;
+ }
+ }
+ return isVisible;
+} \ No newline at end of file