commit
35a91b473d
8 changed files with 81 additions and 66 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();
|
|
@ -1,10 +0,0 @@
|
|||
$ '.send'
|
||||
.click ->
|
||||
$context = $ this
|
||||
$.ajax
|
||||
url: "https://kelder.zeus.ugent.be/messages/",
|
||||
contentType: "text/plain",
|
||||
type: "POST"
|
||||
data: $('.chatbox').val()
|
||||
success: -> $('#chat-response').text('Success! :)')
|
||||
error: -> $('#chat-response').text('Error !1!')
|
16
content/assets/scripts/message.js
Normal file
16
content/assets/scripts/message.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
$('.send').click(function() {
|
||||
var $context;
|
||||
$context = $(this);
|
||||
return $.ajax({
|
||||
url: "https://kelder.zeus.ugent.be/messages/",
|
||||
contentType: "text/plain",
|
||||
type: "POST",
|
||||
data: $('.chatbox').val(),
|
||||
success: function() {
|
||||
return $('#chat-response').text('Success! :)');
|
||||
},
|
||||
error: function() {
|
||||
return $('#chat-response').text('Error !1!');
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
$ ->
|
||||
$.getJSON './quotes.json', (data) ->
|
||||
quote = data[Math.floor(Math.random()*data.length)]
|
||||
$('#quote').append("<h3>#{quote.title}</h3><p>#{quote.description}</p>")
|
7
content/assets/scripts/quote.js
Normal file
7
content/assets/scripts/quote.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
$(function() {
|
||||
return $.getJSON('./quotes.json', function(data) {
|
||||
var quote;
|
||||
quote = data[Math.floor(Math.random() * data.length)];
|
||||
return $('#quote').append("<h3>" + quote.title + "</h3><p>" + quote.description + "</p>");
|
||||
});
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
input_field = document.getElementById('tipue_search_input_field')
|
||||
input = document.getElementById('tipue_search_input')
|
||||
|
||||
input_field.addEventListener 'focusin', ->
|
||||
input.classList.add('focused')
|
||||
|
||||
input_field.addEventListener 'focusout', ->
|
||||
input.classList.remove('focused')
|
||||
|
||||
burger = document.getElementsByClassName('navbar-burger')[0]
|
||||
menu = document.getElementsByClassName('navbar-menu')[0]
|
||||
|
||||
burger.addEventListener 'click', ->
|
||||
s = 'is-active'
|
||||
if menu.classList.contains(s) then menu.classList.remove(s) else menu.classList.add(s)
|
||||
if burger.classList.contains(s) then burger.classList.remove(s) else burger.classList.add(s)
|
32
content/assets/scripts/search.js
Normal file
32
content/assets/scripts/search.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
var burger, input, input_field, menu;
|
||||
|
||||
input_field = document.getElementById('tipue_search_input_field');
|
||||
|
||||
input = document.getElementById('tipue_search_input');
|
||||
|
||||
input_field.addEventListener('focusin', function() {
|
||||
return input.classList.add('focused');
|
||||
});
|
||||
|
||||
input_field.addEventListener('focusout', function() {
|
||||
return input.classList.remove('focused');
|
||||
});
|
||||
|
||||
burger = document.getElementsByClassName('navbar-burger')[0];
|
||||
|
||||
menu = document.getElementsByClassName('navbar-menu')[0];
|
||||
|
||||
burger.addEventListener('click', function() {
|
||||
var s;
|
||||
s = 'is-active';
|
||||
if (menu.classList.contains(s)) {
|
||||
menu.classList.remove(s);
|
||||
} else {
|
||||
menu.classList.add(s);
|
||||
}
|
||||
if (burger.classList.contains(s)) {
|
||||
return burger.classList.remove(s);
|
||||
} else {
|
||||
return burger.classList.add(s);
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue