From 5207bdd5e15391d00c1733c9fb9948fbdda5b417 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:21:57 +0530 Subject: [PATCH 1/8] fixed light button not showing in light mode --- pages/play/movies.js | 6 +++--- pages/play/tv.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/play/movies.js b/pages/play/movies.js index ce978a7..095137e 100644 --- a/pages/play/movies.js +++ b/pages/play/movies.js @@ -55,7 +55,7 @@ const Movies = () => { }, [id, tmdb]); useEffect(() => { document.addEventListener("mousedown", (event) => { - if (event.target !== "iframe") { + if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { switchLight(false) } }) @@ -65,7 +65,7 @@ const Movies = () => { Play Movies | Yaps
+ className={` top-0 left-0 z-[997] bg-black transition duration-300 ease-in-out ${lightStatus ? 'opacity-0.5 fixed w-full h-screen ' : 'opacity-0 h-0 w-0'}`}>
{data ? data.imdb.imdb.name : ""} @@ -77,7 +77,7 @@ const Movies = () => { className={`z-[998] ${lightStatus ? 'absolute left-0 lg:left-[20%] h-[80vh] lg:w-2/3 w-full ' : 'w-full h-[95vh]'}`} allowFullScreen="allowfullscreen">
+ className={`${lightStatus ? 'w-1/2 absolute text-white dark:text-black ' : 'w-full '} p-4 pl-0 bg-transparent gap-10 z-[999] flex flex-row justify-start top-[100%] lg:top-[90%] items-center `}>
switchLight(!lightStatus)} className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> diff --git a/pages/play/tv.js b/pages/play/tv.js index 46edca6..193088b 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -166,7 +166,7 @@ const Tv = () => { //adding event listener for window to catch left click to remove light setting useEffect(() => { document.addEventListener("mousedown", (event) => { - if (event.target !== "iframe") { + if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { switchLight(false) } }) @@ -245,7 +245,7 @@ const Tv = () => {
-
+
switchLight(!lightStatus)} className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> From fd24218c31ce0c5dd16615b316d8cac521149759 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:59:54 +0530 Subject: [PATCH 2/8] fix for dropdown --- pages/play/tv.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/play/tv.js b/pages/play/tv.js index 193088b..3025889 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -168,6 +168,8 @@ const Tv = () => { document.addEventListener("mousedown", (event) => { if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { switchLight(false) + setEpisodeDropDown(false) + setSeasonDropDown(false) } }) }, []) From 15b35aea7e426aeb009d7dfc2962c0c4aeb7604b Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Fri, 13 Oct 2023 23:18:02 +0530 Subject: [PATCH 3/8] added new season and episode switching --- pages/play/tv.js | 336 +++++++++++++++++++++++++---------------------- 1 file changed, 180 insertions(+), 156 deletions(-) diff --git a/pages/play/tv.js b/pages/play/tv.js index 3025889..2479e9e 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -6,6 +6,7 @@ import useSWR from "swr"; import {BsFillLightbulbFill} from "react-icons/bs"; import {BiSolidSkipNextCircle, BiSolidSkipPreviousCircle} from "react-icons/bi"; import {useTheme} from "next-themes"; +import {TMDB_IMAGE_ENDPOINT} from "../../utils"; const servers_ = [{ servername: "Vidsrc.to", link: "https://vidsrc.to/embed/tv/" @@ -30,6 +31,7 @@ const Tv = () => { const [episodes, setEpisodes] = useState({}) const [seasonDropDown, setSeasonDropDown] = useState(false) const [episodeDropDown, setEpisodeDropDown] = useState(false) + const [images, setimages] = useState("") const [videoServer, setVideoServer] = useState(`vidsrc.to`) const [lightStatus, switchLight] = useState(false) const [nextBtn, showNextBtn] = useState(true); @@ -163,16 +165,20 @@ const Tv = () => { else if (videoServer.includes("blackvid.space")) setVideoServer(`https://blackvid.space/embed?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`); } }, [tvDetails]); + console.log(data?.detail?.seasons[0].poster_path); + //adding event listener for window to catch left click to remove light setting useEffect(() => { - document.addEventListener("mousedown", (event) => { - if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { - switchLight(false) - setEpisodeDropDown(false) - setSeasonDropDown(false) - } - }) - }, []) + setimages(data !== undefined ? data.detail.seasons[0].poster_path : "") + document.addEventListener("mousedown", (event) => { + if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { + switchLight(false) + setEpisodeDropDown(false) + setSeasonDropDown(false) + } + }) + }, [] + ) return ( <> @@ -181,179 +187,197 @@ const Tv = () => {
-
+
{data?.detail.name} S{tvDetails.season} E{tvDetails.episode}
- -
-
-
-
- { - setnextprevbtnclicked(true) + className={` w-full flex flex-col ${lightStatus ? '' : 'h-full'} z-[999] h-full`}> + {/**/} +
{data?.detail.name} S{tvDetails.season} E{tvDetails.episode}
+ +
+
+
+
+ { + setnextprevbtnclicked(true) + let current_Episode = tvDetails.episode; + let current_Season = tvDetails.season; + if (episodes[current_Season]) { + if (episodes[current_Season].indexOf(current_Episode) === 0) { + if (season.indexOf(tvDetails.season) !== 0) { + setTvDetails({ + season: current_Season - 1, + episode: episodes[current_Season - 1][episodes[current_Season].length - 1] + }) + } + } else { + setTvDetails((prev) => { + return {...prev, episode: current_Episode - 1}; + }) + } + } + }} + className={`${prevBtn ? 'block' : 'hidden'} hover:scale-125 transition control-button duration-300 ease-in-out`}/> + +
+
{ let current_Episode = tvDetails.episode; let current_Season = tvDetails.season; - if (episodes[current_Season]) { - if (episodes[current_Season].indexOf(current_Episode) === 0) { - if (season.indexOf(tvDetails.season) !== 0) { - setTvDetails({ - season: current_Season - 1, - episode: episodes[current_Season - 1][episodes[current_Season].length - 1] - }) + setnextprevbtnclicked(true) + if (episodes[tvDetails.season]) { + if (episodes[tvDetails.season].indexOf(current_Episode) === episodes[tvDetails.season].length - 1) { + if (season.indexOf(tvDetails.season) !== season.length - 1) { + setTvDetails({season: current_Season + 1, episode: 1}) } } else { setTvDetails((prev) => { - return {...prev, episode: current_Episode - 1}; + return {...prev, episode: current_Episode + 1}; }) } } - }} - className={`${prevBtn ? 'block' : 'hidden'} hover:scale-125 transition control-button duration-300 ease-in-out`}/> - -
-
{ - let current_Episode = tvDetails.episode; - let current_Season = tvDetails.season; - setnextprevbtnclicked(true) - if (episodes[tvDetails.season]) { - if (episodes[tvDetails.season].indexOf(current_Episode) === episodes[tvDetails.season].length - 1) { - if (season.indexOf(tvDetails.season) !== season.length - 1) { - setTvDetails({season: current_Season + 1, episode: 1}) - } - } else { - setTvDetails((prev) => { - return {...prev, episode: current_Episode + 1}; - }) - } } - } - }> - + }> + + +
+ + +
+
+
+
switchLight(!lightStatus)} + className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> + + Light +
+
+
+
    + {season !== [] ? season.map((season, index) => { + return ( +
  • { + setTvDetails({season: season, episode: 1}) + setSeasonDropDown(false) + }} + className={`relative dropdown-scroll bg-app-semi-dark-blue hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.season === season ? 'bg-amber-700' : ''}`}> + Season {season} +
  • + ) + }) : (
  • No Seasons
  • ) + } +
+
+ +
+
+
{ + setEpisodeDropDown(!episodeDropDown) + setSeasonDropDown(false) + }}> + Episode {tvDetails.episode}{episodeDropDown ? + : + } +
+
+
    + {episodes[tvDetails.season] ? episodes[tvDetails.season].map((episode, index) => { + return ( +
  • { + setTvDetails(prev => { + return {...prev, episode: episode} + }) + setEpisodeDropDown(false) + }} + className={`relative dropdown-scroll hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.episode === episode ? 'bg-amber-700' : ''}`}> + Episode {episode} +
  • + ) + }) : (
  • No Episode
  • ) + } +
