diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2019-09-01 19:47:33 +0300 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-02 19:33:52 -0400 |
commit | 2df9a7f97794df46aac70a23bb2b62dbd2752a5a (patch) | |
tree | 4da8c108f21b1943c8b2d2d4c47ff498ddb068c2 /ext/fg/js/popup.js | |
parent | 97be029deee4ec34ad2e90081af15d573dede0cd (diff) |
change Popup.children to Popup.child
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r-- | ext/fg/js/popup.js | 18 |
1 files changed, 4 insertions, 14 deletions
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(); } } |