mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
![]() |
(function ($, document) {
|
|||
|
|
|||
|
// The base query options
|
|||
|
var query = {
|
|||
|
|
|||
|
SortBy: "SortName",
|
|||
|
SortOrder: "Ascending",
|
|||
|
IncludeItemTypes: "Series",
|
|||
|
Recursive: true,
|
|||
|
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
|||
|
Limit: LibraryBrowser.getDetaultPageSize(),
|
|||
|
StartIndex: 0
|
|||
|
};
|
|||
|
|
|||
|
function reloadItems(page) {
|
|||
|
|
|||
|
Dashboard.showLoadingMsg();
|
|||
|
|
|||
|
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
|||
|
|
|||
|
var html = '';
|
|||
|
|
|||
|
var showPaging = result.TotalRecordCount > query.Limit;
|
|||
|
|
|||
|
if (showPaging) {
|
|||
|
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true);
|
|||
|
}
|
|||
|
|
|||
|
html += LibraryBrowser.getPosterDetailViewHtml({
|
|||
|
items: result.Items,
|
|||
|
useAverageAspectRatio: true,
|
|||
|
countNameSingular: "Show",
|
|||
|
countNamePlural: "Shows"
|
|||
|
});
|
|||
|
|
|||
|
if (showPaging) {
|
|||
|
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
|||
|
}
|
|||
|
|
|||
|
var elem = $('#items', page).html(html).trigger('create');
|
|||
|
|
|||
|
$('select', elem).on('change', function () {
|
|||
|
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
|||
|
reloadItems(page);
|
|||
|
});
|
|||
|
|
|||
|
Dashboard.hideLoadingMsg();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
$(document).on('pagebeforeshow', "#tvGenresPage", function () {
|
|||
|
|
|||
|
reloadItems(this);
|
|||
|
|
|||
|
}).on('pageshow', "#tvGenresPage", function () {
|
|||
|
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
})(jQuery, document);
|