Skip to content

Commit

Permalink
added title in url
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkitpareek18 committed Feb 10, 2023
1 parent fa0522e commit cdb2133
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function fetchAndShow() {
let imageAndInfo = "";

if (result.qid === "movie" && result.i) {
imageAndInfo = `<a onClick="setUrl(this); return setVideo(this);" url="imdb=${result.id}&type=movie" isWebSeries="false" title="${result.l}" class="links" IMDB="${result.id}" href="https://www.2embed.to/embed/imdb/movie?id=${result.id}" target="_blank">
imageAndInfo = `<a onClick="setUrl(this); return setVideo(this);" url="imdb=${result.id}&type=movie&title=${result.l.replace(/ /g,"_")}" isWebSeries="false" title="${result.l}" class="links" IMDB="${result.id}" href="https://www.2embed.to/embed/imdb/movie?id=${result.id}" target="_blank">
<img src="${result.i.imageUrl}">
<div class="info">
<h3>${result.l}</h3>
Expand All @@ -41,7 +41,7 @@ function fetchAndShow() {
</a>`;

} else if (result.qid === "tvSeries" && result.i) {
imageAndInfo = `<a onClick="setUrl(this); return setVideo(this);" url="imdb=${result.id}&season=1&episode=1" IMDB="${result.id}" title="${result.l}" isWebSeries="true" class="links" href="https://www.2embed.to/embed/imdb/tv?id=${result.id}&s=1&e=1" target="_blank">
imageAndInfo = `<a onClick="setUrl(this); return setVideo(this);" url="imdb=${result.id}&season=1&episode=1&title=${result.l.replace(/ /g,"_")}" IMDB="${result.id}" title="${result.l}" isWebSeries="true" class="links" href="https://www.2embed.to/embed/imdb/tv?id=${result.id}&s=1&e=1" target="_blank">
<img src="${result.i.imageUrl}">
<div class="info">
<h3>${result.l}</h3>
Expand Down Expand Up @@ -117,10 +117,16 @@ function fillSearchInput() {
searchInput.value = search;
fetchAndShow();
}

// It will set the contents according to url data

else if (imdb && type && !search && !episode && !season) {
fetchTitle(imdb)
.then(title => setAll(imdb, title,season,episode,type))
.catch(error => console.error(error));



}else if (imdb && !search && episode && season) {
fetchTitle(imdb)
.then(title => setAll(imdb, title, season, episode,type))
Expand Down Expand Up @@ -226,7 +232,7 @@ function setVideo(element) {
for (const episode of episodesDataJSON.episodes) {
const episodeNumber = episode.episode_number;
let formatedEpisodeNumber = (episodeNumber).toLocaleString('en-US', { minimumIntegerDigits: 2, useGrouping: false });
episodesData += `<a class="episodes" title="${seasonsDataJSON.name + ": E" + formatedEpisodeNumber + ". " + episode.name}" cssidentification="s${seasonNumber}e${episodeNumber}" url="imdb=${imdbID}&season=${seasonNumber}&episode=${episodeNumber}" onClick="event.preventDefault();setVideo(this);setUrl(this); " href="https://www.2embed.to/embed/tmdb/tv?id=${showId}&s=${seasonNumber}&e=${episodeNumber}">E${formatedEpisodeNumber}. ${episode.name}</a>`;
episodesData += `<a class="episodes" title="${seasonsDataJSON.name + ": E" + formatedEpisodeNumber + ". " + episode.name}" cssidentification="s${seasonNumber}e${episodeNumber}" url="imdb=${imdbID}&season=${seasonNumber}&episode=${episodeNumber}&title=${seasonsDataJSON.name.replace(/ /g,"_") + "_E" + formatedEpisodeNumber + "_" + episode.name.replace(/ /g,"_")}" onClick="event.preventDefault();setVideo(this);setUrl(this); " href="https://www.2embed.to/embed/tmdb/tv?id=${showId}&s=${seasonNumber}&e=${episodeNumber}">E${formatedEpisodeNumber}. ${episode.name}</a>`;
}

episodeContainer.innerHTML = episodesData;
Expand Down
2 changes: 1 addition & 1 deletion script.min.js

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

0 comments on commit cdb2133

Please sign in to comment.