define(["cardBuilder","apphost","imageLoader","libraryMenu","libraryBrowser","loading","emby-itemscontainer"],function(cardBuilder,appHost,imageLoader,libraryMenu,libraryBrowser,loading){"use strict";return function(view,params){function getSavedQueryKey(){return libraryBrowser.getSavedQueryKey()}function reloadItems(page){loading.show();var promise="Recordings"==params.type?ApiClient.getLiveTvRecordings(query):"RecordingSeries"==params.type?ApiClient.getLiveTvRecordingSeries(query):"true"==params.IsAiring?ApiClient.getLiveTvRecommendedPrograms(query):ApiClient.getLiveTvPrograms(query);promise.then(function(result){function onNextPageClick(){query.StartIndex+=query.Limit,reloadItems(page)}function onPreviousPageClick(){query.StartIndex-=query.Limit,reloadItems(page)}window.scrollTo(0,0);var html="",pagingHtml=libraryBrowser.getQueryPagingHtml({startIndex:query.StartIndex,limit:query.Limit,totalRecordCount:result.TotalRecordCount,showLimit:!1});page.querySelector(".listTopPaging").innerHTML=pagingHtml,page.querySelector(".bottomPaging").innerHTML=pagingHtml,html=cardBuilder.getCardsHtml({items:result.Items,shape:query.IsMovie||"RecordingSeries"==params.type?"portrait":"backdrop",preferThumb:!query.IsMovie&&"RecordingSeries"!=params.type,inheritThumb:"Recordings"==params.type,context:"livetv",centerText:!0,lazy:!0,overlayText:!1,showTitle:!0,showParentTitle:query.IsSeries!==!1&&!query.IsMovie,showAirTime:"Recordings"!=params.type&&"RecordingSeries"!=params.type,showAirDateTime:"Recordings"!=params.type&&"RecordingSeries"!=params.type,showChannelName:"Recordings"!=params.type&&"RecordingSeries"!=params.type,overlayMoreButton:!0,showYear:query.IsMovie&&"Recordings"==params.type,showSeriesYear:"RecordingSeries"===params.type,coverImage:!0});var elem=page.querySelector(".itemsContainer");elem.innerHTML=html,imageLoader.lazyChildren(elem);var i,length,elems;for(elems=page.querySelectorAll(".btnNextPage"),i=0,length=elems.length;i