remove zerooo.js and home.js since fetching contributors in now done in php

master
Corne Oppelaar 8 years ago
parent 530b9de718
commit b712668bf3

@ -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 '<a href="' + contributor.html_url + '">' + contributor.login + '</a>';
}));
Zerooo.select('#contributors').innerHTML = html;
Zerooo.select('#contributors-container').style.display = 'block';
});
});

@ -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();
};

@ -1,8 +1,4 @@
{% extends "base.html.twig" %}
{% block head %}
<script src="/js/zerooo.js"></script>
<script src="/js/home.js"></script>
{% endblock %}
{% block content %}
<div class="intro-page">
<div class="intro-page-logo">zer.ooo</div>

Loading…
Cancel
Save