-
Notifications
You must be signed in to change notification settings - Fork 2
/
home.php
498 lines (419 loc) · 12.9 KB
/
home.php
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
<?php
require 'tohost.php';
// Base URL for API
define('BASE_API_URL', 'https://yourapi.com');
// Endpoint for the homepage data
$endpoint = '/api/v2/hianime/home';
$apiUrl = BASE_API_URL . $endpoint;
// Fetch data from API
$response = file_get_contents($apiUrl);
$data = json_decode($response, true);
if (!$data || !$data['success']) {
die("Failed to fetch anime data.");
}
$data = $data['data'];
// Set the default date to today
$date = date('Y-m-d'); // Format: yyyy-mm-dd
// Fetch schedules from the API
$scheduleEndpoint = "/api/v2/hianime/schedule?date=$date";
$scheduleApiUrl = BASE_API_URL . $scheduleEndpoint;
$scheduleResponse = file_get_contents($scheduleApiUrl);
$scheduleData = json_decode($scheduleResponse, true);
if ($scheduleData && $scheduleData['success']) {
$scheduledAnimes = $scheduleData['data']['scheduledAnimes'];
} else {
$scheduledAnimes = []; // Fallback if the API request fails
}
include 'header.html';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anito - Home</title>
<link rel="stylesheet" href="styles.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
/* Base Styles */
body {
background: #202125;
font-family: 'Montserrat', Arial, sans-serif;
color: #fff;
margin: 0;
padding: 0;
-webkit-text-size-adjust: none;
}
h2 {
font-size: 1.8em;
font-weight: 600;
color: #7f00ff;
margin-bottom: 20px;
text-align: center;
}
h3 {
font-size: 1.2em;
font-weight: 600;
color: #fff;
margin-bottom: 10px;
}
/* Main Container */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.section {
margin-bottom: 50px;
}
/* Anime Grid */
.anime-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
padding: 0;
margin: 0;
list-style: none;
}
/* Anime Card */
.anime-card {
background: #333;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
position: relative;
text-decoration: none;
}
.anime-card:hover {
transform: translateY(-5px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}
.anime-card img {
width: 100%;
height: auto;
display: block;
}
.card-info {
padding: 15px;
}
.card-info h3 {
font-size: 1.1em;
color: #fff;
margin-bottom: 5px;
}
.card-info p {
font-size: 0.9em;
color: #aaa;
}
/* Spotlight Anime Section */
/* General Styles */
body {
background: #202125;
font-family: 'Montserrat', Arial, sans-serif;
color: #fff;
margin: 0;
padding: 0;
-webkit-text-size-adjust: none;
}
/* Spotlight Slideshow Section */
.spotlight-slideshow {
position: relative;
width: 100%;
max-width: 1200px;
margin: 0 auto;
overflow: hidden;
}
.slideshow-container {
display: flex;
transition: transform 0.5s ease-in-out;
}
.slide {
min-width: 100%;
box-sizing: border-box;
position: relative;
}
.slide-image {
width: 100%;
height: auto;
display: block;
object-fit: cover;
}
.slide-content {
position: absolute;
bottom: 30px;
left: 20px;
color: white;
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
}
.slide-content h3 {
font-size: 1.5em;
font-weight: 600;
margin-bottom: 10px;
}
.watch-now-btn {
background-color: #7f00ff;
color: #fff;
padding: 10px 20px;
border-radius: 20px;
text-decoration: none;
font-weight: 600;
transition: background-color 0.3s ease;
}
.watch-now-btn:hover {
background-color: #5900b3;
}
/* Navigation Buttons - Box Style */
.navigation {
position: absolute;
top: 50%;
width: 100%;
display: flex;
justify-content: space-between;
transform: translateY(-50%);
}
.prev, .next {
background-color: rgba(0, 0, 0, 0.3);
color: #fff;
padding: 5px 15px; /* Smaller padding */
border-radius: 5px; /* Box-style with sharp corners */
font-size: 10px; /* Smaller font size */
font-weight: 600;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
border: 2px solid #fff; /* Optional: Adds a border to make it more boxy */
}
/* Hover effect for box buttons */
.prev:hover, .next:hover {
background-color: rgba(0, 0, 0, 0.8);
transform: scale(1.1); /* Slightly enlarge the button on hover */
}
/* Focused Button Style */
.prev:focus, .next:focus {
outline: none;
box-shadow: 0 0 0 2px #7f00ff; /* Optional: add focus outline for accessibility */
}
/* Additional Styles for Content */
h2 {
font-size: 1.8em;
font-weight: 600;
color: #7f00ff;
margin-bottom: 20px;
text-align: center;
}
.anime-grid, .schedule-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
padding: 0;
margin: 0;
}
/* Responsive Styles */
@media (max-width: 767px) {
.anime-grid, .schedule-grid {
grid-template-columns: 1fr 1fr;
}
.spotlight-slideshow {
max-width: 100%;
}
.slide-content h3 {
font-size: 1.5em;
}
}
/* Schedule Grid */
.schedule-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
padding: 0;
}
.schedule-card {
background: #333;
border-radius: 8px;
padding: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
text-align: center;
}
.schedule-card:hover {
transform: translateY(-5px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}
.schedule-card h3 {
font-size: 1.2em;
font-weight: 600;
color: #fff;
margin-bottom: 10px;
}
.schedule-card p {
font-size: 0.9em;
color: #aaa;
margin-bottom: 10px;
}
.schedule-card .view-details {
color: #7f00ff;
font-weight: 600;
text-decoration: none;
padding: 5px 10px;
border: 1px solid #7f00ff;
border-radius: 20px;
transition: background-color 0.3s ease, color 0.3s ease;
}
.schedule-card .view-details:hover {
background-color: #7f00ff;
color: #fff;
}
.schedule-card .view-details:active {
background-color: #5900b3;
}
/* Centered Text in Estimated Schedules Section */
.schedule-grid h2 {
text-align: center;
font-size: 1.8em;
font-weight: 600;
color: #7f00ff;
margin-bottom: 30px;
}
/* Animation Keyframes */
@keyframes fadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes fadeInUp {
0% { opacity: 0; transform: translateY(20px); }
100% { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
0% { transform: translateX(-100%); }
100% { transform: translateX(0); }
}
@keyframes scaleUp {
0% { transform: scale(0.8); opacity: 0; }
100% { transform: scale(1); opacity: 1; }
}
@media (max-width: 767px) {
.anime-grid, .schedule-grid {
grid-template-columns: 1fr 1fr;
}
}
</style>
</head>
<body>
<main class="container">
<!-- Spotlight Anime Slideshow -->
<section class="spotlight-slideshow">
<div class="slideshow-container">
<?php foreach ($data['spotlightAnimes'] as $anime): ?>
<div class="slide">
<img src="<?= $anime['poster'] ?>" alt="<?= htmlspecialchars($anime['name']) ?>" class="slide-image">
<div class="slide-content">
<h3><?= htmlspecialchars($anime['name']) ?></h3>
<a href="anime-info.php?animeId=<?= $anime['id'] ?>" class="watch-now-btn">Watch Now</a>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="navigation">
<span class="prev">❮</span>
<span class="next">❯</span>
</div>
</section>
<!-- Latest Anime Episodes -->
<section class="section">
<h2>Latest Anime Episodes</h2>
<div class="anime-grid">
<?php foreach ($data['latestEpisodeAnimes'] as $anime): ?>
<a href="anime-info.php?animeId=<?= $anime['id'] ?>" class="anime-card">
<img src="<?= $anime['poster'] ?>" alt="<?= htmlspecialchars($anime['name']) ?>">
<div class="card-info">
<h3><?= htmlspecialchars($anime['name']) ?></h3>
<p>Sub: <?= $anime['episodes']['sub'] ?> | Dub: <?= $anime['episodes']['dub'] ?></p>
</div>
</a>
<?php endforeach; ?>
</div>
</section>
<!-- Estimated Schedules Section -->
<?php
// Convert seconds into hours and minutes
$totalSeconds = $anime['secondsUntilAiring'];
$hours = floor($totalSeconds / 3600); // Get the full hours
$minutes = floor(($totalSeconds % 3600) / 60); // Get the remaining minutes
// Format the output
$formattedTime = sprintf("%02d:%02d", $hours, $minutes);
// Get today's date
$today = date('Y-m-d');
// Calculate next day's date
$nextDay = date('Y-m-d', strtotime('+1 day', strtotime($today)));
?>
<section class="section">
<center><h2>Estimated Schedules (<?= htmlspecialchars($date) ?>)</h2></center>
<div class="schedule-grid">
<?php if (!empty($scheduledAnimes)): ?>
<?php foreach ($scheduledAnimes as $anime): ?>
<div class="schedule-card">
<h3><?= htmlspecialchars($anime['name']) ?></h3>
<p><strong>Japanese Name:</strong> <?= htmlspecialchars($anime['jname']) ?></p>
<!-- Convert airing time to 12-hour format -->
<?php
$airingTime = $anime['time']; // Assuming airing time is in 24-hour format (e.g., "14:30", "09:15")
$airingTime12Hour = date('g:i A', strtotime($airingTime)); // Convert to 12-hour format
?>
<p><strong>Airing Time:</strong> <?= $airingTime12Hour ?></p>
<!-- Format the remaining time until airing -->
<?php
// Convert seconds to hours and minutes
$secondsUntilAiring = $anime['secondsUntilAiring'];
$hours = floor($secondsUntilAiring / 3600);
$minutes = floor(($secondsUntilAiring % 3600) / 60);
$formattedTime = sprintf("%02d:%02d", $hours, $minutes); // Format as HH:MM
?>
<p><strong>Time Until Airing:</strong> <?= $formattedTime ?> (HH:MM)</p>
<a href="anime-info.php?animeId=<?= $anime['id'] ?>" class="view-details">View Details</a>
</div>
<?php endforeach; ?>
<?php else: ?>
<p>No schedules available for <?= htmlspecialchars($date) ?>.</p>
<?php endif; ?>
</div>
<!-- Button to View Next Day's Schedule -->
<!--<div class="next-day-button">-->
<!-- <a href="schedule.php?date=<?= $nextDay ?>" class="button">View Next Day's Schedule</a>-->
<!--</div>-->
</section>
</main>
<script>
let currentSlide = 0;
const slides = document.querySelectorAll('.slide');
const totalSlides = slides.length;
const nextBtn = document.querySelector('.next');
const prevBtn = document.querySelector('.prev');
const slideshowContainer = document.querySelector('.slideshow-container');
// Function to move to the next slide
function nextSlide() {
currentSlide = (currentSlide + 1) % totalSlides;
updateSlidePosition();
}
// Function to move to the previous slide
function prevSlide() {
currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
updateSlidePosition();
}
// Function to update slide position
function updateSlidePosition() {
const offset = -currentSlide * 100; // Each slide takes up 100% width
slideshowContainer.style.transform = `translateX(${offset}%)`;
}
// Auto slide every 5 seconds
setInterval(nextSlide, 5000);
// Event listeners for next and previous buttons
nextBtn.addEventListener('click', nextSlide);
prevBtn.addEventListener('click', prevSlide);
// Initialize the slideshow
updateSlidePosition();
</script>
<?php include 'footer.html'; ?>
</body>
</html>