- -
-
-
switchLight(!lightStatus)} - className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> - - Light -
-
-
{ - setSeasonDropDown(!seasonDropDown) - setEpisodeDropDown(false) - }}> - Season {tvDetails.season}{seasonDropDown ? - : - } -
-
-
    - {season !== [] ? season.map((season, index) => { - return ( -
  • { - setTvDetails({season: season, episode: 1}) - setSeasonDropDown(false) - }} - className={`relative dropdown-scroll bg-app-semi-dark-blue hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.season === season ? 'bg-amber-700' : ''}`}> - Season {season} -
  • - ) - }) : (
  • No Seasons
  • ) - } -
-
-
-
+
+
{ - setEpisodeDropDown(!episodeDropDown) - setSeasonDropDown(false) - }}> - Episode {tvDetails.episode}{episodeDropDown ? - : - } + className={`dark:text-white text-black p-2 h-full text-center w-1/3`}> + {`You are watching `} +
{data ? data.detail.name : ""}
+
If current server doesn't work please try other servers beside.
-
    - {episodes[tvDetails.season] ? episodes[tvDetails.season].map((episode, index) => { + className={` w-2/3 h-full`}> +
    + {servers_.map((server, index) => { return ( -
  • { - setTvDetails(prev => { - return {...prev, episode: episode} - }) - setEpisodeDropDown(false) - }} - className={`relative dropdown-scroll hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.episode === episode ? 'bg-amber-700' : ''}`}> - Episode {episode} -
  • +
    { + if (server.servername === "Vidsrc.me") + setVideoServer(`${server.link}${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`) + else if (server.servername === "Vidsrc.to") + setVideoServer(`${server.link}${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`) + else if (server.servername === "Moviesapi.club") + setVideoServer(`${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}`) + else + setVideoServer(`${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`); + } + } + className={` ${videoServer.includes(server.servername.toLowerCase()) ? 'bg-amber-700' : ''} dark:text-white hover:scale-110 hover:cursor-pointer transition duration-300 ease-in-out rounded p-3 w-max text-center h-8 `} + key={index}> + {server.servername} +
    ) - }) : (
  • No Episode
  • ) - } -
+ })} +
- -
-
-
- {`You are watching `} -
{data ? data.detail.name : ""}
-
If current server doesn't work please try other servers beside.
-
-
-
- {servers_.map((server, index) => { - return ( -
{ - if (server.servername === "Vidsrc.me") - setVideoServer(`${server.link}${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`) - else if (server.servername === "Vidsrc.to") - setVideoServer(`${server.link}${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`) - else if (server.servername === "Moviesapi.club") - setVideoServer(`${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}`) - else - setVideoServer(`${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`); - } - } - className={` ${videoServer.includes(server.servername.toLowerCase()) ? 'bg-amber-700' : ''} dark:text-white hover:scale-110 hover:cursor-pointer transition duration-300 ease-in-out rounded p-3 w-max text-center h-8 `} - key={index}> - {server.servername} -
- ) - })} -
-
+
+
+ { + season.map((season, index) => { + return ( +
+ +
+ ) + }) + }
From 7216ee30b86665a34fbe3e3bb68ef36697eaca19 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Fri, 13 Oct 2023 23:26:38 +0530 Subject: [PATCH 4/8] fix for dropdown --- .idea/inspectionProfiles/Project_Default.xml | 13 + .idea/prettier.xml | 7 + pages/play/tv.js | 890 +++++++++++-------- 3 files changed, 541 insertions(+), 369 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/prettier.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..939c71e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml new file mode 100644 index 0000000..0c83ac4 --- /dev/null +++ b/.idea/prettier.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/pages/play/tv.js b/pages/play/tv.js index 2479e9e..152254f 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -1,388 +1,540 @@ -import React, {useEffect, useState} from 'react' -import {useRouter} from 'next/router'; +import React, { useEffect, useState } from 'react' +import { useRouter } from 'next/router' import Head from 'next/head' -import {AiOutlineDown, AiOutlineRight} from "react-icons/ai"; -import useSWR from "swr"; -import {BsFillLightbulbFill} from "react-icons/bs"; -import {BiSolidSkipNextCircle, BiSolidSkipPreviousCircle} from "react-icons/bi"; -import {useTheme} from "next-themes"; -import {TMDB_IMAGE_ENDPOINT} from "../../utils"; +import { AiOutlineDown, AiOutlineRight } from 'react-icons/ai' +import useSWR from 'swr' +import { BsFillLightbulbFill } from 'react-icons/bs' +import { + BiSolidSkipNextCircle, + BiSolidSkipPreviousCircle, +} from 'react-icons/bi' +import { useTheme } from 'next-themes' +import { TMDB_IMAGE_ENDPOINT } from '../../utils' -const servers_ = [{ - servername: "Vidsrc.to", link: "https://vidsrc.to/embed/tv/" -}, { - servername: "Vidsrc.me", link: "https://vidsrc.me/embed/tv?", -}, { - servername: "Moviesapi.club", link: "https://moviesapi.club/tv/" -}, { - servername: "Blackvid", link: "https://blackvid.space/embed?tmdb=" -}] -const fetcher = (...args) => fetch(...args).then((res) => res.json()) +const servers_ = [ + { + servername: 'Vidsrc.to', + link: 'https://vidsrc.to/embed/tv/', + }, + { + servername: 'Vidsrc.me', + link: 'https://vidsrc.me/embed/tv?', + }, + { + servername: 'Moviesapi.club', + link: 'https://moviesapi.club/tv/', + }, + { + servername: 'Blackvid', + link: 'https://blackvid.space/embed?tmdb=', + }, +] +const fetcher = (...args) => fetch(...args).then(res => res.json()) const Tv = () => { - const router = useRouter() - const {id, tmdb} = router.query; - const {theme, setTheme} = useTheme(); - const {data} = useSWR(`/api/tv/${tmdb}`, fetcher) - const [tvDetails, setTvDetails] = useState({ - episode: 1, season: 1 - }) - const [season, SetSeason] = useState([]); - const [episodes, setEpisodes] = useState({}) - const [seasonDropDown, setSeasonDropDown] = useState(false) - const [episodeDropDown, setEpisodeDropDown] = useState(false) - const [images, setimages] = useState("") - const [videoServer, setVideoServer] = useState(`vidsrc.to`) - const [lightStatus, switchLight] = useState(false) - const [nextBtn, showNextBtn] = useState(true); - const [prevBtn, showPrevBtn] = useState(true); - const [nextprevbtnclicked, setnextprevbtnclicked] = useState(false) - useEffect(() => { - let temp = [] - if (data) - if (data.detail.seasons[0].name.includes("Specials")) - for (let i = 1; i < data.detail.seasons.length; i++) { - temp.push(i); - } - else - for (let i = 1; i <= data.detail.seasons.length; i++) { - temp.push(i); - } - SetSeason(temp) - let episode = []; - let c = 1; - if (data) { - if (data.detail.seasons[0].name.includes("Specials")) { - for (let k = 0; k < temp.length; k++) { - for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++) - episode.push(i); - episodes[c] = episode - c++; - episode = [] - } - } else { - c = 0; - for (let k = 0; k < temp.length; k++) { - for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++) - episode.push(i); - episodes[c + 1] = episode - c++; - episode = [] - } - } - + const router = useRouter() + const { id, tmdb } = router.query + const { theme, setTheme } = useTheme() + const { data } = useSWR(`/api/tv/${tmdb}`, fetcher) + const [tvDetails, setTvDetails] = useState({ + episode: 1, + season: 1, + }) + const [season, SetSeason] = useState([]) + const [episodes, setEpisodes] = useState({}) + const [seasonDropDown, setSeasonDropDown] = useState(false) + const [episodeDropDown, setEpisodeDropDown] = useState(false) + const [videoServer, setVideoServer] = useState(`vidsrc.to`) + const [lightStatus, switchLight] = useState(false) + const [nextBtn, showNextBtn] = useState(true) + const [prevBtn, showPrevBtn] = useState(true) + const [nextprevbtnclicked, setnextprevbtnclicked] = useState(false) + useEffect(() => { + let temp = [] + if (data) + if (data.detail.seasons[0].name.includes('Specials')) + for (let i = 1; i < data.detail.seasons.length; i++) { + temp.push(i) } - }, [seasonDropDown, episodeDropDown, nextprevbtnclicked]); - useEffect(() => { - console.log(theme) - if (localStorage.getItem("userWatched")) { - let data = JSON.parse(localStorage.getItem("userWatched")) - let tvPresent = -1 - if (id || tmdb) { - for (let i in data.tv) { - if (id) { - if (data.tv[i][0] === id) { - tvPresent = i - } - } else { - if (data.tv[i][0] === tmdb) { - tvPresent = i - } - } - } + else + for (let i = 1; i <= data.detail.seasons.length; i++) { + temp.push(i) + } + SetSeason(temp) + let episode = [] + let c = 1 + if (data) { + if (data.detail.seasons[0].name.includes('Specials')) { + for (let k = 0; k < temp.length; k++) { + for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++) + episode.push(i) + episodes[c] = episode + c++ + episode = [] + } + } else { + c = 0 + for (let k = 0; k < temp.length; k++) { + for (let i = 1; i < data.detail.seasons[c].episode_count + 1; i++) + episode.push(i) + episodes[c + 1] = episode + c++ + episode = [] + } + } + } + }, [seasonDropDown, episodeDropDown, nextprevbtnclicked]) + useEffect(() => { + console.log(theme) + if (localStorage.getItem('userWatched')) { + let data = JSON.parse(localStorage.getItem('userWatched')) + let tvPresent = -1 + if (id || tmdb) { + for (let i in data.tv) { + if (id) { + if (data.tv[i][0] === id) { + tvPresent = i } - if (id || tmdb) - if (tvPresent !== -1) { - setTvDetails({season: data.tv[i][1], episode: data.tv[i][2]}) - } else { - if (id || tmdb) { - if (id) - data.tv.push([id, tvDetails.season, tvDetails.episode]) - else data.tv.push([tmdb, tvDetails.season, tvDetails.episode]) - localStorage.setItem("userWatched", JSON.stringify(data)) - } - } + } else { + if (data.tv[i][0] === tmdb) { + tvPresent = i + } + } + } + } + if (id || tmdb) + if (tvPresent !== -1) { + setTvDetails({ season: data.tv[i][1], episode: data.tv[i][2] }) } else { - if (id || tmdb) - localStorage.setItem("userWatched", JSON.stringify({ - movies: [], tv: [[id ? id : tmdb, tvDetails.season, tvDetails.episode]] - })) + if (id || tmdb) { + if (id) data.tv.push([id, tvDetails.season, tvDetails.episode]) + else data.tv.push([tmdb, tvDetails.season, tvDetails.episode]) + localStorage.setItem('userWatched', JSON.stringify(data)) + } } - }, [id, tmdb]); - useEffect(() => { - if (data !== undefined) { - if (localStorage.getItem('userWatched')) { - let dataa = JSON.parse(localStorage.getItem("userWatched")) - let tvPresent = -1 - if (id || tmdb) { - for (let i in dataa.tv) { - if (id) { - if (dataa.tv[i][0] === id) { - tvPresent = i - } - } else { - if (dataa.tv[i][0] === tmdb) { - tvPresent = i - } - } - } - } - if (id || tmdb) - if (tvPresent !== -1) { - if (id) dataa.tv[tvPresent] = [id, tvDetails.season, tvDetails.episode] - else dataa.tv[tvPresent] = [tmdb, tvDetails.season, tvDetails.episode] - localStorage.setItem("userWatched", JSON.stringify(dataa)) - } else { - if (id || tmdb) { - if (id) - dataa.tv.push([id, tvDetails.season, tvDetails.episode]) - else dataa.tv.push([tmdb, tvDetails.season, tvDetails.episode]) - localStorage.setItem("userWatched", JSON.stringify(dataa)) - } - } - } - if (tvDetails.season === 1 && tvDetails.episode === 1) { - showPrevBtn(false) + } else { + if (id || tmdb) + localStorage.setItem( + 'userWatched', + JSON.stringify({ + movies: [], + tv: [[id ? id : tmdb, tvDetails.season, tvDetails.episode]], + }) + ) + } + }, [id, tmdb]) + useEffect(() => { + if (data !== undefined) { + if (localStorage.getItem('userWatched')) { + let dataa = JSON.parse(localStorage.getItem('userWatched')) + let tvPresent = -1 + if (id || tmdb) { + for (let i in dataa.tv) { + if (id) { + if (dataa.tv[i][0] === id) { + tvPresent = i + } } else { - showPrevBtn(true) + if (dataa.tv[i][0] === tmdb) { + tvPresent = i + } } - if (tvDetails.season === season[season.length - 1] && tvDetails.episode === episodes[tvDetails.season][episodes[tvDetails.season].length - 1]) { - showNextBtn(false) - } else { - showNextBtn(true) - } - let inputstrings = `${data?.detail.name}season` - let inputStringe = `${data?.detail.name}episode` - if (localStorage.getItem(inputstrings.replace(/\s+/g, "").toLowerCase())) { - localStorage.setItem(inputstrings.replace(/\s+/g, "").toLowerCase(), tvDetails.season) - } - if (localStorage.getItem(inputStringe.replace(/\s+/g, "").toLowerCase())) { - localStorage.setItem(inputStringe.replace(/\s+/g, "").toLowerCase(), tvDetails.episode) - } - if (videoServer.includes("vidsrc.me")) setVideoServer(`https://vidsrc.me/embed/tv?${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`) - if (videoServer.includes("vidsrc.to")) setVideoServer(`https://vidsrc.to/embed/tv/${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`) - else if (videoServer.includes("moviesapi.club")) setVideoServer(`https://moviesapi.club/tv/${tmdb}-${tvDetails.season}-${tvDetails.episode}`) - else if (videoServer.includes("blackvid.space")) setVideoServer(`https://blackvid.space/embed?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`); + } } - }, [tvDetails]); - console.log(data?.detail?.seasons[0].poster_path); + if (id || tmdb) + if (tvPresent !== -1) { + if (id) + dataa.tv[tvPresent] = [id, tvDetails.season, tvDetails.episode] + else + dataa.tv[tvPresent] = [tmdb, tvDetails.season, tvDetails.episode] + localStorage.setItem('userWatched', JSON.stringify(dataa)) + } else { + if (id || tmdb) { + if (id) dataa.tv.push([id, tvDetails.season, tvDetails.episode]) + else dataa.tv.push([tmdb, tvDetails.season, tvDetails.episode]) + localStorage.setItem('userWatched', JSON.stringify(dataa)) + } + } + } + if (tvDetails.season === 1 && tvDetails.episode === 1) { + showPrevBtn(false) + } else { + showPrevBtn(true) + } + if ( + tvDetails.season === season[season.length - 1] && + tvDetails.episode === + episodes[tvDetails.season][episodes[tvDetails.season].length - 1] + ) { + showNextBtn(false) + } else { + showNextBtn(true) + } + let inputstrings = `${data?.detail.name}season` + let inputStringe = `${data?.detail.name}episode` + if ( + localStorage.getItem(inputstrings.replace(/\s+/g, '').toLowerCase()) + ) { + localStorage.setItem( + inputstrings.replace(/\s+/g, '').toLowerCase(), + tvDetails.season + ) + } + if ( + localStorage.getItem(inputStringe.replace(/\s+/g, '').toLowerCase()) + ) { + localStorage.setItem( + inputStringe.replace(/\s+/g, '').toLowerCase(), + tvDetails.episode + ) + } + if (videoServer.includes('vidsrc.me')) + setVideoServer( + `https://vidsrc.me/embed/tv?${ + tmdb ? `tmdb=${tmdb}` : `imdb=${id}` + }&season=${tvDetails.season}&episode=${tvDetails.episode}` + ) + if (videoServer.includes('vidsrc.to')) + setVideoServer( + `https://vidsrc.to/embed/tv/${tmdb ? `${tmdb}` : `${id}`}/${ + tvDetails.season + }/${tvDetails.episode}` + ) + else if (videoServer.includes('moviesapi.club')) + setVideoServer( + `https://moviesapi.club/tv/${tmdb}-${tvDetails.season}-${tvDetails.episode}` + ) + else if (videoServer.includes('blackvid.space')) + setVideoServer( + `https://blackvid.space/embed?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}` + ) + } + }, [tvDetails]) + console.log(data?.detail?.seasons[0].poster_path) - //adding event listener for window to catch left click to remove light setting - useEffect(() => { - setimages(data !== undefined ? data.detail.seasons[0].poster_path : "") - document.addEventListener("mousedown", (event) => { - if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { - switchLight(false) - setEpisodeDropDown(false) - setSeasonDropDown(false) - } - }) - }, [] - ) - return ( - <> - - Play Tv | Yaps - -
-
-
-
- {/**/} -
{data?.detail.name} S{tvDetails.season} E{tvDetails.episode}
- -
-
-
-
- { - setnextprevbtnclicked(true) - let current_Episode = tvDetails.episode; - let current_Season = tvDetails.season; - if (episodes[current_Season]) { - if (episodes[current_Season].indexOf(current_Episode) === 0) { - if (season.indexOf(tvDetails.season) !== 0) { - setTvDetails({ - season: current_Season - 1, - episode: episodes[current_Season - 1][episodes[current_Season].length - 1] - }) - } - } else { - setTvDetails((prev) => { - return {...prev, episode: current_Episode - 1}; - }) - } - } - }} - className={`${prevBtn ? 'block' : 'hidden'} hover:scale-125 transition control-button duration-300 ease-in-out`}/> - -
-
{ - let current_Episode = tvDetails.episode; - let current_Season = tvDetails.season; - setnextprevbtnclicked(true) - if (episodes[tvDetails.season]) { - if (episodes[tvDetails.season].indexOf(current_Episode) === episodes[tvDetails.season].length - 1) { - if (season.indexOf(tvDetails.season) !== season.length - 1) { - setTvDetails({season: current_Season + 1, episode: 1}) - } - } else { - setTvDetails((prev) => { - return {...prev, episode: current_Episode + 1}; - }) - } - } - } - }> - - -
- - -
-
-
-
switchLight(!lightStatus)} - className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> - - Light -
-
-
{ - setSeasonDropDown(!seasonDropDown) - setEpisodeDropDown(false) - }}> - Season {tvDetails.season}{seasonDropDown ? - : - } -
-
-
    - {season !== [] ? season.map((season, index) => { - return ( -
  • { - setTvDetails({season: season, episode: 1}) - setSeasonDropDown(false) - }} - className={`relative dropdown-scroll bg-app-semi-dark-blue hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.season === season ? 'bg-amber-700' : ''}`}> - Season {season} -
  • - ) - }) : (
  • No Seasons
  • ) - } -
