PIbd-22_Shabunov_O.A._Inter.../js/videoplayer.js
2023-12-08 00:57:11 +04:00

37 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;