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