jellyfin-web/dashboard-ui/scripts/movieslatest.js
2014-07-05 01:21:13 -04:00

33 lines
937 B
JavaScript

(function ($, document) {
$(document).on('pagebeforeshow', "#moviesLatestPage", function () {
var parentId = LibraryMenu.getTopParentId();
var userId = Dashboard.getCurrentUserId();
var screenWidth = $(window).width();
var page = this;
var options = {
IncludeItemTypes: "Movie",
Limit: screenWidth >= 1920 ? 32 : (screenWidth >= 1440 ? 32 : (screenWidth >= 800 ? 28 : 18)),
Fields: "PrimaryImageAspectRatio",
ParentId: parentId,
IsPlayed: false
};
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: items,
lazy: true
})).trigger('create').createPosterItemMenus();
});
});
})(jQuery, document);