From d45728d162e2c8fb1353eddd7734e1ce2a6221f0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 9 Aug 2017 15:56:38 -0400 Subject: [PATCH] consolidate emby.server.core into emby.server.implementations --- .../emby-webcomponents/guide/guide.js | 2 +- .../emby-webcomponents/itemhelper.js | 2 +- .../itemhovermenu/itemhovermenu.css | 2 +- .../emby-webcomponents/multidownload.js | 2 +- .../emby-webcomponents/scrollstyles.css | 2 +- .../emby-webcomponents/strings/hu.json | 14 +++--- .../emby-webcomponents/strings/pl.json | 2 +- dashboard-ui/livetvsettings.html | 1 - dashboard-ui/scripts/itemdetailpage.js | 4 +- dashboard-ui/strings/ar.json | 2 + dashboard-ui/strings/be-by.json | 4 +- dashboard-ui/strings/bg-bg.json | 4 +- dashboard-ui/strings/ca.json | 4 +- dashboard-ui/strings/cs.json | 2 + dashboard-ui/strings/da.json | 2 + dashboard-ui/strings/de-de.json | 4 +- dashboard-ui/strings/de.json | 10 ++-- dashboard-ui/strings/el.json | 4 +- dashboard-ui/strings/en-gb.json | 2 + dashboard-ui/strings/en-us.json | 1 + dashboard-ui/strings/es-ar.json | 4 +- dashboard-ui/strings/es-es.json | 4 +- dashboard-ui/strings/es-mx.json | 4 +- dashboard-ui/strings/es.json | 2 + dashboard-ui/strings/fa.json | 26 ++++++----- dashboard-ui/strings/fi.json | 4 +- dashboard-ui/strings/fr-ca.json | 4 +- dashboard-ui/strings/fr-fr.json | 6 ++- dashboard-ui/strings/fr.json | 10 ++-- dashboard-ui/strings/gsw.json | 4 +- dashboard-ui/strings/he.json | 4 +- dashboard-ui/strings/hr.json | 2 + dashboard-ui/strings/hu.json | 46 ++++++++++--------- dashboard-ui/strings/id.json | 4 +- dashboard-ui/strings/it.json | 10 ++-- dashboard-ui/strings/kk.json | 2 + dashboard-ui/strings/ko.json | 4 +- dashboard-ui/strings/lt-lt.json | 4 +- dashboard-ui/strings/ms.json | 4 +- dashboard-ui/strings/nb.json | 2 + dashboard-ui/strings/nl.json | 2 + dashboard-ui/strings/pl.json | 2 + dashboard-ui/strings/pt-br.json | 2 + dashboard-ui/strings/pt-pt.json | 2 + dashboard-ui/strings/ro.json | 4 +- dashboard-ui/strings/ru.json | 2 + dashboard-ui/strings/sk.json | 4 +- dashboard-ui/strings/sl-si.json | 4 +- dashboard-ui/strings/sv.json | 2 + dashboard-ui/strings/tr.json | 4 +- dashboard-ui/strings/uk.json | 4 +- dashboard-ui/strings/vi.json | 4 +- dashboard-ui/strings/zh-cn.json | 4 +- dashboard-ui/strings/zh-hk.json | 4 +- dashboard-ui/strings/zh-tw.json | 4 +- dashboard-ui/useredit.html | 2 +- 56 files changed, 180 insertions(+), 90 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js index 49e58189fb..2adbc5576a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js @@ -1 +1 @@ -define(["require","inputManager","browser","globalize","connectionManager","scrollHelper","serverNotifications","loading","datetime","focusManager","playbackManager","userSettings","imageLoader","events","layoutManager","itemShortcuts","registrationServices","dom","css!./guide.css","programStyles","material-icons","scrollStyles","emby-button","paper-icon-button-light","emby-tabs","emby-scroller","flexStyles","registerElement"],function(require,inputManager,browser,globalize,connectionManager,scrollHelper,serverNotifications,loading,datetime,focusManager,playbackManager,userSettings,imageLoader,events,layoutManager,itemShortcuts,registrationServices,dom){"use strict";function showViewSettings(instance){require(["guide-settings-dialog"],function(guideSettingsDialog){guideSettingsDialog.show(instance.categoryOptions).then(function(){instance.refresh()})})}function updateProgramCellOnScroll(cell,scrollPct){var left=cell.posLeft;left||(left=parseFloat(cell.style.left.replace("%","")),cell.posLeft=left);var width=cell.posWidth;width||(width=parseFloat(cell.style.width.replace("%","")),cell.posWidth=width);var right=left+width,newPct=Math.max(Math.min(scrollPct,right),left),offset=newPct-left,pctOfWidth=offset/width*100,guideProgramName=cell.guideProgramName;guideProgramName||(guideProgramName=cell.querySelector(".guideProgramName"),cell.guideProgramName=guideProgramName);var caret=cell.caret;caret||(caret=cell.querySelector(".guide-programNameCaret"),cell.caret=caret),guideProgramName&&(pctOfWidth>0&&pctOfWidth<=100?(guideProgramName.style.transform="translateX("+pctOfWidth+"%)",caret.classList.remove("hide")):(guideProgramName.style.transform="none",caret.classList.add("hide")))}function updateProgramCellsOnScroll(programGrid,programCells){isUpdatingProgramCellScroll||(isUpdatingProgramCellScroll=!0,requestAnimationFrame(function(){for(var scrollLeft=programGrid.scrollLeft,scrollPct=scrollLeft?scrollLeft/programGrid.scrollWidth*100:0,i=0,length=programCells.length;i=startDate&&now=0?date.setHours(date.getHours(),cellCurationMinutes,0,0):date.setHours(date.getHours(),0,0,0),date}function showLoading(){loading.show()}function hideLoading(){loading.hide()}function startCurrentTimeUpdateInterval(){clearCurrentTimeUpdateInterval(),currentTimeUpdateInterval=setInterval(updateCurrentTimeIndicator,6e4),updateCurrentTimeIndicator()}function clearCurrentTimeUpdateInterval(){var interval=currentTimeUpdateInterval;interval&&clearInterval(interval),currentTimeUpdateInterval=null,currentTimeIndicatorBar=null,currentTimeIndicatorArrow=null}function updateCurrentTimeIndicator(){if(currentTimeIndicatorBar||(currentTimeIndicatorBar=options.element.querySelector(".guide-currentTimeIndicatorBar")),currentTimeIndicatorArrow||(currentTimeIndicatorArrow=options.element.querySelector(".guide-currentTimeIndicatorArrowContainer")),currentDate){var dateDifference=(new Date).getTime()-currentDate.getTime(),pct=dateDifference>0?dateDifference/totalRendererdMs:0;pct=Math.min(pct,1),pct<=0||pct>=1?(currentTimeIndicatorBar.classList.add("hide"),currentTimeIndicatorArrow.classList.add("hide")):(currentTimeIndicatorBar.classList.remove("hide"),currentTimeIndicatorArrow.classList.remove("hide"),currentTimeIndicatorBar.style.transform="scaleX("+pct+")",currentTimeIndicatorArrow.style.left=100*pct+"%")}}function getChannelLimit(context){return registrationServices.validateFeature("livetv").then(function(){var limit=browser.slow?100:500;return context.querySelector(".guideRequiresUnlock").classList.add("hide"),limit},function(){var limit=5;return context.querySelector(".guideRequiresUnlock").classList.remove("hide"),context.querySelector(".unlockText").innerHTML=globalize.translate("sharedcomponents#LiveTvGuideRequiresUnlock",limit),limit})}function reloadGuide(context,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){var apiClient=connectionManager.currentApiClient(),channelQuery={StartIndex:0,EnableFavoriteSorting:"false"!==userSettings.get("livetv-favoritechannelsattop")};channelQuery.UserId=apiClient.getCurrentUserId(),getChannelLimit(context).then(function(channelLimit){currentChannelLimit=channelLimit,showLoading(),channelQuery.StartIndex=currentStartIndex,channelQuery.Limit=channelLimit,channelQuery.AddCurrentProgram=!1,channelQuery.EnableUserData=!1,channelQuery.EnableImageTypes="Primary";var categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1;displayMovieContent&&displaySportsContent&&displayNewsContent&&displayKidsContent?(channelQuery.IsMovie=null,channelQuery.IsSports=null,channelQuery.IsKids=null,channelQuery.IsNews=null,channelQuery.IsSeries=null):(displayNewsContent&&(channelQuery.IsNews=!0),displaySportsContent&&(channelQuery.IsSports=!0),displayKidsContent&&(channelQuery.IsKids=!0),displayMovieContent&&(channelQuery.IsMovie=!0),displaySeriesContent&&(channelQuery.IsSeries=!0)),"DatePlayed"===userSettings.get("livetv-channelorder")?(channelQuery.SortBy="DatePlayed",channelQuery.SortOrder="Descending"):(channelQuery.SortBy=null,channelQuery.SortOrder=null);var date=newStartDate;date=new Date(date.getTime()+1e3);var nextDay=new Date(date.getTime()+msPerDay-2e3);apiClient.getLiveTvChannels(channelQuery).then(function(channelsResult){var btnPreviousPage=context.querySelector(".btnPreviousPage"),btnNextPage=context.querySelector(".btnNextPage");channelsResult.TotalRecordCount>channelLimit?(context.querySelector(".guideOptions").classList.remove("hide"),btnPreviousPage.classList.remove("hide"),btnNextPage.classList.remove("hide"),channelQuery.StartIndex?context.querySelector(".btnPreviousPage").disabled=!1:context.querySelector(".btnPreviousPage").disabled=!0,channelQuery.StartIndex+channelLimit",startDate.setTime(startDate.getTime()+cellDurationMs);return html+='
',html+="
",html+='
',html+='arrow_drop_down',html+="
"}function parseDates(program){if(!program.StartDateLocal)try{program.StartDateLocal=datetime.parseISO8601Date(program.StartDate,{toLocal:!0})}catch(err){}if(!program.EndDateLocal)try{program.EndDateLocal=datetime.parseISO8601Date(program.EndDate,{toLocal:!0})}catch(err){}return null}function getTimerIndicator(item){var status;if("SeriesTimer"===item.Type)return'';if(item.TimerId||item.SeriesTimerId)status=item.Status||"Cancelled";else{if("Timer"!==item.Type)return"";status=item.Status}return item.SeriesTimerId?"Cancelled"!==status?'':'':''}function getChannelProgramsHtml(context,date,channel,programs,options,listInfo){var html="",startMs=date.getTime(),endMs=startMs+msPerDay-1,outerCssClass=layoutManager.tv?"channelPrograms channelPrograms-tv":"channelPrograms";html+='
';for(var programsFound,clickAction=layoutManager.tv?"link":"programdialog",categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1,enableColorCodedBackgrounds="true"===userSettings.get("guide-colorcodedbackgrounds"),i=listInfo.startIndex,length=programs.length;iendMs)break;items[program.Id]=program;var renderStartMs=Math.max(program.StartDateLocal.getTime(),startMs),startPercent=(program.StartDateLocal.getTime()-startMs)/msPerDay;startPercent*=100,startPercent=Math.max(startPercent,0);var renderEndMs=Math.min(program.EndDateLocal.getTime(),endMs),endPercent=(renderEndMs-renderStartMs)/msPerDay;endPercent*=100;var cssClass="programCell itemAction",accentCssClass=null,displayInnerContent=!0;program.IsKids?(cssClass+=" childProgramInfo",displayInnerContent=displayKidsContent,accentCssClass="childAccent"):program.IsSports?(cssClass+=" sportsProgramInfo",displayInnerContent=displaySportsContent,accentCssClass="sportsAccent"):program.IsNews?(cssClass+=" newsProgramInfo",displayInnerContent=displayNewsContent,accentCssClass="newsAccent"):program.IsMovie?(cssClass+=" movieProgramInfo",displayInnerContent=displayMovieContent,accentCssClass="movieAccent"):program.IsSeries?(cssClass+=" plainProgramInfo",displayInnerContent=displaySeriesContent):(cssClass+=" plainProgramInfo",displayInnerContent=displayMovieContent&&displayNewsContent&&displaySportsContent&&displayKidsContent&&displaySeriesContent);var timerAttributes="";program.TimerId&&(timerAttributes+=' data-timerid="'+program.TimerId+'"'),program.SeriesTimerId&&(timerAttributes+=' data-seriestimerid="'+program.SeriesTimerId+'"');var isAttribute=endPercent>=2?' is="emby-programcell"':"";if(html+="',html+=displayInnerContent&&enableColorCodedBackgrounds&&accentCssClass?'
':'
',displayInnerContent){var guideProgramNameClass="guideProgramName";html+='
',html+='
',html+='
'+program.Name;var indicatorHtml=null;program.IsLive&&options.showLiveIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Live")+"":program.IsPremiere&&options.showPremiereIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Premiere")+"":program.IsSeries&&!program.IsRepeat&&options.showNewIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#AttributeNew")+"":program.IsSeries&&program.IsRepeat&&options.showRepeatIndicator&&(indicatorHtml=''+globalize.translate("sharedcomponents#Repeat")+""),html+=indicatorHtml||"",program.EpisodeTitle&&options.showEpisodeTitle&&(html+='
',program.EpisodeTitle&&options.showEpisodeTitle&&(html+=''+program.EpisodeTitle+""),html+="
"),html+="
",program.IsHD&&options.showHdIcon&&(html+=layoutManager.tv?'
HD
':'
HD
'),html+=getTimerIndicator(program),html+="
"}html+="
",html+=""}}else if(programsFound)break}return html+="
"}function renderChannelHeaders(context,channels,apiClient){for(var html="",i=0,length=channels.length;i',hasChannelImage){var url=apiClient.getScaledImageUrl(channel.Id,{maxHeight:220,tag:channel.ImageTags.Primary,type:"Primary"});html+='
'}channel.Number&&(html+='

'+channel.Number+"

"),!hasChannelImage&&channel.Name&&(html+='
'+channel.Name+"
"),html+=""}var channelList=context.querySelector(".channelsContainer");channelList.innerHTML=html,imageLoader.lazyChildren(channelList)}function renderPrograms(context,date,channels,programs){for(var allowIndicators=dom.getWindowSize().innerWidth>=600,options={showHdIcon:allowIndicators&&"true"===userSettings.get("guide-indicator-hd"),showLiveIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-live"),showPremiereIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-premiere"),showNewIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-new"),showRepeatIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-repeat"),showEpisodeTitle:!layoutManager.tv},listInfo={startIndex:0},html=[],i=0,length=channels.length;i=pct||left+width>=pct)break;programCell=programCell.nextSibling}programCell?focusManager.focus(programCell):focusManager.autoFocus(autoFocusParent,!0)}}function nativeScrollTo(container,pos,horizontal){container.scrollTo?horizontal?container.scrollTo(pos,0):container.scrollTo(0,pos):horizontal?container.scrollLeft=Math.round(pos):container.scrollTop=Math.round(pos)}function onProgramGridScroll(context,elem,timeslotHeaders){(new Date).getTime()-lastHeaderScroll>=1e3&&(lastGridScroll=(new Date).getTime(),nativeScrollTo(timeslotHeaders,elem.scrollLeft,!0)),updateProgramCellsOnScroll(elem,programCells)}function onTimeslotHeadersScroll(context,elem){(new Date).getTime()-lastGridScroll>=1e3&&(lastHeaderScroll=(new Date).getTime(),nativeScrollTo(programGrid,elem.scrollLeft,!0))}function changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){clearCurrentTimeUpdateInterval();var newStartDate=normalizeDateToTimeslot(date);currentDate=newStartDate,reloadGuide(page,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender)}function getDateTabText(date,isActive,tabIndex){var cssClass=isActive?"emby-tab-button guide-date-tab-button emby-tab-button-active":"emby-tab-button guide-date-tab-button",html='"}function setDateRange(page,guideInfo){var today=new Date,nowHours=today.getHours();today.setHours(nowHours,0,0,0);var start=datetime.parseISO8601Date(guideInfo.StartDate,{toLocal:!0}),end=datetime.parseISO8601Date(guideInfo.EndDate,{toLocal:!0});start.setHours(nowHours,0,0,0),end.setHours(0,0,0,0),start.getTime()>=end.getTime()&&end.setDate(start.getDate()+1),start=new Date(Math.max(today,start));var dateTabsHtml="",tabIndex=0,date=new Date;currentDate&&date.setTime(currentDate.getTime()),date.setHours(nowHours,0,0,0);var startTimeOfDayMs=60*start.getHours()*60*1e3;for(startTimeOfDayMs+=60*start.getMinutes()*1e3;start<=end;){var isActive=date.getDate()===start.getDate()&&date.getMonth()===start.getMonth()&&date.getFullYear()===start.getFullYear();dateTabsHtml+=getDateTabText(start,isActive,tabIndex),start.setDate(start.getDate()+1),start.setHours(0,0,0,0),tabIndex++}page.querySelector(".emby-tabs-slider").innerHTML=dateTabsHtml,page.querySelector(".guideDateTabs").refresh();var newDate=new Date,newDateHours=newDate.getHours(),scrollToTimeMs=60*newDateHours*60*1e3,minutes=newDate.getMinutes();minutes>=30&&(scrollToTimeMs+=18e5);var focusToTimeMs=60*(60*newDateHours+minutes)*1e3;changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,layoutManager.tv)}function reloadPage(page){showLoading();var apiClient=connectionManager.currentApiClient();apiClient.getLiveTvGuideInfo().then(function(guideInfo){setDateRange(page,guideInfo)})}function getChildren(element){var nativeResult=element.children;if(nativeResult)return nativeResult;for(var node,i=0,nodes=element.childNodes,children=[];null!=(node=nodes[i++]);)1===node.nodeType&&children.push(node);return children}function isFirstChild(element){var children=getChildren(element.parentNode);return element===children[0]}function isLastChild(element){var children=getChildren(element.parentNode);return children.length>0&&element===children[children.length-1]}function onInputCommand(e){var container,target=e.target,programCell=dom.parentWithClass(target,"programCell"),scrollX=!1;switch(e.detail.command){case"up":container=programCell?programGrid:null,container&&isFirstChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveUp(target,{container:container});break;case"down":container=programCell?programGrid:null,container&&isLastChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveDown(target,{container:container});break;case"left":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,container&&isFirstChild(programCell)&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveLeft(target,{container:container}),scrollX=!0;break;case"right":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,lastFocusDirection=e.detail.command,focusManager.moveRight(target,{container:container}),scrollX=!0;break;default:return}e.preventDefault(),e.stopPropagation()}function onScrollerFocus(e){var target=e.target,programCell=dom.parentWithClass(target,"programCell");if(programCell){var focused=target,id=focused.getAttribute("data-id"),item=items[id];item&&events.trigger(self,"focus",[{item:item}])}if("left"===lastFocusDirection||"right"===lastFocusDirection)programCell&&scrollHelper.toCenter(programGrid,programCell,!0);else if("up"===lastFocusDirection||"down"===lastFocusDirection){var verticalScroller=dom.parentWithClass(target,"guideVerticalScroller");if(verticalScroller){var focusedElement=programCell||dom.parentWithTag(target,"BUTTON");verticalScroller.toCenter(focusedElement,!0)}}}function setScrollEvents(view,enabled){if(layoutManager.tv){var guideVerticalScroller=view.querySelector(".guideVerticalScroller");enabled?inputManager.on(guideVerticalScroller,onInputCommand):inputManager.off(guideVerticalScroller,onInputCommand)}}function onTimerCreated(e,apiClient,data){for(var programId=data.ProgramId,newTimerId=data.Id,cells=options.element.querySelectorAll('.programCell[data-id="'+programId+'"]'),i=0,length=cells.length;i'),newTimerId&&cell.setAttribute("data-timerid",newTimerId)}}function onSeriesTimerCreated(e,apiClient,data){}function onTimerCancelled(e,apiClient,data){for(var id=data.Id,cells=options.element.querySelectorAll('.programCell[data-timerid="'+id+'"]'),i=0,length=cells.length;i0&&pctOfWidth<=100?(guideProgramName.style.transform="translateX("+pctOfWidth+"%)",caret.classList.remove("hide")):(guideProgramName.style.transform="none",caret.classList.add("hide")))}function updateProgramCellsOnScroll(programGrid,programCells){isUpdatingProgramCellScroll||(isUpdatingProgramCellScroll=!0,requestAnimationFrame(function(){for(var scrollLeft=programGrid.scrollLeft,scrollPct=scrollLeft?scrollLeft/programGrid.scrollWidth*100:0,i=0,length=programCells.length;i=startDate&&now=0?date.setHours(date.getHours(),cellCurationMinutes,0,0):date.setHours(date.getHours(),0,0,0),date}function showLoading(){loading.show()}function hideLoading(){loading.hide()}function startCurrentTimeUpdateInterval(){clearCurrentTimeUpdateInterval(),currentTimeUpdateInterval=setInterval(updateCurrentTimeIndicator,6e4),updateCurrentTimeIndicator()}function clearCurrentTimeUpdateInterval(){var interval=currentTimeUpdateInterval;interval&&clearInterval(interval),currentTimeUpdateInterval=null,currentTimeIndicatorBar=null,currentTimeIndicatorArrow=null}function updateCurrentTimeIndicator(){if(currentTimeIndicatorBar||(currentTimeIndicatorBar=options.element.querySelector(".guide-currentTimeIndicatorBar")),currentTimeIndicatorArrow||(currentTimeIndicatorArrow=options.element.querySelector(".guide-currentTimeIndicatorArrowContainer")),currentDate){var dateDifference=(new Date).getTime()-currentDate.getTime(),pct=dateDifference>0?dateDifference/totalRendererdMs:0;pct=Math.min(pct,1),pct<=0||pct>=1?(currentTimeIndicatorBar.classList.add("hide"),currentTimeIndicatorArrow.classList.add("hide")):(currentTimeIndicatorBar.classList.remove("hide"),currentTimeIndicatorArrow.classList.remove("hide"),currentTimeIndicatorBar.style.transform="scaleX("+pct+")",currentTimeIndicatorArrow.style.left=100*pct+"%")}}function getChannelLimit(context){return registrationServices.validateFeature("livetv").then(function(){var limit=browser.slow?100:500;return context.querySelector(".guideRequiresUnlock").classList.add("hide"),limit},function(){var limit=5;return context.querySelector(".guideRequiresUnlock").classList.remove("hide"),context.querySelector(".unlockText").innerHTML=globalize.translate("sharedcomponents#LiveTvGuideRequiresUnlock",limit),limit})}function reloadGuide(context,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){var apiClient=connectionManager.currentApiClient(),channelQuery={StartIndex:0,EnableFavoriteSorting:"false"!==userSettings.get("livetv-favoritechannelsattop")};channelQuery.UserId=apiClient.getCurrentUserId(),getChannelLimit(context).then(function(channelLimit){currentChannelLimit=channelLimit,showLoading(),channelQuery.StartIndex=currentStartIndex,channelQuery.Limit=channelLimit,channelQuery.AddCurrentProgram=!1,channelQuery.EnableUserData=!1,channelQuery.EnableImageTypes="Primary";var categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1;displayMovieContent&&displaySportsContent&&displayNewsContent&&displayKidsContent?(channelQuery.IsMovie=null,channelQuery.IsSports=null,channelQuery.IsKids=null,channelQuery.IsNews=null,channelQuery.IsSeries=null):(displayNewsContent&&(channelQuery.IsNews=!0),displaySportsContent&&(channelQuery.IsSports=!0),displayKidsContent&&(channelQuery.IsKids=!0),displayMovieContent&&(channelQuery.IsMovie=!0),displaySeriesContent&&(channelQuery.IsSeries=!0)),"DatePlayed"===userSettings.get("livetv-channelorder")?(channelQuery.SortBy="DatePlayed",channelQuery.SortOrder="Descending"):(channelQuery.SortBy=null,channelQuery.SortOrder=null);var date=newStartDate;date=new Date(date.getTime()+1e3);var nextDay=new Date(date.getTime()+msPerDay-2e3);apiClient.getLiveTvChannels(channelQuery).then(function(channelsResult){var btnPreviousPage=context.querySelector(".btnPreviousPage"),btnNextPage=context.querySelector(".btnNextPage");channelsResult.TotalRecordCount>channelLimit?(context.querySelector(".guideOptions").classList.remove("hide"),btnPreviousPage.classList.remove("hide"),btnNextPage.classList.remove("hide"),channelQuery.StartIndex?context.querySelector(".btnPreviousPage").disabled=!1:context.querySelector(".btnPreviousPage").disabled=!0,channelQuery.StartIndex+channelLimit",startDate.setTime(startDate.getTime()+cellDurationMs);return html+='
',html+="
",html+='
',html+='arrow_drop_down',html+="
"}function parseDates(program){if(!program.StartDateLocal)try{program.StartDateLocal=datetime.parseISO8601Date(program.StartDate,{toLocal:!0})}catch(err){}if(!program.EndDateLocal)try{program.EndDateLocal=datetime.parseISO8601Date(program.EndDate,{toLocal:!0})}catch(err){}return null}function getTimerIndicator(item){var status;if("SeriesTimer"===item.Type)return'';if(item.TimerId||item.SeriesTimerId)status=item.Status||"Cancelled";else{if("Timer"!==item.Type)return"";status=item.Status}return item.SeriesTimerId?"Cancelled"!==status?'':'':''}function getChannelProgramsHtml(context,date,channel,programs,options,listInfo){var html="",startMs=date.getTime(),endMs=startMs+msPerDay-1,outerCssClass=layoutManager.tv?"channelPrograms channelPrograms-tv":"channelPrograms";html+='
';for(var programsFound,clickAction=layoutManager.tv?"link":"programdialog",categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1,enableColorCodedBackgrounds="true"===userSettings.get("guide-colorcodedbackgrounds"),i=listInfo.startIndex,length=programs.length;iendMs)break;items[program.Id]=program;var renderStartMs=Math.max(program.StartDateLocal.getTime(),startMs),startPercent=(program.StartDateLocal.getTime()-startMs)/msPerDay;startPercent*=100,startPercent=Math.max(startPercent,0);var renderEndMs=Math.min(program.EndDateLocal.getTime(),endMs),endPercent=(renderEndMs-renderStartMs)/msPerDay;endPercent*=100;var cssClass="programCell itemAction",accentCssClass=null,displayInnerContent=!0;program.IsKids?(cssClass+=" childProgramInfo",displayInnerContent=displayKidsContent,accentCssClass="childAccent"):program.IsSports?(cssClass+=" sportsProgramInfo",displayInnerContent=displaySportsContent,accentCssClass="sportsAccent"):program.IsNews?(cssClass+=" newsProgramInfo",displayInnerContent=displayNewsContent,accentCssClass="newsAccent"):program.IsMovie?(cssClass+=" movieProgramInfo",displayInnerContent=displayMovieContent,accentCssClass="movieAccent"):program.IsSeries?(cssClass+=" plainProgramInfo",displayInnerContent=displaySeriesContent):(cssClass+=" plainProgramInfo",displayInnerContent=displayMovieContent&&displayNewsContent&&displaySportsContent&&displayKidsContent&&displaySeriesContent);var timerAttributes="";program.TimerId&&(timerAttributes+=' data-timerid="'+program.TimerId+'"'),program.SeriesTimerId&&(timerAttributes+=' data-seriestimerid="'+program.SeriesTimerId+'"');var isAttribute=endPercent>=2?' is="emby-programcell"':"";if(html+="',html+=displayInnerContent&&enableColorCodedBackgrounds&&accentCssClass?'
':'
',displayInnerContent){var guideProgramNameClass="guideProgramName";html+='
',html+='
',html+='
'+program.Name;var indicatorHtml=null;program.IsLive&&options.showLiveIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Live")+"":program.IsPremiere&&options.showPremiereIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Premiere")+"":program.IsSeries&&!program.IsRepeat&&options.showNewIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#AttributeNew")+"":program.IsSeries&&program.IsRepeat&&options.showRepeatIndicator&&(indicatorHtml=''+globalize.translate("sharedcomponents#Repeat")+""),html+=indicatorHtml||"",program.EpisodeTitle&&options.showEpisodeTitle&&(html+='
',program.EpisodeTitle&&options.showEpisodeTitle&&(html+=''+program.EpisodeTitle+""),html+="
"),html+="
",program.IsHD&&options.showHdIcon&&(html+=layoutManager.tv?'
HD
':'
HD
'),html+=getTimerIndicator(program),html+="
"}html+="
",html+=""}}else if(programsFound)break}return html+="
"}function renderChannelHeaders(context,channels,apiClient){for(var html="",i=0,length=channels.length;i',hasChannelImage){var url=apiClient.getScaledImageUrl(channel.Id,{maxHeight:220,tag:channel.ImageTags.Primary,type:"Primary"});html+='
'}channel.ChannelNumber&&(html+='

'+channel.ChannelNumber+"

"),!hasChannelImage&&channel.Name&&(html+='
'+channel.Name+"
"),html+=""}var channelList=context.querySelector(".channelsContainer");channelList.innerHTML=html,imageLoader.lazyChildren(channelList)}function renderPrograms(context,date,channels,programs){for(var allowIndicators=dom.getWindowSize().innerWidth>=600,options={showHdIcon:allowIndicators&&"true"===userSettings.get("guide-indicator-hd"),showLiveIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-live"),showPremiereIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-premiere"),showNewIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-new"),showRepeatIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-repeat"),showEpisodeTitle:!layoutManager.tv},listInfo={startIndex:0},html=[],i=0,length=channels.length;i=pct||left+width>=pct)break;programCell=programCell.nextSibling}programCell?focusManager.focus(programCell):focusManager.autoFocus(autoFocusParent,!0)}}function nativeScrollTo(container,pos,horizontal){container.scrollTo?horizontal?container.scrollTo(pos,0):container.scrollTo(0,pos):horizontal?container.scrollLeft=Math.round(pos):container.scrollTop=Math.round(pos)}function onProgramGridScroll(context,elem,timeslotHeaders){(new Date).getTime()-lastHeaderScroll>=1e3&&(lastGridScroll=(new Date).getTime(),nativeScrollTo(timeslotHeaders,elem.scrollLeft,!0)),updateProgramCellsOnScroll(elem,programCells)}function onTimeslotHeadersScroll(context,elem){(new Date).getTime()-lastGridScroll>=1e3&&(lastHeaderScroll=(new Date).getTime(),nativeScrollTo(programGrid,elem.scrollLeft,!0))}function changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){clearCurrentTimeUpdateInterval();var newStartDate=normalizeDateToTimeslot(date);currentDate=newStartDate,reloadGuide(page,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender)}function getDateTabText(date,isActive,tabIndex){var cssClass=isActive?"emby-tab-button guide-date-tab-button emby-tab-button-active":"emby-tab-button guide-date-tab-button",html='"}function setDateRange(page,guideInfo){var today=new Date,nowHours=today.getHours();today.setHours(nowHours,0,0,0);var start=datetime.parseISO8601Date(guideInfo.StartDate,{toLocal:!0}),end=datetime.parseISO8601Date(guideInfo.EndDate,{toLocal:!0});start.setHours(nowHours,0,0,0),end.setHours(0,0,0,0),start.getTime()>=end.getTime()&&end.setDate(start.getDate()+1),start=new Date(Math.max(today,start));var dateTabsHtml="",tabIndex=0,date=new Date;currentDate&&date.setTime(currentDate.getTime()),date.setHours(nowHours,0,0,0);var startTimeOfDayMs=60*start.getHours()*60*1e3;for(startTimeOfDayMs+=60*start.getMinutes()*1e3;start<=end;){var isActive=date.getDate()===start.getDate()&&date.getMonth()===start.getMonth()&&date.getFullYear()===start.getFullYear();dateTabsHtml+=getDateTabText(start,isActive,tabIndex),start.setDate(start.getDate()+1),start.setHours(0,0,0,0),tabIndex++}page.querySelector(".emby-tabs-slider").innerHTML=dateTabsHtml,page.querySelector(".guideDateTabs").refresh();var newDate=new Date,newDateHours=newDate.getHours(),scrollToTimeMs=60*newDateHours*60*1e3,minutes=newDate.getMinutes();minutes>=30&&(scrollToTimeMs+=18e5);var focusToTimeMs=60*(60*newDateHours+minutes)*1e3;changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,layoutManager.tv)}function reloadPage(page){showLoading();var apiClient=connectionManager.currentApiClient();apiClient.getLiveTvGuideInfo().then(function(guideInfo){setDateRange(page,guideInfo)})}function getChildren(element){var nativeResult=element.children;if(nativeResult)return nativeResult;for(var node,i=0,nodes=element.childNodes,children=[];null!=(node=nodes[i++]);)1===node.nodeType&&children.push(node);return children}function isFirstChild(element){var children=getChildren(element.parentNode);return element===children[0]}function isLastChild(element){var children=getChildren(element.parentNode);return children.length>0&&element===children[children.length-1]}function onInputCommand(e){var container,target=e.target,programCell=dom.parentWithClass(target,"programCell"),scrollX=!1;switch(e.detail.command){case"up":container=programCell?programGrid:null,container&&isFirstChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveUp(target,{container:container});break;case"down":container=programCell?programGrid:null,container&&isLastChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveDown(target,{container:container});break;case"left":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,container&&isFirstChild(programCell)&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveLeft(target,{container:container}),scrollX=!0;break;case"right":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,lastFocusDirection=e.detail.command,focusManager.moveRight(target,{container:container}),scrollX=!0;break;default:return}e.preventDefault(),e.stopPropagation()}function onScrollerFocus(e){var target=e.target,programCell=dom.parentWithClass(target,"programCell");if(programCell){var focused=target,id=focused.getAttribute("data-id"),item=items[id];item&&events.trigger(self,"focus",[{item:item}])}if("left"===lastFocusDirection||"right"===lastFocusDirection)programCell&&scrollHelper.toCenter(programGrid,programCell,!0);else if("up"===lastFocusDirection||"down"===lastFocusDirection){var verticalScroller=dom.parentWithClass(target,"guideVerticalScroller");if(verticalScroller){var focusedElement=programCell||dom.parentWithTag(target,"BUTTON");verticalScroller.toCenter(focusedElement,!0)}}}function setScrollEvents(view,enabled){if(layoutManager.tv){var guideVerticalScroller=view.querySelector(".guideVerticalScroller");enabled?inputManager.on(guideVerticalScroller,onInputCommand):inputManager.off(guideVerticalScroller,onInputCommand)}}function onTimerCreated(e,apiClient,data){for(var programId=data.ProgramId,newTimerId=data.Id,cells=options.element.querySelectorAll('.programCell[data-id="'+programId+'"]'),i=0,length=cells.length;i'),newTimerId&&cell.setAttribute("data-timerid",newTimerId)}}function onSeriesTimerCreated(e,apiClient,data){}function onTimerCancelled(e,apiClient,data){for(var id=data.Id,cells=options.element.querySelectorAll('.programCell[data-timerid="'+id+'"]'),i=0,length=cells.length;i
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index f426229ffb..ac52c807b6 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -1,2 +1,2 @@ -define(["loading","appRouter","layoutManager","connectionManager","cardBuilder","datetime","mediaInfo","backdrop","listView","itemContextMenu","itemHelper","dom","indicators","apphost","imageLoader","libraryMenu","globalize","browser","events","scrollHelper","playbackManager","libraryBrowser","scrollStyles","emby-itemscontainer","emby-checkbox","emby-linkbutton","emby-playstatebutton","emby-ratingbutton","emby-downloadbutton"],function(loading,appRouter,layoutManager,connectionManager,cardBuilder,datetime,mediaInfo,backdrop,listView,itemContextMenu,itemHelper,dom,indicators,appHost,imageLoader,libraryMenu,globalize,browser,events,scrollHelper,playbackManager,libraryBrowser){"use strict";function getPromise(apiClient,params){var id=params.id;if(id)return apiClient.getItem(apiClient.getCurrentUserId(),id);if(params.seriesTimerId)return apiClient.getLiveTvSeriesTimer(params.seriesTimerId);var name=params.genre;if(name)return apiClient.getGenre(name,apiClient.getCurrentUserId());if(name=params.musicgenre)return apiClient.getMusicGenre(name,apiClient.getCurrentUserId());if(name=params.gamegenre)return apiClient.getGameGenre(name,apiClient.getCurrentUserId());if(name=params.musicartist)return apiClient.getArtist(name,apiClient.getCurrentUserId());throw new Error("Invalid request")}function hideAll(page,className,show){var i,length,elems=page.querySelectorAll("."+className);for(i=0,length=elems.length;i"}function renderSeriesTimerSchedule(page,apiClient,seriesTimerId){apiClient.getLiveTvTimers({UserId:apiClient.getCurrentUserId(),ImageTypeLimit:1,EnableImageTypes:"Primary,Backdrop,Thumb",SortBy:"StartDate",EnableTotalRecordCount:!1,EnableUserData:!1,SeriesTimerId:seriesTimerId,Fields:"ChannelInfo"}).then(function(result){result.Items.length&&result.Items[0].SeriesTimerId!=seriesTimerId&&(result.Items=[]);var html=getProgramScheduleHtml(result.Items),scheduleTab=page.querySelector(".seriesTimerSchedule");scheduleTab.innerHTML=html,imageLoader.lazyChildren(scheduleTab)})}function renderSeriesTimerEditor(page,item,apiClient,user){if("SeriesTimer"===item.Type){if(!user.Policy.EnableLiveTvManagement)return page.querySelector(".seriesTimerScheduleSection").classList.add("hide"),void hideAll(page,"btnCancelSeriesTimer");require(["seriesRecordingEditor"],function(seriesRecordingEditor){seriesRecordingEditor.embed(item,apiClient.serverId(),{context:page.querySelector(".seriesRecordingEditor")})}),page.querySelector(".seriesTimerScheduleSection").classList.remove("hide"),hideAll(page,"btnCancelSeriesTimer",!0),renderSeriesTimerSchedule(page,apiClient,item.Id)}}function reloadPlayButtons(page,item){var canPlay=!1;if("Program"==item.Type){var now=new Date;now>=datetime.parseISO8601Date(item.StartDate,!0)&&now0)}else hideAll(page,"btnPlay"),hideAll(page,"btnResume"),hideAll(page,"btnInstantMix"),hideAll(page,"btnShuffle");return canPlay}function reloadUserDataButtons(page,item){var i,length,btnPlaystates=page.querySelectorAll(".btnPlaystate");for(i=0,length=btnPlaystates.length;i=1e3?backdrop.setBackdrops([item]):backdrop.clear(),libraryBrowser.renderDetailPageBackdrop(page,item,apiClient,imageLoader,indicators),libraryMenu.setTransparentMenu(!0);var canPlay=reloadPlayButtons(page,item),hasAnyButton=canPlay;item.LocalTrailerCount||item.RemoteTrailers&&item.RemoteTrailers.length?(hideAll(page,"btnPlayTrailer",!0),hasAnyButton=!0):hideAll(page,"btnPlayTrailer"),item.CanDelete&&!item.IsFolder?(hideAll(page,"btnDeleteItem",!0),hasAnyButton=!0):hideAll(page,"btnDeleteItem"),renderSyncLocalContainer(page,params,user,item),hasAnyButton||"Program"!==item.Type?hideAll(page,"mainDetailButtons",!0):hideAll(page,"mainDetailButtons"),showRecordingFields(instance,page,item,user);var groupedVersions=(item.MediaSources||[]).filter(function(g){return"Grouping"==g.Type});user.Policy.IsAdministrator&&groupedVersions.length?page.querySelector(".splitVersionContainer").classList.remove("hide"):page.querySelector(".splitVersionContainer").classList.add("hide");var commands=itemContextMenu.getCommands(getContextMenuOptions(item,user));commands.length?hideAll(page,"btnMoreCommands",!0):hideAll(page,"btnMoreCommands");var itemBirthday=page.querySelector("#itemBirthday");if("Person"==item.Type&&item.PremiereDate)try{var birthday=datetime.parseISO8601Date(item.PremiereDate,!0).toDateString();itemBirthday.classList.remove("hide"),itemBirthday.innerHTML=globalize.translate("BirthDateValue").replace("{0}",birthday)}catch(err){itemBirthday.classList.add("hide")}else itemBirthday.classList.add("hide");var itemDeathDate=page.querySelector("#itemDeathDate");if("Person"==item.Type&&item.EndDate)try{var deathday=datetime.parseISO8601Date(item.EndDate,!0).toDateString();itemDeathDate.classList.remove("hide"),itemDeathDate.innerHTML=globalize.translate("DeathDateValue").replace("{0}",deathday)}catch(err){itemDeathDate.classList.add("hide")}var itemBirthLocation=page.querySelector("#itemBirthLocation");if("Person"==item.Type&&item.ProductionLocations&&item.ProductionLocations.length){var gmap=''+item.ProductionLocations[0]+"";itemBirthLocation.classList.remove("hide"),itemBirthLocation.innerHTML=globalize.translate("BirthPlaceValue").replace("{0}",gmap)}else itemBirthLocation.classList.add("hide");setPeopleHeader(page,item),loading.hide()}function logoImageUrl(item,apiClient,options){return options=options||{},options.type="Logo",item.ImageTags&&item.ImageTags.Logo?(options.tag=item.ImageTags.Logo,apiClient.getScaledImageUrl(item.Id,options)):item.ParentLogoImageTag?(options.tag=item.ParentLogoImageTag,apiClient.getScaledImageUrl(item.ParentLogoItemId,options)):null}function renderLogo(page,item,apiClient){var url=logoImageUrl(item,apiClient,{maxWidth:300}),detailLogo=page.querySelector(".detailLogo");url?(detailLogo.classList.remove("hide"),detailLogo.classList.add("lazy"),detailLogo.setAttribute("data-src",url),imageLoader.lazyImage(detailLogo)):detailLogo.classList.add("hide")}function showRecordingFields(instance,page,item,user){if(!instance.currentRecordingFields){var recordingFieldsElement=page.querySelector(".recordingFields");"Program"==item.Type&&user.Policy.EnableLiveTvManagement?require(["recordingFields"],function(recordingFields){instance.currentRecordingFields=new recordingFields({parent:recordingFieldsElement,programId:item.Id,serverId:item.ServerId}),recordingFieldsElement.classList.remove("hide")}):(recordingFieldsElement.classList.add("hide"),recordingFieldsElement.innerHTML="")}}function renderLinks(linksElem,item){var links=[];if(item.HomePageUrl&&links.push(''+globalize.translate("ButtonWebsite")+""),item.ExternalUrls)for(var i=0,length=item.ExternalUrls.length;i'+url.Name+"")}if(links.length){var html=links.join('');linksElem.innerHTML=html,linksElem.classList.remove("hide")}else linksElem.classList.add("hide")}function renderImage(page,item,apiClient,user){var container=page.querySelector(".detailImageContainer");libraryBrowser.renderDetailImage(page,container,item,apiClient,user.Policy.IsAdministrator&&"Photo"!=item.MediaType,imageLoader,indicators)}function refreshDetailImageUserData(elem,item){var detailImageProgressContainer=elem.querySelector(".detailImageProgressContainer");detailImageProgressContainer.innerHTML=indicators.getProgressBarHtml(item)}function refreshImage(page,item,user){refreshDetailImageUserData(page.querySelector(".detailImageContainer"),item)}function setPeopleHeader(page,item){"Audio"==item.MediaType||"MusicAlbum"==item.Type||"Book"==item.MediaType||"Photo"==item.MediaType?page.querySelector("#peopleHeader").innerHTML=globalize.translate("HeaderPeople"):page.querySelector("#peopleHeader").innerHTML=globalize.translate("HeaderCastAndCrew")}function renderNextUp(page,item,user){var section=page.querySelector(".nextUpSection");return"Series"!=item.Type?void section.classList.add("hide"):void connectionManager.getApiClient(item.ServerId).getNextUpEpisodes({SeriesId:item.Id,UserId:user.Id}).then(function(result){result.Items.length?section.classList.remove("hide"):section.classList.add("hide");var html=cardBuilder.getCardsHtml({items:result.Items,shape:getThumbShape(!1),showTitle:!0,displayAsSpecial:"Season"==item.Type&&item.IndexNumber,overlayText:!0,lazy:!0,overlayPlayButton:!0}),itemsContainer=section.querySelector(".nextUpItems");itemsContainer.innerHTML=html,imageLoader.lazyChildren(itemsContainer)})}function setInitialCollapsibleState(page,item,context,user){page.querySelector(".collectionItems").innerHTML="","TvChannel"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderChannelGuide(page,item,user)):"Playlist"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderPlaylistItems(page,item,user)):"Studio"==item.Type||"Person"==item.Type||"Genre"==item.Type||"MusicGenre"==item.Type||"GameGenre"==item.Type||"MusicArtist"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderItemsByName(page,item,user)):item.IsFolder||"Episode"==item.Type&&item.SeasonId&&item.SeriesId?("BoxSet"==item.Type&&page.querySelector("#childrenCollapsible").classList.add("hide"),renderChildren(page,item)):page.querySelector("#childrenCollapsible").classList.add("hide"),"Series"==item.Type&&renderSeriesSchedule(page,item,user),"Series"==item.Type?renderNextUp(page,item,user):page.querySelector(".nextUpSection").classList.add("hide"),item.MediaSources&&item.MediaSources.length&&renderMediaSources(page,user,item),renderScenes(page,item),item.SpecialFeatureCount&&0!=item.SpecialFeatureCount&&"Series"!=item.Type?(page.querySelector("#specialsCollapsible").classList.remove("hide"),renderSpecials(page,item,user,6)):page.querySelector("#specialsCollapsible").classList.add("hide"),item.People&&item.People.length?(page.querySelector("#castCollapsible").classList.remove("hide"),renderCast(page,item,context,enableScrollX()?null:12)):page.querySelector("#castCollapsible").classList.add("hide"),item.PartCount&&item.PartCount>1?(page.querySelector("#additionalPartsCollapsible").classList.remove("hide"),renderAdditionalParts(page,item,user)):page.querySelector("#additionalPartsCollapsible").classList.add("hide"),page.querySelector("#themeSongsCollapsible").classList.add("hide"),page.querySelector("#themeVideosCollapsible").classList.add("hide"),"MusicAlbum"==item.Type?renderMusicVideos(page,item,user):page.querySelector("#musicVideosCollapsible").classList.add("hide"),renderThemeMedia(page,item,user)}function renderOverview(elems,item){for(var i=0,length=elems.length;i'+text+"
":'
'+text+"
"}).join("");return view.querySelector(".mediaInfoIcons").innerHTML=html,html}function renderPhotoInfo(page,item){var html="",attributes=[];if(item.CameraMake&&attributes.push(createAttribute(globalize.translate("MediaInfoCameraMake"),item.CameraMake)),item.CameraModel&&attributes.push(createAttribute(globalize.translate("MediaInfoCameraModel"),item.CameraModel)),item.Altitude&&attributes.push(createAttribute(globalize.translate("MediaInfoAltitude"),item.Altitude.toFixed(1))),item.Aperture&&attributes.push(createAttribute(globalize.translate("MediaInfoAperture"),"F"+item.Aperture.toFixed(1))),item.ExposureTime){var val=1/item.ExposureTime;attributes.push(createAttribute(globalize.translate("MediaInfoExposureTime"),"1/"+val+" s"))}item.FocalLength&&attributes.push(createAttribute(globalize.translate("MediaInfoFocalLength"),item.FocalLength.toFixed(1)+" mm")),item.ImageOrientation,item.IsoSpeedRating&&attributes.push(createAttribute(globalize.translate("MediaInfoIsoSpeedRating"),item.IsoSpeedRating)),item.Latitude&&attributes.push(createAttribute(globalize.translate("MediaInfoLatitude"),item.Latitude.toFixed(1))),item.Longitude&&attributes.push(createAttribute(globalize.translate("MediaInfoLongitude"),item.Longitude.toFixed(1))),item.ShutterSpeed&&attributes.push(createAttribute(globalize.translate("MediaInfoShutterSpeed"),item.ShutterSpeed)),item.Software&&attributes.push(createAttribute(globalize.translate("MediaInfoSoftware"),item.Software)),html+=attributes.join("
"),page.querySelector(".photoInfoContent").innerHTML=html}function getArtistLinksHtml(artists,serverId,context){for(var html=[],i=0,length=artists.length;i'+artist.Name+"")}return html=html.join(" / "),1==artists.length?globalize.translate("ValueArtist",html):artists.length>1?globalize.translate("ValueArtists",html):html}function enableScrollX(){return browserInfo.mobile&&screen.availWidth<=1e3}function getPortraitShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowPortrait":"portrait"}function getSquareShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowSquare":"square"}function getThumbShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowBackdrop":"backdrop"}function renderMoreFromItems(page,item){var moreFromSection=page.querySelector("#moreFromSection");if(moreFromSection){if("MusicAlbum"!=item.Type||!item.AlbumArtists||!item.AlbumArtists.length)return void moreFromSection.classList.add("hide");var apiClient=connectionManager.getApiClient(item.ServerId);apiClient.getItems(apiClient.getCurrentUserId(),{IncludeItemTypes:"MusicAlbum",ArtistIds:item.AlbumArtists[0].Id,Recursive:!0,ExcludeItemIds:item.Id,SortBy:"ProductionYear,SortName"}).then(function(result){if(!result.Items.length)return void moreFromSection.classList.add("hide");moreFromSection.classList.remove("hide"),moreFromSection.querySelector(".moreFromHeader").innerHTML=globalize.translate("MoreFromValue",item.AlbumArtists[0].Name);var html="";html+=enableScrollX()?'
':'
';var shape="MusicAlbum"==item.Type||"MusicArtist"==item.Type?getSquareShape():getPortraitShape(),supportsImageAnalysis=appHost.supports("imageanalysis");supportsImageAnalysis=!1,html+=cardBuilder.getCardsHtml({items:result.Items,shape:shape,showParentTitle:"MusicAlbum"==item.Type,centerText:!supportsImageAnalysis,showTitle:"MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type,coverImage:"MusicAlbum"==item.Type||"MusicArtist"==item.Type,overlayPlayButton:!0,cardLayout:supportsImageAnalysis,vibrant:supportsImageAnalysis}),html+="
";var similarContent=page.querySelector("#moreFromItems");similarContent.innerHTML=html,imageLoader.lazyChildren(similarContent)})}}function renderSimilarItems(page,item,context){var similarCollapsible=page.querySelector("#similarCollapsible");if(similarCollapsible){if("Movie"!=item.Type&&"Trailer"!=item.Type&&"Series"!=item.Type&&"Program"!=item.Type&&"Recording"!=item.Type&&"Game"!=item.Type&&"MusicAlbum"!=item.Type&&"MusicArtist"!=item.Type&&"ChannelVideoItem"!=item.Type)return void similarCollapsible.classList.add("hide");similarCollapsible.classList.remove("hide");var shape="MusicAlbum"==item.Type||"MusicArtist"==item.Type?getSquareShape():getPortraitShape(),apiClient=connectionManager.getApiClient(item.ServerId),options={userId:apiClient.getCurrentUserId(),limit:"MusicAlbum"==item.Type||"MusicArtist"==item.Type?8:10,fields:"PrimaryImageAspectRatio,UserData,CanDelete"};"MusicAlbum"==item.Type&&item.AlbumArtists&&item.AlbumArtists.length&&(options.ExcludeArtistIds=item.AlbumArtists[0].Id),enableScrollX()&&(options.limit=12),apiClient.getSimilarItems(item.Id,options).then(function(result){if(!result.Items.length)return void similarCollapsible.classList.add("hide");similarCollapsible.classList.remove("hide");var html="";html+=enableScrollX()?'
':'
';var supportsImageAnalysis=appHost.supports("imageanalysis"),cardLayout=supportsImageAnalysis&&("MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type);cardLayout=!1,html+=cardBuilder.getCardsHtml({items:result.Items,shape:shape,showParentTitle:"MusicAlbum"==item.Type,centerText:!cardLayout,showTitle:"MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type,context:context,lazy:!0,showDetailsMenu:!0,coverImage:"MusicAlbum"==item.Type||"MusicArtist"==item.Type,overlayPlayButton:!0,cardLayout:cardLayout,vibrant:cardLayout&&supportsImageAnalysis}),html+="
";var similarContent=similarCollapsible.querySelector(".similarContent");similarContent.innerHTML=html,imageLoader.lazyChildren(similarContent)})}}function renderSeriesAirTime(page,item,isStatic){var seriesAirTime=page.querySelector("#seriesAirTime");if("Series"!=item.Type)return void seriesAirTime.classList.add("hide");var html="";if(item.AirDays&&item.AirDays.length&&(html+=7==item.AirDays.length?"daily":item.AirDays.map(function(a){return a+"s"}).join(",")),item.AirTime&&(html+=" at "+item.AirTime),item.Studios.length)if(isStatic)html+=" on "+item.Studios[0].Name;else{var context=inferContext(item),href=appRouter.getRouteUrl(item.Studios[0],{context:context,itemType:"Studio",serverId:item.ServerId});html+=' on '+item.Studios[0].Name+""}html?(html=("Ended"==item.Status?"Aired ":"Airs ")+html,seriesAirTime.innerHTML=html,seriesAirTime.classList.remove("hide")):seriesAirTime.classList.add("hide")}function renderTags(page,item){var itemTags=page.querySelector(".itemTags");if(item.Tags&&item.Tags.length){for(var html="",i=0,length=item.Tags.length;i'+item.Tags[i]+"
";itemTags.innerHTML=html,itemTags.classList.remove("hide")}else itemTags.classList.add("hide")}function renderChildren(page,item){var fields="ItemCounts,PrimaryImageAspectRatio,BasicSyncInfo,CanDelete",query={ParentId:item.Id,Fields:fields};"BoxSet"!==item.Type&&(query.SortBy="SortName");var promise,apiClient=connectionManager.getApiClient(item.ServerId),userId=apiClient.getCurrentUserId();"Series"==item.Type?promise=apiClient.getSeasons(item.Id,{userId:userId,Fields:fields}):"Season"==item.Type?(fields+=",Overview",promise=apiClient.getEpisodes(item.SeriesId,{seasonId:item.Id,userId:userId,Fields:fields})):"Episode"==item.Type&&item.SeriesId&&item.SeasonId?promise=apiClient.getEpisodes(item.SeriesId,{seasonId:item.SeasonId,userId:userId,Fields:fields}):"MusicAlbum"==item.Type||"MusicArtist"==item.Type&&(query.SortBy="ProductionYear,SortName"),promise=promise||apiClient.getItems(apiClient.getCurrentUserId(),query),promise.then(function(result){var html="",scrollX=!1,isList=!1,scrollClass="hiddenScrollX",childrenItemsContainer=page.querySelector(".childrenItemsContainer");if("MusicAlbum"==item.Type)html=listView.getListViewHtml({items:result.Items,smallIcon:!0,showIndex:!0,index:"disc",showIndexNumber:!0,playFromHere:!0,action:"playallfromhere",image:!1,artist:"auto",containerAlbumArtist:item.AlbumArtist,addToListButton:!0}),isList=!0;else if("Series"==item.Type)scrollX=enableScrollX(),html=cardBuilder.getCardsHtml({items:result.Items,shape:getPortraitShape(),showTitle:!0,centerText:!0,lazy:!0,overlayPlayButton:!0,allowBottomPadding:!scrollX});else if("Season"==item.Type||"Episode"==item.Type){if("Episode"===item.Type?childrenItemsContainer.classList.add("darkScroller"):isList=!0,scrollX="Episode"==item.Type,browser.touch||(scrollClass="smoothScrollX"),result.Items.length<2&&"Episode"===item.Type)return;"Episode"===item.Type?html=cardBuilder.getCardsHtml({items:result.Items,shape:getThumbShape(scrollX),showTitle:!0,displayAsSpecial:"Season"==item.Type&&item.IndexNumber,playFromHere:!0,overlayText:!0,lazy:!0,showDetailsMenu:!0,overlayPlayButton:!0,allowBottomPadding:!scrollX,includeParentInfoInTitle:!1}):"Season"===item.Type&&(html=listView.getListViewHtml({items:result.Items,showIndexNumber:!1,enableOverview:!0,imageSize:"large",enableSideMediaInfo:!1,highlight:!1,action:"none",infoButton:!0,imagePlayButton:!0,includeParentInfoInTitle:!1}))}else"GameSystem"==item.Type&&(html=cardBuilder.getCardsHtml({items:result.Items,shape:"auto",showTitle:!0,centerText:!0,lazy:!0,showDetailsMenu:!0}));if("BoxSet"!==item.Type&&page.querySelector("#childrenCollapsible").classList.remove("hide"),scrollX?(childrenItemsContainer.classList.add(scrollClass),childrenItemsContainer.classList.remove("vertical-wrap"),childrenItemsContainer.classList.remove("vertical-list")):(childrenItemsContainer.classList.remove("hiddenScrollX"),childrenItemsContainer.classList.remove("smoothScrollX"),isList?(childrenItemsContainer.classList.add("vertical-list"),childrenItemsContainer.classList.remove("vertical-wrap")):(childrenItemsContainer.classList.add("vertical-wrap"),childrenItemsContainer.classList.remove("vertical-list"))),childrenItemsContainer.innerHTML=html,imageLoader.lazyChildren(childrenItemsContainer),"BoxSet"==item.Type){var collectionItemTypes=[{name:globalize.translate("HeaderVideos"),mediaType:"Video"},{name:globalize.translate("HeaderSeries"),type:"Series"},{name:globalize.translate("HeaderAlbums"),type:"MusicAlbum"},{name:globalize.translate("HeaderGames"),type:"Game"},{name:globalize.translate("HeaderBooks"),type:"Book"}];renderCollectionItems(page,item,collectionItemTypes,result.Items)}else if("Episode"===item.Type){var card=childrenItemsContainer.querySelector('.card[data-id="'+item.Id+'"]');card&&scrollHelper.toStart(childrenItemsContainer,card.previousSibling||card,!0)}}),"Season"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderEpisodes"):"Episode"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("MoreFromValue",item.SeasonName):"Series"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderSeasons"):"MusicAlbum"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderTracks"):"GameSystem"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderGames"):page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderItems"),"MusicAlbum"==item.Type||"Season"==item.Type?page.querySelector(".childrenSectionHeader",page).classList.add("hide"):page.querySelector(".childrenSectionHeader",page).classList.remove("hide")}function renderItemsByName(page,item,user){require("scripts/itembynamedetailpage".split(","),function(){window.ItemsByName.renderItems(page,item)})}function renderPlaylistItems(page,item,user){require("scripts/playlistedit".split(","),function(){PlaylistViewer.render(page,item)})}function renderChannelGuide(page,item,user){require("scripts/livetvchannel,scripts/livetvcomponents,livetvcss".split(","),function(liveTvChannelPage){liveTvChannelPage.renderPrograms(page,item.Id)})}function renderSeriesSchedule(page,item,user){return}function inferContext(item){return"Movie"==item.Type||"BoxSet"==item.Type?"movies":"Series"==item.Type||"Season"==item.Type||"Episode"==item.Type?"tvshows":"Game"==item.Type||"GameSystem"==item.Type?"games":"Game"==item.Type||"GameSystem"==item.Type?"games":"MusicArtist"==item.Type||"MusicAlbum"==item.Type?"music":null}function renderStudios(elem,item,isStatic){var context=inferContext(item);if(item.Studios&&item.Studios.length&&"Series"!=item.Type,1)elem.classList.add("hide");else{for(var html="",i=0,length=item.Studios.length;i0&&(html+="  /  "),isStatic)html+=item.Studios[i].Name;else{item.Studios[i].Type="Studio";var href=appRouter.getRouteUrl(item.Studios[0],{context:context,serverId:item.ServerId});html+=''+item.Studios[i].Name+""}var translationKey=item.Studios.length>1?"ValueStudios":"ValueStudio";html=globalize.translate(translationKey,html),elem.innerHTML=html,elem.classList.remove("hide")}}function renderGenres(elem,item,limit,isStatic){var context=inferContext(item),html="",genres=item.GenreItems;genres||(genres=(item.Genres||[]).map(function(name){return{Name:name}})||[]);for(var i=0,length=genres.length;i=limit);i++)if(i>0&&(html+=''),isStatic)html+=genres[i].Name;else{var type;switch(context){case"tvshows":type="Series";break;case"games":type="Game";break;case"music":type="MusicAlbum";break;default:type="Movie"}var param,paramValue;if(!genres[i].Id)continue;param="genreId",paramValue=genres[i].Id;var url="secondaryitems.html?type="+type+"&"+param+"="+paramValue+"&serverId="+item.ServerId;html+=''+genres[i].Name+""}elem.innerHTML=html}function filterItemsByCollectionItemType(items,typeInfo){return items.filter(function(item){return typeInfo.mediaType?item.MediaType==typeInfo.mediaType:item.Type==typeInfo.type})}function renderCollectionItems(page,parentItem,types,items){page.querySelector(".collectionItems").innerHTML="";var i,length;for(i=0,length=types.length;i0}).length});otherTypeItems.length&&renderCollectionItemType(page,parentItem,otherType,otherTypeItems),items.length||renderCollectionItemType(page,parentItem,{ -name:globalize.translate("HeaderItems")},items)}function renderCollectionItemType(page,parentItem,type,items){var html="";html+='
',html+='
',html+='

',html+=""+type.name+"",html+="

",html+='',html+="
",html+='
';var shape="MusicAlbum"==type.type?getSquareShape(!1):getPortraitShape(!1);html+=cardBuilder.getCardsHtml({items:items,shape:shape,showTitle:!0,centerText:!0,lazy:!0,showDetailsMenu:!0,overlayMoreButton:!0,showAddToCollection:!1,showRemoveFromCollection:!0,collectionId:parentItem.Id}),html+="
",html+="
";var collectionItems=page.querySelector(".collectionItems");collectionItems.insertAdjacentHTML("beforeend",html),imageLoader.lazyChildren(collectionItems),collectionItems.querySelector(".btnAddToCollection").addEventListener("click",function(){require(["alert"],function(alert){alert({text:globalize.translate("AddItemToCollectionHelp"),html:globalize.translate("AddItemToCollectionHelp")+'

'+globalize.translate("ButtonLearnMore")+""})})})}function renderThemeMedia(page,item){if("SeriesTimer"!==item.Type&&"Timer"!==item.Type&&"Genre"!==item.Type&&"MusicGenre"!==item.Type&&"GameGenre"!==item.Type&&"Studio"!==item.Type&&"Person"!==item.Type){var apiClient=connectionManager.getApiClient(item.ServerId);apiClient.getThemeMedia(apiClient.getCurrentUserId(),item.Id,!0).then(function(result){var themeSongs=result.ThemeSongsResult.OwnerId==item.Id?result.ThemeSongsResult.Items:[],themeVideos=result.ThemeVideosResult.OwnerId==item.Id?result.ThemeVideosResult.Items:[];renderThemeSongs(page,themeSongs),renderThemeVideos(page,themeVideos)})}}function renderThemeSongs(page,items){if(items.length){page.querySelector("#themeSongsCollapsible").classList.remove("hide");var html=listView.getListViewHtml({items:items});page.querySelector("#themeSongsContent").innerHTML=html}else page.querySelector("#themeSongsCollapsible").classList.add("hide")}function renderThemeVideos(page,items,user){if(items.length){page.querySelector("#themeVideosCollapsible").classList.remove("hide");var themeVideosContent=page.querySelector("#themeVideosContent");themeVideosContent.innerHTML=getVideosHtml(items,user),imageLoader.lazyChildren(themeVideosContent)}else page.querySelector("#themeVideosCollapsible").classList.add("hide")}function renderMusicVideos(page,item,user){connectionManager.getApiClient(item.ServerId).getItems(user.Id,{SortBy:"SortName",SortOrder:"Ascending",IncludeItemTypes:"MusicVideo",Recursive:!0,Fields:"DateCreated,CanDelete",AlbumIds:item.Id}).then(function(result){if(result.Items.length){page.querySelector("#musicVideosCollapsible").classList.remove("hide");var musicVideosContent=page.querySelector(".musicVideosContent");musicVideosContent.innerHTML=getVideosHtml(result.Items,user),imageLoader.lazyChildren(musicVideosContent)}else page.querySelector("#musicVideosCollapsible").classList.add("hide")})}function renderAdditionalParts(page,item,user){connectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id,item.Id).then(function(result){if(result.Items.length){page.querySelector("#additionalPartsCollapsible").classList.remove("hide");var additionalPartsContent=page.querySelector("#additionalPartsContent");additionalPartsContent.innerHTML=getVideosHtml(result.Items,user),imageLoader.lazyChildren(additionalPartsContent)}else page.querySelector("#additionalPartsCollapsible").classList.add("hide")})}function renderScenes(page,item){var chapters=item.Chapters||[];if(chapters.length&&!chapters[0].ImageTag&&(chapters=[]),chapters.length){page.querySelector("#scenesCollapsible").classList.remove("hide");var scenesContent=page.querySelector("#scenesContent");enableScrollX()?scenesContent.classList.add("smoothScrollX"):scenesContent.classList.add("vertical-wrap"),require(["chaptercardbuilder"],function(chaptercardbuilder){chaptercardbuilder.buildChapterCards(item,chapters,{itemsContainer:scenesContent,width:400,backdropShape:getThumbShape(),squareShape:getSquareShape()})})}else page.querySelector("#scenesCollapsible").classList.add("hide")}function renderMediaSources(page,user,item){var html=item.MediaSources.map(function(v){return getMediaSourceHtml(user,item,v)}).join('
');item.MediaSources.length>1&&(html="
"+html);var mediaInfoContent=page.querySelector("#mediaInfoContent");mediaInfoContent.innerHTML=html}function getMediaSourceHtml(user,item,version){var html="";version.Name&&item.MediaSources.length>1&&(html+='
'+version.Name+"

");for(var i=0,length=version.MediaStreams.length;i';var displayType=globalize.translate("MediaInfoStreamType"+stream.Type);html+='

'+displayType+"

";var attributes=[];stream.Language&&"Video"!=stream.Type&&attributes.push(createAttribute(globalize.translate("MediaInfoLanguage"),stream.Language)),stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoCodec"),stream.Codec.toUpperCase())),stream.CodecTag&&attributes.push(createAttribute(globalize.translate("MediaInfoCodecTag"),stream.CodecTag)),null!=stream.IsAVC&&attributes.push(createAttribute("AVC",stream.IsAVC?"Yes":"No")),stream.Profile&&attributes.push(createAttribute(globalize.translate("MediaInfoProfile"),stream.Profile)),stream.Level&&attributes.push(createAttribute(globalize.translate("MediaInfoLevel"),stream.Level)),(stream.Width||stream.Height)&&attributes.push(createAttribute(globalize.translate("MediaInfoResolution"),stream.Width+"x"+stream.Height)),stream.AspectRatio&&"mjpeg"!=stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoAspectRatio"),stream.AspectRatio)),"Video"==stream.Type&&(null!=stream.IsAnamorphic&&attributes.push(createAttribute(globalize.translate("MediaInfoAnamorphic"),stream.IsAnamorphic?"Yes":"No")),attributes.push(createAttribute(globalize.translate("MediaInfoInterlaced"),stream.IsInterlaced?"Yes":"No"))),(stream.AverageFrameRate||stream.RealFrameRate)&&attributes.push(createAttribute(globalize.translate("MediaInfoFramerate"),stream.AverageFrameRate||stream.RealFrameRate)),stream.ChannelLayout&&attributes.push(createAttribute(globalize.translate("MediaInfoLayout"),stream.ChannelLayout)),stream.Channels&&attributes.push(createAttribute(globalize.translate("MediaInfoChannels"),stream.Channels+" ch")),stream.BitRate&&"mjpeg"!=stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoBitrate"),parseInt(stream.BitRate/1e3)+" kbps")),stream.SampleRate&&attributes.push(createAttribute(globalize.translate("MediaInfoSampleRate"),stream.SampleRate+" Hz")),stream.BitDepth&&attributes.push(createAttribute(globalize.translate("MediaInfoBitDepth"),stream.BitDepth+" bit")),stream.PixelFormat&&attributes.push(createAttribute(globalize.translate("MediaInfoPixelFormat"),stream.PixelFormat)),stream.RefFrames&&attributes.push(createAttribute(globalize.translate("MediaInfoRefFrames"),stream.RefFrames)),stream.NalLengthSize&&attributes.push(createAttribute("NAL",stream.NalLengthSize)),"Video"!=stream.Type&&attributes.push(createAttribute(globalize.translate("MediaInfoDefault"),stream.IsDefault?"Yes":"No")),"Subtitle"==stream.Type&&(attributes.push(createAttribute(globalize.translate("MediaInfoForced"),stream.IsForced?"Yes":"No")),attributes.push(createAttribute(globalize.translate("MediaInfoExternal"),stream.IsExternal?"Yes":"No"))),"Video"==stream.Type&&version.Timestamp&&attributes.push(createAttribute(globalize.translate("MediaInfoTimestamp"),version.Timestamp)),stream.DisplayTitle&&attributes.push(createAttribute("Title",stream.DisplayTitle)),html+=attributes.join("
"),html+="
"}}if(version.Container&&(html+='
'+globalize.translate("MediaInfoContainer")+''+version.Container+"
"),version.Formats&&version.Formats.length,version.Path&&"Http"!=version.Protocol&&user&&user.Policy.IsAdministrator&&(html+='
'+globalize.translate("MediaInfoPath")+''+version.Path+"
"),version.Size){var size=(version.Size/1048576).toFixed(0);html+='
'+globalize.translate("MediaInfoSize")+''+size+" MB
"}return html}function createAttribute(label,value){return''+label+''+value+""}function getVideosHtml(items,user,limit,moreButtonClass){var html=cardBuilder.getCardsHtml({items:items,shape:"auto",showTitle:!0,action:"play",overlayText:!0,showRuntime:!0});return limit&&items.length>limit&&(html+='

"),html}function renderSpecials(page,item,user,limit){connectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id,item.Id).then(function(specials){var specialsContent=page.querySelector("#specialsContent");specialsContent.innerHTML=getVideosHtml(specials,user,limit,"moreSpecials"),imageLoader.lazyChildren(specialsContent)})}function renderCast(page,item,context,limit,isStatic){var people=item.People||[],castContent=page.querySelector("#castContent");enableScrollX()?(castContent.classList.add("smoothScrollX"),limit=32):castContent.classList.add("vertical-wrap");var limitExceeded=limit&&people.length>limit;limitExceeded&&(people=people.slice(0),people.length=Math.min(limit,people.length)),require(["peoplecardbuilder"],function(peoplecardbuilder){peoplecardbuilder.buildPeopleCards(people,{itemsContainer:castContent,coverImage:!0,serverId:item.ServerId,width:160,shape:getPortraitShape()})});var morePeopleButton=page.querySelector(".morePeople");morePeopleButton&&(limitExceeded&&!enableScrollX()?morePeopleButton.classList.remove("hide"):morePeopleButton.classList.add("hide"))}function showPlayMenu(item,target){require(["playMenu"],function(playMenu){playMenu.show({item:item,positionTo:target})})}function itemDetailPage(){var self=this;self.setInitialCollapsibleState=setInitialCollapsibleState,self.renderDetails=renderDetails,self.renderCast=renderCast,self.renderScenes=renderScenes,self.renderMediaSources=renderMediaSources}function bindAll(view,selector,eventName,fn){var i,length,elems=view.querySelectorAll(selector);for(i=0,length=elems.length;i"}function renderSeriesTimerSchedule(page,apiClient,seriesTimerId){apiClient.getLiveTvTimers({UserId:apiClient.getCurrentUserId(),ImageTypeLimit:1,EnableImageTypes:"Primary,Backdrop,Thumb",SortBy:"StartDate",EnableTotalRecordCount:!1,EnableUserData:!1,SeriesTimerId:seriesTimerId,Fields:"ChannelInfo"}).then(function(result){result.Items.length&&result.Items[0].SeriesTimerId!=seriesTimerId&&(result.Items=[]);var html=getProgramScheduleHtml(result.Items),scheduleTab=page.querySelector(".seriesTimerSchedule");scheduleTab.innerHTML=html,imageLoader.lazyChildren(scheduleTab)})}function renderSeriesTimerEditor(page,item,apiClient,user){if("SeriesTimer"===item.Type){if(!user.Policy.EnableLiveTvManagement)return page.querySelector(".seriesTimerScheduleSection").classList.add("hide"),void hideAll(page,"btnCancelSeriesTimer");require(["seriesRecordingEditor"],function(seriesRecordingEditor){seriesRecordingEditor.embed(item,apiClient.serverId(),{context:page.querySelector(".seriesRecordingEditor")})}),page.querySelector(".seriesTimerScheduleSection").classList.remove("hide"),hideAll(page,"btnCancelSeriesTimer",!0),renderSeriesTimerSchedule(page,apiClient,item.Id)}}function reloadPlayButtons(page,item){var canPlay=!1;if("Program"==item.Type){var now=new Date;now>=datetime.parseISO8601Date(item.StartDate,!0)&&now0)}else hideAll(page,"btnPlay"),hideAll(page,"btnResume"),hideAll(page,"btnInstantMix"),hideAll(page,"btnShuffle");return canPlay}function reloadUserDataButtons(page,item){var i,length,btnPlaystates=page.querySelectorAll(".btnPlaystate");for(i=0,length=btnPlaystates.length;i=1e3?backdrop.setBackdrops([item]):backdrop.clear(),libraryBrowser.renderDetailPageBackdrop(page,item,apiClient,imageLoader,indicators),libraryMenu.setTransparentMenu(!0);var canPlay=reloadPlayButtons(page,item),hasAnyButton=canPlay;item.LocalTrailerCount||item.RemoteTrailers&&item.RemoteTrailers.length?(hideAll(page,"btnPlayTrailer",!0),hasAnyButton=!0):hideAll(page,"btnPlayTrailer"),item.CanDelete&&!item.IsFolder?(hideAll(page,"btnDeleteItem",!0),hasAnyButton=!0):hideAll(page,"btnDeleteItem"),renderSyncLocalContainer(page,params,user,item),hasAnyButton||"Program"!==item.Type?hideAll(page,"mainDetailButtons",!0):hideAll(page,"mainDetailButtons"),showRecordingFields(instance,page,item,user);var groupedVersions=(item.MediaSources||[]).filter(function(g){return"Grouping"==g.Type});user.Policy.IsAdministrator&&groupedVersions.length?page.querySelector(".splitVersionContainer").classList.remove("hide"):page.querySelector(".splitVersionContainer").classList.add("hide");var commands=itemContextMenu.getCommands(getContextMenuOptions(item,user));commands.length?hideAll(page,"btnMoreCommands",!0):hideAll(page,"btnMoreCommands");var itemBirthday=page.querySelector("#itemBirthday");if("Person"==item.Type&&item.PremiereDate)try{var birthday=datetime.parseISO8601Date(item.PremiereDate,!0).toDateString();itemBirthday.classList.remove("hide"),itemBirthday.innerHTML=globalize.translate("BirthDateValue").replace("{0}",birthday)}catch(err){itemBirthday.classList.add("hide")}else itemBirthday.classList.add("hide");var itemDeathDate=page.querySelector("#itemDeathDate");if("Person"==item.Type&&item.EndDate)try{var deathday=datetime.parseISO8601Date(item.EndDate,!0).toDateString();itemDeathDate.classList.remove("hide"),itemDeathDate.innerHTML=globalize.translate("DeathDateValue").replace("{0}",deathday)}catch(err){itemDeathDate.classList.add("hide")}var itemBirthLocation=page.querySelector("#itemBirthLocation");if("Person"==item.Type&&item.ProductionLocations&&item.ProductionLocations.length){var gmap=''+item.ProductionLocations[0]+"";itemBirthLocation.classList.remove("hide"),itemBirthLocation.innerHTML=globalize.translate("BirthPlaceValue").replace("{0}",gmap)}else itemBirthLocation.classList.add("hide");setPeopleHeader(page,item),loading.hide()}function logoImageUrl(item,apiClient,options){return options=options||{},options.type="Logo",item.ImageTags&&item.ImageTags.Logo?(options.tag=item.ImageTags.Logo,apiClient.getScaledImageUrl(item.Id,options)):item.ParentLogoImageTag?(options.tag=item.ParentLogoImageTag,apiClient.getScaledImageUrl(item.ParentLogoItemId,options)):null}function renderLogo(page,item,apiClient){var url=logoImageUrl(item,apiClient,{maxWidth:300}),detailLogo=page.querySelector(".detailLogo");url?(detailLogo.classList.remove("hide"),detailLogo.classList.add("lazy"),detailLogo.setAttribute("data-src",url),imageLoader.lazyImage(detailLogo)):detailLogo.classList.add("hide")}function showRecordingFields(instance,page,item,user){if(!instance.currentRecordingFields){var recordingFieldsElement=page.querySelector(".recordingFields");"Program"==item.Type&&user.Policy.EnableLiveTvManagement?require(["recordingFields"],function(recordingFields){instance.currentRecordingFields=new recordingFields({parent:recordingFieldsElement,programId:item.Id,serverId:item.ServerId}),recordingFieldsElement.classList.remove("hide")}):(recordingFieldsElement.classList.add("hide"),recordingFieldsElement.innerHTML="")}}function renderLinks(linksElem,item){var links=[];if(item.HomePageUrl&&links.push(''+globalize.translate("ButtonWebsite")+""),item.ExternalUrls)for(var i=0,length=item.ExternalUrls.length;i'+url.Name+"")}if(links.length){var html=links.join('');linksElem.innerHTML=html,linksElem.classList.remove("hide")}else linksElem.classList.add("hide")}function renderImage(page,item,apiClient,user){var container=page.querySelector(".detailImageContainer");libraryBrowser.renderDetailImage(page,container,item,apiClient,user.Policy.IsAdministrator&&"Photo"!=item.MediaType,imageLoader,indicators)}function refreshDetailImageUserData(elem,item){var detailImageProgressContainer=elem.querySelector(".detailImageProgressContainer");detailImageProgressContainer.innerHTML=indicators.getProgressBarHtml(item)}function refreshImage(page,item,user){refreshDetailImageUserData(page.querySelector(".detailImageContainer"),item)}function setPeopleHeader(page,item){"Audio"==item.MediaType||"MusicAlbum"==item.Type||"Book"==item.MediaType||"Photo"==item.MediaType?page.querySelector("#peopleHeader").innerHTML=globalize.translate("HeaderPeople"):page.querySelector("#peopleHeader").innerHTML=globalize.translate("HeaderCastAndCrew")}function renderNextUp(page,item,user){var section=page.querySelector(".nextUpSection");return"Series"!=item.Type?void section.classList.add("hide"):void connectionManager.getApiClient(item.ServerId).getNextUpEpisodes({SeriesId:item.Id,UserId:user.Id}).then(function(result){result.Items.length?section.classList.remove("hide"):section.classList.add("hide");var html=cardBuilder.getCardsHtml({items:result.Items,shape:getThumbShape(!1),showTitle:!0,displayAsSpecial:"Season"==item.Type&&item.IndexNumber,overlayText:!1,centerText:!0,overlayPlayButton:!0}),itemsContainer=section.querySelector(".nextUpItems");itemsContainer.innerHTML=html,imageLoader.lazyChildren(itemsContainer)})}function setInitialCollapsibleState(page,item,context,user){page.querySelector(".collectionItems").innerHTML="","TvChannel"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderChannelGuide(page,item,user)):"Playlist"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderPlaylistItems(page,item,user)):"Studio"==item.Type||"Person"==item.Type||"Genre"==item.Type||"MusicGenre"==item.Type||"GameGenre"==item.Type||"MusicArtist"==item.Type?(page.querySelector("#childrenCollapsible").classList.remove("hide"),renderItemsByName(page,item,user)):item.IsFolder||"Episode"==item.Type&&item.SeasonId&&item.SeriesId?("BoxSet"==item.Type&&page.querySelector("#childrenCollapsible").classList.add("hide"),renderChildren(page,item)):page.querySelector("#childrenCollapsible").classList.add("hide"),"Series"==item.Type&&renderSeriesSchedule(page,item,user),"Series"==item.Type?renderNextUp(page,item,user):page.querySelector(".nextUpSection").classList.add("hide"),item.MediaSources&&item.MediaSources.length&&renderMediaSources(page,user,item),renderScenes(page,item),item.SpecialFeatureCount&&0!=item.SpecialFeatureCount&&"Series"!=item.Type?(page.querySelector("#specialsCollapsible").classList.remove("hide"),renderSpecials(page,item,user,6)):page.querySelector("#specialsCollapsible").classList.add("hide"),item.People&&item.People.length?(page.querySelector("#castCollapsible").classList.remove("hide"),renderCast(page,item,context,enableScrollX()?null:12)):page.querySelector("#castCollapsible").classList.add("hide"),item.PartCount&&item.PartCount>1?(page.querySelector("#additionalPartsCollapsible").classList.remove("hide"),renderAdditionalParts(page,item,user)):page.querySelector("#additionalPartsCollapsible").classList.add("hide"),page.querySelector("#themeSongsCollapsible").classList.add("hide"),page.querySelector("#themeVideosCollapsible").classList.add("hide"),"MusicAlbum"==item.Type?renderMusicVideos(page,item,user):page.querySelector("#musicVideosCollapsible").classList.add("hide"),renderThemeMedia(page,item,user)}function renderOverview(elems,item){for(var i=0,length=elems.length;i'+text+"
":'
'+text+"
"}).join("");return view.querySelector(".mediaInfoIcons").innerHTML=html,html}function renderPhotoInfo(page,item){var html="",attributes=[];if(item.CameraMake&&attributes.push(createAttribute(globalize.translate("MediaInfoCameraMake"),item.CameraMake)),item.CameraModel&&attributes.push(createAttribute(globalize.translate("MediaInfoCameraModel"),item.CameraModel)),item.Altitude&&attributes.push(createAttribute(globalize.translate("MediaInfoAltitude"),item.Altitude.toFixed(1))),item.Aperture&&attributes.push(createAttribute(globalize.translate("MediaInfoAperture"),"F"+item.Aperture.toFixed(1))),item.ExposureTime){var val=1/item.ExposureTime;attributes.push(createAttribute(globalize.translate("MediaInfoExposureTime"),"1/"+val+" s"))}item.FocalLength&&attributes.push(createAttribute(globalize.translate("MediaInfoFocalLength"),item.FocalLength.toFixed(1)+" mm")),item.ImageOrientation,item.IsoSpeedRating&&attributes.push(createAttribute(globalize.translate("MediaInfoIsoSpeedRating"),item.IsoSpeedRating)),item.Latitude&&attributes.push(createAttribute(globalize.translate("MediaInfoLatitude"),item.Latitude.toFixed(1))),item.Longitude&&attributes.push(createAttribute(globalize.translate("MediaInfoLongitude"),item.Longitude.toFixed(1))),item.ShutterSpeed&&attributes.push(createAttribute(globalize.translate("MediaInfoShutterSpeed"),item.ShutterSpeed)),item.Software&&attributes.push(createAttribute(globalize.translate("MediaInfoSoftware"),item.Software)),html+=attributes.join("
"),page.querySelector(".photoInfoContent").innerHTML=html}function getArtistLinksHtml(artists,serverId,context){for(var html=[],i=0,length=artists.length;i'+artist.Name+"")}return html=html.join(" / "),1==artists.length?globalize.translate("ValueArtist",html):artists.length>1?globalize.translate("ValueArtists",html):html}function enableScrollX(){return browserInfo.mobile&&screen.availWidth<=1e3}function getPortraitShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowPortrait":"portrait"}function getSquareShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowSquare":"square"}function getThumbShape(scrollX){return null==scrollX&&(scrollX=enableScrollX()),scrollX?"overflowBackdrop":"backdrop"}function renderMoreFromItems(page,item){var moreFromSection=page.querySelector("#moreFromSection");if(moreFromSection){if("MusicAlbum"!=item.Type||!item.AlbumArtists||!item.AlbumArtists.length)return void moreFromSection.classList.add("hide");var apiClient=connectionManager.getApiClient(item.ServerId);apiClient.getItems(apiClient.getCurrentUserId(),{IncludeItemTypes:"MusicAlbum",ArtistIds:item.AlbumArtists[0].Id,Recursive:!0,ExcludeItemIds:item.Id,SortBy:"ProductionYear,SortName"}).then(function(result){if(!result.Items.length)return void moreFromSection.classList.add("hide");moreFromSection.classList.remove("hide"),moreFromSection.querySelector(".moreFromHeader").innerHTML=globalize.translate("MoreFromValue",item.AlbumArtists[0].Name);var html="";html+=enableScrollX()?'
':'
';var shape="MusicAlbum"==item.Type||"MusicArtist"==item.Type?getSquareShape():getPortraitShape(),supportsImageAnalysis=appHost.supports("imageanalysis");supportsImageAnalysis=!1,html+=cardBuilder.getCardsHtml({items:result.Items,shape:shape,showParentTitle:"MusicAlbum"==item.Type,centerText:!supportsImageAnalysis,showTitle:"MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type,coverImage:"MusicAlbum"==item.Type||"MusicArtist"==item.Type,overlayPlayButton:!0,cardLayout:supportsImageAnalysis,vibrant:supportsImageAnalysis}),html+="
";var similarContent=page.querySelector("#moreFromItems");similarContent.innerHTML=html,imageLoader.lazyChildren(similarContent)})}}function renderSimilarItems(page,item,context){var similarCollapsible=page.querySelector("#similarCollapsible");if(similarCollapsible){if("Movie"!=item.Type&&"Trailer"!=item.Type&&"Series"!=item.Type&&"Program"!=item.Type&&"Recording"!=item.Type&&"Game"!=item.Type&&"MusicAlbum"!=item.Type&&"MusicArtist"!=item.Type&&"ChannelVideoItem"!=item.Type)return void similarCollapsible.classList.add("hide");similarCollapsible.classList.remove("hide");var shape="MusicAlbum"==item.Type||"MusicArtist"==item.Type?getSquareShape():getPortraitShape(),apiClient=connectionManager.getApiClient(item.ServerId),options={userId:apiClient.getCurrentUserId(),limit:"MusicAlbum"==item.Type||"MusicArtist"==item.Type?8:10,fields:"PrimaryImageAspectRatio,UserData,CanDelete"};"MusicAlbum"==item.Type&&item.AlbumArtists&&item.AlbumArtists.length&&(options.ExcludeArtistIds=item.AlbumArtists[0].Id),enableScrollX()&&(options.limit=12),apiClient.getSimilarItems(item.Id,options).then(function(result){if(!result.Items.length)return void similarCollapsible.classList.add("hide");similarCollapsible.classList.remove("hide");var html="";html+=enableScrollX()?'
':'
';var supportsImageAnalysis=appHost.supports("imageanalysis"),cardLayout=supportsImageAnalysis&&("MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type);cardLayout=!1,html+=cardBuilder.getCardsHtml({items:result.Items,shape:shape,showParentTitle:"MusicAlbum"==item.Type,centerText:!cardLayout,showTitle:"MusicAlbum"==item.Type||"Game"==item.Type||"MusicArtist"==item.Type,context:context,lazy:!0,showDetailsMenu:!0,coverImage:"MusicAlbum"==item.Type||"MusicArtist"==item.Type,overlayPlayButton:!0,cardLayout:cardLayout,vibrant:cardLayout&&supportsImageAnalysis}),html+="
";var similarContent=similarCollapsible.querySelector(".similarContent");similarContent.innerHTML=html,imageLoader.lazyChildren(similarContent)})}}function renderSeriesAirTime(page,item,isStatic){var seriesAirTime=page.querySelector("#seriesAirTime");if("Series"!=item.Type)return void seriesAirTime.classList.add("hide");var html="";if(item.AirDays&&item.AirDays.length&&(html+=7==item.AirDays.length?"daily":item.AirDays.map(function(a){return a+"s"}).join(",")),item.AirTime&&(html+=" at "+item.AirTime),item.Studios.length)if(isStatic)html+=" on "+item.Studios[0].Name;else{var context=inferContext(item),href=appRouter.getRouteUrl(item.Studios[0],{context:context,itemType:"Studio",serverId:item.ServerId});html+=' on '+item.Studios[0].Name+""}html?(html=("Ended"==item.Status?"Aired ":"Airs ")+html,seriesAirTime.innerHTML=html,seriesAirTime.classList.remove("hide")):seriesAirTime.classList.add("hide")}function renderTags(page,item){var itemTags=page.querySelector(".itemTags");if(item.Tags&&item.Tags.length){for(var html="",i=0,length=item.Tags.length;i'+item.Tags[i]+"
";itemTags.innerHTML=html,itemTags.classList.remove("hide")}else itemTags.classList.add("hide")}function renderChildren(page,item){var fields="ItemCounts,PrimaryImageAspectRatio,BasicSyncInfo,CanDelete",query={ParentId:item.Id,Fields:fields};"BoxSet"!==item.Type&&(query.SortBy="SortName");var promise,apiClient=connectionManager.getApiClient(item.ServerId),userId=apiClient.getCurrentUserId();"Series"==item.Type?promise=apiClient.getSeasons(item.Id,{userId:userId,Fields:fields}):"Season"==item.Type?(fields+=",Overview",promise=apiClient.getEpisodes(item.SeriesId,{seasonId:item.Id,userId:userId,Fields:fields})):"Episode"==item.Type&&item.SeriesId&&item.SeasonId?promise=apiClient.getEpisodes(item.SeriesId,{seasonId:item.SeasonId,userId:userId,Fields:fields}):"MusicAlbum"==item.Type||"MusicArtist"==item.Type&&(query.SortBy="ProductionYear,SortName"),promise=promise||apiClient.getItems(apiClient.getCurrentUserId(),query),promise.then(function(result){var html="",scrollX=!1,isList=!1,scrollClass="hiddenScrollX",childrenItemsContainer=page.querySelector(".childrenItemsContainer");if("MusicAlbum"==item.Type)html=listView.getListViewHtml({items:result.Items,smallIcon:!0,showIndex:!0,index:"disc",showIndexNumber:!0,playFromHere:!0,action:"playallfromhere",image:!1,artist:"auto",containerAlbumArtist:item.AlbumArtist,addToListButton:!0}),isList=!0;else if("Series"==item.Type)scrollX=enableScrollX(),html=cardBuilder.getCardsHtml({items:result.Items,shape:getPortraitShape(),showTitle:!0,centerText:!0,lazy:!0,overlayPlayButton:!0,allowBottomPadding:!scrollX});else if("Season"==item.Type||"Episode"==item.Type){if("Episode"===item.Type?childrenItemsContainer.classList.add("darkScroller"):isList=!0,scrollX="Episode"==item.Type,browser.touch||(scrollClass="smoothScrollX"),result.Items.length<2&&"Episode"===item.Type)return;"Episode"===item.Type?html=cardBuilder.getCardsHtml({items:result.Items,shape:getThumbShape(scrollX),showTitle:!0,displayAsSpecial:"Season"==item.Type&&item.IndexNumber,playFromHere:!0,overlayText:!0,lazy:!0,showDetailsMenu:!0,overlayPlayButton:!0,allowBottomPadding:!scrollX,includeParentInfoInTitle:!1}):"Season"===item.Type&&(html=listView.getListViewHtml({items:result.Items,showIndexNumber:!1,enableOverview:!0,imageSize:"large",enableSideMediaInfo:!1,highlight:!1,action:"none",infoButton:!0,imagePlayButton:!0,includeParentInfoInTitle:!1}))}else"GameSystem"==item.Type&&(html=cardBuilder.getCardsHtml({items:result.Items,shape:"auto",showTitle:!0,centerText:!0,lazy:!0,showDetailsMenu:!0}));if("BoxSet"!==item.Type&&page.querySelector("#childrenCollapsible").classList.remove("hide"),scrollX?(childrenItemsContainer.classList.add(scrollClass),childrenItemsContainer.classList.remove("vertical-wrap"),childrenItemsContainer.classList.remove("vertical-list")):(childrenItemsContainer.classList.remove("hiddenScrollX"),childrenItemsContainer.classList.remove("smoothScrollX"),isList?(childrenItemsContainer.classList.add("vertical-list"),childrenItemsContainer.classList.remove("vertical-wrap")):(childrenItemsContainer.classList.add("vertical-wrap"),childrenItemsContainer.classList.remove("vertical-list"))),childrenItemsContainer.innerHTML=html,imageLoader.lazyChildren(childrenItemsContainer),"BoxSet"==item.Type){var collectionItemTypes=[{name:globalize.translate("HeaderVideos"),mediaType:"Video"},{name:globalize.translate("HeaderSeries"),type:"Series"},{name:globalize.translate("HeaderAlbums"),type:"MusicAlbum"},{name:globalize.translate("HeaderGames"),type:"Game"},{name:globalize.translate("HeaderBooks"),type:"Book"}];renderCollectionItems(page,item,collectionItemTypes,result.Items)}else if("Episode"===item.Type){var card=childrenItemsContainer.querySelector('.card[data-id="'+item.Id+'"]');card&&scrollHelper.toStart(childrenItemsContainer,card.previousSibling||card,!0)}}),"Season"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderEpisodes"):"Episode"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("MoreFromValue",item.SeasonName):"Series"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderSeasons"):"MusicAlbum"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderTracks"):"GameSystem"==item.Type?page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderGames"):page.querySelector("#childrenTitle").innerHTML=globalize.translate("HeaderItems"),"MusicAlbum"==item.Type||"Season"==item.Type?page.querySelector(".childrenSectionHeader",page).classList.add("hide"):page.querySelector(".childrenSectionHeader",page).classList.remove("hide")}function renderItemsByName(page,item,user){require("scripts/itembynamedetailpage".split(","),function(){window.ItemsByName.renderItems(page,item)})}function renderPlaylistItems(page,item,user){require("scripts/playlistedit".split(","),function(){PlaylistViewer.render(page,item)})}function renderChannelGuide(page,item,user){require("scripts/livetvchannel,scripts/livetvcomponents,livetvcss".split(","),function(liveTvChannelPage){liveTvChannelPage.renderPrograms(page,item.Id)})}function renderSeriesSchedule(page,item,user){return}function inferContext(item){return"Movie"==item.Type||"BoxSet"==item.Type?"movies":"Series"==item.Type||"Season"==item.Type||"Episode"==item.Type?"tvshows":"Game"==item.Type||"GameSystem"==item.Type?"games":"Game"==item.Type||"GameSystem"==item.Type?"games":"MusicArtist"==item.Type||"MusicAlbum"==item.Type?"music":null}function renderStudios(elem,item,isStatic){var context=inferContext(item);if(item.Studios&&item.Studios.length&&"Series"!=item.Type,1)elem.classList.add("hide");else{for(var html="",i=0,length=item.Studios.length;i0&&(html+="  /  "),isStatic)html+=item.Studios[i].Name;else{item.Studios[i].Type="Studio";var href=appRouter.getRouteUrl(item.Studios[0],{context:context,serverId:item.ServerId});html+=''+item.Studios[i].Name+""}var translationKey=item.Studios.length>1?"ValueStudios":"ValueStudio";html=globalize.translate(translationKey,html),elem.innerHTML=html,elem.classList.remove("hide")}}function renderGenres(elem,item,limit,isStatic){var context=inferContext(item),html="",genres=item.GenreItems;genres||(genres=(item.Genres||[]).map(function(name){return{Name:name}})||[]);for(var i=0,length=genres.length;i=limit);i++)if(i>0&&(html+=''),isStatic)html+=genres[i].Name;else{var type;switch(context){case"tvshows":type="Series";break;case"games":type="Game";break;case"music":type="MusicAlbum";break;default:type="Movie"}var param,paramValue;if(!genres[i].Id)continue;param="genreId",paramValue=genres[i].Id;var url="secondaryitems.html?type="+type+"&"+param+"="+paramValue+"&serverId="+item.ServerId;html+=''+genres[i].Name+""}elem.innerHTML=html}function filterItemsByCollectionItemType(items,typeInfo){return items.filter(function(item){return typeInfo.mediaType?item.MediaType==typeInfo.mediaType:item.Type==typeInfo.type})}function renderCollectionItems(page,parentItem,types,items){page.querySelector(".collectionItems").innerHTML="";var i,length;for(i=0,length=types.length;i0}).length});otherTypeItems.length&&renderCollectionItemType(page,parentItem,otherType,otherTypeItems),items.length||renderCollectionItemType(page,parentItem,{ +name:globalize.translate("HeaderItems")},items)}function renderCollectionItemType(page,parentItem,type,items){var html="";html+='
',html+='
',html+='

',html+=""+type.name+"",html+="

",html+='',html+="
",html+='
';var shape="MusicAlbum"==type.type?getSquareShape(!1):getPortraitShape(!1);html+=cardBuilder.getCardsHtml({items:items,shape:shape,showTitle:!0,centerText:!0,lazy:!0,showDetailsMenu:!0,overlayMoreButton:!0,showAddToCollection:!1,showRemoveFromCollection:!0,collectionId:parentItem.Id}),html+="
",html+="
";var collectionItems=page.querySelector(".collectionItems");collectionItems.insertAdjacentHTML("beforeend",html),imageLoader.lazyChildren(collectionItems),collectionItems.querySelector(".btnAddToCollection").addEventListener("click",function(){require(["alert"],function(alert){alert({text:globalize.translate("AddItemToCollectionHelp"),html:globalize.translate("AddItemToCollectionHelp")+'

'+globalize.translate("ButtonLearnMore")+""})})})}function renderThemeMedia(page,item){if("SeriesTimer"!==item.Type&&"Timer"!==item.Type&&"Genre"!==item.Type&&"MusicGenre"!==item.Type&&"GameGenre"!==item.Type&&"Studio"!==item.Type&&"Person"!==item.Type){var apiClient=connectionManager.getApiClient(item.ServerId);apiClient.getThemeMedia(apiClient.getCurrentUserId(),item.Id,!0).then(function(result){var themeSongs=result.ThemeSongsResult.OwnerId==item.Id?result.ThemeSongsResult.Items:[],themeVideos=result.ThemeVideosResult.OwnerId==item.Id?result.ThemeVideosResult.Items:[];renderThemeSongs(page,themeSongs),renderThemeVideos(page,themeVideos)})}}function renderThemeSongs(page,items){if(items.length){page.querySelector("#themeSongsCollapsible").classList.remove("hide");var html=listView.getListViewHtml({items:items});page.querySelector("#themeSongsContent").innerHTML=html}else page.querySelector("#themeSongsCollapsible").classList.add("hide")}function renderThemeVideos(page,items,user){if(items.length){page.querySelector("#themeVideosCollapsible").classList.remove("hide");var themeVideosContent=page.querySelector("#themeVideosContent");themeVideosContent.innerHTML=getVideosHtml(items,user),imageLoader.lazyChildren(themeVideosContent)}else page.querySelector("#themeVideosCollapsible").classList.add("hide")}function renderMusicVideos(page,item,user){connectionManager.getApiClient(item.ServerId).getItems(user.Id,{SortBy:"SortName",SortOrder:"Ascending",IncludeItemTypes:"MusicVideo",Recursive:!0,Fields:"DateCreated,CanDelete",AlbumIds:item.Id}).then(function(result){if(result.Items.length){page.querySelector("#musicVideosCollapsible").classList.remove("hide");var musicVideosContent=page.querySelector(".musicVideosContent");musicVideosContent.innerHTML=getVideosHtml(result.Items,user),imageLoader.lazyChildren(musicVideosContent)}else page.querySelector("#musicVideosCollapsible").classList.add("hide")})}function renderAdditionalParts(page,item,user){connectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id,item.Id).then(function(result){if(result.Items.length){page.querySelector("#additionalPartsCollapsible").classList.remove("hide");var additionalPartsContent=page.querySelector("#additionalPartsContent");additionalPartsContent.innerHTML=getVideosHtml(result.Items,user),imageLoader.lazyChildren(additionalPartsContent)}else page.querySelector("#additionalPartsCollapsible").classList.add("hide")})}function renderScenes(page,item){var chapters=item.Chapters||[];if(chapters.length&&!chapters[0].ImageTag&&(chapters=[]),chapters.length){page.querySelector("#scenesCollapsible").classList.remove("hide");var scenesContent=page.querySelector("#scenesContent");enableScrollX()?scenesContent.classList.add("smoothScrollX"):scenesContent.classList.add("vertical-wrap"),require(["chaptercardbuilder"],function(chaptercardbuilder){chaptercardbuilder.buildChapterCards(item,chapters,{itemsContainer:scenesContent,width:400,backdropShape:getThumbShape(),squareShape:getSquareShape()})})}else page.querySelector("#scenesCollapsible").classList.add("hide")}function renderMediaSources(page,user,item){var html=item.MediaSources.map(function(v){return getMediaSourceHtml(user,item,v)}).join('
');item.MediaSources.length>1&&(html="
"+html);var mediaInfoContent=page.querySelector("#mediaInfoContent");mediaInfoContent.innerHTML=html}function getMediaSourceHtml(user,item,version){var html="";version.Name&&item.MediaSources.length>1&&(html+='
'+version.Name+"

");for(var i=0,length=version.MediaStreams.length;i';var displayType=globalize.translate("MediaInfoStreamType"+stream.Type);html+='

'+displayType+"

";var attributes=[];stream.Language&&"Video"!=stream.Type&&attributes.push(createAttribute(globalize.translate("MediaInfoLanguage"),stream.Language)),stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoCodec"),stream.Codec.toUpperCase())),stream.CodecTag&&attributes.push(createAttribute(globalize.translate("MediaInfoCodecTag"),stream.CodecTag)),null!=stream.IsAVC&&attributes.push(createAttribute("AVC",stream.IsAVC?"Yes":"No")),stream.Profile&&attributes.push(createAttribute(globalize.translate("MediaInfoProfile"),stream.Profile)),stream.Level&&attributes.push(createAttribute(globalize.translate("MediaInfoLevel"),stream.Level)),(stream.Width||stream.Height)&&attributes.push(createAttribute(globalize.translate("MediaInfoResolution"),stream.Width+"x"+stream.Height)),stream.AspectRatio&&"mjpeg"!=stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoAspectRatio"),stream.AspectRatio)),"Video"==stream.Type&&(null!=stream.IsAnamorphic&&attributes.push(createAttribute(globalize.translate("MediaInfoAnamorphic"),stream.IsAnamorphic?"Yes":"No")),attributes.push(createAttribute(globalize.translate("MediaInfoInterlaced"),stream.IsInterlaced?"Yes":"No"))),(stream.AverageFrameRate||stream.RealFrameRate)&&attributes.push(createAttribute(globalize.translate("MediaInfoFramerate"),stream.AverageFrameRate||stream.RealFrameRate)),stream.ChannelLayout&&attributes.push(createAttribute(globalize.translate("MediaInfoLayout"),stream.ChannelLayout)),stream.Channels&&attributes.push(createAttribute(globalize.translate("MediaInfoChannels"),stream.Channels+" ch")),stream.BitRate&&"mjpeg"!=stream.Codec&&attributes.push(createAttribute(globalize.translate("MediaInfoBitrate"),parseInt(stream.BitRate/1e3)+" kbps")),stream.SampleRate&&attributes.push(createAttribute(globalize.translate("MediaInfoSampleRate"),stream.SampleRate+" Hz")),stream.BitDepth&&attributes.push(createAttribute(globalize.translate("MediaInfoBitDepth"),stream.BitDepth+" bit")),stream.PixelFormat&&attributes.push(createAttribute(globalize.translate("MediaInfoPixelFormat"),stream.PixelFormat)),stream.RefFrames&&attributes.push(createAttribute(globalize.translate("MediaInfoRefFrames"),stream.RefFrames)),stream.NalLengthSize&&attributes.push(createAttribute("NAL",stream.NalLengthSize)),"Video"!=stream.Type&&attributes.push(createAttribute(globalize.translate("MediaInfoDefault"),stream.IsDefault?"Yes":"No")),"Subtitle"==stream.Type&&(attributes.push(createAttribute(globalize.translate("MediaInfoForced"),stream.IsForced?"Yes":"No")),attributes.push(createAttribute(globalize.translate("MediaInfoExternal"),stream.IsExternal?"Yes":"No"))),"Video"==stream.Type&&version.Timestamp&&attributes.push(createAttribute(globalize.translate("MediaInfoTimestamp"),version.Timestamp)),stream.DisplayTitle&&attributes.push(createAttribute("Title",stream.DisplayTitle)),html+=attributes.join("
"),html+="
"}}if(version.Container&&(html+='
'+globalize.translate("MediaInfoContainer")+''+version.Container+"
"),version.Formats&&version.Formats.length,version.Path&&"Http"!=version.Protocol&&user&&user.Policy.IsAdministrator&&(html+='
'+globalize.translate("MediaInfoPath")+''+version.Path+"
"),version.Size){var size=(version.Size/1048576).toFixed(0);html+='
'+globalize.translate("MediaInfoSize")+''+size+" MB
"}return html}function createAttribute(label,value){return''+label+''+value+""}function getVideosHtml(items,user,limit,moreButtonClass){var html=cardBuilder.getCardsHtml({items:items,shape:"auto",showTitle:!0,action:"play",overlayText:!1,centerText:!0,showRuntime:!0});return limit&&items.length>limit&&(html+='

"),html}function renderSpecials(page,item,user,limit){connectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id,item.Id).then(function(specials){var specialsContent=page.querySelector("#specialsContent");specialsContent.innerHTML=getVideosHtml(specials,user,limit,"moreSpecials"),imageLoader.lazyChildren(specialsContent)})}function renderCast(page,item,context,limit,isStatic){var people=item.People||[],castContent=page.querySelector("#castContent");enableScrollX()?(castContent.classList.add("smoothScrollX"),limit=32):castContent.classList.add("vertical-wrap");var limitExceeded=limit&&people.length>limit;limitExceeded&&(people=people.slice(0),people.length=Math.min(limit,people.length)),require(["peoplecardbuilder"],function(peoplecardbuilder){peoplecardbuilder.buildPeopleCards(people,{itemsContainer:castContent,coverImage:!0,serverId:item.ServerId,width:160,shape:getPortraitShape()})});var morePeopleButton=page.querySelector(".morePeople");morePeopleButton&&(limitExceeded&&!enableScrollX()?morePeopleButton.classList.remove("hide"):morePeopleButton.classList.add("hide"))}function showPlayMenu(item,target){require(["playMenu"],function(playMenu){playMenu.show({item:item,positionTo:target})})}function itemDetailPage(){var self=this;self.setInitialCollapsibleState=setInitialCollapsibleState,self.renderDetails=renderDetails,self.renderCast=renderCast,self.renderScenes=renderScenes,self.renderMediaSources=renderMediaSources}function bindAll(view,selector,eventName,fn){var i,length,elems=view.querySelectorAll(selector);for(i=0,length=elems.length;i
${LabelRemoteClientBitrateLimitHelp}
+
${LabelUserRemoteClientBitrateLimitHelp}
-

${HeaderRemoteControl}