1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/indexpage.js

71 lines
2.1 KiB
JavaScript
Raw Normal View History

(function ($, document, apiClient) {
2013-02-20 20:33:05 -05:00
2014-05-01 22:54:33 -04:00
$(document).on('pagebeforeshow', "#indexPage", function () {
2013-08-06 15:21:42 -04:00
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
2013-02-20 20:33:05 -05:00
2014-05-01 22:54:33 -04:00
var screenWidth = $(window).width();
2013-02-20 20:33:05 -05:00
2014-05-01 22:54:33 -04:00
var page = this;
2013-02-20 20:33:05 -05:00
2014-05-01 22:54:33 -04:00
var options = {
2013-04-04 13:27:36 -04:00
2014-05-01 22:54:33 -04:00
SortBy: "DatePlayed",
SortOrder: "Descending",
MediaTypes: "Video",
Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 4 : (screenWidth >= 1440 ? 4 : 3),
Recursive: true,
Fields: "PrimaryImageAspectRatio",
CollapseBoxSetItems: false,
ExcludeLocationTypes: "Virtual",
ParentId: parentId
};
2014-05-01 22:54:33 -04:00
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
2014-05-01 22:54:33 -04:00
if (result.Items.length) {
$('#resumableSection', page).show();
} else {
$('#resumableSection', page).hide();
}
2013-11-20 16:08:12 -05:00
2014-05-01 22:54:33 -04:00
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
preferBackdrop: true,
shape: 'backdrop',
overlayText: true,
showTitle: true
2013-04-04 13:27:36 -04:00
2014-05-01 22:54:33 -04:00
})).createPosterItemMenus();
2013-08-06 15:21:42 -04:00
});
2013-04-04 13:27:36 -04:00
2014-05-01 22:54:33 -04:00
options = {
SortBy: "DateCreated",
SortOrder: "Descending",
Limit: screenWidth >= 1920 ? 24 : (screenWidth >= 1440 ? 24 : (screenWidth >= 800 ? 18 : 12)),
Recursive: true,
Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed,IsNotFolder",
CollapseBoxSetItems: false,
ExcludeLocationTypes: "Virtual,Remote",
ParentId: parentId
2013-08-06 15:21:42 -04:00
};
2014-05-01 22:54:33 -04:00
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
2013-04-04 13:27:36 -04:00
2014-05-01 22:54:33 -04:00
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
2014-05-01 22:54:33 -04:00
preferThumb: true,
shape: 'backdrop',
showTitle: true,
centerText: true
2013-04-04 13:27:36 -04:00
2014-05-01 22:54:33 -04:00
})).createPosterItemMenus();
2013-04-04 13:27:36 -04:00
});
2013-07-23 08:29:28 -04:00
});
})(jQuery, document, ApiClient);