This repository was archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdlc.js
More file actions
50 lines (38 loc) · 1.9 KB
/
dlc.js
File metadata and controls
50 lines (38 loc) · 1.9 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Function to fetch and render DLC items
async function renderDlcItems() {
const response = await fetch('dlc-items.json');
const dlcItems = await response.json();
const container = document.getElementById('dlc-container');
const categories = new Set(dlcItems.map(item => item.category));
categories.forEach(category => {
const categoryHeader = document.createElement('h2');
categoryHeader.id = category.toLowerCase();
categoryHeader.textContent = category;
container.appendChild(categoryHeader);
dlcItems
.filter(item => item.category === category)
.forEach(item => {
const dlcElement = document.createElement('a');
dlcElement.setAttribute('href', `checkout.html?name=${item.name}`);
dlcElement.id = 'box-link';
const divElement = document.createElement('div');
const h4Element = document.createElement('h4');
h4Element.id = 'title';
h4Element.textContent = item.name;
const dateP = document.createElement('p');
dateP.textContent = `Updated ${item.date}`;
const descriptionP = document.createElement('p');
descriptionP.innerHTML = item.description;
const compatibilityP = document.createElement('p');
compatibilityP.textContent = `Compatible with Sonic: Lock & Load ${item.compatibility}.`;
divElement.appendChild(h4Element);
divElement.appendChild(dateP);
divElement.appendChild(descriptionP);
divElement.appendChild(compatibilityP);
dlcElement.appendChild(divElement);
container.appendChild(dlcElement);
});
});
}
// Call the function to render DLC items
renderDlcItems();