jellyfin-web/dashboard-ui/scripts/movieslatest.js
2014-03-16 00:23:58 -04:00

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);