jellyfin-web/dashboard-ui/scripts/gamesrecommendedpage.js

91 lines
2.5 KiB
JavaScript
Raw Normal View History

2013-04-14 20:37:07 -07:00
(function ($, document) {
2013-09-08 14:16:13 -07:00
$(document).on('pagebeforeshow', "#gamesRecommendedPage", function () {
2013-04-14 20:37:07 -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
2013-09-08 14:16:13 -07:00
SortBy: "DateCreated",
SortOrder: "Descending",
MediaTypes: "Game",
Limit: 5,
Recursive: true,
Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed"
};
2013-04-14 20:37:07 -07:00
2013-09-08 14:16:13 -07:00
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
2013-04-14 20:37:07 -07:00
2013-09-08 14:16:13 -07:00
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
useAverageAspectRatio: true,
showNewIndicator: false,
transparent: true,
borderless: true,
imagePosition: 'center center'
}));
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",
Limit: 5,
Recursive: true,
Fields: "PrimaryImageAspectRatio",
Filters: "IsPlayed"
};
2013-04-14 20:37:07 -07:00
2013-09-08 14:16:13 -07:00
ApiClient.getItems(Dashboard.getCurrentUserId(), 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,
useAverageAspectRatio: true,
transparent: true,
borderless: true,
imagePosition: 'center center'
}));
2013-04-14 20:37:07 -07:00
2013-09-08 14:16:13 -07:00
});
options = {
SortBy: "PlayCount",
SortOrder: "Descending",
MediaTypes: "Game",
Limit: 5,
Recursive: true,
Fields: "PrimaryImageAspectRatio",
Filters: "IsPlayed"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
if (result.Items.length) {
$('#frequentlyPlayedSection', page).show();
} else {
$('#frequentlyPlayedSection', page).hide();
}
$('#frequentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
useAverageAspectRatio: true,
transparent: true,
borderless: true,
imagePosition: 'center center'
}));
});
});
2013-04-14 20:37:07 -07:00
})(jQuery, document);