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-10 14:14:25 -07:00
|
|
|
|
var name = item.Name;
|
2013-03-06 16:28:43 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (item.IndexNumber != null) {
|
|
|
|
|
name = item.IndexNumber + " - " + name;
|
|
|
|
|
}
|
|
|
|
|
if (item.ParentIndexNumber != null) {
|
|
|
|
|
name = item.ParentIndexNumber + "." + name;
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
Dashboard.setPageTitle(name);
|
2013-03-26 14:32:01 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#itemName', page).html(name);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (item.SeriesName || item.Album) {
|
|
|
|
|
var seriesName = item.SeriesName || item.Album;
|
|
|
|
|
$('#seriesName', page).html(seriesName).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setInitialCollapsibleState(page, item);
|
|
|
|
|
renderDetails(page, item);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (MediaPlayer.canPlay(item)) {
|
|
|
|
|
$('#btnPlayMenu', page).show();
|
|
|
|
|
$('#playButtonShadow', page).show();
|
2013-04-11 05:49:14 -07:00
|
|
|
|
$('#btnQueueMenu', page).hide();
|
2013-04-10 14:14:25 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#btnPlayMenu', page).hide();
|
|
|
|
|
$('#playButtonShadow', page).hide();
|
2013-04-10 23:22:34 -07:00
|
|
|
|
$('#btnQueueMenu', page).hide();
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function setInitialCollapsibleState(page, item) {
|
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-03-25 21:44:12 -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-03-25 21:44:12 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
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-03-26 11:51:52 -07:00
|
|
|
|
}
|
|
|
|
|
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-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();
|
|
|
|
|
}
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderDetails(page, item) {
|
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-03-26 15:53:06 -07:00
|
|
|
|
if (item.Overview || item.OverviewHtml) {
|
|
|
|
|
var overview = item.OverviewHtml || item.Overview;
|
|
|
|
|
|
|
|
|
|
$('#itemOverview', page).html(overview).show();
|
2013-03-29 07:12:14 -07:00
|
|
|
|
$('#itemOverview a').each(function () {
|
|
|
|
|
$(this).attr("target", "_blank");
|
2013-03-26 15:53:06 -07:00
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#itemOverview', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.CommunityRating) {
|
2013-04-10 06:53:44 -07:00
|
|
|
|
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#itemCommunityRating', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
LibraryBrowser.renderGenres($('#itemGenres', page), item);
|
|
|
|
|
LibraryBrowser.renderStudios($('#itemStudios', page), item);
|
|
|
|
|
renderUserDataIcons(page, item);
|
|
|
|
|
renderLinks(page, item);
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderLinks(page, item) {
|
|
|
|
|
if (item.ProviderIds) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#itemLinks', page).hide();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderUserDataIcons(page, item) {
|
|
|
|
|
$('#itemRatings', page).html(LibraryBrowser.getUserDataIconsHtml(item));
|
|
|
|
|
}
|
2013-02-20 18:33:05 -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
|
|
|
|
|
2013-03-25 21:44:12 -07:00
|
|
|
|
var chapters = item.Chapters || {};
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-03-25 21:44:12 -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-03-25 21:44:12 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="posterViewItem posterViewItemWithDualText">';
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<a href="#play-Chapter-' + i + '" onclick="ItemDetailPage.play(' + chapter.StartPositionTicks + ');">';
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
|
|
|
|
if (chapter.ImageTag) {
|
|
|
|
|
|
|
|
|
|
var imgUrl = ApiClient.getImageUrl(item.Id, {
|
|
|
|
|
width: 500,
|
|
|
|
|
tag: chapter.ImageTag,
|
|
|
|
|
type: "Chapter",
|
|
|
|
|
index: i
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-03-25 21:44:12 -07:00
|
|
|
|
html += '<img src="' + imgUrl + '" />';
|
|
|
|
|
} else {
|
2013-03-26 10:21:14 -07:00
|
|
|
|
html += '<img src="css/images/items/list/chapter.png"/>';
|
2013-03-25 21:44:12 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-10 10:11:23 -07:00
|
|
|
|
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + chapterName + '</div>';
|
2013-03-25 21:44:12 -07:00
|
|
|
|
html += '<div class="posterViewItemText">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-03-26 15:53:06 -07:00
|
|
|
|
html += ticks_to_human(chapter.StartPositionTicks);
|
|
|
|
|
|
2013-03-25 21:44:12 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
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
|
|
|
|
|
|
|
|
|
var imageTags = item.ImageTags || {};
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (imageTags.Logo) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Logo", item.ImageTags.Logo);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Thumb) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Thumb", item.ImageTags.Thumb);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Art) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Art", item.ImageTags.Art);
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Menu) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Menu", item.ImageTags.Menu);
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Disc) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Disc", item.ImageTags.Disc);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Box) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Box", item.ImageTags.Box);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.BackdropImageTags) {
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = item.BackdropImageTags.length; i < length; i++) {
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += createGalleryImage(item.Id, "Backdrop", item.BackdropImageTags[0], i);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-26 08:14:09 -07:00
|
|
|
|
$('#galleryContent', page).html(html).trigger('create');
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 08:14:09 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function createGalleryImage(itemId, type, tag, index) {
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2013-03-26 08:14:09 -07:00
|
|
|
|
var downloadWidth = 400;
|
|
|
|
|
var lightboxWidth = 800;
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
if (typeof (index) == "undefined") index = 0;
|
2013-03-26 08:14:09 -07:00
|
|
|
|
|
2013-03-26 22:36:41 -07:00
|
|
|
|
html += '<div class="posterViewItem" style="padding-bottom:0px;">';
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<a href="#pop_' + index + '_' + tag + '" data-transition="fade" data-rel="popup" data-position-to="window">';
|
2013-03-26 08:26:29 -07:00
|
|
|
|
html += '<img class="galleryImage" src="' + ApiClient.getImageUrl(itemId, {
|
2013-03-26 08:14:09 -07:00
|
|
|
|
type: type,
|
2013-03-27 19:20:48 -07:00
|
|
|
|
maxwidth: downloadWidth,
|
2013-03-26 08:14:09 -07:00
|
|
|
|
tag: tag,
|
|
|
|
|
index: index
|
|
|
|
|
}) + '" />';
|
2013-03-26 22:36:41 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<div class="galleryPopup" id="pop_' + index + '_' + tag + '" data-role="popup" data-theme="d" data-corners="false" data-overlay-theme="a">';
|
2013-03-26 08:14:09 -07:00
|
|
|
|
html += '<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>';
|
2013-03-26 08:26:29 -07:00
|
|
|
|
html += '<img class="" src="' + ApiClient.getImageUrl(itemId, {
|
2013-03-26 08:14:09 -07:00
|
|
|
|
type: type,
|
2013-03-26 15:53:06 -07:00
|
|
|
|
maxwidth: lightboxWidth,
|
2013-03-26 08:14:09 -07:00
|
|
|
|
tag: tag,
|
|
|
|
|
index: index
|
|
|
|
|
}) + '" />';
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
return html;
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 16:57:18 -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-03-27 12:23:42 -07:00
|
|
|
|
}
|
|
|
|
|
|
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) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Codec</span> ' + stream.Codec + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Profile) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Profile</span> ' + stream.Profile + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Level) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Level</span> ' + stream.Level + '</li>';
|
|
|
|
|
}
|
2013-03-27 12:23:42 -07:00
|
|
|
|
if (stream.Language) {
|
2013-04-09 11:38:58 -07:00
|
|
|
|
html += '<li><span class="mediaInfoLabel">Language</span> ' + stream.Language + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Width) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Width</span> ' + stream.Width + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Height) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Height</span> ' + stream.Height + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.AspectRatio) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Aspect Ratio</span> ' + stream.AspectRatio + '</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Bitrate) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Bitrate</span> ' + stream.Bitrate + '</li>';
|
2013-03-26 22:36:41 -07:00
|
|
|
|
}
|
|
|
|
|
if (stream.Channels) {
|
2013-04-09 11:38:58 -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> ' + stream.SampleRate + '</li>';
|
|
|
|
|
}
|
|
|
|
|
|
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) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Framerate</span> ' + framerate + '</li>';
|
|
|
|
|
}
|
2013-04-09 19:28:24 -07:00
|
|
|
|
|
2013-04-09 12:38:19 -07:00
|
|
|
|
if (stream.PixelFormat) {
|
|
|
|
|
html += '<li><span class="mediaInfoLabel">Pixel Format</span> ' + stream.PixelFormat + '</li>';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-09 11:38:58 -07:00
|
|
|
|
if (stream.IsDefault) {
|
|
|
|
|
html += '<li>Default</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.IsForced) {
|
|
|
|
|
html += '<li>Forced</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.IsExternal) {
|
|
|
|
|
html += '<li>External</li>';
|
|
|
|
|
}
|
|
|
|
|
if (stream.Path) {
|
|
|
|
|
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-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
|
|
|
|
}
|
|
|
|
|
|
2013-03-26 16:57:18 -07:00
|
|
|
|
$('#mediaInfoContent', page).html(html).trigger('create');
|
2013-04-09 11:38:58 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
$('#mediaInfoCollapsible', page).show();
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderSpecials(page, item) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), item.Id).done(function (specials) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
for (var i = 0, length = specials.length; i < length; i++) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var special = specials[i];
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<div class="posterViewItem posterViewItemWithDualText">';
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += '<a href="#play-Special-' + i + '" onclick="ItemDetailPage.playSpecial(' + i + ');">';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var imageTags = special.ImageTags || {};
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
if (imageTags.Primary) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var imgUrl = ApiClient.getImageUrl(special.Id, {
|
2013-03-26 14:32:01 -07:00
|
|
|
|
maxwidth: 500,
|
|
|
|
|
tag: imageTags.Primary,
|
|
|
|
|
type: "primary"
|
|
|
|
|
});
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<img src="' + imgUrl + '" />';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<img src="css/images/items/detail/video.png"/>';
|
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + special.Name + '</div>';
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<div class="posterViewItemText">';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (special.RunTimeTicks != "") {
|
|
|
|
|
html += ticks_to_human(special.RunTimeTicks);
|
2013-03-26 14:32:01 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
html += " ";
|
2013-03-26 14:32:01 -07:00
|
|
|
|
}
|
|
|
|
|
html += '</div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '</a>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '</div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#specialsContent', page).html(html);
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderTrailers(page, item) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), item.Id).done(function (trailers) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
for (var i = 0, length = trailers.length; i < length; i++) {
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var trailer = trailers[i];
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="posterViewItem posterViewItemWithDualText">';
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += '<a href="#play-Trailer-' + i + '" onclick="ItemDetailPage.playTrailer(' + i + ');">';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var imageTags = trailer.ImageTags || {};
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-03-26 14:32:01 -07:00
|
|
|
|
if (imageTags.Primary) {
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var imgUrl = ApiClient.getImageUrl(trailer.Id, {
|
2013-03-26 14:32:01 -07:00
|
|
|
|
maxwidth: 500,
|
|
|
|
|
tag: imageTags.Primary,
|
|
|
|
|
type: "primary"
|
2013-03-26 11:51:52 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
html += '<img src="' + imgUrl + '" />';
|
|
|
|
|
} else {
|
2013-03-26 14:32:01 -07:00
|
|
|
|
html += '<img src="css/images/items/detail/video.png"/>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + trailer.Name + '</div>';
|
2013-03-26 11:51:52 -07:00
|
|
|
|
html += '<div class="posterViewItemText">';
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (trailer.RunTimeTicks != "") {
|
|
|
|
|
html += ticks_to_human(trailer.RunTimeTicks);
|
2013-03-26 11:51:52 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
html += " ";
|
|
|
|
|
}
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#trailersContent', page).html(html);
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-26 22:20:46 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderCast(page, item) {
|
2013-03-26 22:20:46 -07:00
|
|
|
|
var html = '';
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2013-03-26 22:20:46 -07:00
|
|
|
|
var casts = item.People || {};
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = casts.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var cast = casts[i];
|
|
|
|
|
var role = cast.Role || cast.Type;
|
|
|
|
|
|
2013-03-29 07:12:14 -07:00
|
|
|
|
html += '<a href="itembynamedetails.html?person=' + cast.Name + '">';
|
2013-03-26 22:20:46 -07:00
|
|
|
|
html += '<div class="posterViewItem posterViewItemWithDualText">';
|
|
|
|
|
|
|
|
|
|
if (cast.PrimaryImageTag) {
|
|
|
|
|
|
|
|
|
|
var imgUrl = ApiClient.getPersonImageUrl(cast.Name, {
|
2013-03-27 05:42:06 -07:00
|
|
|
|
width: 185,
|
2013-03-26 22:20:46 -07:00
|
|
|
|
tag: cast.PrimaryImageTag,
|
|
|
|
|
type: "primary"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
html += '<img src="' + imgUrl + '" />';
|
|
|
|
|
} else {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
var style = "background-color:" + LibraryBrowser.getMetroColor(cast.Name) + ";";
|
2013-03-31 20:45:32 -07:00
|
|
|
|
|
2013-04-09 11:38:58 -07:00
|
|
|
|
html += '<img src="css/images/items/list/person.png" style="max-width:185px; ' + style + '"/>';
|
2013-03-26 22:20:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + cast.Name + '</div>';
|
|
|
|
|
html += '<div class="posterViewItemText">' + role + '</div>';
|
|
|
|
|
|
2013-03-27 21:27:15 -07:00
|
|
|
|
html += '</div></a>';
|
2013-03-26 22:20:46 -07:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#castContent', page).html(html);
|
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
|
|
|
|
$('#btnPlayMenu', page).on('click', function () {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var userdata = currentItem.UserData || {};
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 23:22:34 -07:00
|
|
|
|
if (userdata.PlaybackPositionTicks) {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var pos = $('#playMenuAnchor', page).offset();
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#playMenu', page).popup("open", {
|
|
|
|
|
x: pos.left + 125,
|
|
|
|
|
y: pos.top + 20
|
|
|
|
|
});
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 23:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
play();
|
|
|
|
|
}
|
2013-04-10 14:14:25 -07:00
|
|
|
|
});
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 23:22:34 -07:00
|
|
|
|
$('#btnQueueMenu', page).on('click', function () {
|
|
|
|
|
var pos = $('#queueMenuAnchor', page).offset();
|
|
|
|
|
|
|
|
|
|
$('#queueMenu', page).popup("open", {
|
|
|
|
|
x: pos.left + 165,
|
|
|
|
|
y: pos.top + 20
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#btnPlay', page).on('click', function () {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#playMenu', page).popup("close");
|
|
|
|
|
play();
|
|
|
|
|
});
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#btnResume', page).on('click', function () {
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#playMenu', page).popup("close");
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
var userdata = currentItem.UserData || {};
|
|
|
|
|
|
|
|
|
|
play(userdata.PlaybackPositionTicks);
|
|
|
|
|
});
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 22:42:34 -07:00
|
|
|
|
$('#btnQueue', page).on('click', function () {
|
|
|
|
|
|
2013-04-10 23:22:34 -07:00
|
|
|
|
$('#queueMenu', page).popup("close");
|
2013-04-10 22:42:34 -07:00
|
|
|
|
Playlist.add(currentItem);
|
|
|
|
|
});
|
|
|
|
|
|
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
|
|
|
|
$('#mediaInfoCollapsible', page).on('expand.lazyload', function () {
|
|
|
|
|
renderMediaInfo(page, currentItem);
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
});
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#scenesCollapsible', page).on('expand.lazyload', function () {
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
if (currentItem) {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
renderScenes(page, currentItem);
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#specialsCollapsible', page).on('expand.lazyload', function () {
|
|
|
|
|
renderSpecials(page, currentItem);
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#trailersCollapsible', page).on('expand.lazyload', function () {
|
|
|
|
|
renderTrailers(page, currentItem);
|
|
|
|
|
|
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#castCollapsible', page).on('expand.lazyload', function () {
|
|
|
|
|
renderCast(page, currentItem);
|
|
|
|
|
|
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
});
|
2013-03-29 07:12:14 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#galleryCollapsible', page).on('expand.lazyload', function () {
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
renderGallery(page, currentItem);
|
2013-03-28 22:51:45 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$(this).off('expand.lazyload');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).on('pagehide', "#itemDetailPage", function () {
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
currentItem = null;
|
|
|
|
|
var page = this;
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
$('#mediaInfoCollapsible', page).off('expand.lazyload');
|
|
|
|
|
$('#scenesCollapsible', page).off('expand.lazyload');
|
|
|
|
|
$('#specialsCollapsible', page).off('expand.lazyload');
|
|
|
|
|
$('#trailersCollapsible', page).off('expand.lazyload');
|
|
|
|
|
$('#castCollapsible', page).off('expand.lazyload');
|
|
|
|
|
$('#galleryCollapsible', page).off('expand.lazyload');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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;
|
2013-04-01 13:26:13 -07:00
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
self.playTrailer = function (index) {
|
|
|
|
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).done(function (trailers) {
|
|
|
|
|
MediaPlayer.play([trailers[index]]);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
self.playSpecial = function (index) {
|
|
|
|
|
ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), currentItem.Id).done(function (specials) {
|
|
|
|
|
MediaPlayer.play([specials[index]]);
|
|
|
|
|
});
|
|
|
|
|
};
|
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);
|