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

109 lines
2.9 KiB
JavaScript
Raw Normal View History

(function ($, document) {
// The base query options
var query = {
UserId: Dashboard.getCurrentUserId(),
StartIndex: 0
};
function reloadItems(page) {
Dashboard.showLoadingMsg();
ApiClient.getLiveTvRecordings(query).done(function (result) {
// Scroll back up so they can see the results from the beginning
$(document).scrollTop(0);
var html = '';
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
updateFilterControls();
2014-05-09 12:43:06 -07:00
var screenWidth = $(window).width();
html += LibraryBrowser.getPosterViewHtml({
2014-01-01 20:53:27 -07:00
items: result.Items,
2014-05-29 07:19:12 -07:00
shape: "auto",
showTitle: true,
showParentTitle: true,
2014-05-09 12:43:06 -07:00
overlayText: screenWidth >= 600,
coverImage: true
});
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
2014-08-01 19:34:45 -07:00
$('#items', page).html(html).trigger('create').createCardMenus();
$('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit;
reloadItems(page);
});
$('.btnPreviousPage', page).on('click', function () {
query.StartIndex -= query.Limit;
reloadItems(page);
});
$('.selectPageSize', page).on('change', function () {
query.Limit = parseInt(this.value);
query.StartIndex = 0;
reloadItems(page);
});
if (getParameterByName('savequery') != 'false') {
LibraryBrowser.saveQueryValues('episodes', query);
}
Dashboard.hideLoadingMsg();
});
}
function updateFilterControls(page) {
}
$(document).on('pageinit', "#liveTvRecordingListPage", function () {
var page = this;
}).on('pagebeforeshow', "#liveTvRecordingListPage", function () {
2014-01-01 20:53:27 -07:00
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
if (limit != query.Limit) {
query.Limit = limit;
query.StartIndex = 0;
}
LibraryBrowser.loadSavedQueryValues('episodes', query);
var groupId = getParameterByName('groupid');
query.GroupId = groupId;
2014-01-01 20:53:27 -07:00
reloadItems(page);
if (query.GroupId) {
ApiClient.getLiveTvRecordingGroup(query.GroupId).done(function (group) {
2014-01-06 11:25:33 -07:00
$('.listName', page).html(group.Name);
2014-01-01 20:53:27 -07:00
});
} else {
2014-05-30 12:23:56 -07:00
$('.listName', page).html(Globalize.translate('HeaderAllRecordings'));
2014-01-01 20:53:27 -07:00
}
}).on('pageshow', "#liveTvRecordingListPage", function () {
updateFilterControls(this);
});
})(jQuery, document);