mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Update Enum
This commit is contained in:
parent
a75338e3d2
commit
7b765b7785
2 changed files with 10 additions and 10 deletions
|
@ -14,14 +14,14 @@ import LibraryMenu from '../scripts/libraryMenu';
|
||||||
import Events from '../utils/events.ts';
|
import Events from '../utils/events.ts';
|
||||||
|
|
||||||
import '../styles/lyrics.scss';
|
import '../styles/lyrics.scss';
|
||||||
import { AutoScrollType } from './lyrics.types';
|
import { AutoScroll } from './lyrics.types';
|
||||||
|
|
||||||
let currentPlayer;
|
let currentPlayer;
|
||||||
let currentItem;
|
let currentItem;
|
||||||
|
|
||||||
let savedLyrics;
|
let savedLyrics;
|
||||||
let isDynamicLyric = false;
|
let isDynamicLyric = false;
|
||||||
let autoScroll = AutoScrollType.Instant;
|
let autoScroll = AutoScroll.Instant;
|
||||||
|
|
||||||
function dynamicLyricHtmlReducer(htmlAccumulator, lyric, index) {
|
function dynamicLyricHtmlReducer(htmlAccumulator, lyric, index) {
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
@ -74,11 +74,11 @@ export default function (view) {
|
||||||
if (lyric) {
|
if (lyric) {
|
||||||
lyric.classList.remove('pastLyric');
|
lyric.classList.remove('pastLyric');
|
||||||
lyric.classList.remove('futureLyric');
|
lyric.classList.remove('futureLyric');
|
||||||
if (autoScroll !== AutoScrollType.NoScroll) {
|
if (autoScroll !== AutoScroll.NoScroll) {
|
||||||
// instant scroll is used when the view is first loaded
|
// instant scroll is used when the view is first loaded
|
||||||
scrollManager.scrollToElement(lyric, autoScroll === AutoScrollType.Smooth);
|
scrollManager.scrollToElement(lyric, autoScroll === AutoScroll.Smooth);
|
||||||
focusManager.focus(lyric);
|
focusManager.focus(lyric);
|
||||||
autoScroll = AutoScrollType.Smooth;
|
autoScroll = AutoScroll.Smooth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ export default function (view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLyricClick(lyricTime) {
|
function onLyricClick(lyricTime) {
|
||||||
autoScroll = AutoScrollType.Smooth;
|
autoScroll = AutoScroll.Smooth;
|
||||||
playbackManager.seek(lyricTime);
|
playbackManager.seek(lyricTime);
|
||||||
if (playbackManager.paused()) {
|
if (playbackManager.paused()) {
|
||||||
playbackManager.playPause(currentPlayer);
|
playbackManager.playPause(currentPlayer);
|
||||||
|
@ -247,19 +247,19 @@ export default function (view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWheelOrTouchMove() {
|
function onWheelOrTouchMove() {
|
||||||
autoScroll = AutoScrollType.NoScroll;
|
autoScroll = AutoScroll.NoScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(e) {
|
function onKeyDown(e) {
|
||||||
const key = keyboardNavigation.getKeyName(e);
|
const key = keyboardNavigation.getKeyName(e);
|
||||||
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
||||||
autoScroll = AutoScrollType.NoScroll;
|
autoScroll = AutoScroll.NoScroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
Events.on(playbackManager, 'playerchange', onPlayerChange);
|
Events.on(playbackManager, 'playerchange', onPlayerChange);
|
||||||
autoScroll = AutoScrollType.Instant;
|
autoScroll = AutoScroll.Instant;
|
||||||
document.addEventListener('wheel', onWheelOrTouchMove);
|
document.addEventListener('wheel', onWheelOrTouchMove);
|
||||||
document.addEventListener('touchmove', onWheelOrTouchMove);
|
document.addEventListener('touchmove', onWheelOrTouchMove);
|
||||||
document.addEventListener('keydown', onKeyDown);
|
document.addEventListener('keydown', onKeyDown);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum AutoScrollType {
|
export enum AutoScroll {
|
||||||
NoScroll = 0,
|
NoScroll = 0,
|
||||||
Smooth = 1,
|
Smooth = 1,
|
||||||
Instant = 2
|
Instant = 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue