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/gamesrecommendedpage.js

68 lines
1.9 KiB
JavaScript
Raw Normal View History

2013-04-14 20:37:07 -07:00
(function ($, document) {
2015-06-19 00:23:55 -04:00
$(document).on('pagebeforeshowready', "#gamesRecommendedPage", function () {
2013-04-14 20:37:07 -07:00
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
var userId = Dashboard.getCurrentUserId();
2014-05-01 22:54:33 -04:00
2013-09-08 17:16:13 -04:00
var page = this;
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
var options = {
2013-04-14 20:37:07 -07:00
IncludeItemTypes: "Game",
2014-11-10 22:41:19 -05:00
Limit: 18,
Fields: "PrimaryImageAspectRatio",
2014-11-30 14:01:33 -05:00
ParentId: parentId,
ImageTypeLimit: 1,
2014-12-01 07:43:34 -05:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2013-09-08 17:16:13 -04:00
};
2013-04-14 20:37:07 -07:00
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: items,
2013-09-08 17:16:13 -04:00
transparent: true,
2014-05-29 15:34:20 -04:00
borderless: true,
shape: 'auto',
lazy: true
2015-01-23 01:15:15 -05:00
})).lazyChildren();
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
});
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
options = {
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
SortBy: "DatePlayed",
SortOrder: "Descending",
MediaTypes: "Game",
2014-11-10 22:41:19 -05:00
Limit: 18,
2013-09-08 17:16:13 -04:00
Recursive: true,
2014-04-03 18:50:04 -04:00
Filters: "IsPlayed",
2014-05-01 22:54:33 -04:00
Fields: "ItemCounts,AudioInfo,PrimaryImageAspectRatio",
2014-11-30 14:01:33 -05:00
ParentId: parentId,
ImageTypeLimit: 1,
2014-12-01 07:43:34 -05:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2013-09-08 17:16:13 -04:00
};
2013-04-14 20:37:07 -07:00
ApiClient.getItems(userId, options).done(function (result) {
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
if (result.Items.length) {
$('#recentlyPlayedSection', page).show();
} else {
$('#recentlyPlayedSection', page).hide();
}
2013-04-14 20:37:07 -07:00
2013-09-08 17:16:13 -04:00
$('#recentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
transparent: true,
2014-05-29 15:34:20 -04:00
borderless: true,
shape: 'auto',
lazy: true
2015-01-23 01:15:15 -05:00
})).lazyChildren();
2013-09-08 17:16:13 -04:00
});
});
2013-04-14 20:37:07 -07:00
})(jQuery, document);