-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (36 loc) · 1.23 KB
/
index.html
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
<!DOCTYPE html>
<html>
<body>
<h1>Code analyses dashboard</h1>
<ul id="analysesLinks"></ul>
<script>
init();
function init() {
loadJSON(function(response) {
var analyses = JSON.parse(response).analyses;
for (var i = 0; i < analyses.length; i++) {
var analysis = analyses[i];
var li = document.createElement("li");
var a = document.createElement("a");
a.href = analysis + "/index.html";
a.innerHTML = analysis;
li.appendChild(a);
document.getElementById("analysesLinks").appendChild(li);
}
});
}
function loadJSON(callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', 'analyses.json', true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
callback(xobj.responseText);
}
};
xobj.send(null);
}
</script>
</body>
</html>