use getFullscreenElement to check fullscreen

This commit is contained in:
siikamiika 2020-04-18 02:05:18 +03:00
parent b786e2da19
commit 350a113996
3 changed files with 14 additions and 12 deletions

View File

@ -16,6 +16,7 @@
*/
/* global
* DOM
* FrameOffsetForwarder
* Frontend
* PopupProxy
@ -95,7 +96,7 @@ async function main() {
}
let popup;
if (isIframe && options.general.showIframePopupsInRootFrame && !document.fullscreen && iframePopupsInRootFrameAvailable) {
if (isIframe && options.general.showIframePopupsInRootFrame && DOM.getFullscreenElement() === null && iframePopupsInRootFrameAvailable) {
popup = popups.iframe || await createIframePopupProxy(url, frameOffsetForwarder, disableIframePopupsInRootFrame);
popups.iframe = popup;
} else if (proxy) {

View File

@ -16,6 +16,7 @@
*/
/* global
* DOM
* apiGetMessageToken
* apiInjectStylesheet
*/
@ -271,7 +272,7 @@ class Popup {
}
_onFullscreenChanged() {
const parent = (Popup._getFullscreenElement() || document.body || null);
const parent = (DOM.getFullscreenElement() || document.body || null);
if (parent !== null && this._container.parentNode !== parent) {
parent.appendChild(this._container);
}
@ -365,16 +366,6 @@ class Popup {
contentWindow.postMessage({action, params, token}, this._targetOrigin);
}
static _getFullscreenElement() {
return (
document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
null
);
}
static _getPositionForHorizontalText(elementRect, width, height, viewport, offsetScale, optionsGeneral) {
const preferBelow = (optionsGeneral.popupHorizontalTextPosition === 'below');
const horizontalOffset = optionsGeneral.popupHorizontalOffset * offsetScale;

View File

@ -62,4 +62,14 @@ class DOM {
default: return false;
}
}
static getFullscreenElement() {
return (
document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
null
);
}
}