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

601 lines
18 KiB
JavaScript
Raw Normal View History

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
2013-04-10 14:14:25 -07:00
function reload(page) {
2013-03-06 16:28:43 -07:00
2013-02-20 18:33:05 -07:00
var id = getParameterByName('id');
Dashboard.showLoadingMsg();
2013-04-10 14:14:25 -07:00
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
currentItem = item;
2013-02-20 18:33:05 -07:00
2013-04-22 07:44:11 -07:00
renderHeader(page, item);
2013-04-10 14:14:25 -07:00
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
2013-05-04 21:49:49 -07:00
LibraryBrowser.renderTitle(item, $('#itemName', page), $('#parentName', page), $('#grandParentName', page));
2013-04-10 14:14:25 -07:00
2013-04-23 07:46:27 -07:00
var context = getContext(item);
setInitialCollapsibleState(page, item, context);
renderDetails(page, item, context);
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
if (MediaPlayer.canPlay(item)) {
$('#playButtonContainer', page).show();
2013-04-10 14:14:25 -07:00
} else {
$('#playButtonContainer', page).hide();
2013-04-10 14:14:25 -07:00
}
2013-04-17 18:32:38 -07:00
2013-05-04 21:49:49 -07:00
Dashboard.getCurrentUser().done(function (user) {
if (user.Configuration.IsAdministrator) {
$('#editButtonContainer', page).show();
} else {
$('#editButtonContainer', page).hide();
}
});
2013-04-30 20:28:26 -07:00
$(".autoNumeric").autoNumeric('init');
2013-05-10 05:18:07 -07:00
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("Context", [item.Type, item.Id, context].join('|'));
}
2013-04-10 14:14:25 -07:00
Dashboard.hideLoadingMsg();
});
}
2013-04-24 13:28:42 -07:00
2013-04-23 07:46:27 -07:00
function getContext(item) {
// should return either movies, tv, music or games
2013-04-24 13:28:42 -07:00
2013-04-23 07:46:27 -07:00
if (item.Type == "Episode" || item.Type == "Series" || item.Type == "Season") {
return "tv";
}
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
return "movies";
}
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "Artist") {
return "music";
}
if (item.MediaType == "Game") {
return "games";
}
return "";
}
2013-04-22 07:44:11 -07:00
function enableCustomHeader(page, text) {
var elem = $('.libraryPageHeader', page).show();
$('span', elem).html(text);
}
function renderHeader(page, item) {
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
enableCustomHeader(page, "Movies");
$('#standardLogo', page).hide();
}
else if (item.Type == "Episode" || item.Type == "Season" || item.Type == "Series") {
enableCustomHeader(page, "TV Shows");
$('#standardLogo', page).hide();
}
2013-04-22 08:10:54 -07:00
else if (item.Type == "Audio" || item.Type == "MusicAlbum") {
2013-04-22 07:44:11 -07:00
enableCustomHeader(page, "Music");
$('#standardLogo', page).hide();
}
2013-04-28 11:47:19 -07:00
else if (item.MediaType == "Game" || item.Type == "GamePlatform") {
2013-04-24 13:28:42 -07:00
enableCustomHeader(page, "Games");
$('#standardLogo', page).hide();
}
2013-04-22 07:44:11 -07:00
else {
$('.libraryPageHeader', page).hide();
$('#standardLogo', page).show();
}
2013-04-28 11:47:19 -07:00
$('.itemTabs', page).hide();
2013-04-22 08:10:54 -07:00
if (item.Type == "MusicAlbum") {
$('#albumTabs', page).show();
}
2013-04-22 07:44:11 -07:00
if (item.Type == "Audio") {
$('#songTabs', page).show();
}
if (item.Type == "Movie") {
$('#movieTabs', page).show();
}
2013-04-24 13:28:42 -07:00
if (item.MediaType == "Game") {
$('#gameTabs', page).show();
2013-04-28 11:47:19 -07:00
}
if (item.Type == "GamePlatform") {
$('#gameSystemTabs', page).show();
2013-04-24 13:28:42 -07:00
}
2013-04-22 07:44:11 -07:00
if (item.Type == "BoxSet") {
$('#boxsetTabs', page).show();
}
2013-04-28 11:47:19 -07:00
2013-04-22 07:44:11 -07:00
if (item.Type == "Trailer") {
$('#trailerTabs', page).show();
}
2013-04-28 11:47:19 -07:00
2013-04-22 07:44:11 -07:00
if (item.Type == "Episode" || item.Type == "Season" || item.Type == "Series") {
$('#tvShowsTabs', page).show();
}
}
2013-04-23 07:46:27 -07:00
function setInitialCollapsibleState(page, item, context) {
2013-04-14 08:14:10 -07:00
2013-04-22 20:56:11 -07:00
if (item.ChildCount && item.Type == "MusicAlbum") {
$('#itemSongs', page).show();
$('#childrenCollapsible', page).hide();
renderChildren(page, item);
}
else if (item.ChildCount) {
$('#itemSongs', page).hide();
2013-04-22 07:44:11 -07:00
$('#childrenCollapsible', page).show();
renderChildren(page, item);
2013-04-22 20:56:11 -07:00
}
else {
$('#itemSongs', page).hide();
2013-04-22 07:44:11 -07:00
$('#childrenCollapsible', page).hide();
}
if (LibraryBrowser.shouldDisplayGallery(item)) {
$('#galleryCollapsible', page).show();
renderGallery(page, item);
} else {
$('#galleryCollapsible', page).hide();
}
2013-03-26 16:57:18 -07:00
if (!item.MediaStreams || !item.MediaStreams.length) {
$('#mediaInfoCollapsible', page).hide();
2013-03-29 07:12:14 -07:00
} else {
2013-03-26 16:57:18 -07:00
$('#mediaInfoCollapsible', page).show();
2013-04-22 07:44:11 -07:00
renderMediaInfo(page, item);
2013-03-26 16:57:18 -07:00
}
if (!item.Chapters || !item.Chapters.length) {
2013-03-26 14:32:01 -07:00
$('#scenesCollapsible', page).hide();
} else {
2013-03-26 15:53:06 -07:00
$('#scenesCollapsible', page).show();
2013-04-22 07:44:11 -07:00
renderScenes(page, item);
}
if (!item.LocalTrailerCount || item.LocalTrailerCount == 0) {
2013-03-26 14:32:01 -07:00
$('#trailersCollapsible', page).hide();
} else {
2013-03-26 15:53:06 -07:00
$('#trailersCollapsible', page).show();
2013-04-22 07:44:11 -07:00
renderTrailers(page, item);
}
if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0) {
2013-03-26 14:32:01 -07:00
$('#specialsCollapsible', page).hide();
} else {
2013-03-26 15:53:06 -07:00
$('#specialsCollapsible', page).show();
2013-04-22 07:44:11 -07:00
renderSpecials(page, item);
}
2013-03-26 22:20:46 -07:00
if (!item.People || !item.People.length) {
$('#castCollapsible', page).hide();
} else {
$('#castCollapsible', page).show();
2013-04-23 07:46:27 -07:00
renderCast(page, item, context);
2013-03-26 22:20:46 -07:00
}
2013-04-24 09:03:10 -07:00
$('#themeSongsCollapsible', page).hide();
$('#themeVideosCollapsible', page).hide();
2013-04-24 09:03:10 -07:00
2013-04-24 09:37:12 -07:00
ApiClient.getThemeSongs(Dashboard.getCurrentUserId(), item.Id).done(function (result) {
renderThemeSongs(page, item, result);
2013-04-24 09:03:10 -07:00
});
2013-04-28 10:21:56 -07:00
ApiClient.getThemeVideos(Dashboard.getCurrentUserId(), item.Id).done(function (result) {
renderThemeVideos(page, item, result);
2013-04-28 10:21:56 -07:00
});
2013-04-10 14:14:25 -07:00
}
2013-04-23 07:46:27 -07:00
function renderDetails(page, item, context) {
2013-02-20 18:33:05 -07:00
if (item.Taglines && item.Taglines.length) {
$('#itemTagline', page).html(item.Taglines[0]).show();
} else {
$('#itemTagline', page).hide();
}
2013-04-21 21:38:03 -07:00
LibraryBrowser.renderOverview($('#itemOverview', page), item);
2013-02-20 18:33:05 -07:00
2013-05-05 21:50:40 -07:00
if (item.CommunityRating || item.CriticRating) {
2013-05-05 20:58:45 -07:00
$('#itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
2013-02-20 18:33:05 -07:00
} else {
$('#itemCommunityRating', page).hide();
}
if (item.Type != "Episode" && item.Type != "Movie") {
2013-05-04 12:53:13 -07:00
var premiereDateElem = $('#itemPremiereDate', page).show();
LibraryBrowser.renderPremiereDate(premiereDateElem, item);
} else {
$('#itemPremiereDate', page).hide();
}
2013-04-12 08:25:00 -07:00
LibraryBrowser.renderBudget($('#itemBudget', page), item);
2013-04-18 07:05:38 -07:00
LibraryBrowser.renderRevenue($('#itemRevenue', page), item);
2013-04-12 08:25:00 -07:00
2013-04-10 14:14:25 -07:00
$('#itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
2013-02-20 18:33:05 -07:00
2013-04-23 07:46:27 -07:00
LibraryBrowser.renderGenres($('#itemGenres', page), item, context);
LibraryBrowser.renderStudios($('#itemStudios', page), item, context);
2013-04-10 14:14:25 -07:00
renderUserDataIcons(page, item);
2013-04-14 08:14:10 -07:00
LibraryBrowser.renderLinks($('#itemLinks', page), item);
2013-05-06 20:00:24 -07:00
2013-05-05 21:50:40 -07:00
if (item.CriticRatingSummary) {
$('#criticRatingSummary', page).show();
$('#criticRatingSummaryText', page).html(item.CriticRatingSummary);
} else {
$('#criticRatingSummary', page).hide();
}
2013-05-06 20:00:24 -07:00
renderTags(page, item);
}
function renderTags(page, item) {
if (item.Tags && item.Tags.length) {
var html = '';
for (var i = 0, length = item.Tags.length; i < length; i++) {
html += '<div class="itemTag">' + item.Tags[i] + '</div>';
}
$('#itemTags', page).show().html(html);
} else {
$('#itemTags', page).hide();
}
2013-04-10 14:14:25 -07:00
}
2013-04-22 07:44:11 -07:00
function renderChildren(page, item) {
ApiClient.getItems(Dashboard.getCurrentUserId(), {
ParentId: getParameterByName('id'),
SortBy: "SortName",
2013-04-25 20:31:10 -07:00
Fields: "PrimaryImageAspectRatio,ItemCounts,DisplayMediaType,DateCreated,UserData,AudioInfo"
2013-04-22 07:44:11 -07:00
}).done(function (result) {
2013-04-22 13:06:43 -07:00
if (item.Type == "MusicAlbum") {
2013-04-22 07:44:11 -07:00
2013-04-25 20:31:10 -07:00
$('#itemSongs', page).html(LibraryBrowser.getSongTableHtml(result.Items, { showArtist: true })).trigger('create');
2013-04-22 13:06:43 -07:00
} else {
2013-04-28 11:47:19 -07:00
2013-05-04 11:21:29 -07:00
var shape = "smallPoster";
2013-05-04 11:21:29 -07:00
if (item.Type == "Season") {
shape = "smallBackdrop";
}
2013-04-28 11:47:19 -07:00
2013-04-22 13:06:43 -07:00
var html = LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
2013-04-28 11:47:19 -07:00
useAverageAspectRatio: true,
shape: shape
2013-04-22 13:06:43 -07:00
});
$('#childrenContent', page).html(html);
}
2013-04-22 07:44:11 -07:00
});
if (item.Type == "Season") {
$('#childrenTitle', page).html('Episodes (' + item.ChildCount + ')');
}
else if (item.Type == "Series") {
$('#childrenTitle', page).html('Seasons (' + item.ChildCount + ')');
}
else if (item.Type == "BoxSet") {
$('#childrenTitle', page).html('Movies (' + item.ChildCount + ')');
}
2013-04-22 08:10:54 -07:00
else if (item.Type == "MusicAlbum") {
2013-04-22 13:06:43 -07:00
$('#childrenTitle', page).html('Tracks (' + item.ChildCount + ')');
2013-04-22 08:10:54 -07:00
}
2013-04-28 11:47:19 -07:00
else if (item.Type == "GamePlatform") {
$('#childrenTitle', page).html('Games (' + item.ChildCount + ')');
}
2013-04-22 07:44:11 -07:00
else {
$('#childrenTitle', page).html('Items (' + item.ChildCount + ')');
}
}
2013-04-10 14:14:25 -07:00
function renderUserDataIcons(page, item) {
$('#itemRatings', page).html(LibraryBrowser.getUserDataIconsHtml(item));
}
2013-04-24 13:28:42 -07:00
2013-04-24 09:37:12 -07:00
function renderThemeSongs(page, item, result) {
2013-04-24 13:28:42 -07:00
2013-04-24 09:37:12 -07:00
if (result.Items.length) {
2013-04-24 13:28:42 -07:00
2013-04-24 09:03:10 -07:00
$('#themeSongsCollapsible', page).show();
2013-04-24 13:28:42 -07:00
$('#themeSongsContent', page).html(LibraryBrowser.getSongTableHtml(result.Items, { showArtist: true, showAlbum: true })).trigger('create');
2013-04-24 09:03:10 -07:00
}
}
2013-02-20 18:33:05 -07:00
function renderThemeVideos(page, item, result) {
2013-04-28 10:21:56 -07:00
if (result.Items.length) {
$('#themeVideosCollapsible', page).show();
2013-04-28 10:21:56 -07:00
$('#themeVideosContent', page).html(getVideosHtml(result.Items)).trigger('create');
2013-04-28 10:21:56 -07:00
}
}
2013-04-10 14:14:25 -07:00
function renderScenes(page, item) {
2013-02-20 18:33:05 -07:00
var html = '';
2013-04-10 14:14:25 -07:00
var chapters = item.Chapters || {};
2013-02-20 18:33:05 -07:00
for (var i = 0, length = chapters.length; i < length; i++) {
var chapter = chapters[i];
2013-04-10 10:11:23 -07:00
var chapterName = chapter.Name || "Chapter " + i;
2013-05-03 13:50:13 -07:00
html += '<a class="posterItem smallBackdropPosterItem" href="#play-Chapter-' + i + '" onclick="ItemDetailPage.play(' + chapter.StartPositionTicks + ');">';
var imgUrl;
if (chapter.ImageTag) {
2013-05-03 13:50:13 -07:00
imgUrl = ApiClient.getImageUrl(item.Id, {
2013-04-22 07:44:11 -07:00
width: 400,
tag: chapter.ImageTag,
type: "Chapter",
index: i
});
} else {
2013-05-03 13:50:13 -07:00
imgUrl = "css/images/items/list/chapter.png";
}
2013-02-20 18:33:05 -07:00
2013-05-03 13:50:13 -07:00
html += '<div class="posterItemImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
html += '<div class="posterItemText">' + chapterName + '</div>';
html += '<div class="posterItemText">';
2013-02-20 18:33:05 -07:00
2013-03-26 15:53:06 -07:00
html += ticks_to_human(chapter.StartPositionTicks);
html += '</div>';
html += '</a>';
2013-02-20 18:33:05 -07:00
}
$('#scenesContent', page).html(html);
2013-04-10 14:14:25 -07:00
}
2013-03-06 16:28:43 -07:00
2013-04-10 14:14:25 -07:00
function renderGallery(page, item) {
2013-02-20 18:33:05 -07:00
2013-04-15 18:09:27 -07:00
var html = LibraryBrowser.getGalleryHtml(item);
2013-04-15 15:13:55 -07:00
$('#galleryContent', page).html(html).trigger('create');
2013-04-10 14:14:25 -07:00
}
2013-04-10 14:14:25 -07:00
function renderMediaInfo(page, item) {
2013-03-26 14:32:01 -07:00
2013-03-26 16:57:18 -07:00
var html = '';
for (var i = 0, length = item.MediaStreams.length; i < length; i++) {
var stream = item.MediaStreams[i];
2013-04-09 11:01:39 -07:00
if (stream.Type == "Data") {
continue;
}
2013-04-09 11:38:58 -07:00
var type;
if (item.MediaType == "Audio" && stream.Type == "Video") {
type = "Embedded Image";
} else {
type = stream.Type;
}
2013-04-09 11:38:58 -07:00
html += '<div class="mediaInfoStream">';
2013-03-26 16:57:18 -07:00
2013-04-09 11:38:58 -07:00
html += '<p class="mediaInfoStreamType">' + type + '</p>';
2013-04-09 19:28:24 -07:00
2013-04-09 11:38:58 -07:00
html += '<ul class="mediaInfoDetails">';
2013-04-09 19:28:24 -07:00
2013-04-09 11:38:58 -07:00
if (stream.Codec) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Codec: </span> ' + stream.Codec + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.Profile) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Profile: </span> ' + stream.Profile + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.Level) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Level: </span> ' + stream.Level + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.Language) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Language: </span> ' + stream.Language + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.Width) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Width: </span> ' + stream.Width + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.Height) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Height: </span> ' + stream.Height + '</li>';
2013-04-09 11:38:58 -07:00
}
if (stream.AspectRatio) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Aspect Ratio: </span> ' + stream.AspectRatio + '</li>';
2013-04-09 11:38:58 -07:00
}
2013-04-18 09:12:07 -07:00
if (stream.BitRate) {
html += '<li><span class="mediaInfoLabel">Bitrate: </span> <span class="autoNumeric" data-a-pad="false">' + (parseInt(stream.BitRate / 1000)) + ' kbps</span></li>';
}
if (stream.Channels) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Channels: </span> ' + stream.Channels + '</li>';
2013-03-26 16:57:18 -07:00
}
2013-04-09 12:38:19 -07:00
if (stream.SampleRate) {
html += '<li><span class="mediaInfoLabel">Sample Rate: </span> <span class="autoNumeric" data-a-pad="false">' + stream.SampleRate + ' khz</span></li>';
2013-04-09 12:38:19 -07:00
}
2013-04-09 11:38:58 -07:00
var framerate = stream.AverageFrameRate || stream.RealFrameRate;
2013-04-09 19:28:24 -07:00
2013-04-09 11:38:58 -07:00
if (framerate) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Framerate: </span> ' + framerate + '</li>';
2013-04-09 11:38:58 -07:00
}
2013-04-09 19:28:24 -07:00
2013-04-09 12:38:19 -07:00
if (stream.PixelFormat) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Pixel Format: </span> ' + stream.PixelFormat + '</li>';
2013-04-09 12:38:19 -07:00
}
2013-05-04 21:49:49 -07:00
if (stream.IsDefault || stream.IsForced || stream.IsExternal) {
var vals = [];
if (stream.IsDefault) {
vals.push("Default");
}
if (stream.IsForced) {
vals.push("Forced");
}
if (stream.IsExternal) {
vals.push("External");
}
html += '<li><span class="mediaInfoLabel">Flags: </span> ' + vals.join(", ") + '</li>';
2013-04-09 11:38:58 -07:00
}
2013-05-04 21:49:49 -07:00
2013-04-09 11:38:58 -07:00
if (stream.Path) {
2013-05-04 21:49:49 -07:00
html += '<li><span class="mediaInfoLabel">Path: </span> ' + stream.Path + '</li>';
2013-03-26 16:57:18 -07:00
}
2013-04-09 11:38:58 -07:00
html += '</ul>';
2013-04-09 11:38:58 -07:00
html += '</div>';
2013-02-20 18:33:05 -07:00
}
2013-03-26 16:57:18 -07:00
$('#mediaInfoContent', page).html(html).trigger('create');
2013-04-10 14:14:25 -07:00
}
2013-04-28 10:21:56 -07:00
function getVideosHtml(items) {
var html = '';
2013-04-28 10:21:56 -07:00
for (var i = 0, length = items.length; i < length; i++) {
2013-04-28 10:21:56 -07:00
var item = items[i];
2013-05-03 13:50:13 -07:00
html += '<a class="posterItem smallBackdropPosterItem" href="#" onclick="MediaPlayer.playById(\'' + item.Id + '\');">';
2013-04-28 10:21:56 -07:00
var imageTags = item.ImageTags || {};
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
2013-04-28 10:39:16 -07:00
imgUrl = ApiClient.getImageUrl(item.Id, {
2013-04-28 10:21:56 -07:00
maxwidth: 500,
tag: imageTags.Primary,
type: "primary"
});
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-04-28 10:39:16 -07:00
html += '<div class="posterItemImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
html += '<div class="posterItemText">' + item.Name + '</div>';
html += '<div class="posterItemText">';
2013-04-28 10:21:56 -07:00
if (item.RunTimeTicks != "") {
html += ticks_to_human(item.RunTimeTicks);
}
else {
html += "&nbsp;";
}
html += '</div>';
2013-04-28 10:21:56 -07:00
html += '</a>';
2013-04-28 10:21:56 -07:00
}
2013-04-28 10:21:56 -07:00
return html;
}
function renderSpecials(page, item) {
ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), item.Id).done(function (specials) {
2013-04-28 10:21:56 -07:00
$('#specialsContent', page).html(getVideosHtml(specials));
});
2013-04-10 14:14:25 -07:00
}
2013-04-10 14:14:25 -07:00
function renderTrailers(page, item) {
2013-04-10 14:14:25 -07:00
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), item.Id).done(function (trailers) {
2013-04-28 10:21:56 -07:00
$('#trailersContent', page).html(getVideosHtml(trailers));
});
2013-04-10 14:14:25 -07:00
}
2013-03-26 22:20:46 -07:00
2013-04-23 07:46:27 -07:00
function renderCast(page, item, context) {
2013-03-26 22:20:46 -07:00
var html = '';
2013-04-10 14:14:25 -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-04-22 07:44:11 -07:00
var cast = casts[i];
2013-03-26 22:20:46 -07:00
2013-04-23 07:46:27 -07:00
html += LibraryBrowser.createCastImage(cast, context);
2013-03-26 22:20:46 -07:00
}
$('#castContent', page).html(html);
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
2013-04-10 14:14:25 -07:00
MediaPlayer.play([currentItem], startPosition);
}
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
$(document).on('pageinit', "#itemDetailPage", function () {
2013-03-29 07:12:14 -07:00
2013-04-10 14:14:25 -07:00
var page = this;
2013-04-04 10:27:36 -07:00
2013-04-10 14:14:25 -07:00
$('#btnPlay', page).on('click', function () {
var userdata = currentItem.UserData || {};
2013-04-30 10:45:51 -07:00
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.MediaType, userdata.PlaybackPositionTicks);
2013-04-14 08:14:10 -07:00
});
$('#btnEdit', page).on('click', function () {
Dashboard.navigate("edititemmetadata.html?id=" + currentItem.Id);
});
2013-04-10 14:14:25 -07:00
}).on('pageshow', "#itemDetailPage", function () {
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
var page = this;
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
reload(page);
2013-03-28 22:51:45 -07:00
2013-04-10 14:14:25 -07:00
}).on('pagehide', "#itemDetailPage", function () {
2013-04-10 14:14:25 -07:00
currentItem = null;
});
2013-04-14 08:14:10 -07:00
2013-04-10 14:14:25 -07:00
function itemDetailPage() {
2013-04-10 14:14:25 -07:00
var self = this;
2013-04-10 14:14:25 -07:00
self.play = play;
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();
2013-02-20 18:33:05 -07:00
2013-04-10 14:14:25 -07:00
})(jQuery, document, LibraryBrowser, window);