-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathwatch.html
531 lines (471 loc) · 12.2 KB
/
watch.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anime Watching Page</title>
<style>
/* Dark Theme and Reset */
body {
margin: 0;
font-family: "Poppins", Arial, sans-serif;
background-color: #121212;
color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
/* Container Styling */
#container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-width: 1200px;
padding: 20px;
}
/* Responsive Iframe Container */
.iframe-container {
position: relative;
width: 100%;
max-width: 1000px;
padding-top: 56.25%;
margin-bottom: 30px;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Episodes Section */
#episodes {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
max-width: 400px;
max-height: 400px;
overflow-y: auto;
padding: 10px;
border-radius: 10px;
background-color: #1e1e1e;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
#episodes::-webkit-scrollbar {
width: 8px;
}
#episodes::-webkit-scrollbar-track {
background-color: #1e1e1e;
}
#episodes::-webkit-scrollbar-thumb {
background-color: #3f3f3f;
border-radius: 10px;
}
.episode-card {
display: flex;
align-items: center;
padding: 10px;
border-radius: 5px;
cursor: pointer;
background-color: #1e1e1e;
color: #ffffff;
transition: background-color 0.3s ease;
}
.episode-card:nth-child(odd) {
background-color: #1e1e1e;
}
.episode-card:nth-child(even) {
background-color: #2a2a2a;
}
.episode-card:hover {
background-color: #333333;
}
.episode-number {
font-size: 16px;
font-weight: bold;
color: #2d2d4f;
margin-right: 10px;
}
.episode-title {
font-size: 14px;
color: #b3b3b3;
}
.filler {
color: #ff6b6b;
}
/* Active Class with Vertical Line */
.episode-card.active {
background-color: #2d2d4f;
border-left: 4px solid #7354e7;
}
</style>
<header>
<!-- Navigation Bar -->
<nav class="navbar">
<!-- Toggle Button for Sidebar -->
<div class="bars" onclick="toggleMenu()">
<div class="bar1">
</div>
<div class="bar2">
</div>
<div class="bar3">
</div>
</div>
</nav>
<!-- Magnifying Glass Icon and Login Button -->
<div class="header-extras">
<div class="css-icon-search" onclick="redirectToPage()">
</div>
</div>
<style>/* Header Styling */
header {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 10;
background-color: transparent;
display: flex;
justify-content: space-between;
align-items: center;
padding: 1em;
}
/* Navbar (contains sidebar toggle) */
.navbar {
background-color: transparent;
display: flex;
align-items: center;
}
/* Sidebar Toggle (Hamburger) */
.bars {
margin-left: 10px;
cursor: pointer;
transition: transform 0.3s ease;
z-index: 101; /* Ensure it’s on top */
display: flex;
flex-direction: column;
}
.bar1, .bar2, .bar3 {
width: 25px;
height: 3px;
background-color: white;
margin: 5px 0;
transition: 0.4s;
}
/* Bars transform to X when open */
.bars.open .bar1 {
transform: rotate(45deg) translate(5px, 5px);
}
.bars.open .bar2 {
opacity: 0;
}
.bars.open .bar3 {
transform: rotate(-45deg) translate(5px, -5px);
}
/* Header Extras (Magnifying Glass & Login Button) */
.header-extras {
display: flex;
align-items: center;
gap: 15px;
position: absolute;
top: 1em;
right: 1em;
}
/* Magnifying Glass Icon */
.css-icon-search {
display: inline-block;
width: 12px;
height: 12px;
border: 2px solid white;
position: relative;
border-radius: 100%;
cursor: pointer;
}
.css-icon-search::before {
content: "";
display: inline-block;
position: absolute;
right: -7px;
bottom: -3px;
background: white;
width: 10px;
height: 2px;
transform: rotate(45deg);
}
/* Login Button */
.login {
background-color: blue;
padding: 12px 20px;
border-radius: 10px;
color: white;
cursor: pointer;
font-size: 15px;
transition: opacity 0.3s ease;
}
.login:hover {
opacity: 0.8;
}
.login:active {
opacity: 0.4;
}
/* Sidebar / Side Menu */
.side-menu {
position: fixed;
display: flex;
flex-direction: column;
top: 0;
left: 0;
height: 100vh;
width: 260px;
background-color: #2a2c31;
transform: translateX(-350px); /* Default: hidden */
overflow-y: auto;
gap: 1em;
z-index: 5;
transition: transform 500ms ease;
padding: 1em;
}
.side-menu.open {
transform: translateX(0); /* Visible when open */
}
@media only screen and (max-width: 860px) {
.side-menu {
width: 300px;
}
}
/* Close Button */
.close-button {
display: flex;
justify-content: center;
align-items: center;
background-color: #4a4b51;
border-radius: 20px;
width: 110px;
padding: 0.8em 0;
margin: 2em 0 0 1em;
line-height: 12px;
color: #fff;
font-weight: 500;
gap: 0.3em;
cursor: pointer;
}
/* Link Styling */
.nav-list .item a {
text-decoration: none; /* Remove underline */
color: inherit; /* Maintain the item's original color */
transition: color 0.3s ease; /* Smooth color transition */
}
.nav-list .item a:hover {
color: #f0f0f0; /* Hover effect for a slight lightening */
}
/* Sidebar List Styling */
.nav-list {
display: flex;
flex-direction: column;
margin-top: 0.5em;
margin-bottom: 1em;
}
.item {
display: flex;
flex-direction: column;
width: 100%;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
position: relative;
padding: 1em;
font-size: 14px;
font-weight: 600;
color: #fff;
}
/* Sidebar Item Hover Effect */
.item:hover {
background255, 255, 255, 0.1); /* Add a subtle background color on hover */
border-radius: 8px;
}
/* Genre List */
.genre-list {
display: flex;
flex-wrap: wrap;
font-size: 12px;
}
.genre-item {
padding: 6px 15px;
width: 49%;
margin-right: 1%;
cursor: pointer;
}
.genre-item:nth-of-type(7n + 1) { color: #d0e6a5; }
.genre-item:nth-of-type(7n + 2) { color: #ffdd95; }
.genre-item:nth-of-type(7n + 3) { color: #fc887b; }
.genre-item:nth-of-type(7n + 4) { color: #ccabda; }
.genre-item:nth-of-type(7n + 5) { color: #abccd8; }
.genre-item:nth-of-type(7n + 6) { color: #d8b2ab; }
.genre-item:nth-of-type(7n) { color: #86e3ce; }
/* Mobile Adjustments */
@media (max-width: 768px) {
.nav-links, .login {
display: none;
}
/* Hide search bar in mobile */
#search-bar {
display: none;
}
/* Sidebar Menu on Mobile */
.menu {
display: flex;
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 250px;
background-color: rgba(0, 0, 0, 0.9);
flex-direction: column;
align-items: flex-start;
padding: 2rem;
transform: translateX(-100%);
transition: transform 0.3s ease;
z-index: 100;
}
.menu.show {
transform: translateX(0);
}
.menu a,
.menu .login {
padding: 10px 0;
font-size: 20px;
color: white;
text-align: left;
}
.menu a:hover {
color: lightblue;
}
}
</style>
<script>
// Function to redirect the user to a new page
function redirectToPage() {
window.location.href = './search.html'; // Change this URL to your desired destination
}
</script>
</header>
<!-- Sidebar / Side Menu -->
<aside class="side-menu" id="sideMenu">
<!-- Close Button for Sidebar -->
<div class="close-button" onclick="toggleMenu()">
Close
</div>
<!-- Sidebar Items -->
<ul class="nav-list">
<li class="item">
<a href="./index.html">Home</a>
</li>
<li class="item">
<a href="./about.html">About</a>
</li>
<li class="item">
<a href="./contact.html">Contact</a>
</li>
<li class="item">
<a href="./bookmarks.html">Bookmarks</a>
</li>
<li class="item">
Genres
</li>
<div class="genre-list" id="genreList">
<!-- Genres will be populated here by JavaScript -->
</div>
</ul>
</aside>
<script>
// JavaScript to Toggle Sidebar
function toggleMenu() {
document.getElementById("sideMenu").classList.toggle("open");
document.querySelector(".bars").classList.toggle("open");
}
// Fetch Genres from API and Populate Sidebar
async function fetchGenres() {
try {
const response = await fetch('https://aniwatch-api-net.vercel.app/api/v2/hianime/home'); // Replace with your API URL
const result = await response.json();
if (result.success && result.data.genres) {
const genreList = document.getElementById('genreList');
genreList.innerHTML = ''; // Clear any existing content
result.data.genres.forEach((genre) => {
const genreItem = document.createElement('div');
genreItem.classList.add('genre-item');
genreItem.textContent = genre;
genreList.appendChild(genreItem);
});
} else {
console.error("Error: Unable to load genres");
}
} catch (error) {
console.error("Error fetching genres:", error);
}
}
// Load genres on page load
window.onload = fetchGenres;
</script>
</head>
<body>
<div id="container">
<!-- Anime Viewing Section -->
<div class="iframe-container">
<iframe id="animeIframe" src="about:blank" title="Anime Viewer"></iframe>
</div>
<div id="episodes"></div>
</div>
<script>
// Extract the anime ID from the URL
const urlParams = new URLSearchParams(window.location.search);
const animeId = urlParams.get("id") || "defaultAnimeId";
// Correct API URL for fetching episodes
const apiUrl = `https://aniwatch-api-net.vercel.app/api/v2/hianime/anime/${animeId}/episodes`;
// Fetch and populate episodes
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
if (data.success) {
const episodesContainer = document.getElementById("episodes");
data.data.episodes.forEach((episode, index) => {
const episodeCard = document.createElement("div");
episodeCard.className = "episode-card";
episodeCard.innerHTML = `
<div class="episode-number">${episode.number}</div>
<div class="episode-title">${episode.title} ${
episode.isFiller ? '<span class="filler">(Filler)</span>' : ""
}</div>
`;
// Set active class on click
episodeCard.onclick = () => {
const iframe = document.getElementById("animeIframe");
iframe.src = `./player.html?id=${episode.episodeId}`;
document.querySelectorAll(".episode-card").forEach(card => card.classList.remove("active"));
episodeCard.classList.add("active");
};
episodesContainer.appendChild(episodeCard);
// Automatically set the first episode as active
if (index === 0) {
episodeCard.click();
}
});
} else {
console.error("Failed to load episodes");
}
})
.catch((error) => console.error("Error fetching data:", error));
</script>
</body>
</html>