-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
index.html
238 lines (232 loc) · 7.58 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<title>Repokémon - Showcase of GitHub repos with Pokémon names</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#DD2120">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="pokemon.min.css">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" property="og:url" content="https://cheeaun.github.io/repokemon/">
<meta name="twitter:title" property="og:title" content="Repokémon">
<meta name="twitter:description" property="og:description" content="Showcase of GitHub repos with Pokémon names">
<meta name="twitter:image" property="og:image" content="https://repository-images.githubusercontent.com/63379101/9da55a80-bee1-11ea-831a-3c245f66ff8e">
<style>
body{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
text-align: center;
cursor: default;
padding: 0 0 2em;
margin: 0;
}
header,
footer{
padding: 0 1em;
}
h1{
font-weight: normal;
margin-bottom: 0;
padding-bottom: 0;
}
h1 img {
max-width: 100%;
height: auto;
}
h1 + p{
margin-top: 0;
padding-top: .2em;
}
#share > *,
#share span{
vertical-align: top;
margin-bottom: 3px;
}
#list{
margin: 0;
padding: 0;
list-style: none;
text-align: center;
display: flex;
flex-wrap: wrap;
}
#list li{
display: inline-flex;
text-align: center;
vertical-align: top;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 120px;
align-items: stretch;
box-sizing: border-box;
}
#list li.unavailable{
flex-direction: column;
align-items: center;
opacity: .35;
padding: 5px 10px;
}
#list li.unavailable *{
pointer-events: none;
}
#list li a{
width: 100%;
display: block;
color: inherit;
text-decoration: none;
border-radius: 5px;
transition: background-color .3s;
padding: 5px 10px;
}
#list li a *{
pointer-events: none;
}
#list li h2{
font-size: 1em;
margin: 0;
padding: 0;
}
#list li .img{
background-repeat: no-repeat;
width: 100px;
height: 100px;
display: inline-block;
transform: scale(.9);
}
#list li a:hover .img{
transform: scale(1);
}
#list li a .metadata{
opacity: .4;
font-size: .7em;
}
#list li a:hover .metadata{
opacity: .9;
}
#controls{
border-top: 1px solid #eee;
position: fixed;
bottom: 0;
right: 0;
left: 0;
padding: 10px;
background-color: rgba(255, 255, 255, .5);
vertical-align: middle;
-webkit-backdrop-filter: blur(15px) saturate(3);
backdrop-filter: blur(15px) saturate(3);
}
#controls input{
vertical-align: middle;
}
#display-unavailable:checked ~ #list li.unavailable {
display: none;
}
#display-available:checked ~ #list li.available {
display: none;
}
</style>
<header>
<h1><img src="repokemon-logo.svg" width="640" heigth="204" alt="Repokémon"></h1>
<p>Showcase of GitHub repos with Pokémon names</p>
</header>
<div id="share">
<a class="github-button" href="https://github.com/cheeaun/repokemon" data-show-count="true" aria-label="Star cheeaun/repokemon on GitHub">Star</a>
<a href="https://twitter.com/share" class="twitter-share-button" data-hashtags="repokemon" data-related="cheeaun" data-show-count="true">Tweet</a>
<span class="fb-share-button" data-href="https://cheeaun.github.io/repokemon" data-layout="button_count" data-size="small"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fcheeaun.github.io%2Frepokemon%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></span>
</div>
<input type="radio" id="display-all" name="display" value="all" checked /><label for="display-all"> All</label>
<input type="radio" id="display-unavailable" name="display" value="unavailable" /><label for="display-unavailable">Existing</label>
<input type="radio" id="display-available" name="display" value="available" /><label for="display-available">Non-existing</label>
<ul id="list"></ul>
<div id="controls">
<label><input type="radio" name="sort" value="number" checked> Pokédex number</label>
<label><input type="radio" name="sort" value="stars"> Most stars</label>
</div>
<footer>
<p>Last updated: <span id="last-updated"></span></p>
<p><b>Note</b>: Faded-out pokémon means the name has not been used as a GitHub repository name yet.</p>
<p>Pokémon data and images are extracted from the <a href="http://www.pokemon.com/us/pokedex/">official Pokédex web site</a>. All Pokémon content is © Nintendo, Game Freak, and The Pokémon Company.</p>
<p>Repokémon is not affiliated with GitHub, Nintendo, Game Freak, or The Pokémon Company in any way.</p>
</footer>
<div id="fb-root"></div>
<script>
var $list = document.getElementById('list');
var xhr = new XMLHttpRequest();
var data, dataWithChunks;
xhr.onload = function(){
data = JSON.parse(this.responseText);
dataWithChunks = data.map(function(d, i){
var chunkID = Math.floor(i / chunkSize);
d.chunkID = chunkID;
return d;
});
renderList();
};
xhr.open('GET', 'data/repokemon.min.json');
xhr.send();
var xhr2 = new XMLHttpRequest();
xhr2.onload = function(){
var txt = this.responseText;
var date = new Date(txt);
document.getElementById('last-updated').innerHTML = date.toLocaleDateString();
};
xhr2.open('GET', 'data/last-updated.txt');
xhr2.send();
var sortFuncs = {
number: function(a, b){
return parseInt(a.id, 10) - parseInt(b.id, 10);
},
stars: function(a, b){
return (b.repo ? b.repo.stars : -1) - (a.repo ? a.repo.stars : -1);
},
};
var chunkSize = 100;
function renderList(sort){
if (!dataWithChunks) return;
if (!sort) sort = 'number';
$list.innerHTML = dataWithChunks.sort(sortFuncs[sort]).map(function(d, i){
var repo = d.repo;
var chunkID = d.chunkID;
if (!repo) return '<li class="unavailable">'
+ '<div class="img i' + d.id + ' c' + chunkID + '"></div>'
+ '<h2>' + d.name + '</h2>'
+ '</li>';
var longDesc = repo.desc || '';
var descLimit = 70;
var veryLongDesc = longDesc.length > descLimit;
var desc = veryLongDesc ? longDesc.slice(0, descLimit-1) + '…' : longDesc;
return '<li class="available">'
+ '<a href="https://github.com/' + repo.full_name + '" title="' + (veryLongDesc ? longDesc : '') + '" target="_blank" rel="noopener noreferrer" ontouchstart>'
+ '<div class="img i' + d.id + ' c' + chunkID + '"></div>'
+ '<h2>' + d.name + '</h2>'
+ '<div class="metadata">' + desc + '</div>'
+ '<div class="metadata">⭐️ ' + repo.stars + ' 🍴' + repo.forks + '</div>'
+ '</a>'
+ '</li>';
}).join('');
};
var $controls = document.getElementById('controls');
$controls.addEventListener('change', function(e){
renderList(e.target.value);
}, true);
var $s = function(url, opts){
var s0 = document.getElementsByTagName('script')[0];
var s1 = document.createElement('script');
s1.crossOrigin = 'anonymous';
if (opts && opts.nonce) s1.nonce = opts.nonce;
s1.src = url;
s0.parentNode.insertBefore(s1, s0);
};
setTimeout(function(){
$s('https://buttons.github.io/buttons.js');
$s('https://platform.twitter.com/widgets.js');
$s('https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v10.0', { nonce: 'IBRLcgmq' });
}, 2000);
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-23235796-8', 'auto');
ga('send', 'pageview');
</script>