-
Notifications
You must be signed in to change notification settings - Fork 0
/
movie.html
101 lines (82 loc) · 3.61 KB
/
movie.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="icon" href="netflix-images/icon.png" type="image/png">
<title>Movie Details</title>
<link rel="stylesheet" href="movstyle.css">
</head>
<body>
<div class="nav" id="nav"><a href="index.html" class="href">
<img src="netflix-images/prime-logo.png" alt="" height="35px" class="nav_logo"></a>
</div>
<iframe src="" frameborder="0" scrolling="no" allowfullscreen id="video-frame"></iframe>
<div>
<h1 id="movieTitle" style="font-weight: bold; font-family: 'Poppins', sans-serif; padding-left: 20px;"></h1>
<div class="header-container" style="display: flex; justify-content: space-between;">
<div style="display: flex; align-items: center;">
<img class="HD" src="img/hd.png" onclick="changehd()" style="margin-bottom: 20px;margin-left: 23px;"/>
<img class="facebook-like" src="img/facebook-like.png" onclick="changeImage()" style="margin-bottom: 20px;margin-right: 13px;" /></div>
<a href="index.html" class="href">
<img src="img/home.png" style="margin-bottom: 20px;width: 140px;margin-right: 20px;"/>
</a>
</div>
</div>
<div class="movie-card">
<div class="movie-details" id="movieDetails"></div>
<img src="netflix-images/icon2.png" alt="Movie Poster" class="movie-poster" id="moviePoster">
</div>
<script>
function changeImage() {
var likeImage = document.querySelector('.facebook-like');
var currentSrc = likeImage.src;
if (currentSrc.includes('facebook-like')) {
likeImage.src = 'img/like.png';
} else {
likeImage.src = 'img/facebook-like.png';
}
}
function changehd() {
var hdImage = document.querySelector('.HD');
var current = hdImage.src;
if (current.includes('hd')) {
hdImage.src = 'img/720.png';
} else {
hdImage.src = 'img/hd.png';
}
}
// Extract the movie title from the URL
const urlParams = new URLSearchParams(window.location.search);
const title = urlParams.get('title');
// Set the movie title on the page
document.getElementById('movieTitle').innerText = title;
// Fetch data from OMDB API
fetch(`https://www.omdbapi.com/?apikey=2aaa3017&t=${encodeURIComponent(title)}`)
.then(response => response.json())
.then(data => {
// Display movie details
const detailsDiv = document.getElementById('movieDetails');
const posterImg = document.getElementById('moviePoster');
// Set poster image
posterImg.src = data.Poster;
// Separate IMDb ID
const imdbID = data.imdbID;
const keysToShow = ['Year', 'Released', 'Runtime', 'Genre', 'Director', 'Writer', 'Actors', 'Plot', 'Language'];
keysToShow.forEach(key => {
if (data[key] && data[key] !== 'N/A') {
const detail = document.createElement('p');
detail.innerHTML = `<strong>${key}:</strong> ${data[key]}`;
detailsDiv.appendChild(detail);
}
});
const iframeSrc = `https://www.2embed.cc/embed/${imdbID}`;
document.getElementById('video-frame').setAttribute('src', iframeSrc);
})
.catch(error => {
console.error('Error fetching data from OMDB:', error);
});
</script>
</body>
</html>