replaced gamification.coffee with gamification.js
This commit is contained in:
parent
b2b1d9594b
commit
3929fc3fd8
2 changed files with 26 additions and 36 deletions
|
@ -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()
|
26
content/assets/scripts/gamification.js
Normal file
26
content/assets/scripts/gamification.js
Normal 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();
|
Loading…
Reference in a new issue