mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add option to enable smooth scroll
This commit is contained in:
parent
ba0e227b17
commit
639f99f82a
5 changed files with 30 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import dom from '../scripts/dom';
|
||||
import browser from '../scripts/browser';
|
||||
import appSettings from 'scripts/settings/appSettings';
|
||||
import layoutManager from './layoutManager';
|
||||
|
||||
/**
|
||||
|
@ -477,7 +477,7 @@ function doScroll(xScroller, scrollX, yScroller, scrollY, smooth) {
|
|||
* Returns true if smooth scroll must be used.
|
||||
*/
|
||||
function useSmoothScroll() {
|
||||
return !!browser.tizen;
|
||||
return appSettings.enableSmoothScroll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
<div class="fieldDescription checkboxFieldDescription">${EnableGamepadHelp}</div>
|
||||
<div class="fieldDescription checkboxFieldDescription">${LabelPleaseRestart}</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription smoothScrollContainer hide">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" class="chkSmoothScroll" />
|
||||
<span>${EnableSmoothScroll}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import layoutManager from 'components/layoutManager';
|
||||
import toast from '../../../components/toast/toast';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
import appSettings from '../../../scripts/settings/appSettings';
|
||||
|
@ -6,6 +7,7 @@ import Events from '../../../utils/events.ts';
|
|||
export default function (view) {
|
||||
function submit(e) {
|
||||
appSettings.enableGamepad(view.querySelector('.chkEnableGamepad').checked);
|
||||
appSettings.enableSmoothScroll(view.querySelector('.chkSmoothScroll').checked);
|
||||
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
|
||||
|
@ -17,7 +19,11 @@ export default function (view) {
|
|||
}
|
||||
|
||||
view.addEventListener('viewshow', function () {
|
||||
view.querySelector('.smoothScrollContainer').classList.toggle('hide', !layoutManager.tv);
|
||||
|
||||
view.querySelector('.chkEnableGamepad').checked = appSettings.enableGamepad();
|
||||
view.querySelector('.chkSmoothScroll').checked = appSettings.enableSmoothScroll();
|
||||
|
||||
view.querySelector('form').addEventListener('submit', submit);
|
||||
view.querySelector('.btnSave').classList.remove('hide');
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import browser from 'scripts/browser';
|
||||
import Events from '../../utils/events.ts';
|
||||
import { toBoolean } from '../../utils/string.ts';
|
||||
|
||||
|
@ -31,6 +32,19 @@ class AppSettings {
|
|||
return toBoolean(this.get('enableGamepad'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Enable smooth scroll' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Enable smooth scroll' or undefined.
|
||||
* @return {boolean} 'Enable smooth scroll' state.
|
||||
*/
|
||||
enableSmoothScroll(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableSmoothScroll', val.toString());
|
||||
}
|
||||
|
||||
return toBoolean(this.get('enableSmoothScroll'), !!browser.tizen);
|
||||
}
|
||||
|
||||
enableSystemExternalPlayers(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('enableSystemExternalPlayers', val.toString());
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"EnableRewatchingNextUp": "Enable Rewatching in Next Up",
|
||||
"EnableRewatchingNextUpHelp": "Enable showing already watched episodes in 'Next Up' sections.",
|
||||
"EnableQuickConnect": "Enable Quick Connect on this server",
|
||||
"EnableSmoothScroll": "Enable smooth scroll",
|
||||
"EnableStreamLooping": "Auto-loop live streams",
|
||||
"EnableStreamLoopingHelp": "Enable this if live streams only contain a few seconds of data and need to be continuously requested. Enabling this when not needed may cause problems.",
|
||||
"EnableThemeSongsHelp": "Play the theme songs in background while browsing the library.",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue