-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseason.js
More file actions
30 lines (24 loc) · 1.09 KB
/
Copy pathseason.js
File metadata and controls
30 lines (24 loc) · 1.09 KB
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
(function () {
const currentSeasonContainer = document.getElementById('current-season');
fetch('https://api.jikan.moe/v4/seasons/now')
.then(response => response.json())
.then(data => {
const currentSeasonList = data.data.slice(0, 10);
currentSeasonList.forEach(anime => {
const animeCard = document.createElement('div');
animeCard.className = 'anime-card';
const animeImage = document.createElement('img');
animeImage.src = anime.images.webp.image_url;
animeImage.alt = anime.title;
const animeTitle = document.createElement('h3');
animeTitle.textContent = anime.title;
const animeLink = document.createElement('a');
animeLink.href = `https://myanimelist.net/anime/${anime.mal_id}`;
animeLink.appendChild(animeImage);
animeLink.appendChild(animeTitle);
animeCard.appendChild(animeLink);
currentSeasonContainer.appendChild(animeCard);
});
})
.catch(error => console.error('Error fetching data:', error));
})();