mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Migrate bundle, qualityOptions, appHost and appLoader
This commit is contained in:
parent
9640f13830
commit
f16df9788a
39 changed files with 1075 additions and 723 deletions
|
@ -1,52 +1,48 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
function injectScriptElement(src, onload) {
|
||||
if (!src) {
|
||||
return;
|
||||
}
|
||||
|
||||
function injectScriptElement(src, onload) {
|
||||
if (!src) {
|
||||
return;
|
||||
const script = document.createElement('script');
|
||||
if (self.dashboardVersion) {
|
||||
src += `?v=${self.dashboardVersion}`;
|
||||
}
|
||||
script.src = src;
|
||||
script.setAttribute('async', '');
|
||||
|
||||
if (onload) {
|
||||
script.onload = onload;
|
||||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
function loadSite() {
|
||||
injectScriptElement(
|
||||
'./libraries/alameda.js',
|
||||
function() {
|
||||
// onload of require library
|
||||
injectScriptElement('./scripts/site.js');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
if (self.dashboardVersion) {
|
||||
src += `?v=${self.dashboardVersion}`;
|
||||
}
|
||||
script.src = src;
|
||||
script.setAttribute('async', '');
|
||||
try {
|
||||
Promise.resolve();
|
||||
} catch (ex) {
|
||||
// this checks for several cases actually, typical is
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (onload) {
|
||||
script.onload = onload;
|
||||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
function loadSite() {
|
||||
injectScriptElement(
|
||||
'./libraries/alameda.js',
|
||||
function() {
|
||||
// onload of require library
|
||||
injectScriptElement('./scripts/site.js');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
Promise.resolve();
|
||||
} catch (ex) {
|
||||
// this checks for several cases actually, typical is
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (!self.Promise) {
|
||||
// Load Promise polyfill if they are not natively supported
|
||||
injectScriptElement(
|
||||
'./libraries/npo.js',
|
||||
loadSite
|
||||
);
|
||||
} else {
|
||||
loadSite();
|
||||
}
|
||||
})();
|
||||
if (!self.Promise) {
|
||||
// Load Promise polyfill if they are not natively supported
|
||||
injectScriptElement(
|
||||
'./libraries/npo.js',
|
||||
loadSite
|
||||
);
|
||||
} else {
|
||||
loadSite();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export function deleteItem(options) {
|
|||
const item = options.item;
|
||||
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||
|
||||
let apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
return confirm({
|
||||
|
||||
|
@ -34,7 +34,7 @@ export function deleteItem(options) {
|
|||
}
|
||||
}
|
||||
}, function (err) {
|
||||
let result = function () {
|
||||
const result = function () {
|
||||
return Promise.reject(err);
|
||||
};
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ require(['apphost'], function (appHost) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (appHost.getWindowState() === 'Minimized') {
|
||||
if (appHost.default.getWindowState() === 'Minimized') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import appHost from 'apphost';
|
|||
dom.removeEventListener(scope, 'command', fn, {});
|
||||
}
|
||||
|
||||
let commandTimes = {};
|
||||
const commandTimes = {};
|
||||
|
||||
function checkCommandTime(command) {
|
||||
const last = commandTimes[command] || 0;
|
||||
|
@ -113,7 +113,7 @@ import appHost from 'apphost';
|
|||
'back': () => {
|
||||
if (appRouter.canGoBack()) {
|
||||
appRouter.back();
|
||||
} else if (appHost.supports('exit')) {
|
||||
} else if (appHost.default.supports('exit')) {
|
||||
appHost.exit();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -277,7 +277,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
html += globalize.translate('HeaderUser');
|
||||
html += '</h3>';
|
||||
|
||||
if (appHost.supports('multiserver')) {
|
||||
if (appHost.default.supports('multiserver')) {
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder" data-itemid="selectserver" href="selectserver.html?showuser=1"><span class="material-icons navMenuOptionIcon wifi"></span><span class="navMenuOptionText">' + globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
showBySelector('.lnkSyncToOtherDevices', false);
|
||||
}
|
||||
|
||||
if (user.Policy.EnableContentDownloading && appHost.supports('sync')) {
|
||||
if (user.Policy.EnableContentDownloading && appHost.default.supports('sync')) {
|
||||
showBySelector('.libraryMenuDownloads', true);
|
||||
} else {
|
||||
showBySelector('.libraryMenuDownloads', false);
|
||||
|
|
|
@ -200,8 +200,8 @@ var Dashboard = {
|
|||
SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android',
|
||||
SupportsMediaControl: true
|
||||
};
|
||||
appHost.getPushTokenInfo();
|
||||
return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo());
|
||||
appHost.default.getPushTokenInfo();
|
||||
return capabilities = Object.assign(capabilities, appHost.default.getPushTokenInfo());
|
||||
},
|
||||
selectServer: function () {
|
||||
if (window.NativeShell && typeof window.NativeShell.selectServer === 'function') {
|
||||
|
@ -271,17 +271,17 @@ function initClient() {
|
|||
}
|
||||
|
||||
function createConnectionManager() {
|
||||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, apphost, credentialProvider, events, userSettings) {
|
||||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, appHost, credentialProvider, events, userSettings) {
|
||||
var credentialProviderInstance = new credentialProvider();
|
||||
var promises = [apphost.getSyncProfile(), apphost.init()];
|
||||
var promises = [appHost.default.getSyncProfile(), appHost.default.init()];
|
||||
|
||||
return Promise.all(promises).then(function (responses) {
|
||||
var deviceProfile = responses[0];
|
||||
var capabilities = Dashboard.capabilities(apphost);
|
||||
var capabilities = Dashboard.capabilities(appHost);
|
||||
|
||||
capabilities.DeviceProfile = deviceProfile;
|
||||
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), capabilities);
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, appHost.default.appName(), appHost.default.appVersion(), appHost.default.deviceName(), appHost.default.deviceId(), capabilities);
|
||||
|
||||
defineConnectionManager(connectionManager);
|
||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
||||
|
@ -292,7 +292,7 @@ function initClient() {
|
|||
return require(['apiclient'], function (apiClientFactory) {
|
||||
console.debug('creating ApiClient singleton');
|
||||
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId());
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.default.appName(), appHost.default.appVersion(), appHost.default.deviceName(), appHost.default.deviceId());
|
||||
|
||||
apiClient.enableAutomaticNetworking = false;
|
||||
apiClient.manualAddressOnly = true;
|
||||
|
@ -350,8 +350,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function getLayoutManager(layoutManager, appHost) {
|
||||
if (appHost.getDefaultLayout) {
|
||||
layoutManager.defaultLayout = appHost.getDefaultLayout();
|
||||
if (appHost.default.getDefaultLayout) {
|
||||
layoutManager.defaultLayout = appHost.default.getDefaultLayout();
|
||||
}
|
||||
|
||||
layoutManager.init();
|
||||
|
@ -538,13 +538,13 @@ function initClient() {
|
|||
require(['components/nowPlayingBar/nowPlayingBar']);
|
||||
}
|
||||
|
||||
if (appHost.supports('remotecontrol')) {
|
||||
if (appHost.default.supports('remotecontrol')) {
|
||||
require(['playerSelectionMenu', 'components/playback/remotecontrolautoplay']);
|
||||
}
|
||||
|
||||
require(['libraries/screensavermanager']);
|
||||
|
||||
if (!appHost.supports('physicalvolumecontrol') || browser.touch) {
|
||||
if (!appHost.default.supports('physicalvolumecontrol') || browser.touch) {
|
||||
require(['components/playback/volumeosd']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue