jellyfin-web/dashboard-ui/scripts/site.js

2904 lines
93 KiB
JavaScript
Raw Normal View History

2016-07-26 21:54:38 -07:00
function getWindowLocationSearch(win) {
var search = (win || window).location.search;
if (!search) {
var index = window.location.href.indexOf('?');
if (index != -1) {
search = window.location.href.substring(index);
}
}
return search || '';
}
function getParameterByName(name, url) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS, "i");
var results = regex.exec(url || getWindowLocationSearch());
if (results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
var Dashboard = {
2015-07-27 11:18:10 -07:00
2015-05-05 08:24:47 -07:00
isConnectMode: function () {
2015-05-28 16:37:43 -07:00
if (AppInfo.isNativeApp) {
2015-05-05 08:24:47 -07:00
return true;
}
2015-12-14 08:43:03 -07:00
var url = window.location.href.toLowerCase();
2015-05-05 08:24:47 -07:00
return url.indexOf('mediabrowser.tv') != -1 ||
2015-08-30 10:26:30 -07:00
url.indexOf('emby.media') != -1;
2015-05-05 08:24:47 -07:00
},
2015-05-01 11:37:01 -07:00
isRunningInCordova: function () {
2015-05-02 09:34:27 -07:00
return window.appMode == 'cordova';
2015-05-01 11:37:01 -07:00
},
2014-10-28 16:17:55 -07:00
onRequestFail: function (e, data) {
if (data.status == 401) {
2016-07-22 22:03:25 -07:00
if (data.errorCode == "ParentalControl") {
2014-10-28 16:17:55 -07:00
2016-07-22 22:03:25 -07:00
var currentView = ViewManager.currentView();
// Bounce to the login screen, but not if a password entry fails, obviously
if (currentView && !currentView.classList.contains('.standalonePage')) {
2014-10-28 16:17:55 -07:00
Dashboard.alert({
message: Globalize.translate('MessageLoggedOutParentalControl'),
2014-10-29 15:01:02 -07:00
callback: function () {
2014-10-28 16:17:55 -07:00
Dashboard.logout(false);
}
});
}
2016-07-22 22:03:25 -07:00
2014-10-28 16:17:55 -07:00
}
}
},
getCurrentUser: function () {
2015-12-14 08:43:03 -07:00
return window.ApiClient.getCurrentUser();
},
2015-05-20 09:28:55 -07:00
serverAddress: function () {
2014-07-07 18:41:03 -07:00
2015-05-20 09:28:55 -07:00
if (Dashboard.isConnectMode()) {
var apiClient = window.ApiClient;
2014-10-21 21:42:26 -07:00
2015-05-20 09:28:55 -07:00
if (apiClient) {
return apiClient.serverAddress();
}
2014-10-21 21:42:26 -07:00
2015-05-20 09:28:55 -07:00
return null;
2014-10-15 20:26:39 -07:00
}
2015-05-20 09:28:55 -07:00
// Try to get the server address from the browser url
// This will preserve protocol, hostname, port and subdirectory
2015-12-14 08:43:03 -07:00
var urlLower = window.location.href.toLowerCase();
var index = urlLower.lastIndexOf('/web');
2015-02-10 20:28:34 -07:00
2015-05-20 09:28:55 -07:00
if (index != -1) {
return urlLower.substring(0, index);
}
2015-02-10 20:28:34 -07:00
2015-05-20 09:28:55 -07:00
// If the above failed, just piece it together manually
var loc = window.location;
2014-10-15 20:26:39 -07:00
2015-05-20 09:28:55 -07:00
var address = loc.protocol + '//' + loc.hostname;
2014-10-15 20:26:39 -07:00
2015-05-20 09:28:55 -07:00
if (loc.port) {
address += ':' + loc.port;
2014-10-15 20:26:39 -07:00
}
return address;
},
getCurrentUserId: function () {
2015-05-20 09:28:55 -07:00
var apiClient = window.ApiClient;
2014-03-15 13:08:06 -07:00
2015-05-20 09:28:55 -07:00
if (apiClient) {
return apiClient.getCurrentUserId();
}
2015-05-20 09:28:55 -07:00
return null;
},
2015-05-20 09:28:55 -07:00
onServerChanged: function (userId, accessToken, apiClient) {
2015-05-20 09:28:55 -07:00
apiClient = apiClient || window.ApiClient;
2014-02-08 13:02:35 -07:00
2015-05-20 09:28:55 -07:00
window.ApiClient = apiClient;
},
2015-05-21 13:53:14 -07:00
logout: function (logoutWithServer) {
2015-05-17 18:27:48 -07:00
function onLogoutDone() {
2015-05-19 12:15:40 -07:00
var loginPage;
2014-10-21 05:42:02 -07:00
2015-05-18 18:46:31 -07:00
if (Dashboard.isConnectMode()) {
loginPage = 'connectlogin.html';
window.ApiClient = null;
} else {
2015-05-19 12:15:40 -07:00
loginPage = 'login.html';
2015-05-18 18:46:31 -07:00
}
2015-05-21 13:53:14 -07:00
Dashboard.navigate(loginPage);
2015-05-17 18:27:48 -07:00
}
2014-07-12 21:55:56 -07:00
2015-05-17 18:27:48 -07:00
if (logoutWithServer === false) {
onLogoutDone();
} else {
2015-12-14 08:43:03 -07:00
ConnectionManager.logout().then(onLogoutDone);
2014-07-12 21:55:56 -07:00
}
},
getConfigurationPageUrl: function (name) {
2016-03-15 22:33:31 -07:00
return "configurationpage?name=" + encodeURIComponent(name);
},
2015-12-14 08:43:03 -07:00
navigate: function (url, preserveQueryString) {
2015-05-12 21:55:19 -07:00
if (!url) {
throw new Error('url cannot be null or empty');
}
2014-04-08 19:12:17 -07:00
var queryString = getWindowLocationSearch();
if (preserveQueryString && queryString) {
url += queryString;
}
2015-05-20 10:29:26 -07:00
2016-03-15 22:33:31 -07:00
if (url.indexOf('/') != 0) {
2016-08-20 23:59:36 -07:00
if (url.indexOf('://') == -1) {
2016-03-15 22:33:31 -07:00
url = '/' + url;
}
}
Emby.Page.show(url);
},
showLoadingMsg: function () {
2015-06-16 10:37:49 -07:00
2015-12-14 08:43:03 -07:00
Dashboard.loadingVisible = true;
2015-06-16 10:37:49 -07:00
2016-02-16 09:15:36 -07:00
require(['loading'], function (loading) {
if (Dashboard.loadingVisible) {
loading.show();
} else {
loading.hide();
}
});
},
hideLoadingMsg: function () {
2015-06-16 10:37:49 -07:00
2015-12-14 08:43:03 -07:00
Dashboard.loadingVisible = false;
2016-02-16 09:15:36 -07:00
require(['loading'], function (loading) {
if (Dashboard.loadingVisible) {
loading.show();
} else {
loading.hide();
}
});
},
processPluginConfigurationUpdateResult: function () {
Dashboard.hideLoadingMsg();
2016-02-24 23:38:12 -07:00
require(['toast'], function (toast) {
toast(Globalize.translate('MessageSettingsSaved'));
});
},
processServerConfigurationUpdateResult: function (result) {
Dashboard.hideLoadingMsg();
2016-02-24 23:38:12 -07:00
require(['toast'], function (toast) {
toast(Globalize.translate('MessageSettingsSaved'));
});
},
processErrorResponse: function (response) {
Dashboard.hideLoadingMsg();
var status = '' + response.status;
if (response.statusText) {
status = response.statusText;
}
Dashboard.alert({
title: status,
message: response.headers ? response.headers.get('X-Application-Error-Code') : null
});
},
2015-05-01 11:37:01 -07:00
alert: function (options) {
if (typeof options == "string") {
2016-02-16 09:15:36 -07:00
require(['toast'], function (toast) {
2015-05-01 11:37:01 -07:00
2016-02-16 09:15:36 -07:00
toast({
text: options
});
2015-12-14 08:43:03 -07:00
2015-06-16 10:37:49 -07:00
});
2015-05-01 11:37:01 -07:00
return;
}
2016-02-26 13:29:27 -07:00
require(['alert'], function (alert) {
alert({
title: options.title || Globalize.translate('HeaderAlert'),
text: options.message
}).then(options.callback || function () { });
2015-12-14 08:43:03 -07:00
});
},
restartServer: function () {
2016-07-28 13:21:54 -07:00
var apiClient = window.ApiClient;
if (!apiClient) {
return;
}
Dashboard.suppressAjaxErrors = true;
Dashboard.showLoadingMsg();
2016-07-28 13:21:54 -07:00
apiClient.restartServer().then(function () {
setTimeout(function () {
Dashboard.reloadPageWhenServerAvailable();
}, 250);
2015-12-14 08:43:03 -07:00
}, function () {
Dashboard.suppressAjaxErrors = false;
});
},
reloadPageWhenServerAvailable: function (retryCount) {
2016-07-28 13:21:54 -07:00
var apiClient = window.ApiClient;
if (!apiClient) {
return;
}
// Don't use apiclient method because we don't want it reporting authentication under the old version
2016-07-28 13:21:54 -07:00
apiClient.getJSON(apiClient.getUrl("System/Info")).then(function (info) {
// If this is back to false, the restart completed
if (!info.HasPendingRestart) {
2016-08-13 17:52:19 -07:00
window.location.reload(true);
} else {
Dashboard.retryReload(retryCount);
}
2015-12-14 08:43:03 -07:00
}, function () {
Dashboard.retryReload(retryCount);
});
},
retryReload: function (retryCount) {
setTimeout(function () {
retryCount = retryCount || 0;
retryCount++;
if (retryCount < 10) {
Dashboard.reloadPageWhenServerAvailable(retryCount);
} else {
Dashboard.suppressAjaxErrors = false;
}
}, 500);
},
2015-06-10 06:37:07 -07:00
showUserFlyout: function () {
2016-02-14 13:38:19 -07:00
Dashboard.navigate('mypreferencesmenu.html?userId=' + ApiClient.getCurrentUserId());
2015-06-10 06:37:07 -07:00
},
getPluginSecurityInfo: function () {
2016-07-28 13:21:54 -07:00
var apiClient = window.ApiClient;
2015-05-19 12:15:40 -07:00
if (!apiClient) {
2016-02-22 11:25:45 -07:00
return Promise.reject();
2015-12-14 08:43:03 -07:00
}
2015-12-14 08:43:03 -07:00
var cachedInfo = Dashboard.pluginSecurityInfo;
if (cachedInfo) {
2016-02-22 11:25:45 -07:00
return Promise.resolve(cachedInfo);
}
2015-12-14 08:43:03 -07:00
return apiClient.ajax({
type: "GET",
url: apiClient.getUrl("Plugins/SecurityInfo"),
dataType: 'json',
error: function () {
// Don't show normal dashboard errors
}
}).then(function (result) {
Dashboard.pluginSecurityInfo = result;
return result;
});
},
resetPluginSecurityInfo: function () {
2015-12-14 08:43:03 -07:00
Dashboard.pluginSecurityInfo = null;
},
2014-06-21 22:52:31 -07:00
ensureHeader: function (page) {
2015-06-28 07:45:21 -07:00
if (page.classList.contains('standalonePage') && !page.classList.contains('noHeaderPage')) {
2014-06-21 22:52:31 -07:00
Dashboard.renderHeader(page);
}
},
2014-06-21 22:52:31 -07:00
renderHeader: function (page) {
2015-06-28 07:45:21 -07:00
var header = page.querySelector('.header');
2013-04-23 12:17:21 -07:00
2015-06-28 07:45:21 -07:00
if (!header) {
2014-06-21 22:52:31 -07:00
var headerHtml = '';
2013-04-22 07:44:11 -07:00
headerHtml += '<div class="header">';
2016-03-15 22:33:31 -07:00
headerHtml += '<a class="logo" href="home.html" style="text-decoration:none;font-size: 22px;">';
2015-06-28 07:45:21 -07:00
if (page.classList.contains('standalonePage')) {
2016-07-24 11:25:32 -07:00
headerHtml += '<img class="imgLogoIcon" src="css/images/logo.png" />';
2013-03-31 22:08:29 -07:00
}
headerHtml += '</a>';
2013-12-26 22:08:37 -07:00
2013-04-22 07:44:11 -07:00
headerHtml += '</div>';
2016-06-17 17:52:04 -07:00
page.insertAdjacentHTML('afterbegin', headerHtml);
}
},
2013-05-10 05:18:07 -07:00
2016-03-27 20:37:33 -07:00
getToolsLinkHtml: function (item) {
var menuHtml = '';
var pageIds = item.pageIds ? item.pageIds.join(',') : '';
pageIds = pageIds ? (' data-pageids="' + pageIds + '"') : '';
menuHtml += '<a class="sidebarLink" href="' + item.href + '"' + pageIds + '>';
var icon = item.icon;
if (icon) {
2016-03-28 10:49:30 -07:00
var style = item.color ? ' style="color:' + item.color + '"' : '';
2016-06-18 22:26:52 -07:00
menuHtml += '<i class="md-icon sidebarLinkIcon"' + style + '>' + icon + '</i>';
2016-03-27 20:37:33 -07:00
}
menuHtml += '<span class="sidebarLinkText">';
menuHtml += item.name;
menuHtml += '</span>';
menuHtml += '</a>';
return menuHtml;
},
2015-06-21 14:31:21 -07:00
getToolsMenuHtml: function (page) {
2015-06-21 14:31:21 -07:00
var items = Dashboard.getToolsMenuLinks(page);
2015-06-21 14:31:21 -07:00
var i, length, item;
var menuHtml = '';
2016-03-27 20:37:33 -07:00
menuHtml += '<div class="drawerContent">';
2015-06-21 14:31:21 -07:00
for (i = 0, length = items.length; i < length; i++) {
2015-06-21 14:31:21 -07:00
item = items[i];
2015-01-18 12:53:34 -07:00
2016-04-12 22:28:45 -07:00
if (item.divider) {
menuHtml += "<div class='sidebarDivider'></div>";
}
2016-07-02 11:05:40 -07:00
if (item.href) {
2016-03-27 20:37:33 -07:00
menuHtml += Dashboard.getToolsLinkHtml(item);
2015-06-21 14:31:21 -07:00
} else {
2015-06-21 14:31:21 -07:00
menuHtml += '<div class="sidebarHeader">';
menuHtml += item.name;
menuHtml += '</div>';
}
}
2016-03-27 20:37:33 -07:00
menuHtml += '</div>';
2015-06-21 14:31:21 -07:00
return menuHtml;
},
2013-12-26 22:08:37 -07:00
2016-03-27 20:37:33 -07:00
getToolsMenuLinks: function () {
return [{
2016-04-12 22:28:45 -07:00
name: Globalize.translate('TabServer')
}, {
name: Globalize.translate('TabDashboard'),
href: "dashboard.html",
pageIds: ['dashboardPage'],
icon: 'dashboard'
}, {
2016-04-12 22:28:45 -07:00
name: Globalize.translate('TabSettings'),
href: "dashboardgeneral.html",
pageIds: ['dashboardGeneralPage'],
icon: 'settings'
}, {
name: Globalize.translate('TabDevices'),
href: "devices.html",
2016-04-13 09:17:52 -07:00
pageIds: ['devicesPage', 'devicePage'],
2016-04-12 22:28:45 -07:00
icon: 'tablet'
}, {
name: Globalize.translate('TabUsers'),
href: "userprofiles.html",
2016-04-16 12:46:47 -07:00
pageIds: ['userProfilesPage', 'newUserPage', 'editUserPage', 'userLibraryAccessPage', 'userParentalControlPage', 'userPasswordPage'],
2016-04-12 22:28:45 -07:00
icon: 'people'
2016-06-24 17:29:39 -07:00
}, {
name: 'Emby Premiere',
href: "supporterkey.html",
pageIds: ['supporterKeyPage'],
icon: 'star'
2016-04-12 22:28:45 -07:00
}, {
divider: true,
2016-04-14 09:30:37 -07:00
name: Globalize.translate('TabLibrary'),
2016-04-12 22:28:45 -07:00
href: "library.html",
2016-06-05 12:44:55 -07:00
pageIds: ['mediaLibraryPage', 'libraryPathMappingPage', 'librarySettingsPage', 'libraryDisplayPage'],
2015-06-21 14:31:21 -07:00
icon: 'folder',
2016-06-24 17:29:39 -07:00
color: '#38c'
2014-06-01 12:41:35 -07:00
}, {
2016-04-12 22:28:45 -07:00
name: Globalize.translate('TabMetadata'),
href: "metadata.html",
2016-04-12 23:02:07 -07:00
pageIds: ['metadataConfigurationPage', 'metadataImagesConfigurationPage', 'metadataNfoPage'],
2016-06-18 22:26:52 -07:00
icon: 'insert_drive_file',
2016-04-12 23:02:07 -07:00
color: '#FF9800'
2016-04-12 22:28:45 -07:00
}, {
name: Globalize.translate('TabSubtitles'),
href: "metadatasubtitles.html",
pageIds: ['metadataSubtitlesPage'],
2016-06-18 22:26:52 -07:00
icon: 'closed_caption'
2016-04-12 22:28:45 -07:00
}, {
name: Globalize.translate('TabPlayback'),
2016-06-18 22:26:52 -07:00
icon: 'play_circle_filled',
2016-04-05 21:22:57 -07:00
color: '#E5342E',
2016-04-12 22:28:45 -07:00
href: "cinemamodeconfiguration.html",
pageIds: ['cinemaModeConfigurationPage', 'playbackConfigurationPage', 'streamingSettingsPage', 'encodingSettingsPage']
}, {
name: Globalize.translate('TabSync'),
icon: 'sync',
href: "syncactivity.html",
2016-06-24 17:29:39 -07:00
pageIds: ['syncActivityPage', 'syncJobPage', 'devicesUploadPage', 'syncSettingsPage'],
color: '#009688'
2016-04-12 22:28:45 -07:00
}, {
divider: true,
name: Globalize.translate('TabExtras')
}, {
name: Globalize.translate('TabAutoOrganize'),
color: '#01C0DD',
href: "autoorganizelog.html",
pageIds: ['libraryFileOrganizerPage', 'libraryFileOrganizerSmartMatchPage', 'libraryFileOrganizerLogPage'],
icon: 'folder'
}, {
name: Globalize.translate('DLNA'),
href: "dlnasettings.html",
pageIds: ['dlnaSettingsPage', 'dlnaProfilesPage', 'dlnaProfilePage'],
icon: 'settings'
2014-01-12 09:55:38 -07:00
}, {
2014-07-16 20:17:14 -07:00
name: Globalize.translate('TabLiveTV'),
2016-04-12 22:28:45 -07:00
href: "livetvstatus.html",
2016-04-12 23:02:07 -07:00
pageIds: ['liveTvStatusPage', 'liveTvSettingsPage', 'liveTvTunerProviderHdHomerunPage', 'liveTvTunerProviderM3UPage', 'liveTvTunerProviderSatPage'],
2016-04-12 22:28:45 -07:00
icon: 'dvr'
2016-04-12 10:37:58 -07:00
}, {
name: Globalize.translate('TabNotifications'),
icon: 'notifications',
color: 'brown',
2016-04-12 22:28:45 -07:00
href: "notificationsettings.html",
pageIds: ['notificationSettingsPage', 'notificationSettingPage']
2014-03-25 14:13:55 -07:00
}, {
2014-07-16 20:17:14 -07:00
name: Globalize.translate('TabPlugins'),
2016-06-18 22:26:52 -07:00
icon: 'add_shopping_cart',
2016-04-05 21:22:57 -07:00
color: '#9D22B1',
2016-04-12 22:28:45 -07:00
href: "plugins.html",
pageIds: ['pluginsPage', 'pluginCatalogPage']
}, {
2016-04-12 22:28:45 -07:00
divider: true,
name: Globalize.translate('TabExpert')
2015-01-18 12:53:34 -07:00
}, {
name: Globalize.translate('TabAdvanced'),
2015-06-21 14:31:21 -07:00
icon: 'settings',
2016-04-12 22:28:45 -07:00
href: "dashboardhosting.html",
2016-04-05 21:22:57 -07:00
color: '#F16834',
2016-04-12 22:28:45 -07:00
pageIds: ['dashboardHostingPage', 'serverSecurityPage']
2016-06-24 17:29:39 -07:00
}, {
name: Globalize.translate('TabLogs'),
href: "log.html",
pageIds: ['logPage'],
2016-07-22 10:30:39 -07:00
icon: 'folder_open'
2016-04-12 22:28:45 -07:00
}, {
name: Globalize.translate('TabScheduledTasks'),
href: "scheduledtasks.html",
pageIds: ['scheduledTasksPage', 'scheduledTaskPage'],
icon: 'schedule'
2016-07-22 10:30:39 -07:00
}, {
2016-08-16 12:39:14 -07:00
name: Globalize.translate('MetadataManager'),
2016-07-22 10:30:39 -07:00
href: "edititemmetadata.html",
pageIds: [],
icon: 'mode_edit'
}, {
name: Globalize.translate('ButtonReports'),
href: "reports.html",
pageIds: [],
icon: 'insert_chart'
}, {
2016-07-24 09:46:17 -07:00
name: Globalize.translate('TabAbout'),
2016-04-12 22:28:45 -07:00
href: "about.html",
2016-07-24 09:46:17 -07:00
icon: 'info',
2016-04-12 22:28:45 -07:00
color: '#679C34',
divider: true,
2016-06-24 17:29:39 -07:00
pageIds: ['aboutPage']
}];
},
2014-04-13 10:27:13 -07:00
getSupportedRemoteCommands: function () {
// Full list
// https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.Model/Session/GeneralCommand.cs
return [
"GoHome",
"GoToSettings",
"VolumeUp",
"VolumeDown",
"Mute",
"Unmute",
"ToggleMute",
"SetVolume",
"SetAudioStreamIndex",
"SetSubtitleStreamIndex",
2014-04-27 18:57:29 -07:00
"DisplayContent",
2014-05-08 13:09:53 -07:00
"GoToSearch",
2015-07-26 14:02:23 -07:00
"DisplayMessage",
"SetRepeatMode"
2014-04-13 10:27:13 -07:00
];
2014-10-25 11:32:58 -07:00
},
2014-10-26 20:06:01 -07:00
isServerlessPage: function () {
2015-12-14 08:43:03 -07:00
var url = window.location.href.toLowerCase();
2015-05-05 16:20:23 -07:00
return url.indexOf('connectlogin.html') != -1 || url.indexOf('selectserver.html') != -1 || url.indexOf('login.html') != -1 || url.indexOf('forgotpassword.html') != -1 || url.indexOf('forgotpasswordpin.html') != -1;
2015-02-19 10:46:18 -07:00
},
capabilities: function () {
2015-05-26 08:31:50 -07:00
var caps = {
2015-05-28 16:37:43 -07:00
PlayableMediaTypes: ['Audio', 'Video'],
2015-02-19 10:46:18 -07:00
2015-05-28 16:37:43 -07:00
SupportedCommands: Dashboard.getSupportedRemoteCommands(),
2015-06-10 06:37:07 -07:00
// Need to use this rather than AppInfo.isNativeApp because the property isn't set yet at the time we call this
SupportsPersistentIdentifier: Dashboard.isRunningInCordova(),
2015-04-08 22:20:23 -07:00
SupportsMediaControl: true,
SupportedLiveMediaTypes: ['Audio', 'Video']
2015-02-19 10:46:18 -07:00
};
2015-05-26 08:31:50 -07:00
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova() && !browserInfo.safari) {
2015-05-28 16:37:43 -07:00
caps.SupportsOfflineAccess = true;
caps.SupportsSync = true;
caps.SupportsContentUploading = true;
}
2015-05-26 08:31:50 -07:00
return caps;
2015-05-02 09:34:27 -07:00
},
2013-04-01 22:14:37 -07:00
2016-07-10 00:01:25 -07:00
normalizeImageOptions: function (options) {
2015-05-02 09:34:27 -07:00
2016-07-10 00:01:25 -07:00
if (AppInfo.hasLowImageBandwidth) {
2015-05-02 09:34:27 -07:00
2016-07-10 00:01:25 -07:00
options.enableImageEnhancers = false;
2015-05-02 09:34:27 -07:00
}
2016-07-10 00:01:25 -07:00
var setQuality;
if (options.maxWidth) {
setQuality = true;
2016-07-07 08:56:49 -07:00
}
2016-07-10 00:01:25 -07:00
if (options.width) {
setQuality = true;
}
2014-10-23 21:54:35 -07:00
2016-07-10 00:01:25 -07:00
if (options.maxHeight) {
setQuality = true;
}
2015-05-15 08:46:20 -07:00
2016-07-10 00:01:25 -07:00
if (options.height) {
setQuality = true;
2014-10-23 21:54:35 -07:00
}
2016-07-10 00:01:25 -07:00
if (setQuality) {
var quality = 90;
2015-05-02 09:34:27 -07:00
2016-08-26 10:24:04 -07:00
var isBackdrop = (options.type || '').toLowerCase() == 'backdrop';
if (isBackdrop) {
2016-07-10 00:01:25 -07:00
quality -= 10;
}
2015-05-11 09:32:15 -07:00
2016-08-06 07:07:44 -07:00
if (browserInfo.slow) {
2016-07-14 20:57:38 -07:00
quality -= 40;
2016-07-10 00:01:25 -07:00
}
2015-05-11 09:32:15 -07:00
2016-08-26 10:24:04 -07:00
if (AppInfo.hasLowImageBandwidth && !isBackdrop) {
2016-07-10 00:01:25 -07:00
2016-08-26 10:24:04 -07:00
quality -= 10;
2016-07-10 00:01:25 -07:00
}
options.quality = quality;
2015-05-11 09:32:15 -07:00
}
},
2015-05-25 10:32:22 -07:00
loadExternalPlayer: function () {
2015-12-14 08:43:03 -07:00
return new Promise(function (resolve, reject) {
2015-05-25 10:32:22 -07:00
2015-12-14 08:43:03 -07:00
require(['scripts/externalplayer.js'], function () {
2015-05-25 10:32:22 -07:00
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova()) {
require(['cordova/externalplayer.js'], resolve);
} else {
resolve();
}
});
2015-05-25 10:32:22 -07:00
});
2015-06-08 14:32:20 -07:00
},
2016-05-05 20:09:36 -07:00
getDeviceProfile: function (maxHeight) {
return new Promise(function (resolve, reject) {
function updateDeviceProfileForAndroid(profile) {
// Just here as an easy escape out, if ever needed
var enableVlcVideo = true;
var enableVlcAudio = window.VlcAudio;
if (enableVlcVideo) {
profile.DirectPlayProfiles.push({
2016-06-06 10:33:27 -07:00
Container: "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm,wtv",
2016-05-05 20:09:36 -07:00
Type: 'Video',
2016-08-06 14:22:00 -07:00
AudioCodec: 'aac,aac_latm,mp2,mp3,ac3,wma,dca,dts,pcm,PCM_S16LE,PCM_S24LE,opus,flac'
2016-05-05 20:09:36 -07:00
});
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
return i.Type == 'Audio';
});
profile.SubtitleProfiles = [];
profile.SubtitleProfiles.push({
Format: 'srt',
Method: 'External'
});
profile.SubtitleProfiles.push({
Format: 'srt',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'subrip',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'ass',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'ssa',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'pgs',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'pgssub',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'dvdsub',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'vtt',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'sub',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'idx',
Method: 'Embed'
});
profile.SubtitleProfiles.push({
Format: 'smi',
Method: 'Embed'
});
2016-05-24 09:58:12 -07:00
profile.CodecProfiles.push({
Type: 'Video',
Container: 'avi',
Conditions: [
{
Condition: 'NotEqual',
Property: 'CodecTag',
Value: 'xvid'
}
]
});
2016-05-05 20:09:36 -07:00
profile.CodecProfiles.push({
Type: 'VideoAudio',
Codec: 'aac,mp3',
Conditions: [
{
Condition: 'LessThanEqual',
Property: 'AudioChannels',
Value: '6'
}
]
});
profile.CodecProfiles.push({
Type: 'Video',
Codec: 'h264',
Conditions: [
{
Condition: 'EqualsAny',
Property: 'VideoProfile',
Value: 'high|main|baseline|constrained baseline'
},
{
Condition: 'LessThanEqual',
Property: 'VideoLevel',
Value: '41'
}]
});
profile.TranscodingProfiles.filter(function (p) {
return p.Type == 'Video' && p.CopyTimestamps == true;
}).forEach(function (p) {
// Vlc doesn't seem to handle this well
p.CopyTimestamps = false;
});
profile.TranscodingProfiles.filter(function (p) {
return p.Type == 'Video' && p.VideoCodec == 'h264';
}).forEach(function (p) {
p.AudioCodec += ',ac3';
});
}
if (enableVlcAudio) {
profile.DirectPlayProfiles.push({
2016-08-22 13:47:16 -07:00
Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,m4a,opus,flac",
2016-05-05 20:09:36 -07:00
Type: 'Audio'
});
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
return i.Type != 'Audio';
});
profile.CodecProfiles.push({
Type: 'Audio',
Conditions: [{
Condition: 'LessThanEqual',
Property: 'AudioChannels',
Value: '2'
}]
});
}
}
require(['browserdeviceprofile', 'qualityoptions', 'appSettings'], function (profileBuilder, qualityoptions, appSettings) {
var supportsCustomSeeking = false;
if (!browserInfo.mobile) {
supportsCustomSeeking = true;
} else if (AppInfo.isNativeApp && browserInfo.safari) {
if (navigator.userAgent.toLowerCase().indexOf('ipad') == -1) {
// Need to disable it in order to support picture in picture
supportsCustomSeeking = true;
}
} else if (AppInfo.isNativeApp) {
supportsCustomSeeking = true;
}
var profile = profileBuilder({
supportsCustomSeeking: supportsCustomSeeking
});
if (!(AppInfo.isNativeApp && browserInfo.android)) {
profile.SubtitleProfiles.push({
Format: 'ass',
Method: 'External'
});
profile.SubtitleProfiles.push({
Format: 'ssa',
Method: 'External'
});
}
var bitrateSetting = appSettings.maxStreamingBitrate();
if (!maxHeight) {
maxHeight = qualityoptions.getVideoQualityOptions(bitrateSetting).filter(function (q) {
return q.selected;
})[0].maxHeight;
}
if (AppInfo.isNativeApp && browserInfo.android) {
updateDeviceProfileForAndroid(profile);
}
profile.MaxStreamingBitrate = bitrateSetting;
2016-08-22 22:08:07 -07:00
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
2016-05-05 20:09:36 -07:00
resolve(profile);
});
});
2014-10-23 21:54:35 -07:00
}
2015-05-02 09:34:27 -07:00
};
2015-05-06 20:11:51 -07:00
var AppInfo = {};
2015-05-02 09:34:27 -07:00
(function () {
2014-10-23 21:54:35 -07:00
2015-05-06 20:11:51 -07:00
function setAppInfo() {
2015-05-08 09:58:27 -07:00
var isCordova = Dashboard.isRunningInCordova();
2015-09-24 10:08:10 -07:00
AppInfo.enableHomeFavorites = true;
2015-09-24 22:15:29 -07:00
AppInfo.enableHomeTabs = true;
2015-09-25 09:08:13 -07:00
AppInfo.enableNowPlayingPageBottomTabs = true;
2016-08-06 07:07:44 -07:00
AppInfo.enableAutoSave = browserInfo.touch;
2016-03-16 11:09:58 -07:00
AppInfo.enableHashBang = Dashboard.isRunningInCordova();
2015-05-16 12:09:02 -07:00
AppInfo.enableAppStorePolicy = isCordova;
2015-05-15 19:36:47 -07:00
2015-12-14 08:43:03 -07:00
var isIOS = browserInfo.ipad || browserInfo.iphone;
var isAndroid = browserInfo.android;
2015-05-27 22:51:48 -07:00
2015-05-29 18:07:54 -07:00
if (isIOS) {
2015-05-06 20:11:51 -07:00
2015-12-14 08:43:03 -07:00
AppInfo.hasLowImageBandwidth = true;
2015-05-07 15:27:01 -07:00
2015-05-08 09:58:27 -07:00
if (isCordova) {
2015-06-20 17:49:42 -07:00
//AppInfo.enableSectionTransitions = true;
2015-09-24 10:08:10 -07:00
AppInfo.enableHomeFavorites = false;
2015-09-25 09:08:13 -07:00
AppInfo.enableNowPlayingPageBottomTabs = false;
2015-05-07 15:27:01 -07:00
}
2015-05-06 20:11:51 -07:00
}
2015-05-07 07:04:10 -07:00
2015-12-14 08:43:03 -07:00
AppInfo.supportsExternalPlayers = true;
2015-05-24 11:33:28 -07:00
if (isCordova) {
AppInfo.enableAppLayouts = true;
2015-12-14 08:43:03 -07:00
AppInfo.supportsExternalPlayerMenu = true;
2015-05-28 16:37:43 -07:00
AppInfo.isNativeApp = true;
2016-09-01 09:36:11 -07:00
AppInfo.enableHomeTabs = false;
2015-12-14 08:43:03 -07:00
if (isIOS) {
AppInfo.supportsExternalPlayers = false;
}
2015-05-24 11:33:28 -07:00
}
else {
2015-05-21 13:53:14 -07:00
AppInfo.enableSupporterMembership = true;
2015-05-07 07:04:10 -07:00
}
2015-05-08 09:58:27 -07:00
2015-12-14 08:43:03 -07:00
// This currently isn't working on android, unfortunately
AppInfo.supportsFileInput = !(AppInfo.isNativeApp && isAndroid);
2015-06-21 14:31:21 -07:00
2016-08-06 07:07:44 -07:00
AppInfo.hasPhysicalVolumeButtons = isCordova || browserInfo.mobile;
2016-06-24 10:30:29 -07:00
2015-07-14 09:39:34 -07:00
if (isCordova && isIOS) {
AppInfo.moreIcon = 'more-horiz';
} else {
AppInfo.moreIcon = 'more-vert';
}
}
2013-04-19 15:09:21 -07:00
2014-10-25 11:32:58 -07:00
function initializeApiClient(apiClient) {
2016-02-07 14:16:02 -07:00
if (AppInfo.enableAppStorePolicy) {
2016-02-09 10:13:50 -07:00
apiClient.getAvailablePlugins = function () {
2016-02-07 14:16:02 -07:00
return Promise.resolve([]);
};
apiClient.getInstalledPlugins = function () {
return Promise.resolve([]);
};
}
2015-06-08 14:32:20 -07:00
apiClient.normalizeImageOptions = Dashboard.normalizeImageOptions;
2015-05-16 12:09:02 -07:00
2015-12-23 10:46:01 -07:00
Events.off(apiClient, 'requestfail', Dashboard.onRequestFail);
Events.on(apiClient, 'requestfail', Dashboard.onRequestFail);
2014-10-25 11:32:58 -07:00
}
2015-05-25 10:32:22 -07:00
2015-12-30 10:02:11 -07:00
function getSyncProfile() {
2016-05-05 20:09:36 -07:00
return Dashboard.getDeviceProfile(Math.max(screen.height, screen.width));
2015-12-30 10:02:11 -07:00
}
function onApiClientCreated(e, newApiClient) {
initializeApiClient(newApiClient);
2016-02-28 14:31:45 -07:00
// This is not included in jQuery slim
2016-03-15 22:33:31 -07:00
if (window.$) {
$.ajax = newApiClient.ajax;
}
2015-12-30 10:02:11 -07:00
}
2016-03-14 19:09:03 -07:00
function defineConnectionManager(connectionManager) {
2016-04-18 11:50:29 -07:00
window.ConnectionManager = connectionManager;
2016-03-14 19:09:03 -07:00
define('connectionManager', [], function () {
return connectionManager;
});
}
2016-03-15 22:33:31 -07:00
var localApiClient;
function bindConnectionManagerEvents(connectionManager, events) {
2016-07-26 21:54:38 -07:00
window.Events = events;
events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
2016-04-18 11:50:29 -07:00
2016-03-15 22:33:31 -07:00
connectionManager.currentApiClient = function () {
if (!localApiClient) {
var server = connectionManager.getLastUsedServer();
2016-03-16 11:53:09 -07:00
if (server) {
localApiClient = connectionManager.getApiClient(server.Id);
}
2016-03-15 22:33:31 -07:00
}
return localApiClient;
};
//events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
// //$(newApiClient).on("websocketmessage", Dashboard.onWebSocketMessageReceived).on('requestfail', Dashboard.onRequestFail);
// newApiClient.normalizeImageOptions = normalizeImageOptions;
//});
events.on(connectionManager, 'localusersignedin', function (e, user) {
localApiClient = connectionManager.getApiClient(user.ServerId);
2016-03-15 23:07:11 -07:00
window.ApiClient = localApiClient;
2016-03-15 22:33:31 -07:00
});
}
2015-05-24 11:33:28 -07:00
//localStorage.clear();
2016-06-03 09:24:04 -07:00
function createConnectionManager() {
2015-05-01 11:37:01 -07:00
2015-12-30 10:02:11 -07:00
return getSyncProfile().then(function (deviceProfile) {
2015-01-24 23:34:50 -07:00
2016-04-18 11:50:29 -07:00
return new Promise(function (resolve, reject) {
2015-06-18 21:23:55 -07:00
2016-04-18 11:50:29 -07:00
require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events'], function (connectionManagerExports, apphost, credentialProvider, events) {
2014-05-16 21:24:10 -07:00
2016-04-18 11:50:29 -07:00
window.MediaBrowser = Object.assign(window.MediaBrowser || {}, connectionManagerExports);
2016-03-14 19:09:03 -07:00
2016-04-18 11:50:29 -07:00
var credentialProviderInstance = new credentialProvider();
2015-04-01 14:56:32 -07:00
2016-04-18 11:50:29 -07:00
apphost.appInfo().then(function (appInfo) {
2015-04-01 14:56:32 -07:00
2016-04-18 11:50:29 -07:00
var capabilities = Dashboard.capabilities();
capabilities.DeviceProfile = deviceProfile;
2015-04-25 20:25:07 -07:00
2016-04-18 11:50:29 -07:00
connectionManager = new MediaBrowser.ConnectionManager(credentialProviderInstance, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities, window.devicePixelRatio);
defineConnectionManager(connectionManager);
bindConnectionManagerEvents(connectionManager, events);
if (Dashboard.isConnectMode()) {
resolve();
2016-01-19 20:02:45 -07:00
2016-04-18 11:50:29 -07:00
} else {
2016-01-19 20:02:45 -07:00
2016-04-18 11:50:29 -07:00
console.log('loading ApiClient singleton');
2016-01-19 20:02:45 -07:00
2016-04-18 11:50:29 -07:00
return getRequirePromise(['apiclient']).then(function (apiClientFactory) {
2016-01-19 20:02:45 -07:00
2016-04-18 11:50:29 -07:00
console.log('creating ApiClient singleton');
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, window.devicePixelRatio);
apiClient.enableAutomaticNetworking = false;
connectionManager.addApiClient(apiClient);
require(['css!' + apiClient.getUrl('Branding/Css')]);
window.ApiClient = apiClient;
localApiClient = apiClient;
console.log('loaded ApiClient singleton');
resolve();
});
2016-04-26 11:28:04 -07:00
}
2016-04-18 11:50:29 -07:00
});
2015-12-23 10:46:01 -07:00
});
2016-04-18 11:50:29 -07:00
});
2015-12-14 08:43:03 -07:00
});
2015-01-24 23:34:50 -07:00
}
2015-01-18 22:41:56 -07:00
2016-03-12 13:16:42 -07:00
function setDocumentClasses(browser) {
2015-05-01 11:37:01 -07:00
2015-06-28 07:45:21 -07:00
var elem = document.documentElement;
2015-06-17 08:39:46 -07:00
2015-05-21 13:53:14 -07:00
if (!AppInfo.enableSupporterMembership) {
2015-06-28 07:45:21 -07:00
elem.classList.add('supporterMembershipDisabled');
2015-05-21 13:53:14 -07:00
}
2015-09-24 10:08:10 -07:00
if (!AppInfo.enableHomeFavorites) {
elem.classList.add('homeFavoritesDisabled');
}
2015-06-17 08:39:46 -07:00
}
2015-10-12 23:31:20 -07:00
function loadTheme() {
var name = getParameterByName('theme');
if (name) {
require(['themes/' + name + '/theme']);
return;
}
var date = new Date();
2015-10-13 12:22:45 -07:00
var month = date.getMonth();
var day = date.getDate();
if (month == 9 && day >= 30) {
2015-10-12 23:31:20 -07:00
require(['themes/halloween/theme']);
return;
}
2015-12-19 21:39:51 -07:00
if (month == 11 && day >= 21 && day <= 26) {
require(['themes/holiday/theme']);
return;
}
2015-10-12 23:31:20 -07:00
}
2016-01-30 12:31:22 -07:00
function returnFirstDependency(obj) {
return obj;
}
2016-02-04 13:51:13 -07:00
function getBowerPath() {
2016-02-05 10:04:38 -07:00
2016-07-26 10:21:27 -07:00
return "bower_components";
2016-02-04 13:51:13 -07:00
}
2016-07-21 14:23:34 -07:00
function getLayoutManager(layoutManager) {
layoutManager.init();
return layoutManager;
}
2016-08-13 21:30:59 -07:00
function getAppStorage(basePath) {
try {
localStorage.setItem('_test', '0');
localStorage.removeItem('_test');
return basePath + "/appstorage-localstorage";
} catch (e) {
return basePath + "/appstorage-memory";
}
}
2016-08-15 19:40:29 -07:00
function createWindowHeadroom() {
// construct an instance of Headroom, passing the element
var headroom = new Headroom([], {
// or scroll tolerance per direction
tolerance: {
down: 20,
up: 0
},
classes: {
//pinned: 'appfooter--pinned',
//unpinned: 'appfooter--unpinned',
//initial: 'appfooter-headroom'
}
});
// initialise
headroom.init();
return headroom;
}
2016-08-15 21:12:12 -07:00
function createMainContentHammer(Hammer) {
2016-08-19 15:56:32 -07:00
2016-08-15 21:12:12 -07:00
var hammer = new Hammer(document.querySelector('.mainDrawerPanelContent'), null);
return hammer;
}
2016-08-22 13:47:16 -07:00
function createSharedAppFooter(appFooter) {
var footer = new appFooter({});
return footer;
}
2016-02-04 13:51:13 -07:00
function initRequire() {
var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate());
var bowerPath = getBowerPath();
2015-12-21 10:48:31 -07:00
var apiClientBowerPath = bowerPath + "/emby-apiclient";
2015-12-26 11:35:53 -07:00
var embyWebComponentsBowerPath = bowerPath + '/emby-webcomponents';
2015-12-21 10:48:31 -07:00
2015-12-14 08:43:03 -07:00
var paths = {
velocity: bowerPath + "/velocity/velocity.min",
2016-04-24 16:27:47 -07:00
ironCardList: 'components/ironcardlist/ironcardlist',
2016-04-23 13:30:45 -07:00
scrollThreshold: 'components/scrollthreshold',
2015-12-14 08:43:03 -07:00
playlisteditor: 'components/playlisteditor/playlisteditor',
medialibrarycreator: 'components/medialibrarycreator/medialibrarycreator',
medialibraryeditor: 'components/medialibraryeditor/medialibraryeditor',
howler: bowerPath + '/howler.js/howler.min',
sortable: bowerPath + '/Sortable/Sortable.min',
isMobile: bowerPath + '/isMobile/isMobile.min',
2016-08-06 19:11:39 -07:00
headroom: bowerPath + '/headroom.js/dist/headroom',
2015-12-14 08:43:03 -07:00
masonry: bowerPath + '/masonry/dist/masonry.pkgd.min',
humanedate: 'components/humanedate',
2016-03-15 22:33:31 -07:00
libraryBrowser: 'scripts/librarybrowser',
chromecasthelpers: 'components/chromecasthelpers',
2015-12-23 10:46:01 -07:00
events: apiClientBowerPath + '/events',
credentialprovider: apiClientBowerPath + '/credentials',
apiclient: apiClientBowerPath + '/apiclient',
2016-04-18 11:50:29 -07:00
connectionManagerFactory: bowerPath + '/emby-apiclient/connectionmanager',
2016-01-12 10:54:37 -07:00
visibleinviewport: embyWebComponentsBowerPath + "/visibleinviewport",
2015-12-26 11:35:53 -07:00
browserdeviceprofile: embyWebComponentsBowerPath + "/browserdeviceprofile",
browser: embyWebComponentsBowerPath + "/browser",
2016-07-06 12:25:58 -07:00
inputManager: embyWebComponentsBowerPath + "/inputmanager",
2015-12-30 10:02:11 -07:00
qualityoptions: embyWebComponentsBowerPath + "/qualityoptions",
2016-01-20 18:05:14 -07:00
hammer: bowerPath + "/hammerjs/hammer.min",
2016-08-29 00:12:24 -07:00
pageJs: embyWebComponentsBowerPath + '/pagejs/page',
2016-01-30 12:31:22 -07:00
focusManager: embyWebComponentsBowerPath + "/focusmanager",
2016-04-26 11:28:04 -07:00
datetime: embyWebComponentsBowerPath + "/datetime",
2016-03-05 11:51:19 -07:00
globalize: embyWebComponentsBowerPath + "/globalize",
2016-05-11 10:46:44 -07:00
itemHelper: embyWebComponentsBowerPath + '/itemhelper',
2016-04-26 11:28:04 -07:00
itemShortcuts: embyWebComponentsBowerPath + "/shortcuts",
2016-05-16 11:20:08 -07:00
imageLoader: embyWebComponentsBowerPath + "/images/imagehelper",
2016-06-08 08:22:10 -07:00
serverNotifications: embyWebComponentsBowerPath + '/servernotifications',
2016-05-16 11:20:08 -07:00
webAnimations: bowerPath + '/web-animations-js/web-animations-next-lite.min'
2015-12-14 08:43:03 -07:00
};
2015-12-15 22:30:14 -07:00
paths.hlsjs = bowerPath + "/hls.js/dist/hls.min";
2016-08-01 13:06:30 -07:00
if ((window.chrome && window.chrome.sockets) || Dashboard.isRunningInCordova()) {
paths.serverdiscovery = apiClientBowerPath + "/serverdiscovery-chrome";
} else {
paths.serverdiscovery = apiClientBowerPath + "/serverdiscovery";
}
2016-08-31 12:17:11 -07:00
define("webActionSheet", [embyWebComponentsBowerPath + "/actionsheet/actionsheet"], returnFirstDependency);
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova()) {
2016-04-27 19:46:41 -07:00
paths.sharingMenu = "cordova/sharingwidget";
2015-12-14 08:43:03 -07:00
paths.wakeonlan = "cordova/wakeonlan";
2016-01-30 21:04:00 -07:00
paths.actionsheet = "cordova/actionsheet";
2015-12-14 08:43:03 -07:00
} else {
2015-12-15 22:30:14 -07:00
paths.wakeonlan = apiClientBowerPath + "/wakeonlan";
2016-02-21 13:39:14 -07:00
2016-04-28 20:10:48 -07:00
define("sharingMenu", [embyWebComponentsBowerPath + "/sharing/sharingmenu"], returnFirstDependency);
2016-08-31 12:17:11 -07:00
define("actionsheet", ["webActionSheet"], returnFirstDependency);
2015-05-26 08:31:50 -07:00
}
2016-07-09 14:09:21 -07:00
define("libjass", [bowerPath + "/libjass/libjass.min", "css!" + bowerPath + "/libjass/libjass"], returnFirstDependency);
2016-04-04 18:23:42 -07:00
2016-08-16 22:29:05 -07:00
define("syncJobList", ["components/syncjoblist/syncjoblist"], returnFirstDependency);
2016-08-15 11:18:05 -07:00
define("appfooter", ["components/appfooter/appfooter"], returnFirstDependency);
2016-08-13 23:21:30 -07:00
define("dockedtabs", ["components/dockedtabs/dockedtabs"], returnFirstDependency);
2016-07-24 11:25:32 -07:00
define("directorybrowser", ["components/directorybrowser/directorybrowser"], returnFirstDependency);
define("metadataEditor", [embyWebComponentsBowerPath + "/metadataeditor/metadataeditor"], returnFirstDependency);
define("personEditor", [embyWebComponentsBowerPath + "/metadataeditor/personeditor"], returnFirstDependency);
2016-07-02 11:05:40 -07:00
define("emby-collapse", [embyWebComponentsBowerPath + "/emby-collapse/emby-collapse"], returnFirstDependency);
2016-06-04 17:17:35 -07:00
define("emby-button", [embyWebComponentsBowerPath + "/emby-button/emby-button"], returnFirstDependency);
2016-07-16 11:02:39 -07:00
define("emby-itemscontainer", [embyWebComponentsBowerPath + "/emby-itemscontainer/emby-itemscontainer"], returnFirstDependency);
2016-08-14 12:58:13 -07:00
define("emby-tabs", [embyWebComponentsBowerPath + "/emby-tabs/emby-tabs"], returnFirstDependency);
define("itemHoverMenu", [embyWebComponentsBowerPath + "/itemhovermenu/itemhovermenu"], returnFirstDependency);
2016-07-17 23:45:29 -07:00
define("multiSelect", [embyWebComponentsBowerPath + "/multiselect/multiselect"], returnFirstDependency);
2016-06-06 22:42:26 -07:00
define("alphaPicker", [embyWebComponentsBowerPath + "/alphapicker/alphapicker"], returnFirstDependency);
2016-06-05 13:46:19 -07:00
define("paper-icon-button-light", [embyWebComponentsBowerPath + "/emby-button/paper-icon-button-light"]);
2016-05-28 11:03:38 -07:00
define("emby-input", [embyWebComponentsBowerPath + "/emby-input/emby-input"], returnFirstDependency);
2016-05-21 21:17:28 -07:00
define("emby-select", [embyWebComponentsBowerPath + "/emby-select/emby-select"], returnFirstDependency);
2016-06-13 12:02:48 -07:00
define("emby-slider", [embyWebComponentsBowerPath + "/emby-slider/emby-slider"], returnFirstDependency);
2016-06-11 08:56:15 -07:00
define("emby-checkbox", [embyWebComponentsBowerPath + "/emby-checkbox/emby-checkbox"], returnFirstDependency);
2016-07-09 10:39:04 -07:00
define("emby-radio", [embyWebComponentsBowerPath + "/emby-radio/emby-radio"], returnFirstDependency);
2016-06-22 22:25:16 -07:00
define("emby-textarea", [embyWebComponentsBowerPath + "/emby-textarea/emby-textarea"], returnFirstDependency);
2016-05-21 19:28:47 -07:00
define("collectionEditor", [embyWebComponentsBowerPath + "/collectioneditor/collectioneditor"], returnFirstDependency);
2016-05-21 23:08:44 -07:00
define("playlistEditor", [embyWebComponentsBowerPath + "/playlisteditor/playlisteditor"], returnFirstDependency);
2016-05-12 19:32:12 -07:00
define("recordingCreator", [embyWebComponentsBowerPath + "/recordingcreator/recordingcreator"], returnFirstDependency);
2016-05-15 22:38:17 -07:00
define("recordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/recordingeditor"], returnFirstDependency);
2016-05-30 13:46:18 -07:00
define("subtitleEditor", [embyWebComponentsBowerPath + "/subtitleeditor/subtitleeditor"], returnFirstDependency);
2016-07-30 21:11:23 -07:00
define("itemIdentifier", [embyWebComponentsBowerPath + "/itemidentifier/itemidentifier"], returnFirstDependency);
2016-05-11 22:58:05 -07:00
define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency);
2016-07-16 14:28:15 -07:00
define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency);
2016-08-29 23:06:24 -07:00
define("imageEditor", [embyWebComponentsBowerPath + "/imageeditor/imageeditor"], returnFirstDependency);
2016-07-18 11:53:04 -07:00
define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency);
2016-07-21 14:23:34 -07:00
define("layoutManager", [embyWebComponentsBowerPath + "/layoutmanager"], getLayoutManager);
2016-07-17 13:08:04 -07:00
define("playMenu", [embyWebComponentsBowerPath + "/playmenu"], returnFirstDependency);
2016-06-15 09:45:45 -07:00
define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency);
2016-03-12 00:28:13 -07:00
define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency);
2016-03-17 09:31:38 -07:00
define("fetchHelper", [embyWebComponentsBowerPath + "/fetchhelper"], returnFirstDependency);
2016-08-08 19:10:12 -07:00
define("roundCardStyle", ["cardStyle", 'css!' + embyWebComponentsBowerPath + "/cardbuilder/roundcard"], returnFirstDependency);
2016-07-28 19:42:42 -07:00
define("cardStyle", ['css!' + embyWebComponentsBowerPath + "/cardbuilder/card"], returnFirstDependency);
define("cardBuilder", [embyWebComponentsBowerPath + "/cardbuilder/cardbuilder"], returnFirstDependency);
define("peoplecardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/peoplecardbuilder"], returnFirstDependency);
define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency);
2016-05-12 19:32:12 -07:00
define("tvguide", [embyWebComponentsBowerPath + "/guide/guide", 'embyRouter'], returnFirstDependency);
2016-08-22 23:42:15 -07:00
define("syncDialog", [embyWebComponentsBowerPath + "/sync/sync"], returnFirstDependency);
2016-07-06 12:25:58 -07:00
define("voiceDialog", [embyWebComponentsBowerPath + "/voice/voicedialog"], returnFirstDependency);
2016-07-20 06:56:24 -07:00
define("voiceReceiver", [embyWebComponentsBowerPath + "/voice/voicereceiver"], returnFirstDependency);
define("voiceProcessor", [embyWebComponentsBowerPath + "/voice/voiceprocessor"], returnFirstDependency);
2016-04-26 11:28:04 -07:00
2016-05-13 21:48:59 -07:00
define("viewManager", [embyWebComponentsBowerPath + "/viewmanager/viewmanager"], function (viewManager) {
2016-06-11 10:10:06 -07:00
window.ViewManager = viewManager;
2016-03-15 22:33:31 -07:00
viewManager.dispatchPageEvents(true);
return viewManager;
});
2016-03-12 00:28:13 -07:00
2016-05-13 21:48:59 -07:00
// hack for an android test before browserInfo is loaded
if (Dashboard.isRunningInCordova() && window.MainActivity) {
2016-05-13 11:28:05 -07:00
define("shell", ["cordova/android/shell"], returnFirstDependency);
} else {
define("shell", [embyWebComponentsBowerPath + "/shell"], returnFirstDependency);
}
2016-04-27 19:46:41 -07:00
define("sharingmanager", [embyWebComponentsBowerPath + "/sharing/sharingmanager"], returnFirstDependency);
2016-04-29 09:55:11 -07:00
if (Dashboard.isRunningInCordova()) {
paths.apphost = "cordova/apphost";
} else {
paths.apphost = "components/apphost";
}
2016-01-28 13:45:52 -07:00
// hack for an android test before browserInfo is loaded
if (Dashboard.isRunningInCordova() && window.MainActivity) {
paths.appStorage = "cordova/android/appstorage";
} else {
2016-08-13 21:30:59 -07:00
paths.appStorage = getAppStorage(apiClientBowerPath);
2016-01-28 13:45:52 -07:00
}
2015-12-14 08:43:03 -07:00
var sha1Path = bowerPath + "/cryptojslib/components/sha1-min";
var md5Path = bowerPath + "/cryptojslib/components/md5-min";
var shim = {};
2015-12-14 08:43:03 -07:00
shim[sha1Path] = {
deps: [bowerPath + "/cryptojslib/components/core-min"]
};
2014-04-13 10:27:13 -07:00
2015-12-14 08:43:03 -07:00
shim[md5Path] = {
deps: [bowerPath + "/cryptojslib/components/core-min"]
};
2015-12-14 08:43:03 -07:00
requirejs.config({
2016-01-17 00:04:56 -07:00
waitSeconds: 0,
2015-12-14 08:43:03 -07:00
map: {
'*': {
2016-05-12 19:32:12 -07:00
'css': bowerPath + '/emby-webcomponents/require/requirecss',
'html': bowerPath + '/emby-webcomponents/require/requirehtml',
'text': bowerPath + '/emby-webcomponents/require/requiretext'
2015-12-14 08:43:03 -07:00
}
},
urlArgs: urlArgs,
2014-04-13 10:27:13 -07:00
2015-12-14 08:43:03 -07:00
paths: paths,
shim: shim
});
2013-09-09 11:23:55 -07:00
2015-12-14 08:43:03 -07:00
define("cryptojs-sha1", [sha1Path]);
define("cryptojs-md5", [md5Path]);
2015-05-08 20:48:43 -07:00
2015-12-14 08:43:03 -07:00
define("paper-checkbox", ["html!" + bowerPath + "/paper-checkbox/paper-checkbox.html"]);
2016-02-24 10:43:06 -07:00
define("jstree", [bowerPath + "/jstree/dist/jstree", "css!thirdparty/jstree/themes/default/style.min.css"]);
2014-07-08 17:46:11 -07:00
2016-06-01 21:41:12 -07:00
define("dashboardcss", ['css!css/dashboard']);
define("jqmbase", ['dashboardcss', 'css!thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.theme.css']);
2016-02-07 22:59:33 -07:00
define("jqmicons", ['jqmbase', 'css!thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.icons.css']);
define("jqmtable", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.table", 'css!thirdparty/jquerymobile-1.4.5/jqm.table.css']);
2014-07-08 17:46:11 -07:00
2016-02-07 22:59:33 -07:00
define("jqmwidget", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.widget"]);
2015-05-17 19:52:52 -07:00
2016-02-07 22:59:33 -07:00
define("jqmslider", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.slider", 'css!thirdparty/jquerymobile-1.4.5/jqm.slider.css']);
2015-05-26 08:31:50 -07:00
2016-02-07 22:59:33 -07:00
define("jqmpopup", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.popup", 'css!thirdparty/jquerymobile-1.4.5/jqm.popup.css']);
2015-05-27 22:51:48 -07:00
2016-02-07 22:59:33 -07:00
define("jqmlistview", ['jqmbase', 'css!thirdparty/jquerymobile-1.4.5/jqm.listview.css']);
2015-05-27 22:51:48 -07:00
2016-02-07 22:59:33 -07:00
define("jqmcontrolgroup", ['jqmbase', 'css!thirdparty/jquerymobile-1.4.5/jqm.controlgroup.css']);
2015-06-17 08:39:46 -07:00
2016-02-07 22:59:33 -07:00
define("jqmcollapsible", ['jqmbase', "jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.collapsible", 'css!thirdparty/jquerymobile-1.4.5/jqm.collapsible.css']);
2015-09-24 10:08:10 -07:00
2016-02-07 22:59:33 -07:00
define("jqmcheckbox", ['jqmbase', "jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.checkbox", 'css!thirdparty/jquerymobile-1.4.5/jqm.checkbox.css']);
2014-10-06 16:58:46 -07:00
2016-02-07 22:59:33 -07:00
define("jqmpanel", ['jqmbase', "thirdparty/jquerymobile-1.4.5/jqm.panel", 'css!thirdparty/jquerymobile-1.4.5/jqm.panel.css']);
2015-05-08 20:48:43 -07:00
2016-01-30 23:03:40 -07:00
define("slideshow", [embyWebComponentsBowerPath + "/slideshow/slideshow"], returnFirstDependency);
2015-09-29 09:29:06 -07:00
2015-12-14 08:43:03 -07:00
define('fetch', [bowerPath + '/fetch/fetch']);
2016-08-19 23:27:48 -07:00
2016-08-29 11:42:53 -07:00
define('raf', [embyWebComponentsBowerPath + '/polyfills/raf']);
2016-08-19 23:27:48 -07:00
define('functionbind', [embyWebComponentsBowerPath + '/polyfills/bind']);
define('arraypolyfills', [embyWebComponentsBowerPath + '/polyfills/array']);
define('objectassign', [embyWebComponentsBowerPath + '/polyfills/objectassign']);
2015-12-14 08:43:03 -07:00
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
2016-04-26 11:28:04 -07:00
define("clearButtonStyle", ['css!' + embyWebComponentsBowerPath + '/clearbutton']);
2016-07-15 22:05:40 -07:00
define("userdataButtons", [embyWebComponentsBowerPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency);
2016-05-30 13:46:18 -07:00
define("listView", [embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency);
define("listViewStyle", ['css!' + embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency);
2016-08-06 23:15:03 -07:00
define("formDialogStyle", ['css!' + embyWebComponentsBowerPath + "/formdialog"], returnFirstDependency);
2016-07-15 22:05:40 -07:00
define("indicators", [embyWebComponentsBowerPath + "/indicators/indicators"], returnFirstDependency);
2015-10-01 23:14:04 -07:00
2016-06-19 20:34:47 -07:00
if ('registerElement' in document && 'content' in document.createElement('template')) {
define('webcomponentsjs', []);
} else {
define('webcomponentsjs', [bowerPath + '/webcomponentsjs/webcomponents-lite.min.js']);
}
2015-10-01 23:14:04 -07:00
if (Dashboard.isRunningInCordova()) {
2016-04-26 11:28:04 -07:00
define('registrationservices', ['cordova/registrationservices'], returnFirstDependency);
2015-12-14 08:43:03 -07:00
2015-10-01 23:14:04 -07:00
} else {
2016-04-26 11:28:04 -07:00
define('registrationservices', ['scripts/registrationservices'], returnFirstDependency);
2015-10-01 23:14:04 -07:00
}
2015-12-15 22:30:14 -07:00
if (Dashboard.isRunningInCordova()) {
2016-08-06 19:56:32 -07:00
define("localassetmanager", ["cordova/localassetmanager"], returnFirstDependency);
define("fileupload", ["cordova/fileupload"], returnFirstDependency);
2015-12-15 22:30:14 -07:00
} else {
2016-08-06 19:56:32 -07:00
define("localassetmanager", [apiClientBowerPath + "/localassetmanager"], returnFirstDependency);
define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency);
2015-12-15 22:30:14 -07:00
}
define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]);
define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"]);
define("serversync", [apiClientBowerPath + "/sync/serversync"]);
define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"]);
define("offlineusersync", [apiClientBowerPath + "/sync/offlineusersync"]);
define("mediasync", [apiClientBowerPath + "/sync/mediasync"]);
2016-01-30 12:31:22 -07:00
2016-01-30 23:03:40 -07:00
define("swiper", [bowerPath + "/Swiper/dist/js/swiper.min", "css!" + bowerPath + "/Swiper/dist/css/swiper.min"], returnFirstDependency);
2016-07-07 08:56:49 -07:00
define("scroller", [embyWebComponentsBowerPath + "/scroller/smoothscroller"], returnFirstDependency);
2016-02-16 09:15:36 -07:00
define("toast", [embyWebComponentsBowerPath + "/toast/toast"], returnFirstDependency);
2016-02-29 09:23:30 -07:00
define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency);
2016-01-30 12:31:22 -07:00
2016-02-29 23:02:03 -07:00
define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], updateAppSettings);
define("userSettings", [embyWebComponentsBowerPath + "/usersettings/usersettings"], returnFirstDependency);
define("userSettingsBuilder", [embyWebComponentsBowerPath + "/usersettings/usersettingsbuilder"], returnFirstDependency);
2016-02-29 23:02:03 -07:00
2016-06-09 23:54:03 -07:00
define("material-icons", ['css!' + embyWebComponentsBowerPath + '/fonts/material-icons/style']);
2016-03-12 13:16:42 -07:00
define("robotoFont", ['css!' + embyWebComponentsBowerPath + '/fonts/roboto/style']);
define("opensansFont", ['css!' + embyWebComponentsBowerPath + '/fonts/opensans/style']);
define("montserratFont", ['css!' + embyWebComponentsBowerPath + '/fonts/montserrat/style']);
2016-04-10 21:24:16 -07:00
define("scrollStyles", ['css!' + embyWebComponentsBowerPath + '/scrollstyles']);
2016-03-12 13:16:42 -07:00
2016-06-20 22:35:33 -07:00
define("navdrawer", ['components/navdrawer/navdrawer'], returnFirstDependency);
2016-06-21 08:25:36 -07:00
define("viewcontainer", ['components/viewcontainer-lite', 'css!' + embyWebComponentsBowerPath + '/viewmanager/viewcontainer-lite'], returnFirstDependency);
2016-03-14 19:09:03 -07:00
define('queryString', [bowerPath + '/query-string/index'], function () {
2016-03-14 13:00:18 -07:00
return queryString;
});
2016-03-15 22:33:31 -07:00
define("jQuery", [bowerPath + '/jquery/dist/jquery.slim.min'], function () {
2016-08-20 11:34:30 -07:00
require(['fnchecked']);
2016-03-15 22:33:31 -07:00
if (window.ApiClient) {
jQuery.ajax = ApiClient.ajax;
}
return jQuery;
});
2016-08-20 11:34:30 -07:00
define("fnchecked", ['legacy/fnchecked']);
2016-05-13 11:28:05 -07:00
define("dialogHelper", [embyWebComponentsBowerPath + "/dialoghelper/dialoghelper"], function (dialoghelper) {
dialoghelper.setOnOpen(onDialogOpen);
return dialoghelper;
});
2016-06-10 09:45:04 -07:00
if (!('registerElement' in document)) {
//define("registerElement", ['bower_components/webcomponentsjs/CustomElements.min']);
2016-06-19 20:34:47 -07:00
define("registerElement", ['webcomponentsjs']);
2016-06-10 09:45:04 -07:00
} else {
2016-06-19 20:34:47 -07:00
define("registerElement", []);
2016-06-10 09:45:04 -07:00
}
2016-01-30 12:31:22 -07:00
// alias
define("historyManager", [], function () {
2016-03-15 22:33:31 -07:00
return Emby.Page;
2016-01-30 12:31:22 -07:00
});
2016-01-30 23:03:40 -07:00
2016-08-15 19:40:29 -07:00
define("headroom-window", ['headroom'], createWindowHeadroom);
2016-08-15 21:12:12 -07:00
define("hammer-main", ['hammer'], createMainContentHammer);
2016-08-22 13:47:16 -07:00
define("appfooter-shared", ['appfooter'], createSharedAppFooter);
2016-08-15 19:40:29 -07:00
2016-03-14 19:09:03 -07:00
// mock this for now. not used in this app
2016-06-06 10:33:27 -07:00
define("playbackManager", [], function () {
return {
2016-08-20 23:59:36 -07:00
isPlaying: function () {
return MediaPlayer.currentItem != null;
},
2016-06-06 10:33:27 -07:00
isPlayingVideo: function () {
2016-08-20 23:59:36 -07:00
return MediaPlayer.currentItem != null;
2016-07-16 11:02:39 -07:00
},
play: function (options) {
2016-08-20 23:59:36 -07:00
if (options.fullscreen === false) {
// theme backdrops - not supported
if (!options.items || options.items[0].MediaType == 'Video') {
return;
}
}
2016-07-16 11:02:39 -07:00
MediaController.play(options);
2016-07-16 14:28:15 -07:00
},
currentPlaylistIndex: function (options) {
return MediaController.currentPlaylistIndex(options);
2016-07-16 16:08:21 -07:00
},
2016-07-26 21:54:38 -07:00
canQueueMediaType: function (mediaType) {
2016-07-16 16:08:21 -07:00
return MediaController.canQueueMediaType(mediaType);
2016-07-17 09:59:14 -07:00
},
canPlay: function (item) {
return MediaController.canPlay(item);
2016-07-17 11:55:07 -07:00
},
2016-08-06 19:11:39 -07:00
canQueue: function (item) {
return MediaController.canQueueMediaType(item.MediaType, item.Type);
},
2016-07-17 11:55:07 -07:00
instantMix: function (item) {
return MediaController.instantMix(item);
2016-07-17 13:38:05 -07:00
},
shuffle: function (item) {
return MediaController.shuffle(item);
2016-08-03 10:26:42 -07:00
},
pause: function () {
return MediaController.pause();
2016-08-20 23:59:36 -07:00
},
stop: function () {
return MediaController.stop();
},
seek: function (ticks) {
return MediaController.seek(ticks);
2016-06-06 10:33:27 -07:00
}
};
});
// mock this for now. not used in this app
2016-03-14 19:09:03 -07:00
define("skinManager", [], function () {
2016-03-16 11:09:58 -07:00
2016-03-14 19:09:03 -07:00
return {
2016-03-15 22:33:31 -07:00
loadUserSkin: function () {
2016-03-16 11:09:58 -07:00
2016-03-15 22:33:31 -07:00
Emby.Page.show('/home.html');
}
2016-03-14 19:09:03 -07:00
};
});
2016-04-26 11:28:04 -07:00
// mock this for now. not used in this app
define("playbackManager", [], function () {
return {
};
});
2016-03-14 19:09:03 -07:00
// mock this for now. not used in this app
define("pluginManager", [], function () {
return {
};
});
2016-01-30 23:03:40 -07:00
define("connectionManager", [], function () {
return ConnectionManager;
});
2016-02-05 23:33:34 -07:00
2016-03-01 21:46:10 -07:00
define('apiClientResolver', [], function () {
return function () {
return window.ApiClient;
};
});
2016-04-26 11:28:04 -07:00
define("embyRouter", [embyWebComponentsBowerPath + '/router'], function (embyRouter) {
2016-03-15 22:33:31 -07:00
embyRouter.showLocalLogin = function (apiClient, serverId, manualLogin) {
Dashboard.navigate('login.html?serverid=' + serverId);
};
embyRouter.showSelectServer = function () {
Dashboard.navigate('selectserver.html');
};
embyRouter.showWelcome = function () {
if (Dashboard.isConnectMode()) {
Dashboard.navigate('connectlogin.html?mode=welcome');
} else {
Dashboard.navigate('login.html');
}
};
embyRouter.showSettings = function () {
Dashboard.navigate('mypreferencesmenu.html?userId=' + ApiClient.getCurrentUserId());
};
2016-07-06 12:45:37 -07:00
embyRouter.showGuide = function () {
Dashboard.navigate('livetv.html?tab=1');
};
2016-07-24 11:58:21 -07:00
embyRouter.goHome = function () {
Dashboard.navigate('home.html');
};
embyRouter.showSearch = function () {
Dashboard.navigate('search.html');
};
2016-07-06 12:45:37 -07:00
embyRouter.showLiveTV = function () {
Dashboard.navigate('livetv.html');
};
embyRouter.showRecordedTV = function () {
Dashboard.navigate('livetv.html?tab=3');
};
embyRouter.showFavorites = function () {
2016-08-31 12:17:11 -07:00
Dashboard.navigate('favorites.html');
};
embyRouter.showSettings = function () {
Dashboard.navigate('mypreferencesmenu.html');
2016-07-06 12:45:37 -07:00
};
2016-08-24 20:07:31 -07:00
function showItem(item, serverId, options) {
2016-04-26 11:28:04 -07:00
if (typeof (item) === 'string') {
require(['connectionManager'], function (connectionManager) {
var apiClient = connectionManager.currentApiClient();
2016-08-24 20:07:31 -07:00
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
embyRouter.showItem(item, options);
});
2016-04-26 11:28:04 -07:00
});
} else {
2016-08-24 20:07:31 -07:00
if (arguments.length == 2) {
options = arguments[1];
}
var context = options ? options.context : null;
Emby.Page.show('/' + LibraryBrowser.getHref(item, context), { item: item });
2016-04-26 11:28:04 -07:00
}
2016-06-01 14:15:16 -07:00
}
embyRouter.showItem = showItem;
2016-04-26 11:28:04 -07:00
2016-03-15 22:33:31 -07:00
return embyRouter;
});
2016-02-05 23:33:34 -07:00
}
2016-02-29 23:02:03 -07:00
function updateAppSettings(appSettings) {
appSettings.enableExternalPlayers = function (val) {
if (val != null) {
appSettings.set('externalplayers', val.toString());
}
return appSettings.get('externalplayers') == 'true';
};
return appSettings;
}
2016-05-13 11:28:05 -07:00
function onDialogOpen(dlg) {
if (dlg.classList.contains('formDialog')) {
2016-08-14 21:36:17 -07:00
if (!dlg.classList.contains('background-theme-a')) {
dlg.classList.add('background-theme-b');
dlg.classList.add('ui-body-b');
2016-05-13 11:28:05 -07:00
}
}
2015-12-14 08:43:03 -07:00
}
2015-10-01 23:14:04 -07:00
2016-02-04 13:51:13 -07:00
function initRequireWithBrowser(browser) {
2016-02-05 10:04:38 -07:00
2016-02-04 13:51:13 -07:00
var bowerPath = getBowerPath();
var embyWebComponentsBowerPath = bowerPath + '/emby-webcomponents';
2016-08-22 11:28:24 -07:00
if (Dashboard.isRunningInCordova() && browser.safari) {
define("imageFetcher", ['cordova/ios/imagestore'], returnFirstDependency);
} else {
define("imageFetcher", [embyWebComponentsBowerPath + "/images/basicimagefetcher"], returnFirstDependency);
}
2016-05-25 11:59:46 -07:00
var preferNativeAlerts = browser.mobile || browser.tv || browser.xboxOne;
// use native alerts if preferred and supported (not supported in opera tv)
2016-05-25 12:12:38 -07:00
if (preferNativeAlerts && window.alert) {
2016-04-09 19:27:09 -07:00
define("alert", [embyWebComponentsBowerPath + "/alert/nativealert"], returnFirstDependency);
2016-02-04 13:51:13 -07:00
} else {
2016-02-26 13:29:27 -07:00
define("alert", [embyWebComponentsBowerPath + "/alert/alert"], returnFirstDependency);
2016-02-04 13:51:13 -07:00
}
2016-03-09 10:40:22 -07:00
2016-07-19 23:23:18 -07:00
define("dialog", [embyWebComponentsBowerPath + "/dialog/dialog"], returnFirstDependency);
2016-05-25 12:12:38 -07:00
if (preferNativeAlerts && window.confirm) {
2016-05-25 11:59:46 -07:00
define("confirm", [embyWebComponentsBowerPath + "/confirm/nativeconfirm"], returnFirstDependency);
} else {
define("confirm", [embyWebComponentsBowerPath + "/confirm/confirm"], returnFirstDependency);
}
2016-05-25 12:12:38 -07:00
if (preferNativeAlerts && window.prompt) {
2016-05-25 11:59:46 -07:00
define("prompt", [embyWebComponentsBowerPath + "/prompt/nativeprompt"], returnFirstDependency);
} else {
define("prompt", [embyWebComponentsBowerPath + "/prompt/prompt"], returnFirstDependency);
}
2016-08-03 21:39:19 -07:00
if (browser.tizen || browser.operaTv) {
// Need the older version due to artifacts
define("loading", [embyWebComponentsBowerPath + "/loading/loading-legacy"], returnFirstDependency);
2016-03-09 10:40:22 -07:00
} else {
define("loading", [embyWebComponentsBowerPath + "/loading/loading-lite"], returnFirstDependency);
}
2016-03-28 22:16:44 -07:00
2016-04-18 13:43:57 -07:00
define("multi-download", [embyWebComponentsBowerPath + '/multidownload'], returnFirstDependency);
2016-04-17 22:58:08 -07:00
2016-03-28 22:16:44 -07:00
if (Dashboard.isRunningInCordova() && browser.android) {
2016-03-29 12:08:10 -07:00
define("fileDownloader", ['cordova/android/filedownloader'], returnFirstDependency);
2016-03-28 22:16:44 -07:00
} else {
2016-04-17 22:58:08 -07:00
define("fileDownloader", [embyWebComponentsBowerPath + '/filedownloader'], returnFirstDependency);
2016-03-28 22:16:44 -07:00
}
2016-02-04 13:51:13 -07:00
}
2016-04-18 19:07:31 -07:00
function init() {
2015-05-08 20:48:43 -07:00
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova() && browserInfo.android) {
2015-06-19 21:48:45 -07:00
define("nativedirectorychooser", ["cordova/android/nativedirectorychooser"]);
2015-06-09 21:01:14 -07:00
}
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova() && browserInfo.android) {
2016-04-28 10:21:28 -07:00
2016-01-20 11:11:15 -07:00
if (MainActivity.getChromeVersion() >= 48) {
2016-08-22 11:28:24 -07:00
//define("audiorenderer", ["scripts/htmlmediarenderer"]);
window.VlcAudio = true;
define("audiorenderer", ["cordova/android/vlcplayer"]);
2016-01-20 11:11:15 -07:00
} else {
2016-02-05 09:04:31 -07:00
window.VlcAudio = true;
2016-01-20 11:11:15 -07:00
define("audiorenderer", ["cordova/android/vlcplayer"]);
}
2015-07-05 11:34:52 -07:00
define("videorenderer", ["cordova/android/vlcplayer"]);
2015-06-10 06:37:07 -07:00
}
2015-12-14 08:43:03 -07:00
else if (Dashboard.isRunningInCordova() && browserInfo.safari) {
2016-04-28 10:21:28 -07:00
define("audiorenderer", ["cordova/audioplayer"]);
2015-09-09 20:22:52 -07:00
define("videorenderer", ["scripts/htmlmediarenderer"]);
}
2015-06-10 06:37:07 -07:00
else {
define("audiorenderer", ["scripts/htmlmediarenderer"]);
define("videorenderer", ["scripts/htmlmediarenderer"]);
}
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova() && browserInfo.android) {
2016-08-20 00:29:06 -07:00
define("localsync", ["cordova/android/localsync"], returnFirstDependency);
2015-08-12 14:39:02 -07:00
}
else {
2016-08-20 00:29:06 -07:00
define("localsync", ["scripts/localsync"], returnFirstDependency);
2015-08-12 14:39:02 -07:00
}
2016-04-18 11:01:50 -07:00
define("livetvcss", ['css!css/livetv.css']);
define("detailtablecss", ['css!css/detailtable.css']);
define("autoorganizetablecss", ['css!css/autoorganizetable.css']);
2015-06-19 09:36:51 -07:00
2015-12-14 08:43:03 -07:00
define("buttonenabled", ["legacy/buttonenabled"]);
2015-10-13 12:22:45 -07:00
var deps = [];
2015-09-09 10:49:44 -07:00
2015-12-14 08:43:03 -07:00
deps.push('scripts/mediacontroller');
2016-07-26 21:54:38 -07:00
require(deps, function () {
2015-09-09 10:49:44 -07:00
2015-12-14 08:43:03 -07:00
initAfterDependencies();
2015-09-09 10:49:44 -07:00
});
}
2015-12-14 08:43:03 -07:00
function getRequirePromise(deps) {
return new Promise(function (resolve, reject) {
require(deps, resolve);
});
}
function initAfterDependencies() {
2015-05-19 12:15:40 -07:00
2016-08-21 10:38:10 -07:00
var list = [];
2015-06-08 14:32:20 -07:00
2016-03-06 11:09:20 -07:00
if (!window.fetch) {
2016-08-21 10:38:10 -07:00
list.push('fetch');
2016-03-06 11:09:20 -07:00
}
2016-03-16 13:38:01 -07:00
if (typeof Object.assign != 'function') {
2016-08-19 23:27:48 -07:00
list.push('objectassign');
}
if (!Array.prototype.filter) {
list.push('arraypolyfills');
}
if (!Function.prototype.bind) {
list.push('functionbind');
2016-03-16 13:38:01 -07:00
}
2016-08-29 11:42:53 -07:00
if (!window.requestAnimationFrame) {
list.push('raf');
}
2016-08-21 10:38:10 -07:00
require(list, function () {
2015-12-23 10:46:01 -07:00
2016-04-18 11:50:29 -07:00
createConnectionManager().then(function () {
2015-12-14 08:43:03 -07:00
2016-01-19 20:02:45 -07:00
console.log('initAfterDependencies promises resolved');
2015-12-14 08:43:03 -07:00
MediaController.init();
2016-03-05 11:51:19 -07:00
require(['globalize'], function (globalize) {
2015-07-27 12:16:30 -07:00
2016-03-05 11:51:19 -07:00
window.Globalize = globalize;
2015-07-27 19:05:06 -07:00
2016-05-12 12:21:43 -07:00
Promise.all([loadCoreDictionary(globalize), loadSharedComponentsDictionary(globalize)]).then(onGlobalizeInit);
2016-03-05 11:51:19 -07:00
});
});
});
}
2015-09-01 19:56:19 -07:00
2016-05-12 12:21:43 -07:00
function loadSharedComponentsDictionary(globalize) {
var baseUrl = 'bower_components/emby-webcomponents/strings/';
2016-07-27 10:11:05 -07:00
var languages = ['ar', 'bg-BG', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'en-US', 'es-AR', 'es-MX', 'es', 'fi', 'fr', 'gsw', 'he', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl-SI', 'sv', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW'];
2016-05-12 12:21:43 -07:00
var translations = languages.map(function (i) {
return {
lang: i,
path: baseUrl + i + '.json'
};
});
globalize.loadStrings({
name: 'sharedcomponents',
translations: translations
});
}
2016-03-05 11:51:19 -07:00
function loadCoreDictionary(globalize) {
2015-07-27 19:05:06 -07:00
2016-03-05 11:51:19 -07:00
var baseUrl = 'strings/';
2015-08-31 21:15:10 -07:00
2016-04-08 21:16:53 -07:00
var languages = ['ar', 'bg-BG', 'ca', 'cs', 'da', 'de', 'el', 'en-GB', 'en-US', 'es-AR', 'es-MX', 'es', 'fi', 'fr', 'gsw', 'he', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'ms', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sl-SI', 'sv', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW'];
2015-08-31 21:15:10 -07:00
2016-03-05 11:51:19 -07:00
var translations = languages.map(function (i) {
return {
lang: i,
path: baseUrl + i + '.json'
};
});
2015-08-31 21:15:10 -07:00
2016-03-05 11:51:19 -07:00
globalize.defaultModule('core');
2015-08-31 21:15:10 -07:00
2016-03-05 11:51:19 -07:00
return globalize.loadStrings({
name: 'core',
translations: translations
});
}
2015-08-31 21:15:10 -07:00
2016-03-05 11:51:19 -07:00
function onGlobalizeInit() {
2016-03-15 22:33:31 -07:00
2016-03-05 12:07:58 -07:00
document.title = Globalize.translateDocument(document.title, 'core');
2015-09-01 19:56:19 -07:00
2016-03-15 22:33:31 -07:00
onAppReady();
}
2016-02-14 13:34:54 -07:00
2016-03-15 22:33:31 -07:00
function defineRoute(newRoute, dictionary) {
2015-07-27 12:16:30 -07:00
2016-03-15 22:33:31 -07:00
var baseRoute = Emby.Page.baseUrl();
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
var path = newRoute.path;
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
path = path.replace(baseRoute, '');
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
console.log('Defining route: ' + path);
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
newRoute.dictionary = newRoute.dictionary || dictionary || 'core';
Emby.Page.addRoute(path, newRoute);
}
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
function defineCoreRoutes() {
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
console.log('Defining core routes');
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/about.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-08-22 11:28:24 -07:00
controller: 'dashboard/aboutpage',
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/addplugin.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/appservices.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
2016-03-05 11:51:19 -07:00
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/autoorganizelog.html',
dependencies: ['scripts/taskbutton', 'autoorganizetablecss'],
2016-08-22 11:28:24 -07:00
controller: 'dashboard/autoorganizelog',
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/autoorganizesmart.html',
dependencies: ['emby-button'],
2016-08-22 11:28:24 -07:00
controller: 'dashboard/autoorganizesmart',
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/autoorganizetv.html',
dependencies: ['emby-checkbox', 'emby-input', 'emby-button', 'emby-select', 'emby-collapse'],
2016-08-22 11:28:24 -07:00
controller: 'dashboard/autoorganizetv',
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/channelitems.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-16 11:20:08 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/channels.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-16 11:20:08 -07:00
autoFocus: false,
2016-08-15 19:40:29 -07:00
transition: 'fade',
controller: 'scripts/channels'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/channelsettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/cinemamodeconfiguration.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/connectlogin.html',
2016-06-18 10:26:42 -07:00
dependencies: ['emby-button', 'emby-input'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-06-18 10:26:42 -07:00
anonymous: true,
2016-08-24 13:14:35 -07:00
startup: true,
2016-06-18 10:26:42 -07:00
controller: 'scripts/connectlogin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dashboard.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dashboardgeneral.html',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/dashboardgeneral',
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dashboardhosting.html',
dependencies: ['paper-checkbox', 'emby-input', 'emby-button'],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-18 14:46:56 -07:00
roles: 'admin',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/dashboardhosting'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/device.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/devices.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/devicesupload.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dlnaprofile.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dlnaprofiles.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dlnaserversettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/dlnasettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/edititemmetadata.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-15 22:33:31 -07:00
autoFocus: false
});
defineRoute({
path: '/encodingsettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/favorites.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-30 23:33:37 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
controller: 'scripts/favorites'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/forgotpassword.html',
2016-06-17 17:52:04 -07:00
dependencies: ['emby-input', 'emby-button'],
anonymous: true,
2016-08-24 13:14:35 -07:00
startup: true,
2016-06-17 17:52:04 -07:00
controller: 'scripts/forgotpassword'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/forgotpasswordpin.html',
2016-06-17 17:52:04 -07:00
dependencies: ['emby-input', 'emby-button'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-06-17 17:52:04 -07:00
anonymous: true,
2016-08-24 13:14:35 -07:00
startup: true,
2016-06-17 17:52:04 -07:00
controller: 'scripts/forgotpasswordpin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/gamegenres.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/games.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/gamesrecommended.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/gamestudios.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/gamesystems.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/home.html',
2016-05-15 09:30:32 -07:00
dependencies: [],
2016-03-16 13:38:01 -07:00
autoFocus: false,
2016-05-16 11:20:08 -07:00
controller: 'scripts/indexpage',
transition: 'fade',
type: 'home'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/index.html',
2016-03-16 13:38:01 -07:00
dependencies: [],
2016-03-15 22:33:31 -07:00
autoFocus: false,
isDefaultRoute: true
});
defineRoute({
path: '/itemdetails.html',
2016-07-30 23:21:49 -07:00
dependencies: ['emby-button', 'scripts/livetvcomponents', 'paper-icon-button-light', 'emby-itemscontainer'],
2016-05-19 10:27:39 -07:00
controller: 'scripts/itemdetailpage',
2016-05-16 11:20:08 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/itemlist.html',
2016-06-11 08:56:15 -07:00
dependencies: [],
2016-03-18 12:43:17 -07:00
autoFocus: false,
2016-05-16 11:20:08 -07:00
controller: 'scripts/itemlistpage',
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/kids.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-15 22:33:31 -07:00
autoFocus: false
});
defineRoute({
path: '/library.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
2016-06-03 22:51:33 -07:00
defineRoute({
path: '/librarydisplay.html',
2016-08-27 12:14:04 -07:00
dependencies: [],
2016-06-03 22:51:33 -07:00
autoFocus: false,
roles: 'admin',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/librarydisplay'
2016-06-03 22:51:33 -07:00
});
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/librarypathmapping.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/librarysettings.html',
2016-08-21 11:40:38 -07:00
dependencies: ['emby-collapse', 'emby-input', 'paper-checkbox', 'emby-button', 'emby-select'],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-06-04 10:14:03 -07:00
roles: 'admin',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/librarysettings'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetv.html',
2016-06-04 20:50:07 -07:00
dependencies: ['emby-button', 'livetvcss'],
2016-05-15 10:11:26 -07:00
controller: 'scripts/livetvsuggested',
2016-05-16 11:20:08 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvguideprovider.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvitems.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvrecordinglist.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvseriestimer.html',
2016-08-11 15:41:25 -07:00
dependencies: ['emby-checkbox', 'emby-input', 'emby-button', 'emby-collapse', 'scripts/livetvcomponents', 'scripts/livetvseriestimer', 'livetvcss'],
autoFocus: false,
controller: 'scripts/livetvseriestimer'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvsettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvstatus.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvtunerprovider-hdhomerun.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvtunerprovider-m3u.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/livetvtunerprovider-satip.html',
2016-08-21 10:38:10 -07:00
dependencies: ['emby-input', 'paper-checkbox'],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-03-17 11:19:39 -07:00
roles: 'admin',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/livetvtunerprovider-satip'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/log.html',
2016-07-22 12:48:47 -07:00
dependencies: ['emby-checkbox'],
2016-03-27 20:37:33 -07:00
roles: 'admin',
2016-08-22 11:28:24 -07:00
controller: 'dashboard/logpage'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/login.html',
2016-06-04 20:50:07 -07:00
dependencies: ['emby-button', 'humanedate', 'emby-input'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-17 10:44:17 -07:00
anonymous: true,
2016-08-24 13:14:35 -07:00
startup: true,
2016-05-20 09:49:21 -07:00
controller: 'scripts/loginpage'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/metadata.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/metadataadvanced.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/metadataimages.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/metadatanfo.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/metadatasubtitles.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/movies.html',
2016-06-11 08:56:15 -07:00
dependencies: ['emby-button'],
2016-04-03 11:47:49 -07:00
autoFocus: false,
2016-05-16 11:20:08 -07:00
controller: 'scripts/moviesrecommended',
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/music.html',
2016-06-06 22:42:26 -07:00
dependencies: [],
2016-05-15 11:52:36 -07:00
controller: 'scripts/musicrecommended',
2016-05-16 11:20:08 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mypreferencesdisplay.html',
2016-06-19 09:53:53 -07:00
dependencies: ['emby-checkbox', 'emby-button', 'emby-select'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-19 09:53:53 -07:00
transition: 'fade',
controller: 'scripts/mypreferencesdisplay'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mypreferenceshome.html',
2016-06-25 18:33:16 -07:00
dependencies: ['emby-checkbox', 'emby-button'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-20 17:47:37 -07:00
transition: 'fade',
controller: 'scripts/mypreferenceshome'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mypreferenceslanguages.html',
2016-06-19 09:53:53 -07:00
dependencies: ['emby-button', 'emby-checkbox'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-19 09:53:53 -07:00
transition: 'fade',
controller: 'scripts/mypreferenceslanguages'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mypreferencesmenu.html',
2016-06-04 20:50:07 -07:00
dependencies: ['emby-button'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-08-22 13:47:16 -07:00
transition: 'fade',
controller: 'scripts/mypreferencescommon'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/myprofile.html',
2016-07-02 11:05:40 -07:00
dependencies: ['emby-button', 'emby-collapse', 'emby-checkbox', 'emby-input'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-21 21:39:47 -07:00
transition: 'fade',
controller: 'scripts/myprofile'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mysync.html',
2016-08-16 22:46:15 -07:00
dependencies: [],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-19 09:53:53 -07:00
transition: 'fade',
controller: 'scripts/mysync'
2016-03-15 22:33:31 -07:00
});
2016-08-22 11:28:24 -07:00
defineRoute({
path: '/camerauploadsettings.html',
dependencies: [],
autoFocus: false,
transition: 'fade',
controller: 'scripts/camerauploadsettings'
});
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/mysyncjob.html',
2016-07-02 19:47:39 -07:00
dependencies: [],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-11 10:10:06 -07:00
transition: 'fade',
controller: 'scripts/syncjob'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/mysyncsettings.html',
2016-06-19 09:53:53 -07:00
dependencies: ['emby-checkbox', 'emby-input', 'emby-button', 'paper-icon-button-light'],
2016-05-16 13:48:56 -07:00
autoFocus: false,
2016-06-19 09:53:53 -07:00
transition: 'fade',
controller: 'scripts/mysyncsettings'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/notificationlist.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/notificationsetting.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/notificationsettings.html',
2016-04-12 22:28:45 -07:00
controller: 'scripts/notificationsettings',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/nowplaying.html',
2016-07-16 11:02:39 -07:00
dependencies: ['paper-icon-button-light', 'emby-slider', 'emby-button', 'emby-input', 'emby-itemscontainer'],
2016-05-11 07:36:28 -07:00
controller: 'scripts/nowplayingpage',
2016-05-16 13:48:56 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/photos.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-16 11:20:08 -07:00
autoFocus: false,
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/playbackconfiguration.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/playlists.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-16 11:20:08 -07:00
autoFocus: false,
2016-07-30 10:43:55 -07:00
transition: 'fade',
controller: 'scripts/playlists'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/plugincatalog.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/plugins.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/reports.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/scheduledtask.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/scheduledtasks.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/search.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-06-27 15:53:42 -07:00
controller: 'scripts/searchpage'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/secondaryitems.html',
2016-03-18 12:43:17 -07:00
dependencies: [],
autoFocus: false,
2016-05-20 09:49:21 -07:00
controller: 'scripts/secondaryitems'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/selectserver.html',
2016-06-25 18:33:16 -07:00
dependencies: ['listViewStyle', 'emby-button'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-06-18 10:26:42 -07:00
anonymous: true,
2016-08-24 13:14:35 -07:00
startup: true,
2016-06-18 10:26:42 -07:00
controller: 'scripts/selectserver'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/serversecurity.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/shared.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/streamingsettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/support.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/supporterkey.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/syncactivity.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-08-16 22:46:15 -07:00
autoFocus: false,
controller: 'scripts/syncactivity'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/syncjob.html',
2016-07-02 19:47:39 -07:00
dependencies: [],
2016-06-11 10:10:06 -07:00
autoFocus: false,
transition: 'fade',
controller: 'scripts/syncjob'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/syncsettings.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-05-20 09:49:21 -07:00
autoFocus: false
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/tv.html',
2016-06-11 08:56:15 -07:00
dependencies: ['paper-icon-button-light', 'emby-button'],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-16 11:20:08 -07:00
controller: 'scripts/tvrecommended',
transition: 'fade'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/useredit.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/userlibraryaccess.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/usernew.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/userparentalcontrol.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/userpassword.html',
2016-06-21 21:39:47 -07:00
dependencies: ['emby-input', 'emby-button', 'emby-checkbox'],
autoFocus: false,
controller: 'scripts/userpasswordpage'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/userprofiles.html',
2016-03-19 08:38:05 -07:00
dependencies: [],
2016-03-16 22:04:32 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardagreement.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
2016-06-23 10:04:18 -07:00
defineRoute({
path: '/wizardcomponents.html',
2016-06-29 09:31:01 -07:00
dependencies: ['dashboardcss', 'emby-button', 'emby-input', 'emby-select'],
2016-06-23 10:04:18 -07:00
autoFocus: false,
anonymous: true,
2016-08-22 11:28:24 -07:00
controller: 'dashboard/wizardcomponents'
2016-06-23 10:04:18 -07:00
});
2016-03-15 22:33:31 -07:00
defineRoute({
path: '/wizardfinish.html',
2016-06-04 20:50:07 -07:00
dependencies: ['emby-button', 'dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 12:45:04 -07:00
anonymous: true,
2016-08-22 11:28:24 -07:00
controller: 'dashboard/wizardfinishpage'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardlibrary.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardlivetvguide.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardlivetvtuner.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardservice.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardsettings.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizardstart.html',
2016-06-01 21:41:12 -07:00
dependencies: ['dashboardcss'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/wizarduser.html',
2016-06-02 09:54:53 -07:00
dependencies: ['dashboardcss', 'emby-input'],
2016-03-15 22:33:31 -07:00
autoFocus: false,
2016-05-20 09:49:21 -07:00
anonymous: true
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/configurationpage',
dependencies: ['jQuery'],
autoFocus: false,
enableCache: false,
2016-03-16 22:04:32 -07:00
enableContentQueryString: true,
roles: 'admin'
2016-03-15 22:33:31 -07:00
});
defineRoute({
path: '/',
isDefaultRoute: true,
autoFocus: false,
dependencies: []
});
2015-05-19 12:15:40 -07:00
}
2015-12-14 08:43:03 -07:00
function onAppReady() {
2015-09-10 11:28:22 -07:00
2016-03-15 22:33:31 -07:00
require(['scripts/mediaplayer'], function () {
MediaPlayer.init();
});
2016-01-19 20:02:45 -07:00
console.log('Begin onAppReady');
2015-09-23 09:16:06 -07:00
var deps = [];
2016-01-20 18:05:14 -07:00
deps.push('imageLoader');
2016-04-26 11:28:04 -07:00
deps.push('embyRouter');
2016-01-20 18:05:14 -07:00
2015-12-14 08:43:03 -07:00
if (!(AppInfo.isNativeApp && browserInfo.android)) {
document.documentElement.classList.add('minimumSizeTabs');
}
// Do these now to prevent a flash of content
if (AppInfo.isNativeApp && browserInfo.android) {
deps.push('css!devices/android/android.css');
} else if (AppInfo.isNativeApp && browserInfo.safari) {
deps.push('css!devices/ios/ios.css');
}
2015-10-05 19:50:20 -07:00
2015-12-14 08:43:03 -07:00
loadTheme();
if (Dashboard.isRunningInCordova()) {
deps.push('registrationservices');
if (browserInfo.android) {
deps.push('cordova/android/androidcredentials');
}
2015-09-21 18:05:33 -07:00
}
2015-12-14 08:43:03 -07:00
deps.push('scripts/librarymenu');
2016-04-18 13:43:57 -07:00
console.log('onAppReady - loading dependencies');
2016-07-21 14:23:34 -07:00
require(deps, function (imageLoader, pageObjects) {
2016-01-20 18:05:14 -07:00
2016-04-02 09:31:09 -07:00
console.log('Loaded dependencies in onAppReady');
2016-01-20 18:05:14 -07:00
window.ImageLoader = imageLoader;
2015-09-23 09:16:06 -07:00
2016-03-15 22:33:31 -07:00
window.Emby = {};
window.Emby.Page = pageObjects;
window.Emby.TransparencyLevel = pageObjects.TransparencyLevel;
defineCoreRoutes();
Emby.Page.start({
2016-03-15 23:07:11 -07:00
click: true,
2016-03-16 11:09:58 -07:00
hashbang: AppInfo.enableHashBang
2016-03-15 22:33:31 -07:00
});
2015-12-14 08:43:03 -07:00
var postInitDependencies = [];
2016-08-20 23:59:36 -07:00
postInitDependencies.push('bower_components/emby-webcomponents/thememediaplayer');
2015-12-14 08:43:03 -07:00
postInitDependencies.push('scripts/remotecontrol');
postInitDependencies.push('css!css/chromecast.css');
2016-03-12 00:28:13 -07:00
postInitDependencies.push('scripts/autobackdrops');
2015-12-14 08:43:03 -07:00
if (Dashboard.isRunningInCordova()) {
if (browserInfo.android) {
postInitDependencies.push('cordova/android/mediasession');
2016-01-08 21:28:09 -07:00
postInitDependencies.push('cordova/android/chromecast');
2015-12-14 08:43:03 -07:00
} else {
postInitDependencies.push('cordova/volume');
}
if (browserInfo.safari) {
2016-04-01 21:16:18 -07:00
postInitDependencies.push('cordova/ios/chromecast');
2015-12-14 08:43:03 -07:00
postInitDependencies.push('cordova/ios/orientation');
2016-04-28 10:21:28 -07:00
postInitDependencies.push('cordova/ios/remotecontrols');
2015-12-14 08:43:03 -07:00
2016-08-22 13:47:16 -07:00
//postInitDependencies.push('cordova/ios/backgroundfetch');
2015-12-14 08:43:03 -07:00
}
} else if (browserInfo.chrome) {
postInitDependencies.push('scripts/chromecast');
}
2016-07-26 10:21:27 -07:00
postInitDependencies.push('scripts/nowplayingbar');
2015-12-14 08:43:03 -07:00
2015-12-25 21:08:25 -07:00
postInitDependencies.push('components/remotecontrolautoplay');
// Prefer custom font over Segoe if on desktop windows
2016-03-12 13:16:42 -07:00
if (!browserInfo.mobile && navigator.userAgent.toLowerCase().indexOf('windows') != -1) {
//postInitDependencies.push('opensansFont');
postInitDependencies.push('robotoFont');
2016-03-12 13:16:42 -07:00
}
2016-07-22 10:30:39 -07:00
postInitDependencies.push('bower_components/emby-webcomponents/input/api');
2016-08-21 10:38:10 -07:00
if (!browserInfo.tv) {
2016-07-27 22:55:47 -07:00
2016-08-22 11:28:24 -07:00
registerServiceWorker();
2016-08-01 09:26:42 -07:00
if (window.Notification) {
2016-07-31 22:09:09 -07:00
postInitDependencies.push('bower_components/emby-webcomponents/notifications/notifications');
}
2016-07-22 10:30:39 -07:00
}
2015-12-14 08:43:03 -07:00
require(postInitDependencies);
2016-06-14 13:59:30 -07:00
upgradeLayouts();
2016-08-19 15:56:32 -07:00
initAutoSync();
2015-09-23 09:16:06 -07:00
});
2015-08-31 21:15:10 -07:00
}
2016-08-22 11:28:24 -07:00
function registerServiceWorker() {
if (navigator.serviceWorker) {
try {
navigator.serviceWorker.register('serviceworker.js').then(function () {
return navigator.serviceWorker.ready;
}).then(function (reg) {
2016-08-29 11:58:54 -07:00
if (reg.sync) {
// https://github.com/WICG/BackgroundSync/blob/master/explainer.md
return reg.sync.register('emby-sync').then(function () {
window.SyncRegistered = Dashboard.isConnectMode();
});
2016-08-29 00:12:24 -07:00
}
2016-08-22 11:28:24 -07:00
});
} catch (err) {
console.log('Error registering serviceWorker: ' + err);
}
}
}
2016-06-14 13:59:30 -07:00
function upgradeLayouts() {
2016-07-17 11:55:07 -07:00
if (!AppInfo.enableAppLayouts) {
2016-06-14 13:59:30 -07:00
Dashboard.getPluginSecurityInfo().then(function (info) {
if (info.IsMBSupporter) {
AppInfo.enableAppLayouts = true;
}
});
}
}
2016-08-19 15:56:32 -07:00
function initAutoSync() {
require(['serverNotifications', 'events'], function (serverNotifications, events) {
events.on(serverNotifications, 'SyncJobItemReady', function (e, apiClient, data) {
require(['localsync'], function (localSync) {
localSync.sync({});
});
});
});
}
2015-12-14 08:43:03 -07:00
initRequire();
2015-12-30 10:02:11 -07:00
function onWebComponentsReady() {
2015-12-14 08:43:03 -07:00
2015-12-30 10:02:11 -07:00
var initialDependencies = [];
2015-12-14 08:43:03 -07:00
2015-12-30 10:02:11 -07:00
initialDependencies.push('browser');
2015-12-14 08:43:03 -07:00
2015-12-30 10:02:11 -07:00
if (!window.Promise) {
initialDependencies.push('native-promise-only');
}
2015-12-14 08:43:03 -07:00
2016-03-07 12:13:58 -07:00
require(initialDependencies, function (browser) {
2015-12-14 08:43:03 -07:00
2016-02-04 13:51:13 -07:00
initRequireWithBrowser(browser);
2015-12-30 10:02:11 -07:00
window.browserInfo = browser;
2016-01-28 13:45:52 -07:00
2015-12-30 10:02:11 -07:00
setAppInfo();
2016-03-12 13:16:42 -07:00
setDocumentClasses(browser);
2015-12-14 08:43:03 -07:00
2016-04-18 11:50:29 -07:00
init();
2015-12-30 10:02:11 -07:00
});
}
2015-12-14 08:43:03 -07:00
2016-06-19 20:34:47 -07:00
onWebComponentsReady();
2015-04-30 20:00:29 -07:00
})();
2015-09-06 12:09:36 -07:00
function pageClassOn(eventName, className, fn) {
2015-12-14 08:43:03 -07:00
document.addEventListener(eventName, function (e) {
2015-09-06 12:09:36 -07:00
var target = e.target;
if (target.classList.contains(className)) {
fn.call(target, e);
}
});
}
function pageIdOn(eventName, id, fn) {
2015-12-14 08:43:03 -07:00
document.addEventListener(eventName, function (e) {
2015-09-06 12:09:36 -07:00
var target = e.target;
if (target.id == id) {
fn.call(target, e);
}
});
}
2016-03-15 22:33:31 -07:00
pageClassOn('viewinit', "page", function () {
2015-01-17 22:45:10 -07:00
2015-12-14 08:43:03 -07:00
var page = this;
2015-01-17 22:45:10 -07:00
2015-12-14 08:43:03 -07:00
var current = page.getAttribute('data-theme');
2015-09-04 13:32:20 -07:00
2015-05-13 20:24:25 -07:00
if (!current) {
2015-01-18 21:29:57 -07:00
2015-05-13 20:24:25 -07:00
var newTheme;
2015-01-17 22:45:10 -07:00
2015-12-14 08:43:03 -07:00
if (page.classList.contains('libraryPage')) {
2015-05-13 20:24:25 -07:00
newTheme = 'b';
} else {
newTheme = 'a';
}
2015-01-17 22:45:10 -07:00
2015-12-14 08:43:03 -07:00
page.setAttribute("data-theme", newTheme);
2016-03-15 22:33:31 -07:00
current = newTheme;
2015-05-13 20:24:25 -07:00
}
2016-03-15 22:33:31 -07:00
page.classList.add("ui-page");
page.classList.add("ui-page-theme-" + current);
2016-05-16 11:20:08 -07:00
page.classList.add("ui-body-" + current);
2016-03-15 22:33:31 -07:00
var contents = page.querySelectorAll("div[data-role='content']");
for (var i = 0, length = contents.length; i < length; i++) {
var content = contents[i];
//var theme = content.getAttribute("theme") || undefined;
//content.classList.add("ui-content");
//if (self.options.contentTheme) {
// content.classList.add("ui-body-" + (self.options.contentTheme));
//}
// Add ARIA role
content.setAttribute("role", "main");
content.classList.add("ui-content");
}
2015-09-06 12:09:36 -07:00
});
2016-03-15 22:33:31 -07:00
pageClassOn('viewshow', "page", function () {
2015-09-04 13:32:20 -07:00
var page = this;
var currentTheme = page.classList.contains('ui-page-theme-a') ? 'a' : 'b';
2015-09-04 09:20:54 -07:00
var docElem = document.documentElement;
2015-09-04 13:32:20 -07:00
if (currentTheme == 'a') {
2015-09-04 09:20:54 -07:00
docElem.classList.add('background-theme-a');
docElem.classList.remove('background-theme-b');
} else {
docElem.classList.add('background-theme-b');
docElem.classList.remove('background-theme-a');
}
2015-05-25 10:32:22 -07:00
Dashboard.ensureHeader(page);
2016-08-13 21:30:59 -07:00
});