forked from cheeaun/cheeaun.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
146 lines (146 loc) · 3.33 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Repositories of leesei</title>
<meta name="viewport" content="width=device-width; initial-scale=1">
<style>
body {
color: #666;
background-color: #fff;
font-family: helvetica, arial, sans-serif;
font-size: 13px;
margin: 0;
padding: 0;
}
h1{
font-size: 13px;
margin: 0;
padding: 0;
}
h1 a{
display: block;
line-height: 20px;
padding: 6px 20px;
border-bottom: 1px solid #ddd;
}
#projects-count{
font-weight: normal;
color: #ccc;
display: inline-block;
line-height: 1.3em;
margin-left: .5em;
}
a{
color: #666;
background-color: transparent;
text-decoration: none;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
a:hover{
color: #fff;
background-color: #666;
}
#repos-list{
margin: 0;
padding: 0;
list-style: none;
}
#repos-list li{
display: inline;
}
#repos-list li a{
position: relative;
display: block;
line-height: 20px;
padding: 6px 20px;
overflow: hidden;
}
#repos-list li:nth-child(odd) a{
background-color: #fafafa;
}
#repos-list li a:hover{
color: #fff;
background-color: #666;
}
#repos-list li.fork a:before{
color: #999;
content: '\2646';
position: absolute;
left: 5px;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
#repos-list li a .desc{
color: #ccc;
display: inline-block;
line-height: 1.3em;
margin-left: .5em;
}
#projects-info,
#repos-list li a .info{
float: right;
clear: right;
}
b.stars,
b.forks{
font-weight: bold;
display: inline-block;
}
b.stars:before,
b.forks:before{
display: inline-block;
font-size: 14px;
width: 20px;
text-align: center;
}
b.stars:before{
content: '\2605';
}
b.forks:before{
content: '\2646';
}
</style>
<h1><a href="http://github.com/leesei"><span id="projects-info"></span>leesei <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){
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/leesei/repos?callback=load&per_page=100"></script>