-
- -
-
-
{ - setEpisodeDropDown(!episodeDropDown) - setSeasonDropDown(false) - }}> - Episode {tvDetails.episode}{episodeDropDown ? - : - } -
-
-
    - {episodes[tvDetails.season] ? episodes[tvDetails.season].map((episode, index) => { - return ( -
  • { - setTvDetails(prev => { - return {...prev, episode: episode} - }) - setEpisodeDropDown(false) - }} - className={`relative dropdown-scroll hover:bg-amber-700 hover:cursor-pointer pl-2 flex items-center justify-evenly w-full h-12 ${tvDetails.episode === episode ? 'bg-amber-700' : ''}`}> - Episode {episode} -
  • - ) - }) : (
  • No Episode
  • ) - } -
-
-
-
-
- -
-
-
- {`You are watching `} -
{data ? data.detail.name : ""}
-
If current server doesn't work please try other servers beside.
-
-
-
- {servers_.map((server, index) => { - return ( -
{ - if (server.servername === "Vidsrc.me") - setVideoServer(`${server.link}${tmdb ? `tmdb=${tmdb}` : `imdb=${id}`}&season=${tvDetails.season}&episode=${tvDetails.episode}`) - else if (server.servername === "Vidsrc.to") - setVideoServer(`${server.link}${tmdb ? `${tmdb}` : `${id}`}/${tvDetails.season}/${tvDetails.episode}`) - else if (server.servername === "Moviesapi.club") - setVideoServer(`${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}`) - else - setVideoServer(`${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`); - } - } - className={` ${videoServer.includes(server.servername.toLowerCase()) ? 'bg-amber-700' : ''} dark:text-white hover:scale-110 hover:cursor-pointer transition duration-300 ease-in-out rounded p-3 w-max text-center h-8 `} - key={index}> - {server.servername} -
- ) - })} -
-
-
-
-
-
-
- { - season.map((season, index) => { - return ( -
- -
- ) + //adding event listener for window to catch left click to remove light setting + useEffect(() => { + document.addEventListener('mousedown', event => { + if ( + event.target !== 'iframe' && + event.target.tagName.toLowerCase() !== 'span' + ) { + switchLight(false) + } + }) + }, []) + return ( + <> + + Play Tv | Yaps + +
+
+
+ {/**/} +
+ {data?.detail.name} S{tvDetails.season} E{tvDetails.episode} +
+ +
+
+
+
+ { + setnextprevbtnclicked(true) + let current_Episode = tvDetails.episode + let current_Season = tvDetails.season + if (episodes[current_Season]) { + if ( + episodes[current_Season].indexOf(current_Episode) === + 0 + ) { + if (season.indexOf(tvDetails.season) !== 0) { + setTvDetails({ + season: current_Season - 1, + episode: + episodes[current_Season - 1][ + episodes[current_Season].length - 1 + ], }) + } + } else { + setTvDetails(prev => { + return { ...prev, episode: current_Episode - 1 } + }) } -
+ } + }} + className={`${ + prevBtn ? 'block' : 'hidden' + } control-button transition duration-300 ease-in-out hover:scale-125`} + /> +
+
{ + let current_Episode = tvDetails.episode + let current_Season = tvDetails.season + setnextprevbtnclicked(true) + if (episodes[tvDetails.season]) { + if ( + episodes[tvDetails.season].indexOf(current_Episode) === + episodes[tvDetails.season].length - 1 + ) { + if ( + season.indexOf(tvDetails.season) !== + season.length - 1 + ) { + setTvDetails({ + season: current_Season + 1, + episode: 1, + }) + } + } else { + setTvDetails(prev => { + return { ...prev, episode: current_Episode + 1 } + }) + } + } + }}> + + +
+
- - ) +
+
switchLight(!lightStatus)} + className={ + 'flex flex-row items-center gap-1 transition duration-300 ease-in-out hover:cursor-pointer hover:text-orange-500' + }> + + Light +
+
+
{ + setSeasonDropDown(!seasonDropDown) + setEpisodeDropDown(false) + }}> + Season {tvDetails.season} + + {seasonDropDown ? : } + +
+
+
    + {season !== [] ? ( + season.map((season, index) => { + return ( +
  • { + setTvDetails({ season: season, episode: 1 }) + setSeasonDropDown(false) + }} + className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly bg-app-semi-dark-blue pl-2 hover:cursor-pointer hover:bg-amber-700 ${ + tvDetails.season === season ? 'bg-amber-700' : '' + }`}> + Season {season} +
  • + ) + }) + ) : ( +
  • No Seasons
  • + )} +
+
+
+
+
{ + setEpisodeDropDown(!episodeDropDown) + setSeasonDropDown(false) + }}> + Episode {tvDetails.episode} + + {episodeDropDown ? : } + +
+
+
    + {episodes[tvDetails.season] ? ( + episodes[tvDetails.season].map((episode, index) => { + return ( +
  • { + setTvDetails(prev => { + return { ...prev, episode: episode } + }) + setEpisodeDropDown(false) + }} + className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly pl-2 hover:cursor-pointer hover:bg-amber-700 ${ + tvDetails.episode === episode + ? 'bg-amber-700' + : '' + }`}> + Episode {episode} +
  • + ) + }) + ) : ( +
  • No Episode
  • + )} +
