mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #6266 from viown/make-ask-to-skip-default
Make ask to skip the default for 'Intro' and 'Outro' segments
This commit is contained in:
commit
7ccc494a5b
2 changed files with 9 additions and 3 deletions
|
@ -5,10 +5,16 @@ import { UserSettings } from 'scripts/settings/userSettings';
|
|||
import { MediaSegmentAction } from '../constants/mediaSegmentAction';
|
||||
|
||||
const PREFIX = 'segmentTypeAction';
|
||||
const DEFAULT_ACTIONS: Partial<Record<MediaSegmentType, MediaSegmentAction>> = {
|
||||
[MediaSegmentType.Intro]: MediaSegmentAction.AskToSkip,
|
||||
[MediaSegmentType.Outro]: MediaSegmentAction.AskToSkip
|
||||
};
|
||||
|
||||
export const getId = (type: MediaSegmentType) => `${PREFIX}__${type}`;
|
||||
|
||||
export function getMediaSegmentAction(userSettings: UserSettings, type: MediaSegmentType): MediaSegmentAction | undefined {
|
||||
export function getMediaSegmentAction(userSettings: UserSettings, type: MediaSegmentType): MediaSegmentAction {
|
||||
const action = userSettings.get(getId(type), false);
|
||||
return action ? action as MediaSegmentAction : undefined;
|
||||
const defaultAction = DEFAULT_ACTIONS[type] || MediaSegmentAction.None;
|
||||
|
||||
return action ? action as MediaSegmentAction : defaultAction;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ function populateMediaSegments(container, userSettings) {
|
|||
].map(segmentType => {
|
||||
const segmentTypeLabel = globalize.translate('LabelMediaSegmentsType', globalize.translate(`MediaSegmentType.${segmentType}`));
|
||||
const id = getId(segmentType);
|
||||
selectedValues[id] = getMediaSegmentAction(userSettings, segmentType) || MediaSegmentAction.None;
|
||||
selectedValues[id] = getMediaSegmentAction(userSettings, segmentType);
|
||||
return `<div class="selectContainer">
|
||||
<select is="emby-select" id="${id}" class="segmentTypeAction" label="${segmentTypeLabel}">
|
||||
${actionOptions}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue