mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
(function ($, document) {
|
|
|
|
$(document).on('pagebeforeshow', "#moviesLatestPage", function () {
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
var page = this;
|
|
|
|
var options = {
|
|
|
|
SortBy: "DateCreated",
|
|
SortOrder: "Descending",
|
|
IncludeItemTypes: "Movie",
|
|
Limit: screenWidth >= 1920 ? 32 : (screenWidth >= 1440 ? 24 : (screenWidth >= 800 ? 18 : 12)),
|
|
Recursive: true,
|
|
Fields: "PrimaryImageAspectRatio",
|
|
Filters: "IsUnplayed"
|
|
};
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
|
items: result.Items,
|
|
useAverageAspectRatio: true
|
|
|
|
})).createPosterItemMenus();
|
|
});
|
|
|
|
|
|
options = {
|
|
|
|
SortBy: "DateCreated",
|
|
SortOrder: "Descending",
|
|
IncludeItemTypes: "Trailer",
|
|
Limit: screenWidth >= 1920 ? 8 : (screenWidth >= 1440 ? 8 : 6),
|
|
Recursive: true,
|
|
Fields: "PrimaryImageAspectRatio",
|
|
Filters: "IsUnplayed"
|
|
};
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
if (result.Items.length) {
|
|
$('#trailerSection', page).show();
|
|
} else {
|
|
$('#trailerSection', page).hide();
|
|
}
|
|
|
|
$('#trailerItems', page).html(LibraryBrowser.getPosterViewHtml({
|
|
items: result.Items,
|
|
useAverageAspectRatio: true
|
|
|
|
})).createPosterItemMenus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
})(jQuery, document); |