From b69507f771d09ac07f679c8eabf420e7558f9b7c Mon Sep 17 00:00:00 2001 From: real-zephex Date: Sat, 11 May 2024 09:15:12 +0530 Subject: some minor fixes --- src/app/anime/components/episode_buttons.jsx | 72 ++++++++++++++++++++++++---- src/app/anime/components/search.jsx | 6 +++ 2 files changed, 69 insertions(+), 9 deletions(-) (limited to 'src/app/anime/components') diff --git a/src/app/anime/components/episode_buttons.jsx b/src/app/anime/components/episode_buttons.jsx index 30a8086..013dee1 100644 --- a/src/app/anime/components/episode_buttons.jsx +++ b/src/app/anime/components/episode_buttons.jsx @@ -11,6 +11,7 @@ import { import styles from "../styles/buttons.module.css"; import { video_url } from "../data-fetch/request"; import { preFetchVideoLinks } from "./cacher"; +import { storeLocal } from "./storeHistory"; const EpisodesButtons = ({ data: data }) => { const [videoLink, setVideoLink] = useState(null); @@ -23,6 +24,11 @@ const EpisodesButtons = ({ data: data }) => { const groups = createGroups(data.episodes, 50); + /** + * Retrieves the video URL for a given episode ID. + * This function handles the initializing, changing URL, and hiding the video player. + * @param {string} epID - The episode ID. + */ async function getVideoURL(epID) { setVideoLoading(true); const data = await video_url(epID); @@ -30,9 +36,14 @@ const EpisodesButtons = ({ data: data }) => { setVideoLoading(false); } + /** + * Creates button groups for a range of episodes. + * @param {number} start - The starting index of episodes. + * @param {number} end - The ending index of episodes. + * @returns {JSX.Element} - Button groups JSX element. + */ function createButtonGroups(start, end) { try { - // Reset background color of all buttons with the class "episode-button" const buttons = document.getElementsByClassName("episode-button"); for (let i = 0; i < buttons.length; i++) { buttons[i].style.backgroundColor = "#1f1f1fd2"; @@ -49,18 +60,18 @@ const EpisodesButtons = ({ data: data }) => { {data.episodes && data.episodes.slice(start, end).map((item, index) => ( + {searchResults} -- cgit v1.2.3