+
+
+
+
+ +
+
+
+ {`You are watching `} +
+ {data ? data.detail.name : ''} +
+
+ {' '} + If current server doesn't work please try other servers + beside. +
+
+
+
+ {servers_.map((server, index) => { + return ( +
{ + if (server.servername === 'Vidsrc.me') + setVideoServer( + `${server.link}${ + tmdb ? `tmdb=${tmdb}` : `imdb=${id}` + }&season=${tvDetails.season}&episode=${ + tvDetails.episode + }` + ) + else if (server.servername === 'Vidsrc.to') + setVideoServer( + `${server.link}${tmdb ? `${tmdb}` : `${id}`}/${ + tvDetails.season + }/${tvDetails.episode}` + ) + else if (server.servername === 'Moviesapi.club') + setVideoServer( + `${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}` + ) + else + setVideoServer( + `${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}` + ) + }} + className={` ${ + videoServer.includes(server.servername.toLowerCase()) + ? 'bg-amber-700' + : '' + } h-8 w-max rounded p-3 text-center transition duration-300 ease-in-out hover:scale-110 hover:cursor-pointer dark:text-white `} + key={index}> + {server.servername} +
+ ) + })} +
+
+
+
+
+
+
+ {season.map((season, index) => { + return ( +
+ +
+ ) + })} +
+
+
+ + ) } export default Tv From 290fdf724bb078f7333467db53498b7b5df19b9e Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Fri, 13 Oct 2023 23:31:07 +0530 Subject: [PATCH 5/8] bug fixes for tv page --- pages/play/tv.js | 502 ++++++++++++++++++++++------------------------- 1 file changed, 235 insertions(+), 267 deletions(-) diff --git a/pages/play/tv.js b/pages/play/tv.js index 152254f..51a7303 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -9,7 +9,6 @@ import { BiSolidSkipPreviousCircle, } from 'react-icons/bi' import { useTheme } from 'next-themes' -import { TMDB_IMAGE_ENDPOINT } from '../../utils' const servers_ = [ { @@ -233,303 +232,272 @@ const Tv = () => { lightStatus ? 'opacity-1 fixed h-screen ' : 'h-0 w-0 opacity-0' }`}>
+ className={` flex w-full flex-col ${ + lightStatus ? '' : 'h-full' + } z-[999] h-full`}> + {/**/} +
+ {data?.detail.name} S{tvDetails.season} E{tvDetails.episode} +
+
- {/**/} -
- {data?.detail.name} S{tvDetails.season} E{tvDetails.episode} -
- -
-
-
-
- { - setnextprevbtnclicked(true) - let current_Episode = tvDetails.episode - let current_Season = tvDetails.season - if (episodes[current_Season]) { - if ( - episodes[current_Season].indexOf(current_Episode) === - 0 - ) { - if (season.indexOf(tvDetails.season) !== 0) { - setTvDetails({ - season: current_Season - 1, - episode: - episodes[current_Season - 1][ - episodes[current_Season].length - 1 - ], - }) - } - } else { - setTvDetails(prev => { - return { ...prev, episode: current_Episode - 1 } - }) - } - } - }} - className={`${ - prevBtn ? 'block' : 'hidden' - } control-button transition duration-300 ease-in-out hover:scale-125`} - /> - -
-
+
+
+
+ { + setnextprevbtnclicked(true) let current_Episode = tvDetails.episode let current_Season = tvDetails.season - setnextprevbtnclicked(true) - if (episodes[tvDetails.season]) { + if (episodes[current_Season]) { if ( - episodes[tvDetails.season].indexOf(current_Episode) === - episodes[tvDetails.season].length - 1 + episodes[current_Season].indexOf(current_Episode) === 0 ) { - if ( - season.indexOf(tvDetails.season) !== - season.length - 1 - ) { + if (season.indexOf(tvDetails.season) !== 0) { setTvDetails({ - season: current_Season + 1, - episode: 1, + season: current_Season - 1, + episode: + episodes[current_Season - 1][ + episodes[current_Season].length - 1 + ], }) } } else { setTvDetails(prev => { - return { ...prev, episode: current_Episode + 1 } + return { ...prev, episode: current_Episode - 1 } }) } } - }}> - - + }} + className={`${ + prevBtn ? 'block' : 'hidden' + } control-button transition duration-300 ease-in-out hover:scale-125`} + /> +
-
-
switchLight(!lightStatus)} - className={ - 'flex flex-row items-center gap-1 transition duration-300 ease-in-out hover:cursor-pointer hover:text-orange-500' - }> - - Light -
-
+ className={'relative'} + onClick={() => { + let current_Episode = tvDetails.episode + let current_Season = tvDetails.season + setnextprevbtnclicked(true) + if (episodes[tvDetails.season]) { + if ( + episodes[tvDetails.season].indexOf(current_Episode) === + episodes[tvDetails.season].length - 1 + ) { + if ( + season.indexOf(tvDetails.season) !== + season.length - 1 + ) { + setTvDetails({ + season: current_Season + 1, + episode: 1, + }) + } + } else { + setTvDetails(prev => { + return { ...prev, episode: current_Episode + 1 } + }) + } + } + }}> +
{ - setSeasonDropDown(!seasonDropDown) - setEpisodeDropDown(false) - }}> - Season {tvDetails.season} - - {seasonDropDown ? : } - -
-
-
    - {season !== [] ? ( - season.map((season, index) => { - return ( -
  • { - setTvDetails({ season: season, episode: 1 }) - setSeasonDropDown(false) - }} - className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly bg-app-semi-dark-blue pl-2 hover:cursor-pointer hover:bg-amber-700 ${ - tvDetails.season === season ? 'bg-amber-700' : '' - }`}> - Season {season} -
  • - ) - }) - ) : ( -
  • No Seasons
  • - )} -
