2016-09-17 22:52:10 -07:00
|
|
|
|
define(['layoutManager', 'cardBuilder', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'itemContextMenu', 'itemHelper', 'userdataButtons', 'dom', 'indicators', 'apphost', 'scrollStyles', 'emby-itemscontainer', 'emby-checkbox', 'emby-toggle'], function (layoutManager, cardBuilder, datetime, mediaInfo, backdrop, listView, itemContextMenu, itemHelper, userdataButtons, dom, indicators, appHost) {
|
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
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function getPromise(params) {
|
2013-03-06 16:28:43 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
var id = params.id;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-08-18 21:08:03 -07:00
|
|
|
|
if (id) {
|
|
|
|
|
return ApiClient.getItem(Dashboard.getCurrentUserId(), id);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
var name = params.genre;
|
2015-08-18 21:08:03 -07:00
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
name = params.musicgenre;
|
2015-08-18 21:08:03 -07:00
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
name = params.gamegenre;
|
2015-08-18 21:08:03 -07:00
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
name = params.musicartist;
|
2015-08-18 21:08:03 -07:00
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getArtist(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw new Error('Invalid request');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function reload(page, params) {
|
2015-08-18 21:08:03 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
getPromise(params).then(function (item) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
reloadFromItem(page, params, item);
|
2014-06-16 19:03:59 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-29 12:34:20 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
function hideAll(page, className, show) {
|
|
|
|
|
|
|
|
|
|
var i, length;
|
|
|
|
|
var elems = page.querySelectorAll('.' + className);
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
if (show) {
|
|
|
|
|
elems[i].classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
elems[i].classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-16 18:58:51 -07:00
|
|
|
|
function getContextMenuOptions(item, button) {
|
|
|
|
|
|
2016-08-12 08:54:37 -07:00
|
|
|
|
var options = {
|
2016-07-16 18:58:51 -07:00
|
|
|
|
item: item,
|
|
|
|
|
open: false,
|
|
|
|
|
play: false,
|
|
|
|
|
queue: false,
|
|
|
|
|
playAllFromHere: false,
|
|
|
|
|
queueAllFromHere: false,
|
|
|
|
|
positionTo: button
|
|
|
|
|
};
|
2016-08-12 08:54:37 -07:00
|
|
|
|
|
|
|
|
|
if (appHost.supports('sync')) {
|
|
|
|
|
// Will be displayed via button
|
|
|
|
|
options.syncLocal = false;
|
|
|
|
|
} else {
|
|
|
|
|
// Will be displayed via button
|
|
|
|
|
options.sync = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateSyncStatus(page, item) {
|
|
|
|
|
|
|
|
|
|
var i, length;
|
2016-08-15 11:18:05 -07:00
|
|
|
|
var elems = page.querySelectorAll('.chkOffline');
|
2016-08-12 08:54:37 -07:00
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
|
2016-08-15 22:34:36 -07:00
|
|
|
|
elems[i].checked = item.SyncPercent != null;
|
2016-08-12 08:54:37 -07:00
|
|
|
|
}
|
2016-07-16 18:58:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function reloadFromItem(page, params, 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
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
var context = params.context;
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
LibraryBrowser.renderName(item, page.querySelector('.itemName'), false, context);
|
|
|
|
|
LibraryBrowser.renderParentName(item, page.querySelector('.parentName'), context);
|
2016-09-03 10:16:36 -07:00
|
|
|
|
LibraryMenu.setTitle('');
|
2013-11-27 12:04:19 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
Dashboard.getCurrentUser().then(function (user) {
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2016-05-16 11:20:08 -07:00
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
|
|
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-09-01 12:18:25 -07:00
|
|
|
|
var hasBackdrop = false;
|
2015-08-30 10:26:30 -07:00
|
|
|
|
|
2015-08-24 11:22:44 -07:00
|
|
|
|
// For these types, make the backdrop a little smaller so that the items are more quickly accessible
|
2016-03-31 22:02:29 -07:00
|
|
|
|
if (item.Type == 'MusicArtist' || item.Type == "MusicAlbum" || item.Type == "Playlist" || item.Type == "BoxSet" || item.MediaType == "Audio" || !layoutManager.mobile) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var itemBackdropElement = page.querySelector('#itemBackdrop');
|
|
|
|
|
itemBackdropElement.classList.add('noBackdrop');
|
|
|
|
|
itemBackdropElement.style.backgroundImage = 'none';
|
2016-05-18 14:46:56 -07:00
|
|
|
|
backdrop.setBackdrops([item]);
|
2015-08-30 10:26:30 -07:00
|
|
|
|
}
|
2015-09-01 12:18:25 -07:00
|
|
|
|
else {
|
|
|
|
|
hasBackdrop = LibraryBrowser.renderDetailPageBackdrop(page, item);
|
2016-05-18 14:46:56 -07:00
|
|
|
|
backdrop.clear();
|
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();
|
|
|
|
|
|
2016-05-05 21:50:06 -07:00
|
|
|
|
if (now >= datetime.parseISO8601Date(item.StartDate, true) && now < datetime.parseISO8601Date(item.EndDate, true)) {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlay', true);
|
2015-08-17 21:22:45 -07:00
|
|
|
|
canPlay = true;
|
2015-07-28 20:42:03 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlay');
|
2015-07-28 20:42:03 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (MediaController.canPlay(item)) {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlay', true);
|
2015-08-17 21:22:45 -07:00
|
|
|
|
canPlay = true;
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlay');
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
2014-04-13 10:27:13 -07:00
|
|
|
|
|
2014-06-16 19:03:59 -07:00
|
|
|
|
if (item.LocalTrailerCount && item.PlayAccess == 'Full') {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlayTrailer', true);
|
2014-06-16 19:03:59 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnPlayTrailer');
|
2014-06-16 19:03:59 -07:00
|
|
|
|
}
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2016-07-16 18:58:51 -07:00
|
|
|
|
if (itemHelper.canSync(user, item)) {
|
2016-08-12 08:54:37 -07:00
|
|
|
|
if (appHost.supports('sync')) {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
hideAll(page, 'syncLocalContainer', true);
|
2016-08-12 08:54:37 -07:00
|
|
|
|
hideAll(page, 'btnSync');
|
|
|
|
|
} else {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
hideAll(page, 'syncLocalContainer');
|
2016-08-12 08:54:37 -07:00
|
|
|
|
hideAll(page, 'btnSync', true);
|
|
|
|
|
}
|
|
|
|
|
updateSyncStatus(page, item);
|
2014-07-19 21:46:29 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnSync');
|
2016-08-15 11:18:05 -07:00
|
|
|
|
hideAll(page, 'syncLocalContainer');
|
2014-07-19 21:46:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-28 20:42:03 -07:00
|
|
|
|
if (item.Type == 'Program' && item.TimerId) {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnCancelRecording', true);
|
2015-07-28 20:42:03 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnCancelRecording');
|
2015-07-28 20:42:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) {
|
2015-08-17 21:22:45 -07:00
|
|
|
|
|
|
|
|
|
if (canPlay) {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnRecord', true);
|
|
|
|
|
hideAll(page, 'btnFloatingRecord');
|
2015-08-17 21:22:45 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnRecord');
|
|
|
|
|
hideAll(page, 'btnFloatingRecord', true);
|
2015-08-17 21:22:45 -07:00
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
} else {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
hideAll(page, 'btnRecord');
|
|
|
|
|
hideAll(page, 'btnFloatingRecord');
|
2015-07-28 20:42:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
var btnPlayExternalTrailer = page.querySelectorAll('.btnPlayExternalTrailer');
|
|
|
|
|
for (var i = 0, length = btnPlayExternalTrailer.length; i < length; i++) {
|
|
|
|
|
if (!item.LocalTrailerCount && item.RemoteTrailers.length && item.PlayAccess == 'Full') {
|
2014-06-02 19:01:30 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
btnPlayExternalTrailer[i].classList.remove('hide');
|
|
|
|
|
btnPlayExternalTrailer[i].href = item.RemoteTrailers[0].Url;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
} else {
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
btnPlayExternalTrailer[i].classList.add('hide');
|
|
|
|
|
btnPlayExternalTrailer[i].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) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.splitVersionContainer').classList.remove('hide');
|
2014-06-16 19:03:59 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.splitVersionContainer').classList.add('hide');
|
2013-07-29 08:05:09 -07:00
|
|
|
|
}
|
2014-08-07 21:36:51 -07:00
|
|
|
|
|
2016-07-16 18:58:51 -07:00
|
|
|
|
itemContextMenu.getCommands(getContextMenuOptions(item)).then(function (commands) {
|
|
|
|
|
if (commands.length) {
|
|
|
|
|
hideAll(page, 'btnMoreCommands', true);
|
|
|
|
|
} else {
|
|
|
|
|
hideAll(page, 'btnMoreCommands');
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-03-24 18:14:24 -07:00
|
|
|
|
|
|
|
|
|
if (user.Policy.IsAdministrator) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.chapterSettingsButton').classList.remove('hide');
|
2015-03-24 18:14:24 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.chapterSettingsButton').classList.add('hide');
|
2015-03-24 18:14:24 -07:00
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var itemBirthday = page.querySelector('#itemBirthday');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
if (item.Type == "Person" && item.PremiereDate) {
|
|
|
|
|
|
|
|
|
|
try {
|
2016-05-05 21:50:06 -07:00
|
|
|
|
var birthday = datetime.parseISO8601Date(item.PremiereDate, true).toDateString();
|
2015-08-21 08:34:42 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemBirthday.classList.remove('hide');
|
|
|
|
|
itemBirthday.innerHTML = Globalize.translate('BirthDateValue').replace('{0}', birthday);
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemBirthday.classList.add('hide');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemBirthday.classList.add('hide');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-06 22:48:14 -07:00
|
|
|
|
var itemDeathDate = page.querySelector('#itemDeathDate');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
if (item.Type == "Person" && item.EndDate) {
|
|
|
|
|
|
|
|
|
|
try {
|
2016-05-05 21:50:06 -07:00
|
|
|
|
var deathday = datetime.parseISO8601Date(item.EndDate, true).toDateString();
|
2015-08-21 08:34:42 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemDeathDate.classList.remove('hide');
|
|
|
|
|
itemDeathDate.innerHTML = Globalize.translate('DeathDateValue').replace('{0}', deathday);
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemDeathDate.classList.add('hide');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var itemBirthLocation = page.querySelector('#itemBirthLocation');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
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>';
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemBirthLocation.classList.remove('hide');
|
|
|
|
|
itemBirthLocation.innerHTML = Globalize.translate('BirthPlaceValue').replace('{0}', gmap);
|
2015-08-21 08:34:42 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
itemBirthLocation.classList.add('hide');
|
2015-08-21 08:34:42 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
});
|
2013-07-29 08:05:09 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
//if (item.LocationType == "Offline") {
|
2013-10-25 08:52:10 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
// page.querySelector('.offlineIndicator').classList.remove('hide');
|
|
|
|
|
//}
|
|
|
|
|
//else {
|
|
|
|
|
// page.querySelector('.offlineIndicator').classList.add('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 {
|
2016-05-05 21:50:06 -07:00
|
|
|
|
if (item.PremiereDate && (new Date().getTime() >= datetime.parseISO8601Date(item.PremiereDate, true).getTime())) {
|
2014-06-16 19:03:59 -07:00
|
|
|
|
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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
//if (isMissingEpisode) {
|
2013-10-17 13:59:46 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
// page.querySelector('.missingIndicator').classList.remove('hide');
|
|
|
|
|
//}
|
|
|
|
|
//else {
|
|
|
|
|
// page.querySelector('.missingIndicator').classList.add('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
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
page.dispatchEvent(new CustomEvent("displayingitem", {
|
|
|
|
|
detail: {
|
|
|
|
|
item: item,
|
|
|
|
|
context: context
|
|
|
|
|
},
|
|
|
|
|
bubbles: true
|
|
|
|
|
}));
|
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
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
function renderLinks(linksElem, item) {
|
|
|
|
|
|
|
|
|
|
var links = [];
|
|
|
|
|
|
|
|
|
|
if (item.HomePageUrl) {
|
|
|
|
|
links.push('<a class="textlink" href="' + item.HomePageUrl + '" target="_blank">' + Globalize.translate('ButtonWebsite') + '</a>');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.ExternalUrls) {
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = item.ExternalUrls.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var url = item.ExternalUrls[i];
|
|
|
|
|
|
|
|
|
|
links.push('<a class="textlink" href="' + url.Url + '" target="_blank">' + url.Name + '</a>');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (links.length) {
|
|
|
|
|
|
|
|
|
|
var html = links.join(' / ');
|
|
|
|
|
|
|
|
|
|
html = Globalize.translate('ValueLinks', html);
|
|
|
|
|
|
|
|
|
|
linksElem.innerHTML = html;
|
|
|
|
|
linksElem.classList.remove('hide');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
linksElem.classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-25 08:12:39 -07:00
|
|
|
|
function renderImage(page, item, user) {
|
2014-07-01 14:13:32 -07:00
|
|
|
|
|
2015-09-17 09:04:04 -07:00
|
|
|
|
LibraryBrowser.renderDetailImage(page.querySelector('.detailImageContainer'), item, user.Policy.IsAdministrator && item.MediaType != 'Photo');
|
2014-06-25 08:12:39 -07:00
|
|
|
|
}
|
2014-06-16 19:03:59 -07:00
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
function refreshDetailImageUserData(elem, item) {
|
|
|
|
|
|
|
|
|
|
var detailImageProgressContainer = elem.querySelector('.detailImageProgressContainer');
|
|
|
|
|
|
2016-07-30 16:23:57 -07:00
|
|
|
|
detailImageProgressContainer.innerHTML = indicators.getProgressBarHtml(item);
|
2016-07-30 11:37:38 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-23 19:08:20 -07:00
|
|
|
|
function refreshImage(page, item, user) {
|
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
refreshDetailImageUserData(page.querySelector('.detailImageContainer'), item);
|
2015-08-23 19:08:20 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-02 08:32:11 -07:00
|
|
|
|
function setPeopleHeader(page, item) {
|
|
|
|
|
|
2016-03-31 22:02:29 -07:00
|
|
|
|
if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.MediaType == "Book" || item.MediaType == "Photo") {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#peopleHeader').innerHTML = Globalize.translate('HeaderPeople');
|
2013-10-02 08:32:11 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#peopleHeader').innerHTML = Globalize.translate('HeaderCastAndCrew');
|
2013-10-02 08:32:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-13 21:56:41 -07:00
|
|
|
|
function renderNextUp(page, item, user) {
|
|
|
|
|
|
|
|
|
|
var section = page.querySelector('.nextUpSection');
|
|
|
|
|
|
2016-07-04 12:30:23 -07:00
|
|
|
|
if (item.Type != 'Series') {
|
2016-03-13 21:56:41 -07:00
|
|
|
|
section.classList.add('hide');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApiClient.getNextUpEpisodes({
|
|
|
|
|
|
|
|
|
|
SeriesId: item.Id,
|
|
|
|
|
UserId: user.Id
|
|
|
|
|
|
|
|
|
|
}).then(function (result) {
|
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
section.classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
section.classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
var html = cardBuilder.getCardsHtml({
|
2016-03-13 21:56:41 -07:00
|
|
|
|
items: result.Items,
|
2016-07-30 12:17:09 -07:00
|
|
|
|
shape: getThumbShape(false),
|
2016-03-13 21:56:41 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
displayAsSpecial: item.Type == "Season" && item.IndexNumber,
|
|
|
|
|
overlayText: true,
|
|
|
|
|
lazy: true,
|
|
|
|
|
overlayPlayButton: true
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-13 21:58:46 -07:00
|
|
|
|
var itemsContainer = section.querySelector('.nextUpItems');
|
2016-05-05 20:09:36 -07:00
|
|
|
|
|
2016-03-13 21:58:46 -07:00
|
|
|
|
itemsContainer.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(itemsContainer);
|
2016-03-13 21:56:41 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-25 08:52:10 -07:00
|
|
|
|
function setInitialCollapsibleState(page, item, context, user) {
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.collectionItems').innerHTML = '';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2015-08-17 21:22:45 -07:00
|
|
|
|
if (item.Type == 'TvChannel') {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.remove('hide');
|
2015-08-17 21:22:45 -07:00
|
|
|
|
renderChannelGuide(page, item, user);
|
|
|
|
|
}
|
2015-08-19 21:06:49 -07:00
|
|
|
|
else if (item.Type == 'Playlist') {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.remove('hide');
|
2015-08-19 21:06:49 -07:00
|
|
|
|
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') {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.remove('hide');
|
2015-08-18 21:08:03 -07:00
|
|
|
|
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") {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.add('hide');
|
2014-03-08 11:17:05 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.remove('hide');
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
2016-06-01 23:08:47 -07:00
|
|
|
|
renderChildren(page, item);
|
2013-04-22 20:56:11 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#childrenCollapsible').classList.add('hide');
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-13 21:56:41 -07:00
|
|
|
|
if (item.Type == 'Series') {
|
|
|
|
|
|
|
|
|
|
renderNextUp(page, item, user);
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.nextUpSection').classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2016-07-26 10:21:27 -07:00
|
|
|
|
if (!chapters.length) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#scenesCollapsible').classList.add('hide');
|
2013-03-26 14:32:01 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#scenesCollapsible').classList.remove('hide');
|
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") {
|
2016-06-26 21:19:10 -07:00
|
|
|
|
page.querySelector('#specialsCollapsible').classList.add('hide');
|
2013-03-26 14:32:01 -07:00
|
|
|
|
} else {
|
2016-06-26 21:19:10 -07:00
|
|
|
|
page.querySelector('#specialsCollapsible').classList.remove('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) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#castCollapsible').classList.add('hide');
|
2013-03-26 22:20:46 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#castCollapsible').classList.remove('hide');
|
2016-07-30 21:11:23 -07:00
|
|
|
|
renderCast(page, item, context, enableScrollX() ? null : 12);
|
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) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
2014-02-17 20:02:41 -07:00
|
|
|
|
renderAdditionalParts(page, item, user);
|
2015-01-27 15:45:59 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#additionalPartsCollapsible').classList.add('hide');
|
2013-06-12 14:46:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#themeSongsCollapsible').classList.add('hide');
|
|
|
|
|
page.querySelector('#themeVideosCollapsible').classList.add('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 {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#musicVideosCollapsible').classList.add('hide');
|
2013-07-29 12:12:21 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-14 20:54:52 -07:00
|
|
|
|
renderThemeMedia(page, item, user);
|
2015-12-14 08:43:03 -07:00
|
|
|
|
|
|
|
|
|
if (enableScrollX()) {
|
|
|
|
|
renderCriticReviews(page, item);
|
|
|
|
|
} else {
|
|
|
|
|
renderCriticReviews(page, item, 1);
|
|
|
|
|
}
|
2013-04-10 14:14:25 -07:00
|
|
|
|
}
|
2013-03-25 21:44:12 -07:00
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
function renderOverview(elems, item) {
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
var elem = elems[i];
|
|
|
|
|
var overview = item.Overview || '';
|
|
|
|
|
|
|
|
|
|
if (overview) {
|
|
|
|
|
elem.innerHTML = overview;
|
|
|
|
|
|
|
|
|
|
elem.classList.remove('empty');
|
|
|
|
|
|
|
|
|
|
var anchors = elem.querySelectorAll('a');
|
|
|
|
|
for (var j = 0, length2 = anchors.length; j < length2; j++) {
|
|
|
|
|
anchors[j].setAttribute("target", "_blank");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
elem.innerHTML = '';
|
|
|
|
|
|
|
|
|
|
elem.classList.add('empty');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
2016-07-21 22:38:01 -07:00
|
|
|
|
renderMoreFromItems(page, item);
|
2016-02-13 08:56:58 -07:00
|
|
|
|
|
|
|
|
|
if (!isStatic) {
|
|
|
|
|
renderSiblingLinks(page, item, context);
|
|
|
|
|
}
|
2013-05-19 10:35:00 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var taglineElement = page.querySelector('.tagline');
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
if (item.Taglines && item.Taglines.length) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
taglineElement.classList.remove('hide');
|
|
|
|
|
taglineElement.innerHTML = item.Taglines[0];
|
2013-02-20 18:33:05 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
taglineElement.classList.add('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-30 10:26:30 -07:00
|
|
|
|
var seasonOnBottom = screen.availHeight < 800 || screen.availWidth < 600;
|
2015-08-24 11:22:44 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom)) {
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderOverview([bottomOverview], item);
|
2015-08-23 19:08:20 -07:00
|
|
|
|
topOverview.classList.add('hide');
|
|
|
|
|
bottomOverview.classList.remove('hide');
|
|
|
|
|
} else {
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderOverview([topOverview], item);
|
2015-08-23 19:08:20 -07:00
|
|
|
|
topOverview.classList.remove('hide');
|
|
|
|
|
bottomOverview.classList.add('hide');
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderAwardSummary(page.querySelector('#awardSummary'), item);
|
2013-04-12 08:25:00 -07:00
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
var i, length;
|
|
|
|
|
var itemMiscInfo = page.querySelectorAll('.itemMiscInfo');
|
|
|
|
|
for (i = 0, length = itemMiscInfo.length; i < length; i++) {
|
|
|
|
|
mediaInfo.fillPrimaryMediaInfo(itemMiscInfo[i], item, {
|
2016-09-14 09:20:03 -07:00
|
|
|
|
interactive: true,
|
|
|
|
|
episodeTitle: false
|
2016-05-11 22:58:05 -07:00
|
|
|
|
});
|
2016-06-24 09:51:13 -07:00
|
|
|
|
}
|
|
|
|
|
var itemGenres = page.querySelectorAll('.itemGenres');
|
2016-06-28 19:44:07 -07:00
|
|
|
|
for (i = 0, length = itemGenres.length; i < length; i++) {
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderGenres(itemGenres[i], item, null, isStatic);
|
2016-06-24 09:51:13 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderStudios(page.querySelector('.itemStudios'), item, isStatic);
|
2013-04-10 14:14:25 -07:00
|
|
|
|
renderUserDataIcons(page, item);
|
2016-07-30 11:37:38 -07:00
|
|
|
|
renderLinks(page.querySelector('.itemExternalLinks'), item);
|
2013-05-14 21:05:52 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.criticRatingScore').innerHTML = (item.CriticRating || '0') + '%';
|
2013-05-06 20:00:24 -07:00
|
|
|
|
|
2013-05-05 21:50:40 -07:00
|
|
|
|
if (item.CriticRatingSummary) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#criticRatingSummary').classList.remove('hide');
|
|
|
|
|
page.querySelector('.criticRatingSummaryText').innerHTML = item.CriticRatingSummary;
|
2013-05-05 21:50:40 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('#criticRatingSummary').classList.add('hide');
|
2013-05-05 21:50:40 -07:00
|
|
|
|
}
|
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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var playersElement = page.querySelector('#players');
|
|
|
|
|
|
2013-05-16 20:24:41 -07:00
|
|
|
|
if (item.Players) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
playersElement.classList.remove('hide');
|
|
|
|
|
playersElement.innerHTML = item.Players + ' Player';
|
2013-05-16 20:24:41 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
playersElement.classList.add('hide');
|
2013-05-16 20:24:41 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 09:51:13 -07:00
|
|
|
|
var artist = page.querySelectorAll('.artist');
|
2016-07-09 14:09:21 -07:00
|
|
|
|
for (i = 0, length = artist.length; i < length; i++) {
|
2016-06-24 09:51:13 -07:00
|
|
|
|
if (item.ArtistItems && item.ArtistItems.length && item.Type != "MusicAlbum") {
|
|
|
|
|
artist[i].classList.remove('hide');
|
|
|
|
|
artist[i].innerHTML = getArtistLinksHtml(item.ArtistItems, context);
|
|
|
|
|
} else {
|
|
|
|
|
artist[i].classList.add('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) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.audioVideoMediaInfo').classList.remove('hide');
|
2014-08-28 17:49:25 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.audioVideoMediaInfo').classList.add('hide');
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.MediaType == 'Photo') {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.photoInfo').classList.remove('hide');
|
2014-08-28 17:49:25 -07:00
|
|
|
|
renderPhotoInfo(page, item);
|
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.photoInfo').classList.add('hide');
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
|
|
|
|
|
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) {
|
2016-01-21 01:23:02 -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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.photoInfoContent').innerHTML = html;
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
function renderTabButtons(page, item) {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var elem = page.querySelector('.tabDetails');
|
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()) {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.detailsSection').classList.remove('hide');
|
2014-03-20 08:55:22 -07:00
|
|
|
|
|
2014-08-28 17:49:25 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.detailsSection').classList.add('hide');
|
2014-08-28 17:49:25 -07:00
|
|
|
|
}
|
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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var lnkPreviousItem = page.querySelector('.lnkPreviousItem');
|
|
|
|
|
var lnkNextItem = page.querySelector('.lnkNextItem');
|
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")) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
lnkNextItem.classList.add('hide');
|
|
|
|
|
lnkPreviousItem.classList.add('hide');
|
|
|
|
|
|
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
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
promise.then(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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
lnkPreviousItem.classList.remove('hide');
|
|
|
|
|
lnkPreviousItem.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
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
lnkNextItem.classList.remove('hide');
|
|
|
|
|
lnkNextItem.href = 'itemdetails.html?id=' + curr.Id + '&context=' + context;
|
2013-05-19 10:35:00 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-26 07:51:26 -07:00
|
|
|
|
function enableScrollX() {
|
2015-12-14 08:43:03 -07:00
|
|
|
|
return browserInfo.mobile && AppInfo.enableAppLayouts && screen.availWidth <= 1000;
|
2015-09-26 07:51:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
function getPortraitShape(scrollX) {
|
|
|
|
|
if (scrollX == null) {
|
|
|
|
|
scrollX = enableScrollX();
|
|
|
|
|
}
|
|
|
|
|
return scrollX ? 'overflowPortrait' : 'portrait';
|
2015-09-26 07:51:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
function getSquareShape(scrollX) {
|
|
|
|
|
if (scrollX == null) {
|
|
|
|
|
scrollX = enableScrollX();
|
|
|
|
|
}
|
|
|
|
|
return scrollX ? 'overflowSquare' : 'square';
|
2015-09-26 07:51:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
function getThumbShape(scrollX) {
|
|
|
|
|
|
|
|
|
|
if (scrollX == null) {
|
|
|
|
|
scrollX = enableScrollX();
|
|
|
|
|
}
|
|
|
|
|
return scrollX ? 'overflowBackdrop' : 'backdrop';
|
2015-09-27 08:00:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-21 22:38:01 -07:00
|
|
|
|
function renderMoreFromItems(page, item) {
|
2016-07-22 10:54:43 -07:00
|
|
|
|
|
2016-07-21 22:38:01 -07:00
|
|
|
|
var moreFromSection = page.querySelector('#moreFromSection');
|
|
|
|
|
|
|
|
|
|
if (!moreFromSection) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type != 'MusicAlbum' || !item.AlbumArtists || !item.AlbumArtists.length) {
|
|
|
|
|
moreFromSection.classList.add('hide');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
2016-07-22 10:54:43 -07:00
|
|
|
|
|
2016-07-21 22:38:01 -07:00
|
|
|
|
IncludeItemTypes: "MusicAlbum",
|
|
|
|
|
ArtistIds: item.AlbumArtists[0].Id,
|
|
|
|
|
Recursive: true,
|
|
|
|
|
ExcludeItemIds: item.Id
|
|
|
|
|
|
2016-07-22 10:54:43 -07:00
|
|
|
|
}).then(function (result) {
|
|
|
|
|
|
2016-07-21 22:38:01 -07:00
|
|
|
|
if (!result.Items.length) {
|
|
|
|
|
moreFromSection.classList.add('hide');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
moreFromSection.classList.remove('hide');
|
|
|
|
|
|
|
|
|
|
moreFromSection.querySelector('.moreFromHeader').innerHTML = Globalize.translate('MoreFromValue', item.AlbumArtists[0].Name);
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (enableScrollX()) {
|
|
|
|
|
html += '<div is="emby-itemscontainer" class="hiddenScrollX itemsContainer">';
|
|
|
|
|
} else {
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap">';
|
2016-07-21 22:38:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var shape = item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? getSquareShape() : getPortraitShape();
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += cardBuilder.getCardsHtml({
|
2016-07-21 22:38:01 -07:00
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: shape,
|
|
|
|
|
showParentTitle: item.Type == "MusicAlbum",
|
|
|
|
|
centerText: true,
|
|
|
|
|
showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist",
|
|
|
|
|
coverImage: item.Type == "MusicAlbum" || item.Type == "MusicArtist",
|
|
|
|
|
overlayPlayButton: true
|
|
|
|
|
});
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
var similarContent = page.querySelector('#moreFromItems');
|
|
|
|
|
similarContent.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(similarContent);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 12:34:20 -07:00
|
|
|
|
function renderSimilarItems(page, item, context) {
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var similarCollapsible = page.querySelector('#similarCollapsible');
|
|
|
|
|
|
2016-06-28 19:44:07 -07:00
|
|
|
|
if (!similarCollapsible) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
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") {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
similarCollapsible.classList.remove('hide');
|
2015-08-20 19:36:30 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
similarCollapsible.classList.add('hide');
|
2015-08-20 19:36:30 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2015-09-26 07:51:26 -07:00
|
|
|
|
var shape = item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? getSquareShape() : getPortraitShape();
|
2015-05-12 21:55:19 -07:00
|
|
|
|
|
2013-05-25 16:52:41 -07:00
|
|
|
|
var options = {
|
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
2016-06-28 20:17:27 -07:00
|
|
|
|
limit: 8,
|
2016-08-01 22:55:52 -07:00
|
|
|
|
fields: "PrimaryImageAspectRatio,UserData,CanDelete"
|
2013-05-25 16:52:41 -07:00
|
|
|
|
};
|
2013-05-28 13:01:33 -07:00
|
|
|
|
|
2016-07-22 10:54:43 -07:00
|
|
|
|
if (item.Type == 'MusicAlbum' && item.AlbumArtists && item.AlbumArtists.length) {
|
2016-07-22 15:10:39 -07:00
|
|
|
|
options.ExcludeArtistIds = item.AlbumArtists[0].Id;
|
2016-07-22 10:54:43 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-26 07:51:26 -07:00
|
|
|
|
if (enableScrollX()) {
|
|
|
|
|
options.limit = 12;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getSimilarItems(item.Id, options).then(function (result) {
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
|
|
|
|
if (!result.Items.length) {
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
similarCollapsible.classList.add('hide');
|
2013-05-15 15:55:24 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
similarCollapsible.classList.remove('hide');
|
|
|
|
|
similarCollapsible.querySelector('.similiarHeader').innerHTML = Globalize.translate('HeaderIfYouLikeCheckTheseOut', item.Name);
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2015-09-26 07:51:26 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (enableScrollX()) {
|
2016-07-17 11:55:07 -07:00
|
|
|
|
html += '<div is="emby-itemscontainer" class="hiddenScrollX itemsContainer">';
|
2015-09-26 07:51:26 -07:00
|
|
|
|
} else {
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap">';
|
2015-09-26 07:51:26 -07:00
|
|
|
|
}
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += cardBuilder.getCardsHtml({
|
2013-05-15 15:55:24 -07:00
|
|
|
|
items: result.Items,
|
2015-08-30 10:26:30 -07:00
|
|
|
|
shape: shape,
|
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-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-09-26 07:51:26 -07:00
|
|
|
|
html += '</div>';
|
2013-05-15 15:55:24 -07:00
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
var similarContent = page.querySelector('#similarContent');
|
|
|
|
|
similarContent.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(similarContent);
|
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
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
var seriesAirTime = page.querySelector('#seriesAirTime');
|
|
|
|
|
|
2013-05-15 06:57:13 -07:00
|
|
|
|
if (item.Type != "Series") {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
seriesAirTime.classList.add('hide');
|
2013-05-15 06:57:13 -07:00
|
|
|
|
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
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
seriesAirTime.innerHTML = html;
|
|
|
|
|
seriesAirTime.classList.remove('hide');
|
2013-06-04 09:48:23 -07:00
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
seriesAirTime.classList.add('hide');
|
2013-06-04 09:48:23 -07:00
|
|
|
|
}
|
2013-05-06 20:00:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderTags(page, item) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
var itemTags = page.querySelector('.itemTags');
|
|
|
|
|
|
2013-05-06 20:00:24 -07:00
|
|
|
|
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>';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
itemTags.innerHTML = html;
|
|
|
|
|
itemTags.classList.remove('hide');
|
2013-05-06 20:00:24 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
itemTags.classList.add('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) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
query = Object.assign({}, query);
|
2015-01-29 23:32:20 -07:00
|
|
|
|
|
|
|
|
|
return function (index, limit, fields) {
|
|
|
|
|
|
|
|
|
|
query.StartIndex = index;
|
|
|
|
|
query.Limit = limit;
|
|
|
|
|
query.Fields = fields;
|
|
|
|
|
|
|
|
|
|
return ApiClient.getEpisodes(seriesId, query);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getAlbumSongsFunction(query) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
query = Object.assign({}, query);
|
2015-01-29 23:32:20 -07:00
|
|
|
|
|
|
|
|
|
return function (index, limit, fields) {
|
|
|
|
|
|
|
|
|
|
query.StartIndex = index;
|
|
|
|
|
query.Limit = limit;
|
|
|
|
|
query.Fields = fields;
|
|
|
|
|
|
|
|
|
|
return ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _childrenItemsFunction = null;
|
2016-06-01 23:08:47 -07:00
|
|
|
|
function renderChildren(page, item) {
|
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
|
|
|
|
|
2016-08-15 23:13:54 -07:00
|
|
|
|
var fields = "ItemCounts,AudioInfo,PrimaryImageAspectRatio,BasicSyncInfo,CanDelete";
|
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
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
var userId = Dashboard.getCurrentUserId();
|
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
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
userId: userId,
|
2013-12-29 11:53:56 -07:00
|
|
|
|
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,
|
2016-06-01 23:08:47 -07:00
|
|
|
|
userId: userId,
|
2013-12-29 11:53:56 -07:00
|
|
|
|
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,
|
2016-06-01 23:08:47 -07:00
|
|
|
|
userId: userId,
|
2016-04-13 09:17:52 -07:00
|
|
|
|
Fields: fields
|
2015-01-29 23:32:20 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
promise.then(function (result) {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2014-08-30 07:26:29 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
var scrollX = false;
|
2016-07-31 12:05:56 -07:00
|
|
|
|
var isList = false;
|
2015-12-14 08:43:03 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
if (item.Type == "MusicAlbum") {
|
2013-04-22 07:44:11 -07:00
|
|
|
|
|
2016-07-15 22:05:40 -07:00
|
|
|
|
html = listView.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,
|
2016-07-15 22:05:40 -07:00
|
|
|
|
action: 'playallfromhere',
|
2015-05-09 21:29:04 -07:00
|
|
|
|
lazy: true
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
2016-07-31 12:05:56 -07:00
|
|
|
|
isList = true;
|
2014-08-30 07:26:29 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Series") {
|
2015-12-14 08:43:03 -07:00
|
|
|
|
|
|
|
|
|
scrollX = enableScrollX();
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html = cardBuilder.getCardsHtml({
|
2014-08-30 07:26:29 -07:00
|
|
|
|
items: result.Items,
|
2015-12-14 08:43:03 -07:00
|
|
|
|
shape: getPortraitShape(),
|
|
|
|
|
showTitle: true,
|
2014-08-30 07:26:29 -07:00
|
|
|
|
centerText: true,
|
2016-02-12 13:26:03 -07:00
|
|
|
|
lazy: true,
|
2016-08-15 22:34:36 -07:00
|
|
|
|
overlayPlayButton: true,
|
|
|
|
|
allowBottomPadding: !scrollX
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Season") {
|
2016-04-13 09:17:52 -07:00
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html = cardBuilder.getCardsHtml({
|
2014-08-30 07:26:29 -07:00
|
|
|
|
items: result.Items,
|
2016-07-30 12:17:09 -07:00
|
|
|
|
shape: getThumbShape(false),
|
2014-08-30 07:26:29 -07:00
|
|
|
|
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,
|
2016-08-31 12:17:11 -07:00
|
|
|
|
overlayPlayButton: AppInfo.enableAppLayouts
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "GameSystem") {
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html = cardBuilder.getCardsHtml({
|
2014-08-30 07:26:29 -07:00
|
|
|
|
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');
|
2015-12-14 08:43:03 -07:00
|
|
|
|
if (scrollX) {
|
|
|
|
|
elem.classList.add('hiddenScrollX');
|
2016-07-30 12:17:09 -07:00
|
|
|
|
elem.classList.remove('vertical-wrap');
|
2016-07-31 12:05:56 -07:00
|
|
|
|
elem.classList.remove('vertical-list');
|
2015-12-14 08:43:03 -07:00
|
|
|
|
} else {
|
|
|
|
|
elem.classList.remove('hiddenScrollX');
|
2016-07-31 12:05:56 -07:00
|
|
|
|
|
|
|
|
|
if (isList) {
|
|
|
|
|
elem.classList.add('vertical-list');
|
|
|
|
|
elem.classList.remove('vertical-wrap');
|
|
|
|
|
} else {
|
|
|
|
|
elem.classList.add('vertical-wrap');
|
|
|
|
|
elem.classList.remove('vertical-list');
|
|
|
|
|
}
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(elem);
|
|
|
|
|
|
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
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
renderCollectionItems(page, item, collectionItemTypes, result.Items);
|
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") {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.childrenSectionHeader', page).classList.add('hide');
|
2015-07-06 00:06:09 -07:00
|
|
|
|
} else {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
page.querySelector('.childrenSectionHeader', page).classList.remove('hide');
|
2015-07-06 00:06:09 -07:00
|
|
|
|
}
|
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);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 11:37:38 -07:00
|
|
|
|
function renderStudios(elem, item, isStatic) {
|
|
|
|
|
|
|
|
|
|
if (item.Studios && item.Studios.length && item.Type != "Series") {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = item.Studios.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
html += ' / ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isStatic) {
|
|
|
|
|
html += item.Studios[i].Name;
|
|
|
|
|
} else {
|
|
|
|
|
html += '<a class="textlink" href="itemdetails.html?id=' + item.Studios[i].Id + '">' + item.Studios[i].Name + '</a>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var translationKey = item.Studios.length > 1 ? "ValueStudios" : "ValueStudio";
|
|
|
|
|
|
|
|
|
|
html = Globalize.translate(translationKey, html);
|
|
|
|
|
|
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
elem.classList.remove('hide');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
elem.classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderGenres(elem, item, limit, isStatic) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
var genres = item.Genres || [];
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = genres.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
if (limit && i >= limit) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
html += '<span> / </span>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var param = item.Type == "Audio" || item.Type == "MusicArtist" || item.Type == "MusicAlbum" ? "musicgenre" : "genre";
|
|
|
|
|
|
|
|
|
|
if (item.MediaType == "Game") {
|
|
|
|
|
param = "gamegenre";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isStatic) {
|
|
|
|
|
html += genres[i];
|
|
|
|
|
} else {
|
|
|
|
|
html += '<a class="textlink" href="itemdetails.html?' + param + '=' + ApiClient.encodeName(genres[i]) + '">' + genres[i] + '</a>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderAwardSummary(elem, item) {
|
|
|
|
|
if (item.AwardSummary) {
|
|
|
|
|
elem.classList.remove('hide');
|
|
|
|
|
elem.innerHTML = Globalize.translate('ValueAwards', item.AwardSummary);
|
|
|
|
|
} else {
|
|
|
|
|
elem.classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
function renderCollectionItems(page, parentItem, types, items) {
|
2015-09-15 20:55:26 -07:00
|
|
|
|
|
|
|
|
|
// First empty out existing content
|
|
|
|
|
page.querySelector('.collectionItems').innerHTML = '';
|
2016-06-01 23:08:47 -07:00
|
|
|
|
var i, length;
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
for (i = 0, length = types.length; i < length; i++) {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
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) {
|
2016-06-01 23:08:47 -07:00
|
|
|
|
renderCollectionItemType(page, parentItem, type, typeItems);
|
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) {
|
2016-06-01 23:08:47 -07:00
|
|
|
|
renderCollectionItemType(page, parentItem, otherType, otherTypeItems);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
2014-03-15 15:52:43 -07:00
|
|
|
|
|
2014-03-08 11:17:05 -07:00
|
|
|
|
if (!items.length) {
|
2016-06-01 23:08:47 -07:00
|
|
|
|
renderCollectionItemType(page, parentItem, { name: Globalize.translate('HeaderItems') }, items);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-01 23:08:47 -07:00
|
|
|
|
function renderCollectionItemType(page, parentItem, type, items) {
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
html += '<div class="detailSection">';
|
|
|
|
|
|
2016-05-18 14:46:56 -07:00
|
|
|
|
html += '<div style="display:flex;align-items:center;">';
|
2015-07-29 10:16:00 -07:00
|
|
|
|
html += '<h1>';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
html += '<span>' + type.name + '</span>';
|
|
|
|
|
|
2015-07-29 10:16:00 -07:00
|
|
|
|
html += '</h1>';
|
2016-06-18 22:26:52 -07:00
|
|
|
|
html += '<button class="btnAddToCollection autoSize" type="button" is="paper-icon-button-light" style="margin-left:1em;"><i class="md-icon" icon="add">add</i></button>';
|
2016-05-18 14:46:56 -07:00
|
|
|
|
html += '</div>';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += '<div is="emby-itemscontainer" class="detailSectionContent itemsContainer vertical-wrap">';
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
var shape = type.type == 'MusicAlbum' ? getSquareShape(false) : getPortraitShape(false);
|
2014-03-08 11:17:05 -07:00
|
|
|
|
|
2016-07-30 12:17:09 -07:00
|
|
|
|
html += cardBuilder.getCardsHtml({
|
2014-03-08 11:17:05 -07:00
|
|
|
|
items: items,
|
|
|
|
|
shape: shape,
|
|
|
|
|
showTitle: true,
|
2014-05-29 12:34:20 -07:00
|
|
|
|
centerText: true,
|
2015-05-14 19:16:57 -07:00
|
|
|
|
lazy: true,
|
2015-09-15 20:55:26 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
overlayMoreButton: true,
|
|
|
|
|
showAddToCollection: false,
|
2016-07-20 13:45:50 -07:00
|
|
|
|
showRemoveFromCollection: true,
|
|
|
|
|
collectionId: parentItem.Id
|
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');
|
2016-06-01 23:08:47 -07:00
|
|
|
|
collectionItems.insertAdjacentHTML('beforeend', html);
|
2015-06-28 07:45:21 -07:00
|
|
|
|
ImageLoader.lazyChildren(collectionItems);
|
2015-09-15 20:55:26 -07:00
|
|
|
|
|
2016-05-18 14:46:56 -07:00
|
|
|
|
collectionItems.querySelector('.btnAddToCollection').addEventListener('click', function () {
|
|
|
|
|
require(['alert'], function (alert) {
|
|
|
|
|
alert({
|
|
|
|
|
text: Globalize.translate('AddItemToCollectionHelp'),
|
|
|
|
|
html: Globalize.translate('AddItemToCollectionHelp') + '<br/><br/><a target="_blank" href="https://github.com/MediaBrowser/Wiki/wiki/Collections">' + Globalize.translate('ButtonLearnMore') + '</a>'
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-09-15 20:55:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 14:14:25 -07:00
|
|
|
|
function renderUserDataIcons(page, item) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
|
|
|
|
|
var userDataIcons = page.querySelectorAll('.userDataIcons');
|
|
|
|
|
|
2016-07-17 23:45:29 -07:00
|
|
|
|
var html = userdataButtons.getIconsHtml({
|
|
|
|
|
item: item,
|
|
|
|
|
style: 'fab-mini'
|
|
|
|
|
});
|
2016-06-24 08:12:13 -07:00
|
|
|
|
|
|
|
|
|
for (var i = 0, length = userDataIcons.length; i < length; i++) {
|
|
|
|
|
userDataIcons[i].innerHTML = html;
|
|
|
|
|
}
|
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") {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#criticReviewsCollapsible').classList.add('hide');
|
2013-05-19 10:35:00 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
var options = {};
|
|
|
|
|
|
|
|
|
|
if (limit) {
|
|
|
|
|
options.limit = limit;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getCriticReviews(item.Id, options).then(function (result) {
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2014-03-19 10:44:55 -07:00
|
|
|
|
if (result.TotalRecordCount || item.CriticRatingSummary || item.AwardSummary) {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#criticReviewsCollapsible').classList.remove('hide');
|
2013-05-11 23:05:51 -07:00
|
|
|
|
renderCriticReviewsContent(page, result, limit);
|
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#criticReviewsCollapsible').classList.add('hide');
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
html += '<div class="paperList criticReviewPaperList">';
|
2016-06-24 10:30:29 -07:00
|
|
|
|
html += '<div class="listItem">';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
if (review.Score != null) {
|
2015-09-24 10:08:10 -07:00
|
|
|
|
//html += review.Score;
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
else if (review.Likes != null) {
|
|
|
|
|
|
|
|
|
|
if (review.Likes) {
|
2016-09-09 09:58:08 -07:00
|
|
|
|
html += '<div style="flex-shrink:0;background-color:transparent;background-image:url(\'css/images/fresh.png\');background-repeat:no-repeat;background-position:center center;background-size: cover;width:40px;height:40px;"></div>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
} else {
|
2016-09-09 09:58:08 -07:00
|
|
|
|
html += '<div style="flex-shrink:0;background-color:transparent;background-image:url(\'css/images/rotten.png\');background-repeat:no-repeat;background-position:center center;background-size: cover;width:40px;height:40px;"></div>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-05-13 22:36:36 -07:00
|
|
|
|
|
2016-06-26 21:19:10 -07:00
|
|
|
|
html += '<div class="listItemBody two-line">';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-09-09 09:58:08 -07:00
|
|
|
|
html += '<h3 class="listItemBodyText" style="white-space:normal;">' + review.Caption + '</h3>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
var vals = [];
|
|
|
|
|
|
|
|
|
|
if (review.ReviewerName) {
|
|
|
|
|
vals.push(review.ReviewerName);
|
|
|
|
|
}
|
|
|
|
|
if (review.Publisher) {
|
|
|
|
|
vals.push(review.Publisher);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-09 09:58:08 -07:00
|
|
|
|
html += '<div class="secondary listItemBodyText">' + vals.join(', ') + '.';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (review.Date) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
2016-05-05 21:50:06 -07:00
|
|
|
|
var date = datetime.parseISO8601Date(review.Date, true).toLocaleDateString();
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
html += '<span class="reviewDate">' + date + '</span>';
|
|
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
if (review.Url) {
|
2016-09-09 09:58:08 -07:00
|
|
|
|
html += '<div class="secondary listItemBodyText"><a class="textlink" href="' + review.Url + '" target="_blank">' + Globalize.translate('ButtonFullReview') + '</a></div>';
|
2013-05-11 23:05:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 10:30:29 -07:00
|
|
|
|
html += '</div>';
|
2015-09-24 10:08:10 -07:00
|
|
|
|
|
2016-06-24 10:30:29 -07:00
|
|
|
|
html += '</div>';
|
2015-10-07 14:42:29 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
|
|
|
|
if (limit && result.TotalRecordCount > limit) {
|
2016-06-04 20:50:07 -07:00
|
|
|
|
html += '<p style="margin: 0;"><button is="emby-button" type="button" class="raised more moreCriticReviews">' + Globalize.translate('ButtonMore') + '</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;
|
2015-12-14 08:43:03 -07:00
|
|
|
|
|
|
|
|
|
if (enableScrollX()) {
|
|
|
|
|
criticReviewsContent.classList.add('hiddenScrollX');
|
|
|
|
|
} else {
|
|
|
|
|
criticReviewsContent.classList.remove('hiddenScrollX');
|
|
|
|
|
}
|
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
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).then(function (result) {
|
2014-04-14 20:54:52 -07:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
}
|
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
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#themeSongsCollapsible').classList.remove('hide');
|
2013-04-24 09:03:10 -07:00
|
|
|
|
|
2016-07-15 22:05:40 -07:00
|
|
|
|
var html = listView.getListViewHtml({
|
2016-08-05 12:34:10 -07:00
|
|
|
|
items: items
|
2014-08-15 09:35:41 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-09-07 21:22:38 -07:00
|
|
|
|
page.querySelector('#themeSongsContent').innerHTML = html;
|
2014-04-14 20:54:52 -07:00
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#themeSongsCollapsible').classList.add('hide');
|
2014-04-14 20:54:52 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderThemeVideos(page, items, user) {
|
|
|
|
|
|
|
|
|
|
if (items.length) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#themeVideosCollapsible').classList.remove('hide');
|
2014-04-14 20:54:52 -07:00
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
var themeVideosContent = page.querySelector('#themeVideosContent');
|
|
|
|
|
themeVideosContent.innerHTML = getVideosHtml(items, user);
|
|
|
|
|
ImageLoader.lazyChildren(themeVideosContent);
|
2014-04-14 20:54:52 -07:00
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#themeVideosCollapsible').classList.add('hide');
|
2014-04-14 20:54:52 -07:00
|
|
|
|
}
|
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,
|
2016-08-01 22:55:52 -07:00
|
|
|
|
Fields: "DateCreated,CanDelete",
|
2016-05-12 12:21:43 -07:00
|
|
|
|
Albums: item.Name
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function (result) {
|
2013-07-29 12:12:21 -07:00
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#musicVideosCollapsible').classList.remove('hide');
|
|
|
|
|
|
|
|
|
|
var musicVideosContent = page.querySelector('.musicVideosContent');
|
|
|
|
|
musicVideosContent.innerHTML = getVideosHtml(result.Items, user);
|
|
|
|
|
ImageLoader.lazyChildren(musicVideosContent);
|
2013-07-29 12:12:21 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#musicVideosCollapsible').classList.add('hide');
|
2013-07-29 12:12:21 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 20:02:41 -07:00
|
|
|
|
function renderAdditionalParts(page, item, user) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
|
|
|
|
|
|
|
|
|
var additionalPartsContent = page.querySelector('#additionalPartsContent');
|
|
|
|
|
additionalPartsContent.innerHTML = getVideosHtml(result.Items, user);
|
|
|
|
|
ImageLoader.lazyChildren(additionalPartsContent);
|
2013-06-12 14:46:50 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
2016-06-22 22:26:06 -07:00
|
|
|
|
page.querySelector('#additionalPartsCollapsible').classList.add('hide');
|
2013-06-12 14:46:50 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-03 04:51:45 -07:00
|
|
|
|
function renderScenes(page, item, user, limit, isStatic) {
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2014-03-21 20:35:03 -07:00
|
|
|
|
var chapters = item.Chapters || [];
|
2016-07-30 19:54:17 -07:00
|
|
|
|
var scenesContent = page.querySelector('#scenesContent');
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-09-27 08:00:57 -07:00
|
|
|
|
if (enableScrollX()) {
|
2016-07-30 19:54:17 -07:00
|
|
|
|
scenesContent.classList.add('smoothScrollX');
|
2015-09-27 08:00:57 -07:00
|
|
|
|
limit = null;
|
|
|
|
|
} else {
|
2016-07-30 19:54:17 -07:00
|
|
|
|
scenesContent.classList.add('vertical-wrap');
|
2015-09-27 08:00:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 19:54:17 -07:00
|
|
|
|
var limitExceeded = limit && chapters.length > limit;
|
2013-05-03 13:50:13 -07:00
|
|
|
|
|
2016-07-30 19:54:17 -07:00
|
|
|
|
if (limitExceeded) {
|
|
|
|
|
chapters = chapters.slice(0);
|
|
|
|
|
chapters.length = Math.min(limit, chapters.length);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 19:54:17 -07:00
|
|
|
|
require(['chaptercardbuilder'], function (chaptercardbuilder) {
|
2015-09-27 08:00:57 -07:00
|
|
|
|
|
2016-07-30 19:54:17 -07:00
|
|
|
|
chaptercardbuilder.buildChapterCards(item, chapters, {
|
|
|
|
|
itemsContainer: scenesContent,
|
|
|
|
|
coverImage: true,
|
2016-07-30 21:11:23 -07:00
|
|
|
|
width: 400,
|
|
|
|
|
backdropShape: getThumbShape(),
|
|
|
|
|
squareShape: getSquareShape()
|
2016-07-30 19:54:17 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-07-30 19:54:17 -07:00
|
|
|
|
if (limitExceeded) {
|
|
|
|
|
page.querySelector('.moreScenes').classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.moreScenes').classList.add('hide');
|
|
|
|
|
}
|
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);
|
|
|
|
|
|
2016-08-04 23:10:24 -07:00
|
|
|
|
html += '<h3 class="mediaInfoStreamType">' + displayType + '</h3>';
|
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
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
if (stream.CodecTag) {
|
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoCodecTag'), stream.CodecTag));
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-27 12:23:05 -07:00
|
|
|
|
if (stream.IsAVC != null) {
|
2016-04-27 18:59:54 -07:00
|
|
|
|
attributes.push(createAttribute('AVC', (stream.IsAVC ? 'Yes' : 'No')));
|
2016-04-27 12:23:05 -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") {
|
2016-07-26 17:43:27 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoBitrate'), (parseInt(stream.BitRate / 1000)) + ' kbps'));
|
2013-11-12 09:08:23 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-20 08:55:22 -07:00
|
|
|
|
if (stream.SampleRate) {
|
2016-07-26 17:43:27 -07:00
|
|
|
|
attributes.push(createAttribute(Globalize.translate('MediaInfoSampleRate'), stream.SampleRate + ' Hz'));
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-18 10:43:00 -07:00
|
|
|
|
if (stream.NalLengthSize) {
|
|
|
|
|
attributes.push(createAttribute('NAL', stream.NalLengthSize));
|
2015-04-10 12:08:09 -07:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2016-05-14 11:02:06 -07:00
|
|
|
|
if (stream.DisplayTitle) {
|
|
|
|
|
attributes.push(createAttribute('Title', stream.DisplayTitle));
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2016-09-12 14:24:05 -07:00
|
|
|
|
var html = cardBuilder.getCardsHtml({
|
|
|
|
|
items: items,
|
2016-09-14 23:23:39 -07:00
|
|
|
|
shape: "auto",
|
2016-09-12 14:24:05 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
action: 'play',
|
|
|
|
|
overlayText: true,
|
|
|
|
|
showRuntime: true
|
|
|
|
|
});
|
2013-03-26 11:51:52 -07:00
|
|
|
|
|
2013-05-11 23:05:51 -07:00
|
|
|
|
if (limit && items.length > limit) {
|
2016-06-04 20:50:07 -07:00
|
|
|
|
html += '<p style="margin: 0;padding-left:5px;"><button is="emby-button" type="button" class="raised more ' + moreButtonClass + '">' + Globalize.translate('ButtonMore') + '</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
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getSpecialFeatures(user.Id, item.Id).then(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
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
var people = item.People || [];
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var castContent = page.querySelector('#castContent');
|
2015-09-27 08:00:57 -07:00
|
|
|
|
|
|
|
|
|
if (enableScrollX()) {
|
2016-07-30 21:11:23 -07:00
|
|
|
|
castContent.classList.add('smoothScrollX');
|
|
|
|
|
limit = 32;
|
2015-09-27 08:00:57 -07:00
|
|
|
|
} else {
|
2016-07-30 21:11:23 -07:00
|
|
|
|
castContent.classList.add('vertical-wrap');
|
2015-09-27 08:00:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
var limitExceeded = limit && people.length > limit;
|
2015-09-27 08:00:57 -07:00
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
if (limitExceeded) {
|
|
|
|
|
people = people.slice(0);
|
|
|
|
|
people.length = Math.min(limit, people.length);
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
require(['peoplecardbuilder'], function (peoplecardbuilder) {
|
2015-09-27 08:00:57 -07:00
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
peoplecardbuilder.buildPeopleCards(people, {
|
|
|
|
|
itemsContainer: castContent,
|
|
|
|
|
coverImage: true,
|
|
|
|
|
serverId: item.ServerId,
|
|
|
|
|
width: 160,
|
|
|
|
|
shape: getPortraitShape()
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-09-27 08:00:57 -07:00
|
|
|
|
|
2016-07-30 21:11:23 -07:00
|
|
|
|
if (limitExceeded && !enableScrollX()) {
|
|
|
|
|
page.querySelector('.morePeople').classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.morePeople').classList.add('hide');
|
2015-09-27 08:00:57 -07:00
|
|
|
|
}
|
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
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function splitVersions(page, params) {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2016-02-22 12:12:06 -07:00
|
|
|
|
require(['confirm'], function (confirm) {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2016-02-22 12:12:06 -07:00
|
|
|
|
confirm("Are you sure you wish to split the media sources into separate items?", "Split Media Apart").then(function () {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2014-07-01 22:16:59 -07:00
|
|
|
|
ApiClient.ajax({
|
2014-03-19 10:44:55 -07:00
|
|
|
|
type: "DELETE",
|
2016-05-19 10:27:39 -07:00
|
|
|
|
url: ApiClient.getUrl("Videos/" + params.id + "/AlternateSources")
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function () {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
reload(page, params);
|
2014-03-19 10:44:55 -07:00
|
|
|
|
});
|
2016-02-22 12:12:06 -07:00
|
|
|
|
});
|
2014-03-19 10:44:55 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function playTrailer(page) {
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).then(function (trailers) {
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
2014-03-29 08:40:32 -07:00
|
|
|
|
MediaController.play({ items: trailers });
|
2014-03-19 10:44:55 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-17 13:30:14 -07:00
|
|
|
|
function showPlayMenu(item, target) {
|
|
|
|
|
|
|
|
|
|
require(['playMenu'], function (playMenu) {
|
|
|
|
|
|
|
|
|
|
playMenu.show({
|
|
|
|
|
|
|
|
|
|
item: item,
|
|
|
|
|
positionTo: target
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
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-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).then(function (channel) {
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-07-17 13:30:14 -07:00
|
|
|
|
showPlayMenu(channel, button);
|
2015-07-28 20:42:03 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-17 13:30:14 -07:00
|
|
|
|
showPlayMenu(currentItem, button);
|
2015-07-28 20:42:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function deleteTimer(page, params, id) {
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-02-22 12:12:06 -07:00
|
|
|
|
require(['confirm'], function (confirm) {
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-02-22 12:12:06 -07:00
|
|
|
|
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.cancelLiveTvTimer(id).then(function () {
|
2013-08-08 07:53:25 -07:00
|
|
|
|
|
2016-02-24 23:38:12 -07:00
|
|
|
|
require(['toast'], function (toast) {
|
|
|
|
|
toast(Globalize.translate('MessageRecordingCancelled'));
|
|
|
|
|
});
|
2013-08-23 19:53:30 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
reload(page, params);
|
2015-07-28 20:42:03 -07:00
|
|
|
|
});
|
2016-02-22 12:12:06 -07:00
|
|
|
|
});
|
2015-07-28 20:42:03 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
function itemDetailPage() {
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
self.play = play;
|
|
|
|
|
self.setInitialCollapsibleState = setInitialCollapsibleState;
|
|
|
|
|
self.renderDetails = renderDetails;
|
|
|
|
|
self.renderCriticReviews = renderCriticReviews;
|
|
|
|
|
self.renderCast = renderCast;
|
|
|
|
|
self.renderScenes = renderScenes;
|
|
|
|
|
self.renderMediaSources = renderMediaSources;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.ItemDetailPage = new itemDetailPage();
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
function onPlayClick() {
|
|
|
|
|
playCurrentItem(this);
|
|
|
|
|
}
|
2014-07-19 21:46:29 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
function onSyncClick() {
|
|
|
|
|
require(['syncDialog'], function (syncDialog) {
|
|
|
|
|
syncDialog.showMenu({
|
2016-08-22 23:42:15 -07:00
|
|
|
|
items: [currentItem],
|
|
|
|
|
serverId: ApiClient.serverId()
|
2014-12-12 20:56:30 -07:00
|
|
|
|
});
|
2014-07-19 21:46:29 -07:00
|
|
|
|
});
|
2016-06-24 08:12:13 -07:00
|
|
|
|
}
|
2014-07-19 21:46:29 -07:00
|
|
|
|
|
2016-08-15 21:12:12 -07:00
|
|
|
|
return function (view, params) {
|
|
|
|
|
|
2016-08-15 22:34:36 -07:00
|
|
|
|
function resetSyncStatus() {
|
|
|
|
|
updateSyncStatus(view, currentItem);
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-15 21:12:12 -07:00
|
|
|
|
function onSyncLocalClick() {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
|
2016-08-15 21:12:12 -07:00
|
|
|
|
if (this.checked) {
|
|
|
|
|
require(['syncDialog'], function (syncDialog) {
|
|
|
|
|
syncDialog.showMenu({
|
2016-08-22 22:08:07 -07:00
|
|
|
|
items: [currentItem],
|
2016-08-22 23:42:15 -07:00
|
|
|
|
isLocalSync: true,
|
|
|
|
|
serverId: ApiClient.serverId()
|
|
|
|
|
|
2016-08-15 22:34:36 -07:00
|
|
|
|
}).then(function () {
|
|
|
|
|
reload(view, params);
|
|
|
|
|
}, resetSyncStatus);
|
2016-08-15 11:18:05 -07:00
|
|
|
|
});
|
2016-08-15 21:12:12 -07:00
|
|
|
|
} else {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
|
2016-08-15 21:12:12 -07:00
|
|
|
|
require(['confirm'], function (confirm) {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
|
2016-08-15 21:12:12 -07:00
|
|
|
|
confirm(Globalize.translate('ConfirmRemoveDownload')).then(function () {
|
|
|
|
|
ApiClient.cancelSyncItems([currentItem.Id]);
|
2016-08-15 22:34:36 -07:00
|
|
|
|
}, resetSyncStatus);
|
2016-08-15 21:12:12 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
function onPlayTrailerClick() {
|
|
|
|
|
playTrailer(view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onRecordClick() {
|
2016-05-19 10:27:39 -07:00
|
|
|
|
var id = params.id;
|
2016-05-13 11:28:05 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2016-05-12 19:32:12 -07:00
|
|
|
|
require(['recordingCreator'], function (recordingCreator) {
|
|
|
|
|
recordingCreator.show(id, currentItem.ServerId).then(function () {
|
2016-05-19 10:27:39 -07:00
|
|
|
|
reload(view, params);
|
2015-12-15 11:24:41 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
2016-06-24 08:12:13 -07:00
|
|
|
|
}
|
2015-07-28 20:42:03 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
function onCancelRecordingClick() {
|
2016-05-19 10:27:39 -07:00
|
|
|
|
deleteTimer(view, params, currentItem.TimerId);
|
2016-06-24 08:12:13 -07:00
|
|
|
|
}
|
2014-08-07 21:36:51 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
function onMoreCommandsClick() {
|
2014-08-07 21:36:51 -07:00
|
|
|
|
var button = this;
|
|
|
|
|
|
2016-07-16 18:58:51 -07:00
|
|
|
|
itemContextMenu.show(getContextMenuOptions(currentItem, button)).then(function (result) {
|
2014-08-07 21:36:51 -07:00
|
|
|
|
|
2016-07-16 18:58:51 -07:00
|
|
|
|
if (result.deleted) {
|
|
|
|
|
Emby.Page.goHome();
|
|
|
|
|
|
|
|
|
|
} else if (result.updated) {
|
2016-06-28 19:44:07 -07:00
|
|
|
|
reload(view, params);
|
2016-07-16 18:58:51 -07:00
|
|
|
|
}
|
2014-08-07 21:36:51 -07:00
|
|
|
|
});
|
2016-06-24 08:12:13 -07:00
|
|
|
|
}
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
var elems = view.querySelectorAll('.btnPlay');
|
|
|
|
|
var i, length;
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onPlayClick);
|
|
|
|
|
}
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
elems = view.querySelectorAll('.btnPlayTrailer');
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onPlayTrailerClick);
|
|
|
|
|
}
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
view.querySelector('.btnSplitVersions').addEventListener('click', function () {
|
2014-08-30 07:26:29 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
splitVersions(view, params);
|
2014-08-30 07:26:29 -07:00
|
|
|
|
});
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
elems = view.querySelectorAll('.btnSync');
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onSyncClick);
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-08-15 11:18:05 -07:00
|
|
|
|
elems = view.querySelectorAll('.chkOffline');
|
2016-08-12 08:54:37 -07:00
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
2016-08-15 11:18:05 -07:00
|
|
|
|
elems[i].addEventListener('change', onSyncLocalClick);
|
2016-08-12 08:54:37 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
elems = view.querySelectorAll('.btnRecord,.btnFloatingRecord');
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onRecordClick);
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
elems = view.querySelectorAll('.btnCancelRecording');
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onCancelRecordingClick);
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
elems = view.querySelectorAll('.btnMoreCommands');
|
|
|
|
|
for (i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
elems[i].addEventListener('click', onMoreCommandsClick);
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
|
2016-06-24 08:12:13 -07:00
|
|
|
|
view.addEventListener('click', function (e) {
|
|
|
|
|
|
2016-07-18 11:53:04 -07:00
|
|
|
|
if (dom.parentWithClass(e.target, 'moreScenes')) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
Dashboard.getCurrentUser().then(function (user) {
|
|
|
|
|
renderScenes(view, currentItem, user);
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-07-18 11:53:04 -07:00
|
|
|
|
else if (dom.parentWithClass(e.target, 'morePeople')) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
renderCast(view, currentItem, params.context);
|
|
|
|
|
}
|
2016-07-18 11:53:04 -07:00
|
|
|
|
else if (dom.parentWithClass(e.target, 'moreSpecials')) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
Dashboard.getCurrentUser().then(function (user) {
|
|
|
|
|
renderSpecials(view, currentItem, user);
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-07-18 11:53:04 -07:00
|
|
|
|
else if (dom.parentWithClass(e.target, 'moreCriticReviews')) {
|
2016-06-24 08:12:13 -07:00
|
|
|
|
renderCriticReviews(view, currentItem);
|
|
|
|
|
}
|
2013-05-11 23:05:51 -07:00
|
|
|
|
});
|
2014-02-17 20:02:41 -07:00
|
|
|
|
|
2016-07-17 09:59:14 -07:00
|
|
|
|
view.querySelector('.collectionItems').addEventListener('needsrefresh', function (e) {
|
2016-06-01 23:08:47 -07:00
|
|
|
|
|
2016-07-17 09:59:14 -07:00
|
|
|
|
renderChildren(view, currentItem);
|
2016-06-01 23:08:47 -07:00
|
|
|
|
});
|
|
|
|
|
|
2016-07-30 22:25:54 -07:00
|
|
|
|
function editImages() {
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
|
|
2016-08-29 23:06:24 -07:00
|
|
|
|
require(['imageEditor'], function (imageEditor) {
|
2016-07-30 22:25:54 -07:00
|
|
|
|
|
2016-08-29 23:06:24 -07:00
|
|
|
|
imageEditor.show({
|
|
|
|
|
|
|
|
|
|
itemId: currentItem.Id,
|
|
|
|
|
serverId: currentItem.ServerId
|
|
|
|
|
|
|
|
|
|
}).then(resolve, reject);
|
2016-07-30 22:25:54 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-28 21:05:16 -07:00
|
|
|
|
view.querySelector('.detailImageContainer').addEventListener('click', function (e) {
|
2016-07-18 20:57:55 -07:00
|
|
|
|
var itemDetailGalleryLink = dom.parentWithClass(e.target, 'itemDetailGalleryLink');
|
2016-06-28 21:05:16 -07:00
|
|
|
|
if (itemDetailGalleryLink) {
|
2016-07-30 22:25:54 -07:00
|
|
|
|
editImages().then(function () {
|
2016-06-28 21:05:16 -07:00
|
|
|
|
reload(view, params);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-06-01 23:08:47 -07:00
|
|
|
|
|
2016-06-11 08:56:15 -07:00
|
|
|
|
function onWebSocketMessage(e, data) {
|
|
|
|
|
|
|
|
|
|
var msg = data;
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
currentItem.UserData = userData;
|
|
|
|
|
|
|
|
|
|
Dashboard.getCurrentUser().then(function (user) {
|
|
|
|
|
|
|
|
|
|
refreshImage(view, currentItem, user);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-17 22:56:10 -07:00
|
|
|
|
view.querySelector('.chapterSettingsButton').addEventListener('click', function () {
|
|
|
|
|
Dashboard.navigate('librarysettings.html');
|
|
|
|
|
});
|
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
view.addEventListener('viewbeforeshow', function () {
|
|
|
|
|
var page = this;
|
|
|
|
|
reload(page, params);
|
2014-10-06 16:58:46 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
Events.on(ApiClient, 'websocketmessage', onWebSocketMessage);
|
|
|
|
|
});
|
2015-12-14 08:43:03 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
view.addEventListener('viewbeforehide', function () {
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
currentItem = null;
|
2013-04-10 14:14:25 -07:00
|
|
|
|
|
2016-05-19 10:27:39 -07:00
|
|
|
|
Events.off(ApiClient, 'websocketmessage', onWebSocketMessage);
|
|
|
|
|
LibraryMenu.setTransparentMenu(false);
|
|
|
|
|
});
|
|
|
|
|
};
|
2016-03-13 21:56:41 -07:00
|
|
|
|
});
|