mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
1 line
888 B
JavaScript
1 line
888 B
JavaScript
define(["displaySettings","userSettingsBuilder","userSettings"],function(DisplaySettings,userSettingsBuilder,currentUserSettings){"use strict";return function(view,params){var settingsInstance,userId=params.userId||ApiClient.getCurrentUserId(),userSettings=userId===ApiClient.getCurrentUserId()?currentUserSettings:new userSettingsBuilder,autoSave=!0;view.addEventListener("viewshow",function(){settingsInstance?settingsInstance.loadData():settingsInstance=new DisplaySettings({serverId:ApiClient.serverId(),userId:userId,element:view.querySelector(".settingsContainer"),userSettings:userSettings,enableSaveButton:!autoSave,enableSaveConfirmation:!autoSave})}),view.addEventListener("viewbeforehide",function(){autoSave&&settingsInstance&&settingsInstance.submit()}),view.addEventListener("viewdestroy",function(){settingsInstance&&(settingsInstance.destroy(),settingsInstance=null)})}}); |