-
-
-
-
{ - setEpisodeDropDown(!episodeDropDown) - setSeasonDropDown(false) - }}> - Episode {tvDetails.episode} - - {episodeDropDown ? : } - -
-
-
    - {episodes[tvDetails.season] ? ( - episodes[tvDetails.season].map((episode, index) => { - return ( -
  • { - setTvDetails(prev => { - return { ...prev, episode: episode } - }) - setEpisodeDropDown(false) - }} - className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly pl-2 hover:cursor-pointer hover:bg-amber-700 ${ - tvDetails.episode === episode - ? 'bg-amber-700' - : '' - }`}> - Episode {episode} -
  • - ) - }) - ) : ( -
  • No Episode
  • - )} -
+ 'tooltip-div absolute left-5 z-50 hidden w-10 bg-[#222222] text-center' + }> + Next
-
-
+ className={`flex items-center justify-center gap-10 ${ + lightStatus ? 'text-white' : '' + }`}> +
switchLight(!lightStatus)} + className={ + 'flex flex-row items-center gap-1 transition duration-300 ease-in-out hover:cursor-pointer hover:text-orange-500' + }> + + Light +
+
- {`You are watching `} -
- {data ? data.detail.name : ''} -
-
- {' '} - If current server doesn't work please try other servers - beside. -
+ className={ + 'z-50 flex cursor-pointer flex-row items-center justify-center gap-2 rounded bg-[#151515] text-white outline-0 dark:bg-inherit' + } + onClick={() => { + setSeasonDropDown(!seasonDropDown) + setEpisodeDropDown(false) + }}> + Season {tvDetails.season} + + {seasonDropDown ? : } +
-
-
- {servers_.map((server, index) => { - return ( -
{ - if (server.servername === 'Vidsrc.me') - setVideoServer( - `${server.link}${ - tmdb ? `tmdb=${tmdb}` : `imdb=${id}` - }&season=${tvDetails.season}&episode=${ - tvDetails.episode - }` - ) - else if (server.servername === 'Vidsrc.to') - setVideoServer( - `${server.link}${tmdb ? `${tmdb}` : `${id}`}/${ - tvDetails.season - }/${tvDetails.episode}` - ) - else if (server.servername === 'Moviesapi.club') - setVideoServer( - `${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}` - ) - else - setVideoServer( - `${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}` - ) - }} - className={` ${ - videoServer.includes(server.servername.toLowerCase()) - ? 'bg-amber-700' - : '' - } h-8 w-max rounded p-3 text-center transition duration-300 ease-in-out hover:scale-110 hover:cursor-pointer dark:text-white `} - key={index}> - {server.servername} -
- ) - })} -
+
+
    + {season !== [] ? ( + season.map((season, index) => { + return ( +
  • { + setTvDetails({ season: season, episode: 1 }) + setSeasonDropDown(false) + }} + className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly bg-app-semi-dark-blue pl-2 hover:cursor-pointer hover:bg-amber-700 ${ + tvDetails.season === season ? 'bg-amber-700' : '' + }`}> + Season {season} +
  • + ) + }) + ) : ( +
  • No Seasons
  • + )} +
