From 44f38c4dea6d517bb7657063ed2394745945c1f8 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 5 Sep 2020 22:03:35 -0400 Subject: Popup window (#773) * Add option usePopupWindow * Add PopupWindow class * Add support for creating PopupWindow --- ext/fg/js/frontend.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ext/fg/js/frontend.js') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 8c4cfc82..b9656882 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -307,11 +307,17 @@ class Frontend { } async _updatePopup() { - const showIframePopupsInRootFrame = this._options.general.showIframePopupsInRootFrame; + const {usePopupWindow, showIframePopupsInRootFrame} = this._options.general; const isIframe = !this._useProxyPopup && (window !== window.parent); let popupPromise; - if ( + if (usePopupWindow) { + popupPromise = this._popupCache.get('window'); + if (typeof popupPromise === 'undefined') { + popupPromise = this._getPopupWindow(); + this._popupCache.set('window', popupPromise); + } + } else if ( isIframe && showIframePopupsInRootFrame && DocumentUtil.getFullscreenElement() === null && @@ -404,6 +410,14 @@ class Frontend { return popup; } + async _getPopupWindow() { + return await this._popupFactory.getOrCreatePopup({ + ownerFrameId: this._frameId, + depth: this._depth, + popupWindow: true + }); + } + _ignoreElements() { if (this._popup !== null) { const container = this._popup.container; -- cgit v1.2.3