Internet-programming-Pibd-2.../script.js
2023-12-01 11:17:36 +04:00

23 lines
896 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');
});