2017-05-08 11:05:12 -07:00
|
|
|
define(["require","globalize","loading","connectionManager","homeSections","dom","events","listViewStyle","emby-select","emby-checkbox"],function(require,globalize,loading,connectionManager,homeSections,dom,events){"use strict";function renderLatestItems(context,user,result){var folderHtml="";folderHtml+='<div class="checkboxList">';var excludeViewTypes=["playlists","livetv","boxsets","channels"],excludeItemTypes=["Channel"];folderHtml+=result.Items.map(function(i){if(excludeViewTypes.indexOf(i.CollectionType||[])!==-1)return"";if(excludeItemTypes.indexOf(i.Type)!==-1)return"";var currentHtml="",id="chkIncludeInLatest"+i.Id,isChecked=user.Configuration.LatestItemsExcludes.indexOf(i.Id)===-1,checkedHtml=isChecked?' checked="checked"':"";return currentHtml+="<label>",currentHtml+='<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="'+i.Id+'" id="'+id+'"'+checkedHtml+"/>",currentHtml+="<span>"+i.Name+"</span>",currentHtml+="</label>"}).join(""),folderHtml+="</div>",context.querySelector(".latestItemsList").innerHTML=folderHtml}function renderViews(page,user,result){var folderHtml="";folderHtml+='<div class="checkboxList">',folderHtml+=result.map(function(i){var currentHtml="",id="chkGroupFolder"+i.Id,isChecked=user.Configuration.GroupedFolders.indexOf(i.Id)!==-1,checkedHtml=isChecked?' checked="checked"':"";return currentHtml+="<label>",currentHtml+='<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="'+i.Id+'" id="'+id+'"'+checkedHtml+"/>",currentHtml+="<span>"+i.Name+"</span>",currentHtml+="</label>"}).join(""),folderHtml+="</div>",page.querySelector(".folderGroupList").innerHTML=folderHtml}function getLandingScreenOptions(type){var list=[];return"movies"===type?(list.push({name:globalize.translate("sharedcomponents#Movies"),value:"movies",isDefault:!0}),list.push({name:globalize.translate("sharedcomponents#Suggestions"),value:"suggestions"}),list.push({name:globalize.translate("sharedcomponents#Favorites"),value:"favorites"}),list.push({name:globalize.translate("sharedcomponents#Collections"),value:"collections"})):"tvshows"===type&&(list.push({name:globalize.translate("sharedcomponents#Suggestions"),value:"suggestions",isDefault:!0}),list.push({name:globalize.translate("sharedcomponents#Latest"),value:"latest"}),list.push({name:globalize.translate("sharedcomponents#Shows"),value:"shows"}),list.push({name:globalize.translate("sharedcomponents#Favorites"),value:"favorites"})),list.push({name:globalize.translate("sharedcomponents#Genres"),value:"genres"}),list}function getLandingScreenOptionsHtml(type,userValue){return getLandingScreenOptions(type).map(function(o){var selected=userValue===o.value||o.isDefault&&!userValue,selectedHtml=selected?" selected":"",optionValue=o.isDefault?"":o.value;return'<option value="'+optionValue+'"'+selectedHtml+">"+o.name+"</option>"}).join("")}function renderLandingScreens(context,user,userSettings,result){for(var html="",i=0,length=result.Items.length;i<length;i++){var folder=result.Items[i];if("movies"===folder.CollectionType||"tvshows"===folder.CollectionType){html+='<div class="selectContainer">',html+='<select is="emby-select" class="selectLanding" data-folderid="'+folder.Id+'" label="'+folder.Name+'">';var userValue=userSettings.get("landing-"+folder.Id);html+=getLandingScreenOptionsHtml(folder.CollectionType,userValue),html+="</select>",html+="</div>"}}context.querySelector(".landingScreens").innerHTML=html,html?context.querySelector(".landingScreensSection").classList.remove("hide"):context.querySelector(".landingScreensSection").classList.add("hide")}function renderViewOrder(context,user,result){var html="",index=0;html+=result.Items.map(function(view){var currentHtml="";return currentHtml+='<div class="listItem viewItem" data-viewid="'+view.Id+'">',currentHtml+='<i class="md-icon listItemIcon"></i>',currentHtml+='<div class="listItemBody">',currentHtml+="<div>",currentHtml+=view.Name,currentHtml+="</div>",currentHtml+="</div>",currentHtml+='<button type="button" is="paper-icon-button-light" class="btnViewItemUp
|