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

121 lines
3.3 KiB
JavaScript
Raw Normal View History

(function ($, document) {
// The base query options
var query = {
UserId: Dashboard.getCurrentUserId(),
StartIndex: 0
};
function reloadItems(page) {
Dashboard.showLoadingMsg();
2015-11-28 01:07:44 -07:00
ApiClient.getLiveTvRecordings(query).then(function (result) {
// Scroll back up so they can see the results from the beginning
2015-06-28 07:45:21 -07:00
window.scrollTo(0, 0);
var html = '';
2015-06-18 11:29:44 -07:00
$('.listTopPaging', page).html(LibraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
showLimit: false,
updatePageSizeSetting: false
}));
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
});
2015-06-18 11:29:44 -07:00
html += LibraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
showLimit: false,
updatePageSizeSetting: false
});
2015-06-28 07:45:21 -07:00
var elem = page.querySelector('#items');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
$('.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) {
}
2015-09-01 07:01:59 -07:00
$(document).on('pageinit', "#liveTvRecordingListPage", function () {
var page = this;
2015-08-31 23:22:46 -07:00
}).on('pagebeforeshow', "#liveTvRecordingListPage", function () {
2014-01-01 20:53:27 -07:00
var page = this;
2015-06-18 11:29:44 -07:00
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) {
2015-11-28 01:07:44 -07:00
ApiClient.getLiveTvRecordingGroup(query.GroupId).then(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
}
updateFilterControls(this);
});
})(jQuery, document);