2013-04-10 14:14:25 -07:00
|
|
|
|
(function ($, document, LibraryBrowser, window) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var currentItem;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
|
function getPromise() {
|
2013-03-06 16:28:43 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
|
if (id) {
|
|
|
|
|
return ApiClient.getItem(Dashboard.getCurrentUserId(), id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var name = getParameterByName('genre');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = getParameterByName('musicgenre');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = getParameterByName('gamegenre');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = getParameterByName('musicartist');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getArtist(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw new Error('Invalid request');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
|
getPromise().done(function (item) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
reloadFromItem(page, item);
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-29 12:34:20 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
function reloadFromItem(page, item) {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
currentItem = item;
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
var context = getContext(item);
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
renderHeader(page, item, context);
|
2013-11-28 11:27:29 -07:00
|
|
|
|
|
2014-07-05 09:51:39 -07:00
|
|
|
|
LibraryBrowser.renderName(item, $('.itemName', page), false, context);
|
2014-09-29 21:47:30 -07:00
|
|
|
|
LibraryBrowser.renderParentName(item, $('.parentName', page), context);
|
2015-08-17 09:52:56 -07:00
|
|
|
|
LibraryMenu.setTitle(item.SeriesName || item.Name);
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2014-06-25 08:12:39 -07:00
|
|
|
|
renderImage(page, item, user);
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
setInitialCollapsibleState(page, item, context, user);
|
|
|
|
|
renderDetails(page, item, context);
|
2015-07-06 07:20:23 -07:00
|
|
|
|
|
2015-08-24 11:22:44 -07:00
|
|
|
|
var hasBackdrop = LibraryBrowser.renderDetailPageBackdrop(page, item);
|
|
|
|
|
//$('#itemBackdrop', page).addClass('noBackdrop').css('background-image', 'none');
|
|
|
|
|
//Backdrops.setBackdrops(page, [item]);
|
|
|
|
|
// For these types, make the backdrop a little smaller so that the items are more quickly accessible
|
|
|
|
|
if (item.Type == "Season" || item.Type == "MusicArtist" || item.Type == "MusicAlbum" || item.Type == "Series" || item.Type == "Playlist" || item.Type == "BoxSet") {
|
|
|
|
|
page.querySelector('#itemBackdrop').classList.add('smallBackdrop');
|
2015-07-06 07:20:23 -07:00
|
|
|
|
} else {
|
2015-08-24 11:22:44 -07:00
|
|
|
|
page.querySelector('#itemBackdrop').classList.remove('smallBackdrop');
|
2015-07-06 07:20:23 -07:00
|
|
|
|
}
|
2014-01-22 19:19:04 -07:00
|
|
|
|
|
2015-08-18 10:54:29 -07:00
|
|
|
|
var transparentHeader = hasBackdrop && page.classList.contains('noSecondaryNavPage');
|
|
|
|
|
|
|
|
|
|
LibraryMenu.setTransparentMenu(transparentHeader);
|
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
var canPlay = false;
|
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
if (item.Type == 'Program') {
|
|
|
|
|
|
|
|
|
|
var now = new Date();
|
|
|
|
|
|
|
|
|
|
if (now >= parseISO8601Date(item.StartDate, { toLocal: true }) && now < parseISO8601Date(item.EndDate, { toLocal: true })) {
|
|
|
|
|
$('.btnPlay', page).removeClass('hide');
|
2015-08-17 21:22:45 -07:00
|
|
|
|
canPlay = true;
|
2015-07-28 20:42:03 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('.btnPlay', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (MediaController.canPlay(item)) {
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.btnPlay', page).removeClass('hide');
|
2015-08-17 21:22:45 -07:00
|
|
|
|
canPlay = true;
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('.btnPlay', page).addClass('hide');
|
|
|
|
|
}
|
2014-04-13 10:27:13 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
if (item.LocalTrailerCount && item.PlayAccess == 'Full') {
|
|
|
|
|
$('.btnPlayTrailer', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnPlayTrailer', page).addClass('hide');
|
|
|
|
|
}
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2014-07-19 21:46:29 -07:00
|
|
|
|
if (SyncManager.isAvailable(item, user)) {
|
|
|
|
|
$('.btnSync', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnSync', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 22:08:05 -07:00
|
|
|
|
if (LibraryBrowser.canShare(item, user)) {
|
2015-06-30 16:59:45 -07:00
|
|
|
|
$('.btnShare', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnShare', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
if (item.Type == 'Program' && item.TimerId) {
|
|
|
|
|
$('.btnCancelRecording', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnCancelRecording', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) {
|
2015-08-17 21:22:45 -07:00
|
|
|
|
|
|
|
|
|
if (canPlay) {
|
|
|
|
|
$('.btnRecord', page).removeClass('hide');
|
|
|
|
|
$('.btnFloatingRecord', page).addClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnRecord', page).addClass('hide');
|
|
|
|
|
$('.btnFloatingRecord', page).removeClass('hide');
|
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('.btnRecord', page).addClass('hide');
|
2015-08-17 21:22:45 -07:00
|
|
|
|
$('.btnFloatingRecord', page).addClass('hide');
|
2015-07-28 20:42:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
if (!item.LocalTrailerCount && item.RemoteTrailers.length && item.PlayAccess == 'Full') {
|
2014-06-02 19:01:30 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.btnPlayExternalTrailer', page).removeClass('hide').attr('href', item.RemoteTrailers[0].Url);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
} else {
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.btnPlayExternalTrailer', page).addClass('hide').attr('href', '#');
|
2013-10-17 13:59:46 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
|
|
|
|
var groupedVersions = (item.MediaSources || []).filter(function (g) {
|
|
|
|
|
return g.Type == "Grouping";
|
|
|
|
|
});
|
|
|
|
|
|
2014-12-19 23:06:27 -07:00
|
|
|
|
if (user.Policy.IsAdministrator && groupedVersions.length) {
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.splitVersionContainer', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.splitVersionContainer', page).hide();
|
2013-07-29 08:05:09 -07:00
|
|
|
|
}
|
2014-08-07 21:36:51 -07:00
|
|
|
|
|
2015-06-18 11:29:44 -07:00
|
|
|
|
$('.btnMoreCommands', page).visible(LibraryBrowser.getMoreCommands(item, user).length > 0);
|
2015-03-24 18:14:24 -07:00
|
|
|
|
|
|
|
|
|
if (user.Policy.IsAdministrator) {
|
|
|
|
|
$('.chapterSettingsButton', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.chapterSettingsButton', page).hide();
|
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
|
|
|
|
LiveTvHelpers.renderOriginalAirDate($('.airDate', page), item);
|
2015-08-21 08:34:42 -07:00
|
|
|
|
|
|
|
|
|
if (item.Type == "Person" && item.PremiereDate) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var birthday = parseISO8601Date(item.PremiereDate, { toLocal: true }).toDateString();
|
|
|
|
|
|
|
|
|
|
$('#itemBirthday', page).show().html(Globalize.translate('BirthDateValue').replace('{0}', birthday));
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Person" && item.EndDate) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var deathday = parseISO8601Date(item.EndDate, { toLocal: true }).toDateString();
|
|
|
|
|
|
|
|
|
|
$('#itemDeathDate', page).show().html(Globalize.translate('DeathDateValue').replace('{0}', deathday));
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Person" && item.ProductionLocations && item.ProductionLocations.length) {
|
|
|
|
|
|
|
|
|
|
var gmap = '<a class="textlink" target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>';
|
|
|
|
|
|
|
|
|
|
$('#itemBirthLocation', page).show().html(Globalize.translate('BirthPlaceValue').replace('{0}', gmap)).trigger('create');
|
|
|
|
|
} else {
|
|
|
|
|
$('#itemBirthLocation', page).hide();
|
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
});
|
2013-07-29 08:05:09 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
if (item.LocationType == "Offline") {
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.offlineIndicator', page).show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('.offlineIndicator', page).hide();
|
|
|
|
|
}
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
var isMissingEpisode = false;
|
|
|
|
|
|
|
|
|
|
if (item.LocationType == "Virtual" && item.Type == "Episode") {
|
|
|
|
|
try {
|
|
|
|
|
if (item.PremiereDate && (new Date().getTime() >= parseISO8601Date(item.PremiereDate, { toLocal: true }).getTime())) {
|
|
|
|
|
isMissingEpisode = true;
|
2013-10-17 13:59:46 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
} catch (err) {
|
|
|
|
|
|
2013-10-17 13:59:46 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
if (isMissingEpisode) {
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$('.missingIndicator', page).show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('.missingIndicator', page).hide();
|
|
|
|
|
}
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
setPeopleHeader(page, item);
|
2013-10-02 08:32:11 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
$(page).trigger('displayingitem', [{
|
2014-04-13 10:27:13 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
item: item,
|
|
|
|
|
context: context
|
|
|
|
|
}]);
|
2013-05-10 05:18:07 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2014-06-25 08:12:39 -07:00
|
|
|
|
function renderImage(page, item, user) {
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2015-07-14 13:29:51 -07:00
|
|
|
|
var imageHref = user.Policy.IsAdministrator && item.MediaType != 'Photo' ? "edititemmetadata.html?tab=3&id=" + item.Id : "";
|
2014-06-25 08:12:39 -07:00
|
|
|
|
|
2015-06-28 08:43:49 -07:00
|
|
|
|
LibraryBrowser.renderDetailImage(page.querySelector('.detailImageContainer'), item, imageHref);
|
2014-06-25 08:12:39 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
2015-08-23 19:08:20 -07:00
|
|
|
|
function refreshImage(page, item, user) {
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.refreshDetailImageUserData(page.querySelector('.detailImageContainer'), item);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
function onWebSocketMessage(e, data) {
|
|
|
|
|
|
|
|
|
|
var msg = data;
|
2015-06-29 11:45:42 -07:00
|
|
|
|
var page = $($.mobile.activePage)[0];
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
|
|
|
|
if (msg.MessageType === "UserDataChanged") {
|
|
|
|
|
|
|
|
|
|
if (currentItem && msg.Data.UserId == Dashboard.getCurrentUserId()) {
|
|
|
|
|
|
|
|
|
|
var key = currentItem.UserData.Key;
|
|
|
|
|
|
|
|
|
|
var userData = msg.Data.UserDataList.filter(function (u) {
|
|
|
|
|
|
|
|
|
|
return u.Key == key;
|
|
|
|
|
})[0];
|
|
|
|
|
|
|
|
|
|
if (userData) {
|
2014-06-25 08:12:39 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
currentItem.UserData = userData;
|
2014-06-25 08:12:39 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
|
2015-08-23 19:08:20 -07:00
|
|
|
|
refreshImage(page, currentItem, user);
|
2014-06-25 08:12:39 -07:00
|
|
|
|
});
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-03 21:53:49 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2013-10-02 08:32:11 -07:00
|
|
|
|
function setPeopleHeader(page, item) {
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.MediaType == "Book" || item.MediaType == "Photo") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
$('#peopleHeader', page).html(Globalize.translate('HeaderPeople'));
|
2013-10-02 08:32:11 -07:00
|
|
|
|
} else {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
$('#peopleHeader', page).html(Globalize.translate('HeaderCastAndCrew'));
|
2013-10-02 08:32:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
function getContext(item) {
|
|
|
|
|
|
2015-07-26 22:03:34 -07:00
|
|
|
|
return getParameterByName('context');
|
2013-04-23 07:46:27 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function renderHeader(page, item, context) {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2013-04-28 11:47:19 -07:00
|
|
|
|
$('.itemTabs', page).hide();
|
2015-07-18 11:07:03 -07:00
|
|
|
|
|
2015-08-17 09:52:56 -07:00
|
|
|
|
if (context == 'tv') {
|
2015-08-16 11:37:53 -07:00
|
|
|
|
$(page).removeClass('noSecondaryNavPage');
|
|
|
|
|
|
|
|
|
|
$('#tvShowsTabs', page).show();
|
2015-08-18 08:25:57 -07:00
|
|
|
|
LibraryMenu.setMenuButtonVisible(true);
|
2014-05-10 22:11:53 -07:00
|
|
|
|
}
|
2015-08-16 11:37:53 -07:00
|
|
|
|
else {
|
|
|
|
|
$(page).addClass('noSecondaryNavPage');
|
|
|
|
|
LibraryMenu.setBackButtonVisible(true);
|
|
|
|
|
LibraryMenu.setMenuButtonVisible(false);
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-25 08:52:10 -07:00
|
|
|
|
function setInitialCollapsibleState(page, item, context, user) {
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2014-03-08 11:17:05 -07:00
|
|
|
|
$('.collectionItems', page).empty();
|
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
if (item.Type == 'TvChannel') {
|
|
|
|
|
|
|
|
|
|
$('#childrenCollapsible', page).removeClass('hide');
|
|
|
|
|
renderChannelGuide(page, item, user);
|
|
|
|
|
}
|
2015-08-19 21:06:49 -07:00
|
|
|
|
else if (item.Type == 'Playlist') {
|
|
|
|
|
|
|
|
|
|
$('#childrenCollapsible', page).removeClass('hide');
|
|
|
|
|
renderPlaylistItems(page, item, user);
|
|
|
|
|
}
|
2015-08-18 21:08:03 -07:00
|
|
|
|
else if (item.Type == 'Studio' || item.Type == 'Person' || item.Type == 'Genre' || item.Type == 'MusicGenre' || item.Type == 'GameGenre' || item.Type == 'MusicArtist') {
|
|
|
|
|
|
|
|
|
|
$('#childrenCollapsible', page).removeClass('hide');
|
|
|
|
|
renderItemsByName(page, item, user);
|
|
|
|
|
}
|
2015-08-17 21:22:45 -07:00
|
|
|
|
else if (item.IsFolder) {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
if (item.Type == "BoxSet") {
|
|
|
|
|
$('#childrenCollapsible', page).addClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('#childrenCollapsible', page).removeClass('hide');
|
|
|
|
|
}
|
2014-05-29 12:34:20 -07:00
|
|
|
|
renderChildren(page, item, user, context);
|
2013-04-22 20:56:11 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2013-05-18 15:48:19 -07:00
|
|
|
|
$('#childrenCollapsible', page).addClass('hide');
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
if (item.MediaSources && item.MediaSources.length) {
|
|
|
|
|
renderMediaSources(page, item);
|
2013-03-26 16:57:18 -07:00
|
|
|
|
}
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
2014-03-21 20:35:03 -07:00
|
|
|
|
var chapters = item.Chapters || [];
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
2015-05-15 19:36:47 -07:00
|
|
|
|
if (!chapters.length || !AppInfo.enableDetailPageChapters) {
|
2013-03-26 14:32:01 -07:00
|
|
|
|
$('#scenesCollapsible', page).hide();
|
|
|
|
|
} else {
|
2013-03-26 15:53:06 -07:00
|
|
|
|
$('#scenesCollapsible', page).show();
|
2014-07-11 19:31:08 -07:00
|
|
|
|
renderScenes(page, item, user, 3);
|
2013-03-25 21:44:12 -07:00
|
|
|
|
}
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2013-09-05 05:48:14 -07:00
|
|
|
|
if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0 || item.Type == "Series") {
|
2013-05-18 15:48:19 -07:00
|
|
|
|
$('#specialsCollapsible', page).addClass('hide');
|
2013-03-26 14:32:01 -07:00
|
|
|
|
} else {
|
2013-05-18 15:48:19 -07:00
|
|
|
|
$('#specialsCollapsible', page).removeClass('hide');
|
2014-02-17 20:02:41 -07:00
|
|
|
|
renderSpecials(page, item, user, 6);
|
2013-03-26 11:51:52 -07:00
|
|
|
|
}
|
2013-03-26 22:20:46 -07:00
|
|
|
|
if (!item.People || !item.People.length) {
|
|
|
|
|
$('#castCollapsible', page).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('#castCollapsible', page).show();
|
2014-01-16 15:49:31 -07:00
|
|
|
|
renderCast(page, item, context, 6);
|
2013-03-26 22:20:46 -07:00
|
|
|
|
}
|
2013-04-24 09:03:10 -07:00
|
|
|
|
|
2015-01-27 15:45:59 -07:00
|
|
|
|
if (item.PartCount && item.PartCount > 1) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
$('#additionalPartsCollapsible', page).removeClass('hide');
|
2014-02-17 20:02:41 -07:00
|
|
|
|
renderAdditionalParts(page, item, user);
|
2015-01-27 15:45:59 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#additionalPartsCollapsible', page).addClass('hide');
|
2013-06-12 14:46:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-24 09:03:10 -07:00
|
|
|
|
$('#themeSongsCollapsible', page).hide();
|
2013-04-28 11:30:58 -07:00
|
|
|
|
$('#themeVideosCollapsible', page).hide();
|
2013-04-24 09:03:10 -07:00
|
|
|
|
|
2013-07-29 12:12:21 -07:00
|
|
|
|
if (item.Type == "MusicAlbum") {
|
2014-02-17 20:02:41 -07:00
|
|
|
|
renderMusicVideos(page, item, user);
|
2013-07-29 12:12:21 -07:00
|
|
|
|
} else {
|
2013-07-30 14:02:28 -07:00
|
|
|
|
$('#musicVideosCollapsible', page).hide();
|
2013-07-29 12:12:21 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
renderThemeMedia(page, item, user);
|
2013-05-11 23:05:51 -07:00
|
|
|
|
renderCriticReviews(page, item, 1);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2015-07-03 04:51:45 -07:00
|
|
|
|
function renderDetails(page, item, context, isStatic) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
renderSimilarItems(page, item, context);
|
2014-06-11 12:31:33 -07:00
|
|
|
|
renderSiblingLinks(page, item, context);
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
if (item.Taglines && item.Taglines.length) {
|
2015-08-18 10:54:29 -07:00
|
|
|
|
$('.tagline', page).html(item.Taglines[0]).show();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
} else {
|
2015-08-18 10:54:29 -07:00
|
|
|
|
$('.tagline', page).hide();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-23 19:08:20 -07:00
|
|
|
|
var topOverview = page.querySelector('.topOverview');
|
|
|
|
|
var bottomOverview = page.querySelector('.bottomOverview');
|
|
|
|
|
|
2015-08-24 11:22:44 -07:00
|
|
|
|
var seasonOnBottom = screen.availHeight < 1080 || screen.availWidth < 1920;
|
|
|
|
|
|
|
|
|
|
if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom) || (item.Type == 'Series' && seasonOnBottom)) {
|
2015-08-23 19:08:20 -07:00
|
|
|
|
LibraryBrowser.renderOverview([bottomOverview], item);
|
|
|
|
|
topOverview.classList.add('hide');
|
|
|
|
|
bottomOverview.classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
LibraryBrowser.renderOverview([topOverview], item);
|
|
|
|
|
topOverview.classList.remove('hide');
|
|
|
|
|
bottomOverview.classList.add('hide');
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-01-17 22:55:21 -07:00
|
|
|
|
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-01-18 11:10:21 -07:00
|
|
|
|
LibraryBrowser.renderAwardSummary($('#awardSummary', page), item);
|
2013-04-12 08:25:00 -07:00
|
|
|
|
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-08-20 20:21:27 -07:00
|
|
|
|
LibraryBrowser.renderGenres($('.itemGenres', page), item, null, isStatic);
|
|
|
|
|
LibraryBrowser.renderStudios($('.itemStudios', page), item, isStatic);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
renderUserDataIcons(page, item);
|
2015-06-29 11:45:42 -07:00
|
|
|
|
LibraryBrowser.renderLinks(page.querySelector('.itemExternalLinks'), item);
|
2013-05-14 21:05:52 -07:00
|
|
|
|
|
|
|
|
|
$('.criticRatingScore', page).html((item.CriticRating || '0') + '%');
|
2013-05-06 20:00:24 -07:00
|
|
|
|
|
2013-05-05 21:50:40 -07:00
|
|
|
|
if (item.CriticRatingSummary) {
|
|
|
|
|
$('#criticRatingSummary', page).show();
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.criticRatingSummaryText', page).html(item.CriticRatingSummary);
|
2013-05-05 21:50:40 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$('#criticRatingSummary', page).hide();
|
|
|
|
|
}
|
2013-05-06 20:00:24 -07:00
|
|
|
|
|
|
|
|
|
renderTags(page, item);
|
2013-05-14 22:04:12 -07:00
|
|
|
|
|
2015-08-21 10:45:56 -07:00
|
|
|
|
renderSeriesAirTime(page, item, isStatic);
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-05-16 20:24:41 -07:00
|
|
|
|
if (item.Players) {
|
|
|
|
|
$('#players', page).show().html(item.Players + ' Player');
|
|
|
|
|
} else {
|
|
|
|
|
$('#players', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-13 10:25:28 -07:00
|
|
|
|
if (item.ArtistItems && item.ArtistItems.length && item.Type != "MusicAlbum") {
|
2015-08-18 10:54:29 -07:00
|
|
|
|
$('.artist', page).show().html(getArtistLinksHtml(item.ArtistItems, context)).trigger('create');
|
2013-05-16 20:24:41 -07:00
|
|
|
|
} else {
|
2015-08-18 10:54:29 -07:00
|
|
|
|
$('.artist', page).hide();
|
2013-05-16 20:24:41 -07:00
|
|
|
|
}
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.MediaSources && item.MediaSources.length && item.Path) {
|
|
|
|
|
$('.audioVideoMediaInfo', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.audioVideoMediaInfo', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.MediaType == 'Photo') {
|
|
|
|
|
$('.photoInfo', page).removeClass('hide');
|
|
|
|
|
renderPhotoInfo(page, item);
|
|
|
|
|
} else {
|
|
|
|
|
$('.photoInfo', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 08:55:22 -07:00
|
|
|
|
renderTabButtons(page, item);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
function renderPhotoInfo(page, item) {
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
var html = '';
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
var attributes = [];
|
2013-05-28 13:01:33 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.CameraMake) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoCameraMake'), item.CameraMake));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.CameraModel) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoCameraModel'), item.CameraModel));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
if (item.Altitude) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoAltitude'), item.Altitude.toFixed(1)));
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Aperture) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoAperture'), 'F' + item.Aperture.toFixed(1)));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.ExposureTime) {
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
var val = 1 / item.ExposureTime;
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoExposureTime'), '1/' + val + ' s'));
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.FocalLength) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoFocalLength'), item.FocalLength.toFixed(1) + ' mm'));
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
if (item.ImageOrientation) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoOrientation'), item.ImageOrientation));
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.IsoSpeedRating) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoIsoSpeedRating'), item.IsoSpeedRating));
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Latitude) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoLatitude'), item.Latitude.toFixed(1)));
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Longitude) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoLongitude'), item.Longitude.toFixed(1)));
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (item.ShutterSpeed) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoShutterSpeed'), item.ShutterSpeed));
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
if (item.Software) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoSoftware'), item.Software));
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
html += attributes.join('<br/>');
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
$('.photoInfoContent', page).html(html).trigger('create');
|
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
function renderTabButtons(page, item) {
|
|
|
|
|
|
|
|
|
|
var elem = $('.tabDetails', page)[0];
|
2015-02-08 11:21:24 -07:00
|
|
|
|
var text = elem.textContent || elem.innerText || '';
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
if (text.trim()) {
|
|
|
|
|
|
|
|
|
|
$('.detailsSection', page).removeClass('hide');
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('.detailsSection', page).addClass('hide');
|
|
|
|
|
}
|
2013-05-15 06:57:13 -07:00
|
|
|
|
}
|
2013-10-02 08:32:11 -07:00
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function getArtistLinksHtml(artists, context) {
|
2013-10-02 08:32:11 -07:00
|
|
|
|
|
2013-09-05 12:00:50 -07:00
|
|
|
|
var html = [];
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = artists.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var artist = artists[i];
|
|
|
|
|
|
2015-08-20 20:21:27 -07:00
|
|
|
|
html.push('<a class="textlink" href="itemdetails.html?id=' + artist.Id + '">' + artist.Name + '</a>');
|
2013-09-05 12:00:50 -07:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html = html.join(' / ');
|
2013-10-02 08:32:11 -07:00
|
|
|
|
|
2013-09-05 12:00:50 -07:00
|
|
|
|
if (artists.length == 1) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
return Globalize.translate('ValueArtist', html);
|
2013-09-05 12:00:50 -07:00
|
|
|
|
}
|
|
|
|
|
if (artists.length > 1) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
return Globalize.translate('ValueArtists', html);
|
2013-09-05 12:00:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
}
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
2014-06-11 12:31:33 -07:00
|
|
|
|
function renderSiblingLinks(page, item, context) {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
|
|
|
|
$('.lnkSibling', page).addClass('hide');
|
2014-06-02 19:01:30 -07:00
|
|
|
|
|
2014-08-28 21:06:30 -07:00
|
|
|
|
if ((item.Type != "Episode" && item.Type != "Season" && item.Type != "Audio" && item.Type != "Photo")) {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
var promise;
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
if (item.Type == "Season") {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
promise = ApiClient.getSeasons(item.SeriesId, {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
|
|
|
AdjacentTo: item.Id
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-02 21:20:04 -07:00
|
|
|
|
else if (item.Type == "Episode" && item.SeasonId) {
|
2013-12-03 21:18:50 -07:00
|
|
|
|
|
|
|
|
|
// Use dedicated episodes endpoint
|
|
|
|
|
promise = ApiClient.getEpisodes(item.SeriesId, {
|
|
|
|
|
|
|
|
|
|
seasonId: item.SeasonId,
|
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
|
|
|
AdjacentTo: item.Id
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
promise = ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
|
|
|
|
AdjacentTo: item.Id,
|
2014-08-28 21:06:30 -07:00
|
|
|
|
ParentId: item.ParentId,
|
|
|
|
|
SortBy: 'SortName'
|
2013-12-03 21:18:50 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-11 12:31:33 -07:00
|
|
|
|
context = context || '';
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
promise.done(function (result) {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2014-08-28 21:06:30 -07:00
|
|
|
|
var foundExisting = false;
|
|
|
|
|
|
2013-05-19 10:35:00 -07:00
|
|
|
|
for (var i = 0, length = result.Items.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var curr = result.Items[i];
|
|
|
|
|
|
2014-08-28 21:06:30 -07:00
|
|
|
|
if (curr.Id == item.Id) {
|
|
|
|
|
foundExisting = true;
|
2013-05-19 10:35:00 -07:00
|
|
|
|
}
|
2014-08-28 21:06:30 -07:00
|
|
|
|
else if (!foundExisting) {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2014-06-11 12:31:33 -07:00
|
|
|
|
$('.lnkPreviousItem', page).removeClass('hide').attr('href', 'itemdetails.html?id=' + curr.Id + '&context=' + context);
|
2013-05-19 10:35:00 -07:00
|
|
|
|
}
|
2014-08-28 21:06:30 -07:00
|
|
|
|
else {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2014-06-11 12:31:33 -07:00
|
|
|
|
$('.lnkNextItem', page).removeClass('hide').attr('href', 'itemdetails.html?id=' + curr.Id + '&context=' + context);
|
2013-05-19 10:35:00 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function renderSimilarItems(page, item, context) {
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2015-08-20 19:36:30 -07:00
|
|
|
|
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Series" || item.Type == "Program" || item.Type == "Recording" || item.Type == "Game" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "ChannelVideoItem") {
|
|
|
|
|
$('#similarCollapsible', page).show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$('#similarCollapsible', page).hide();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2015-05-12 21:55:19 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
2013-05-25 16:52:41 -07:00
|
|
|
|
var options = {
|
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
2015-05-12 21:55:19 -07:00
|
|
|
|
limit: screenWidth > 800 ? 5 : 4,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
fields: "PrimaryImageAspectRatio,UserData,SyncInfo"
|
2013-05-25 16:52:41 -07:00
|
|
|
|
};
|
2013-05-28 13:01:33 -07:00
|
|
|
|
|
2015-08-20 19:36:30 -07:00
|
|
|
|
ApiClient.getSimilarItems(item.Id, options).done(function (result) {
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
|
|
|
|
if (!result.Items.length) {
|
|
|
|
|
|
|
|
|
|
$('#similarCollapsible', page).hide();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var elem = $('#similarCollapsible', page).show();
|
|
|
|
|
|
2015-07-29 10:16:00 -07:00
|
|
|
|
$('.similiarHeader', elem).html(Globalize.translate('HeaderIfYouLikeCheckTheseOut', item.Name));
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
2015-08-20 19:36:30 -07:00
|
|
|
|
shape: item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? "detailPageSquare" : "detailPagePortrait",
|
2013-12-29 11:53:56 -07:00
|
|
|
|
showParentTitle: item.Type == "MusicAlbum",
|
2015-08-20 19:36:30 -07:00
|
|
|
|
centerText: true,
|
|
|
|
|
showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist",
|
2014-05-29 12:34:20 -07:00
|
|
|
|
borderless: item.Type == "Game",
|
2014-08-02 19:16:37 -07:00
|
|
|
|
context: context,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
2015-08-20 19:36:30 -07:00
|
|
|
|
showDetailsMenu: true,
|
2015-08-24 20:13:04 -07:00
|
|
|
|
coverImage: item.Type == "MusicAlbum" || item.Type == "MusicArtist",
|
|
|
|
|
overlayPlayButton: true
|
2013-05-15 15:55:24 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-24 20:13:04 -07:00
|
|
|
|
$('#similarContent', page).html(html).lazyChildren().createCardMenus();
|
2013-05-15 15:55:24 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:45:56 -07:00
|
|
|
|
function renderSeriesAirTime(page, item, isStatic) {
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2013-05-15 06:57:13 -07:00
|
|
|
|
if (item.Type != "Series") {
|
|
|
|
|
$('#seriesAirTime', page).hide();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-04 09:48:23 -07:00
|
|
|
|
var html = '';
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2013-05-18 10:07:20 -07:00
|
|
|
|
if (item.AirDays && item.AirDays.length) {
|
2013-06-04 09:48:23 -07:00
|
|
|
|
html += item.AirDays.length == 7 ? 'daily' : item.AirDays.map(function (a) {
|
2013-05-15 06:57:13 -07:00
|
|
|
|
return a + "s";
|
|
|
|
|
|
|
|
|
|
}).join(',');
|
|
|
|
|
}
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2013-05-15 06:57:13 -07:00
|
|
|
|
if (item.AirTime) {
|
|
|
|
|
html += ' at ' + item.AirTime;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-25 08:52:10 -07:00
|
|
|
|
if (item.Studios.length) {
|
2015-08-21 10:45:56 -07:00
|
|
|
|
|
|
|
|
|
if (isStatic) {
|
|
|
|
|
html += ' on ' + item.Studios[0].Name;
|
|
|
|
|
} else {
|
|
|
|
|
html += ' on <a class="textlink" href="itemdetails.html?id=' + item.Studios[0].Id + '">' + item.Studios[0].Name + '</a>';
|
|
|
|
|
}
|
2013-10-25 08:52:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-04 09:48:23 -07:00
|
|
|
|
if (html) {
|
|
|
|
|
html = (item.Status == 'Ended' ? 'Aired ' : 'Airs ') + html;
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
2013-06-04 09:48:23 -07:00
|
|
|
|
$('#seriesAirTime', page).show().html(html).trigger('create');
|
|
|
|
|
} else {
|
|
|
|
|
$('#seriesAirTime', page).hide();
|
|
|
|
|
}
|
2013-05-06 20:00:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderTags(page, item) {
|
|
|
|
|
|
|
|
|
|
if (item.Tags && item.Tags.length) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
2014-09-17 18:26:23 -07:00
|
|
|
|
html += '<p>' + Globalize.translate('HeaderTags') + '</p>';
|
2013-05-06 20:00:24 -07:00
|
|
|
|
for (var i = 0, length = item.Tags.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
html += '<div class="itemTag">' + item.Tags[i] + '</div>';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.itemTags', page).show().html(html);
|
2013-05-06 20:00:24 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.itemTags', page).hide();
|
2013-05-06 20:00:24 -07:00
|
|
|
|
}
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2015-01-29 23:32:20 -07:00
|
|
|
|
function getEpisodesFunction(seriesId, query) {
|
|
|
|
|
|
|
|
|
|
query = $.extend({}, query);
|
|
|
|
|
|
|
|
|
|
return function (index, limit, fields) {
|
|
|
|
|
|
|
|
|
|
query.StartIndex = index;
|
|
|
|
|
query.Limit = limit;
|
|
|
|
|
query.Fields = fields;
|
|
|
|
|
|
|
|
|
|
return ApiClient.getEpisodes(seriesId, query);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getAlbumSongsFunction(query) {
|
|
|
|
|
|
|
|
|
|
query = $.extend({}, query);
|
|
|
|
|
|
|
|
|
|
return function (index, limit, fields) {
|
|
|
|
|
|
|
|
|
|
query.StartIndex = index;
|
|
|
|
|
query.Limit = limit;
|
|
|
|
|
query.Fields = fields;
|
|
|
|
|
|
|
|
|
|
return ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _childrenItemsFunction = null;
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function renderChildren(page, item, user, context) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
2015-01-29 23:32:20 -07:00
|
|
|
|
_childrenItemsFunction = null;
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2014-12-10 23:20:28 -07:00
|
|
|
|
var fields = "ItemCounts,AudioInfo,PrimaryImageAspectRatio,SyncInfo";
|
2014-01-20 09:09:53 -07:00
|
|
|
|
|
2013-10-25 08:52:10 -07:00
|
|
|
|
var query = {
|
2013-08-30 18:08:32 -07:00
|
|
|
|
ParentId: item.Id,
|
2013-12-29 11:53:56 -07:00
|
|
|
|
Fields: fields
|
2013-10-25 08:52:10 -07:00
|
|
|
|
};
|
2014-01-20 09:09:53 -07:00
|
|
|
|
|
2014-01-01 20:53:27 -07:00
|
|
|
|
// Let the server pre-sort boxsets
|
|
|
|
|
if (item.Type !== "BoxSet") {
|
|
|
|
|
query.SortBy = "SortName";
|
|
|
|
|
}
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2013-11-22 08:33:14 -07:00
|
|
|
|
var promise;
|
|
|
|
|
|
2013-11-28 11:27:29 -07:00
|
|
|
|
if (item.Type == "Series") {
|
2013-11-22 08:33:14 -07:00
|
|
|
|
|
2013-11-28 11:27:29 -07:00
|
|
|
|
promise = ApiClient.getSeasons(item.Id, {
|
2013-11-15 14:31:33 -07:00
|
|
|
|
|
2013-12-29 11:53:56 -07:00
|
|
|
|
userId: user.Id,
|
|
|
|
|
Fields: fields
|
2013-11-22 08:33:14 -07:00
|
|
|
|
});
|
2013-11-15 14:31:33 -07:00
|
|
|
|
}
|
2013-12-01 19:24:14 -07:00
|
|
|
|
else if (item.Type == "Season") {
|
2013-11-15 14:31:33 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
// Use dedicated episodes endpoint
|
|
|
|
|
promise = ApiClient.getEpisodes(item.SeriesId, {
|
2013-11-28 11:27:29 -07:00
|
|
|
|
|
2013-12-03 21:18:50 -07:00
|
|
|
|
seasonId: item.Id,
|
2013-12-29 11:53:56 -07:00
|
|
|
|
userId: user.Id,
|
|
|
|
|
Fields: fields
|
2013-12-03 21:18:50 -07:00
|
|
|
|
});
|
2015-01-29 23:32:20 -07:00
|
|
|
|
|
|
|
|
|
_childrenItemsFunction = getEpisodesFunction(item.SeriesId, {
|
|
|
|
|
|
|
|
|
|
seasonId: item.Id,
|
|
|
|
|
userId: user.Id
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "MusicAlbum") {
|
|
|
|
|
|
|
|
|
|
_childrenItemsFunction = getAlbumSongsFunction(query);
|
2013-10-25 08:52:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-22 08:33:14 -07:00
|
|
|
|
promise = promise || ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
|
|
|
|
|
|
|
|
|
promise.done(function (result) {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
var html = '';
|
2015-01-22 23:15:15 -07:00
|
|
|
|
var trigger = false;
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
if (item.Type == "MusicAlbum") {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
html = LibraryBrowser.getListViewHtml({
|
2014-08-15 09:35:41 -07:00
|
|
|
|
items: result.Items,
|
2014-08-16 22:38:13 -07:00
|
|
|
|
smallIcon: true,
|
|
|
|
|
showIndex: true,
|
2014-08-17 11:12:17 -07:00
|
|
|
|
index: 'disc',
|
2014-08-30 07:26:29 -07:00
|
|
|
|
showIndexNumber: true,
|
|
|
|
|
playFromHere: true,
|
2015-05-09 21:29:04 -07:00
|
|
|
|
defaultAction: 'playallfromhere',
|
|
|
|
|
lazy: true
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
2015-01-22 23:15:15 -07:00
|
|
|
|
trigger = true;
|
2013-12-29 11:53:56 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Series") {
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "detailPagePortrait",
|
|
|
|
|
showTitle: false,
|
|
|
|
|
centerText: true,
|
|
|
|
|
context: context,
|
2015-05-09 21:29:04 -07:00
|
|
|
|
lazy: true
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Season") {
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "detailPage169",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
displayAsSpecial: item.Type == "Season" && item.IndexNumber,
|
2015-01-29 23:32:20 -07:00
|
|
|
|
playFromHere: true,
|
2015-05-09 21:29:04 -07:00
|
|
|
|
overlayText: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
2015-07-18 11:07:03 -07:00
|
|
|
|
showDetailsMenu: true,
|
2015-07-19 20:43:13 -07:00
|
|
|
|
overlayPlayButton: AppInfo.enableAppLayouts
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "GameSystem") {
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "auto",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
centerText: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
|
|
|
|
showDetailsMenu: true
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var elem = page.querySelector('.childrenItemsContainer');
|
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(elem);
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
|
|
|
|
if (trigger) {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
$(elem).trigger('create');
|
2015-01-22 23:15:15 -07:00
|
|
|
|
}
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
if (item.Type == "BoxSet") {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
var collectionItemTypes = [
|
2014-09-17 18:26:23 -07:00
|
|
|
|
{ name: Globalize.translate('HeaderMovies'), type: 'Movie' },
|
|
|
|
|
{ name: Globalize.translate('HeaderSeries'), type: 'Series' },
|
|
|
|
|
{ name: Globalize.translate('HeaderAlbums'), type: 'MusicAlbum' },
|
|
|
|
|
{ name: Globalize.translate('HeaderGames'), type: 'Game' },
|
|
|
|
|
{ name: Globalize.translate('HeaderBooks'), type: 'Book' }
|
2014-08-30 07:26:29 -07:00
|
|
|
|
];
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
renderCollectionItems(page, collectionItemTypes, result.Items, user, context);
|
2013-04-22 13:06:43 -07:00
|
|
|
|
}
|
2013-04-22 07:44:11 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Season") {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('#childrenTitle').innerHTML = Globalize.translate('HeaderEpisodes');
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Series") {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('#childrenTitle').innerHTML = Globalize.translate('HeaderSeasons');
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
2013-04-22 08:10:54 -07:00
|
|
|
|
else if (item.Type == "MusicAlbum") {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('#childrenTitle').innerHTML = Globalize.translate('HeaderTracks');
|
2013-04-22 08:10:54 -07:00
|
|
|
|
}
|
2013-09-21 14:00:04 -07:00
|
|
|
|
else if (item.Type == "GameSystem") {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('#childrenTitle').innerHTML = Globalize.translate('HeaderGames');
|
2013-04-28 11:47:19 -07:00
|
|
|
|
}
|
2013-04-22 07:44:11 -07:00
|
|
|
|
else {
|
2015-06-28 07:45:21 -07:00
|
|
|
|
page.querySelector('#childrenTitle').innerHTML = Globalize.translate('HeaderItems');
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
2015-07-06 00:06:09 -07:00
|
|
|
|
|
|
|
|
|
if (item.Type == "MusicAlbum") {
|
|
|
|
|
$('.childrenSectionHeader', page).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('.childrenSectionHeader', page).show();
|
|
|
|
|
}
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
|
function renderItemsByName(page, item, user) {
|
|
|
|
|
|
|
|
|
|
require('scripts/itembynamedetailpage'.split(','), function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.ItemsByName.renderItems(page, item);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-19 21:06:49 -07:00
|
|
|
|
function renderPlaylistItems(page, item, user) {
|
|
|
|
|
|
|
|
|
|
require('scripts/playlistedit'.split(','), function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlaylistViewer.render(page, item);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
function renderChannelGuide(page, item, user) {
|
|
|
|
|
|
|
|
|
|
require('scripts/livetvcomponents,scripts/livetvchannel,livetvcss'.split(','), function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LiveTvChannelPage.renderPrograms(page, item.Id);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-08 11:17:05 -07:00
|
|
|
|
function renderCollectionItems(page, types, items, user) {
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = types.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var type = types[i];
|
|
|
|
|
|
|
|
|
|
var typeItems = items.filter(function (curr) {
|
|
|
|
|
|
|
|
|
|
return curr.Type == type.type;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
if (typeItems.length) {
|
|
|
|
|
renderCollectionItemType(page, type, typeItems, user);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
var otherType = { name: Globalize.translate('HeaderOtherItems') };
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
var otherTypeItems = items.filter(function (curr) {
|
|
|
|
|
|
2014-03-15 15:52:43 -07:00
|
|
|
|
return !types.filter(function (t) {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
return t.type == curr.Type;
|
|
|
|
|
|
|
|
|
|
}).length;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (otherTypeItems.length) {
|
|
|
|
|
renderCollectionItemType(page, otherType, otherTypeItems, user);
|
|
|
|
|
}
|
2014-03-15 15:52:43 -07:00
|
|
|
|
|
2014-03-08 11:17:05 -07:00
|
|
|
|
if (!items.length) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
renderCollectionItemType(page, { name: Globalize.translate('HeaderItems') }, items, user);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
$('.collectionItems', page).trigger('create').createCardMenus();
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function renderCollectionItemType(page, type, items, user, context) {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
html += '<div class="detailSection">';
|
|
|
|
|
|
2015-07-29 10:16:00 -07:00
|
|
|
|
html += '<h1>';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
html += '<span>' + type.name + '</span>';
|
|
|
|
|
|
2014-12-19 23:06:27 -07:00
|
|
|
|
if (user.Policy.IsAdministrator) {
|
2015-07-29 10:16:00 -07:00
|
|
|
|
html += '<a class="detailSectionHeaderButton clearLink" style="margin-top:-8px;display:inline-block;" href="edititemmetadata.html?tab=2&id=' + currentItem.Id + '" title="' + Globalize.translate('ButtonEdit') + '" style="display:none;"><paper-icon-button icon="mode-edit"></paper-icon-button></a>';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-29 10:16:00 -07:00
|
|
|
|
html += '</h1>';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="detailSectionContent">';
|
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
var shape = type.type == 'MusicAlbum' ? 'detailPageSquare' : 'detailPagePortrait';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: items,
|
|
|
|
|
shape: shape,
|
|
|
|
|
showTitle: true,
|
2014-05-29 12:34:20 -07:00
|
|
|
|
centerText: true,
|
2015-05-09 21:29:04 -07:00
|
|
|
|
context: context,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
|
|
|
|
showDetailsMenu: true
|
2014-03-08 11:17:05 -07:00
|
|
|
|
});
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var collectionItems = page.querySelector('.collectionItems');
|
|
|
|
|
$(collectionItems).append(html);
|
|
|
|
|
ImageLoader.lazyChildren(collectionItems);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderUserDataIcons(page, item) {
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item, true, 'fab'));
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
function renderCriticReviews(page, item, limit) {
|
|
|
|
|
|
2013-05-27 18:59:26 -07:00
|
|
|
|
if (item.Type != "Movie" && item.Type != "Trailer" && item.Type != "MusicVideo") {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
$('#criticReviewsCollapsible', page).hide();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
var options = {};
|
|
|
|
|
|
|
|
|
|
if (limit) {
|
|
|
|
|
options.limit = limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApiClient.getCriticReviews(item.Id, options).done(function (result) {
|
|
|
|
|
|
2014-03-19 10:44:55 -07:00
|
|
|
|
if (result.TotalRecordCount || item.CriticRatingSummary || item.AwardSummary) {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
$('#criticReviewsCollapsible', page).show();
|
|
|
|
|
renderCriticReviewsContent(page, result, limit);
|
|
|
|
|
} else {
|
|
|
|
|
$('#criticReviewsCollapsible', page).hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderCriticReviewsContent(page, result, limit) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-11-28 11:27:29 -07:00
|
|
|
|
var reviews = result.Items;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
for (var i = 0, length = reviews.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var review = reviews[i];
|
|
|
|
|
|
|
|
|
|
html += '<div class="criticReview">';
|
|
|
|
|
|
|
|
|
|
html += '<div class="reviewScore">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (review.Score != null) {
|
|
|
|
|
html += review.Score;
|
|
|
|
|
}
|
|
|
|
|
else if (review.Likes != null) {
|
|
|
|
|
|
|
|
|
|
if (review.Likes) {
|
|
|
|
|
html += '<img src="css/images/fresh.png" />';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<img src="css/images/rotten.png" />';
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-05-13 22:36:36 -07:00
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '<div class="reviewCaption">' + review.Caption + '</div>';
|
|
|
|
|
|
|
|
|
|
var vals = [];
|
|
|
|
|
|
|
|
|
|
if (review.ReviewerName) {
|
|
|
|
|
vals.push(review.ReviewerName);
|
|
|
|
|
}
|
|
|
|
|
if (review.Publisher) {
|
|
|
|
|
vals.push(review.Publisher);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<div class="reviewerName">' + vals.join(', ') + '.';
|
|
|
|
|
|
|
|
|
|
if (review.Date) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
2013-10-25 07:18:53 -07:00
|
|
|
|
var date = parseISO8601Date(review.Date, { toLocal: true }).toLocaleDateString();
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
html += '<span class="reviewDate">' + date + '</span>';
|
|
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
if (review.Url) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
html += '<div class="reviewLink"><a class="textlink" href="' + review.Url + '" target="_blank">' + Globalize.translate('ButtonFullReview') + '</a></div>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (limit && result.TotalRecordCount > limit) {
|
2015-08-20 10:59:17 -07:00
|
|
|
|
html += '<p style="margin: 0;"><paper-button raised class="more moreCriticReviews">' + Globalize.translate('ButtonMore') + '</paper-button></p>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var criticReviewsContent = page.querySelector('#criticReviewsContent');
|
|
|
|
|
criticReviewsContent.innerHTML = html;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
2014-04-17 22:03:01 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
function renderThemeMedia(page, item) {
|
2014-04-17 22:03:01 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).done(function (result) {
|
|
|
|
|
|
|
|
|
|
var themeSongs = result.ThemeSongsResult.OwnerId == item.Id ?
|
|
|
|
|
result.ThemeSongsResult.Items :
|
|
|
|
|
[];
|
2014-04-17 22:03:01 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
var themeVideos = result.ThemeVideosResult.OwnerId == item.Id ?
|
|
|
|
|
result.ThemeVideosResult.Items :
|
|
|
|
|
[];
|
|
|
|
|
|
|
|
|
|
renderThemeSongs(page, themeSongs);
|
|
|
|
|
renderThemeVideos(page, themeVideos);
|
|
|
|
|
|
|
|
|
|
$(page).trigger('thememediadownload', [result]);
|
|
|
|
|
});
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
}
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
function renderThemeSongs(page, items) {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
if (items.length) {
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
$('#themeSongsCollapsible', page).show();
|
2013-04-24 09:03:10 -07:00
|
|
|
|
|
2014-08-15 09:35:41 -07:00
|
|
|
|
var html = LibraryBrowser.getListViewHtml({
|
|
|
|
|
items: items,
|
|
|
|
|
smallIcon: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#themeSongsContent', page).html(html).trigger('create');
|
2014-04-14 20:54:52 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#themeSongsCollapsible', page).hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderThemeVideos(page, items, user) {
|
|
|
|
|
|
|
|
|
|
if (items.length) {
|
|
|
|
|
|
|
|
|
|
$('#themeVideosCollapsible', page).show();
|
|
|
|
|
|
2015-05-09 21:29:04 -07:00
|
|
|
|
$('#themeVideosContent', page).html(getVideosHtml(items, user)).lazyChildren().trigger('create');
|
2014-04-14 20:54:52 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#themeVideosCollapsible', page).hide();
|
|
|
|
|
}
|
2013-04-24 09:03:10 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
function renderMusicVideos(page, item, user) {
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
ApiClient.getItems(user.Id, {
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
|
|
|
|
SortBy: "SortName",
|
|
|
|
|
SortOrder: "Ascending",
|
|
|
|
|
IncludeItemTypes: "MusicVideo",
|
|
|
|
|
Recursive: true,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "DateCreated,SyncInfo",
|
2013-08-08 05:19:11 -07:00
|
|
|
|
Albums: item.Name
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
|
|
|
|
}).done(function (result) {
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
|
|
|
|
|
$('#musicVideosCollapsible', page).show();
|
|
|
|
|
|
2015-05-09 21:29:04 -07:00
|
|
|
|
$('#musicVideosContent', page).html(getVideosHtml(result.Items, user)).lazyChildren().trigger('create');
|
2013-07-29 12:12:21 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#musicVideosCollapsible', page).hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
function renderAdditionalParts(page, item, user) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
ApiClient.getAdditionalVideoParts(user.Id, item.Id).done(function (result) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
|
|
|
|
|
$('#additionalPartsCollapsible', page).show();
|
|
|
|
|
|
2015-05-09 21:29:04 -07:00
|
|
|
|
$('#additionalPartsContent', page).html(getVideosHtml(result.Items, user)).lazyChildren().trigger('create');
|
2013-06-12 14:46:50 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#additionalPartsCollapsible', page).hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-03 04:51:45 -07:00
|
|
|
|
function renderScenes(page, item, user, limit, isStatic) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
var html = '';
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2014-03-21 20:35:03 -07:00
|
|
|
|
var chapters = item.Chapters || [];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-05-16 12:09:02 -07:00
|
|
|
|
var maxWidth = LibraryBrowser.getPosterViewInfo().backdropWidth;
|
2015-05-06 20:11:51 -07:00
|
|
|
|
|
2013-03-25 21:44:12 -07:00
|
|
|
|
for (var i = 0, length = chapters.length; i < length; i++) {
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && i >= limit) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-25 21:44:12 -07:00
|
|
|
|
var chapter = chapters[i];
|
2013-04-10 10:11:23 -07:00
|
|
|
|
var chapterName = chapter.Name || "Chapter " + i;
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2015-07-03 04:51:45 -07:00
|
|
|
|
var onclick = item.PlayAccess == 'Full' && !isStatic ? ' onclick="ItemDetailPage.play(' + chapter.StartPositionTicks + ');"' : '';
|
2014-02-17 20:02:41 -07:00
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
html += '<a class="card detailPage169Card" href="#play-Chapter-' + i + '"' + onclick + '>';
|
2014-07-26 10:30:15 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="cardBox">';
|
|
|
|
|
html += '<div class="cardScalable">';
|
2013-05-03 13:50:13 -07:00
|
|
|
|
|
|
|
|
|
var imgUrl;
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
|
|
|
|
if (chapter.ImageTag) {
|
|
|
|
|
|
2014-05-23 16:58:28 -07:00
|
|
|
|
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
|
2015-05-16 12:09:02 -07:00
|
|
|
|
maxWidth: maxWidth,
|
2013-03-25 21:44:12 -07:00
|
|
|
|
tag: chapter.ImageTag,
|
|
|
|
|
type: "Chapter",
|
|
|
|
|
index: i
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2013-05-03 13:50:13 -07:00
|
|
|
|
imgUrl = "css/images/items/list/chapter.png";
|
2013-03-25 21:44:12 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardPadder"></div>';
|
2013-05-03 13:50:13 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardContent">';
|
2015-05-09 21:29:04 -07:00
|
|
|
|
html += '<div class="cardImage lazy" data-src="' + imgUrl + '"></div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardFooter">';
|
|
|
|
|
html += '<div class="cardText">' + chapterName + '</div>';
|
|
|
|
|
html += '<div class="cardText">';
|
2013-06-07 10:29:33 -07:00
|
|
|
|
html += Dashboard.getDisplayTime(chapter.StartPositionTicks);
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
//cardFooter
|
|
|
|
|
html += "</div>";
|
2013-03-26 15:53:06 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
// cardContent
|
2013-12-22 14:11:32 -07:00
|
|
|
|
html += '</div>';
|
2014-07-26 10:30:15 -07:00
|
|
|
|
|
|
|
|
|
// cardScalable
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
// cardBox
|
2013-03-25 21:44:12 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && chapters.length > limit) {
|
2015-08-20 10:59:17 -07:00
|
|
|
|
html += '<p style="margin: 0;"><paper-button raised class="more moreScenes">' + Globalize.translate('ButtonMore') + '</paper-button></p>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var scenesContent = page.querySelector('#scenesContent');
|
|
|
|
|
scenesContent.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(scenesContent);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-06 16:28:43 -07:00
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
function renderMediaSources(page, item) {
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
var html = item.MediaSources.map(function (v) {
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
return getMediaSourceHtml(item, v);
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
|
|
|
|
}).join('<div style="border-top:1px solid #444;margin: 1em 0;"></div>');
|
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
if (item.MediaSources.length > 1) {
|
2014-03-20 20:31:40 -07:00
|
|
|
|
html = '<br/>' + html;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var mediaInfoContent = page.querySelector('#mediaInfoContent');
|
|
|
|
|
mediaInfoContent.innerHTML = html;
|
2014-03-20 20:31:40 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
function getMediaSourceHtml(item, version) {
|
2013-03-26 14:32:01 -07:00
|
|
|
|
|
2013-03-26 16:57:18 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
if (version.Name && item.MediaSources.length > 1) {
|
2014-04-17 22:03:01 -07:00
|
|
|
|
html += '<div><span class="mediaInfoAttribute">' + version.Name + '</span></div><br/>';
|
2014-03-20 20:31:40 -07:00
|
|
|
|
}
|
2013-03-26 16:57:18 -07:00
|
|
|
|
|
2014-03-20 20:31:40 -07:00
|
|
|
|
for (var i = 0, length = version.MediaStreams.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var stream = version.MediaStreams[i];
|
2013-03-26 16:57:18 -07:00
|
|
|
|
|
2013-04-09 11:01:39 -07:00
|
|
|
|
if (stream.Type == "Data") {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-09 11:38:58 -07:00
|
|
|
|
html += '<div class="mediaInfoStream">';
|
2013-03-26 16:57:18 -07:00
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
var displayType = Globalize.translate('MediaInfoStreamType' + stream.Type);
|
|
|
|
|
|
|
|
|
|
html += '<div class="mediaInfoStreamType">' + displayType + '</div>';
|
2013-04-09 19:28:24 -07:00
|
|
|
|
|
2013-05-15 20:39:15 -07:00
|
|
|
|
var attributes = [];
|
2013-04-09 19:28:24 -07:00
|
|
|
|
|
2014-01-18 12:25:20 -07:00
|
|
|
|
if (stream.Language && stream.Type != "Video") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoLanguage'), stream.Language));
|
2013-11-12 09:08:23 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-24 22:25:03 -07:00
|
|
|
|
if (stream.Codec) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoCodec'), stream.Codec.toUpperCase()));
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2013-09-03 14:06:33 -07:00
|
|
|
|
|
2014-03-24 22:25:03 -07:00
|
|
|
|
if (stream.Profile) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoProfile'), stream.Profile));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stream.Level) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoLevel'), stream.Level));
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2013-09-03 14:06:33 -07:00
|
|
|
|
|
2013-10-13 10:52:57 -07:00
|
|
|
|
if (stream.Width || stream.Height) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoResolution'), stream.Width + 'x' + stream.Height));
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2013-05-15 20:39:15 -07:00
|
|
|
|
|
2013-10-13 10:52:57 -07:00
|
|
|
|
if (stream.AspectRatio && stream.Codec != "mjpeg") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoAspectRatio'), stream.AspectRatio));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
if (stream.Type == "Video") {
|
2014-06-22 09:25:47 -07:00
|
|
|
|
if (stream.IsAnamorphic != null) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoAnamorphic'), (stream.IsAnamorphic ? 'Yes' : 'No')));
|
2014-06-22 09:25:47 -07:00
|
|
|
|
}
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoInterlaced'), (stream.IsInterlaced ? 'Yes' : 'No')));
|
2014-03-20 08:55:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stream.AverageFrameRate || stream.RealFrameRate) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoFramerate'), (stream.AverageFrameRate || stream.RealFrameRate)));
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2013-05-15 20:39:15 -07:00
|
|
|
|
|
2013-11-12 09:08:23 -07:00
|
|
|
|
if (stream.ChannelLayout) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoLayout'), stream.ChannelLayout));
|
2013-03-26 22:36:41 -07:00
|
|
|
|
}
|
2015-04-24 20:30:44 -07:00
|
|
|
|
if (stream.Channels) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoChannels'), stream.Channels + ' ch'));
|
2013-03-26 16:57:18 -07:00
|
|
|
|
}
|
2013-05-15 20:39:15 -07:00
|
|
|
|
|
2013-11-12 09:08:23 -07:00
|
|
|
|
if (stream.BitRate && stream.Codec != "mjpeg") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoBitrate'), (parseInt(stream.BitRate / 1024)) + ' kbps'));
|
2013-11-12 09:08:23 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 08:55:22 -07:00
|
|
|
|
if (stream.SampleRate) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoSampleRate'), stream.SampleRate + ' khz'));
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-04-23 22:08:10 -07:00
|
|
|
|
if (stream.BitDepth) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoBitDepth'), stream.BitDepth + ' bit'));
|
2014-04-23 22:08:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-26 12:21:29 -07:00
|
|
|
|
if (stream.PixelFormat) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
|
2014-03-26 12:21:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-20 08:48:23 -07:00
|
|
|
|
if (stream.RefFrames) {
|
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoRefFrames'), stream.RefFrames));
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-10 12:08:09 -07:00
|
|
|
|
if (stream.KeyFrames) {
|
|
|
|
|
//attributes.push(createAttribute(Globalize.translate('MediaInfoKeyFrames'), stream.KeyFrames.join(', ')));
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 08:55:22 -07:00
|
|
|
|
if (stream.Type != "Video") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoDefault'), (stream.IsDefault ? 'Yes' : 'No')));
|
2013-05-15 20:39:15 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
if (stream.Type == "Subtitle") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoForced'), (stream.IsForced ? 'Yes' : 'No')));
|
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoExternal'), (stream.IsExternal ? 'Yes' : 'No')));
|
2013-03-26 16:57:18 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-24 19:45:06 -07:00
|
|
|
|
if (stream.Type == "Video" && version.Timestamp) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoTimestamp'), version.Timestamp));
|
2014-04-24 19:45:06 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-22 21:26:01 -07:00
|
|
|
|
if (stream.IsCabac != null) {
|
|
|
|
|
attributes.push(createAttribute(Globalize.translate('CABAC'), (stream.IsCabac ? 'Yes' : 'No')));
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 08:55:22 -07:00
|
|
|
|
html += attributes.join('<br/>');
|
2013-03-26 22:36:41 -07:00
|
|
|
|
|
2013-04-09 11:38:58 -07:00
|
|
|
|
html += '</div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
if (version.Container) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
html += '<div><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoContainer') + '</span><span class="mediaInfoAttribute">' + version.Container + '</span></div>';
|
2014-09-05 21:21:23 -07:00
|
|
|
|
}
|
2014-04-17 22:03:01 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
if (version.Formats && version.Formats.length) {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
//html += '<div><span class="mediaInfoLabel">'+Globalize.translate('MediaInfoFormat')+'</span><span class="mediaInfoAttribute">' + version.Formats.join(',') + '</span></div>';
|
2014-04-17 22:03:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-28 09:50:33 -07:00
|
|
|
|
if (version.Path && version.Protocol != 'Http') {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
html += '<div style="max-width:600px;overflow:hidden;"><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoPath') + '</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
|
2014-03-20 20:31:40 -07:00
|
|
|
|
}
|
2014-03-29 08:40:32 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
if (version.Size) {
|
2014-04-24 19:45:06 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
var size = (version.Size / (1024 * 1024)).toFixed(0);
|
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
html += '<div><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoSize') + '</span><span class="mediaInfoAttribute">' + size + ' MB</span></div>';
|
2014-04-24 19:45:06 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 20:31:40 -07:00
|
|
|
|
return html;
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-03-20 21:26:00 -07:00
|
|
|
|
function createAttribute(label, value) {
|
|
|
|
|
return '<span class="mediaInfoLabel">' + label + '</span><span class="mediaInfoAttribute">' + value + '</span>'
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
function getVideosHtml(items, user, limit, moreButtonClass) {
|
2013-04-28 10:21:56 -07:00
|
|
|
|
|
2013-03-26 11:51:52 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-05-16 12:09:02 -07:00
|
|
|
|
var maxWidth = LibraryBrowser.getPosterViewInfo().backdropWidth;
|
2015-05-06 20:11:51 -07:00
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && i >= limit) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
var item = items[i];
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
var cssClass = "card detailPage169Card";
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2013-07-29 12:12:21 -07:00
|
|
|
|
var href = "itemdetails.html?id=" + item.Id;
|
|
|
|
|
|
2014-03-29 08:40:32 -07:00
|
|
|
|
var onclick = item.PlayAccess == 'Full' ? ' onclick="MediaController.play(\'' + item.Id + '\'); return false;"' : "";
|
2014-02-17 20:02:41 -07:00
|
|
|
|
|
|
|
|
|
html += '<a class="' + cssClass + '" href="' + href + '"' + onclick + '>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardBox">';
|
|
|
|
|
html += '<div class="cardScalable">';
|
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
var imageTags = item.ImageTags || {};
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-28 10:39:16 -07:00
|
|
|
|
var imgUrl;
|
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
if (imageTags.Primary) {
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2014-05-23 16:58:28 -07:00
|
|
|
|
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
|
2015-05-16 12:09:02 -07:00
|
|
|
|
maxWidth: maxWidth,
|
2013-04-28 10:21:56 -07:00
|
|
|
|
tag: imageTags.Primary,
|
|
|
|
|
type: "primary"
|
|
|
|
|
});
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
} else {
|
2013-04-28 10:39:16 -07:00
|
|
|
|
imgUrl = "css/images/items/detail/video.png";
|
2013-04-28 10:21:56 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardPadder"></div>';
|
2013-04-28 10:39:16 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardContent">';
|
2015-05-09 21:29:04 -07:00
|
|
|
|
html += '<div class="cardImage lazy" data-src="' + imgUrl + '"></div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
html += '<div class="cardFooter">';
|
|
|
|
|
html += '<div class="cardText">' + item.Name + '</div>';
|
|
|
|
|
html += '<div class="cardText">';
|
2013-04-28 10:21:56 -07:00
|
|
|
|
if (item.RunTimeTicks != "") {
|
2013-06-07 10:29:33 -07:00
|
|
|
|
html += Dashboard.getDisplayTime(item.RunTimeTicks);
|
2013-04-28 10:21:56 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
html += " ";
|
|
|
|
|
}
|
|
|
|
|
html += '</div>';
|
2014-07-26 10:30:15 -07:00
|
|
|
|
|
|
|
|
|
//cardFooter
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
// cardContent
|
2013-12-22 14:11:32 -07:00
|
|
|
|
html += '</div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
// cardScalable
|
|
|
|
|
html += '</div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2014-07-26 10:30:15 -07:00
|
|
|
|
// cardBox
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
2013-04-28 10:21:56 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && items.length > limit) {
|
2015-08-20 10:59:17 -07:00
|
|
|
|
html += '<p style="margin: 0;padding-left:5px;"><paper-button raised class="more ' + moreButtonClass + '">' + Globalize.translate('ButtonMore') + '</paper-button></p>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-28 10:21:56 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
function renderSpecials(page, item, user, limit) {
|
2013-04-28 10:21:56 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
ApiClient.getSpecialFeatures(user.Id, item.Id).done(function (specials) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var specialsContent = page.querySelector('#specialsContent');
|
|
|
|
|
specialsContent.innerHTML = getVideosHtml(specials, user, limit, "moreSpecials");
|
|
|
|
|
ImageLoader.lazyChildren(specialsContent);
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2015-07-03 04:51:45 -07:00
|
|
|
|
function renderCast(page, item, context, limit, isStatic) {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2013-03-26 22:20:46 -07:00
|
|
|
|
var html = '';
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2013-04-14 13:47:09 -07:00
|
|
|
|
var casts = item.People || [];
|
2013-03-26 22:20:46 -07:00
|
|
|
|
|
|
|
|
|
for (var i = 0, length = casts.length; i < length; i++) {
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && i >= limit) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-22 07:44:11 -07:00
|
|
|
|
var cast = casts[i];
|
2015-08-20 20:21:27 -07:00
|
|
|
|
var href = isStatic ? '#' : 'itemdetails.html?id=' + cast.Id + '';
|
2015-07-03 04:51:45 -07:00
|
|
|
|
html += '<a class="tileItem smallPosterTileItem" href="' + href + '">';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
var imgUrl;
|
2015-07-06 00:06:09 -07:00
|
|
|
|
var lazy = true;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
if (cast.PrimaryImageTag) {
|
|
|
|
|
|
2014-08-18 18:42:53 -07:00
|
|
|
|
imgUrl = ApiClient.getScaledImageUrl(cast.Id, {
|
2014-04-11 08:36:25 -07:00
|
|
|
|
width: 100,
|
2013-05-11 23:05:51 -07:00
|
|
|
|
tag: cast.PrimaryImageTag,
|
2015-05-10 06:06:12 -07:00
|
|
|
|
type: "primary",
|
|
|
|
|
minScale: 2
|
2013-05-11 23:05:51 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
imgUrl = "css/images/items/list/person.png";
|
2015-07-06 00:06:09 -07:00
|
|
|
|
lazy = false;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-06 00:06:09 -07:00
|
|
|
|
if (lazy) {
|
|
|
|
|
html += '<div class="tileImage lazy" data-src="' + imgUrl + '"></div>';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<div class="tileImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="tileContent">';
|
|
|
|
|
|
|
|
|
|
html += '<p>' + cast.Name + '</p>';
|
|
|
|
|
|
2014-09-17 18:26:23 -07:00
|
|
|
|
var role = cast.Role ? Globalize.translate('ValueAsRole', cast.Role) : cast.Type;
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2013-05-18 10:07:20 -07:00
|
|
|
|
if (role == "GuestStar") {
|
2014-09-17 18:26:23 -07:00
|
|
|
|
role = Globalize.translate('ValueGuestStar');
|
2013-05-18 10:07:20 -07:00
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2013-05-21 18:52:06 -07:00
|
|
|
|
role = role || "";
|
|
|
|
|
|
|
|
|
|
var maxlength = 40;
|
|
|
|
|
|
|
|
|
|
if (role.length > maxlength) {
|
|
|
|
|
role = role.substring(0, maxlength - 3) + '...';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<p>' + role + '</p>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
2013-03-26 22:20:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && casts.length > limit) {
|
2015-08-20 10:59:17 -07:00
|
|
|
|
html += '<p style="margin: 0;padding-left:5px;"><paper-button raised class="more morePeople">' + Globalize.translate('ButtonMore') + '</paper-button></p>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var castContent = page.querySelector('#castContent');
|
|
|
|
|
castContent.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(castContent);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function play(startPosition) {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2014-03-29 08:40:32 -07:00
|
|
|
|
MediaController.play({
|
|
|
|
|
items: [currentItem],
|
|
|
|
|
startPositionTicks: startPosition
|
|
|
|
|
});
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2014-03-19 10:44:55 -07:00
|
|
|
|
function splitVersions(page) {
|
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
2014-03-22 09:16:43 -07:00
|
|
|
|
Dashboard.confirm("Are you sure you wish to split the media sources into separate items?", "Split Media Apart", function (confirmResult) {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
if (confirmResult) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2014-07-01 22:16:59 -07:00
|
|
|
|
ApiClient.ajax({
|
2014-03-19 10:44:55 -07:00
|
|
|
|
type: "DELETE",
|
2014-03-22 09:16:43 -07:00
|
|
|
|
url: ApiClient.getUrl("Videos/" + id + "/AlternateSources")
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
}).done(function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function playTrailer(page) {
|
|
|
|
|
|
|
|
|
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).done(function (trailers) {
|
|
|
|
|
|
2014-03-29 08:40:32 -07:00
|
|
|
|
MediaController.play({ items: trailers });
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
function onItemDeleted(e, itemId) {
|
2015-08-02 19:12:52 -07:00
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
if (currentItem && currentItem.Id == itemId) {
|
2015-08-02 19:12:52 -07:00
|
|
|
|
if (currentItem.Type == 'Recording') {
|
|
|
|
|
Dashboard.navigate('livetv.html');
|
|
|
|
|
} else {
|
|
|
|
|
Dashboard.navigate('index.html');
|
|
|
|
|
}
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
function playCurrentItem(button) {
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
if (currentItem.Type == 'Program') {
|
2013-04-04 10:27:36 -07:00
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).done(function (channel) {
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.showPlayMenu(null, channel.Id, channel.Type, false, channel.MediaType, (channel.UserData || {}).PlaybackPositionTicks);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var userdata = currentItem.UserData || {};
|
|
|
|
|
|
|
|
|
|
var mediaType = currentItem.MediaType;
|
|
|
|
|
|
|
|
|
|
if (currentItem.Type == "MusicArtist" || currentItem.Type == "MusicAlbum") {
|
|
|
|
|
mediaType = "Audio";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.showPlayMenu(button, currentItem.Id, currentItem.Type, currentItem.IsFolder, mediaType, userdata.PlaybackPositionTicks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteTimer(page, id) {
|
|
|
|
|
|
|
|
|
|
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation'), function (result) {
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.cancelLiveTvTimer(id).done(function () {
|
2013-08-08 07:53:25 -07:00
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
2013-08-23 19:53:30 -07:00
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
reload(page);
|
|
|
|
|
});
|
2013-08-08 07:53:25 -07:00
|
|
|
|
}
|
2013-08-23 19:53:30 -07:00
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageinitdepends', "#itemDetailPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('.btnPlay', page).on('click', function () {
|
|
|
|
|
playCurrentItem(this);
|
2013-04-14 08:14:10 -07:00
|
|
|
|
});
|
2013-04-10 22:42:34 -07:00
|
|
|
|
|
2014-04-07 21:17:18 -07:00
|
|
|
|
$('.btnPlayTrailer', page).on('click', function () {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
playTrailer(page);
|
2014-01-10 06:52:01 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-03-19 10:44:55 -07:00
|
|
|
|
$('.btnSplitVersions', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
splitVersions(page);
|
|
|
|
|
});
|
|
|
|
|
|
2014-07-19 21:46:29 -07:00
|
|
|
|
$('.btnSync', page).on('click', function () {
|
|
|
|
|
|
2014-12-12 20:56:30 -07:00
|
|
|
|
SyncManager.showMenu({
|
|
|
|
|
items: [currentItem]
|
|
|
|
|
});
|
2014-07-19 21:46:29 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
$('.btnRecord,.btnFloatingRecord', page).on('click', function () {
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
|
|
|
|
Dashboard.navigate('livetvnewrecording.html?programid=' + id);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.btnCancelRecording', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
deleteTimer(page, currentItem.TimerId);
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-30 16:59:45 -07:00
|
|
|
|
$('.btnShare', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
require(['sharingmanager'], function () {
|
|
|
|
|
SharingManager.showMenu(Dashboard.getCurrentUserId(), currentItem.Id);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2014-08-07 21:36:51 -07:00
|
|
|
|
$('.btnMoreCommands', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
var button = this;
|
|
|
|
|
|
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
$('.childrenItemsContainer', page).on('playallfromhere', function (e, index) {
|
|
|
|
|
|
2015-01-29 23:32:20 -07:00
|
|
|
|
LibraryBrowser.playAllFromHere(_childrenItemsFunction, index);
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
|
|
|
|
}).on('queueallfromhere', function (e, index) {
|
|
|
|
|
|
2015-01-29 23:32:20 -07:00
|
|
|
|
LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index);
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
$(page).on("click", ".moreScenes", function () {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
renderScenes(page, currentItem, user);
|
|
|
|
|
});
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}).on("click", ".morePeople", function () {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
renderCast(page, currentItem, getContext(currentItem));
|
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}).on("click", ".moreSpecials", function () {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
renderSpecials(page, currentItem, user);
|
|
|
|
|
});
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}).on("click", ".moreCriticReviews", function () {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
renderCriticReviews(page, currentItem);
|
|
|
|
|
});
|
2014-02-17 20:02:41 -07:00
|
|
|
|
|
2015-07-14 09:39:34 -07:00
|
|
|
|
var btnMore = page.querySelectorAll('.btnMoreCommands iron-icon');
|
|
|
|
|
for (var i = 0, length = btnMore.length; i < length; i++) {
|
|
|
|
|
btnMore[i].icon = AppInfo.moreIcon;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}).on('pagebeforeshowready', "#itemDetailPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
reload(page);
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
Events.on(ApiClient, 'websocketmessage', onWebSocketMessage);
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted);
|
2014-10-06 16:58:46 -07:00
|
|
|
|
|
2015-06-20 17:49:42 -07:00
|
|
|
|
}).on('pagebeforehide', "#itemDetailPage", function () {
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2015-06-29 11:45:42 -07:00
|
|
|
|
Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted);
|
2014-10-06 16:58:46 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
currentItem = null;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
Events.off(ApiClient, 'websocketmessage', onWebSocketMessage);
|
2015-08-18 10:54:29 -07:00
|
|
|
|
LibraryMenu.setTransparentMenu(false);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
});
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function itemDetailPage() {
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var self = this;
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
self.play = play;
|
2015-07-03 04:51:45 -07:00
|
|
|
|
self.setInitialCollapsibleState = setInitialCollapsibleState;
|
|
|
|
|
self.renderDetails = renderDetails;
|
|
|
|
|
self.renderCriticReviews = renderCriticReviews;
|
|
|
|
|
self.renderCast = renderCast;
|
|
|
|
|
self.renderScenes = renderScenes;
|
|
|
|
|
self.renderMediaSources = renderMediaSources;
|
2013-04-09 11:38:58 -07:00
|
|
|
|
}
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
window.ItemDetailPage = new itemDetailPage();
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, LibraryBrowser, window);
|