-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
78 lines (64 loc) · 3.32 KB
/
index.js
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
window.onload = function()
{
const xhttp = new XMLHttpRequest();
xhttp.onload = function()
{
var json = JSON.parse(this.responseText)["cards"];
var element = document.getElementById("cards");
for (var i = 0; i < json.length; i++) {
var data_global = json[i];
var card = document.createElement("div");
card.className = "card shadow";
card.innerHTML =
'<img class="rounded" src="' + data_global["img"] + '">\
<h6 class="text-center m-4">' + data_global["title"] + '</h6>';
card.onclick = function()
{
$('#modal').modal('show');
for (var i = 0; i < json.length; i++) {
var data = json[i];
if (data["title"] != this.getElementsByTagName("h6")[0].innerText) {
continue;
}
document.getElementById("title").innerText = this.getElementsByTagName("h6")[0].innerText;
document.getElementById("image").src = data["img"];
$.getJSON("posts/" + data["post"], function(json)
{
const features = json["features"];
const features_element = document.getElementById("features");
features_element.innerHTML = "";
for (var i = 0; i < features.length; i++)
features_element.innerHTML += '<button class="btn btn-' + (features[i]["status"] ? 'success' : 'danger') + ' m-1">' + features[i]["name"] + '</button>';
const changelog = json["changelog"];
const changelog_element = document.getElementById("changelog");
changelog_element.innerHTML = "";
for (var i = 0; i < changelog.length; i++) {
const changelog_id = "changelog_" + i;
var changelog_changes = "";
for (var j = 0; j < changelog[i]["changes"].length; j++)
changelog_changes += '<li>' + changelog[i]["changes"][j] + '</li>';
changelog_element.innerHTML +=
'<a class="btn btn-dark" data-bs-toggle="collapse" href="#' + changelog_id + '">' +
changelog[i]["date"] +
'</a>\
<div class="collapse" id="' + changelog_id + '">\
<div class="container-fluid m-1">\
<ul>' +
changelog_changes;
'</ul>\
</div>\
</div>'
document.getElementById("download").onclick = function ()
{
window.open("https://github.com/Wyxather/Orion-Portal/releases/download/" + json["download"] + "/Orion-Internal.dll");
}
}
});
}
}
element.appendChild(card);
}
}
xhttp.open("GET", "cards.json");
xhttp.send();
}