Spaces:
Running
Running
Update 2.html
Browse files
2.html
CHANGED
@@ -83,6 +83,7 @@
|
|
83 |
overflow: hidden;
|
84 |
cursor: pointer;
|
85 |
transition: transform 0.3s;
|
|
|
86 |
}
|
87 |
|
88 |
.movie-card:hover {
|
@@ -116,6 +117,25 @@
|
|
116 |
font-weight: bold;
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
.footer {
|
120 |
background-color: #2a2a2a;
|
121 |
padding: 20px;
|
@@ -138,7 +158,6 @@
|
|
138 |
text-decoration: underline;
|
139 |
}
|
140 |
|
141 |
-
/* Mobile Responsiveness */
|
142 |
@media (max-width: 768px) {
|
143 |
.header h1 {
|
144 |
font-size: 1.5rem;
|
@@ -179,6 +198,11 @@
|
|
179 |
font-size: 20px;
|
180 |
margin: 20px 0 15px 0;
|
181 |
}
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
</style>
|
184 |
</head>
|
@@ -221,7 +245,6 @@
|
|
221 |
const searchInput = document.getElementById('searchInput');
|
222 |
const searchButton = document.getElementById('searchButton');
|
223 |
|
224 |
-
// Get trending movies
|
225 |
async function getTrendingMovies() {
|
226 |
try {
|
227 |
const response = await fetch(
|
@@ -236,7 +259,6 @@
|
|
236 |
}
|
237 |
}
|
238 |
|
239 |
-
// Search movies
|
240 |
async function searchMovies(query) {
|
241 |
try {
|
242 |
const response = await fetch(
|
@@ -251,7 +273,6 @@
|
|
251 |
}
|
252 |
}
|
253 |
|
254 |
-
// Display movies
|
255 |
function displayMovies(movies) {
|
256 |
movieGrid.innerHTML = '';
|
257 |
movies.forEach((movie) => {
|
@@ -267,19 +288,28 @@
|
|
267 |
<p>${movie.overview ? movie.overview.substring(0, 80) + '...' : 'No description available'}</p>
|
268 |
<div class="rating">★ ${movie.vote_average.toFixed(1)}</div>
|
269 |
</div>
|
|
|
270 |
`;
|
271 |
|
272 |
-
movieCard.addEventListener('click', () =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
movieGrid.appendChild(movieCard);
|
274 |
});
|
275 |
}
|
276 |
|
277 |
-
// Open movie details in a new tab
|
278 |
function openMovieDetails(movieId) {
|
279 |
-
window.
|
280 |
}
|
281 |
|
282 |
-
// Event listeners
|
283 |
searchButton.addEventListener('click', async () => {
|
284 |
const query = searchInput.value;
|
285 |
if (query) {
|
@@ -298,7 +328,6 @@
|
|
298 |
}
|
299 |
});
|
300 |
|
301 |
-
// Load trending movies on page load
|
302 |
window.addEventListener('load', async () => {
|
303 |
const trendingMovies = await getTrendingMovies();
|
304 |
displayMovies(trendingMovies);
|
|
|
83 |
overflow: hidden;
|
84 |
cursor: pointer;
|
85 |
transition: transform 0.3s;
|
86 |
+
position: relative;
|
87 |
}
|
88 |
|
89 |
.movie-card:hover {
|
|
|
117 |
font-weight: bold;
|
118 |
}
|
119 |
|
120 |
+
.quick-play-button {
|
121 |
+
position: absolute;
|
122 |
+
bottom: 10px;
|
123 |
+
right: 10px;
|
124 |
+
background-color: #007bff;
|
125 |
+
color: white;
|
126 |
+
padding: 8px 15px;
|
127 |
+
border-radius: 5px;
|
128 |
+
font-size: 12px;
|
129 |
+
opacity: 0;
|
130 |
+
transition: opacity 0.3s;
|
131 |
+
border: none;
|
132 |
+
cursor: pointer;
|
133 |
+
}
|
134 |
+
|
135 |
+
.movie-card:hover .quick-play-button {
|
136 |
+
opacity: 1;
|
137 |
+
}
|
138 |
+
|
139 |
.footer {
|
140 |
background-color: #2a2a2a;
|
141 |
padding: 20px;
|
|
|
158 |
text-decoration: underline;
|
159 |
}
|
160 |
|
|
|
161 |
@media (max-width: 768px) {
|
162 |
.header h1 {
|
163 |
font-size: 1.5rem;
|
|
|
198 |
font-size: 20px;
|
199 |
margin: 20px 0 15px 0;
|
200 |
}
|
201 |
+
|
202 |
+
.quick-play-button {
|
203 |
+
padding: 6px 12px;
|
204 |
+
font-size: 10px;
|
205 |
+
}
|
206 |
}
|
207 |
</style>
|
208 |
</head>
|
|
|
245 |
const searchInput = document.getElementById('searchInput');
|
246 |
const searchButton = document.getElementById('searchButton');
|
247 |
|
|
|
248 |
async function getTrendingMovies() {
|
249 |
try {
|
250 |
const response = await fetch(
|
|
|
259 |
}
|
260 |
}
|
261 |
|
|
|
262 |
async function searchMovies(query) {
|
263 |
try {
|
264 |
const response = await fetch(
|
|
|
273 |
}
|
274 |
}
|
275 |
|
|
|
276 |
function displayMovies(movies) {
|
277 |
movieGrid.innerHTML = '';
|
278 |
movies.forEach((movie) => {
|
|
|
288 |
<p>${movie.overview ? movie.overview.substring(0, 80) + '...' : 'No description available'}</p>
|
289 |
<div class="rating">★ ${movie.vote_average.toFixed(1)}</div>
|
290 |
</div>
|
291 |
+
<button class="quick-play-button" data-id="${movie.id}">Quick Play</button>
|
292 |
`;
|
293 |
|
294 |
+
movieCard.addEventListener('click', (e) => {
|
295 |
+
if (!e.target.classList.contains('quick-play-button')) {
|
296 |
+
openMovieDetails(movie.id);
|
297 |
+
}
|
298 |
+
});
|
299 |
+
|
300 |
+
movieCard.querySelector('.quick-play-button').addEventListener('click', (e) => {
|
301 |
+
e.stopPropagation();
|
302 |
+
window.location.href = `movie.html?id=${movie.id}#moviePlayer`;
|
303 |
+
});
|
304 |
+
|
305 |
movieGrid.appendChild(movieCard);
|
306 |
});
|
307 |
}
|
308 |
|
|
|
309 |
function openMovieDetails(movieId) {
|
310 |
+
window.location.href = `movie.html?id=${movieId}`;
|
311 |
}
|
312 |
|
|
|
313 |
searchButton.addEventListener('click', async () => {
|
314 |
const query = searchInput.value;
|
315 |
if (query) {
|
|
|
328 |
}
|
329 |
});
|
330 |
|
|
|
331 |
window.addEventListener('load', async () => {
|
332 |
const trendingMovies = await getTrendingMovies();
|
333 |
displayMovies(trendingMovies);
|