diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fg/js/popup-proxy-host.js | 2 | ||||
-rw-r--r-- | ext/fg/js/popup-proxy.js | 2 | ||||
-rw-r--r-- | ext/fg/js/popup.js | 18 |
3 files changed, 6 insertions, 16 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 1048f410..fa61aeb4 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -57,7 +57,7 @@ class PopupProxyHost { const popup = new Popup(id, depth, this.frameIdPromise); if (parent !== null) { popup.parent = parent; - parent.children.push(popup); + parent.child = popup; } this.popups[id] = popup; return popup; diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index 112b998e..f6295079 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -24,7 +24,7 @@ class PopupProxy { this.id = null; this.idPromise = null; this.parent = null; - this.children = []; + this.child = null; this.depth = 0; this.container = null; diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 61a5e4d0..3bc0b6f8 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -24,7 +24,7 @@ class Popup { this.frameIdPromise = frameIdPromise; this.frameId = null; this.parent = null; - this.children = []; + this.child = null; this.container = document.createElement('iframe'); this.container.id = 'yomichan-float'; this.container.addEventListener('mousedown', e => e.stopPropagation()); @@ -212,19 +212,9 @@ class Popup { } hideChildren() { - if (this.children.length === 0) { - return; - } - - const targets = this.children.slice(0); - while (targets.length > 0) { - const target = targets.shift(); - if (target.isContainerHidden()) { continue; } - - target.hide(); - for (const child of target.children) { - targets.push(child); - } + // recursively hides all children + if (this.child && !this.child.isContainerHidden()) { + this.child.hide(); } } |