mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
tv shows section - changed dispay
This commit is contained in:
parent
363f71b573
commit
e2cc657ac7
2 changed files with 81 additions and 4 deletions
|
@ -70,6 +70,83 @@
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getEpisodePosterViewHtml: 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 || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||||
|
|
||||||
|
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||||
|
|
||||||
|
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "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 {
|
||||||
|
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showText) {
|
||||||
|
html += "<div class='posterViewItemText posterViewItemPrimaryText'>";
|
||||||
|
if (item.SeriesName != null) {
|
||||||
|
html += item.SeriesName;
|
||||||
|
html += "</div>";
|
||||||
|
html += "<div class='posterViewItemText'>";
|
||||||
|
}
|
||||||
|
if (item.ParentIndexNumber != null) {
|
||||||
|
html += item.ParentIndexNumber + ".";
|
||||||
|
}
|
||||||
|
if (item.IndexNumber != null) {
|
||||||
|
html += item.IndexNumber + " -";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += " "+item.Name;
|
||||||
|
html += "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</a></div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
|
||||||
getAveragePrimaryImageAspectRatio: function (items) {
|
getAveragePrimaryImageAspectRatio: function (items) {
|
||||||
|
|
||||||
var values = [];
|
var values = [];
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
IncludeItemTypes: "Episode",
|
IncludeItemTypes: "Episode",
|
||||||
Limit: 6,
|
Limit: 6,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio"
|
Fields: "PrimaryImageAspectRatio,SeriesInfo"
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
|
||||||
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
$('#recentlyAddedItems', page).html(LibraryBrowser.getEpisodePosterViewHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
useAverageAspectRatio: true
|
useAverageAspectRatio: true
|
||||||
}));
|
}));
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
Filters: "IsResumable",
|
Filters: "IsResumable",
|
||||||
Limit: 6,
|
Limit: 6,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio"
|
Fields: "PrimaryImageAspectRatio,SeriesInfo"
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
$('#resumableSection', page).hide();
|
$('#resumableSection', page).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
|
$('#resumableItems', page).html(LibraryBrowser.getEpisodePosterViewHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
useAverageAspectRatio: true
|
useAverageAspectRatio: true
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue