mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
tv show poster view
This commit is contained in:
parent
867a549058
commit
a65280a36c
2 changed files with 81 additions and 1 deletions
|
@ -238,6 +238,86 @@
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSeriesPosterViewHtml: function (options) {
|
||||||
|
|
||||||
|
var items = options.items;
|
||||||
|
|
||||||
|
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||||
|
|
||||||
|
var html = "";
|
||||||
|
|
||||||
|
for (var i = 0, length = items.length; i < length; i++) {
|
||||||
|
var item = items[i];
|
||||||
|
|
||||||
|
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||||
|
|
||||||
|
var href = item.url || "tvseries.html?id=" + item.Id;
|
||||||
|
|
||||||
|
var showText = options.showTitle || !hasPrimaryImage;
|
||||||
|
|
||||||
|
var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
|
||||||
|
|
||||||
|
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||||
|
|
||||||
|
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Backdrop",
|
||||||
|
height: 198,
|
||||||
|
width: 352,
|
||||||
|
tag: item.BackdropImageTags[0]
|
||||||
|
|
||||||
|
}) + "' />";
|
||||||
|
} else if (hasPrimaryImage) {
|
||||||
|
|
||||||
|
var height = 300;
|
||||||
|
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||||
|
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Primary",
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
tag: item.ImageTags.Primary
|
||||||
|
|
||||||
|
}) + "' />";
|
||||||
|
|
||||||
|
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Backdrop",
|
||||||
|
height: 198,
|
||||||
|
width: 352,
|
||||||
|
tag: item.BackdropImageTags[0]
|
||||||
|
|
||||||
|
}) + "' />";
|
||||||
|
}
|
||||||
|
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||||
|
|
||||||
|
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||||
|
}
|
||||||
|
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
||||||
|
|
||||||
|
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showText) {
|
||||||
|
html += "<div class='posterViewItemText'>";
|
||||||
|
html += item.Name;
|
||||||
|
html += "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.showNewIndicator !== false) {
|
||||||
|
html += LibraryBrowser.getNewIndicatorHtml(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</a></div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
|
||||||
getNewIndicatorHtml: function (item) {
|
getNewIndicatorHtml: function (item) {
|
||||||
|
|
||||||
if (item.RecentlyAddedItemCount) {
|
if (item.RecentlyAddedItemCount) {
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||||
|
|
||||||
$('#items', page).html(LibraryBrowser.getPosterViewHtml({
|
$('#items', page).html(LibraryBrowser.getSeriesPosterViewHtml({
|
||||||
|
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
useAverageAspectRatio: true
|
useAverageAspectRatio: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue