PIbd-22_Shabunov_O.A._Inter.../js/videoplayer.js

37 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-12-08 00:57:11 +04:00
import { getMovieById } from './rest_api';
export async function loadMovieData() {
const id = new URLSearchParams(location.search).get('id');
const movie = await getMovieById(id);
document.querySelector('iframe').setAttribute('src', movie.video);
document.querySelector('#movieTitle').innerHTML = movie.title;
document.querySelector('#movieDescription').innerHTML = movie.description;
const movieInfoTemplate = `
<h3>О фильме</h3>
<ul class="list-group list-group-flush my-3">
<li class="list-group-item">
<span class="fw-bold">Год производства:</span> ${movie.releaseDate}
</li>
<li class="list-group-item">
<span class="fw-bold">Страна:</span> ${movie.country}
</li>
<li class="list-group-item">
<span class="fw-bold">Слоган:</span> <span class="text-secondary">«${movie.tagline}»</span>
</li>
<li class="list-group-item">
<span class="fw-bold">Режиссер:</span> ${movie.director}
</li>
<li class="list-group-item">
<span class="fw-bold">Возраст:</span> ${movie.ageRating}
</li>
</ul>
`;
document.querySelector('#movieInfoContainer').innerHTML = movieInfoTemplate;
}
export default loadMovieData;