2021-03-28 17:11:00 +03:00
|
|
|
import { Events } from 'jellyfin-apiclient';
|
|
|
|
import toast from '../../../components/toast/toast';
|
|
|
|
import globalize from '../../../scripts/globalize';
|
|
|
|
import appSettings from '../../../scripts/settings/appSettings';
|
|
|
|
|
2021-06-15 22:01:00 +03:00
|
|
|
export default function (view) {
|
2021-03-28 17:11:00 +03:00
|
|
|
function submit(e) {
|
|
|
|
appSettings.enableGamepad(view.querySelector('.chkEnableGamepad').checked);
|
|
|
|
|
|
|
|
toast(globalize.translate('SettingsSaved'));
|
|
|
|
|
|
|
|
Events.trigger(view, 'saved');
|
|
|
|
|
2021-06-15 21:50:20 +03:00
|
|
|
e?.preventDefault();
|
2021-03-28 17:11:00 +03:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
view.addEventListener('viewshow', function () {
|
|
|
|
view.querySelector('.chkEnableGamepad').checked = appSettings.enableGamepad();
|
|
|
|
view.querySelector('form').addEventListener('submit', submit);
|
|
|
|
view.querySelector('.btnSave').classList.remove('hide');
|
|
|
|
|
|
|
|
import('../../../components/autoFocuser').then(({default: autoFocuser}) => {
|
|
|
|
autoFocuser.autoFocus(view);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|