2014-01-01 11:26:31 -07:00
|
|
|
|
(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
|
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-05-22 12:16:14 -07:00
|
|
|
|
$(document).on('pageinitdepends', "#liveTvRecordingListPage", function () {
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
|
2015-06-18 21:23:55 -07:00
|
|
|
|
}).on('pagebeforeshowready', "#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) {
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2014-01-01 11:26:31 -07:00
|
|
|
|
|
|
|
|
|
updateFilterControls(this);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|