2013-04-10 10:36:34 -07:00
|
|
|
|
(function ($, document, LibraryBrowser) {
|
2013-03-27 15:29:37 -07:00
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
var currentItem;
|
2013-04-24 07:05:47 -07:00
|
|
|
|
var shape;
|
2015-02-02 11:14:02 -07:00
|
|
|
|
var _childrenItemsFunction;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-05-31 18:48:41 -07:00
|
|
|
|
function getPromise() {
|
2013-04-10 10:36:34 -07:00
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
return ApiClient.getItem(Dashboard.getCurrentUserId(), id);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-18 18:42:53 -07:00
|
|
|
|
var name = getParameterByName('genre');
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-05-31 18:48:41 -07:00
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
2013-04-25 20:31:10 -07:00
|
|
|
|
|
2013-06-10 20:31:00 -07:00
|
|
|
|
name = getParameterByName('musicgenre');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 10:17:33 -07:00
|
|
|
|
name = getParameterByName('gamegenre');
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId());
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-21 13:48:26 -07:00
|
|
|
|
name = getParameterByName('musicartist');
|
2013-04-21 21:38:03 -07:00
|
|
|
|
|
2013-05-31 18:48:41 -07:00
|
|
|
|
if (name) {
|
|
|
|
|
return ApiClient.getArtist(name, Dashboard.getCurrentUserId());
|
2013-03-27 15:29:37 -07:00
|
|
|
|
}
|
2013-05-31 18:48:41 -07:00
|
|
|
|
else {
|
|
|
|
|
throw new Error('Invalid request');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
2013-03-27 15:29:37 -07:00
|
|
|
|
|
2013-05-31 18:48:41 -07:00
|
|
|
|
getPromise().done(function (item) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-06-20 08:10:40 -07:00
|
|
|
|
var context = getParameterByName('context');
|
|
|
|
|
|
|
|
|
|
var editQuery = '?id=' + item.Id;
|
|
|
|
|
if (context) {
|
|
|
|
|
editQuery += '&context=' + context;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
currentItem = item;
|
|
|
|
|
|
2014-08-16 22:38:13 -07:00
|
|
|
|
Backdrops.setBackdrops(page, [item]);
|
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
renderHeader(page, item, context);
|
2013-04-23 07:46:27 -07:00
|
|
|
|
|
2013-07-29 08:05:09 -07:00
|
|
|
|
var name = item.Name;
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
Dashboard.setPageTitle(name);
|
|
|
|
|
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.itemName', page).html(name);
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
renderDetails(page, item, context);
|
|
|
|
|
renderTabs(page, item, context);
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2014-04-13 10:27:13 -07:00
|
|
|
|
$(page).trigger('displayingitem', [{
|
2013-05-10 05:18:07 -07:00
|
|
|
|
|
2014-04-13 10:27:13 -07:00
|
|
|
|
item: item,
|
2014-06-20 08:10:40 -07:00
|
|
|
|
context: context
|
2014-04-13 10:27:13 -07:00
|
|
|
|
}]);
|
2013-05-10 05:18:07 -07:00
|
|
|
|
|
2013-06-27 06:31:49 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
|
2014-03-29 08:40:32 -07:00
|
|
|
|
if (MediaController.canPlay(item)) {
|
2014-07-04 22:21:13 -07:00
|
|
|
|
$('.btnPlay', page).show();
|
2014-01-22 19:19:04 -07:00
|
|
|
|
} else {
|
2014-07-04 22:21:13 -07:00
|
|
|
|
$('.btnPlay', page).hide();
|
2014-01-22 19:19:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-16 22:30:31 -07:00
|
|
|
|
if (SyncManager.isAvailable(item, user)) {
|
|
|
|
|
$('.btnSync', page).removeClass('hide');
|
|
|
|
|
} else {
|
|
|
|
|
$('.btnSync', page).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-19 23:06:27 -07:00
|
|
|
|
var editImagesHref = user.Policy.IsAdministrator ? 'edititemimages.html' + editQuery : null;
|
2014-06-20 08:10:40 -07:00
|
|
|
|
|
2014-08-16 22:38:13 -07:00
|
|
|
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item, editImagesHref, true));
|
2014-01-03 21:53:49 -07:00
|
|
|
|
|
2014-08-21 19:24:38 -07:00
|
|
|
|
if (LibraryBrowser.getMoreCommands(item, user).length) {
|
|
|
|
|
$('.btnMoreCommands', page).show();
|
2013-06-27 06:31:49 -07:00
|
|
|
|
} else {
|
2014-08-21 19:24:38 -07:00
|
|
|
|
$('.btnMoreCommands', page).show();
|
2013-06-27 06:31:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
function renderHeader(page, item, context) {
|
2013-04-25 20:31:10 -07:00
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
$('.itemTabs', page).hide();
|
|
|
|
|
|
|
|
|
|
if (context == "movies" && item.Type == "Genre") {
|
|
|
|
|
$('#movieGenreTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context == "movies" && item.Type == "Person") {
|
|
|
|
|
$('#moviePeopleTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context == "movies" && item.Type == "Studio") {
|
|
|
|
|
$('#movieStudioTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context == "tv" && item.Type == "Studio") {
|
|
|
|
|
$('#tvStudioTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context == "tv" && item.Type == "Genre") {
|
|
|
|
|
$('#tvGenreTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (context == "tv" && item.Type == "Person") {
|
|
|
|
|
$('#tvPeopleTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-10 20:31:00 -07:00
|
|
|
|
if (context == "music" && item.Type == "MusicGenre") {
|
2013-04-23 07:46:27 -07:00
|
|
|
|
$('#musicGenreTabs', page).show();
|
|
|
|
|
}
|
2013-11-21 13:48:26 -07:00
|
|
|
|
if (context == "music" && item.Type == "MusicArtist") {
|
2013-04-23 19:50:43 -07:00
|
|
|
|
$('#artistTabs', page).show();
|
|
|
|
|
}
|
2013-07-01 10:17:33 -07:00
|
|
|
|
if (context == "games" && item.Type == "GameGenre") {
|
2013-04-28 11:39:38 -07:00
|
|
|
|
$('#gameGenreTabs', page).show();
|
|
|
|
|
}
|
|
|
|
|
if (context == "games" && item.Type == "Studio") {
|
|
|
|
|
$('#gameStudioTabs', page).show();
|
|
|
|
|
}
|
2013-04-23 07:46:27 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
function renderTabs(page, item, context) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
var html = '<fieldset data-role="controlgroup" data-type="horizontal" class="libraryTabs">';
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
html += '<legend></legend>';
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.MovieCount) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioMovies" class="context-movies" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioMovies">' + Globalize.translate('TabMovies') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.SeriesCount) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioShows" class="context-tv" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioShows">' + Globalize.translate('TabSeries') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.EpisodeCount) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioEpisodes" class="context-tv" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioEpisodes">' + Globalize.translate('TabEpisodes') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.TrailerCount) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioTrailers" class="context-movies" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioTrailers">' + Globalize.translate('TabTrailers') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.GameCount) {
|
2013-04-17 07:42:25 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioGames" class="context-games" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioGames">' + Globalize.translate('TabGames') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.AlbumCount) {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioAlbums" class="context-music" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioAlbums">' + Globalize.translate('TabAlbums') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-17 07:42:25 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.SongCount) {
|
2013-04-17 07:42:25 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioSongs" class="context-music" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioSongs">' + Globalize.translate('TabSongs') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-04-17 07:42:25 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (item.MusicVideoCount) {
|
2013-04-17 07:42:25 -07:00
|
|
|
|
|
2014-09-05 21:21:23 -07:00
|
|
|
|
html += '<input type="radio" name="ibnItems" id="radioMusicVideos" class="context-music" value="on">';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
html += '<label for="radioMusicVideos">' + Globalize.translate('TabMusicVideos') + '</label>';
|
2013-09-10 11:56:00 -07:00
|
|
|
|
}
|
2013-05-27 18:59:26 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
html += '</fieldset>';
|
2013-05-27 18:59:26 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
var elem = $('#itemTabs', page).html(html).trigger('create');
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
bindRadioEvents(page);
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
var selectedRadio = null;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (context) {
|
|
|
|
|
selectedRadio = $('.context-' + context + ':first', elem);
|
|
|
|
|
}
|
2013-08-31 07:50:54 -07:00
|
|
|
|
|
2013-09-10 11:56:00 -07:00
|
|
|
|
if (selectedRadio && selectedRadio.length) {
|
|
|
|
|
selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click');
|
|
|
|
|
} else {
|
|
|
|
|
$('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click');
|
|
|
|
|
}
|
2013-08-31 07:50:54 -07:00
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bindRadioEvents(page) {
|
|
|
|
|
|
2013-05-27 18:59:26 -07:00
|
|
|
|
$("#radioMusicVideos", page).on("click", function () {
|
|
|
|
|
|
|
|
|
|
shape = "poster";
|
|
|
|
|
loadItems(page, {
|
|
|
|
|
MediaTypes: "",
|
|
|
|
|
IncludeItemTypes: "MusicVideo",
|
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-05-27 18:59:26 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
$("#radioMovies", page).on("click", function () {
|
|
|
|
|
|
2013-05-05 19:23:19 -07:00
|
|
|
|
shape = "poster";
|
2013-04-24 07:05:47 -07:00
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "Movie",
|
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#radioShows", page).on("click", function () {
|
2013-04-16 22:36:56 -07:00
|
|
|
|
|
2013-05-05 19:23:19 -07:00
|
|
|
|
shape = "poster";
|
2013-04-24 07:05:47 -07:00
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "Series",
|
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-17 21:45:00 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#radioTrailers", page).on("click", function () {
|
|
|
|
|
|
2013-04-24 07:05:47 -07:00
|
|
|
|
shape = "poster";
|
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "Trailer",
|
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-17 21:45:00 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#radioGames", page).on("click", function () {
|
|
|
|
|
|
2013-04-24 07:05:47 -07:00
|
|
|
|
shape = "poster";
|
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
IncludeItemTypes: "",
|
|
|
|
|
MediaTypes: "Game",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-17 21:45:00 -07:00
|
|
|
|
});
|
|
|
|
|
|
2013-05-03 21:38:38 -07:00
|
|
|
|
$("#radioEpisodes", page).on("click", function () {
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-04-24 07:05:47 -07:00
|
|
|
|
shape = "backdrop";
|
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "Episode",
|
2013-05-03 21:38:38 -07:00
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-16 22:36:56 -07:00
|
|
|
|
});
|
2013-04-19 16:57:23 -07:00
|
|
|
|
|
|
|
|
|
$("#radioAlbums", page).on("click", function () {
|
|
|
|
|
|
2013-04-25 18:17:22 -07:00
|
|
|
|
shape = "square";
|
2013-04-24 07:05:47 -07:00
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "MusicAlbum",
|
2013-04-25 16:28:01 -07:00
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-19 16:57:23 -07:00
|
|
|
|
});
|
2013-04-19 17:44:35 -07:00
|
|
|
|
|
|
|
|
|
$("#radioSongs", page).on("click", function () {
|
|
|
|
|
|
2013-04-24 07:05:47 -07:00
|
|
|
|
loadItems(page, {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
MediaTypes: "",
|
2013-04-24 07:05:47 -07:00
|
|
|
|
IncludeItemTypes: "Audio",
|
2013-04-25 16:28:01 -07:00
|
|
|
|
PersonTypes: "",
|
2015-03-13 10:25:28 -07:00
|
|
|
|
ArtistIds: ""
|
2013-04-24 07:05:47 -07:00
|
|
|
|
});
|
2013-04-19 17:44:35 -07:00
|
|
|
|
});
|
2013-04-16 22:36:56 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
function renderDetails(page, item, context) {
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2014-08-16 22:38:13 -07:00
|
|
|
|
//LibraryBrowser.renderDetailPageBackdrop(page, item);
|
2013-05-14 21:05:52 -07:00
|
|
|
|
LibraryBrowser.renderOverview($('.itemOverview', page), item);
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
renderUserDataIcons(page, item);
|
2013-04-14 08:14:10 -07:00
|
|
|
|
LibraryBrowser.renderLinks($('#itemLinks', page), item);
|
2013-04-12 11:22:40 -07:00
|
|
|
|
|
2014-06-28 12:35:30 -07:00
|
|
|
|
LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
|
2013-06-10 18:28:41 -07:00
|
|
|
|
|
2013-04-12 11:22:40 -07:00
|
|
|
|
if (item.Type == "Person" && item.PremiereDate) {
|
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
try {
|
|
|
|
|
var birthday = parseISO8601Date(item.PremiereDate, { toLocal: true }).toDateString();
|
2013-04-12 11:22:40 -07:00
|
|
|
|
|
2014-08-24 08:48:06 -07:00
|
|
|
|
$('#itemBirthday', page).show().html(Globalize.translate('BirthDateValue').replace('{0}', birthday));
|
2013-04-18 22:08:18 -07:00
|
|
|
|
}
|
2013-04-19 17:44:35 -07:00
|
|
|
|
catch (err) {
|
2013-04-18 22:08:18 -07:00
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
2013-04-12 11:22:40 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Person" && item.EndDate) {
|
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
try {
|
|
|
|
|
var deathday = parseISO8601Date(item.EndDate, { toLocal: true }).toDateString();
|
2013-04-12 11:22:40 -07:00
|
|
|
|
|
2014-08-24 08:48:06 -07:00
|
|
|
|
$('#itemDeathDate', page).show().html(Globalize.translate('DeathDateValue').replace('{0}', deathday));
|
2013-04-18 22:08:18 -07:00
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
$('#itemBirthday', page).hide();
|
|
|
|
|
}
|
2013-04-12 11:22:40 -07:00
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type == "Person" && item.ProductionLocations && item.ProductionLocations.length) {
|
|
|
|
|
|
2013-05-12 13:30:23 -07:00
|
|
|
|
var gmap = '<a class="textlink" target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>';
|
2013-04-12 11:22:40 -07:00
|
|
|
|
|
2014-08-24 08:48:06 -07:00
|
|
|
|
$('#itemBirthLocation', page).show().html(Globalize.translate('BirthPlaceValue').replace('{0}', gmap)).trigger('create');
|
2013-04-12 11:22:40 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('#itemBirthLocation', page).hide();
|
|
|
|
|
}
|
2013-04-10 10:36:34 -07:00
|
|
|
|
}
|
2013-04-02 13:02:23 -07:00
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
function renderUserDataIcons(page, item) {
|
2013-05-14 21:05:52 -07:00
|
|
|
|
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
|
2013-04-10 10:36:34 -07:00
|
|
|
|
}
|
2013-04-02 13:02:23 -07:00
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
function addCurrentItemToQuery(query) {
|
|
|
|
|
|
|
|
|
|
if (currentItem.Type == "Person") {
|
2015-03-18 10:04:49 -07:00
|
|
|
|
query.PersonIds = currentItem.Id;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
}
|
|
|
|
|
else if (currentItem.Type == "Genre") {
|
|
|
|
|
query.Genres = currentItem.Name;
|
|
|
|
|
}
|
2013-06-10 20:31:00 -07:00
|
|
|
|
else if (currentItem.Type == "MusicGenre") {
|
|
|
|
|
query.Genres = currentItem.Name;
|
|
|
|
|
}
|
2013-07-01 10:17:33 -07:00
|
|
|
|
else if (currentItem.Type == "GameGenre") {
|
|
|
|
|
query.Genres = currentItem.Name;
|
|
|
|
|
}
|
2013-04-17 21:45:00 -07:00
|
|
|
|
else if (currentItem.Type == "Studio") {
|
2015-03-13 11:45:03 -07:00
|
|
|
|
query.StudioIds = currentItem.Id;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
}
|
2013-11-21 13:48:26 -07:00
|
|
|
|
else if (currentItem.Type == "MusicArtist") {
|
2015-03-13 10:25:28 -07:00
|
|
|
|
query.ArtistIds = currentItem.Id;
|
2013-04-24 07:05:47 -07:00
|
|
|
|
}
|
2013-04-25 20:31:10 -07:00
|
|
|
|
}
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2015-04-25 20:25:07 -07:00
|
|
|
|
function getQuery(options) {
|
2015-02-02 11:14:02 -07:00
|
|
|
|
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
SortBy: "SortName",
|
|
|
|
|
SortOrder: "Ascending",
|
|
|
|
|
IncludeItemTypes: "",
|
|
|
|
|
Recursive: true,
|
|
|
|
|
Fields: "AudioInfo,SeriesInfo,ParentId,PrimaryImageAspectRatio,SyncInfo",
|
|
|
|
|
Limit: LibraryBrowser.getDefaultPageSize(),
|
|
|
|
|
StartIndex: 0,
|
|
|
|
|
CollapseBoxSetItems: false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
query = $.extend(query, options || {});
|
|
|
|
|
|
|
|
|
|
if (query.IncludeItemTypes == "Audio") {
|
|
|
|
|
query.SortBy = "AlbumArtist,Album,SortName";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addCurrentItemToQuery(query);
|
|
|
|
|
|
2015-04-25 20:25:07 -07:00
|
|
|
|
return query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getItemsFunction(options) {
|
|
|
|
|
|
|
|
|
|
var query = getQuery(options);
|
|
|
|
|
|
2015-02-02 11:14:02 -07:00
|
|
|
|
return function (index, limit, fields) {
|
|
|
|
|
|
|
|
|
|
query.StartIndex = index;
|
|
|
|
|
query.Limit = limit;
|
|
|
|
|
query.Fields = fields;
|
|
|
|
|
|
|
|
|
|
return ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
function loadItems(page, options) {
|
|
|
|
|
|
2013-04-17 22:13:44 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-02-02 11:14:02 -07:00
|
|
|
|
_childrenItemsFunction = getItemsFunction(options);
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2015-04-25 20:25:07 -07:00
|
|
|
|
var query = getQuery(options);
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2015-04-25 20:25:07 -07:00
|
|
|
|
getItemsFunction(options)(options.StartIndex, options.Limit, options.Fields).done(function (result) {
|
2013-05-18 10:07:20 -07:00
|
|
|
|
|
2013-04-17 21:45:00 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-04-19 17:44:35 -07:00
|
|
|
|
if (result.TotalRecordCount > query.Limit) {
|
|
|
|
|
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
|
|
|
|
|
$('.viewSettings', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.listTopPaging', page).html('');
|
|
|
|
|
$('.viewSettings', page).hide();
|
|
|
|
|
}
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2014-05-09 12:43:06 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
2013-05-12 18:54:06 -07:00
|
|
|
|
if (query.IncludeItemTypes == "Audio") {
|
2013-05-27 18:59:26 -07:00
|
|
|
|
|
2014-08-15 09:35:41 -07:00
|
|
|
|
html = LibraryBrowser.getListViewHtml({
|
|
|
|
|
items: result.Items,
|
2014-08-21 08:55:35 -07:00
|
|
|
|
smallIcon: true,
|
2014-08-30 07:26:29 -07:00
|
|
|
|
playFromHere: true,
|
|
|
|
|
defaultAction: 'playallfromhere'
|
2013-05-12 18:54:06 -07:00
|
|
|
|
});
|
2014-01-01 11:26:31 -07:00
|
|
|
|
}
|
|
|
|
|
else if (query.IncludeItemTypes == "Movie" || query.IncludeItemTypes == "Trailer") {
|
2013-05-12 18:54:06 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "portrait",
|
|
|
|
|
context: 'movies',
|
2014-01-14 22:01:58 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
centerText: true
|
2014-01-01 11:26:31 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (query.IncludeItemTypes == "Episode") {
|
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-05-09 12:43:06 -07:00
|
|
|
|
overlayText: screenWidth >= 600
|
2014-01-01 11:26:31 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (query.IncludeItemTypes == "Series") {
|
|
|
|
|
|
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
preferThumb: true,
|
|
|
|
|
context: 'tv'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (query.IncludeItemTypes == "MusicAlbum") {
|
|
|
|
|
|
2014-08-21 19:24:38 -07:00
|
|
|
|
html = LibraryBrowser.getPosterViewHtml({
|
2014-01-01 11:26:31 -07:00
|
|
|
|
items: result.Items,
|
2014-08-21 19:24:38 -07:00
|
|
|
|
shape: "square",
|
|
|
|
|
context: 'music',
|
2014-08-22 10:26:58 -07:00
|
|
|
|
playFromHere: true,
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true
|
2014-01-01 11:26:31 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-05-27 18:59:26 -07:00
|
|
|
|
|
2014-08-16 22:38:13 -07:00
|
|
|
|
html = LibraryBrowser.getListViewHtml({
|
2013-05-12 18:54:06 -07:00
|
|
|
|
items: result.Items,
|
2014-08-16 22:38:13 -07:00
|
|
|
|
smallIcon: true
|
2013-05-12 18:54:06 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-04-19 09:28:06 -07:00
|
|
|
|
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2015-01-26 09:47:15 -07:00
|
|
|
|
$('#items', page).html(html).trigger('create').lazyChildren();
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
$('.btnNextPage', page).on('click', function () {
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
|
|
|
|
query.StartIndex = query.StartIndex + query.Limit;
|
|
|
|
|
loadItems(page, query);
|
|
|
|
|
});
|
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
$('.btnPreviousPage', page).on('click', function () {
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
|
|
|
|
query.StartIndex = query.StartIndex - query.Limit;
|
|
|
|
|
loadItems(page, query);
|
|
|
|
|
});
|
2013-04-17 22:13:44 -07:00
|
|
|
|
|
2013-04-27 15:52:41 -07:00
|
|
|
|
$('.selectPageSize', page).on('change', function () {
|
|
|
|
|
query.Limit = parseInt(this.value);
|
|
|
|
|
query.StartIndex = 0;
|
2013-07-04 09:10:05 -07:00
|
|
|
|
loadItems(page, query);
|
2013-04-27 15:52:41 -07:00
|
|
|
|
});
|
|
|
|
|
|
2013-04-17 22:13:44 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2013-04-17 21:45:00 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-28 21:00:24 -07:00
|
|
|
|
$(document).on('pageinit', "#itemByNameDetailPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2014-07-04 22:21:13 -07:00
|
|
|
|
$('.btnPlay', page).on('click', function () {
|
2013-08-08 07:53:25 -07:00
|
|
|
|
var userdata = currentItem.UserData || {};
|
2014-03-29 08:40:32 -07:00
|
|
|
|
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, false, "Audio", userdata.PlaybackPositionTicks);
|
2013-05-28 21:00:24 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-08-21 08:55:35 -07:00
|
|
|
|
$('.itemsContainer', page).on('playallfromhere', function (e, index) {
|
|
|
|
|
|
2015-02-02 11:14:02 -07:00
|
|
|
|
LibraryBrowser.playAllFromHere(_childrenItemsFunction, index);
|
2014-08-21 08:55:35 -07:00
|
|
|
|
|
|
|
|
|
}).on('queueallfromhere', function (e, index) {
|
|
|
|
|
|
2015-02-02 11:14:02 -07:00
|
|
|
|
LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index);
|
2014-08-21 08:55:35 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2014-08-21 19:24:38 -07:00
|
|
|
|
$('.btnMoreCommands', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
var button = this;
|
|
|
|
|
|
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
|
|
|
|
|
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2014-12-16 22:30:31 -07:00
|
|
|
|
$('.btnSync', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
SyncManager.showMenu({
|
|
|
|
|
items: [currentItem]
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2013-05-28 21:00:24 -07:00
|
|
|
|
}).on('pageshow', "#itemByNameDetailPage", function () {
|
2013-04-17 21:45:00 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
|
|
|
|
|
}).on('pagehide', "#itemByNameDetailPage", function () {
|
|
|
|
|
|
|
|
|
|
currentItem = null;
|
2013-04-10 10:36:34 -07:00
|
|
|
|
});
|
2013-03-27 21:27:15 -07:00
|
|
|
|
|
2013-03-27 15:29:37 -07:00
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
})(jQuery, document, LibraryBrowser);
|