jellyfin-web/dashboard-ui/scripts/mypreferencessubtitles.js
2017-11-15 16:06:00 -05:00

1 line
963 B
JavaScript

define(["subtitleSettings","userSettingsBuilder","userSettings"],function(SubtitleSettings,userSettingsBuilder,currentUserSettings){"use strict";return function(view,params){var subtitleSettingsInstance,userId=params.userId||ApiClient.getCurrentUserId(),userSettings=userId===ApiClient.getCurrentUserId()?currentUserSettings:new userSettingsBuilder,autoSave=!0;view.addEventListener("viewshow",function(){subtitleSettingsInstance?subtitleSettingsInstance.loadData():subtitleSettingsInstance=new SubtitleSettings({serverId:ApiClient.serverId(),userId:userId,element:view.querySelector(".settingsContainer"),userSettings:userSettings,enableSaveButton:!autoSave,enableSaveConfirmation:!autoSave})}),view.addEventListener("viewbeforehide",function(){autoSave&&subtitleSettingsInstance&&subtitleSettingsInstance.submit()}),view.addEventListener("viewdestroy",function(){subtitleSettingsInstance&&(subtitleSettingsInstance.destroy(),subtitleSettingsInstance=null)})}});