-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
55 lines (45 loc) · 1.51 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const apiKey = 'f531333d637d0c44abc85b3e74db2186';
const apiUrl = 'https://api.themoviedb.org/3/movie/top_rated';
let currentPage = 1;
let totalPages = 3;
let currentTab = 'all';
document.addEventListener('DOMContentLoaded', fetchMovies);
function fetchMovies() {
// Use fetch to get data from the API
//Append the fetched data to the movieList
// Call renderMovies function to display the movies
}
function renderMovies(movies) {
// Clear previous movies
//Loop through the movies and create HTML elements for each movie
// Append the movie cards to the movieList
}
function searchMovies() {
// Implement search functionality
//Use fetch to get data based on the search input
// Render the searched movies
}
function sortMoviesByDate(){
//Implement sorting functionality by date
// Update the movieList and call renderMovies function
}
function sortMoviesByRating(){
// Implement sorting functionality by rating
//Update the movieList and call renderMovies function
}
function showAllMovies() {
//Implement showing all movies
// Update the currentTab variable, fetch movies, and render them
}
function showFavoriteMovies() {
// Implement showing favorite movies
// Update the currentTab variable, fetch movies, and render them
}
function previousPage(){
// Implement previous page functionality
// Update the currentPage variable, fetch movies, and render them
}
function nextPage() {
// Implement next page functionality
//Update the currentPage variable, fetch movies, and render them
}