Fix UI hiding
This commit is contained in:
parent
0681c3ae08
commit
ae2bb7afcd
@ -1,3 +1,4 @@
|
||||
import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
|
||||
import { EventBusConnector } from '../EventBus';
|
||||
|
||||
if (process.env.CHANNEL !== 'stable'){
|
||||
@ -29,6 +30,7 @@ class UI {
|
||||
this.saveState = undefined;
|
||||
this.playerData = uiConfig.playerData;
|
||||
this.uiSettings = uiConfig.uiSettings;
|
||||
this.siteSettings = uiConfig.siteSettings;
|
||||
|
||||
this.iframeErrorCount = 0;
|
||||
this.iframeConfirmed = false;
|
||||
@ -43,10 +45,28 @@ class UI {
|
||||
this.extensionBase = chrome.runtime.getURL('').replace(/\/$/, "");
|
||||
|
||||
// UI will be initialized when setUiVisibility is called
|
||||
console.log('ui config:', uiConfig);
|
||||
this.init();
|
||||
}
|
||||
|
||||
canRun() {
|
||||
if (this.isGlobal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled
|
||||
|| this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled
|
||||
|| this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled;
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (!this.canRun()) {
|
||||
console.log('ui config: canRun returned false', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled)
|
||||
return;
|
||||
}
|
||||
console.log('ui config: canRun returned truie', this.siteSettings?.data.enableUI.fullscreen === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.theater === ExtensionMode.Enabled, this.siteSettings?.data.enableUI.normal === ExtensionMode.Enabled)
|
||||
|
||||
|
||||
this.initUIContainer();
|
||||
this.loadIframe();
|
||||
this.initMessaging();
|
||||
@ -315,6 +335,10 @@ class UI {
|
||||
canShowUI: false,
|
||||
}
|
||||
|
||||
if (this.playerData?.environment && this.siteSettings.data.enableUI[this.playerData?.environment] !== ExtensionMode.Enabled) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (this.playerData?.dimensions) {
|
||||
result.playerDimensions = this.playerData.dimensions;
|
||||
}
|
||||
|
@ -291,7 +291,8 @@ class PlayerData {
|
||||
parentElement: this.element,
|
||||
eventBus: this.eventBus,
|
||||
playerData: this,
|
||||
uiSettings: this.videoData.settings.active.ui
|
||||
uiSettings: this.videoData.settings.active.ui,
|
||||
siteSettings: this.siteSettings,
|
||||
}
|
||||
);
|
||||
|
||||
@ -615,7 +616,8 @@ class PlayerData {
|
||||
parentElement: this.element,
|
||||
eventBus: this.eventBus,
|
||||
playerData: this,
|
||||
uiSettings: this.videoData.settings.active.ui
|
||||
uiSettings: this.videoData.settings.active.ui,
|
||||
siteSettings: this.siteSettings,
|
||||
}
|
||||
);
|
||||
|
||||
@ -627,8 +629,6 @@ class PlayerData {
|
||||
* Finds and returns HTML element of the player
|
||||
*/
|
||||
private getPlayer(options?: {verbose?: boolean}): HTMLElement {
|
||||
const host = window.location.hostname;
|
||||
let element = this.videoElement.parentNode;
|
||||
const videoWidth = this.videoElement.offsetWidth;
|
||||
const videoHeight = this.videoElement.offsetHeight;
|
||||
let playerCandidate;
|
||||
@ -649,7 +649,6 @@ class PlayerData {
|
||||
}
|
||||
|
||||
// if mode is given, we follow the preference
|
||||
|
||||
if (this.siteSettings.data.currentDOMConfig?.elements?.player?.manual && this.siteSettings.data.currentDOMConfig?.elements?.player?.mode) {
|
||||
if (this.siteSettings.data.currentDOMConfig?.elements?.player?.mode === 'qs') {
|
||||
playerCandidate = this.getPlayerQs(playerQs, elementStack, videoWidth, videoHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user