From 721d512024aa850f121f3d07cacfaddb55831dac Mon Sep 17 00:00:00 2001 From: l4kr Date: Mon, 9 Feb 2026 10:53:48 +0100 Subject: [PATCH] actually first commit --- .../usersettings/usersettingsbuilder.js | 457 +----------------- 1 file changed, 1 insertion(+), 456 deletions(-) diff --git a/modules/common/usersettings/usersettingsbuilder.js b/modules/common/usersettings/usersettingsbuilder.js index 9d81553..2e81ec5 100644 --- a/modules/common/usersettings/usersettingsbuilder.js +++ b/modules/common/usersettings/usersettingsbuilder.js @@ -1,456 +1 @@ -define([ - "exports", - "./../appsettings.js", - "./../../emby-apiclient/events.js", -], function (_exports, _appsettings, _events) { - function UserSettings() {} - function getHomeSection(instance, index) { - instance = - instance.get("homesection" + index) || - instance.getDefaultHomeScreenSection(index); - return (instance = - "librarytiles" !== instance && - "smalllibrarytiles-automobile" !== instance && - "librarytiles-automobile" !== instance - ? instance - : "smalllibrarytiles"); - } - (Object.defineProperty(_exports, "__esModule", { value: !0 }), - (_exports.default = void 0), - (UserSettings.prototype.setUserInfo = function (userId, apiClient) { - var self; - return ( - this.saveTimeout && clearTimeout(this.saveTimeout), - (this.currentUserId = userId), - (this.currentApiClient = apiClient), - (this.supportsPartialSave = - null == apiClient - ? void 0v - : apiClient.isMinServerVersion("4.9.0.23")), - userId - ? ((self = this), - apiClient.getDisplayPreferences(userId).then(function (result) { - ((self.displayPrefs = result), - _events.default.trigger(self, "load")); - })) - : ((this.displayPrefs = null), Promise.resolve()) - ); - }), - (UserSettings.prototype.getData = function () { - return this.displayPrefs; - }), - (UserSettings.prototype.importFrom = function (instance) { - this.displayPrefs = instance.getData(); - }), - (UserSettings.prototype.set = function (name, value, enableOnServer) { - var currentValue, - userId = this.currentUserId; - if (userId) - return ( - (currentValue = this.get(name, enableOnServer)), - (userId = _appsettings.default.set( - name, - (value = null == value ? null : value), - userId, - )), - !1 !== enableOnServer && - this.displayPrefs && - ((enableOnServer = null == value ? value : value.toString()), - (this.displayPrefs[name] = enableOnServer), - (function (instance, name, value) { - var obj; - instance.supportsPartialSave - ? (((obj = {})[name] = value), - instance.currentApiClient.updatePartialDisplayPreferences( - obj, - instance.currentUserId, - )) - : (instance.saveTimeout && clearTimeout(instance.saveTimeout), - (instance.saveTimeout = setTimeout( - function () { - ((this.saveTimeout = null), - this.currentApiClient.updateDisplayPreferences( - this.displayPrefs, - this.currentUserId, - )); - }.bind(instance), - 50, - ))); - })(this, name, enableOnServer)), - currentValue !== value && - _events.default.trigger(this, "change", [name, value]), - userId - ); - throw new Error("userId cannot be null"); - }), - (UserSettings.prototype.remove = function (name, enableOnServer) { - return this.set(name, null, enableOnServer); - }), - (UserSettings.prototype.get = function (name, enableOnServer) { - var userId = this.currentUserId; - return userId - ? !1 !== enableOnServer && this.displayPrefs - ? this.displayPrefs[name] - : _appsettings.default.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.enableNextVideoInfoOverlay = function (val) { - return null != val - ? this.set("enableNextVideoInfoOverlay", val.toString()) - : "false" !== (val = this.get("enableNextVideoInfoOverlay")); - }), - (UserSettings.prototype.getEnableLogoAsTitle = function (displayLanguage) { - var val = this.get("enableLogoAsTitle"); - return val - ? "true" === val - : displayLanguage && displayLanguage.toLowerCase().startsWith("en"); - }), - (UserSettings.prototype.hideEpisodeSpoilerInfo = function (val) { - return null != val - ? this.set("hideEpisodeSpoilerInfo", val.toString(), !0) - : "true" === (val = this.get("hideEpisodeSpoilerInfo", !0)); - }), - (UserSettings.prototype.setEnableLogoAsTitle = function (val) { - return this.set("enableLogoAsTitle", val.toString()); - }), - (UserSettings.prototype.groupCollectionItems = function (val) { - return null != val - ? this.set("groupCollectionItems", val.toString(), !0) - : "false" !== (val = this.get("groupCollectionItems", !0)); - }), - (UserSettings.prototype.enableAutoFolderJumpThrough = function (val) { - return null != val - ? this.set("enableAutoFolderJumpThrough", val.toString(), !0) - : "false" !== (val = this.get("enableAutoFolderJumpThrough", !0)); - }), - (UserSettings.prototype.enableHomescreenFocusPreviews = function (val) { - return null != val - ? this.set("enableHomescreenFocusPreviews", val.toString(), !0) - : "true" === (val = this.get("enableHomescreenFocusPreviews", !0)); - }), - (UserSettings.prototype.genreLimitForListsOnDetails = function (val) { - return null != val - ? this.set("genreLimitForListsOnDetails", val.toString(), !0) - : parseInt(this.get("genreLimitForListsOnDetails", !0) || "3"); - }), - (UserSettings.prototype.genreLimitOnDetails = function (val) { - return null != val - ? this.set("genreLimitOnDetails", val.toString(), !0) - : parseInt(this.get("genreLimitOnDetails", !0) || "1"); - }), - (UserSettings.prototype.showDetailPoster = function (isTvLayout, val) { - var key = "showDetailPoster" + (isTvLayout ? "tv" : ""); - if (null != val) return this.set(key, val.toString(), !0); - switch ((val = this.get(key, !0))) { - case "true": - return !0; - case "false": - return !1; - default: - return !isTvLayout; - } - }), - (UserSettings.prototype.showEndsAtOnDetails = function (val) { - return null != val - ? this.set("showEndsAtOnDetails", val.toString(), !0) - : "false" !== (val = this.get("showEndsAtOnDetails", !0)); - }), - (UserSettings.prototype.enableRatingInfoOnPlaybackStart = function (val) { - return null != val - ? this.set("enableRatingInfoOnPlaybackStart", val.toString(), !0) - : "false" !== (val = this.get("enableRatingInfoOnPlaybackStart", !0)); - }), - (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") || "10000"); - }), - (UserSettings.prototype.settingsTheme = function (val) { - return null != val - ? this.set("settingsTheme", val, !1) - : this.get("settingsTheme", !1); - }), - (UserSettings.prototype.theme = function (val) { - return null != val - ? this.set("appTheme", val, !1) - : this.get("appTheme", !1) || null; - }), - (UserSettings.prototype.accentColor = function (val) { - return null != val - ? this.set("accentColor", val, !0) - : this.get("accentColor", !0) || "blue"; - }), - (UserSettings.prototype.useSystemAccentColor = function (val) { - return null != val - ? this.set("useSystemAccentColor", val.toString(), !1) - : "true" === this.get("useSystemAccentColor", !1); - }), - (UserSettings.prototype.osdContentSection = function (type, val) { - return null != val - ? this.set("osdcontentsection-" + type, val, !1) - : this.get("osdcontentsection-" + type, !1); - }), - (UserSettings.prototype.drawerStyle = function (val) { - return null != val - ? this.set("drawerstyle", val, !1) - : this.get("drawerstyle", !1) || "closed"; - }), - (UserSettings.prototype.settingsDrawerStyle = function (val) { - return null != val - ? this.set("settingsdrawerstyle", val, !1) - : this.get("settingsdrawerstyle", !1) || "closed"; - }), - (UserSettings.prototype.videoScreenUpAction = function (val) { - return null != val - ? this.set("videoScreenUpAction", val, !0) - : this.get("videoScreenUpAction", !0); - }), - (UserSettings.prototype.nowPlayingAudioBackgroundStyle = function (val) { - return null != val - ? this.set("nowPlayingAudioBackgroundStyle", val, !0) - : this.get("nowPlayingAudioBackgroundStyle", !0) || "blur"; - }), - (UserSettings.prototype.nowPlayingVideoBackgroundStyle = function (val) { - return null != val - ? this.set("nowPlayingVideoBackgroundStyle", val, !0) - : this.get("nowPlayingVideoBackgroundStyle", !0) || "backdrop"; - }), - (UserSettings.prototype.stillWatchingTimeMs = function (val) { - return null != val - ? this.set("stillwatchingms", val, !0) - : parseInt(this.get("stillwatchingms", !0) || "14400000"); - }), - (UserSettings.prototype.tvHome = function (val) { - return null != val - ? this.set("tvhome", val, !0) - : this.get("tvhome", !0) || "vertical"; - }), - (UserSettings.prototype.tvScrollDirection = function (val) { - return null != val - ? this.set("tvScrollDirection", val, !0) - : this.get("tvScrollDirection", !0) || "vertical"; - }), - (UserSettings.prototype.itemSortBy = function (itemId, val) { - itemId = "sortitems-" + itemId + "-by"; - return null != val - ? this.set(itemId, val, !1) - : this.get(itemId, !1) || ""; - }), - (UserSettings.prototype.itemSortOrder = function (itemId, val) { - itemId = "sortitems-" + itemId + "-order"; - return null != val - ? this.set(itemId, val, !1) - : this.get(itemId, !1) || "Ascending"; - }), - (UserSettings.prototype.enableStillWatching = function (val) { - return null != val - ? this.stillWatchingTimeMs(val ? 144e5 : 0) - : 0 < this.stillWatchingTimeMs(); - }), - (UserSettings.prototype.getSubtitleAppearanceSettings = function (key) { - key = key || "localplayersubtitleappearance3"; - key = JSON.parse(this.get(key, !1) || "{}"); - return ( - key.dropShadow || (key.dropShadow = "dropshadow"), - key.textBackground || (key.textBackground = "transparent"), - key.textBackgroundOpacity || (key.textBackgroundOpacity = "1"), - key.textColor || (key.textColor = "#ffffff"), - null == key.positionBottom && (key.positionBottom = "10"), - null == key.positionTop && (key.positionTop = "5"), - key - ); - }), - (UserSettings.prototype.setSubtitleAppearanceSettings = function ( - value, - key, - ) { - return this.set( - (key = key || "localplayersubtitleappearance3"), - JSON.stringify(value), - !1, - ); - }), - (UserSettings.prototype.setFilter = function (key, value, enableOnServer) { - return this.set(key, value, !0 === enableOnServer); - }), - (UserSettings.prototype.getFilter = function (key, enableOnServer) { - key = this.get(key, !0 === enableOnServer); - return "null" === key || "" === key ? null : key; - }), - (UserSettings.prototype.getDefaultHomeScreenSection = function (index) { - switch (index) { - case 0: - return "smalllibrarytiles"; - case 1: - return "resume"; - case 2: - return "resumeaudio"; - case 3: - return "livetv"; - case 4: - return "none"; - case 5: - return "latestmedia"; - default: - return "none"; - } - }), - (UserSettings.prototype.homeSection0 = function (val) { - return null != val - ? this.set("homesection0", val.toString(), !0) - : getHomeSection(this, 0); - }), - (UserSettings.prototype.homeSection1 = function (val) { - return null != val - ? this.set("homesection1", val.toString(), !0) - : getHomeSection(this, 1); - }), - (UserSettings.prototype.homeSection2 = function (val) { - return null != val - ? this.set("homesection2", val.toString(), !0) - : getHomeSection(this, 2); - }), - (UserSettings.prototype.homeSection3 = function (val) { - return null != val - ? this.set("homesection3", val.toString(), !0) - : getHomeSection(this, 3); - }), - (UserSettings.prototype.homeSection4 = function (val) { - return null != val - ? this.set("homesection4", val.toString(), !0) - : getHomeSection(this, 4); - }), - (UserSettings.prototype.homeSection5 = function (val) { - return null != val - ? this.set("homesection5", val.toString(), !0) - : getHomeSection(this, 5); - }), - (UserSettings.prototype.homeSection6 = function (val) { - return null != val - ? this.set("homesection6", val.toString(), !0) - : getHomeSection(this, 6); - }), - (UserSettings.prototype.getHomeScreenSections = function () { - for (var sections = [], i = 0; i < 7; i++) { - var section = getHomeSection(this, i); - "none" !== section && sections.push(section); - } - return sections; - }), - (UserSettings.prototype.guideChannelStyle = function (val) { - return null != val - ? this.set("guideChannelStyle", val.toString(), !0) - : this.get("guideChannelStyle", !0) || "image"; - }), - (UserSettings.prototype.showChannelNumberInGuide = function (val) { - return null != val - ? this.set("showChannelNumberInGuide", val.toString(), !0) - : "false" !== this.get("showChannelNumberInGuide", !0); - }), - (UserSettings.prototype.showFullMediaInfoOnDetailScreen = function (val) { - return null != val - ? this.set("showFullMediaInfoOnDetailScreen", val.toString(), !0) - : "false" !== this.get("showFullMediaInfoOnDetailScreen", !0); - }), - (UserSettings.prototype.seriesDisplay = function (val) { - return null != val - ? this.set("seriesDisplay", val.toString(), !0) - : this.get("seriesDisplay", !0) || "episodes"; - }), - (UserSettings.prototype.getLiveTvChannelSortSettingsKey = function () { - return "livetv-channelorder"; - }), - (UserSettings.prototype.getLiveTvChannelSortOrders = function (globalize) { - for ( - var selectedOrder, - sortBy = [], - currentOrder = - (sortBy.push({ - name: globalize.translate("HeaderDefaultChannelOrder"), - value: "DefaultChannelOrder", - defaultSortOrder: "Ascending", - menuSortKey: "0", - }), - sortBy.push({ - name: globalize.translate("ChannelNumber"), - value: "ChannelNumber,SortName", - defaultSortOrder: "Ascending", - }), - sortBy.push({ - name: globalize.translate("DatePlayed"), - value: "DatePlayed,ChannelNumber,SortName", - defaultSortOrder: "Descending", - }), - sortBy.push({ - name: globalize.translate("Title"), - value: "SortName", - defaultSortOrder: "Ascending", - }), - sortBy.push({ - name: globalize.translate("HeaderFavoritesThenByDefault"), - value: "IsFavorite,DefaultChannelOrder", - defaultSortOrder: "Ascending", - }), - sortBy.push({ - name: globalize.translate("HeaderFavoritesThenByChannelNumber"), - value: "IsFavorite,ChannelNumber,SortName", - defaultSortOrder: "Ascending", - }), - sortBy.push({ - name: globalize.translate("HeaderFavoritesThenByTitle"), - value: "IsFavorite,SortName", - defaultSortOrder: "Ascending", - }), - this.getFilter(this.getLiveTvChannelSortSettingsKey(), !0)), - i = 0, - length = sortBy.length; - i < length; - i++ - ) { - var order = sortBy[i]; - if (order.value === currentOrder) { - selectedOrder = order; - break; - } - } - return ( - ((selectedOrder = selectedOrder || sortBy[0]).selected = !0), - sortBy - ); - }), - (UserSettings.prototype.addLiveTvChannelSortingToQuery = function ( - query, - globalize, - ) { - for ( - var selectedOrder, - orders = this.getLiveTvChannelSortOrders(globalize), - i = 0, - length = orders.length; - i < length; - i++ - ) { - var order = orders[i]; - if (order.selected) { - selectedOrder = order; - break; - } - } - ((query.SortBy = selectedOrder.value), - (query.SortOrder = selectedOrder.defaultSortOrder)); - })); - _exports.default = UserSettings; -}); +define(["exports","./../appsettings.js","./../../emby-apiclient/events.js"],function(_exports,_appsettings,_events){function UserSettings(){}function getHomeSection(instance,index){instance=instance.get("homesection"+index)||instance.getDefaultHomeScreenSection(index);return instance="librarytiles"!==instance&&"smalllibrarytiles-automobile"!==instance&&"librarytiles-automobile"!==instance?instance:"smalllibrarytiles"}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,UserSettings.prototype.setUserInfo=function(userId,apiClient){var self;return this.saveTimeout&&clearTimeout(this.saveTimeout),this.currentUserId=userId,this.currentApiClient=apiClient,this.supportsPartialSave=null==apiClient?void 0:apiClient.isMinServerVersion("4.9.0.23"),userId?(self=this,apiClient.getDisplayPreferences(userId).then(function(result){self.displayPrefs=result,_events.default.trigger(self,"load")})):(this.displayPrefs=null,Promise.resolve())},UserSettings.prototype.getData=function(){return this.displayPrefs},UserSettings.prototype.importFrom=function(instance){this.displayPrefs=instance.getData()},UserSettings.prototype.set=function(name,value,enableOnServer){var currentValue,userId=this.currentUserId;if(userId)return currentValue=this.get(name,enableOnServer),userId=_appsettings.default.set(name,value=null==value?null:value,userId),!1!==enableOnServer&&this.displayPrefs&&(enableOnServer=null==value?value:value.toString(),this.displayPrefs[name]=enableOnServer,function(instance,name,value){var obj;instance.supportsPartialSave?((obj={})[name]=value,instance.currentApiClient.updatePartialDisplayPreferences(obj,instance.currentUserId)):(instance.saveTimeout&&clearTimeout(instance.saveTimeout),instance.saveTimeout=setTimeout(function(){this.saveTimeout=null,this.currentApiClient.updateDisplayPreferences(this.displayPrefs,this.currentUserId)}.bind(instance),50))}(this,name,enableOnServer)),currentValue!==value&&_events.default.trigger(this,"change",[name,value]),userId;throw new Error("userId cannot be null")},UserSettings.prototype.remove=function(name,enableOnServer){return this.set(name,null,enableOnServer)},UserSettings.prototype.get=function(name,enableOnServer){var userId=this.currentUserId;return userId?!1!==enableOnServer&&this.displayPrefs?this.displayPrefs[name]:_appsettings.default.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.enableNextVideoInfoOverlay=function(val){return null!=val?this.set("enableNextVideoInfoOverlay",val.toString()):"false"!==(val=this.get("enableNextVideoInfoOverlay"))},UserSettings.prototype.getEnableLogoAsTitle=function(displayLanguage){var val=this.get("enableLogoAsTitle");return val?"true"===val:displayLanguage&&displayLanguage.toLowerCase().startsWith("en")},UserSettings.prototype.hideEpisodeSpoilerInfo=function(val){return null!=val?this.set("hideEpisodeSpoilerInfo",val.toString(),!0):"true"===(val=this.get("hideEpisodeSpoilerInfo",!0))},UserSettings.prototype.setEnableLogoAsTitle=function(val){return this.set("enableLogoAsTitle",val.toString())},UserSettings.prototype.groupCollectionItems=function(val){return null!=val?this.set("groupCollectionItems",val.toString(),!0):"false"!==(val=this.get("groupCollectionItems",!0))},UserSettings.prototype.enableAutoFolderJumpThrough=function(val){return null!=val?this.set("enableAutoFolderJumpThrough",val.toString(),!0):"false"!==(val=this.get("enableAutoFolderJumpThrough",!0))},UserSettings.prototype.enableHomescreenFocusPreviews=function(val){return null!=val?this.set("enableHomescreenFocusPreviews",val.toString(),!0):"true"===(val=this.get("enableHomescreenFocusPreviews",!0))},UserSettings.prototype.genreLimitForListsOnDetails=function(val){return null!=val?this.set("genreLimitForListsOnDetails",val.toString(),!0):parseInt(this.get("genreLimitForListsOnDetails",!0)||"3")},UserSettings.prototype.genreLimitOnDetails=function(val){return null!=val?this.set("genreLimitOnDetails",val.toString(),!0):parseInt(this.get("genreLimitOnDetails",!0)||"1")},UserSettings.prototype.showDetailPoster=function(isTvLayout,val){var key="showDetailPoster"+(isTvLayout?"tv":"");if(null!=val)return this.set(key,val.toString(),!0);switch(val=this.get(key,!0)){case"true":return!0;case"false":return!1;default:return!isTvLayout}},UserSettings.prototype.showEndsAtOnDetails=function(val){return null!=val?this.set("showEndsAtOnDetails",val.toString(),!0):"false"!==(val=this.get("showEndsAtOnDetails",!0))},UserSettings.prototype.enableRatingInfoOnPlaybackStart=function(val){return null!=val?this.set("enableRatingInfoOnPlaybackStart",val.toString(),!0):"false"!==(val=this.get("enableRatingInfoOnPlaybackStart",!0))},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")||"10000")},UserSettings.prototype.settingsTheme=function(val){return null!=val?this.set("settingsTheme",val,!1):this.get("settingsTheme",!1)},UserSettings.prototype.theme=function(val){return null!=val?this.set("appTheme",val,!1):this.get("appTheme",!1)||null},UserSettings.prototype.accentColor=function(val){return null!=val?this.set("accentColor",val,!0):this.get("accentColor",!0)||"emby"},UserSettings.prototype.useSystemAccentColor=function(val){return null!=val?this.set("useSystemAccentColor",val.toString(),!1):"true"===this.get("useSystemAccentColor",!1)},UserSettings.prototype.osdContentSection=function(type,val){return null!=val?this.set("osdcontentsection-"+type,val,!1):this.get("osdcontentsection-"+type,!1)},UserSettings.prototype.drawerStyle=function(val){return null!=val?this.set("drawerstyle",val,!1):this.get("drawerstyle",!1)||"docked"},UserSettings.prototype.settingsDrawerStyle=function(val){return null!=val?this.set("settingsdrawerstyle",val,!1):this.get("settingsdrawerstyle",!1)||"docked"},UserSettings.prototype.videoScreenUpAction=function(val){return null!=val?this.set("videoScreenUpAction",val,!0):this.get("videoScreenUpAction",!0)},UserSettings.prototype.nowPlayingAudioBackgroundStyle=function(val){return null!=val?this.set("nowPlayingAudioBackgroundStyle",val,!0):this.get("nowPlayingAudioBackgroundStyle",!0)||"blur"},UserSettings.prototype.nowPlayingVideoBackgroundStyle=function(val){return null!=val?this.set("nowPlayingVideoBackgroundStyle",val,!0):this.get("nowPlayingVideoBackgroundStyle",!0)||"backdrop"},UserSettings.prototype.stillWatchingTimeMs=function(val){return null!=val?this.set("stillwatchingms",val,!0):parseInt(this.get("stillwatchingms",!0)||"14400000")},UserSettings.prototype.tvHome=function(val){return null!=val?this.set("tvhome",val,!0):this.get("tvhome",!0)||"vertical"},UserSettings.prototype.tvScrollDirection=function(val){return null!=val?this.set("tvScrollDirection",val,!0):this.get("tvScrollDirection",!0)||"vertical"},UserSettings.prototype.itemSortBy=function(itemId,val){itemId="sortitems-"+itemId+"-by";return null!=val?this.set(itemId,val,!1):this.get(itemId,!1)||""},UserSettings.prototype.itemSortOrder=function(itemId,val){itemId="sortitems-"+itemId+"-order";return null!=val?this.set(itemId,val,!1):this.get(itemId,!1)||"Ascending"},UserSettings.prototype.enableStillWatching=function(val){return null!=val?this.stillWatchingTimeMs(val?144e5:0):0