diff --git a/index.html b/index.html index e45fa20..13095fb 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ JustStreamIt + @@ -29,7 +30,8 @@ } .full-w { width: 100%; - padding-top: 50%; + height: 3rem; + background-image; } @@ -90,7 +92,6 @@ - diff --git a/script.js b/script.js index 1ea226d..f4f55db 100644 --- a/script.js +++ b/script.js @@ -1,24 +1,6 @@ const url_title = "http://localhost:8000/api/v1/titles/"; const url_genre = "http://localhost:8000/api/v1/genres/"; -// get categories and create the options in select menu -async function getCategory() { - listeGenres = []; - for (let i = 1; i<6; i++) { - const response = await fetch(`${url_genre}?page=${i}`); - const genres = await response.json(); - for (let j in genres.results) { - listeGenres.push(genres.results[j].name); - }; - } - let categorySelect = document.getElementById("category-select"); - for (i in listeGenres) { - let option = ` - - `; - categorySelect.innerHTML += option; - } -} // create the best film block and get a movie from a given ID async function bestFilm(filmId) { @@ -30,7 +12,7 @@ async function bestFilm(filmId) { let detail = `
- film cover + film cover

${bfilm.title}

@@ -41,14 +23,13 @@ async function bestFilm(filmId) {
`; - //document.getElementById("bestFilm").innerHTML += detail+modal; blockToLook.innerHTML += detail; getModalDetail(bfilm, bfilm.id, blockToLook); - - } -async function getModalDetail(filmData, modalId, blockToLook) { +// call the movie URL, retrieve data and create modal block, then insert it in HTML directly +// avoid to manage a promise object in createBlock() +async function getModalDetail(filmData, modalId, blockToLook) { const response = await fetch(`${filmData.url}`); const film = await response.json(); @@ -61,6 +42,7 @@ async function getModalDetail(filmData, modalId, blockToLook) { if (film.genre) { genre = film.genre; } + let modalContent = `