2018-10-23 01:05:09 +03:00
|
|
|
function getWindowLocationSearch(win) {
|
2020-05-04 12:44:12 +02:00
|
|
|
'use strict';
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var search = (win || window).location.search;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
if (!search) {
|
2020-05-04 12:44:12 +02:00
|
|
|
var index = window.location.href.indexOf('?');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (-1 != index) {
|
|
|
|
search = window.location.href.substring(index);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return search || '';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getParameterByName(name, url) {
|
2020-05-04 12:44:12 +02:00
|
|
|
'use strict';
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
|
|
var regexS = '[\\?&]' + name + '=([^&#]*)';
|
|
|
|
var regex = new RegExp(regexS, 'i');
|
2019-02-23 16:38:53 +00:00
|
|
|
var results = regex.exec(url || getWindowLocationSearch());
|
|
|
|
|
|
|
|
if (null == results) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return '';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return decodeURIComponent(results[1].replace(/\+/g, ' '));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function pageClassOn(eventName, className, fn) {
|
2020-05-04 12:44:12 +02:00
|
|
|
'use strict';
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-03-04 20:38:39 +00:00
|
|
|
document.addEventListener(eventName, function (event) {
|
|
|
|
var target = event.target;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (target.classList.contains(className)) {
|
2019-03-04 20:38:39 +00:00
|
|
|
fn.call(target, event);
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function pageIdOn(eventName, id, fn) {
|
2020-05-04 12:44:12 +02:00
|
|
|
'use strict';
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-03-04 20:38:39 +00:00
|
|
|
document.addEventListener(eventName, function (event) {
|
|
|
|
var target = event.target;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (target.id === id) {
|
2019-03-04 20:38:39 +00:00
|
|
|
fn.call(target, event);
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var Dashboard = {
|
2019-02-23 16:38:53 +00:00
|
|
|
getCurrentUser: function () {
|
|
|
|
return window.ApiClient.getCurrentUser(false);
|
|
|
|
},
|
2019-03-11 20:52:12 +00:00
|
|
|
|
|
|
|
//TODO: investigate url prefix support for serverAddress function
|
2019-02-23 16:38:53 +00:00
|
|
|
serverAddress: function () {
|
|
|
|
if (AppInfo.isNativeApp) {
|
|
|
|
var apiClient = window.ApiClient;
|
|
|
|
|
|
|
|
if (apiClient) {
|
|
|
|
return apiClient.serverAddress();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var urlLower = window.location.href.toLowerCase();
|
2020-05-04 12:44:12 +02:00
|
|
|
var index = urlLower.lastIndexOf('/web');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (-1 != index) {
|
|
|
|
return urlLower.substring(0, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
var loc = window.location;
|
2020-05-04 12:44:12 +02:00
|
|
|
var address = loc.protocol + '//' + loc.hostname;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (loc.port) {
|
2020-05-04 12:44:12 +02:00
|
|
|
address += ':' + loc.port;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return address;
|
|
|
|
},
|
|
|
|
getCurrentUserId: function () {
|
|
|
|
var apiClient = window.ApiClient;
|
|
|
|
|
|
|
|
if (apiClient) {
|
|
|
|
return apiClient.getCurrentUserId();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
onServerChanged: function (userId, accessToken, apiClient) {
|
|
|
|
apiClient = apiClient || window.ApiClient;
|
|
|
|
window.ApiClient = apiClient;
|
|
|
|
},
|
|
|
|
logout: function () {
|
|
|
|
ConnectionManager.logout().then(function () {
|
|
|
|
var loginPage;
|
|
|
|
|
2019-01-04 12:32:24 +01:00
|
|
|
if (AppInfo.isNativeApp) {
|
2020-05-04 12:44:12 +02:00
|
|
|
loginPage = 'selectserver.html';
|
2019-02-23 16:38:53 +00:00
|
|
|
window.ApiClient = null;
|
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
loginPage = 'login.html';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
Dashboard.navigate(loginPage);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getConfigurationPageUrl: function (name) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'configurationpage?name=' + encodeURIComponent(name);
|
2019-02-23 16:38:53 +00:00
|
|
|
},
|
|
|
|
getConfigurationResourceUrl: function (name) {
|
|
|
|
if (AppInfo.isNativeApp) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return ApiClient.getUrl('web/ConfigurationPage', {
|
2018-10-23 01:05:09 +03:00
|
|
|
name: name
|
|
|
|
});
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Dashboard.getConfigurationPageUrl(name);
|
|
|
|
},
|
|
|
|
navigate: function (url, preserveQueryString) {
|
|
|
|
if (!url) {
|
2020-05-04 12:44:12 +02:00
|
|
|
throw new Error('url cannot be null or empty');
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var queryString = getWindowLocationSearch();
|
|
|
|
|
|
|
|
if (preserveQueryString && queryString) {
|
|
|
|
url += queryString;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['appRouter'], function (appRouter) {
|
2019-02-23 16:38:53 +00:00
|
|
|
return appRouter.show(url).then(resolve, reject);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
navigate_direct: function (path) {
|
|
|
|
return new Promise(function (resolve, reject) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['appRouter'], function (appRouter) {
|
2019-02-23 16:38:53 +00:00
|
|
|
return appRouter.showDirect(path).then(resolve, reject);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
processPluginConfigurationUpdateResult: function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['loading', 'toast'], function (loading, toast) {
|
2019-02-23 16:38:53 +00:00
|
|
|
loading.hide();
|
2020-05-04 12:44:12 +02:00
|
|
|
toast(Globalize.translate('MessageSettingsSaved'));
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
processServerConfigurationUpdateResult: function (result) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['loading', 'toast'], function (loading, toast) {
|
2019-02-23 16:38:53 +00:00
|
|
|
loading.hide();
|
2020-05-04 12:44:12 +02:00
|
|
|
toast(Globalize.translate('MessageSettingsSaved'));
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
processErrorResponse: function (response) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['loading'], function (loading) {
|
2019-02-23 16:38:53 +00:00
|
|
|
loading.hide();
|
|
|
|
});
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
var status = '' + response.status;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (response.statusText) {
|
|
|
|
status = response.statusText;
|
|
|
|
}
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
title: status,
|
2020-05-04 12:44:12 +02:00
|
|
|
message: response.headers ? response.headers.get('X-Application-Error-Code') : null
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
alert: function (options) {
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('string' == typeof options) {
|
|
|
|
return void require(['toast'], function (toast) {
|
2018-10-23 01:05:09 +03:00
|
|
|
toast({
|
|
|
|
text: options
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
});
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['alert'], function (alert) {
|
2019-02-23 16:38:53 +00:00
|
|
|
alert({
|
2020-05-04 12:44:12 +02:00
|
|
|
title: options.title || Globalize.translate('HeaderAlert'),
|
2019-02-23 16:38:53 +00:00
|
|
|
text: options.message
|
|
|
|
}).then(options.callback || function () {});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
restartServer: function () {
|
|
|
|
var apiClient = window.ApiClient;
|
|
|
|
|
|
|
|
if (apiClient) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['serverRestartDialog', 'events'], function (ServerRestartDialog, events) {
|
2018-10-23 01:05:09 +03:00
|
|
|
var dialog = new ServerRestartDialog({
|
|
|
|
apiClient: apiClient
|
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
events.on(dialog, 'restarted', function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
if (AppInfo.isNativeApp) {
|
|
|
|
apiClient.ensureWebSocket();
|
|
|
|
} else {
|
|
|
|
window.location.reload(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialog.show();
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
},
|
2019-02-23 16:38:53 +00:00
|
|
|
capabilities: function (appHost) {
|
2019-07-01 14:29:46 -07:00
|
|
|
var capabilities = {
|
2020-05-04 12:44:12 +02:00
|
|
|
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', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
|
|
|
|
SupportsPersistentIdentifier: 'cordova' === self.appMode || 'android' === self.appMode,
|
2019-02-23 16:38:53 +00:00
|
|
|
SupportsMediaControl: true
|
|
|
|
};
|
|
|
|
appHost.getPushTokenInfo();
|
2019-07-01 14:29:46 -07:00
|
|
|
return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo());
|
2020-02-01 23:55:07 +03:00
|
|
|
},
|
|
|
|
selectServer: function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
if (window.NativeShell && typeof window.NativeShell.selectServer === 'function') {
|
2020-02-01 23:55:07 +03:00
|
|
|
window.NativeShell.selectServer();
|
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('selectserver.html');
|
2020-02-01 23:55:07 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
};
|
2019-10-01 00:51:56 +09:00
|
|
|
|
2019-02-23 16:38:53 +00:00
|
|
|
var AppInfo = {};
|
2019-10-01 00:51:56 +09:00
|
|
|
|
2019-02-23 16:38:53 +00:00
|
|
|
!function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
'use strict';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function defineConnectionManager(connectionManager) {
|
2019-02-23 16:38:53 +00:00
|
|
|
window.ConnectionManager = connectionManager;
|
2020-05-04 12:44:12 +02:00
|
|
|
define('connectionManager', [], function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
return connectionManager;
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
2019-02-23 16:38:53 +00:00
|
|
|
window.Events = events;
|
|
|
|
|
|
|
|
connectionManager.currentApiClient = function () {
|
2018-10-23 01:05:09 +03:00
|
|
|
if (!localApiClient) {
|
|
|
|
var server = connectionManager.getLastUsedServer();
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (server) {
|
|
|
|
localApiClient = connectionManager.getApiClient(server.Id);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
return localApiClient;
|
|
|
|
};
|
|
|
|
|
|
|
|
connectionManager.onLocalUserSignedIn = function (user) {
|
|
|
|
localApiClient = connectionManager.getApiClient(user.ServerId);
|
|
|
|
window.ApiClient = localApiClient;
|
|
|
|
return userSettings.setUserInfo(user.Id, localApiClient);
|
|
|
|
};
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
events.on(connectionManager, 'localusersignedout', function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
userSettings.setUserInfo(null, null);
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function createConnectionManager() {
|
2020-05-04 12:44:12 +02:00
|
|
|
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, apphost, credentialProvider, events, userSettings) {
|
2019-03-04 20:30:42 +00:00
|
|
|
var credentialProviderInstance = new credentialProvider();
|
2019-03-04 20:25:42 +00:00
|
|
|
var promises = [apphost.getSyncProfile(), apphost.init()];
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-03-17 22:24:49 +01:00
|
|
|
return Promise.all(promises).then(function (responses) {
|
2019-03-04 20:30:42 +00:00
|
|
|
var deviceProfile = responses[0];
|
|
|
|
var capabilities = Dashboard.capabilities(apphost);
|
2019-02-23 17:12:14 +00:00
|
|
|
|
|
|
|
capabilities.DeviceProfile = deviceProfile;
|
|
|
|
|
2020-03-11 21:31:04 +01:00
|
|
|
var connectionManager = new ConnectionManager(credentialProviderInstance, apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), capabilities);
|
2019-02-23 17:12:14 +00:00
|
|
|
|
|
|
|
defineConnectionManager(connectionManager);
|
|
|
|
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
|
|
|
|
|
|
|
if (!AppInfo.isNativeApp) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('loading ApiClient singleton');
|
2019-02-23 17:12:14 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return require(['apiclient'], function (apiClientFactory) {
|
|
|
|
console.debug('creating ApiClient singleton');
|
2019-02-23 17:12:14 +00:00
|
|
|
|
2020-05-02 21:40:43 +02:00
|
|
|
var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId());
|
2019-03-17 22:24:49 +01:00
|
|
|
|
2019-02-23 17:12:14 +00:00
|
|
|
apiClient.enableAutomaticNetworking = false;
|
2019-03-04 20:27:29 +00:00
|
|
|
apiClient.manualAddressOnly = true;
|
2019-02-23 17:12:14 +00:00
|
|
|
|
|
|
|
connectionManager.addApiClient(apiClient);
|
|
|
|
|
|
|
|
window.ApiClient = apiClient;
|
2019-10-01 00:51:56 +09:00
|
|
|
localApiClient = apiClient;
|
2019-02-23 17:12:14 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('loaded ApiClient singleton');
|
2019-02-23 17:12:14 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.resolve();
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function returnFirstDependency(obj) {
|
2019-02-23 16:38:53 +00:00
|
|
|
return obj;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-04-03 18:49:19 +02:00
|
|
|
function returnDefault(obj) {
|
|
|
|
if (obj.default === null) {
|
2020-05-05 12:01:43 +02:00
|
|
|
throw new Error('Object has no default!');
|
2020-04-03 18:49:19 +02:00
|
|
|
}
|
|
|
|
return obj.default;
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
function getBowerPath() {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'libraries';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
function getComponentsPath() {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'components';
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
|
|
|
|
2020-01-24 02:57:29 +09:00
|
|
|
function getElementsPath() {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'elements';
|
2020-01-24 02:57:29 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
function getScriptsPath() {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'scripts';
|
2020-01-24 02:57:29 +09:00
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
function getPlaybackManager(playbackManager) {
|
2020-05-04 12:44:12 +02:00
|
|
|
window.addEventListener('beforeunload', function () {
|
2018-10-23 01:05:09 +03:00
|
|
|
try {
|
2019-01-21 17:47:10 +09:00
|
|
|
playbackManager.onAppClose();
|
2018-10-23 01:05:09 +03:00
|
|
|
} catch (err) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.error('error in onAppClose: ' + err);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
|
|
|
return playbackManager;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getLayoutManager(layoutManager, appHost) {
|
2019-01-21 17:47:10 +09:00
|
|
|
if (appHost.getDefaultLayout) {
|
|
|
|
layoutManager.defaultLayout = appHost.getDefaultLayout();
|
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-01-21 17:47:10 +09:00
|
|
|
layoutManager.init();
|
|
|
|
return layoutManager;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function createSharedAppFooter(appFooter) {
|
2019-01-21 17:47:10 +09:00
|
|
|
return new appFooter({});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onRequireJsError(requireType, requireModules) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.error('RequireJS error: ' + (requireType || 'unknown') + '. Failed modules: ' + (requireModules || []).join(','));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function defineResizeObserver() {
|
2019-02-23 16:38:53 +00:00
|
|
|
if (self.ResizeObserver) {
|
2020-05-04 12:44:12 +02:00
|
|
|
define('ResizeObserver', [], function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
return self.ResizeObserver;
|
|
|
|
});
|
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
define('ResizeObserver', ['resize-observer-polyfill'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-05-14 23:25:22 +02:00
|
|
|
function initRequireWithBrowser() {
|
2019-10-01 00:51:56 +09:00
|
|
|
var componentsPath = getComponentsPath();
|
2020-04-24 23:37:27 +09:00
|
|
|
var scriptsPath = getScriptsPath();
|
2019-01-16 02:47:29 +09:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-17 17:04:36 +09:00
|
|
|
define('lazyLoader', [componentsPath + '/lazyLoader/lazyLoaderIntersectionObserver'], returnFirstDependency);
|
2020-05-17 00:52:16 +09:00
|
|
|
define('shell', [scriptsPath + '/shell'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-14 23:25:22 +02:00
|
|
|
define('registerElement', ['document-register-element'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('alert', [componentsPath + '/alert'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-01-16 02:47:29 +09:00
|
|
|
defineResizeObserver();
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('dialog', [componentsPath + '/dialog/dialog'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('confirm', [componentsPath + '/confirm/confirm'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('prompt', [componentsPath + '/prompt/prompt'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('loading', [componentsPath + '/loading/loading'], returnFirstDependency);
|
2020-05-17 00:52:16 +09:00
|
|
|
define('multi-download', [scriptsPath + '/multiDownload'], returnFirstDependency);
|
|
|
|
define('fileDownloader', [scriptsPath + '/fileDownloader'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
define('castSenderApiLoader', [componentsPath + '/castSenderApi'], returnFirstDependency);
|
2019-03-16 19:34:19 +00:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function init() {
|
2020-05-04 12:44:12 +02:00
|
|
|
define('livetvcss', ['css!assets/css/livetv.css'], returnFirstDependency);
|
|
|
|
define('detailtablecss', ['css!assets/css/detailtable.css'], returnFirstDependency);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-09-11 22:16:27 -07:00
|
|
|
var promises = [];
|
2019-05-05 23:55:42 +02:00
|
|
|
if (!window.fetch) {
|
2020-05-04 12:44:12 +02:00
|
|
|
promises.push(require(['fetch']));
|
2019-05-05 23:55:42 +02:00
|
|
|
}
|
|
|
|
|
2019-02-23 17:12:14 +00:00
|
|
|
Promise.all(promises).then(function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
createConnectionManager().then(function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('initAfterDependencies promises resolved');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['globalize', 'browser'], function (globalize, browser) {
|
2019-02-23 16:38:53 +00:00
|
|
|
window.Globalize = globalize;
|
|
|
|
loadCoreDictionary(globalize).then(function () {
|
|
|
|
onGlobalizeInit(browser);
|
|
|
|
});
|
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['keyboardnavigation'], function(keyboardnavigation) {
|
2019-05-08 07:03:59 +02:00
|
|
|
keyboardnavigation.enable();
|
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['mouseManager']);
|
|
|
|
require(['focusPreventScroll']);
|
|
|
|
require(['autoFocuser'], function(autoFocuser) {
|
2019-11-02 20:38:58 +03:00
|
|
|
autoFocuser.enable();
|
|
|
|
});
|
2020-04-03 19:26:59 +02:00
|
|
|
require(['globalize', 'connectionManager', 'events'], function (globalize, connectionManager, events) {
|
|
|
|
events.on(connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
|
|
|
});
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function loadCoreDictionary(globalize) {
|
2020-05-04 12:44:12 +02:00
|
|
|
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'];
|
2019-03-04 20:38:39 +00:00
|
|
|
var translations = languages.map(function (language) {
|
2019-02-03 02:31:09 +09:00
|
|
|
return {
|
2019-03-04 20:38:39 +00:00
|
|
|
lang: language,
|
2020-05-04 12:44:12 +02:00
|
|
|
path: 'strings/' + language + '.json'
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
2019-02-03 02:31:09 +09:00
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
globalize.defaultModule('core');
|
2019-02-03 02:31:09 +09:00
|
|
|
return globalize.loadStrings({
|
2020-05-04 12:44:12 +02:00
|
|
|
name: 'core',
|
2018-10-23 01:05:09 +03:00
|
|
|
translations: translations
|
2019-02-03 02:31:09 +09:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onGlobalizeInit(browser) {
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('android' === self.appMode) {
|
|
|
|
if (-1 !== self.location.href.toString().toLowerCase().indexOf('start=backgroundsync')) {
|
2019-02-23 16:38:53 +00:00
|
|
|
return onAppReady(browser);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
document.title = Globalize.translateDocument(document.title, 'core');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (browser.tv && !browser.android) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('using system fonts with explicit sizes');
|
|
|
|
require(['systemFontsSizedCss']);
|
2019-02-23 16:38:53 +00:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('using default fonts');
|
|
|
|
require(['systemFontsCss']);
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['apphost', 'css!assets/css/librarybrowser'], function (appHost) {
|
2019-05-21 22:28:48 +01:00
|
|
|
loadPlugins(appHost, browser).then(function () {
|
2019-01-21 17:47:10 +09:00
|
|
|
onAppReady(browser);
|
2019-02-23 16:38:53 +00:00
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2019-05-21 22:28:48 +01:00
|
|
|
function loadPlugins(appHost, browser, shell) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('loading installed plugins');
|
2019-03-04 20:40:13 +00:00
|
|
|
var list = [
|
2020-05-18 17:57:52 +02:00
|
|
|
'plugins/playAccessValidation/plugin',
|
|
|
|
'plugins/experimentalWarnings/plugin',
|
|
|
|
'plugins/htmlAudioPlayer/plugin',
|
|
|
|
'plugins/htmlVideoPlayer/plugin',
|
|
|
|
'plugins/photoPlayer/plugin',
|
|
|
|
'plugins/bookPlayer/plugin',
|
|
|
|
'plugins/youtubePlayer/plugin',
|
|
|
|
'plugins/backdropScreensaver/plugin',
|
|
|
|
'plugins/logoScreensaver/plugin'
|
2019-03-04 20:40:13 +00:00
|
|
|
];
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (appHost.supports('remotecontrol')) {
|
2020-05-18 17:57:52 +02:00
|
|
|
list.push('plugins/sessionPlayer/plugin');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-02-01 10:22:26 +00:00
|
|
|
if (browser.chrome || browser.opera) {
|
2020-05-18 17:57:52 +02:00
|
|
|
list.push('plugins/chromecastPlayer/plugin');
|
2019-02-01 10:22:26 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-05-21 22:28:48 +01:00
|
|
|
if (window.NativeShell) {
|
|
|
|
list = list.concat(window.NativeShell.getPlugins());
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
Promise.all(list.map(loadPlugin)).then(function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['packageManager'], function (packageManager) {
|
2019-02-23 16:38:53 +00:00
|
|
|
packageManager.init().then(resolve, reject);
|
|
|
|
});
|
|
|
|
}, reject);
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function loadPlugin(url) {
|
2019-02-23 16:38:53 +00:00
|
|
|
return new Promise(function (resolve, reject) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['pluginManager'], function (pluginManager) {
|
2019-02-23 16:38:53 +00:00
|
|
|
pluginManager.loadPlugin(url).then(resolve, reject);
|
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onAppReady(browser) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('begin onAppReady');
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-03-09 17:35:38 +00:00
|
|
|
// ensure that appHost is loaded in this point
|
2019-03-16 15:48:53 +00:00
|
|
|
require(['apphost', 'appRouter'], function (appHost, appRouter) {
|
2019-03-09 17:35:38 +00:00
|
|
|
window.Emby = {};
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
console.debug('onAppReady: loading dependencies');
|
2019-10-01 00:51:56 +09:00
|
|
|
if (browser.iOS) {
|
2019-12-11 23:41:16 +09:00
|
|
|
require(['css!assets/css/ios.css']);
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
window.Emby.Page = appRouter;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-17 00:52:16 +09:00
|
|
|
require(['emby-button', 'scripts/themeLoader', 'libraryMenu', 'scripts/routes'], function () {
|
2019-10-01 00:51:56 +09:00
|
|
|
Emby.Page.start({
|
|
|
|
click: false,
|
|
|
|
hashbang: true
|
|
|
|
});
|
2019-02-23 17:12:14 +00:00
|
|
|
|
2020-05-17 01:06:28 +09:00
|
|
|
require(['components/themeMediaPlayer', 'scripts/autoBackdrops']);
|
2019-02-23 17:12:14 +00:00
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
2020-05-17 02:48:21 +09:00
|
|
|
require(['components/nowPlayingBar/nowPlayingBar']);
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (appHost.supports('remotecontrol')) {
|
|
|
|
require(['playerSelectionMenu', 'components/playback/remotecontrolautoplay']);
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['libraries/screensavermanager']);
|
2019-11-23 23:25:10 +03:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (!appHost.supports('physicalvolumecontrol') || browser.touch) {
|
|
|
|
require(['components/playback/volumeosd']);
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-29 00:25:30 +02:00
|
|
|
/* eslint-disable-next-line compat/compat */
|
2020-05-01 16:13:46 +02:00
|
|
|
if (navigator.mediaSession || window.NativeShell) {
|
2020-05-07 11:33:40 +02:00
|
|
|
require(['mediaSession']);
|
2020-05-01 16:13:46 +02:00
|
|
|
}
|
2020-05-07 11:33:40 +02:00
|
|
|
require(['serverNotifications']);
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['date-fns', 'date-fns/locale']);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
if (!browser.tv && !browser.xboxOne) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['components/playback/playbackorientation']);
|
2019-10-01 00:51:56 +09:00
|
|
|
registerServiceWorker();
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
if (window.Notification) {
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['components/notifications/notifications']);
|
2019-02-23 17:12:14 +00:00
|
|
|
}
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['playerSelectionMenu']);
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-02-04 15:40:32 -05:00
|
|
|
var apiClient = window.ConnectionManager && window.ConnectionManager.currentApiClient();
|
|
|
|
if (apiClient) {
|
2020-05-04 12:44:12 +02:00
|
|
|
fetch(apiClient.getUrl('Branding/Css'))
|
2020-02-04 15:40:32 -05:00
|
|
|
.then(function(response) {
|
|
|
|
if (!response.ok) {
|
|
|
|
throw new Error(response.status + ' ' + response.statusText);
|
|
|
|
}
|
|
|
|
return response.text();
|
|
|
|
})
|
|
|
|
.then(function(css) {
|
|
|
|
// Inject the branding css as a dom element in body so it will take
|
|
|
|
// precedence over other stylesheets
|
|
|
|
var style = document.createElement('style');
|
|
|
|
style.appendChild(document.createTextNode(css));
|
|
|
|
document.body.appendChild(style);
|
|
|
|
})
|
|
|
|
.catch(function(err) {
|
|
|
|
console.warn('Error applying custom css', err);
|
|
|
|
});
|
2019-10-01 00:51:56 +09:00
|
|
|
}
|
|
|
|
});
|
2019-03-09 17:35:38 +00:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function registerServiceWorker() {
|
2020-04-04 21:29:53 +02:00
|
|
|
/* eslint-disable compat/compat */
|
2020-05-04 12:44:12 +02:00
|
|
|
if (navigator.serviceWorker && self.appMode !== 'cordova' && self.appMode !== 'android') {
|
2019-02-23 16:38:53 +00:00
|
|
|
try {
|
2020-05-04 12:44:12 +02:00
|
|
|
navigator.serviceWorker.register('serviceworker.js');
|
2019-02-23 16:38:53 +00:00
|
|
|
} catch (err) {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.error('error registering serviceWorker: ' + err);
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
2020-04-04 21:29:53 +02:00
|
|
|
} else {
|
2020-05-04 12:44:12 +02:00
|
|
|
console.warn('serviceWorker unsupported');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2020-04-04 21:29:53 +02:00
|
|
|
/* eslint-enable compat/compat */
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
2020-05-14 23:25:22 +02:00
|
|
|
function onWebComponentsReady() {
|
|
|
|
initRequireWithBrowser();
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-02-05 03:50:16 +09:00
|
|
|
if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') {
|
|
|
|
AppInfo.isNativeApp = true;
|
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-02-26 10:29:52 -05:00
|
|
|
init();
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-05 03:50:16 +09:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var localApiClient;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
(function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
2020-01-24 02:57:29 +09:00
|
|
|
|
2019-01-21 17:47:10 +09:00
|
|
|
var bowerPath = getBowerPath();
|
2019-10-01 00:51:56 +09:00
|
|
|
var componentsPath = getComponentsPath();
|
2020-01-24 02:57:29 +09:00
|
|
|
var elementsPath = getElementsPath();
|
|
|
|
var scriptsPath = getScriptsPath();
|
|
|
|
|
2019-01-21 17:47:10 +09:00
|
|
|
var paths = {
|
2020-05-17 00:52:16 +09:00
|
|
|
browserdeviceprofile: 'scripts/browserDeviceProfile',
|
2020-05-04 12:44:12 +02:00
|
|
|
browser: 'scripts/browser',
|
2020-05-17 00:52:16 +09:00
|
|
|
libraryBrowser: 'scripts/libraryBrowser',
|
2020-05-04 12:44:12 +02:00
|
|
|
inputManager: 'scripts/inputManager',
|
|
|
|
datetime: 'scripts/datetime',
|
|
|
|
globalize: 'scripts/globalize',
|
|
|
|
dfnshelper: 'scripts/dfnshelper',
|
2020-05-17 00:52:16 +09:00
|
|
|
libraryMenu: 'scripts/libraryMenu',
|
2020-05-04 12:44:12 +02:00
|
|
|
playlisteditor: componentsPath + '/playlisteditor/playlisteditor',
|
2020-05-17 02:48:21 +09:00
|
|
|
medialibrarycreator: componentsPath + '/mediaLibraryCreator/mediaLibraryCreator',
|
|
|
|
medialibraryeditor: componentsPath + '/mediaLibraryEditor/mediaLibraryEditor',
|
2020-05-17 17:04:36 +09:00
|
|
|
imageoptionseditor: componentsPath + '/imageOptionsEditor/imageOptionsEditor',
|
2020-05-04 12:44:12 +02:00
|
|
|
apphost: componentsPath + '/apphost',
|
|
|
|
visibleinviewport: bowerPath + '/visibleinviewport',
|
2020-05-17 01:06:28 +09:00
|
|
|
qualityoptions: componentsPath + '/qualityOptions',
|
2020-05-04 12:44:12 +02:00
|
|
|
focusManager: componentsPath + '/focusManager',
|
2020-05-17 01:06:28 +09:00
|
|
|
itemHelper: componentsPath + '/itemHelper',
|
2020-05-04 12:44:12 +02:00
|
|
|
itemShortcuts: componentsPath + '/shortcuts',
|
|
|
|
playQueueManager: componentsPath + '/playback/playqueuemanager',
|
|
|
|
nowPlayingHelper: componentsPath + '/playback/nowplayinghelper',
|
|
|
|
pluginManager: componentsPath + '/pluginManager',
|
|
|
|
packageManager: componentsPath + '/packagemanager',
|
2020-05-18 19:32:19 +02:00
|
|
|
screensaverManager: componentsPath + '/screensavermanager',
|
|
|
|
chromecastHelper: 'plugins/chromecastPlayer/chromecastHelpers'
|
2019-01-21 17:47:10 +09:00
|
|
|
};
|
2019-09-30 00:05:20 -04:00
|
|
|
|
2019-10-01 00:51:56 +09:00
|
|
|
requirejs.onError = onRequireJsError;
|
2019-09-30 00:05:20 -04:00
|
|
|
requirejs.config({
|
|
|
|
waitSeconds: 0,
|
|
|
|
map: {
|
2020-05-04 12:44:12 +02:00
|
|
|
'*': {
|
|
|
|
css: 'components/require/requirecss',
|
|
|
|
text: 'components/require/requiretext'
|
2019-09-30 00:05:20 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
bundles: {
|
2019-10-01 00:51:56 +09:00
|
|
|
bundle: [
|
2020-05-04 12:44:12 +02:00
|
|
|
'document-register-element',
|
|
|
|
'fetch',
|
|
|
|
'flvjs',
|
|
|
|
'jstree',
|
2020-05-05 23:02:05 +09:00
|
|
|
'epubjs',
|
2020-05-04 12:44:12 +02:00
|
|
|
'jQuery',
|
|
|
|
'hlsjs',
|
|
|
|
'howler',
|
|
|
|
'native-promise-only',
|
|
|
|
'resize-observer-polyfill',
|
|
|
|
'shaka',
|
|
|
|
'swiper',
|
|
|
|
'queryString',
|
|
|
|
'sortable',
|
|
|
|
'webcomponents',
|
|
|
|
'material-icons',
|
|
|
|
'jellyfin-noto',
|
|
|
|
'date-fns',
|
|
|
|
'page',
|
|
|
|
'polyfill',
|
|
|
|
'fast-text-encoding',
|
|
|
|
'intersection-observer',
|
|
|
|
'classlist-polyfill',
|
|
|
|
'screenfull',
|
2020-05-05 11:28:41 +02:00
|
|
|
'headroom',
|
|
|
|
'apiclient',
|
|
|
|
'events',
|
|
|
|
'credentialprovider',
|
|
|
|
'connectionManagerFactory',
|
|
|
|
'appStorage'
|
2019-10-01 00:51:56 +09:00
|
|
|
]
|
2019-09-30 00:05:20 -04:00
|
|
|
},
|
|
|
|
urlArgs: urlArgs,
|
|
|
|
paths: paths,
|
|
|
|
onError: onRequireJsError
|
|
|
|
});
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['fetch']);
|
|
|
|
require(['polyfill']);
|
|
|
|
require(['fast-text-encoding']);
|
|
|
|
require(['intersection-observer']);
|
|
|
|
require(['classlist-polyfill']);
|
2020-03-13 09:43:30 +01:00
|
|
|
|
2019-09-30 00:05:20 -04:00
|
|
|
// Expose jQuery globally
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['jQuery'], function(jQuery) {
|
2019-09-30 00:05:20 -04:00
|
|
|
window.$ = jQuery;
|
|
|
|
window.jQuery = jQuery;
|
|
|
|
});
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
require(['css!assets/css/site']);
|
|
|
|
require(['jellyfin-noto']);
|
2019-10-03 02:33:21 +09:00
|
|
|
|
|
|
|
// define styles
|
|
|
|
// TODO determine which of these files can be moved to the components themselves
|
2020-05-04 12:44:12 +02:00
|
|
|
define('systemFontsCss', ['css!assets/css/fonts'], returnFirstDependency);
|
|
|
|
define('systemFontsSizedCss', ['css!assets/css/fonts.sized'], returnFirstDependency);
|
|
|
|
define('scrollStyles', ['css!assets/css/scrollstyles'], returnFirstDependency);
|
|
|
|
define('dashboardcss', ['css!assets/css/dashboard'], returnFirstDependency);
|
|
|
|
define('programStyles', ['css!' + componentsPath + '/guide/programs'], returnFirstDependency);
|
|
|
|
define('listViewStyle', ['css!' + componentsPath + '/listview/listview'], returnFirstDependency);
|
|
|
|
define('formDialogStyle', ['css!' + componentsPath + '/formdialog'], returnFirstDependency);
|
|
|
|
define('clearButtonStyle', ['css!assets/css/clearbutton'], returnFirstDependency);
|
|
|
|
define('cardStyle', ['css!' + componentsPath + '/cardbuilder/card'], returnFirstDependency);
|
|
|
|
define('flexStyles', ['css!assets/css/flexstyles'], returnFirstDependency);
|
2019-10-03 02:33:21 +09:00
|
|
|
|
|
|
|
// define legacy features
|
|
|
|
// TODO delete the rest of these
|
2020-05-04 12:44:12 +02:00
|
|
|
define('fnchecked', ['legacy/fnchecked'], returnFirstDependency);
|
|
|
|
define('legacyDashboard', ['legacy/dashboard'], returnFirstDependency);
|
|
|
|
define('legacySelectMenu', ['legacy/selectmenu'], returnFirstDependency);
|
2019-10-03 02:33:21 +09:00
|
|
|
|
|
|
|
// there are several objects that need to be instantiated
|
|
|
|
// TODO find a better way to do this
|
2020-05-17 17:04:36 +09:00
|
|
|
define('appFooter', [componentsPath + '/appFooter/appFooter'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('appFooter-shared', ['appFooter'], createSharedAppFooter);
|
2019-10-03 02:33:21 +09:00
|
|
|
|
2019-11-11 01:59:23 +09:00
|
|
|
// TODO remove these libraries
|
2020-01-05 14:17:25 +09:00
|
|
|
// all of these have been modified so we need to fix that first
|
2020-05-04 12:44:12 +02:00
|
|
|
define('scroller', [bowerPath + '/scroller'], returnFirstDependency);
|
|
|
|
define('navdrawer', [bowerPath + '/navdrawer/navdrawer'], returnFirstDependency);
|
|
|
|
|
|
|
|
define('emby-button', [elementsPath + '/emby-button/emby-button'], returnFirstDependency);
|
|
|
|
define('paper-icon-button-light', [elementsPath + '/emby-button/paper-icon-button-light'], returnFirstDependency);
|
|
|
|
define('emby-checkbox', [elementsPath + '/emby-checkbox/emby-checkbox'], returnFirstDependency);
|
|
|
|
define('emby-collapse', [elementsPath + '/emby-collapse/emby-collapse'], returnFirstDependency);
|
|
|
|
define('emby-input', [elementsPath + '/emby-input/emby-input'], returnFirstDependency);
|
|
|
|
define('emby-progressring', [elementsPath + '/emby-progressring/emby-progressring'], returnFirstDependency);
|
|
|
|
define('emby-radio', [elementsPath + '/emby-radio/emby-radio'], returnFirstDependency);
|
|
|
|
define('emby-select', [elementsPath + '/emby-select/emby-select'], returnFirstDependency);
|
|
|
|
define('emby-slider', [elementsPath + '/emby-slider/emby-slider'], returnFirstDependency);
|
|
|
|
define('emby-textarea', [elementsPath + '/emby-textarea/emby-textarea'], returnFirstDependency);
|
|
|
|
define('emby-toggle', [elementsPath + '/emby-toggle/emby-toggle'], returnFirstDependency);
|
|
|
|
define('emby-scroller', [elementsPath + '/emby-scroller/emby-scroller'], returnFirstDependency);
|
|
|
|
define('emby-tabs', [elementsPath + '/emby-tabs/emby-tabs'], returnFirstDependency);
|
|
|
|
define('emby-scrollbuttons', [elementsPath + '/emby-scrollbuttons/emby-scrollbuttons'], returnFirstDependency);
|
|
|
|
define('emby-itemrefreshindicator', [elementsPath + '/emby-itemrefreshindicator/emby-itemrefreshindicator'], returnFirstDependency);
|
|
|
|
define('emby-itemscontainer', [elementsPath + '/emby-itemscontainer/emby-itemscontainer'], returnFirstDependency);
|
|
|
|
define('emby-playstatebutton', [elementsPath + '/emby-playstatebutton/emby-playstatebutton'], returnFirstDependency);
|
|
|
|
define('emby-ratingbutton', [elementsPath + '/emby-ratingbutton/emby-ratingbutton'], returnFirstDependency);
|
|
|
|
define('emby-progressbar', [elementsPath + '/emby-progressbar/emby-progressbar'], returnFirstDependency);
|
|
|
|
define('emby-programcell', [elementsPath + '/emby-programcell/emby-programcell'], returnFirstDependency);
|
|
|
|
|
|
|
|
define('webSettings', [scriptsPath + '/settings/webSettings'], returnFirstDependency);
|
|
|
|
define('appSettings', [scriptsPath + '/settings/appSettings'], returnFirstDependency);
|
|
|
|
define('userSettings', [scriptsPath + '/settings/userSettings'], returnFirstDependency);
|
|
|
|
|
|
|
|
define('mediaSession', [componentsPath + '/playback/mediasession'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('actionsheet', [componentsPath + '/actionSheet/actionSheet'], returnFirstDependency);
|
2020-05-17 01:06:28 +09:00
|
|
|
define('tunerPicker', [componentsPath + '/tunerPicker'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('mainTabsManager', [componentsPath + '/maintabsmanager'], returnFirstDependency);
|
|
|
|
define('imageLoader', [componentsPath + '/images/imageLoader'], returnFirstDependency);
|
|
|
|
define('directorybrowser', [componentsPath + '/directorybrowser/directorybrowser'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('metadataEditor', [componentsPath + '/metadataEditor/metadataEditor'], returnFirstDependency);
|
|
|
|
define('personEditor', [componentsPath + '/metadataEditor/personEditor'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('playerSelectionMenu', [componentsPath + '/playback/playerSelectionMenu'], returnFirstDependency);
|
|
|
|
define('playerSettingsMenu', [componentsPath + '/playback/playersettingsmenu'], returnFirstDependency);
|
|
|
|
define('playMethodHelper', [componentsPath + '/playback/playmethodhelper'], returnFirstDependency);
|
|
|
|
define('brightnessOsd', [componentsPath + '/playback/brightnessosd'], returnFirstDependency);
|
|
|
|
define('alphaNumericShortcuts', [scriptsPath + '/alphanumericshortcuts'], returnFirstDependency);
|
2020-05-17 02:48:21 +09:00
|
|
|
define('multiSelect', [componentsPath + '/multiSelect/multiSelect'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('alphaPicker', [componentsPath + '/alphaPicker/alphaPicker'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('tabbedView', [componentsPath + '/tabbedview/tabbedview'], returnFirstDependency);
|
|
|
|
define('itemsTab', [componentsPath + '/tabbedview/itemstab'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('collectionEditor', [componentsPath + '/collectionEditor/collectionEditor'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('serverRestartDialog', [componentsPath + '/serverRestartDialog'], returnFirstDependency);
|
|
|
|
define('playlistEditor', [componentsPath + '/playlisteditor/playlisteditor'], returnFirstDependency);
|
|
|
|
define('recordingCreator', [componentsPath + '/recordingcreator/recordingcreator'], returnFirstDependency);
|
|
|
|
define('recordingEditor', [componentsPath + '/recordingcreator/recordingeditor'], returnFirstDependency);
|
|
|
|
define('seriesRecordingEditor', [componentsPath + '/recordingcreator/seriesrecordingeditor'], returnFirstDependency);
|
|
|
|
define('recordingFields', [componentsPath + '/recordingcreator/recordingfields'], returnFirstDependency);
|
|
|
|
define('recordingButton', [componentsPath + '/recordingcreator/recordingbutton'], returnFirstDependency);
|
|
|
|
define('recordingHelper', [componentsPath + '/recordingcreator/recordinghelper'], returnFirstDependency);
|
|
|
|
define('subtitleEditor', [componentsPath + '/subtitleeditor/subtitleeditor'], returnFirstDependency);
|
|
|
|
define('subtitleSync', [componentsPath + '/subtitlesync/subtitlesync'], returnFirstDependency);
|
|
|
|
define('itemIdentifier', [componentsPath + '/itemidentifier/itemidentifier'], returnFirstDependency);
|
|
|
|
define('itemMediaInfo', [componentsPath + '/itemMediaInfo/itemMediaInfo'], returnFirstDependency);
|
|
|
|
define('mediaInfo', [componentsPath + '/mediainfo/mediainfo'], returnFirstDependency);
|
2020-05-17 01:06:28 +09:00
|
|
|
define('itemContextMenu', [componentsPath + '/itemContextMenu'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('imageEditor', [componentsPath + '/imageeditor/imageeditor'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('imageDownloader', [componentsPath + '/imageDownloader/imageDownloader'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('dom', [scriptsPath + '/dom'], returnFirstDependency);
|
|
|
|
define('playerStats', [componentsPath + '/playerstats/playerstats'], returnFirstDependency);
|
|
|
|
define('searchFields', [componentsPath + '/search/searchfields'], returnFirstDependency);
|
|
|
|
define('searchResults', [componentsPath + '/search/searchresults'], returnFirstDependency);
|
|
|
|
define('upNextDialog', [componentsPath + '/upnextdialog/upnextdialog'], returnFirstDependency);
|
|
|
|
define('subtitleAppearanceHelper', [componentsPath + '/subtitlesettings/subtitleappearancehelper'], returnFirstDependency);
|
|
|
|
define('subtitleSettings', [componentsPath + '/subtitlesettings/subtitlesettings'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('displaySettings', [componentsPath + '/displaySettings/displaySettings'], returnFirstDependency);
|
2020-05-17 02:48:21 +09:00
|
|
|
define('playbackSettings', [componentsPath + '/playbackSettings/playbackSettings'], returnFirstDependency);
|
2020-05-17 17:04:36 +09:00
|
|
|
define('homescreenSettings', [componentsPath + '/homeScreenSettings/homeScreenSettings'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('playbackManager', [componentsPath + '/playback/playbackmanager'], getPlaybackManager);
|
2020-04-16 16:05:04 +02:00
|
|
|
define('timeSyncManager', [componentsPath + '/syncplay/timeSyncManager'], returnDefault);
|
2020-05-05 12:01:43 +02:00
|
|
|
define('groupSelectionMenu', [componentsPath + '/syncplay/groupSelectionMenu'], returnFirstDependency);
|
2020-05-06 23:41:54 +02:00
|
|
|
define('syncPlayManager', [componentsPath + '/syncplay/syncPlayManager'], returnDefault);
|
2020-04-15 18:09:34 +02:00
|
|
|
define('playbackPermissionManager', [componentsPath + '/syncplay/playbackPermissionManager'], returnDefault);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('layoutManager', [componentsPath + '/layoutManager', 'apphost'], getLayoutManager);
|
|
|
|
define('homeSections', [componentsPath + '/homesections/homesections'], returnFirstDependency);
|
|
|
|
define('playMenu', [componentsPath + '/playmenu'], returnFirstDependency);
|
|
|
|
define('refreshDialog', [componentsPath + '/refreshdialog/refreshdialog'], returnFirstDependency);
|
|
|
|
define('backdrop', [componentsPath + '/backdrop/backdrop'], returnFirstDependency);
|
|
|
|
define('fetchHelper', [componentsPath + '/fetchhelper'], returnFirstDependency);
|
|
|
|
define('cardBuilder', [componentsPath + '/cardbuilder/cardBuilder'], returnFirstDependency);
|
|
|
|
define('peoplecardbuilder', [componentsPath + '/cardbuilder/peoplecardbuilder'], returnFirstDependency);
|
|
|
|
define('chaptercardbuilder', [componentsPath + '/cardbuilder/chaptercardbuilder'], returnFirstDependency);
|
2020-05-19 10:29:49 +02:00
|
|
|
define('deleteHelper', [scriptsPath + '/deleteHelper'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('tvguide', [componentsPath + '/guide/guide'], returnFirstDependency);
|
|
|
|
define('guide-settings-dialog', [componentsPath + '/guide/guide-settings'], returnFirstDependency);
|
2020-05-17 02:48:21 +09:00
|
|
|
define('loadingDialog', [componentsPath + '/loadingDialog/loadingDialog'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('viewManager', [componentsPath + '/viewManager/viewManager'], function (viewManager) {
|
2019-02-23 16:38:53 +00:00
|
|
|
window.ViewManager = viewManager;
|
|
|
|
viewManager.dispatchPageEvents(true);
|
|
|
|
return viewManager;
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
define('slideshow', [componentsPath + '/slideshow/slideshow'], returnFirstDependency);
|
|
|
|
define('focusPreventScroll', ['legacy/focusPreventScroll'], returnFirstDependency);
|
|
|
|
define('userdataButtons', [componentsPath + '/userdatabuttons/userdatabuttons'], returnFirstDependency);
|
|
|
|
define('listView', [componentsPath + '/listview/listview'], returnFirstDependency);
|
|
|
|
define('indicators', [componentsPath + '/indicators/indicators'], returnFirstDependency);
|
|
|
|
define('viewSettings', [componentsPath + '/viewsettings/viewsettings'], returnFirstDependency);
|
|
|
|
define('filterMenu', [componentsPath + '/filtermenu/filtermenu'], returnFirstDependency);
|
|
|
|
define('sortMenu', [componentsPath + '/sortmenu/sortmenu'], returnFirstDependency);
|
2020-05-17 01:06:28 +09:00
|
|
|
define('sanitizefilename', [componentsPath + '/sanitizeFilename'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('toast', [componentsPath + '/toast/toast'], returnFirstDependency);
|
2020-05-19 10:26:10 +02:00
|
|
|
define('scrollHelper', [scriptsPath + '/scrollHelper'], returnFirstDependency);
|
2020-05-17 00:52:16 +09:00
|
|
|
define('touchHelper', [scriptsPath + '/touchHelper'], returnFirstDependency);
|
2020-05-17 02:48:21 +09:00
|
|
|
define('imageUploader', [componentsPath + '/imageUploader/imageUploader'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('htmlMediaHelper', [componentsPath + '/htmlMediaHelper'], returnFirstDependency);
|
|
|
|
define('viewContainer', [componentsPath + '/viewContainer'], returnFirstDependency);
|
|
|
|
define('dialogHelper', [componentsPath + '/dialogHelper/dialogHelper'], returnFirstDependency);
|
2020-05-17 00:52:16 +09:00
|
|
|
define('serverNotifications', [scriptsPath + '/serverNotifications'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('skinManager', [componentsPath + '/skinManager'], returnFirstDependency);
|
2020-05-17 00:52:16 +09:00
|
|
|
define('keyboardnavigation', [scriptsPath + '/keyboardNavigation'], returnFirstDependency);
|
2020-05-04 12:44:12 +02:00
|
|
|
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
|
|
|
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
|
|
|
define('autoFocuser', [componentsPath + '/autoFocuser'], returnFirstDependency);
|
|
|
|
define('connectionManager', [], function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
return ConnectionManager;
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
define('apiClientResolver', [], function () {
|
2019-02-23 16:38:53 +00:00
|
|
|
return function () {
|
|
|
|
return window.ApiClient;
|
|
|
|
};
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
2020-05-04 12:44:12 +02:00
|
|
|
define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) {
|
2018-10-23 01:05:09 +03:00
|
|
|
function showItem(item, serverId, options) {
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('string' == typeof item) {
|
|
|
|
require(['connectionManager'], function (connectionManager) {
|
2019-02-23 16:38:53 +00:00
|
|
|
var apiClient = connectionManager.currentApiClient();
|
|
|
|
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
|
|
|
|
appRouter.showItem(item, options);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
if (2 == arguments.length) {
|
|
|
|
options = arguments[1];
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
appRouter.show('/' + appRouter.getRouteUrl(item, options), {
|
2019-02-23 16:38:53 +00:00
|
|
|
item: item
|
|
|
|
});
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
appRouter.showLocalLogin = function (serverId, manualLogin) {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('login.html?serverid=' + serverId);
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showVideoOsd = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
return Dashboard.navigate('videoosd.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showSelectServer = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate(AppInfo.isNativeApp ? 'selectserver.html' : 'login.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showWelcome = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate(AppInfo.isNativeApp ? 'selectserver.html' : 'login.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showSettings = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('mypreferencesmenu.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showGuide = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('livetv.html?tab=1');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.goHome = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('home.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showSearch = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('search.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showLiveTV = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('livetv.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showRecordedTV = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('livetv.html?tab=3');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showFavorites = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('home.html?tab=1');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showSettings = function () {
|
2020-05-04 12:44:12 +02:00
|
|
|
Dashboard.navigate('mypreferencesmenu.html');
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.setTitle = function (title) {
|
|
|
|
LibraryMenu.setTitle(title);
|
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.getRouteUrl = function (item, options) {
|
|
|
|
if (!item) {
|
2020-05-04 12:44:12 +02:00
|
|
|
throw new Error('item cannot be null');
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (item.url) {
|
|
|
|
return item.url;
|
|
|
|
}
|
|
|
|
|
|
|
|
var context = options ? options.context : null;
|
|
|
|
var id = item.Id || item.ItemId;
|
|
|
|
|
|
|
|
if (!options) {
|
|
|
|
options = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
var url;
|
|
|
|
var itemType = item.Type || (options ? options.itemType : null);
|
|
|
|
var serverId = item.ServerId || options.serverId;
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('settings' === item) {
|
|
|
|
return 'mypreferencesmenu.html';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('wizard' === item) {
|
|
|
|
return 'wizardstart.html';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('manageserver' === item) {
|
|
|
|
return 'dashboard.html';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('recordedtv' === item) {
|
|
|
|
return 'livetv.html?tab=3&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('nextup' === item) {
|
|
|
|
return 'list.html?type=nextup&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('list' === item) {
|
|
|
|
var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (options.isFavorite) {
|
2020-05-04 12:44:12 +02:00
|
|
|
url += '&IsFavorite=true';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('livetv' === item) {
|
|
|
|
if ('programs' === options.section) {
|
|
|
|
return 'livetv.html?tab=0&serverId=' + options.serverId;
|
2019-09-11 03:22:22 -07:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('guide' === options.section) {
|
|
|
|
return 'livetv.html?tab=1&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('movies' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('shows' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('sports' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('kids' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('news' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('onnow' === options.section) {
|
|
|
|
return 'list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('dvrschedule' === options.section) {
|
|
|
|
return 'livetv.html?tab=4&serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('seriesrecording' === options.section) {
|
|
|
|
return 'livetv.html?tab=5&serverId=' + options.serverId;
|
2019-07-01 12:14:28 -05:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'livetv.html?serverId=' + options.serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('SeriesTimer' == itemType) {
|
|
|
|
return 'itemdetails.html?seriesTimerId=' + id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('livetv' == item.CollectionType) {
|
|
|
|
return 'livetv.html';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('Genre' === item.Type) {
|
|
|
|
url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('livetv' === context) {
|
|
|
|
url += '&type=Programs';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.parentId) {
|
2020-05-04 12:44:12 +02:00
|
|
|
url += '&parentId=' + options.parentId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('MusicGenre' === item.Type) {
|
|
|
|
url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (options.parentId) {
|
2020-05-04 12:44:12 +02:00
|
|
|
url += '&parentId=' + options.parentId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('Studio' === item.Type) {
|
|
|
|
url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
|
|
|
if (options.parentId) {
|
2020-05-04 12:44:12 +02:00
|
|
|
url += '&parentId=' + options.parentId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('folders' !== context && !itemHelper.isLocalItem(item)) {
|
|
|
|
if ('movies' == item.CollectionType) {
|
|
|
|
url = 'movies.html?topParentId=' + item.Id;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (options && 'latest' === options.section) {
|
|
|
|
url += '&tab=1';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('tvshows' == item.CollectionType) {
|
|
|
|
url = 'tv.html?topParentId=' + item.Id;
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if (options && 'latest' === options.section) {
|
|
|
|
url += '&tab=2';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('music' == item.CollectionType) {
|
|
|
|
return 'music.html?topParentId=' + item.Id;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
var itemTypes = ['Playlist', 'TvChannel', 'Program', 'BoxSet', 'MusicAlbum', 'MusicGenre', 'Person', 'Recording', 'MusicArtist'];
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2019-03-05 19:10:03 +00:00
|
|
|
if (itemTypes.indexOf(itemType) >= 0) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'itemdetails.html?id=' + id + '&serverId=' + serverId;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-02-23 16:38:53 +00:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
var contextSuffix = context ? '&context=' + context : '';
|
2019-01-21 17:47:10 +09:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
if ('Series' == itemType || 'Season' == itemType || 'Episode' == itemType) {
|
|
|
|
return 'itemdetails.html?id=' + id + contextSuffix + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (item.IsFolder) {
|
|
|
|
if (id) {
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'list.html?parentId=' + id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return '#';
|
2019-02-23 16:38:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
return 'itemdetails.html?id=' + id + '&serverId=' + serverId;
|
2019-02-23 16:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appRouter.showItem = showItem;
|
|
|
|
return appRouter;
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
|
2020-05-14 23:25:22 +02:00
|
|
|
return onWebComponentsReady();
|
2019-02-23 16:38:53 +00:00
|
|
|
}();
|
2019-10-01 00:51:56 +09:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
pageClassOn('viewshow', 'standalonePage', function () {
|
|
|
|
document.querySelector('.skinHeader').classList.add('noHeaderRight');
|
2019-01-21 17:47:10 +09:00
|
|
|
});
|
2019-10-01 00:51:56 +09:00
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
pageClassOn('viewhide', 'standalonePage', function () {
|
|
|
|
document.querySelector('.skinHeader').classList.remove('noHeaderRight');
|
2018-12-11 00:46:50 -05:00
|
|
|
});
|