2024-03-25 01:16:33 +03:00
|
|
|
import layoutManager from 'components/layoutManager';
|
2021-03-28 17:11:00 +03:00
|
|
|
import toast from '../../../components/toast/toast';
|
|
|
|
import globalize from '../../../scripts/globalize';
|
|
|
|
import appSettings from '../../../scripts/settings/appSettings';
|
2022-10-14 10:53:16 -04:00
|
|
|
import Events from '../../../utils/events.ts';
|
2021-03-28 17:11:00 +03:00
|
|
|
|
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);
|
2024-03-25 01:16:33 +03:00
|
|
|
appSettings.enableSmoothScroll(view.querySelector('.chkSmoothScroll').checked);
|
2021-03-28 17:11:00 +03:00
|
|
|
|
|
|
|
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 () {
|
2024-03-25 01:16:33 +03:00
|
|
|
view.querySelector('.smoothScrollContainer').classList.toggle('hide', !layoutManager.tv);
|
|
|
|
|
2021-03-28 17:11:00 +03:00
|
|
|
view.querySelector('.chkEnableGamepad').checked = appSettings.enableGamepad();
|
2024-03-25 01:16:33 +03:00
|
|
|
view.querySelector('.chkSmoothScroll').checked = appSettings.enableSmoothScroll();
|
|
|
|
|
2021-03-28 17:11:00 +03:00
|
|
|
view.querySelector('form').addEventListener('submit', submit);
|
|
|
|
view.querySelector('.btnSave').classList.remove('hide');
|
|
|
|
|
2023-03-29 00:38:22 -04:00
|
|
|
import('../../../components/autoFocuser').then(({ default: autoFocuser }) => {
|
2021-03-28 17:11:00 +03:00
|
|
|
autoFocuser.autoFocus(view);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|