-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
79 lines (70 loc) · 2.65 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!doctype html>
<html>
<head>
<style>
* {
font-family: sans-serif;
}
</style>
</head>
<body>
<div>
<h5>2015년 아희 커밋 추세</h5>
<div id="heuistory"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script>
<script>
$(document).ready(function() {
function loadCommits(group, name, cb) {
$.ajax({
url: 'https://api.github.com/repos/' + group + '/' + name + '/commits',
dataType: 'json',
data: {
since: '2015-01-01T00:00:00Z',
until: '2015-12-31T24:00:00Z'
},
success: function(data) {
console.log(data);
cb(data);
}
})
}
function loadRepos(group) {
if(window.heuistoryLoaded) {
return;
} else {
window.heuistoryLoaded = true;
}
var h = Raphael('heuistory', 400, 400);
$.ajax({
url: 'https://api.github.com/orgs/' + group + '/repos',
dataType: 'json',
success: function(repos) {
$.each(repos, function(i, repo) {
var x = 260;
var y = 20 * i + 20;
h.text(x, y, repo.name)
.attr('text-anchor', 'start');
loadCommits(group, repo.name, function(commits) {
var stats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
$.each(commits, function(j, commit) {
var month = new Date(commit.commit.committer.date).getMonth();
stats[month] += 1;
});
$.each(stats, function(k, stat) {
var r = 0.5 * stat;
h.circle(k * 20 + 20, y, r)
.attr('stroke', 'none')
.attr('fill', '#E6550D');
});
});
});
}
});
}
loadRepos('aheui');
});
</script>
</body>
</html>