-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
60 lines (48 loc) · 2.14 KB
/
script.js
File metadata and controls
60 lines (48 loc) · 2.14 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
51
52
53
54
55
56
57
58
59
60
async function fetchData() {
const response = await fetch('https://ymanagement.mefi.workers.dev');
const data = await response.json();
displayData(data);
}
function displayData(data) {
const versionsContainer = document.getElementById('versions');
const changelogContainer = document.getElementById('changelog');
for (const [key, value] of Object.entries(data)) {
if (key !== 'Latest_Changelog') {
const versionDiv = document.createElement('div');
versionDiv.className = 'version';
const versionTitle = document.createElement('span');
versionTitle.textContent = key.replace(/_/g, ' ');
versionDiv.appendChild(versionTitle);
if (value.error) {
versionDiv.appendChild(document.createTextNode(value.error));
} else {
const createLink = (text, url) => {
const link = document.createElement('a');
link.textContent = text;
link.href = url;
link.target = '_blank';
link.className = 'button-link';
return link;
};
const link1 = createLink('Download', value.Link_1);
const link2 = createLink('Mirror', value.Link_2);
// const mirror = createLink('Mirror 2', value.Mirror);
versionDiv.appendChild(link1);
versionDiv.appendChild(document.createTextNode(' '));
if (window.innerWidth >= 400) {
versionDiv.appendChild(link2);
versionDiv.appendChild(document.createTextNode(' '));
}
// versionDiv.appendChild(document.createTextNode(' '));
// versionDiv.appendChild(mirror);
if (key === 'Wave_Patched') {
versionDiv.classList.add('wave');
}
}
versionsContainer.appendChild(versionDiv);
}
}
const latestChangelog = data.Latest_Changelog.Patched_Changelogs;
changelogContainer.textContent = `${latestChangelog}`;
}
fetchData();