2017-05-17 11:17:20 -07:00
|
|
|
define(["loading","libraryBrowser","libraryMenu","playbackManager","mainTabsManager","homeSections","globalize","serverNotifications","events","emby-button"],function(loading,libraryBrowser,libraryMenu,playbackManager,mainTabsManager,homeSections,globalize,serverNotifications,events){"use strict";function displayPreferencesKey(){return AppInfo.isNativeApp?"Emby Mobile":"webclient"}function dismissWelcome(page,userId){var apiClient=ApiClient;getDisplayPreferences(apiClient,"home",userId).then(function(result){result.CustomPrefs[homePageTourKey]=homePageDismissValue,apiClient.updateDisplayPreferences("home",result,userId,displayPreferencesKey())})}function showWelcomeIfNeeded(page,displayPreferences){if(displayPreferences.CustomPrefs[homePageTourKey]==homePageDismissValue)page.querySelector(".welcomeMessage").classList.add("hide");else{loading.hide();var elem=page.querySelector(".welcomeMessage");elem.classList.remove("hide"),displayPreferences.CustomPrefs[homePageTourKey]?(elem.querySelector(".tourHeader").innerHTML=globalize.translate("HeaderWelcomeBack"),elem.querySelector(".tourButtonText").innerHTML=globalize.translate("ButtonTakeTheTourToSeeWhatsNew")):(elem.querySelector(".tourHeader").innerHTML=globalize.translate("HeaderWelcomeToProjectWebClient"),elem.querySelector(".tourButtonText").innerHTML=globalize.translate("ButtonTakeTheTour"))}}function takeTour(page,userId){require(["slideshow"],function(){var slides=[{imageUrl:"css/images/tour/web/tourcontent.jpg",title:globalize.translate("WebClientTourContent")},{imageUrl:"css/images/tour/web/tourmovies.jpg",title:globalize.translate("WebClientTourMovies")},{imageUrl:"css/images/tour/web/tourmouseover.jpg",title:globalize.translate("WebClientTourMouseOver")},{imageUrl:"css/images/tour/web/tourtaphold.jpg",title:globalize.translate("WebClientTourTapHold")},{imageUrl:"css/images/tour/web/tourmysync.png",title:globalize.translate("WebClientTourMySync")},{imageUrl:"css/images/tour/web/toureditor.png",title:globalize.translate("WebClientTourMetadataManager")},{imageUrl:"css/images/tour/web/tourplaylist.png",title:globalize.translate("WebClientTourPlaylists")},{imageUrl:"css/images/tour/web/tourcollections.jpg",title:globalize.translate("WebClientTourCollections")},{imageUrl:"css/images/tour/web/tourusersettings1.png",title:globalize.translate("WebClientTourUserPreferences1")},{imageUrl:"css/images/tour/web/tourusersettings2.png",title:globalize.translate("WebClientTourUserPreferences2")},{imageUrl:"css/images/tour/web/tourusersettings3.png",title:globalize.translate("WebClientTourUserPreferences3")},{imageUrl:"css/images/tour/web/tourusersettings4.png",title:globalize.translate("WebClientTourUserPreferences4")},{imageUrl:"css/images/tour/web/tourmobile1.jpg",title:globalize.translate("WebClientTourMobile1")},{imageUrl:"css/images/tour/web/tourmobile2.png",title:globalize.translate("WebClientTourMobile2")},{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),page.querySelector(".welcomeMessage").classList.add("hide")})})}function getRequirePromise(deps){return new Promise(function(resolve,reject){require(deps,resolve)})}function loadHomeTab(page,tabContent){var apiClient=ApiClient;if(apiClient){var userId=Dashboard.getCurrentUserId();loading.show();var promises=[Dashboard.getCurrentUser(),getRequirePromise(["userSettings"])];Promise.all(promises).then(function(responses){var user=responses[0],userSettings=responses[1];homeSections.loadSections(tabContent.querySelector(".sections"),apiClient,user,userSettings).then(function(){loading.hide()})}),AppInfo.isNativeApp||getDisplayPreferences(apiClient,"home",userId).then(function(displayPreferences){showWelcomeIfNeeded(page,displayPreferences)})}}function getDisplayPreferences(apiClient,key,userId){return apiClient.getDisplayPreferences(key,userId,displayPreferencesKey())}function getTabs(){return[{name:globalize.translate("TabHome")}
|