prevent the use of confusing globals
This commit is contained in:
parent
fd102348ce
commit
6159eca8f8
18 changed files with 44 additions and 34 deletions
|
@ -5,8 +5,8 @@
|
|||
}
|
||||
|
||||
const script = document.createElement('script');
|
||||
if (self.dashboardVersion) {
|
||||
src += `?v=${self.dashboardVersion}`;
|
||||
if (window.dashboardVersion) {
|
||||
src += `?v=${window.dashboardVersion}`;
|
||||
}
|
||||
script.src = src;
|
||||
script.setAttribute('async', '');
|
||||
|
@ -35,10 +35,10 @@
|
|||
// Promise() being missing on some legacy browser, and a funky one
|
||||
// is Promise() present but buggy on WebOS 2
|
||||
window.Promise = undefined;
|
||||
self.Promise = undefined;
|
||||
window.Promise = undefined;
|
||||
}
|
||||
|
||||
if (!self.Promise) {
|
||||
if (!window.Promise) {
|
||||
// Load Promise polyfill if they are not natively supported
|
||||
injectScriptElement(
|
||||
'./libraries/npo.js',
|
||||
|
|
|
@ -210,7 +210,7 @@ if (userAgent.toLowerCase().indexOf('xbox') !== -1) {
|
|||
browser.tv = true;
|
||||
}
|
||||
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || self.tizen != null;
|
||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || window.tizen != null;
|
||||
browser.web0s = userAgent.toLowerCase().indexOf('Web0S'.toLowerCase()) !== -1;
|
||||
browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1);
|
||||
|
||||
|
|
|
@ -315,10 +315,12 @@ define(['browser'], function (browser) {
|
|||
// Not sure how to test for this
|
||||
var supportsMp2VideoAudio = browser.edgeUwp || browser.tizen || browser.web0s;
|
||||
|
||||
/* eslint-disable compat/compat */
|
||||
var maxVideoWidth = browser.xboxOne ?
|
||||
(self.screen ? self.screen.width : null) :
|
||||
(window.screen ? window.screen.width : null) :
|
||||
null;
|
||||
|
||||
/* eslint-enable compat/compat */
|
||||
if (options.maxVideoWidth) {
|
||||
maxVideoWidth = options.maxVideoWidth;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ export function capabilities(appHost) {
|
|||
let capabilities = {
|
||||
PlayableMediaTypes: ['Audio', 'Video'],
|
||||
SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
|
||||
SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android',
|
||||
SupportsPersistentIdentifier: window.appMode === 'cordova' || window.appMode === 'android',
|
||||
SupportsMediaControl: true
|
||||
};
|
||||
return Object.assign(capabilities, appHost.getPushTokenInfo());
|
||||
|
|
|
@ -799,7 +799,7 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getNavDrawerOptions() {
|
||||
let drawerWidth = screen.availWidth - 50;
|
||||
let drawerWidth = window.screen.availWidth - 50;
|
||||
drawerWidth = Math.max(drawerWidth, 240);
|
||||
drawerWidth = Math.min(drawerWidth, 320);
|
||||
return {
|
||||
|
|
|
@ -31,7 +31,7 @@ function sameDomain(url) {
|
|||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
return location.hostname === a.hostname && location.protocol === a.protocol;
|
||||
return window.location.hostname === a.hostname && window.location.protocol === a.protocol;
|
||||
}
|
||||
|
||||
function download(url) {
|
||||
|
@ -62,4 +62,3 @@ export default function (urls) {
|
|||
download(url);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -187,9 +187,9 @@ function initClient() {
|
|||
}
|
||||
|
||||
function defineResizeObserver() {
|
||||
if (self.ResizeObserver) {
|
||||
if (window.ResizeObserver) {
|
||||
define('ResizeObserver', [], function () {
|
||||
return self.ResizeObserver;
|
||||
return window.ResizeObserver;
|
||||
});
|
||||
} else {
|
||||
define('ResizeObserver', ['resize-observer-polyfill'], returnFirstDependency);
|
||||
|
@ -248,8 +248,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function onGlobalizeInit(browser, globalize) {
|
||||
if (self.appMode === 'android') {
|
||||
if (self.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
|
||||
if (window.appMode === 'android') {
|
||||
if (window.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
|
||||
return onAppReady(browser);
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ function initClient() {
|
|||
|
||||
function registerServiceWorker() {
|
||||
/* eslint-disable compat/compat */
|
||||
if (navigator.serviceWorker && self.appMode !== 'cordova' && self.appMode !== 'android') {
|
||||
if (navigator.serviceWorker && window.appMode !== 'cordova' && window.appMode !== 'android') {
|
||||
try {
|
||||
navigator.serviceWorker.register('serviceworker.js');
|
||||
} catch (err) {
|
||||
|
@ -437,7 +437,7 @@ function initClient() {
|
|||
|
||||
define('castSenderApiLoader', [componentsPath + '/castSenderApi'], returnFirstDependency);
|
||||
|
||||
if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') {
|
||||
if (window.appMode === 'cordova' || window.appMode === 'android' || window.appMode === 'standalone') {
|
||||
AppInfo.isNativeApp = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue