Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,41 @@ img::-moz-selection {
font-weight: 400;
padding: 0.75em 0;
letter-spacing: 1px;
color: white;

color: #fed136;
transition: 0.6s ease;
font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#mainNav .navbar-nav .nav-item .nav-link::after {
content: '';
position: absolute;
font-weight:400;
left: 50%;
right: 50%;
bottom: 0px;
width: 0px;
height: 4px;
background: #1b60a5;
transition: all 0.45s;
}

#mainNav .navbar-nav .nav-item .nav-link:hover::after {
width: 100%;
left:0;

}


#mainNav .navbar-nav .nav-item .nav-link.active,
#mainNav .navbar-nav .nav-item .nav-link:hover {
color: #fed136;
color: rgb(38, 121, 216);
text-transform: unset;
}



@media (min-width: 992px) {
#mainNav {
padding-top: 25px;
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@
>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="tv.html">Tv Shows</a>
<a class="nav-link js-scroll-trigger" href="tv.html">TV Shows</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="about.html"
>About Us</a
>
</li>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- <div class="collapse navbar-collapse" id="navbarSupportedContent">
<form class="d-flex"> <input class="form-control mr-2" type="search" placeholder="Search" aria-label="Search"> <button class="btn btn-outline-success" type="submit">Search</button> </form>
</div>
</div> -->
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="contact.html"
>Contact Us</a
Expand Down
24 changes: 18 additions & 6 deletions js/movie.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
const notAvailable = "N/A";

function scrollToResult(result) {
if (result) {
result.scrollIntoView({ behavior: "smooth" });
}
}

function movieSelected(id) {
sessionStorage.setItem("movieId", id);
window.location = "singleMovie.html";
window.location.href = "singleMovie.html";

//window.location.href = `/search-results?query=${encodeURIComponent(query)}`;

return false;
}

Expand All @@ -18,9 +27,10 @@ function getMovie() {
.then(response => {
console.log(response);
let movie = response.data;

let output = `
<div class="row">

${
!movie.poster_path
? `
Expand Down Expand Up @@ -125,10 +135,12 @@ function getMovie() {
movie.imdb_id
}" style=" width: 100%; height: 100%" allowfullscreen="true" scrolling="no" class="embed-responsive-item" ></iframe>
</div>
</div>


`;
</div> `;

if (output) {
// Scroll to the search result
scrollToResult(output);
}
$("#movie").html(output);
})
.catch(err => {
Expand Down
83 changes: 46 additions & 37 deletions js/searchMovie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,75 @@ let adultFlag = false;
$(document).ready(() => {
$("#searchForm").on("submit", e => {
let searchText = $("#searchText").val();
//adultFlag = $('#adult').value();
adultFlag = $("input[name=adult]:checked").val();
getMovies(searchText);
e.preventDefault();
});
});
});

function scrollToResult(result) {
if (result) {
// Scroll to the element with the id "movies" where your search results are displayed
document.getElementById("movies").scrollIntoView({ behavior: "smooth" });
}
}

function getMovies(searchText) {
axios
.get(
"https://api.themoviedb.org/3/search/movie?api_key=ca5d667528ca51e527d9e4f7830d97d2&language=en-US&query=" +
searchText +
"&page=1&include_adult=" +
"&page=1&include_adult=" +
adultFlag
)
.then(response => {
let movies = response.data.results;

let output = "";

if (movies.length > 0) {
$.each(movies, (index, movie) => {
output += `
<div class="col-md-4 col-sm-6 portfolio-item">
${
!movie.poster_path
? `
<a class="portfolio-link" data-toggle="modal" href="#" onclick="movieSelected('${
movie.id
}')">
<img class="img-fluid" src="img/no-poster.gif" alt="${movie.title}">
</a>

`
: `
<a class="portfolio-link" data-toggle="modal" href="#" onclick="movieSelected('${
movie.id
}')">
<img class="img-fluid" src="https://image.tmdb.org/t/p/w500/${
movie.poster_path
}" alt="${movie.title}">
</a>
`
}
<div class="portfolio-caption">
<h4 style="color:black">${movie.title}</h4>
<p class="text-muted">Released On<br/>${movie.release_date}</p>
<a onclick="movieSelected('${
movie.id
}')" class="btn btn-primary" href="#">Movie Details</a>

</div>
</div>

`;
<div class="col-md-4 col-sm-6 portfolio-item">
${
!movie.poster_path
? `
<a class="portfolio-link" data-toggle="modal" href="#" onclick="movieSelected('${
movie.id
}')">
<img class="img-fluid" src="img/no-poster.gif" alt="${movie.title}">
</a>
`
: `
<a class="portfolio-link" data-toggle="modal" href="#" onclick="movieSelected('${
movie.id
}')">
<img class="img-fluid" src="https://image.tmdb.org/t/p/w500/${
movie.poster_path
}" alt="${movie.title}">
</a>
`
}
<div class="portfolio-caption">
<h4 style="color:black">${movie.title}</h4>
<p class="text-muted">Released On<br/>${movie.release_date}</p>
<a onclick="movieSelected('${
movie.id
}')" class="btn btn-primary" href="#">Movie Details</a>
</div>
</div>
`;
});

// After rendering the search results, scroll to the "movies" section
$("#movies").html(output);
scrollToResult(document.getElementById("movies"));
} else {
output =
'<h2 class="text-center">No Movie Available with this Name!! Please Try Another Name</h2>';
`<h2 Id = "h2a" class="text-center">Oopsie!! We dont have ${searchText}..Please Try Something else..</h2>`;
$("#movies").html(output);
scrollToResult(document.getElementById("h2a"));

}
})
.catch(err => {
Expand Down
15 changes: 15 additions & 0 deletions js/searchTv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@ $(document).ready(() => {
});
});

function scrollToResult(result) {
if (result) {
result.scrollIntoView({ behavior: "smooth" });
}
}



function getMovies(searchText){
axios.get('https://api.themoviedb.org/3/search/tv?api_key=ca5d667528ca51e527d9e4f7830d97d2&language=en-US&query='+searchText+'&page=1')
.then((response) =>{
let movies = response.data.results;
console.log(response);
let output ='';
if (output) {
// Scroll to the search result
scrollToResult(output);
}
if(movies.length>0){
$.each(movies, (index, movie) =>{
output += `
Expand All @@ -43,6 +54,10 @@ function getMovies(searchText){
</div>

`;
if (output) {
// Scroll to the search result
scrollToResult(output);
}
});
$('#movies').html(output);
}
Expand Down
18 changes: 14 additions & 4 deletions js/tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ let searchTitle ='';

function movieSelected(id){
sessionStorage.setItem('movieId', id);
window.location = 'singleTv.html';
window.location.href = 'singleTv.html';
// window.location.href = `/search-results?query=${encodeURIComponent(query)}`;

return false;
}

function scrollToResult(result) {
if (result) {
result.scrollIntoView({ behavior: "smooth" });
}
}




function getMovie(){
Expand Down Expand Up @@ -88,10 +97,11 @@ function getMovie(){
</div>
</div>
<br>



`;
if (output) {
// Scroll to the search result
scrollToResult(output);
}
$('#movie').html(output);
})
.catch((err) =>{
Expand Down
4 changes: 2 additions & 2 deletions movies.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
<div class="container">
<div class="row" style="padding-top: 100px;">
<div class=" col-md-12 jumbotron bg-dark">
<h3 class="text-center" style="color:white; padding-bottom: 20px;">Search for any Movie</h3>
<h3 class="text-center" style="color:white; padding-bottom: 20px;">Search for any Movie,TV Show or Short-Film..</h3>
<form id="searchForm">
<input type="text" class="form-control" id="searchText"
placeholder="Search Movie by Name and Press Enter" />
placeholder="Search any Movie,TV-Show by Name and Press Enter" />
<h4 class="text-center" style="color:white; padding-top: 20px;">Are you over 18 years old?</h4>
<div style="padding-bottom:10px; color:white;">
<input type="radio" name="adult" value="true" /> Yes<br />
Expand Down