Internet-programming-Pibd-2.../js/script.js
2023-12-07 22:24:21 +04:00

24 lines
897 B
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.

const movieCards = document.querySelectorAll('.movie-card');
// Добавляем обработчик события нажатия для каждой карточки фильма
movieCards.forEach(card => {
const link = card.querySelector('.movie-link');
const kinopoiskId = card.dataset.kinopoiskId;
card.addEventListener('click', () => {
// Формируем новый URL с использованием ID Кинопоиска
const redirectUrl = `https://kinopoisk-watch-dsze5.ondigitalocean.app/player/?id=${kinopoiskId}`;
// Перенаправляем пользователя на полученный URL
window.location.href = redirectUrl;
});
});
$(document).ready(function () {
var url = window.location.href;
$('.navbar-nav a').filter(function () {
return this.href == url;
}).addClass('active');
});