-
Notifications
You must be signed in to change notification settings - Fork 38
accidentally closed the previous pull request #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KateMhq
wants to merge
19
commits into
constructorlabs:master
Choose a base branch
from
KateMhq:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
37e3b20
basic features
KateMhq 2c04ea2
css added
KateMhq fed83bc
css added
KateMhq 1ce37fe
fixed bug
KateMhq ce0f729
updated event listener
KateMhq 5419198
pagination
KateMhq 7ed6888
de-bug
KateMhq b884040
bug fixed
KateMhq deb74ab
load new page
KateMhq e0e5050
local storage
KateMhq 984d5e8
fixed movie id
KateMhq 9a865a9
add to favorite works
KateMhq d6b644c
add to fav completed
KateMhq 7f61ba7
format clean
KateMhq 22d8488
sorting completed
KateMhq 2a9007a
persistant fav list
KateMhq 3641b14
responsive design
KateMhq b7c3d9b
preview completed
KateMhq b88eb80
README updated
KateMhq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <link rel="stylesheet" href="style.css"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| <title></title> | ||
|
|
||
| </head> | ||
| <body> | ||
| <h1>My Favorites</h1> | ||
| <!-- <form class="search-area"> | ||
| <input type="text " class="search-area-text" placeholder="Search for a movie!"> | ||
| <input type="button" class="search-area-submit" > | ||
| </form> --> | ||
|
|
||
| <ol class="favorite-list"> | ||
| </ol> | ||
|
|
||
| <script src="favorite.js"></script> | ||
| </body> | ||
| </html> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| const favoriteList = document.querySelector(".favorite-list"); | ||
| const localStorage = window.localStorage; | ||
| const mySearchResults = document.createElement("button"); | ||
| const body=document.querySelector("body"); | ||
| let localData = JSON.parse(localStorage.getItem("favList")); | ||
|
|
||
| mySearchResults.innerHTML = "Go to search results"; | ||
| body.insertBefore(mySearchResults, favoriteList); | ||
|
|
||
| mySearchResults.addEventListener("click", function(event) { | ||
| event.preventDefault(); | ||
| window.location.href = "movie.html"; | ||
| }); | ||
|
|
||
|
|
||
| function loadFavList(localData) { | ||
|
|
||
| favoriteList.innerHTML=" "; | ||
| localData.sort(function(a, b) { | ||
| return a.index - b.index; | ||
| }) | ||
| .map(movie => { | ||
| let movieContainer = document.createElement("li"); | ||
| movieContainer.className = "movie"; | ||
| movieContainer.id = movie.id; | ||
| movieContainer.value = movie.index; | ||
|
|
||
| // console.log(movie.index) | ||
| // console.log(movie.title) | ||
| // console.log(movieContainer.value) | ||
|
|
||
| let movieTitle = document.createElement("h2"); | ||
| let movieYear = document.createElement("h3"); | ||
| let posterImage = document.createElement("img"); | ||
| let upVote=document.createElement("button"); | ||
| let downVote=document.createElement("button"); | ||
|
|
||
| movieTitle.innerHTML = `${movie.title}`; | ||
| movieTitle.className = "movie-title"; | ||
| movieContainer.appendChild(movieTitle); | ||
|
|
||
| movieYear.innerHTML = `${movie.year}`; | ||
| movieYear.className = "movie-year"; | ||
| movieContainer.appendChild(movieYear); | ||
|
|
||
| posterImage.src = `${movie.image}`; | ||
| posterImage.className = "movie-image"; | ||
| posterImage.alt = "Movie poster"; | ||
| movieContainer.appendChild(posterImage); | ||
|
|
||
| upVote.innerHTML="Up" | ||
| movieContainer.appendChild(upVote); | ||
|
|
||
| downVote.innerHTML="Down" | ||
| movieContainer.appendChild(downVote); | ||
|
|
||
| upVote.addEventListener("click", function(event) { | ||
| event.preventDefault(); | ||
| localData=shift(event,1); | ||
| loadFavList(localData); | ||
| }); | ||
| downVote.addEventListener("click", function(event) { | ||
| event.preventDefault(); | ||
| localData=shift(event,-1); | ||
| loadFavList(localData); | ||
| //function; | ||
| }); | ||
|
|
||
| favoriteList.appendChild(movieContainer); | ||
| return localData; | ||
|
|
||
| }); | ||
| } | ||
|
|
||
| loadFavList(localData); | ||
|
|
||
| function shift(event,number){ | ||
| const currentIndex= event.target.parentNode.getAttribute("value"); | ||
| localData[parseInt(currentIndex)-number].index=currentIndex; | ||
| localData[currentIndex].index=parseInt(currentIndex)-number; | ||
| localStorage.setItem("favList", JSON.stringify(localData)); | ||
| return localData | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <link rel="stylesheet" href="style.css"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| <title></title> | ||
|
|
||
| </head> | ||
| <body> | ||
| <h1>Movie Collectors</h1> | ||
| <form class="search-area"> | ||
| <input type="text " class="search-area-text" placeholder="Search for a movie!"> | ||
| <input type="button" class="search-area-submit" > | ||
| </form> | ||
| <ul class="preview"> | ||
| </ul> | ||
|
|
||
| <div class="pagination"> | ||
| </div> | ||
|
|
||
| <ul class="search-result-list"> | ||
| </ul> | ||
|
|
||
| <script src="movie.js"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out code can be removed