2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
// The base query options
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
UserId: Dashboard.getCurrentUserId(),
|
2016-02-26 10:15:06 -07:00
|
|
|
|
StartIndex: 0,
|
|
|
|
|
Fields: "CanDelete,PrimaryImageAspectRatio"
|
2014-01-01 11:26:31 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function reloadItems(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getLiveTvRecordings(query).then(function (result) {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
// Scroll back up so they can see the results from the beginning
|
2015-06-28 07:45:21 -07:00
|
|
|
|
window.scrollTo(0, 0);
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}));
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
updateFilterControls();
|
|
|
|
|
|
2014-05-09 12:43:06 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += LibraryBrowser.getPosterViewHtml({
|
2014-01-01 20:53:27 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
items: result.Items,
|
2014-05-29 07:19:12 -07:00
|
|
|
|
shape: "auto",
|
2014-01-01 11:26:31 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-05-09 12:43:06 -07:00
|
|
|
|
overlayText: screenWidth >= 600,
|
2014-01-01 11:26:31 -07:00
|
|
|
|
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
|
|
|
|
|
});
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
2015-06-28 07:45:21 -07:00
|
|
|
|
var elem = page.querySelector('#items');
|
|
|
|
|
elem.innerHTML = html;
|
|
|
|
|
ImageLoader.lazyChildren(elem);
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
$('.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 () {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
|
2015-08-31 23:22:46 -07:00
|
|
|
|
}).on('pagebeforeshow', "#liveTvRecordingListPage", function () {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
2014-01-01 20:53:27 -07:00
|
|
|
|
var page = this;
|
2015-06-18 11:29:44 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -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');
|
2014-01-07 11:39:35 -07:00
|
|
|
|
query.GroupId = groupId;
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
2014-01-01 20:53:27 -07:00
|
|
|
|
reloadItems(page);
|
|
|
|
|
|
|
|
|
|
if (query.GroupId) {
|
|
|
|
|
|
2015-12-14 08:43:03 -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
|
|
|
|
}
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
updateFilterControls(this);
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|