replaced gamification.coffee with gamification.js

This commit is contained in:
fklinck 2018-12-19 22:06:35 +01:00
parent b2b1d9594b
commit 3929fc3fd8
2 changed files with 26 additions and 36 deletions

View file

@ -1,36 +0,0 @@
request = new XMLHttpRequest
request.open 'GET', 'https://zeus.ugent.be/game/top4/show.json', true
request.onload = ->
if request.status >= 200 and request.status < 400
# Success!
data = JSON.parse(request.responseText)
str = "<table>"
for x in data
str += """
<tr>
<td class="picture">
<img class="coder-picture" src="#{x.avatar_url}">
</td>
<td class="name">
<a class="coder-name" href="#{x.github_url}">#{x.github_name}</a>
</td>
<td class="score">
#{x.score}
</td>
</tr>
"""
str += "</table>"
el = document.getElementById('gamification-coders')
el.innerHTML = str
else
# We reached our target server, but it returned an error
return
request.onerror = ->
# There was a connection error of some sort
return
request.send()

View file

@ -0,0 +1,26 @@
var request;
request = new XMLHttpRequest;
request.open('GET', 'https://zeus.ugent.be/game/top4/show.json', true);
request.onload = function() {
var data, el, i, len, str, x;
if (request.status >= 200 && request.status < 400) {
data = JSON.parse(request.responseText);
str = "<table>";
for (i = 0, len = data.length; i < len; i++) {
x = data[i];
str += "<tr>\n <td class=\"picture\">\n <img class=\"coder-picture\" src=\"" + x.avatar_url + "\">\n </td>\n <td class=\"name\">\n <a class=\"coder-name\" href=\"" + x.github_url + "\">" + x.github_name + "</a>\n </td>\n <td class=\"score\">\n " + x.score + "\n </td>\n</tr>";
}
str += "</table>";
el = document.getElementById('gamification-coders');
el.innerHTML = str;
} else {
}
};
request.onerror = function() {};
request.send();