Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Commit

Permalink
iframe added,back to gogo anime
Browse files Browse the repository at this point in the history
  • Loading branch information
sohamsingh29 committed Jul 18, 2021
1 parent 9ce4394 commit 46951b6
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 72 deletions.
2 changes: 1 addition & 1 deletion components/card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Card = ({ title, id, heading, image, episodenumber }) => {
>
<MovieImg
className="w-full object-cover rounded-xl h-60 xl:h-96 md:h-72 lg:h-80"
src={image?.includes("4anime.to") ? image : "/nothing.svg"}
src={image}
loading="lazy"
alt={title}
/>
Expand Down
1 change: 1 addition & 0 deletions components/card/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PagiNation from "../PagiNation";
import Loader from "../Loader/Loader";
function Container({ Data = [], heading, page, Icon }) {
const { theme, loading } = useSelector((state) => state);
console.log(Data);
return loading ? (
<Loader />
) : Data.length > 0 ? (
Expand Down
48 changes: 24 additions & 24 deletions components/sidebar/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useRouter } from "next/router";
const Search = () => {
const router = useRouter();
const [val, setVal] = useState("");
// const [content, setContent] = useState([]);
const [content, setContent] = useState([]);
useEffect(() => {
var SearchBar = document.getElementById("search");
var SearchInput = document.getElementById("searchinput");
Expand All @@ -20,33 +20,33 @@ const Search = () => {
if (!isClickInside) {
SearchInput.style.maxWidth = 0;
SearchInput.style.marginLeft = 0;
// setContent([]);
setContent([]);
setVal("");
}
});
}, []);
const handleSearch = async (e) => {
setVal(e.target.value);
// let d = await axios.get(
// "https://ajax.gogocdn.net/site/loadAjaxSearch?keyword=" + val
// );
// d = d.data.content.replaceAll("category/", "/details/");
// var myList = [];
// var $ = cheerio.load(d);
// $("a").each(function (index, element) {
// let result = {};
// let title = $(this).text();
// let link = $(this).attr().href;
// let image = $(this)
// .children("div")
// .attr()
// .style.slice(15)
// .replace(/[("")]/g, "");
// result = { title, link, image };
// myList.push(result);
// });
let d = await axios.get(
"https://ajax.gogocdn.net/site/loadAjaxSearch?keyword=" + val
);
d = d.data.content.replaceAll("category/", "/details/");
var myList = [];
var $ = cheerio.load(d);
$("a").each(function (index, element) {
let result = {};
let title = $(this).text();
let link = $(this).attr().href;
let image = $(this)
.children("div")
.attr()
.style.slice(15)
.replace(/[("")]/g, "");
result = { title, link, image };
myList.push(result);
});

// setContent(myList);
setContent(myList);
};
const handleClick = () => {
var SearchBar = document.getElementById("search");
Expand All @@ -59,7 +59,7 @@ const Search = () => {
const handleSubmit = (e) => {
e.preventDefault();
router.push(`/search/${val}/1`);
// setContent([]);
setContent([]);
setVal("");
};
const theme = useSelector((state) => state.theme);
Expand All @@ -79,7 +79,7 @@ const Search = () => {
placeholder="Search for anime..."
id="searchinput"
/>
{/* {content.length > 0 && (
{content.length > 0 && (
<div
className={` autocomplete absolute left-0 px-1 py-0 top-11 shadow-2xl transition-all duration-200 rounded-xl ${theme.button.text} w-full ${theme.button.background}`}
>
Expand All @@ -101,7 +101,7 @@ const Search = () => {
</Link>
))}
</div>
)} */}
)}
</div>
</form>
);
Expand Down
110 changes: 64 additions & 46 deletions components/watch/watchingContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const WatchingContainer = ({ data = [], slug }) => {
const { theme, loading, resumeId } = useSelector((state) => state);
const [link, setLink] = useState("");
const [myList, setMyList] = useState([]);
const [iframe, setIframe] = useState(false);
const dispatch = useDispatch();
useEffect(() => {
if (data.links?.length > 0) {
Expand All @@ -75,6 +76,9 @@ const WatchingContainer = ({ data = [], slug }) => {
})
);
}, 5000);
} else {
setLink(data.link);
setIframe(true);
}
return () => clearInterval(myInterval);
}, [data.links]);
Expand Down Expand Up @@ -108,57 +112,71 @@ const WatchingContainer = ({ data = [], slug }) => {
>
{"Ep:" + slug[1]}
</span>
<Select
name="Select links"
onChange={(event) => {
setLink(event.target.value);
}}
button={theme.button}
className={`h-11 cursor-pointer outline-none border ${theme.border.selected} rounded-full ${theme.button.background} border ${theme.button.text} ${theme.button.border} shadow-2xl transition-all duration-500`}
value={link}
theme={theme}
>
{myList.map((item, index) => {
return (
<option
key={index}
className={`${theme.text.notselected} ${theme.border.selected} border outline-none`}
value={item.src}
>
{item.size.replace(/[()]/g, "")}
</option>
);
})}
</Select>
{!iframe && (
<Select
name="Select links"
onChange={(event) => {
setLink(event.target.value);
}}
button={theme.button}
className={`h-11 cursor-pointer outline-none border ${theme.border.selected} rounded-full ${theme.button.background} border ${theme.button.text} ${theme.button.border} shadow-2xl transition-all duration-500`}
value={link}
theme={theme}
>
{myList.map((item, index) => {
return (
<option
key={index}
className={`${theme.text.notselected} ${theme.border.selected} border outline-none`}
value={item.src}
>
{item.size.replace(/[()]/g, "")}
</option>
);
})}
</Select>
)}
</div>
</div>
<div className="flex w-full justify-center items-center flex-col-reverse lg:flex-row">
<div
className={`flex flex-row lg:flex-col text-lg lg:mx-4 justify-center font-semibold items-center ${theme.text.selected}`}
>
Speed
{Data.map((Item) => (
<PlayBack
button={theme.detailsButton}
key={Item.id}
className={`shadow-2xl transition-all duration-500 my-4 lg:my-1 mx-2 p-1 flex justify-center items-center w-10 h-10 rounded-full cursor-pointer text-sm`}
onClick={() => handleClick(Item.rate)}
active={Myref.current?.playbackRate == Item.rate}
{iframe ? (
<iframe
src={link}
className=" max-w-full lg:max-w-screen-lg"
sandbox
width={1024}
height={576}
/>
) : (
<>
<div
className={`flex flex-row lg:flex-col text-lg lg:mx-4 justify-center font-semibold items-center ${theme.text.selected}`}
>
{Item.rate}
</PlayBack>
))}
</div>
Speed
{Data.map((Item) => (
<PlayBack
button={theme.detailsButton}
key={Item.id}
className={`shadow-2xl transition-all duration-500 my-4 lg:my-1 mx-2 p-1 flex justify-center items-center w-10 h-10 rounded-full cursor-pointer text-sm`}
onClick={() => handleClick(Item.rate)}
active={Myref.current?.playbackRate == Item.rate}
>
{Item.rate}
</PlayBack>
))}
</div>

<video
src={link}
width="1024"
autoPlay
height="576"
controls
ref={Myref}
style={{ boxShadow: " 0rem 2rem 5rem rgba(0, 0, 0, 0.2)" }}
></video>
<video
src={link}
width="1024"
autoPlay
height="576"
controls
ref={Myref}
style={{ boxShadow: " 0rem 2rem 5rem rgba(0, 0, 0, 0.2)" }}
/>
</>
)}
</div>
<PagiNation
page={[slug[0], slug[1]]}
Expand Down
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/sw.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,7 @@
dependencies:
"anymatch" "~3.1.1"
"braces" "~3.0.2"
"fsevents" "~2.3.1"
"glob-parent" "~5.1.0"
"is-binary-path" "~2.1.0"
"is-glob" "~4.0.1"
Expand Down Expand Up @@ -2799,6 +2800,11 @@
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
"version" "1.0.0"

"fsevents@~2.3.1":
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
"version" "2.3.2"

"function-bind@^1.1.1":
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down Expand Up @@ -4705,6 +4711,8 @@
"integrity" "sha512-vPD+JoDj3CY8k6m1bLcAFttXMe78P4CMxoau0iLVS60+S9kLsv2379xaGy4NgYWu+h2WTlucpoLPAoUoixFBag=="
"resolved" "https://registry.npmjs.org/rollup/-/rollup-2.45.1.tgz"
"version" "2.45.1"
dependencies:
"fsevents" "~2.3.1"
optionalDependencies:
"fsevents" "~2.3.1"

Expand Down

0 comments on commit 46951b6

Please sign in to comment.