From 1f67ea6ea96fe78d4cc9507fe17aa3ee6ba19ebf Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Wed, 11 Jul 2018 00:36:43 +0200 Subject: [PATCH] screw jquery --- content/assets/scripts/gamification.coffee | 37 ++++++++++++++++------ content/index.erb | 1 - 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/content/assets/scripts/gamification.coffee b/content/assets/scripts/gamification.coffee index ea74a35..c6c330f 100644 --- a/content/assets/scripts/gamification.coffee +++ b/content/assets/scripts/gamification.coffee @@ -1,19 +1,36 @@ - $.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) -> +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 = "" for x in data - str += """ + str += """ - - + - + + - """ + """ str += "
+ - + #{x.github_name} - + #{x.score} -
" - $('#gamification-coders').html(str) + 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() diff --git a/content/index.erb b/content/index.erb index 2cffe09..7eb2bcd 100644 --- a/content/index.erb +++ b/content/index.erb @@ -5,7 +5,6 @@ <% end %> <% content_for :scripts do %> - <%= asset :js, :gamification %> <% end %>