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

85 lines
2.5 KiB
JavaScript
Raw Normal View History

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