update components

This commit is contained in:
Luke Pulverenti 2017-09-25 15:17:34 -04:00
parent 305c2ddaf6
commit 2ae8f5b9af
14 changed files with 18 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
define(["appSettings","events","browser"],function(appsettings,events,browser){"use strict";function onSaveTimeout(){var self=this;self.saveTimeout=null,self.currentApiClient.updateDisplayPreferences("usersettings",self.displayPrefs,self.currentUserId,"emby")}function saveServerPreferences(instance){instance.saveTimeout&&clearTimeout(instance.saveTimeout),instance.saveTimeout=setTimeout(onSaveTimeout.bind(instance),50)}function UserSettings(){}function getSavedQueryKey(context){return"query-"+context}return UserSettings.prototype.setUserInfo=function(userId,apiClient){if(this.saveTimeout&&clearTimeout(this.saveTimeout),this.currentUserId=userId,this.currentApiClient=apiClient,!userId)return this.displayPrefs=null,Promise.resolve();var self=this;return apiClient.getDisplayPreferences("usersettings",userId,"emby").then(function(result){result.CustomPrefs=result.CustomPrefs||{},self.displayPrefs=result})},UserSettings.prototype.getData=function(){return this.displayPrefs},UserSettings.prototype.importFrom=function(instance){this.displayPrefs=instance.getData()},UserSettings.prototype.set=function(name,value,enableOnServer){var userId=this.currentUserId;if(!userId)throw new Error("userId cannot be null");var currentValue=this.get(name);appsettings.set(name,value,userId),enableOnServer!==!1&&this.displayPrefs&&(this.displayPrefs.CustomPrefs[name]=null==value?value:value.toString(),saveServerPreferences(this)),currentValue!==value&&events.trigger(this,"change",[name])},UserSettings.prototype.get=function(name,enableOnServer){var userId=this.currentUserId;return userId?enableOnServer!==!1&&this.displayPrefs?this.displayPrefs.CustomPrefs[name]:appsettings.get(name,userId):null},UserSettings.prototype.serverConfig=function(config){var apiClient=this.currentApiClient;return config?apiClient.updateUserConfiguration(this.currentUserId,config):apiClient.getUser(this.currentUserId).then(function(user){return user.Configuration})},UserSettings.prototype.enableCinemaMode=function(val){return null!=val&&this.set("enableCinemaMode",val.toString(),!1),val=this.get("enableCinemaMode",!1),!val||"false"!==val},UserSettings.prototype.enableNextVideoInfoOverlay=function(val){return null!=val&&this.set("enableNextVideoInfoOverlay",val.toString()),val=this.get("enableNextVideoInfoOverlay"),"false"!==val},UserSettings.prototype.enableThemeSongs=function(val){return null!=val&&this.set("enableThemeSongs",val.toString(),!1),val=this.get("enableThemeSongs",!1),"false"!==val},UserSettings.prototype.enableThemeVideos=function(val){return null!=val&&this.set("enableThemeVideos",val.toString(),!1),val=this.get("enableThemeVideos",!1),val?"false"!==val:!browser.slow},UserSettings.prototype.language=function(val){return null!=val&&this.set("language",val.toString(),!1),this.get("language",!1)},UserSettings.prototype.skipBackLength=function(val){return null!=val&&this.set("skipBackLength",val.toString()),parseInt(this.get("skipBackLength")||"10000")},UserSettings.prototype.skipForwardLength=function(val){return null!=val&&this.set("skipForwardLength",val.toString()),parseInt(this.get("skipForwardLength")||"30000")},UserSettings.prototype.dashboardTheme=function(val){return null!=val&&this.set("dashboardTheme",val),this.get("dashboardTheme")},UserSettings.prototype.appTheme=function(val){return null!=val&&this.set("appTheme",val,!1),this.get("appTheme",!1)},UserSettings.prototype.loadQuerySettings=function(query,context){var key=getSavedQueryKey(context),values=this.get(key);if(values)return values=JSON.parse(values),Object.assign(query,values)},UserSettings.prototype.saveQuerySettings=function(query,context){var key=getSavedQueryKey(context),values={};query.SortBy&&(values.SortBy=query.SortBy),query.SortOrder&&(values.SortOrder=query.SortOrder),this.set(key,JSON.stringify(values))},UserSettings.prototype.getSubtitleAppearanceSettings=function(key){return key=key||"localplayersubtitleappearance3",JSON.parse(this.get(key,!1)||"{}")},UserSettings.prototype.setSubtitleAppearanceSettings=function(value,key){key=key||"localplayersubtitleappearance3",this.set(key,JSON.stringify(value),!1)},UserSettings});
define(["appSettings","events"],function(appsettings,events){"use strict";function onSaveTimeout(){var self=this;self.saveTimeout=null,self.currentApiClient.updateDisplayPreferences("usersettings",self.displayPrefs,self.currentUserId,"emby")}function saveServerPreferences(instance){instance.saveTimeout&&clearTimeout(instance.saveTimeout),instance.saveTimeout=setTimeout(onSaveTimeout.bind(instance),50)}function UserSettings(){}function getSavedQueryKey(context){return"query-"+context}return UserSettings.prototype.setUserInfo=function(userId,apiClient){if(this.saveTimeout&&clearTimeout(this.saveTimeout),this.currentUserId=userId,this.currentApiClient=apiClient,!userId)return this.displayPrefs=null,Promise.resolve();var self=this;return apiClient.getDisplayPreferences("usersettings",userId,"emby").then(function(result){result.CustomPrefs=result.CustomPrefs||{},self.displayPrefs=result})},UserSettings.prototype.getData=function(){return this.displayPrefs},UserSettings.prototype.importFrom=function(instance){this.displayPrefs=instance.getData()},UserSettings.prototype.set=function(name,value,enableOnServer){var userId=this.currentUserId;if(!userId)throw new Error("userId cannot be null");var currentValue=this.get(name),result=appsettings.set(name,value,userId);return enableOnServer!==!1&&this.displayPrefs&&(this.displayPrefs.CustomPrefs[name]=null==value?value:value.toString(),saveServerPreferences(this)),currentValue!==value&&events.trigger(this,"change",[name]),result},UserSettings.prototype.get=function(name,enableOnServer){var userId=this.currentUserId;return userId?enableOnServer!==!1&&this.displayPrefs?this.displayPrefs.CustomPrefs[name]:appsettings.get(name,userId):null},UserSettings.prototype.serverConfig=function(config){var apiClient=this.currentApiClient;return config?apiClient.updateUserConfiguration(this.currentUserId,config):apiClient.getUser(this.currentUserId).then(function(user){return user.Configuration})},UserSettings.prototype.enableCinemaMode=function(val){return null!=val?this.set("enableCinemaMode",val.toString(),!1):(val=this.get("enableCinemaMode",!1),!val||"false"!==val)},UserSettings.prototype.enableNextVideoInfoOverlay=function(val){return null!=val?this.set("enableNextVideoInfoOverlay",val.toString()):(val=this.get("enableNextVideoInfoOverlay"),"false"!==val)},UserSettings.prototype.enableThemeSongs=function(val){return null!=val?this.set("enableThemeSongs",val.toString(),!1):(val=this.get("enableThemeSongs",!1),"false"!==val)},UserSettings.prototype.enableThemeVideos=function(val){return null!=val?this.set("enableThemeVideos",val.toString(),!1):(val=this.get("enableThemeVideos",!1),val?"false"!==val:UserSettings.defaults.enableThemeVideos)},UserSettings.prototype.language=function(val){return null!=val?this.set("language",val.toString(),!1):this.get("language",!1)},UserSettings.prototype.skipBackLength=function(val){return null!=val?this.set("skipBackLength",val.toString()):parseInt(this.get("skipBackLength")||"10000")},UserSettings.prototype.skipForwardLength=function(val){return null!=val?this.set("skipForwardLength",val.toString()):parseInt(this.get("skipForwardLength")||"30000")},UserSettings.prototype.dashboardTheme=function(val){return null!=val?this.set("dashboardTheme",val):this.get("dashboardTheme")},UserSettings.prototype.theme=function(val){return null!=val?this.set("appTheme",val,!1):this.get("appTheme",!1)||UserSettings.defaults.theme},UserSettings.defaults={theme:null,enableThemeVideos:!0},UserSettings.prototype.loadQuerySettings=function(query,context){var key=getSavedQueryKey(context),values=this.get(key);if(values)return values=JSON.parse(values),Object.assign(query,values)},UserSettings.prototype.saveQuerySettings=function(query,context){var key=getSavedQueryKey(context),values={};return query.SortBy&&(values.SortBy=query.SortBy),query.SortOrder&&(values.SortOrder=query.SortOrder),this.set(key,JSON.stringify(values))},UserSettings.prototype.getSubtitleAppearanceSettings=function(key){return key=key||"localplayersubtitleappearance3",JSON.parse(this.get(key,!1)||"{}")},UserSettings.prototype.setSubtitleAppearanceSettings=function(value,key){return key=key||"localplayersubtitleappearance3",this.set(key,JSON.stringify(value),!1)},UserSettings});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
<div style="flex-grow:1;">
<input is="emby-input" class="txtPath" label="${LabelFileOrUrl}" required="required" autocomplete="off" />
</div>
<button type="button" is="paper-icon-button-light" id="btnSelectPath" class="autoSize"><i class="md-icon">search</i></button>
<button type="button" is="paper-icon-button-light" id="btnSelectPath" class="emby-input-iconbutton"><i class="md-icon">search</i></button>
</div>
<div class="fieldDescription">${XmlTvPathHelp}</div>
</div>
@ -46,7 +46,7 @@
</div>
<div class="paperList" style="padding:1em;border-radius:5px;">
<div class="premiereHelp"></div>
<a class="lnkPremiere" href="https://emby.media/premiere">${ButtonLearnMore}</a>
<a class="lnkPremiere button-link" href="https://emby.media/premiere" target="_blank" is="emby-linkbutton">${ButtonLearnMore}</a>
</div><br />
<div>
<button is="emby-button" type="submit" class="raised button-submit block btnSubmitListings hide"><span>${ButtonSave}</span></button>

