mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add gamepad enabling/disabling
This commit is contained in:
parent
c7b05ba130
commit
7974fbcbaa
8 changed files with 90 additions and 2 deletions
24
src/controllers/user/controls/index.html
Normal file
24
src/controllers/user/controls/index.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div id="controlsPreferencesPage" data-role="page" class="page libraryPage userPreferencesPage noSecondaryNavPage" data-title="${Controls}" data-menubutton="true">
|
||||
<div class="padded-left padded-right padded-bottom-page">
|
||||
<form style="margin: 0 auto;">
|
||||
<div class="verticalSection verticalSection-extrabottompadding">
|
||||
<h2 class="sectionTitle">
|
||||
${Controls}
|
||||
</h2>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" class="chkEnableGamepad" />
|
||||
<span>${LabelEnableGamepad}</span>
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">${EnableGamepadHelp}</div>
|
||||
<div class="fieldDescription checkboxFieldDescription">${LabelPleaseRestart}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
||||
<span>${Save}</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
28
src/controllers/user/controls/index.js
Normal file
28
src/controllers/user/controls/index.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Events } from 'jellyfin-apiclient';
|
||||
import toast from '../../../components/toast/toast';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
import appSettings from '../../../scripts/settings/appSettings';
|
||||
|
||||
export default function (view, params) {
|
||||
function submit(e) {
|
||||
appSettings.enableGamepad(view.querySelector('.chkEnableGamepad').checked);
|
||||
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
|
||||
Events.trigger(view, 'saved');
|
||||
|
||||
if (e) e.preventDefault();
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue