-
Notifications
You must be signed in to change notification settings - Fork 0
/
movie-details.html
131 lines (127 loc) · 7.41 KB
/
movie-details.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="script.js"></script>
<title>Movies Database</title>
</head>
<nav class="navbar navbar-expand-lg bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="https://dhirajmokal13.github.io/movie-website/movie.html">Box Office</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="https://dhirajmokal13.github.io/movie-website/movie.html">Home</a>
</li>
</ul>
<form class="d-flex" role="search">
<input class="form-control me-2" placeholder="Search Movie">
<button class="btn btn-outline-success" id="search">Search</button>
</form>
</div>
</div>
</nav>
<div class="container d-flex align-items-center justify-content-center my-4">
<div class="card"
style="width: 24rem; box-shadow:0 10px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19) !important;">
<img src="" id="Poster" class="card-img-top" alt="Image not found" loading="lazy">
<div class="card-body">
<h5 class="card-title" id="title"></h5>
<p class="card-text" id="ryear"><span class="text-success">Released</span>: </p>
<p class="card-text" id="type"><span class="text-success">Type</span>: </p>
<p class="card-text" id="totalSeasons"></p>
<p class="card-text" id="genre"><span class="text-success">Genre</span>: </p>
<p class="card-text" id="rtime"><span class="text-success">Run Time</span>: </p>
<p class="card-text" id="lang"><span class="text-success">Languages</span>: </p>
<p class="card-text" id="rated"><span class="text-success">Rated</span>: </p>
<p class="card-text" id="actors"><span class="text-success">Actors</span>: </p>
<p class="card-text" id="awards"><span class="text-success">Awards</span>: </p>
<p class="card-text" id="coll"></p>
<p class="card-text" id="country"><span class="text-success">Country</span>: </p>
<p class="card-text" id="dvd"></p>
<p class="card-text" id="director"><span class="text-success">Director</span>: </p>
<p class="card-text" id="metascore"><span class="text-success">Metascore</span>: </p>
<p class="card-text" id="production"></p>
<p class="card-text" id="website"></p>
<p class="card-text" id="writer"><span class="text-success">Writer</span>: </p>
<p class="card-text" id="rating"><span class="text-success">Imdb Rating</span>: </p>
<p class="card-text" id="votes"><span class="text-success">Imdb Votes</span>: </p>
<p class="card-text" id="ratings"><span class="text-success">Rating</span>: </p>
<p class="card-text" id="plot"><span class="text-success">Plot</span>: </p>
</div>
</div>
</div>
<body>
<script>
function idSelect(se) {
return document.getElementById(se);
}
function addText(txt) {
return document.createTextNode(txt);
}
let url = new URL(window.location.href);
let movie_id = url.searchParams.get("movie-id");
fetch(`http://www.omdbapi.com/?apikey=${key}&i=${movie_id}&plot=full`).then(res => res.json()).
then(data => {
if (data["Poster"] === "N/A") {
data["Poster"] = 'https://previews.123rf.com/images/kaymosk/kaymosk1804/kaymosk180400006/100130939-error-404-page-not-found-error-with-glitch-effect-on-screen-vector-illustration-for-your-design-.jpg';
}
idSelect("Poster").src = data["Poster"];
idSelect("title").innerHTML = data["Title"];
if (data['totalSeasons']) {
idSelect("totalSeasons").innerHTML = "<span class='text-success'>Total Seasons</span>: " + data["totalSeasons"];
}
if (data["BoxOffice"]) {
idSelect("coll").innerHTML = '<span class="text-success">Boxoffice</span>: ' + data["BoxOffice"];
}
if (data["DVD"]) {
idSelect("dvd").innerHTML = '<span class="text-success">DVD</span>: ' + data["DVD"];
}
if (data["Production"]) {
idSelect("production").innerHTML = '<span class="text-success">Production</span>: ' + data["Production"];
}
if (data["Website"]) {
idSelect("website").innerHTML = '<span class="text-success">Website</span>: ' + data["Website"];
}
idSelect("ryear").appendChild(addText(data["Released"]));
idSelect("type").appendChild(addText(data["Type"]));
idSelect("genre").appendChild(addText(data["Genre"]));
idSelect("rated").appendChild(addText(data["Rated"]));
idSelect("rtime").appendChild(addText(data["Runtime"]));
idSelect("lang").appendChild(addText(data["Language"]));
idSelect("actors").appendChild(addText(data["Actors"]));
idSelect("awards").appendChild(addText(data["Awards"]));
idSelect("country").appendChild(addText(data["Country"]));
idSelect("director").appendChild(addText(data["Director"]));
idSelect("metascore").appendChild(addText(data["Metascore"]));
idSelect("plot").appendChild(addText(data["Plot"]));
idSelect("writer").appendChild(addText(data["Writer"]));
idSelect("rating").appendChild(addText(data["imdbRating"] + "/10"));
idSelect("votes").appendChild(addText(data["imdbVotes"]));
for (i = 0; i < data["Ratings"].length; i++) {
let Rating = data["Ratings"][i]["Source"] + " " + data["Ratings"][i]["Value"];
idSelect("ratings").appendChild(addText(Rating + " "));
}
}).catch(err => {
console.error(err);
})
idSelect("search").addEventListener("click", (e) => {
e.preventDefault();
window.location.href = "https://dhirajmokal13.github.io/movie-website/movie.html";
})
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2"
crossorigin="anonymous"></script>
</body>
</html>