2017-02-07 00:33:24 -07:00
|
|
|
define(["components/categorysyncbuttons","cardBuilder","apphost","imageLoader","scripts/livetvcomponents","emby-button","listViewStyle","emby-itemscontainer"],function(categorysyncbuttons,cardBuilder,appHost,imageLoader){"use strict";function getRecordingGroupHtml(group){var html="";return html+='<div class="listItem">',html+='<button type="button" is="emby-button" class="fab mini autoSize blue" item-icon><i class="md-icon">live_tv</i></button>',html+='<div class="listItemBody two-line">',html+='<a href="livetvitems.html?type=Recordings&groupid='+group.Id+'" class="clearLink">',html+="<div>",html+=group.Name,html+="</div>",html+='<div class="secondary">',html+=1==group.RecordingCount?Globalize.translate("ValueItemCount",group.RecordingCount):Globalize.translate("ValueItemCountPlural",group.RecordingCount),html+="</div>",html+="</a>",html+="</div>",html+="</div>"}function renderRecordingGroups(context,groups){groups.length?context.querySelector("#recordingGroups").classList.remove("hide"):context.querySelector("#recordingGroups").classList.add("hide");var html="";html+='<div class="paperList">';for(var i=0,length=groups.length;i<length;i++)html+=getRecordingGroupHtml(groups[i]);html+="</div>",context.querySelector("#recordingGroupItems").innerHTML=html,Dashboard.hideLoadingMsg()}function enableScrollX(){return browserInfo.mobile}function renderRecordings(elem,recordings,cardOptions){recordings.length?elem.classList.remove("hide"):elem.classList.add("hide");var recordingItems=elem.querySelector(".recordingItems");enableScrollX()?(recordingItems.classList.add("hiddenScrollX"),recordingItems.classList.remove("vertical-wrap")):(recordingItems.classList.remove("hiddenScrollX"),recordingItems.classList.add("vertical-wrap"));var supportsImageAnalysis=appHost.supports("imageanalysis"),cardLayout=appHost.preferVisualCards||supportsImageAnalysis;recordingItems.innerHTML=cardBuilder.getCardsHtml(Object.assign({items:recordings,shape:enableScrollX()?"autooverflow":"auto",showTitle:!0,showParentTitle:!0,coverImage:!0,lazy:!0,cardLayout:cardLayout,centerText:!cardLayout,vibrant:supportsImageAnalysis,allowBottomPadding:!enableScrollX(),preferThumb:"auto",overlayText:!1},cardOptions||{})),imageLoader.lazyChildren(recordingItems)}function getBackdropShape(){return enableScrollX()?"overflowBackdrop":"backdrop"}function renderActiveRecordings(context,promise){promise.then(function(result){result.Items.length&&"InProgress"!=result.Items[0].Status&&(result.Items=[]),renderRecordings(context.querySelector("#activeRecordings"),result.Items,{shape:getBackdropShape(),showParentTitle:!1,showTitle:!0,showAirTime:!0,showAirEndTime:!0,showChannelName:!0,cardLayout:!0,vibrant:!0,preferThumb:!0,coverImage:!0})})}function renderLatestRecordings(context,promise){promise.then(function(result){renderRecordings(context.querySelector("#latestRecordings"),result.Items,{shape:enableScrollX()?"overflowBackdrop":"backdrop",showYear:!0,lines:2}),Dashboard.hideLoadingMsg()})}function renderMovieRecordings(context,promise){promise.then(function(result){renderRecordings(context.querySelector("#movieRecordings"),result.Items,{showYear:!0,showParentTitle:!1})})}function renderEpisodeRecordings(context,promise){promise.then(function(result){renderRecordings(context.querySelector("#episodeRecordings"),result.Items,{showSeriesYear:!0,showParentTitle:!1})})}function renderSportsRecordings(context,promise){promise.then(function(result){renderRecordings(context.querySelector("#sportsRecordings"),result.Items,{showYear:!0,showParentTitle:!1})})}function renderKidsRecordings(context,promise){promise.then(function(result){renderRecordings(context.querySelector("#kidsRecordings"),result.Items,{shape:enableScrollX()?"overflowBackdrop":"backdrop",showYear:!0,lines:2})})}function onMoreClick(e){var type=this.getAttribute("data-type");switch(type){case"latest":Dashboard.navigate("livetvitems.html?type=Recordings");break;case"movies":Dashboard.navigate("livetvitems.html?type=Recordings&IsMovie=true");break;case"episodes":Dashboard.navigate("livetvitems.html?type=RecordingSeries");b
|