From c48e18ae6cc28f0fcb5dfa96954a94d91887139f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 12 Sep 2017 13:19:50 -0400 Subject: [PATCH] update dialogs --- .../build/document-register-element.js | 3 ++- dashboard-ui/bower_components/emby-webcomponents/router.js | 2 +- .../emby-webcomponents/upnextdialog/upnextdialog.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard-ui/bower_components/document-register-element/build/document-register-element.js b/dashboard-ui/bower_components/document-register-element/build/document-register-element.js index 735257f9c1..02fbeaf06c 100644 --- a/dashboard-ui/bower_components/document-register-element/build/document-register-element.js +++ b/dashboard-ui/bower_components/document-register-element/build/document-register-element.js @@ -1 +1,2 @@ -!function(e,t,n,r){"use strict";function rt(e,t){for(var n=0,r=e.length;n>0),s="attached",o="detached",u="extends",a="ADDITION",f="MODIFICATION",l="REMOVAL",c="DOMAttrModified",h="DOMContentLoaded",p="DOMSubtreeModified",d="<",v="=",m=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,g=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],y=[],b=[],w="",E=t.documentElement,S=y.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},x=n.prototype,T=x.hasOwnProperty,N=x.isPrototypeOf,C=n.defineProperty,k=n.getOwnPropertyDescriptor,L=n.getOwnPropertyNames,A=n.getPrototypeOf,O=n.setPrototypeOf,M=!!n.__proto__,_=n.create||function mt(e){return e?(mt.prototype=e,new mt):this},D=O||(M?function(e,t){return e.__proto__=t,e}:L&&k?function(){function e(e,t){for(var n,r=L(t),i=0,s=r.length;i>0),s="attached",o="detached",u="extends",a="ADDITION",f="MODIFICATION",l="REMOVAL",c="DOMAttrModified",h="DOMContentLoaded",p="DOMSubtreeModified",d="<",v="=",m=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,g=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],y=[],b=[],w="",E=t.documentElement,S=y.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},x=n.prototype,T=x.hasOwnProperty,N=x.isPrototypeOf,C=n.defineProperty,k=n.getOwnPropertyDescriptor,L=n.getOwnPropertyNames,A=n.getPrototypeOf,O=n.setPrototypeOf,M=!!n.__proto__,_=n.create||function mt(e){return e?(mt.prototype=e,new mt):this},D=O||(M?function(e,t){return e.__proto__=t,e}:L&&k?function(){function e(e,t){for(var n,r=L(t),i=0,s=r.length;ihttps://emby.media')}).then(function(){appRouter.showSelectServer()})})}}function loadContentUrl(ctx,next,route,request){var url;url=route.contentPath&&"function"==typeof route.contentPath?route.contentPath(ctx.querystring):route.contentPath||route.path,url.indexOf("://")===-1&&(0!==url.indexOf("/")&&(url="/"+url),url=baseUrl()+url),ctx.querystring&&route.enableContentQueryString&&(url+="?"+ctx.querystring),require(["text!"+url],function(html){loadContent(ctx,route,html,request)})}function handleRoute(ctx,next,route){authenticate(ctx,route,function(){initRoute(ctx,next,route)})}function initRoute(ctx,next,route){var onInitComplete=function(controllerFactory){sendRouteToViewManager(ctx,next,route,controllerFactory)};require(route.dependencies||[],function(){route.controller?require([route.controller],onInitComplete):onInitComplete()})}function cancelCurrentLoadRequest(){var currentRequest=currentViewLoadRequest;currentRequest&&(currentRequest.cancel=!0)}function sendRouteToViewManager(ctx,next,route,controllerFactory){if(isDummyBackToHome&&"home"===route.type)return void(isDummyBackToHome=!1);cancelCurrentLoadRequest();var isBackNav=ctx.isBack,currentRequest={url:baseUrl()+ctx.path,transition:route.transition,isBack:isBackNav,state:ctx.state,type:route.type,fullscreen:route.fullscreen,controllerFactory:controllerFactory,options:{supportsThemeMedia:route.supportsThemeMedia||!1,enableMediaControl:route.enableMediaControl!==!1},autoFocus:route.autoFocus};currentViewLoadRequest=currentRequest;var onNewViewNeeded=function(){"string"==typeof route.path?loadContentUrl(ctx,next,route,currentRequest):next()};return isBackNav?void viewManager.tryRestoreView(currentRequest,function(){currentRouteInfo={route:route,path:ctx.path}}).catch(function(result){result&&result.cancelled||onNewViewNeeded()}):void onNewViewNeeded()}function onForcedLogoutMessageTimeout(){var msg=forcedLogoutMsg;forcedLogoutMsg=null,msg&&require(["alert"],function(alert){alert(msg)})}function showForcedLogoutMessage(msg){forcedLogoutMsg=msg,msgTimeout&&clearTimeout(msgTimeout),msgTimeout=setTimeout(onForcedLogoutMessageTimeout,100)}function onRequestFail(e,data){var apiClient=this;if(401===data.status&&"ParentalControl"===data.errorCode){var isCurrentAllowed=!currentRouteInfo||(currentRouteInfo.route.anonymous||currentRouteInfo.route.startup);isCurrentAllowed||(showForcedLogoutMessage(globalize.translate("sharedcomponents#AccessRestrictedTryAgainLater")),connectionManager.isLoggedIntoConnect()?appRouter.showConnectLogin():appRouter.showLocalLogin(apiClient.serverId()))}}function normalizeImageOptions(options){var height=screen.availHeight;height=Math.min(height,1440);var scaleFactor=height/1080;Math.abs(height-1080)<100&&(scaleFactor=1);var appImageScaleFactor=browser.tv?.8:1;scaleFactor*=appImageScaleFactor;var setQuality;if(options.maxWidth&&(options.maxWidth=Math.round(options.maxWidth*scaleFactor),setQuality=!0),options.width&&(options.width=Math.round(options.width*scaleFactor),setQuality=!0),options.maxHeight&&(options.maxHeight=Math.round(options.maxHeight*scaleFactor),setQuality=!0),options.height&&(options.height=Math.round(options.height*scaleFactor),setQuality=!0),setQuality){var quality=browser.tv?70:90,isBackdrop=options.type&&"backdrop"===options.type.toLowerCase();isBackdrop&&(quality-=10),browser.slow&&(quality-=40),options.quality=quality}}function onApiClientCreated(e,newApiClient){newApiClient.normalizeImageOptions=normalizeImageOptions,events.off(newApiClient,"requestfail",onRequestFail),events.on(newApiClient,"requestfail",onRequestFail)}function initApiClient(apiClient){onApiClientCreated({},apiClient)}function initApiClients(){connectionManager.getApiClients().forEach(initApiClient),events.on(connectionManager,"apiclientcreated",onApiClientCreated)}function start(options){loading.show(),initApiClients(),connectionManager.connect({enableAutoLogin:appSettings.enableAutoLogin()}).then(function(result){firstConnectionResult=result,loading.hide(),options=options||{},page({click:options.click!==!1,hashbang:options.hashbang!==!1,enableHistory:enableHistory()})})}function enableHistory(){return!browser.xboxOne&&!browser.orsay}function enableNativeHistory(){return page.enableNativeHistory()}function authenticate(ctx,route,callback){var firstResult=firstConnectionResult;if(firstResult&&(firstConnectionResult=null,firstResult.State!==MediaBrowser.ConnectionState.SignedIn&&!route.anonymous))return void handleConnectionResult(firstResult,loading);var apiClient=connectionManager.currentApiClient(),pathname=ctx.pathname.toLowerCase();console.log("appRouter - processing path request "+pathname);var isCurrentRouteStartup=!currentRouteInfo||currentRouteInfo.route.startup,shouldExitApp=ctx.isBack&&route.isDefaultRoute&&isCurrentRouteStartup;if(!(shouldExitApp||apiClient&&apiClient.isLoggedIn()||route.anonymous))return console.log("appRouter - route does not allow anonymous access, redirecting to login"),void beginConnectionWizard();if(shouldExitApp){if(appHost.supports("exit"))return void appHost.exit()}else{if(apiClient&&apiClient.isLoggedIn()){if(console.log("appRouter - user is authenticated"),ctx.isBack&&(route.isDefaultRoute||route.startup)&&!isCurrentRouteStartup)return void handleBackToDefault();if(route.isDefaultRoute)return console.log("appRouter - loading skin home page"),void loadUserSkinWithOptions(ctx);if(route.roles)return void validateRoles(apiClient,route.roles).then(function(){apiClient.ensureWebSocket(),callback()},beginConnectionWizard);apiClient.ensureWebSocket()}console.log("appRouter - proceeding to "+pathname),callback()}}function loadUserSkinWithOptions(ctx){require(["queryString"],function(queryString){var params=queryString.parse(ctx.querystring);skinManager.loadUserSkin({start:params.start})})}function validateRoles(apiClient,roles){return Promise.all(roles.split(",").map(function(role){return validateRole(apiClient,role)}))}function validateRole(apiClient,role){return"admin"===role?apiClient.getCurrentUser().then(function(user){return user.Policy.IsAdministrator?Promise.resolve():Promise.reject()}):Promise.resolve()}function handleBackToDefault(){return!appHost.supports("exitmenu")&&appHost.supports("exit")?void appHost.exit():(isDummyBackToHome=!0,skinManager.loadUserSkin(),void(isHandlingBackToDefault||skinManager.getCurrentSkin().showBackMenu().then(function(){isHandlingBackToDefault=!1})))}function loadContent(ctx,route,html,request){html=globalize.translateDocument(html,route.dictionary),request.view=html,viewManager.loadView(request),currentRouteInfo={route:route,path:ctx.path},ctx.handled=!0}function getRequestFile(){var path=window.location.pathname||"",index=path.lastIndexOf("/");return path=index!==-1?path.substring(index):"/"+path,path&&"/"!==path||(path="/index.html"),path}function endsWith(str,srch){return str.lastIndexOf(srch)===srch.length-1}function baseUrl(){return baseRoute}function getHandler(route){return function(ctx,next){handleRoute(ctx,next,route)}}function getWindowLocationSearch(win){var currentPath=currentRouteInfo?currentRouteInfo.path||"":"",index=currentPath.indexOf("?"),search="";return index!==-1&&(search=currentPath.substring(index)),search||""}function param(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url||getWindowLocationSearch());return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function back(){var checkCanGoBack=browser.web0s||browser.orsay;checkCanGoBack?canGoBack()?page.back():appHost.exit():page.back()}function canGoBack(){var curr=current();return!!curr&&("home"!==curr.type&&page.canGoBack())}function show(path,options){0!==path.indexOf("/")&&path.indexOf("://")===-1&&(path="/"+path);var baseRoute=baseUrl();return path=path.replace(baseRoute,""),currentRouteInfo&¤tRouteInfo.path===path&&"home"!==currentRouteInfo.route.type?(loading.hide(),Promise.resolve()):new Promise(function(resolve,reject){resolveOnNextShow=resolve,page.show(path,options)})}function current(){return currentRouteInfo?currentRouteInfo.route:null}function goHome(){var skin=skinManager.getCurrentSkin();if(skin.getHomeRoute){var homePath=skin.getHomeRoute();return show(pluginManager.mapRoute(skin,homePath))}var homeRoute=skin.getRoutes().filter(function(r){return"home"===r.type})[0];return show(pluginManager.mapRoute(skin,homeRoute))}function getRouteUrl(item,options){return"downloads"===item?"offline/offline.html":"managedownloads"===item?"offline/managedownloads.html":skinManager.getCurrentSkin().getRouteUrl(item,options)}function showItem(item,serverId,options){if("string"==typeof item){var apiClient=serverId?connectionManager.getApiClient(serverId):connectionManager.currentApiClient();apiClient.getItem(apiClient.getCurrentUserId(),item).then(function(item){appRouter.showItem(item,options)})}else{2===arguments.length&&(options=arguments[1]);var url=appRouter.getRouteUrl(item,options);appRouter.show(url,{item:item})}}function setTitle(title){skinManager.getCurrentSkin().setTitle(title)}function showVideoOsd(){var skin=skinManager.getCurrentSkin(),homeRoute=skin.getRoutes().filter(function(r){return"video-osd"===r.type})[0];return show(pluginManager.mapRoute(skin,homeRoute))}function addRoute(path,newRoute){page(path,getHandler(newRoute)),allRoutes.push(newRoute)}function getRoutes(){return allRoutes}function setTransparency(level){backdropContainer||(backdropContainer=document.querySelector(".backdropContainer")),backgroundContainer||(backgroundContainer=document.querySelector(".backgroundContainer")),"full"===level||2===level?(backdrop.clear(!0),document.documentElement.classList.add("transparentDocument"),backgroundContainer.classList.add("backgroundContainer-transparent"),backdropContainer.classList.add("hide")):"backdrop"===level||1===level?(backdrop.externalBackdrop(!0),document.documentElement.classList.add("transparentDocument"),backgroundContainer.classList.add("backgroundContainer-transparent"),backdropContainer.classList.add("hide")):(backdrop.externalBackdrop(!1),document.documentElement.classList.remove("transparentDocument"),backgroundContainer.classList.remove("backgroundContainer-transparent"),backdropContainer.classList.remove("hide"))}function pushState(state,title,url){state.navigate=!1,page.pushState(state,title,url)}function setBaseRoute(){var baseRoute=window.location.pathname.replace(getRequestFile(),"");baseRoute.lastIndexOf("/")===baseRoute.length-1&&(baseRoute=baseRoute.substring(0,baseRoute.length-1)),console.log("Setting page base to "+baseRoute),page.base(baseRoute)}function invokeShortcut(id){0===id.indexOf("library-")?(id=id.replace("library-",""),id=id.split("_"),appRouter.showItem(id[0],id[1])):(id=id.split("_"),appRouter.show(appRouter.getRouteUrl(id[0],{serverId:id[1]})))}var currentViewLoadRequest,msgTimeout,forcedLogoutMsg,firstConnectionResult,isHandlingBackToDefault,isDummyBackToHome,appRouter={showLocalLogin:function(serverId,manualLogin){var pageName=manualLogin?"manuallogin":"login";show("/startup/"+pageName+".html?serverid="+serverId)},showSelectServer:function(){show("/startup/selectserver.html")},showWelcome:function(){show("/startup/welcome.html")},showConnectLogin:function(){show("/startup/connectlogin.html")},showSettings:function(){show("/settings/settings.html")},showSearch:function(){skinManager.getCurrentSkin().search()},showGenre:function(options){skinManager.getCurrentSkin().showGenre(options)},showGuide:function(){skinManager.getCurrentSkin().showGuide()},showLiveTV:function(){skinManager.getCurrentSkin().showLiveTV()},showRecordedTV:function(){skinManager.getCurrentSkin().showRecordedTV()},showFavorites:function(){skinManager.getCurrentSkin().showFavorites()},showNowPlaying:function(){skinManager.getCurrentSkin().showNowPlaying()}},baseRoute=window.location.href.split("?")[0].replace(getRequestFile(),"");baseRoute=baseRoute.split("#")[0],endsWith(baseRoute,"/")&&!endsWith(baseRoute,"://")&&(baseRoute=baseRoute.substring(0,baseRoute.length-1));var resolveOnNextShow;document.addEventListener("viewshow",function(){var resolve=resolveOnNextShow;resolve&&(resolveOnNextShow=null,resolve())});var currentRouteInfo,backdropContainer,backgroundContainer,allRoutes=[];return setBaseRoute(),appRouter.addRoute=addRoute,appRouter.param=param,appRouter.back=back,appRouter.show=show,appRouter.start=start,appRouter.baseUrl=baseUrl,appRouter.canGoBack=canGoBack,appRouter.current=current,appRouter.beginConnectionWizard=beginConnectionWizard,appRouter.goHome=goHome,appRouter.showItem=showItem,appRouter.setTitle=setTitle,appRouter.setTransparency=setTransparency,appRouter.getRoutes=getRoutes,appRouter.getRouteUrl=getRouteUrl,appRouter.pushState=pushState,appRouter.enableNativeHistory=enableNativeHistory,appRouter.showVideoOsd=showVideoOsd,appRouter.handleAnchorClick=page.handleAnchorClick,appRouter.TransparencyLevel={None:0,Backdrop:1,Full:2},appRouter.invokeShortcut=invokeShortcut,appRouter}); \ No newline at end of file +define(["loading","globalize","events","viewManager","skinManager","pluginManager","backdrop","browser","pageJs","appSettings","apphost","connectionManager"],function(loading,globalize,events,viewManager,skinManager,pluginManager,backdrop,browser,page,appSettings,appHost,connectionManager){"use strict";function beginConnectionWizard(){backdrop.clear(),loading.show(),connectionManager.connect({enableAutoLogin:appSettings.enableAutoLogin()}).then(function(result){handleConnectionResult(result,loading)})}function handleConnectionResult(result,loading){switch(result.State){case MediaBrowser.ConnectionState.SignedIn:loading.hide(),skinManager.loadUserSkin();break;case MediaBrowser.ConnectionState.ServerSignIn:result.ApiClient.getPublicUsers().then(function(users){users.length?appRouter.showLocalLogin(result.Servers[0].Id):appRouter.showLocalLogin(result.Servers[0].Id,!0)});break;case MediaBrowser.ConnectionState.ServerSelection:appRouter.showSelectServer();break;case MediaBrowser.ConnectionState.ConnectSignIn:appRouter.showWelcome();break;case MediaBrowser.ConnectionState.ServerUpdateNeeded:require(["alert"],function(alert){alert({text:globalize.translate("sharedcomponents#ServerUpdateNeeded","https://emby.media"),html:globalize.translate("sharedcomponents#ServerUpdateNeeded",'https://emby.media')}).then(function(){appRouter.showSelectServer()})})}}function loadContentUrl(ctx,next,route,request){var url;url=route.contentPath&&"function"==typeof route.contentPath?route.contentPath(ctx.querystring):route.contentPath||route.path,url.indexOf("://")===-1&&(0!==url.indexOf("/")&&(url="/"+url),url=baseUrl()+url),ctx.querystring&&route.enableContentQueryString&&(url+="?"+ctx.querystring),require(["text!"+url],function(html){loadContent(ctx,route,html,request)})}function handleRoute(ctx,next,route){authenticate(ctx,route,function(){initRoute(ctx,next,route)})}function initRoute(ctx,next,route){var onInitComplete=function(controllerFactory){sendRouteToViewManager(ctx,next,route,controllerFactory)};require(route.dependencies||[],function(){route.controller?require([route.controller],onInitComplete):onInitComplete()})}function cancelCurrentLoadRequest(){var currentRequest=currentViewLoadRequest;currentRequest&&(currentRequest.cancel=!0)}function sendRouteToViewManager(ctx,next,route,controllerFactory){if(isDummyBackToHome&&"home"===route.type)return void(isDummyBackToHome=!1);cancelCurrentLoadRequest();var isBackNav=ctx.isBack,currentRequest={url:baseUrl()+ctx.path,transition:route.transition,isBack:isBackNav,state:ctx.state,type:route.type,fullscreen:route.fullscreen,controllerFactory:controllerFactory,options:{supportsThemeMedia:route.supportsThemeMedia||!1,enableMediaControl:route.enableMediaControl!==!1},autoFocus:route.autoFocus};currentViewLoadRequest=currentRequest;var onNewViewNeeded=function(){"string"==typeof route.path?loadContentUrl(ctx,next,route,currentRequest):next()};return isBackNav?void viewManager.tryRestoreView(currentRequest,function(){currentRouteInfo={route:route,path:ctx.path}}).catch(function(result){result&&result.cancelled||onNewViewNeeded()}):void onNewViewNeeded()}function onForcedLogoutMessageTimeout(){var msg=forcedLogoutMsg;forcedLogoutMsg=null,msg&&require(["alert"],function(alert){alert(msg)})}function showForcedLogoutMessage(msg){forcedLogoutMsg=msg,msgTimeout&&clearTimeout(msgTimeout),msgTimeout=setTimeout(onForcedLogoutMessageTimeout,100)}function onRequestFail(e,data){var apiClient=this;if(401===data.status&&"ParentalControl"===data.errorCode){var isCurrentAllowed=!currentRouteInfo||(currentRouteInfo.route.anonymous||currentRouteInfo.route.startup);isCurrentAllowed||(showForcedLogoutMessage(globalize.translate("sharedcomponents#AccessRestrictedTryAgainLater")),connectionManager.isLoggedIntoConnect()?appRouter.showConnectLogin():appRouter.showLocalLogin(apiClient.serverId()))}}function normalizeImageOptions(options){var height=screen.availHeight;height=Math.min(height,1440);var scaleFactor=height/1080;Math.abs(height-1080)<100&&(scaleFactor=1);var appImageScaleFactor=browser.tv?.8:1;scaleFactor*=appImageScaleFactor;var setQuality;if(options.maxWidth&&(options.maxWidth=Math.round(options.maxWidth*scaleFactor),setQuality=!0),options.width&&(options.width=Math.round(options.width*scaleFactor),setQuality=!0),options.maxHeight&&(options.maxHeight=Math.round(options.maxHeight*scaleFactor),setQuality=!0),options.height&&(options.height=Math.round(options.height*scaleFactor),setQuality=!0),setQuality){var quality=browser.tv?70:90,isBackdrop=options.type&&"backdrop"===options.type.toLowerCase();isBackdrop&&(quality-=10),browser.slow&&(quality-=40),options.quality=quality}}function onApiClientCreated(e,newApiClient){newApiClient.normalizeImageOptions=normalizeImageOptions,events.off(newApiClient,"requestfail",onRequestFail),events.on(newApiClient,"requestfail",onRequestFail)}function initApiClient(apiClient){onApiClientCreated({},apiClient)}function initApiClients(){connectionManager.getApiClients().forEach(initApiClient),events.on(connectionManager,"apiclientcreated",onApiClientCreated)}function start(options){loading.show(),initApiClients(),connectionManager.connect({enableAutoLogin:appSettings.enableAutoLogin()}).then(function(result){firstConnectionResult=result,loading.hide(),options=options||{},page({click:options.click!==!1,hashbang:options.hashbang!==!1,enableHistory:enableHistory()})})}function enableHistory(){return!browser.xboxOne&&!browser.orsay}function enableNativeHistory(){return page.enableNativeHistory()}function authenticate(ctx,route,callback){var firstResult=firstConnectionResult;if(firstResult&&(firstConnectionResult=null,firstResult.State!==MediaBrowser.ConnectionState.SignedIn&&!route.anonymous))return void handleConnectionResult(firstResult,loading);var apiClient=connectionManager.currentApiClient(),pathname=ctx.pathname.toLowerCase();console.log("appRouter - processing path request "+pathname);var isCurrentRouteStartup=!currentRouteInfo||currentRouteInfo.route.startup,shouldExitApp=ctx.isBack&&route.isDefaultRoute&&isCurrentRouteStartup;if(!(shouldExitApp||apiClient&&apiClient.isLoggedIn()||route.anonymous))return console.log("appRouter - route does not allow anonymous access, redirecting to login"),void beginConnectionWizard();if(shouldExitApp){if(appHost.supports("exit"))return void appHost.exit()}else{if(apiClient&&apiClient.isLoggedIn()){if(console.log("appRouter - user is authenticated"),ctx.isBack&&(route.isDefaultRoute||route.startup)&&!isCurrentRouteStartup)return void handleBackToDefault();if(route.isDefaultRoute)return console.log("appRouter - loading skin home page"),void loadUserSkinWithOptions(ctx);if(route.roles)return void validateRoles(apiClient,route.roles).then(function(){apiClient.ensureWebSocket(),callback()},beginConnectionWizard);apiClient.ensureWebSocket()}console.log("appRouter - proceeding to "+pathname),callback()}}function loadUserSkinWithOptions(ctx){require(["queryString"],function(queryString){var params=queryString.parse(ctx.querystring);skinManager.loadUserSkin({start:params.start})})}function validateRoles(apiClient,roles){return Promise.all(roles.split(",").map(function(role){return validateRole(apiClient,role)}))}function validateRole(apiClient,role){return"admin"===role?apiClient.getCurrentUser().then(function(user){return user.Policy.IsAdministrator?Promise.resolve():Promise.reject()}):Promise.resolve()}function handleBackToDefault(){return!appHost.supports("exitmenu")&&appHost.supports("exit")?void appHost.exit():(isDummyBackToHome=!0,skinManager.loadUserSkin(),void(isHandlingBackToDefault||skinManager.getCurrentSkin().showBackMenu().then(function(){isHandlingBackToDefault=!1})))}function loadContent(ctx,route,html,request){html=globalize.translateDocument(html,route.dictionary),request.view=html,viewManager.loadView(request),currentRouteInfo={route:route,path:ctx.path},ctx.handled=!0}function getRequestFile(){var path=window.location.pathname||"",index=path.lastIndexOf("/");return path=index!==-1?path.substring(index):"/"+path,path&&"/"!==path||(path="/index.html"),path}function endsWith(str,srch){return str.lastIndexOf(srch)===srch.length-1}function baseUrl(){return baseRoute}function getHandler(route){return function(ctx,next){handleRoute(ctx,next,route)}}function getWindowLocationSearch(win){var currentPath=currentRouteInfo?currentRouteInfo.path||"":"",index=currentPath.indexOf("?"),search="";return index!==-1&&(search=currentPath.substring(index)),search||""}function param(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url||getWindowLocationSearch());return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function back(){var checkCanGoBack=browser.web0s||browser.orsay;if(checkCanGoBack){var curr=current();!canGoBack()||!curr||curr.startup&&"startup/manualserver"!==curr.controller&&"startup/manuallogin"!==curr.controller?appHost.exit():page.back()}else page.back()}function canGoBack(){var curr=current();return!!curr&&("home"!==curr.type&&page.canGoBack())}function show(path,options){0!==path.indexOf("/")&&path.indexOf("://")===-1&&(path="/"+path);var baseRoute=baseUrl();return path=path.replace(baseRoute,""),currentRouteInfo&¤tRouteInfo.path===path&&"home"!==currentRouteInfo.route.type?(loading.hide(),Promise.resolve()):new Promise(function(resolve,reject){resolveOnNextShow=resolve,page.show(path,options)})}function current(){return currentRouteInfo?currentRouteInfo.route:null}function goHome(){var skin=skinManager.getCurrentSkin();if(skin.getHomeRoute){var homePath=skin.getHomeRoute();return show(pluginManager.mapRoute(skin,homePath))}var homeRoute=skin.getRoutes().filter(function(r){return"home"===r.type})[0];return show(pluginManager.mapRoute(skin,homeRoute))}function getRouteUrl(item,options){return"downloads"===item?"offline/offline.html":"managedownloads"===item?"offline/managedownloads.html":skinManager.getCurrentSkin().getRouteUrl(item,options)}function showItem(item,serverId,options){if("string"==typeof item){var apiClient=serverId?connectionManager.getApiClient(serverId):connectionManager.currentApiClient();apiClient.getItem(apiClient.getCurrentUserId(),item).then(function(item){appRouter.showItem(item,options)})}else{2===arguments.length&&(options=arguments[1]);var url=appRouter.getRouteUrl(item,options);appRouter.show(url,{item:item})}}function setTitle(title){skinManager.getCurrentSkin().setTitle(title)}function showVideoOsd(){var skin=skinManager.getCurrentSkin(),homeRoute=skin.getRoutes().filter(function(r){return"video-osd"===r.type})[0];return show(pluginManager.mapRoute(skin,homeRoute))}function addRoute(path,newRoute){page(path,getHandler(newRoute)),allRoutes.push(newRoute)}function getRoutes(){return allRoutes}function setTransparency(level){backdropContainer||(backdropContainer=document.querySelector(".backdropContainer")),backgroundContainer||(backgroundContainer=document.querySelector(".backgroundContainer")),"full"===level||2===level?(backdrop.clear(!0),document.documentElement.classList.add("transparentDocument"),backgroundContainer.classList.add("backgroundContainer-transparent"),backdropContainer.classList.add("hide")):"backdrop"===level||1===level?(backdrop.externalBackdrop(!0),document.documentElement.classList.add("transparentDocument"),backgroundContainer.classList.add("backgroundContainer-transparent"),backdropContainer.classList.add("hide")):(backdrop.externalBackdrop(!1),document.documentElement.classList.remove("transparentDocument"),backgroundContainer.classList.remove("backgroundContainer-transparent"),backdropContainer.classList.remove("hide"))}function pushState(state,title,url){state.navigate=!1,page.pushState(state,title,url)}function setBaseRoute(){var baseRoute=window.location.pathname.replace(getRequestFile(),"");baseRoute.lastIndexOf("/")===baseRoute.length-1&&(baseRoute=baseRoute.substring(0,baseRoute.length-1)),console.log("Setting page base to "+baseRoute),page.base(baseRoute)}function invokeShortcut(id){0===id.indexOf("library-")?(id=id.replace("library-",""),id=id.split("_"),appRouter.showItem(id[0],id[1])):(id=id.split("_"),appRouter.show(appRouter.getRouteUrl(id[0],{serverId:id[1]})))}var currentViewLoadRequest,msgTimeout,forcedLogoutMsg,firstConnectionResult,isHandlingBackToDefault,isDummyBackToHome,appRouter={showLocalLogin:function(serverId,manualLogin){var pageName=manualLogin?"manuallogin":"login";show("/startup/"+pageName+".html?serverid="+serverId)},showSelectServer:function(){show("/startup/selectserver.html")},showWelcome:function(){show("/startup/welcome.html")},showConnectLogin:function(){show("/startup/connectlogin.html")},showSettings:function(){show("/settings/settings.html")},showSearch:function(){skinManager.getCurrentSkin().search()},showGenre:function(options){skinManager.getCurrentSkin().showGenre(options)},showGuide:function(){skinManager.getCurrentSkin().showGuide()},showLiveTV:function(){skinManager.getCurrentSkin().showLiveTV()},showRecordedTV:function(){skinManager.getCurrentSkin().showRecordedTV()},showFavorites:function(){skinManager.getCurrentSkin().showFavorites()},showNowPlaying:function(){skinManager.getCurrentSkin().showNowPlaying()}},baseRoute=window.location.href.split("?")[0].replace(getRequestFile(),"");baseRoute=baseRoute.split("#")[0],endsWith(baseRoute,"/")&&!endsWith(baseRoute,"://")&&(baseRoute=baseRoute.substring(0,baseRoute.length-1));var resolveOnNextShow;document.addEventListener("viewshow",function(){var resolve=resolveOnNextShow;resolve&&(resolveOnNextShow=null,resolve())});var currentRouteInfo,backdropContainer,backgroundContainer,allRoutes=[];return setBaseRoute(),appRouter.addRoute=addRoute,appRouter.param=param,appRouter.back=back,appRouter.show=show,appRouter.start=start,appRouter.baseUrl=baseUrl,appRouter.canGoBack=canGoBack,appRouter.current=current,appRouter.beginConnectionWizard=beginConnectionWizard,appRouter.goHome=goHome,appRouter.showItem=showItem,appRouter.setTitle=setTitle,appRouter.setTransparency=setTransparency,appRouter.getRoutes=getRoutes,appRouter.getRouteUrl=getRouteUrl,appRouter.pushState=pushState,appRouter.enableNativeHistory=enableNativeHistory,appRouter.showVideoOsd=showVideoOsd,appRouter.handleAnchorClick=page.handleAnchorClick,appRouter.TransparencyLevel={None:0,Backdrop:1,Full:2},appRouter.invokeShortcut=invokeShortcut,appRouter}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/upnextdialog/upnextdialog.js b/dashboard-ui/bower_components/emby-webcomponents/upnextdialog/upnextdialog.js index 451ebcc19d..5520f37c7e 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/upnextdialog/upnextdialog.js +++ b/dashboard-ui/bower_components/emby-webcomponents/upnextdialog/upnextdialog.js @@ -1 +1 @@ -define(["dom","playbackManager","connectionManager","events","mediaInfo","layoutManager","focusManager","globalize","itemHelper","css!./upnextdialog","emby-button","flexStyles"],function(dom,playbackManager,connectionManager,events,mediaInfo,layoutManager,focusManager,globalize,itemHelper){"use strict";function seriesImageUrl(item,options){if("Episode"!==item.Type)return null;if(options=options||{},options.type=options.type||"Primary","Primary"===options.type&&item.SeriesPrimaryImageTag)return options.tag=item.SeriesPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if("Thumb"===options.type){if(item.SeriesThumbImageTag)return options.tag=item.SeriesThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if(item.ParentThumbImageTag)return options.tag=item.ParentThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId,options)}return null}function imageUrl(item,options){return options=options||{},options.type=options.type||"Primary",item.ImageTags&&item.ImageTags[options.type]?(options.tag=item.ImageTags[options.type],connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId||item.Id,options)):"Primary"===options.type&&item.AlbumId&&item.AlbumPrimaryImageTag?(options.tag=item.AlbumPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId,options)):null}function setPoster(osdPoster,item,secondaryItem){if(item){var imgUrl=seriesImageUrl(item,{type:"Primary"})||seriesImageUrl(item,{type:"Thumb"})||imageUrl(item,{type:"Primary"});if(!imgUrl&&secondaryItem&&(imgUrl=seriesImageUrl(secondaryItem,{type:"Primary"})||seriesImageUrl(secondaryItem,{type:"Thumb"})||imageUrl(secondaryItem,{type:"Primary"})),imgUrl)return void(osdPoster.innerHTML='')}osdPoster.innerHTML=""}function getHtml(){var html="";return html+='
',html+="
",html+='
',html+='

 

',html+='

',html+='
',html+="
",html+='
',html+='
',html+='",html+='",html+="
",html+="
"}function setNextVideoText(){var instance=this,elem=instance.options.parent,secondsRemaining=Math.max(Math.round(getTimeRemainingMs(instance)/1e3),0);console.log("up next seconds remaining: "+secondsRemaining);var timeText=''+globalize.translate("sharedcomponents#HeaderSecondsValue",secondsRemaining)+"",nextVideoText="Episode"===instance.itemType?globalize.translate("sharedcomponents#HeaderNextEpisodePlayingInValue",timeText):globalize.translate("sharedcomponents#HeaderNextVideoPlayingInValue",timeText);elem.querySelector(".upNextDialog-nextVideoText").innerHTML=nextVideoText}function fillItem(item){var instance=this,elem=instance.options.parent;setPoster(elem.querySelector(".upNextDialog-poster"),item),elem.querySelector(".upNextDialog-overview").innerHTML=item.Overview||"",elem.querySelector(".upNextDialog-mediainfo").innerHTML=mediaInfo.getPrimaryMediaInfoHtml(item,{});var title=itemHelper.getDisplayName(item);item.SeriesName&&(title=item.SeriesName+" - "+title),elem.querySelector(".upNextDialog-title").innerHTML=title||"",instance.itemType=item.Type,instance.show()}function clearCountdownTextTimeout(instance){instance._countdownTextTimeout&&(clearInterval(instance._countdownTextTimeout),instance._countdownTextTimeout=null)}function onStartNowClick(){var options=this.options;if(options){var player=options.player;this.hide(),playbackManager.nextTrack(player)}}function init(instance,options){options.parent.innerHTML=getHtml(),options.parent.classList.add("hide"),options.parent.classList.add("upNextDialog"),options.parent.classList.add("upNextDialog-hidden"),playbackManager.nextItem(options.player).then(fillItem.bind(instance)),options.parent.querySelector(".btnHide").addEventListener("click",instance.hide.bind(instance)),options.parent.querySelector(".btnStartNow").addEventListener("click",onStartNowClick.bind(instance))}function clearHideAnimationEventListeners(instance,elem){var fn=instance._onHideAnimationComplete;fn&&dom.removeEventListener(elem,transitionEndEventName,fn,{once:!0})}function onHideAnimationComplete(e){var instance=this,elem=e.target;elem.classList.add("hide"),clearHideAnimationEventListeners(instance,elem),events.trigger(instance,"hide")}function hideComingUpNext(){var instance=this;clearCountdownTextTimeout(this);var elem=instance.options.parent;if(clearHideAnimationEventListeners(this,elem),!elem.classList.contains("upNextDialog-hidden")){void elem.offsetWidth,elem.classList.add("upNextDialog-hidden");var fn=onHideAnimationComplete.bind(instance);instance._onHideAnimationComplete=fn,dom.addEventListener(elem,transitionEndEventName,fn,{once:!0})}}function getTimeRemainingMs(instance){var options=instance.options;if(options){var runtimeTicks=playbackManager.duration(options.player);if(runtimeTicks){var timeRemainingTicks=runtimeTicks-playbackManager.currentTime(options.player);return Math.round(timeRemainingTicks/1e4)}}return 0}function startComingUpNextHideTimer(instance){var timeRemainingMs=getTimeRemainingMs(instance);timeRemainingMs<=0||(setNextVideoText.call(instance),clearCountdownTextTimeout(instance),instance._countdownTextTimeout=setInterval(setNextVideoText.bind(instance),400))}function UpNextDialog(options){this.options=options,init(this,options)}var transitionEndEventName=dom.whichTransitionEvent();return UpNextDialog.prototype.show=function(){var elem=this.options.parent;clearHideAnimationEventListeners(this,elem),elem.classList.remove("hide"),void elem.offsetWidth,elem.classList.remove("upNextDialog-hidden"),layoutManager.tv&&setTimeout(function(){focusManager.focus(elem.querySelector(".btnStartNow"))},50),startComingUpNextHideTimer(this)},UpNextDialog.prototype.hide=function(){hideComingUpNext.call(this)},UpNextDialog.prototype.destroy=function(){hideComingUpNext.call(this),this.options=null,this.itemType=null},UpNextDialog}); \ No newline at end of file +define(["dom","playbackManager","connectionManager","events","mediaInfo","layoutManager","focusManager","globalize","itemHelper","css!./upnextdialog","emby-button","flexStyles"],function(dom,playbackManager,connectionManager,events,mediaInfo,layoutManager,focusManager,globalize,itemHelper){"use strict";function seriesImageUrl(item,options){if("Episode"!==item.Type)return null;if(options=options||{},options.type=options.type||"Primary","Primary"===options.type&&item.SeriesPrimaryImageTag)return options.tag=item.SeriesPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if("Thumb"===options.type){if(item.SeriesThumbImageTag)return options.tag=item.SeriesThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if(item.ParentThumbImageTag)return options.tag=item.ParentThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId,options)}return null}function imageUrl(item,options){return options=options||{},options.type=options.type||"Primary",item.ImageTags&&item.ImageTags[options.type]?(options.tag=item.ImageTags[options.type],connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId||item.Id,options)):"Primary"===options.type&&item.AlbumId&&item.AlbumPrimaryImageTag?(options.tag=item.AlbumPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId,options)):null}function setPoster(osdPoster,item,secondaryItem){if(item){var imgUrl=seriesImageUrl(item,{type:"Primary"})||seriesImageUrl(item,{type:"Thumb"})||imageUrl(item,{type:"Primary"});if(!imgUrl&&secondaryItem&&(imgUrl=seriesImageUrl(secondaryItem,{type:"Primary"})||seriesImageUrl(secondaryItem,{type:"Thumb"})||imageUrl(secondaryItem,{type:"Primary"})),imgUrl)return void(osdPoster.innerHTML='')}osdPoster.innerHTML=""}function getHtml(){var html="";return html+='
',html+="
",html+='
',html+='

 

',html+='

',html+='
',html+="
",html+='
',html+='
',html+='",html+='",html+="
",html+="
"}function setNextVideoText(){var instance=this,elem=instance.options.parent,secondsRemaining=Math.max(Math.round(getTimeRemainingMs(instance)/1e3),0);console.log("up next seconds remaining: "+secondsRemaining);var timeText=''+globalize.translate("sharedcomponents#HeaderSecondsValue",secondsRemaining)+"",nextVideoText="Episode"===instance.itemType?globalize.translate("sharedcomponents#HeaderNextEpisodePlayingInValue",timeText):globalize.translate("sharedcomponents#HeaderNextVideoPlayingInValue",timeText);elem.querySelector(".upNextDialog-nextVideoText").innerHTML=nextVideoText}function fillItem(item){var instance=this,elem=instance.options.parent;setPoster(elem.querySelector(".upNextDialog-poster"),item),elem.querySelector(".upNextDialog-overview").innerHTML=item.Overview||"",elem.querySelector(".upNextDialog-mediainfo").innerHTML=mediaInfo.getPrimaryMediaInfoHtml(item,{});var title=itemHelper.getDisplayName(item);item.SeriesName&&(title=item.SeriesName+" - "+title),elem.querySelector(".upNextDialog-title").innerHTML=title||"",instance.itemType=item.Type,instance.show()}function clearCountdownTextTimeout(instance){instance._countdownTextTimeout&&(clearInterval(instance._countdownTextTimeout),instance._countdownTextTimeout=null)}function onStartNowClick(){var options=this.options;if(options){var player=options.player;this.hide(),playbackManager.nextTrack(player)}}function init(instance,options){options.parent.innerHTML=getHtml(),options.parent.classList.add("hide"),options.parent.classList.add("upNextDialog"),options.parent.classList.add("upNextDialog-hidden"),playbackManager.nextItem(options.player).then(fillItem.bind(instance)),options.parent.querySelector(".btnHide").addEventListener("click",instance.hide.bind(instance)),options.parent.querySelector(".btnStartNow").addEventListener("click",onStartNowClick.bind(instance))}function clearHideAnimationEventListeners(instance,elem){var fn=instance._onHideAnimationComplete;fn&&dom.removeEventListener(elem,transitionEndEventName,fn,{once:!0})}function onHideAnimationComplete(e){var instance=this,elem=e.target;elem.classList.add("hide"),clearHideAnimationEventListeners(instance,elem),events.trigger(instance,"hide")}function hideComingUpNext(){var instance=this;if(clearCountdownTextTimeout(this),instance.options){var elem=instance.options.parent;if(elem&&(clearHideAnimationEventListeners(this,elem),!elem.classList.contains("upNextDialog-hidden"))){void elem.offsetWidth,elem.classList.add("upNextDialog-hidden");var fn=onHideAnimationComplete.bind(instance);instance._onHideAnimationComplete=fn,dom.addEventListener(elem,transitionEndEventName,fn,{once:!0})}}}function getTimeRemainingMs(instance){var options=instance.options;if(options){var runtimeTicks=playbackManager.duration(options.player);if(runtimeTicks){var timeRemainingTicks=runtimeTicks-playbackManager.currentTime(options.player);return Math.round(timeRemainingTicks/1e4)}}return 0}function startComingUpNextHideTimer(instance){var timeRemainingMs=getTimeRemainingMs(instance);timeRemainingMs<=0||(setNextVideoText.call(instance),clearCountdownTextTimeout(instance),instance._countdownTextTimeout=setInterval(setNextVideoText.bind(instance),400))}function UpNextDialog(options){this.options=options,init(this,options)}var transitionEndEventName=dom.whichTransitionEvent();return UpNextDialog.prototype.show=function(){var elem=this.options.parent;clearHideAnimationEventListeners(this,elem),elem.classList.remove("hide"),void elem.offsetWidth,elem.classList.remove("upNextDialog-hidden"),layoutManager.tv&&setTimeout(function(){focusManager.focus(elem.querySelector(".btnStartNow"))},50),startComingUpNextHideTimer(this)},UpNextDialog.prototype.hide=function(){hideComingUpNext.call(this)},UpNextDialog.prototype.destroy=function(){hideComingUpNext.call(this),this.options=null,this.itemType=null},UpNextDialog}); \ No newline at end of file