2016-07-18 20:57:55 -07:00
|
|
|
|
define(['jQuery', 'libraryBrowser'], function ($, libraryBrowser) {
|
2016-10-22 22:11:46 -07:00
|
|
|
|
'use strict';
|
2015-07-03 04:51:45 -07:00
|
|
|
|
|
|
|
|
|
var currentItem;
|
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl('Social/Shares/Public/' + id + '/Item')).then(function (item) {
|
2015-07-03 04:51:45 -07:00
|
|
|
|
|
|
|
|
|
reloadFromItem(page, item);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reloadFromItem(page, item) {
|
|
|
|
|
|
|
|
|
|
currentItem = item;
|
|
|
|
|
|
2016-07-18 20:57:55 -07:00
|
|
|
|
libraryBrowser.renderName(item, $('.itemName', page)[0], false);
|
|
|
|
|
libraryBrowser.renderParentName(item, $('.parentName', page)[0]);
|
|
|
|
|
libraryBrowser.renderDetailPageBackdrop(page, item);
|
2015-07-03 04:51:45 -07:00
|
|
|
|
|
|
|
|
|
renderImage(page, item);
|
|
|
|
|
|
|
|
|
|
setInitialCollapsibleState(page, item);
|
|
|
|
|
ItemDetailPage.renderDetails(page, item, null, true);
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setInitialCollapsibleState(page, item) {
|
|
|
|
|
|
|
|
|
|
$('.collectionItems', page).empty();
|
|
|
|
|
|
|
|
|
|
if (item.MediaSources && item.MediaSources.length) {
|
|
|
|
|
ItemDetailPage.renderMediaSources(page, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var chapters = item.Chapters || [];
|
|
|
|
|
|
2016-07-26 10:21:27 -07:00
|
|
|
|
if (!chapters.length) {
|
2015-07-03 04:51:45 -07:00
|
|
|
|
$('#scenesCollapsible', page).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('#scenesCollapsible', page).show();
|
|
|
|
|
ItemDetailPage.renderScenes(page, item, null, 3, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!item.People || !item.People.length) {
|
|
|
|
|
$('#castCollapsible', page).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('#castCollapsible', page).show();
|
|
|
|
|
ItemDetailPage.renderCast(page, item, null, 6, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ItemDetailPage.renderCriticReviews(page, item, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderImage(page, item) {
|
2016-07-18 20:57:55 -07:00
|
|
|
|
libraryBrowser.renderDetailImage(page.querySelector('.detailImageContainer'), item, false);
|
2015-07-03 04:51:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#publicSharedItemPage", function () {
|
2015-07-03 04:51:45 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$(page).on("click", ".moreScenes", function () {
|
|
|
|
|
|
|
|
|
|
ItemDetailPage.renderScenes(page, currentItem, null, null, true);
|
|
|
|
|
|
|
|
|
|
}).on("click", ".morePeople", function () {
|
|
|
|
|
|
|
|
|
|
ItemDetailPage.renderCast(page, currentItem, null, null, true);
|
|
|
|
|
|
|
|
|
|
}).on("click", ".moreCriticReviews", function () {
|
|
|
|
|
|
|
|
|
|
ItemDetailPage.renderCriticReviews(page, currentItem);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#publicSharedItemPage", function () {
|
2015-07-03 04:51:45 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|