mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix sonar critical issue with switch fallthrough
This commit is contained in:
parent
ccdbf0bfc3
commit
dfca85dea4
1 changed files with 23 additions and 24 deletions
|
@ -144,10 +144,13 @@ class SubtitleSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle(action) {
|
toggle(action) {
|
||||||
|
if (action && !['hide', 'forceToHide'].includes(action)) {
|
||||||
|
console.warn('SubtitleSync.toggle called with invalid action', action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (player && playbackManager.supportSubtitleOffset(player)) {
|
if (player && playbackManager.supportSubtitleOffset(player)) {
|
||||||
/* eslint-disable no-fallthrough */
|
if (!action) {
|
||||||
switch (action) {
|
|
||||||
case undefined:
|
|
||||||
// if showing subtitle sync is enabled and if there is an external subtitle stream enabled
|
// if showing subtitle sync is enabled and if there is an external subtitle stream enabled
|
||||||
if (playbackManager.isShowingSubtitleOffsetEnabled(player) && playbackManager.canHandleOffsetOnCurrentSubtitle(player)) {
|
if (playbackManager.isShowingSubtitleOffsetEnabled(player) && playbackManager.canHandleOffsetOnCurrentSubtitle(player)) {
|
||||||
// if no subtitle offset is defined or element has focus (offset being defined)
|
// if no subtitle offset is defined or element has focus (offset being defined)
|
||||||
|
@ -159,18 +162,14 @@ class SubtitleSync {
|
||||||
}
|
}
|
||||||
// show subtitle sync
|
// show subtitle sync
|
||||||
subtitleSyncContainer.classList.remove('hide');
|
subtitleSyncContainer.classList.remove('hide');
|
||||||
break; // stop here
|
return;
|
||||||
} // else continue and hide
|
|
||||||
case 'hide':
|
|
||||||
// only break if element has focus
|
|
||||||
if (subtitleSyncTextField.hasFocus) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'forceToHide':
|
} else if (action === 'hide' && subtitleSyncTextField.hasFocus) {
|
||||||
|
// do not hide if element has focus
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
subtitleSyncContainer.classList.add('hide');
|
subtitleSyncContainer.classList.add('hide');
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* eslint-enable no-fallthrough */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue