Skip to content

Commit

Permalink
made changes in absolute path in html files
Browse files Browse the repository at this point in the history
  • Loading branch information
Rataash99 committed Mar 5, 2024
1 parent 8cba7a5 commit 8d4a224
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion favorite.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<header id = "top-header"
class="flex fixed flex-col mx-auto justify-start w-full h-fit items-center gap-2 p-2 md:py-4 md:px-4 top-0 left-0 right-0 shadow-xl shadow-slate-900 bg-slate-900 z-20 "
>
<a href="/index.html">
<a href="./index.html">
<img
id="logo"
class="size-10 w-auto cursor-pointer"
Expand Down
1 change: 0 additions & 1 deletion favorite.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function sendingDataToHTML(element, item){
favoriteMovies = favoriteMovies.filter(obj => {
return e.target.id != obj.id;
})
console.log(favoriteMovies);
movies.innerHTML = "";
createMovieDiv(favoriteMovies);

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<header id = "top-header"
class="flex fixed flex-col mx-auto justify-between w-full h-fit items-center gap-2 p-2 pb-0 md:py-4 md:px-4 top-0 left-0 right-0 shadow-xl shadow-slate-900 bg-slate-900 z-20 "
>
<a href="/index.html">
<a href="./index.html">
<img
id="logo"
class="w-auto cursor-pointer size-10"
Expand Down
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ movies.addEventListener('click', (e) => {
const favData = JSON.stringify(favoriteMovies);
localStorage.setItem('favMovieData', favData);
}
console.log(favoriteMovies);
});

// handling favorite.html
const favBtn = document.querySelector('#go-to-fav');
favBtn.addEventListener('click', handleFavBtn);
function handleFavBtn(){
console.log(favoriteMovies);
const jsonData = JSON.stringify(favoriteMovies);
window.location.href = `./favorite.html?favorites=${encodeURIComponent(jsonData)}`
}
Expand Down Expand Up @@ -154,8 +152,7 @@ movies.addEventListener('click', (e) => {
fetch(url)
.then(response => response.json())
.then(data => {
// Process the response data
handleSearchList(data.results, e);
handleSearchList(data.results, e);// Process the response data
})
.catch(error => {
console.error('Error fetching data:', error);
Expand Down
4 changes: 2 additions & 2 deletions movie.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<header id = "top-header"
class="flex fixed flex-col mx-auto justify-center w-full h-fit items-center gap-2 p-2 md:py-4 md:px-4 top-0 left-0 right-0 shadow-xl shadow-slate-900 bg-slate-900 z-20 "
>
<a id = "prev-page">
<a href="./index.html">
<img
id="logo"
class="size-10 w-auto cursor-pointer"
Expand All @@ -30,7 +30,7 @@
</a>
</header>
<main id = "movie-main" class="w-full overflow-scroll ">
<a id = "back" href="./index.html" class = "hover:scale-105 border border-blue-500 cursor-pointer hover:text-blue-400 fixed left-3 text-md p-1.5 rounded-full top-[4rem] px-2.5 bg-slate-900 hover:bg-slate-950 sm:top-[5rem] lg:left-[4rem]">
<a id = "back" href = "index.html" class = "hover:scale-105 border border-blue-500 cursor-pointer hover:text-blue-400 fixed left-3 text-md p-1.5 rounded-full top-[4rem] px-2.5 bg-slate-900 hover:bg-slate-950 sm:top-[5rem] lg:left-[4rem]">
<i class="fa-solid fa-arrow-left "></i>
</a>
<div id = "individual-movie-div" class="mx-auto w-full mt-[2rem] justify-center sm:justify-start sm:items-start items-center p-4 h-fit flex flex-col gap-6 md:gap-12">
Expand Down
9 changes: 0 additions & 9 deletions movie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
const params = new URLSearchParams(window.location.search);
const jsonData = params.get('data');
const data = JSON.parse(decodeURIComponent(jsonData));
const prevUrl = params.get('prevUrl');
console.log(data);

fetch("https://api.themoviedb.org/3/genre/movie/list?api_key=3206e39e86eabbd67afc597cdeafe219")
.then(response => {
Expand Down Expand Up @@ -40,10 +38,3 @@ const voteAvg = document.querySelector("#vote-avg");
voteAvg.textContent = `${data.vote_average.toFixed(2)}`;

const genre = document.querySelector("#genre");

// back to previous page
const goBack = document.querySelector('#prev-page');
goBack.addEventListener('click', () => {
console.log(prevUrl);
goBack.src = prevUrl;
})

0 comments on commit 8d4a224

Please sign in to comment.