xinoooo commited on
Commit
63ce9b5
·
verified ·
1 Parent(s): 5e91e56

Update public/index.html

Browse files
Files changed (1) hide show
  1. public/index.html +55 -54
public/index.html CHANGED
@@ -4,57 +4,61 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Daftar Anime</title>
7
- <link rel="stylesheet" href="styles.css">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </head>
9
  <body>
10
 
11
- <!-- Navbar -->
12
- <div class="navbar">
13
- <div class="logo"><a href="index.html">Shienime</a></div>
14
- <div>
15
- <a href="index.html">Home</a>
16
- <a href="jadwal-rilis.html">Jadwal Rilis</a>
17
-
18
- <!-- Dark mode toggle switch -->
19
- <label class="dark-mode-toggle">
20
- <input type="checkbox" id="dark-mode-toggle">
21
- <span class="switch"></span>
22
- </label>
23
- </div>
24
- </div>
25
-
26
- <!-- Main Content -->
27
  <h1>Daftar Anime Terbaru</h1>
28
 
29
  <div id="anime-list" class="anime-list">
30
- <!-- Anime items will be dynamically added here -->
31
- </div>
32
-
33
- <!-- Footer -->
34
- <div class="footer">
35
- <p>&copy; 2024 Shienime. All rights reserved.</p>
36
  </div>
37
 
38
  <script>
39
  const apiUrl = "https://xinoooo-sme.hf.space/api/anime";
40
 
41
- // Check for saved dark mode preference in localStorage
42
- if (localStorage.getItem('darkMode') === 'enabled') {
43
- document.body.classList.add('dark-mode');
44
- document.querySelector('#dark-mode-toggle').checked = true;
45
- }
46
-
47
- // Toggle dark mode function
48
- const toggleDarkMode = () => {
49
- document.body.classList.toggle('dark-mode');
50
- const isDarkMode = document.body.classList.contains('dark-mode');
51
- localStorage.setItem('darkMode', isDarkMode ? 'enabled' : 'disabled');
52
- };
53
-
54
- // Add event listener to the dark mode toggle switch
55
- document.querySelector('#dark-mode-toggle').addEventListener('change', toggleDarkMode);
56
-
57
- // Fetch Anime List
58
  async function fetchAnimeList() {
59
  try {
60
  const response = await fetch(apiUrl);
@@ -64,32 +68,29 @@
64
  animeListContainer.innerHTML = "";
65
 
66
  animeList.forEach(anime => {
 
 
 
 
67
  const animeItem = document.createElement("div");
68
  animeItem.className = "anime-item";
69
 
70
  const Title = anime.title.replace(/ episode \d+/i, '');
71
- if (Title.includes("[BATCH]")) {
72
- return; // Skip this anime and don't display it
73
- }
74
- // Initial image placeholder (anime.image)
75
  const imgElement = document.createElement('img');
76
- imgElement.src = anime.image; // Initial image
77
  imgElement.alt = Title;
78
 
79
  animeItem.innerHTML = `
80
  <div class="anime-title">${Title}</div>
81
  <a href="list-episode.html?id=${anime.id}" class="anime-link">Check ${Title}</a>
82
  `;
83
-
84
- // Prepend the img element to the anime item
85
  animeItem.insertBefore(imgElement, animeItem.firstChild);
86
-
87
- // Fetch the real image from the server
88
- fetch(`https://xinoooo-sme.hf.space/anime/image/${anime.id}`)
89
- .then(response => response.blob()) // Get the image as a blob
90
  .then(imageBlob => {
91
- const imageUrl = URL.createObjectURL(imageBlob); // Convert blob to image URL
92
- imgElement.src = imageUrl; // Update the img src with the new image
93
  })
94
  .catch(error => {
95
  console.error('Error fetching image for anime:', error);
@@ -107,4 +108,4 @@
107
  </script>
108
 
109
  </body>
110
- </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Daftar Anime</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ background-color: #f4f4f9;
13
+ }
14
+ h1 {
15
+ text-align: center;
16
+ }
17
+ .anime-list {
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ gap: 20px;
21
+ justify-content: center;
22
+ }
23
+ .anime-item {
24
+ width: 200px;
25
+ text-align: center;
26
+ background: #fff;
27
+ border: 1px solid #ddd;
28
+ border-radius: 10px;
29
+ overflow: hidden;
30
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
31
+ }
32
+ .anime-item img {
33
+ width: 100%;
34
+ height: 120px;
35
+ object-fit: cover;
36
+ }
37
+ .anime-title {
38
+ padding: 10px;
39
+ font-weight: bold;
40
+ }
41
+ .anime-link {
42
+ color: #3498db;
43
+ text-decoration: none;
44
+ padding: 10px;
45
+ display: block;
46
+ }
47
+ .anime-link:hover {
48
+ text-decoration: underline;
49
+ }
50
+ </style>
51
  </head>
52
  <body>
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  <h1>Daftar Anime Terbaru</h1>
55
 
56
  <div id="anime-list" class="anime-list">
 
 
 
 
 
 
57
  </div>
58
 
59
  <script>
60
  const apiUrl = "https://xinoooo-sme.hf.space/api/anime";
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  async function fetchAnimeList() {
63
  try {
64
  const response = await fetch(apiUrl);
 
68
  animeListContainer.innerHTML = "";
69
 
70
  animeList.forEach(anime => {
71
+ if (anime.title.includes("[BATCH]")) {
72
+ return;
73
+ }
74
+
75
  const animeItem = document.createElement("div");
76
  animeItem.className = "anime-item";
77
 
78
  const Title = anime.title.replace(/ episode \d+/i, '');
79
+
 
 
 
80
  const imgElement = document.createElement('img');
81
+ imgElement.src = anime.image;
82
  imgElement.alt = Title;
83
 
84
  animeItem.innerHTML = `
85
  <div class="anime-title">${Title}</div>
86
  <a href="list-episode.html?id=${anime.id}" class="anime-link">Check ${Title}</a>
87
  `;
 
 
88
  animeItem.insertBefore(imgElement, animeItem.firstChild);
89
+ fetch(`https://xinoooo-sme.hf.space/api/anime/image/${anime.id}`)
90
+ .then(response => response.blob())
 
 
91
  .then(imageBlob => {
92
+ const imageUrl = URL.createObjectURL(imageBlob);
93
+ imgElement.src = imageUrl;
94
  })
95
  .catch(error => {
96
  console.error('Error fetching image for anime:', error);
 
108
  </script>
109
 
110
  </body>
111
+ </html>