mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
merge branch master into pdf-reader
This commit is contained in:
commit
6b302ed20b
292 changed files with 7971 additions and 6918 deletions
|
@ -1,10 +1,10 @@
|
|||
window.getWindowLocationSearch = function(win) {
|
||||
'use strict';
|
||||
|
||||
var search = (win || window).location.search;
|
||||
let search = (win || window).location.search;
|
||||
|
||||
if (!search) {
|
||||
var index = window.location.href.indexOf('?');
|
||||
const index = window.location.href.indexOf('?');
|
||||
|
||||
if (index != -1) {
|
||||
search = window.location.href.substring(index);
|
||||
|
@ -18,9 +18,9 @@ window.getParameterByName = function(name, url) {
|
|||
'use strict';
|
||||
|
||||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
var regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||
var regex = new RegExp(regexS, 'i');
|
||||
var results = regex.exec(url || getWindowLocationSearch());
|
||||
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||
const regex = new RegExp(regexS, 'i');
|
||||
const results = regex.exec(url || getWindowLocationSearch());
|
||||
|
||||
if (results == null) {
|
||||
return '';
|
||||
|
@ -33,7 +33,7 @@ window.pageClassOn = function(eventName, className, fn) {
|
|||
'use strict';
|
||||
|
||||
document.addEventListener(eventName, function (event) {
|
||||
var target = event.target;
|
||||
const target = event.target;
|
||||
|
||||
if (target.classList.contains(className)) {
|
||||
fn.call(target, event);
|
||||
|
@ -45,7 +45,7 @@ window.pageIdOn = function(eventName, id, fn) {
|
|||
'use strict';
|
||||
|
||||
document.addEventListener(eventName, function (event) {
|
||||
var target = event.target;
|
||||
const target = event.target;
|
||||
|
||||
if (target.id === id) {
|
||||
fn.call(target, event);
|
||||
|
@ -53,33 +53,26 @@ window.pageIdOn = function(eventName, id, fn) {
|
|||
});
|
||||
};
|
||||
|
||||
var AppInfo = {};
|
||||
const AppInfo = {};
|
||||
|
||||
function initClient() {
|
||||
function defineConnectionManager(connectionManager) {
|
||||
window.ConnectionManager = connectionManager;
|
||||
define('connectionManager', [], function () {
|
||||
return connectionManager;
|
||||
});
|
||||
}
|
||||
|
||||
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
||||
window.Events = events;
|
||||
|
||||
connectionManager.currentApiClient = function () {
|
||||
window.connectionManager.currentApiClient = function () {
|
||||
if (!localApiClient) {
|
||||
var server = connectionManager.getLastUsedServer();
|
||||
const server = window.connectionManager.getLastUsedServer();
|
||||
|
||||
if (server) {
|
||||
localApiClient = connectionManager.getApiClient(server.Id);
|
||||
localApiClient = window.connectionManager.getApiClient(server.Id);
|
||||
}
|
||||
}
|
||||
|
||||
return localApiClient;
|
||||
};
|
||||
|
||||
connectionManager.onLocalUserSignedIn = function (user) {
|
||||
localApiClient = connectionManager.getApiClient(user.ServerId);
|
||||
window.connectionManager.onLocalUserSignedIn = function (user) {
|
||||
localApiClient = window.connectionManager.getApiClient(user.ServerId);
|
||||
window.ApiClient = localApiClient;
|
||||
return userSettings.setUserInfo(user.Id, localApiClient);
|
||||
};
|
||||
|
@ -93,16 +86,15 @@ function initClient() {
|
|||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, appHost, credentialProvider, events, userSettings) {
|
||||
appHost = appHost.default || appHost;
|
||||
|
||||
var credentialProviderInstance = new credentialProvider();
|
||||
var promises = [appHost.init()];
|
||||
const credentialProviderInstance = new credentialProvider();
|
||||
const promises = [appHost.init()];
|
||||
|
||||
return Promise.all(promises).then(function (responses) {
|
||||
var capabilities = Dashboard.capabilities(appHost);
|
||||
const capabilities = Dashboard.capabilities(appHost);
|
||||
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||
window.connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||
|
||||
defineConnectionManager(connectionManager);
|
||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
||||
bindConnectionManagerEvents(window.connectionManager, events, userSettings);
|
||||
|
||||
if (!AppInfo.isNativeApp) {
|
||||
console.debug('loading ApiClient singleton');
|
||||
|
@ -110,12 +102,12 @@ function initClient() {
|
|||
return require(['apiclient', 'clientUtils'], function (apiClientFactory, clientUtils) {
|
||||
console.debug('creating ApiClient singleton');
|
||||
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
|
||||
const apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
|
||||
|
||||
apiClient.enableAutomaticNetworking = false;
|
||||
apiClient.manualAddressOnly = true;
|
||||
|
||||
connectionManager.addApiClient(apiClient);
|
||||
window.connectionManager.addApiClient(apiClient);
|
||||
|
||||
window.ApiClient = apiClient;
|
||||
localApiClient = apiClient;
|
||||
|
@ -202,7 +194,7 @@ function initClient() {
|
|||
|
||||
require(['clientUtils']);
|
||||
|
||||
var promises = [];
|
||||
const promises = [];
|
||||
if (!window.fetch) {
|
||||
promises.push(require(['fetch']));
|
||||
}
|
||||
|
@ -211,7 +203,7 @@ function initClient() {
|
|||
createConnectionManager().then(function () {
|
||||
console.debug('initAfterDependencies promises resolved');
|
||||
|
||||
require(['globalize', 'browser'], function (globalize, browser) {
|
||||
require(['globalize', 'browser'], function (globalize, {default: browser}) {
|
||||
window.Globalize = globalize;
|
||||
loadCoreDictionary(globalize).then(function () {
|
||||
onGlobalizeInit(browser, globalize);
|
||||
|
@ -226,16 +218,16 @@ function initClient() {
|
|||
require(['autoFocuser'], function(autoFocuser) {
|
||||
autoFocuser.enable();
|
||||
});
|
||||
require(['globalize', 'connectionManager', 'events'], function (globalize, connectionManager, events) {
|
||||
events.on(connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
||||
require(['globalize', 'events'], function (globalize, events) {
|
||||
events.on(window.connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadCoreDictionary(globalize) {
|
||||
var languages = ['ar', 'be-by', 'bg-bg', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'es', 'es-ar', 'es-mx', 'fa', 'fi', 'fr', 'fr-ca', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'lt-lt', 'ms', 'nb', 'nl', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sv', 'tr', 'uk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||
var translations = languages.map(function (language) {
|
||||
const languages = ['ar', 'be-by', 'bg-bg', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'es', 'es-ar', 'es-mx', 'fa', 'fi', 'fr', 'fr-ca', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'lt-lt', 'ms', 'nb', 'nl', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sv', 'tr', 'uk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||
const translations = languages.map(function (language) {
|
||||
return {
|
||||
lang: language,
|
||||
path: 'strings/' + language + '.json'
|
||||
|
@ -375,7 +367,7 @@ function initClient() {
|
|||
|
||||
require(['playerSelectionMenu']);
|
||||
|
||||
var apiClient = window.ConnectionManager && window.ConnectionManager.currentApiClient();
|
||||
const apiClient = window.connectionManager && window.connectionManager.currentApiClient();
|
||||
if (apiClient) {
|
||||
fetch(apiClient.getUrl('Branding/Css'))
|
||||
.then(function(response) {
|
||||
|
@ -418,8 +410,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function onWebComponentsReady() {
|
||||
var componentsPath = getComponentsPath();
|
||||
var scriptsPath = getScriptsPath();
|
||||
const componentsPath = getComponentsPath();
|
||||
const scriptsPath = getScriptsPath();
|
||||
|
||||
define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency);
|
||||
|
||||
|
@ -449,18 +441,18 @@ function initClient() {
|
|||
init();
|
||||
}
|
||||
|
||||
var promise;
|
||||
var localApiClient;
|
||||
let promise;
|
||||
let localApiClient;
|
||||
|
||||
function initRequireJs() {
|
||||
var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
||||
const urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
||||
|
||||
var bowerPath = getBowerPath();
|
||||
var componentsPath = getComponentsPath();
|
||||
var elementsPath = getElementsPath();
|
||||
var scriptsPath = getScriptsPath();
|
||||
const bowerPath = getBowerPath();
|
||||
const componentsPath = getComponentsPath();
|
||||
const elementsPath = getElementsPath();
|
||||
const scriptsPath = getScriptsPath();
|
||||
|
||||
var paths = {
|
||||
const paths = {
|
||||
browserdeviceprofile: 'scripts/browserDeviceProfile',
|
||||
browser: 'scripts/browser',
|
||||
libraryBrowser: 'scripts/libraryBrowser',
|
||||
|
@ -590,6 +582,7 @@ function initClient() {
|
|||
define('webSettings', [scriptsPath + '/settings/webSettings'], returnFirstDependency);
|
||||
define('appSettings', [scriptsPath + '/settings/appSettings'], returnFirstDependency);
|
||||
define('userSettings', [scriptsPath + '/settings/userSettings'], returnFirstDependency);
|
||||
define('autocast', [scriptsPath + '/autocast'], returnFirstDependency);
|
||||
|
||||
define('mediaSession', [componentsPath + '/playback/mediasession'], returnFirstDependency);
|
||||
define('actionsheet', [componentsPath + '/actionSheet/actionSheet'], returnFirstDependency);
|
||||
|
@ -634,6 +627,7 @@ function initClient() {
|
|||
define('displaySettings', [componentsPath + '/displaySettings/displaySettings'], returnFirstDependency);
|
||||
define('playbackSettings', [componentsPath + '/playbackSettings/playbackSettings'], returnFirstDependency);
|
||||
define('homescreenSettings', [componentsPath + '/homeScreenSettings/homeScreenSettings'], returnFirstDependency);
|
||||
define('quickConnectSettings', [componentsPath + '/quickConnectSettings/quickConnectSettings'], returnFirstDependency);
|
||||
define('playbackManager', [componentsPath + '/playback/playbackmanager'], getPlaybackManager);
|
||||
define('timeSyncManager', [componentsPath + '/syncPlay/timeSyncManager'], returnDefault);
|
||||
define('groupSelectionMenu', [componentsPath + '/syncPlay/groupSelectionMenu'], returnFirstDependency);
|
||||
|
@ -679,9 +673,6 @@ function initClient() {
|
|||
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
||||
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
||||
define('autoFocuser', [componentsPath + '/autoFocuser'], returnFirstDependency);
|
||||
define('connectionManager', [], function () {
|
||||
return ConnectionManager;
|
||||
});
|
||||
define('apiClientResolver', [], function () {
|
||||
return function () {
|
||||
return window.ApiClient;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue