diff options
author | Alex Yatskov <alex@foosoft.net> | 2019-10-05 10:14:07 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2019-10-05 10:14:07 -0700 |
commit | 7f5f3951f057b84864f7f37825804f9049ddab10 (patch) | |
tree | 1a724bbd4d8cf2b053f3e2b99b46ba41008508b8 /ext/fg/js/popup.js | |
parent | f4b6527ed6ed1f0f4f5a63b94766b20f3b90e6ec (diff) | |
parent | 46ab36180f486a19332c538401b4db12ffe1bda1 (diff) |
Merge branch 'master' into testing
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r-- | ext/fg/js/popup.js | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 08965084..9dff6f28 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -56,17 +56,19 @@ class Popup { return new Promise((resolve) => { const parentFrameId = (typeof this.frameId === 'number' ? this.frameId : null); this.container.addEventListener('load', () => { - this.invokeApi('popupNestedInitialize', { - id: this.id, - depth: this.depth, - parentFrameId, + this.invokeApi('initialize', { + options: { + general: { + customPopupCss: options.general.customPopupCss + } + }, + popupInfo: { + id: this.id, + depth: this.depth, + parentFrameId + }, url: this.url }); - this.invokeApi('setOptions', { - general: { - customPopupCss: options.general.customPopupCss - } - }); resolve(); }); this.observeFullscreen(); @@ -105,7 +107,7 @@ class Popup { container.style.height = `${height}px`; container.style.visibility = 'visible'; - this.hideChildren(); + this.hideChildren(true); } static getPositionForHorizontalText(elementRect, width, height, maxWidth, maxHeight, optionsGeneral) { @@ -206,16 +208,21 @@ class Popup { this.invokeApi('orphaned'); } - hide() { - this.hideChildren(); + hide(changeFocus) { + if (this.isContainerHidden()) { + changeFocus = false; + } + this.hideChildren(changeFocus); this.hideContainer(); - this.focusParent(); + if (changeFocus) { + this.focusParent(); + } } - hideChildren() { - // recursively hides all children - if (this.child && !this.child.isContainerHidden()) { - this.child.hide(); + hideChildren(changeFocus) { + // Recursively hides all children. + if (this.child !== null && !this.child.isContainerHidden()) { + this.child.hide(changeFocus); } } |