-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
180 lines (161 loc) · 7.18 KB
/
index.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!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">
<title>WatchMovie.ts</title>
<meta name="description" content="A website that converts Youtube videos into mp3 files. Made using Next.js">
<link rel="icon" href="/favicon.ico">
<!-- External CSS library (Tailwind CSS) -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<style>
body {
margin: 0;
overflow: hidden;
background-color: #000;
}
canvas {
display: block;
width: 100%;
height: 100vh;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
</style>
</head>
<body>
<div class="flex justify-center items-center flex-col pt-40 text-center font-bold lg:text-8xl text-6xl space-y-2">
<h1 class="text-white pb-10">
Watch <span class="text-red-400">Movies</span> From
<span class="text-red-400"> IMDB</span>
</h1>
</div>
<div class="flex justify-center items-center flex-col text-center">
<h6 class="text-white pb-10">
Just Enter the <span class="text-blue-400">Title</span> of the
<span class="text-blue-400"> Movie</span>
</h6>
</div>
<br>
<center>
<div class="w-full max-w-xs">
<form class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<div class="mb-4">
<input class="shadow appearance-none border rounded w-full py-2 px-3 text-white-700 leading-tight focus:outline-none focus:shadow-outline" id="search-input" type="text" placeholder="Search for a movie" autocomplete="off">
</div>
<div class="flex items-center justify-between">
<button
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
type="button" onclick="fetchAndShow()">
Search
</button>
</div>
</form>
</div>
</center>
<br>
<br>
<div id="movieResults" class="flex justify-center flex-wrap"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script>
// Three.js scene setup
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// Geometry and material for particles
const starGeometry = new THREE.BufferGeometry();
const starMaterial = new THREE.PointsMaterial({ color: 0xffffff });
const starVertices = [];
for (let i = 0; i < 1000; i++) {
const x = (Math.random() - 0.5) * 2000;
const y = (Math.random() - 0.5) * 2000;
const z = -Math.random() * 2000;
starVertices.push(x, y, z);
}
starGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starVertices, 3));
const stars = new THREE.Points(starGeometry, starMaterial);
scene.add(stars);
// Animation loop
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
// Show the body element and start animation after resources load
window.onload = function() {
document.body.style.display = "block";
animate();
};
</script>
<script>
function fetchAndShow() {
const query = encodeURIComponent(document.getElementById("search-input").value);
const url = `https://api.themoviedb.org/3/search/movie?api_key=b6b677eb7d4ec17f700e3d4dfc31d005&query=${query}`;
fetch(url)
.then(response => response.json())
.then(data => {
const results = data.results;
const movieResults = document.getElementById("movieResults");
movieResults.innerHTML = "";
results.forEach(result => {
const resultElem = document.createElement("div");
resultElem.classList.add("movieResult");
resultElem.setAttribute("IMDB", result.id);
const imageAndInfo = `
<div onclick="setUrl(this)">
<img src="https://image.tmdb.org/t/p/w500${result.poster_path}" alt="${result.title}">
<h3>${result.title}</h3>
<p>${result.release_date}</p>
</div>
`;
resultElem.innerHTML = imageAndInfo;
movieResults.appendChild(resultElem);
});
})
.catch(error => console.error('Error fetching and displaying movie data:', error));
}
function closePopUpAds() {
let elements = document.getElementsByTagName("*");
for (let element of elements) {
if (element.style.position === "absolute" && element.style.right === "0" && element.style.top === "0" && element.textContent === "X") {
element.click();
break;
}
}
}
function setUrl(element) {
const imdbId = element.parentElement.getAttribute("IMDB");
const url = `https://player.smashy.stream/movie/${imdbId}`;
const iframe = document.createElement("iframe");
iframe.setAttribute("src", url);
iframe.style.border = "none";
iframe.setAttribute("allowfullscreen", "");
const screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
const maxWidth = screenWidth;
const maxHeight = screenHeight * 0.8;
const aspectRatio = 16 / 9;
let playerWidth, playerHeight;
if ((maxWidth / maxHeight) > aspectRatio) {
// Height is the constraining factor
playerHeight = maxHeight;
playerWidth = playerHeight * aspectRatio;
} else {
playerWidth = maxWidth;
playerHeight = playerWidth / aspectRatio;
}
iframe.style.width = playerWidth + "px";
iframe.style.height = playerHeight + "px";
const body = document.querySelector("body");
body.innerHTML = "";
body.appendChild(iframe);
// Call the function to close pop-up ads every second
setInterval(closePopUpAds, 1000);
}
</script>
</body>
</html>