mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
135 lines
3.5 KiB
JavaScript
135 lines
3.5 KiB
JavaScript
(function ($, document, LibraryBrowser) {
|
|
|
|
var currentItem;
|
|
|
|
function reload(page) {
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
|
|
|
|
currentItem = item;
|
|
|
|
var name = item.Name;
|
|
|
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
|
|
|
Dashboard.setPageTitle(name);
|
|
|
|
$('#itemName', page).html(name);
|
|
|
|
renderDetails(page, item);
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
});
|
|
}
|
|
|
|
function renderDetails(page, item) {
|
|
|
|
if (item.Taglines && item.Taglines.length) {
|
|
$('#itemTagline', page).html(item.Taglines[0]).show();
|
|
} else {
|
|
$('#itemTagline', page).hide();
|
|
}
|
|
|
|
if (item.Overview || item.OverviewHtml) {
|
|
var overview = item.OverviewHtml || item.Overview;
|
|
|
|
$('#itemOverview', page).html(overview).show();
|
|
$('#itemOverview a').each(function () {
|
|
$(this).attr("target", "_blank");
|
|
});
|
|
} else {
|
|
$('#itemOverview', page).hide();
|
|
}
|
|
|
|
if (item.CommunityRating) {
|
|
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
|
} else {
|
|
$('#itemCommunityRating', page).hide();
|
|
}
|
|
|
|
$('#itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
|
|
|
renderGenres(page, item);
|
|
renderStudios(page, item);
|
|
renderUserDataIcons(page, item);
|
|
renderLinks(page, item);
|
|
}
|
|
|
|
function renderLinks(page, item) {
|
|
if (item.ProviderIds) {
|
|
|
|
$('#itemLinks', page).html(LibraryBrowser.getLinksHtml(item));
|
|
|
|
} else {
|
|
$('#itemLinks', page).hide();
|
|
}
|
|
}
|
|
|
|
function renderStudios(page, item) {
|
|
|
|
if (item.Studios && item.Studios.length) {
|
|
|
|
var elem = $('#itemStudios', page).show();
|
|
|
|
var html = 'Studios: ';
|
|
|
|
for (var i = 0, length = item.Studios.length; i < length; i++) {
|
|
|
|
if (i > 0) {
|
|
html += ' / ';
|
|
}
|
|
|
|
html += '<a href="itembynamedetails.html?studio=' + item.Studios[i] + '">' + item.Studios[i] + '</a>';
|
|
}
|
|
|
|
elem.html(html).trigger('create');
|
|
|
|
|
|
} else {
|
|
$('#itemStudios', page).hide();
|
|
}
|
|
}
|
|
|
|
function renderGenres(page, item) {
|
|
|
|
if (item.Genres && item.Genres.length) {
|
|
var elem = $('#itemGenres', page).show();
|
|
|
|
var html = 'Genres: ';
|
|
|
|
for (var i = 0, length = item.Genres.length; i < length; i++) {
|
|
|
|
if (i > 0) {
|
|
html += ' / ';
|
|
}
|
|
|
|
html += '<a href="itembynamedetails.html?genre=' + item.Genres[i] + '">' + item.Genres[i] + '</a>';
|
|
}
|
|
|
|
elem.html(html).trigger('create');
|
|
|
|
|
|
} else {
|
|
$('#itemGenres', page).hide();
|
|
}
|
|
}
|
|
|
|
function renderUserDataIcons(page, item) {
|
|
$('#itemRatings', page).html(LibraryBrowser.getUserDataIconsHtml(item));
|
|
}
|
|
|
|
$(document).on('pageshow', "#tvSeriesPage", function () {
|
|
|
|
reload(this);
|
|
|
|
}).on('pagehide', "#tvSeriesPage", function () {
|
|
|
|
currentItem = null;
|
|
});
|
|
|
|
|
|
})(jQuery, document, LibraryBrowser); |