+
+
+
+
{ + setEpisodeDropDown(!episodeDropDown) + setSeasonDropDown(false) + }}> + Episode {tvDetails.episode} + + {episodeDropDown ? : } + +
+
+
    + {episodes[tvDetails.season] ? ( + episodes[tvDetails.season].map((episode, index) => { + return ( +
  • { + setTvDetails(prev => { + return { ...prev, episode: episode } + }) + setEpisodeDropDown(false) + }} + className={`dropdown-scroll relative flex h-12 w-full items-center justify-evenly pl-2 hover:cursor-pointer hover:bg-amber-700 ${ + tvDetails.episode === episode ? 'bg-amber-700' : '' + }`}> + Episode {episode} +
  • + ) + }) + ) : ( +
  • No Episode
  • + )} +
+
-
- {season.map((season, index) => { - return ( -
- -
- ) - })} + className={` ${ + lightStatus ? 'hidden' : 'flex' + } h-36 w-full items-center justify-start`}> +
+
+ {`You are watching `} +
{data ? data.detail.name : ''}
+
+ {' '} + If current server doesn't work please try other servers beside. +
+
+
+
+ {servers_.map((server, index) => { + return ( +
{ + if (server.servername === 'Vidsrc.me') + setVideoServer( + `${server.link}${ + tmdb ? `tmdb=${tmdb}` : `imdb=${id}` + }&season=${tvDetails.season}&episode=${ + tvDetails.episode + }` + ) + else if (server.servername === 'Vidsrc.to') + setVideoServer( + `${server.link}${tmdb ? `${tmdb}` : `${id}`}/${ + tvDetails.season + }/${tvDetails.episode}` + ) + else if (server.servername === 'Moviesapi.club') + setVideoServer( + `${server.link}${tmdb}-${tvDetails.season}-${tvDetails.episode}` + ) + else + setVideoServer( + `${server.link}${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}` + ) + }} + className={` ${ + videoServer.includes(server.servername.toLowerCase()) + ? 'bg-amber-700' + : '' + } h-8 w-max rounded p-3 text-center transition duration-300 ease-in-out hover:scale-110 hover:cursor-pointer dark:text-white `} + key={index}> + {server.servername} +
+ ) + })} +
+
From 3aa078b239aa9a52fcbbb13c00d3cf4a652b8429 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:26:09 +0530 Subject: [PATCH 6/8] minor ui change --- .idea/prettier.xml | 1 - pages/play/movies.js | 277 ++++++++++++++++++++++++++----------------- pages/play/tv.js | 2 +- 3 files changed, 168 insertions(+), 112 deletions(-) diff --git a/.idea/prettier.xml b/.idea/prettier.xml index 0c83ac4..b0c1c68 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -2,6 +2,5 @@ \ No newline at end of file diff --git a/pages/play/movies.js b/pages/play/movies.js index 095137e..9ec56a0 100644 --- a/pages/play/movies.js +++ b/pages/play/movies.js @@ -1,120 +1,177 @@ -import React, {useEffect, useState} from 'react' -import {useRouter} from 'next/router'; +import React, { useEffect, useState } from 'react' +import { useRouter } from 'next/router' import Head from 'next/head' -import useSWR from "swr"; -import {BsFillLightbulbFill} from "react-icons/bs"; -import {useTheme} from "next-themes"; +import useSWR from 'swr' +import { BsFillLightbulbFill } from 'react-icons/bs' +import { useTheme } from 'next-themes' -const servers_ = [{ - servername: "Vidsrc.to", link: "https://vidsrc.to/embed/movie/" -}, { - servername: "Vidsrc.me", link: "https://vidsrc.me/embed/movie?", -}, { - servername: "Moviesapi.club", link: "https://moviesapi.club/movie/" -}, { - servername: "Blackvid", link: "https://blackvid.space/embed?tmdb=" -}] -const fetcher = (...args) => fetch(...args).then((res) => res.json()) +const servers_ = [ + { + servername: 'Vidsrc.to', + link: 'https://vidsrc.to/embed/movie/', + }, + { + servername: 'Vidsrc.me', + link: 'https://vidsrc.me/embed/movie?', + }, + { + servername: 'Moviesapi.club', + link: 'https://moviesapi.club/movie/', + }, + { + servername: 'Blackvid', + link: 'https://blackvid.space/embed?tmdb=', + }, +] +const fetcher = (...args) => fetch(...args).then(res => res.json()) const Movies = () => { - const router = useRouter() - const {id, tmdb} = router.query; - const me = tmdb ? `tmdb=${tmdb}` : `imdb=${id}` - const {theme} = useTheme(); - const to = tmdb ? `${tmdb}` : `${id}` - const [lightStatus, switchLight] = useState(false) - const [videoServer, setVideoServer] = useState('vidsrc.to') - const {data} = useSWR(`/api/movie/${id}`, fetcher) - useEffect(() => { - if (localStorage.getItem("userWatched")) { - let data = JSON.parse(localStorage.getItem("userWatched")) - let moviePresent = false - for (let i in data.movies) { - if (id) if (data.movies[i] === id) { - moviePresent = true - } else { - if (data.movies === tmdb) { - moviePresent = true - } - } + const router = useRouter() + const { id, tmdb } = router.query + const me = tmdb ? `tmdb=${tmdb}` : `imdb=${id}` + const { theme } = useTheme() + const to = tmdb ? `${tmdb}` : `${id}` + const [lightStatus, switchLight] = useState(false) + const [videoServer, setVideoServer] = useState('vidsrc.to') + const { data } = useSWR(`/api/movie/${id}`, fetcher) + useEffect(() => { + if (localStorage.getItem('userWatched')) { + let data = JSON.parse(localStorage.getItem('userWatched')) + let moviePresent = false + for (let i in data.movies) { + if (id) + if (data.movies[i] === id) { + moviePresent = true + } else { + if (data.movies === tmdb) { + moviePresent = true } - if (id || tmdb) { - if (!moviePresent) { - if (id) - data.movies.push(id) - else data.movies.push(tmdb) - localStorage.setItem("userWatched", JSON.stringify(data)) - } - } - } else { - if (id || tmdb) - localStorage.setItem("userWatched", JSON.stringify({ - movies: [id ? id : tmdb], tv: [] - })) + } + } + if (id || tmdb) { + if (!moviePresent) { + if (id) data.movies.push(id) + else data.movies.push(tmdb) + localStorage.setItem('userWatched', JSON.stringify(data)) } - }, [id, tmdb]); - useEffect(() => { - document.addEventListener("mousedown", (event) => { - if (event.target !== "iframe" && event.target.tagName.toLowerCase() !== "span") { - switchLight(false) + } + } else { + if (id || tmdb) + localStorage.setItem( + 'userWatched', + JSON.stringify({ + movies: [id ? id : tmdb], + tv: [], + }) + ) + } + }, [id, tmdb]) + useEffect(() => { + document.addEventListener('mousedown', event => { + if ( + event.target !== 'iframe' && + event.target.tagName.toLowerCase() !== 'span' + ) { + switchLight(false) + } + }) + }, []) + return ( + <> + + Play Movies | Yaps + +
+
{data ? data.imdb.imdb.name : ''}
+
+
+ -
-
switchLight(!lightStatus)} - className={"flex flex-row gap-1 items-center hover:text-orange-500 transition duration-300 ease-in-out hover:cursor-pointer"}> - - Light -
-
-
-
-
- {`You are watching `} -
{data ? data.imdb.imdb.name : ""}
-
If current server doesn't work please try other servers beside.
-
-
-
- {servers_.map((server, index) => { - return (
{ - if (server.servername === "Vidsrc.me") setVideoServer(server.link + me) - else if (server.servername === "Vidsrc.to") setVideoServer(server.link + to) - - else setVideoServer(server.link + data?.imdb.imdb.tmdb_id); - }} - className={` ${videoServer.includes(server.servername.toLowerCase()) ? 'bg-amber-700' : ''} dark:text-white hover:scale-110 hover:cursor-pointer transition duration-300 ease-in-out rounded p-3 w-max text-center h-8`} - key={index}> - {server.servername} -
) - })} -
-
-
-
+ className={`z-[998] ${ + lightStatus + ? 'absolute left-0 h-[80vh] w-full lg:left-[20%] lg:w-2/3 ' + : 'h-[95vh] w-full' + }`} + allowFullScreen='allowfullscreen'> +
+
switchLight(!lightStatus)} + className={ + 'flex flex-row items-center gap-1 transition duration-300 ease-in-out hover:cursor-pointer hover:text-orange-500' + }> + + Light
+
+
+
+
+ {`You are watching `} +
+ {data ? data.imdb.imdb.name : ''} +
+
+ {' '} + If current server doesn't work please try other servers + beside. +
+
+
+
+ {servers_.map((server, index) => { + return ( +
{ + if (server.servername === 'Vidsrc.me') + setVideoServer(server.link + me) + else if (server.servername === 'Vidsrc.to') + setVideoServer(server.link + to) + else + setVideoServer( + server.link + data?.imdb.imdb.tmdb_id + ) + }} + className={` ${ + videoServer.includes(server.servername.toLowerCase()) + ? ' bg-app-greyish-blue text-white ' + : '' + } h-12 w-max rounded p-4 pt-3 text-center transition duration-300 ease-in-out hover:scale-110 hover:cursor-pointer hover:bg-app-greyish-blue hover:text-white dark:text-white`} + key={index}> + {server.servername} +
+ ) + })} +
+
+
+
- ) +
+ + ) } -export default Movies; +export default Movies diff --git a/pages/play/tv.js b/pages/play/tv.js index 51a7303..a0f19ba 100644 --- a/pages/play/tv.js +++ b/pages/play/tv.js @@ -488,7 +488,7 @@ const Tv = () => { }} className={` ${ videoServer.includes(server.servername.toLowerCase()) - ? 'bg-amber-700' + ? 'bg-app-greyish-blue' : '' } h-8 w-max rounded p-3 text-center transition duration-300 ease-in-out hover:scale-110 hover:cursor-pointer dark:text-white `} key={index}> From cfec87da9f9ec6ccc151924e689dc766360bb206 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:28:43 +0530 Subject: [PATCH 7/8] Delete .idea directory --- .idea/.gitignore | 5 ----- .idea/inspectionProfiles/Project_Default.xml | 13 ------------- .idea/jsLibraryMappings.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/prettier.xml | 6 ------ .idea/vcs.xml | 6 ------ .idea/yaps.iml | 13 ------------- 7 files changed, 57 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/jsLibraryMappings.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/prettier.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/yaps.iml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index b58b603..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 939c71e..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index 3577762..0000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index edd7f0f..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml deleted file mode 100644 index b0c1c68..0000000 --- a/.idea/prettier.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/yaps.iml b/.idea/yaps.iml deleted file mode 100644 index 9f7ba11..0000000 --- a/.idea/yaps.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file From b8d477d8699a62b5246ec67c9f311fde132b74b9 Mon Sep 17 00:00:00 2001 From: Rohithk <67067796+Rohithk2003@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:28:53 +0530 Subject: [PATCH 8/8] Delete .vscode directory --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0967ef4..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1 +0,0 @@ -{}