style: format static/player/episodes/nav.ts
This commit is contained in:
@@ -1,22 +1,25 @@
|
|||||||
import { state, showEndState, hideEndState } from "../state";
|
|
||||||
import type { SkipSegment } from "../types";
|
import type { SkipSegment } from "../types";
|
||||||
import { resolveActiveSegments, renderSegments } from "../skip/segments";
|
|
||||||
import { updateSubtitleOptions } from "../subtitles";
|
|
||||||
import { updateQualityOptions } from "../quality";
|
|
||||||
import { hydrateAlternateMode, updateModeButtons } from "../mode";
|
import { hydrateAlternateMode, updateModeButtons } from "../mode";
|
||||||
import { updateOverlay, isAutoplayEnabled, switchEpisodeRange } from "./ui";
|
|
||||||
import { markEpisodeTransition } from "../progress";
|
import { markEpisodeTransition } from "../progress";
|
||||||
|
import { updateQualityOptions } from "../quality";
|
||||||
|
import { resolveActiveSegments, renderSegments } from "../skip/segments";
|
||||||
|
import { state, showEndState, hideEndState } from "../state";
|
||||||
import { safeLocalStorage } from "../storage";
|
import { safeLocalStorage } from "../storage";
|
||||||
import { completeAnime } from "./complete";
|
import { updateSubtitleOptions } from "../subtitles";
|
||||||
import { loadVideoSource } from "../video";
|
import { loadVideoSource } from "../video";
|
||||||
|
import { completeAnime } from "./complete";
|
||||||
|
import { updateOverlay, isAutoplayEnabled, switchEpisodeRange } from "./ui";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles video end: either marks complete or loads next episode.
|
* Handles video end: either marks complete or loads next episode. Fetches episode data from API,
|
||||||
* Fetches episode data from API, updates player state and URL.
|
* updates player state and URL.
|
||||||
*/
|
*/
|
||||||
export const goToNextEpisode = async (): Promise<void> => {
|
export const goToNextEpisode = async (): Promise<void> => {
|
||||||
const currentEp = Number.parseInt(state.episode.current, 10);
|
const currentEp = Number.parseInt(state.episode.current, 10);
|
||||||
if (!currentEp) return;
|
if (!currentEp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const navigateToEpisode = (episode: number): void => {
|
const navigateToEpisode = (episode: number): void => {
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
@@ -124,9 +127,9 @@ export const goToNextEpisode = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// highlight new episode in list/grid
|
// highlight new episode in list/grid
|
||||||
state.elements.episodeList
|
state.elements.episodeList?.querySelectorAll("[data-episode-id]").forEach((el) => {
|
||||||
?.querySelectorAll("[data-episode-id]")
|
el.classList.remove("bg-accent/20");
|
||||||
.forEach((el) => el.classList.remove("bg-accent/20"));
|
});
|
||||||
const newListEl = state.elements.episodeList?.querySelector(`[data-episode-id="${nextEp}"]`);
|
const newListEl = state.elements.episodeList?.querySelector(`[data-episode-id="${nextEp}"]`);
|
||||||
newListEl?.classList.add("bg-accent/20");
|
newListEl?.classList.add("bg-accent/20");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user