View File

@ -1 +1 @@
define(["userSettingsBuilder","appStorage","loading","skinManager","emby-linkbutton"],function(userSettingsBuilder,appStorage,loading,skinManager){"use strict";function fillThemes(select,isDashboard){select.innerHTML=skinManager.getThemes().map(function(t){var value=t.id;return t.isDefault&&!isDashboard?value="":t.isDefaultServerDashboard&&isDashboard&&(value=""),'<option value="'+value+'">'+t.name+"</option>"}).join("")}return function(view,params){function loadForm(page,user){user.Policy.IsAdministrator?page.querySelector(".selectDashboardThemeContainer").classList.remove("hide"):page.querySelector(".selectDashboardThemeContainer").classList.add("hide"),userSettingsInstance.setUserInfo(userId,ApiClient).then(function(){var selectTheme=page.querySelector("#selectTheme"),selectDashboardTheme=page.querySelector("#selectDashboardTheme");fillThemes(selectTheme),fillThemes(selectDashboardTheme,!0),userSettingsLoaded=!0,page.querySelector(".chkDisplayMissingEpisodes").checked=user.Configuration.DisplayMissingEpisodes||!1,page.querySelector("#chkThemeSong").checked=userSettingsInstance.enableThemeSongs(),page.querySelector("#selectBackdrop").value=appStorage.getItem("enableBackdrops-"+user.Id)||"0",page.querySelector("#selectLanguage").value=userSettingsInstance.language()||"",selectDashboardTheme.value=userSettingsInstance.dashboardTheme()||"",selectTheme.value=userSettingsInstance.appTheme()||"",loading.hide()})}function refreshGlobalUserSettings(){require(["userSettings"],function(userSettings){userSettings.importFrom(userSettingsInstance)})}function saveUser(page,user){return user.Configuration.DisplayMissingEpisodes=page.querySelector(".chkDisplayMissingEpisodes").checked,userSettingsLoaded&&(AppInfo.supportsUserDisplayLanguageSetting&&userSettingsInstance.language(page.querySelector("#selectLanguage").value),userSettingsInstance.enableThemeSongs(page.querySelector("#chkThemeSong").checked),userSettingsInstance.dashboardTheme(page.querySelector("#selectDashboardTheme").value),userSettingsInstance.appTheme(page.querySelector("#selectTheme").value),userId===Dashboard.getCurrentUserId()&&(skinManager.setTheme(userSettingsInstance.appTheme()||"dark"),refreshGlobalUserSettings())),appStorage.setItem("enableBackdrops-"+user.Id,page.querySelector("#selectBackdrop").value),ApiClient.updateUserConfiguration(user.Id,user.Configuration)}function save(page){autoSave||loading.show(),ApiClient.getUser(userId).then(function(user){saveUser(page,user).then(function(){loading.hide(),autoSave||require(["toast"],function(toast){toast(Globalize.translate("SettingsSaved"))})},function(){loading.hide()})})}var userSettingsLoaded,userId=params.userId||Dashboard.getCurrentUserId(),userSettingsInstance=new userSettingsBuilder,autoSave=!0;view.querySelector(".displayPreferencesForm").addEventListener("submit",function(e){return save(view),e.preventDefault(),!1}),autoSave?view.querySelector(".btnSave").classList.add("hide"):view.querySelector(".btnSave").classList.remove("hide"),view.addEventListener("viewshow",function(){var page=this;loading.show(),ApiClient.getUser(userId).then(function(user){loadForm(page,user)}),AppInfo.supportsUserDisplayLanguageSetting?page.querySelector(".languageSection").classList.remove("hide"):page.querySelector(".languageSection").classList.add("hide")}),view.addEventListener("viewbeforehide",function(){var page=this;autoSave&&save(page)})}});
define(["userSettingsBuilder","appStorage","loading","skinManager","emby-linkbutton"],function(userSettingsBuilder,appStorage,loading,skinManager){"use strict";function fillThemes(select,isDashboard){select.innerHTML=skinManager.getThemes().map(function(t){var value=t.id;return t.isDefault&&!isDashboard?value="":t.isDefaultServerDashboard&&isDashboard&&(value=""),'<option value="'+value+'">'+t.name+"</option>"}).join("")}return function(view,params){function loadForm(page,user){user.Policy.IsAdministrator?page.querySelector(".selectDashboardThemeContainer").classList.remove("hide"):page.querySelector(".selectDashboardThemeContainer").classList.add("hide"),userSettingsInstance.setUserInfo(userId,ApiClient).then(function(){var selectTheme=page.querySelector("#selectTheme"),selectDashboardTheme=page.querySelector("#selectDashboardTheme");fillThemes(selectTheme),fillThemes(selectDashboardTheme,!0),userSettingsLoaded=!0,page.querySelector(".chkDisplayMissingEpisodes").checked=user.Configuration.DisplayMissingEpisodes||!1,page.querySelector("#chkThemeSong").checked=userSettingsInstance.enableThemeSongs(),page.querySelector("#selectBackdrop").value=appStorage.getItem("enableBackdrops-"+user.Id)||"0",page.querySelector("#selectLanguage").value=userSettingsInstance.language()||"",selectDashboardTheme.value=userSettingsInstance.dashboardTheme()||"",selectTheme.value=userSettingsInstance.theme()||"",loading.hide()})}function refreshGlobalUserSettings(){require(["userSettings"],function(userSettings){userSettings.importFrom(userSettingsInstance)})}function saveUser(page,user){return user.Configuration.DisplayMissingEpisodes=page.querySelector(".chkDisplayMissingEpisodes").checked,userSettingsLoaded&&(AppInfo.supportsUserDisplayLanguageSetting&&userSettingsInstance.language(page.querySelector("#selectLanguage").value),userSettingsInstance.enableThemeSongs(page.querySelector("#chkThemeSong").checked),userSettingsInstance.dashboardTheme(page.querySelector("#selectDashboardTheme").value),userSettingsInstance.theme(page.querySelector("#selectTheme").value),userId===Dashboard.getCurrentUserId()&&(skinManager.setTheme(userSettingsInstance.theme()||"dark"),refreshGlobalUserSettings())),appStorage.setItem("enableBackdrops-"+user.Id,page.querySelector("#selectBackdrop").value),ApiClient.updateUserConfiguration(user.Id,user.Configuration)}function save(page){autoSave||loading.show(),ApiClient.getUser(userId).then(function(user){saveUser(page,user).then(function(){loading.hide(),autoSave||require(["toast"],function(toast){toast(Globalize.translate("SettingsSaved"))})},function(){loading.hide()})})}var userSettingsLoaded,userId=params.userId||Dashboard.getCurrentUserId(),userSettingsInstance=new userSettingsBuilder,autoSave=!0;view.querySelector(".displayPreferencesForm").addEventListener("submit",function(e){return save(view),e.preventDefault(),!1}),autoSave?view.querySelector(".btnSave").classList.add("hide"):view.querySelector(".btnSave").classList.remove("hide"),view.addEventListener("viewshow",function(){var page=this;loading.show(),ApiClient.getUser(userId).then(function(user){loadForm(page,user)}),AppInfo.supportsUserDisplayLanguageSetting?page.querySelector(".languageSection").classList.remove("hide"):page.querySelector(".languageSection").classList.add("hide")}),view.addEventListener("viewbeforehide",function(){var page=this;autoSave&&save(page)})}});

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
define(["userSettings","skinManager"],function(userSettings,skinManager){"use strict";pageClassOn("viewbeforeshow","page",function(){var viewType=this.getAttribute("data-theme");viewType||(viewType=this.classList.contains("type-interior")||this.classList.contains("wizardPage")?"a":"b",this.setAttribute("data-theme",viewType));var theme,context;"a"===viewType?(theme=userSettings.dashboardTheme(),context="serverdashboard"):theme=userSettings.appTheme(),skinManager.setTheme(theme,context)})});
define(["userSettings","skinManager"],function(userSettings,skinManager){"use strict";pageClassOn("viewbeforeshow","page",function(){var viewType=this.getAttribute("data-theme");viewType||(viewType=this.classList.contains("type-interior")||this.classList.contains("wizardPage")?"a":"b",this.setAttribute("data-theme",viewType));var theme,context;"a"===viewType?(theme=userSettings.dashboardTheme(),context="serverdashboard"):theme=userSettings.theme(),skinManager.setTheme(theme,context)})});