-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (45 loc) · 2.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<meta charset="UTF-8">
<title>thekhenziegit</title>
<meta name="viewport" content="width=device-width; initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<h1><a href="http://github.com/thekhenzie"><span id="projects-info"></span>thekhenziegit <span id="projects-count"></span>
</a></h1>
<ul id="repos-list"></ul>
<script>
var reposList = document.getElementById('repos-list'),
projectsCount = document.getElementById('projects-count'),
projectsInfo = document.getElementById('projects-info'),
load = function (data) {
console.log(data);
if (!data || !data.data || !data.data.length) return;
var repositories = data.data,
html = '';
repositories.sort(function (a, b) {
var aFork = a.fork, bFork = b.fork;
if (aFork && !bFork) return 1;
if (!aFork && bFork) return -1;
return new Date(b.pushed_at) - new Date(a.pushed_at);
});
var l = repositories.length, lp = 0, lf = 0, w = 0, f = 0;
for (var i = 0; i < l; i++) {
var r = repositories[i],
fork = r.fork ? ' class="fork"' : '',
watchers = r.watchers,
forks = r.forks;
w += r.watchers;
f += r.forks;
fork ? lf++ : lp++;
html += '<li' + fork + '>'
+ '<a href="' + r.html_url + '">'
+ '<span class="info"><b class="language">' + (r.language || '') + '</b> <b class="stars">' + watchers + '</b> <b class="forks">' + forks + '</b></span>'
+ '<b>' + r.name + '</b> '
+ '<span class="desc">' + (r.description|| '') + '</span>'
+ '</a>';
}
reposList.innerHTML = html;
projectsCount.innerHTML = l + ' repositories; ' + lp + ' public, ' + lf + ' forks';
projectsInfo.innerHTML = '<b class="stars">' + w + '</b> <b class="forks">' + f + '</b>';
};
</script>
<script src="https://api.github.com/users/thekhenzie/repos?callback=load&per_page=100"></script>