2017-06-26 09:00:47 -07:00
|
|
|
define(["datetime","jQuery","events","dom","globalize","loading","playMethodHelper","libraryBrowser","humanedate","cardStyle","listViewStyle","emby-linkbutton"],function(datetime,$,events,dom,globalize,loading,playMethodHelper,libraryBrowser){"use strict";function onConnectionHelpClick(e){return e.preventDefault(),!1}function onEditServerNameClick(e){var page=dom.parentWithClass(this,"page");return require(["prompt"],function(prompt){prompt({label:globalize.translate("LabelFriendlyServerName"),description:globalize.translate("LabelFriendlyServerNameHelp"),value:page.querySelector(".serverNameHeader").innerHTML,confirmText:globalize.translate("ButtonSave")}).then(function(value){loading.show(),ApiClient.getServerConfiguration().then(function(config){config.ServerName=value,ApiClient.updateServerConfiguration(config).then(function(){page.querySelector(".serverNameHeader").innerHTML=value,loading.hide()})})})}),e.preventDefault(),!1}function renderSessionOptions(btn,session){require(["alert"],function(alert){var showTranscodeReasons,title,text=[],displayPlayMethod=playMethodHelper.getDisplayPlayMethod(session),isDirectStream="DirectStream"===displayPlayMethod,isTranscode="Transcode"===displayPlayMethod;isDirectStream?(html+=globalize.translate("sharedcomponents#DirectStreaming"),text.push(globalize.translate("sharedcomponents#DirectStreamHelp1")),text.push("<br/>"),text.push(globalize.translate("sharedcomponents#DirectStreamHelp2"))):isTranscode&&(html+=globalize.translate("sharedcomponents#Transcoding"),text.push(globalize.translate("sharedcomponents#MediaIsBeingConverted")),session.TranscodingInfo&&session.TranscodingInfo.TranscodeReasons&&session.TranscodingInfo.TranscodeReasons.length&&(text.push("<br/>"),text.push(globalize.translate("sharedcomponents#LabelReasonForTranscoding")),showTranscodeReasons=!0)),showTranscodeReasons&&session.TranscodingInfo.TranscodeReasons.forEach(function(t){text.push(globalize.translate("sharedcomponents#"+t))}),alert({text:text.join("<br/>"),title:title})})}function onActiveDevicesClick(e){var btn=dom.parentWithClass(e.target,"btnCardOptions");if(btn){var card=dom.parentWithClass(btn,"card");if(card){var sessionId=card.id,session=(DashboardPage.sessionsList||[]).filter(function(s){return"session"+s.Id===sessionId})[0];session&&renderSessionOptions(btn,session)}}}window.DashboardPage={newsStartIndex:0,onPageInit:function(){var page=this;page.querySelector(".btnConnectionHelp").addEventListener("click",onConnectionHelpClick),page.querySelector(".btnEditServerName").addEventListener("click",onEditServerNameClick),page.querySelector(".activeDevices").addEventListener("click",onActiveDevicesClick)},onPageShow:function(){var page=this,apiClient=ApiClient;apiClient&&(DashboardPage.newsStartIndex=0,loading.show(),DashboardPage.pollForInfo(page),DashboardPage.startInterval(apiClient),events.on(apiClient,"websocketmessage",DashboardPage.onWebSocketMessage),events.on(apiClient,"websocketopen",DashboardPage.onWebSocketOpen),DashboardPage.lastAppUpdateCheck=null,DashboardPage.lastPluginUpdateCheck=null,Dashboard.getPluginSecurityInfo().then(function(pluginSecurityInfo){DashboardPage.renderSupporterIcon(page,pluginSecurityInfo)}),DashboardPage.reloadSystemInfo(page),DashboardPage.reloadNews(page),DashboardPage.sessionUpdateTimer=setInterval(DashboardPage.refreshSessionsLocally,6e4),$(".activityItems",page).activityLogList(),$(".swaggerLink",page).attr("href",apiClient.getUrl("swagger-ui/index.html",{api_key:ApiClient.accessToken()})))},onPageHide:function(){var page=this;$(".activityItems",page).activityLogList("destroy");var apiClient=ApiClient;apiClient&&(events.off(apiClient,"websocketmessage",DashboardPage.onWebSocketMessage),events.off(apiClient,"websocketopen",DashboardPage.onWebSocketOpen),DashboardPage.stopInterval(apiClient)),DashboardPage.sessionUpdateTimer&&clearInterval(DashboardPage.sessionUpdateTimer)},renderPaths:function(page,systemInfo){$("#cachePath",page).html(systemInfo.CachePath),$("#logPath",page).html(systemInfo.LogPath),$("#transcodingTemporaryPath",page).html(systemInfo.Transc
|
|
|
|
},{imageUrl:"css/images/tour/admin/chapters.png",title:globalize.translate("DashboardTourChapters")},{imageUrl:"css/images/tour/admin/subtitles.png",title:globalize.translate("DashboardTourSubtitles")},{imageUrl:"css/images/tour/admin/plugins.png",title:globalize.translate("DashboardTourPlugins")},{imageUrl:"css/images/tour/admin/notifications.png",title:globalize.translate("DashboardTourNotifications")},{imageUrl:"css/images/tour/admin/scheduledtasks.png",title:globalize.translate("DashboardTourScheduledTasks")},{imageUrl:"css/images/tour/admin/mobile.png",title:globalize.translate("DashboardTourMobile")},{imageUrl:"css/images/tour/enjoy.jpg",title:globalize.translate("MessageEnjoyYourStay")}];require(["slideshow"],function(slideshow){var newSlideShow=new slideshow({slides:slides,interactive:!0,loop:!1});newSlideShow.show(),dismissWelcome(page,userId),$(".welcomeMessage",page).hide()})})}function onPageShowCheckTour(){var page=this,apiClient=ApiClient;apiClient&&!AppInfo.isNativeApp&&showWelcomeIfNeeded(page,apiClient)}var welcomeDismissValue="12",welcomeTourKey="welcomeTour";$(document).on("pageinit","#dashboardPage",function(){var page=this;$(".btnTakeTour",page).on("click",function(){takeTour(page,Dashboard.getCurrentUserId())})}).on("pageshow","#dashboardPage",onPageShowCheckTour)}(jQuery,document,window),pageClassOn("pageshow","type-interior",function(){var page=this;Dashboard.getPluginSecurityInfo().then(function(pluginSecurityInfo){if(!page.querySelector(".customSupporterPromotion")&&($(".supporterPromotion",page).remove(),!pluginSecurityInfo.IsMBSupporter&&AppInfo.enableSupporterMembership)){var html='<div class="supporterPromotionContainer"><div class="supporterPromotion"><a class="clearLink" href="http://emby.media/premiere" target="_blank"><button is="emby-button" type="button" class="raised block" style="text-transform:none;background-color:#52B54B;color:#fff;"><div>'+globalize.translate("HeaderSupportTheTeam")+'</div><div style="font-weight:normal;margin-top:5px;">'+globalize.translate("TextEnjoyBonusFeatures")+"</div></button></a></div></div>";page.querySelector(".content-primary").insertAdjacentHTML("afterbegin",html)}})})});
|