From b712668bf3b6696c8d1aef4028f564fed832e7be Mon Sep 17 00:00:00 2001 From: Corne Oppelaar Date: Sun, 19 Jun 2016 19:51:43 +0200 Subject: [PATCH] remove zerooo.js and home.js since fetching contributors in now done in php --- public/js/home.js | 17 ---------- public/js/zerooo.js | 81 -------------------------------------------- views/home.html.twig | 4 --- 3 files changed, 102 deletions(-) delete mode 100644 public/js/home.js delete mode 100644 public/js/zerooo.js diff --git a/public/js/home.js b/public/js/home.js deleted file mode 100644 index ce9b437..0000000 --- a/public/js/home.js +++ /dev/null @@ -1,17 +0,0 @@ -Zerooo.whenReady(function() { - Zerooo.getJSON('https://api.github.com/repos/EaterOfCode/zer.ooo/contributors', function (err, data) { - if (err) return; - - var contributors = data.filter(function (data) { - // It's me! - return data.id !== 1922630; - }); - - var html = Zerooo.joinHumanReadable(contributors.map(function (contributor) { - return '' + contributor.login + ''; - })); - - Zerooo.select('#contributors').innerHTML = html; - Zerooo.select('#contributors-container').style.display = 'block'; - }); -}); \ No newline at end of file diff --git a/public/js/zerooo.js b/public/js/zerooo.js deleted file mode 100644 index f57c5e2..0000000 --- a/public/js/zerooo.js +++ /dev/null @@ -1,81 +0,0 @@ -Zerooo = {}; - -Zerooo.getJSON = function (url, callback) { - var x = new XMLHttpRequest(); - var callbackSent = false; - - x.open("GET", url, true); - x.onerror = function (message, source, lineno, colno, error) { - if (!callbackSent) { - sendCallback(error); - } - }; - - x.onreadystatechange = function () { - if (x.readyState != 4) return; - - if (x.status !== 200) { - sendCallback(new Error(url + " responded with status code " + x.status)); - return; - } - - var data = x.responseText; - var json = null; - - try { - json = JSON.parse(data); - } catch (e) { - sendCallback(e) - } - - sendCallback(null, json); - }; - x.send(); - - function sendCallback(err, data) - { - if (!callbackSent) { - callbackSent = true; - callback(err, data || null); - } - } -}; - -Zerooo.whenReady = function (callback) { - if (document.readyState == "complete") { - setTimeout(callback, 0); - return; - } - - document.onreadystatechange = function () { - if (document.readyState == "complete") { - callback(); - } - } -}; - -Zerooo.select = function (sel) { - return document.querySelector(sel); -}; - -Zerooo.selectAll = function (sel) { - return document.querySelectorAll(sel); -}; - -Zerooo.joinHumanReadable = function (arr) { - if (arr.length === 0) { - return ""; - } - - if (arr.length === 1) { - return arr.shift(); - } - - var str = arr.shift(); - - while (arr.length > 1) { - str += ', ' + arr.shift(); - } - - return str + " and " + arr.shift(); -}; \ No newline at end of file diff --git a/views/home.html.twig b/views/home.html.twig index 4b1de1a..c4790a4 100644 --- a/views/home.html.twig +++ b/views/home.html.twig @@ -1,8 +1,4 @@ {% extends "base.html.twig" %} -{% block head %} - - -{% endblock %} {% block content %}