-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
423 lines (351 loc) · 12.2 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<!DOCTYPE html>
<html lang="zn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>
ALEX
</title>
<meta name="description" content="你只能在这里 or 你选择在这里">
<meta name="author" content="alex">
<meta http-equiv="Cache-Control" content="no-transform"/>
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta name="theme-color" content="#1e2327">
<link rel="apple-touch-icon" href="https://github.githubassets.com/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://github.githubassets.com/apple-touch-icon-180x180.png">
<link rel="icon" type="image/x-icon" href="https://github.githubassets.com/favicon.ico">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/1.0.25-csp/vue.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
<meta name="generator" content="Hexo 4.1.1"></head>
<body id="replica-app">
<nav class="navbar-wrapper">
<div class="navbar">
<div class="container clearfix">
<a href="/" class="navbar-logo"><i class="fa fa-github"></i></a>
<div class="navbar-search float-left desktop-only">
<div class="navbar-search-form">
<label for="gsc-i-id1">This website</label>
<div id="google-search">
<gcse:search></gcse:search>
</div>
</div>
</div>
<ul class="navbar-nav float-left">
<li><a href="/archives">Archives</a></li>
<li><a href="/categories">Categories</a></li>
<li><a href="/tags">Tags</a></li>
<li class="desktop-only"><a href="/atom.xml" target="_blank">RSS</a></li>
</ul>
<ul class="navbar-nav user-nav float-right desktop-only">
<li class="user-nav-notification">
<a><span class="user-nav-unread"></span><i class="fa fa-bell"></i></a>
</li>
<li>
<a><i class="fa fa-plus"></i> <i class="fa fa-caret-down"></i></a>
</li>
<li class="user-nav-logo">
<a><img src="https://octodex.github.com/images/baracktocat.jpg"> <i class="fa fa-caret-down"></i></i></a>
</li>
</ul>
</div>
</div>
</nav>
<div class="main-container">
<div class="container-lg">
<div class="blog-intro">
<div class="blog-intro-user">
<img class="avatar" src="https://octodex.github.com/images/baracktocat.jpg">
<div class="user-name">
<div class="blog-title">ALEX</div>
<div class="blog-author">alex</div>
<ul class="user-detail mobile-only">
<li>
<i class="fa fa-link"></i>
<a href="https://github.com/chaoweimt">https://github.com/chaoweimt</a>
</li>
</ul>
</div>
<div class="blog-description">
你只能在这里 or 你选择在这里
</div>
</div>
<ul class="user-detail desktop-only">
<li>
<i class="fa fa-link"></i>
<a href="https://github.com/chaoweimt">https://github.com/chaoweimt</a>
</li>
</ul>
<div class="social-media desktop-only">
<h4>Social Media</h4>
<ul>
</ul>
</div>
</div>
<div class="blog-detail">
<nav class="blog-detail-nav desktop-only">
<ul class="clearfix">
<li class="selected">
<a href="/">Overview</a></li>
<li class="">
<a href="/archives">Posts <span class="counter">1</span></a>
</li>
<li class="">
<a href="/categories">Categories <span
class="counter">0</span></a></li>
<li class="">
<a href="/tags">Tags <span class="counter">0</span></a></li>
</ul>
</nav>
<div class="body-secondary">
<p class="right-title">Recent post</p>
<ul class="recent-post clearfix">
<li class="recent-post-item">
<div class="clearfix">
<h5 class="post-title text-ellipsis">
<i class="fa fa-bars"></i>
<a href="/2019/12/15/hello-world/">Hello World</a>
</h5>
<p class="post-description text-ellipsis desktop-only">
Welcome to Hexo ! This is your very first post.
</p>
<p class="post-info desktop-only">
<span>
<i class="fa fa-folder-open"></i> Uncategorized
</span>
<span><i class="fa fa-tag"></i> 0 </span>
</p>
</div>
</li>
</ul>
<div class="calendar-container" id="calendar">
<div class="calendar">
<h3>
{{posts.length}} contributions in the last year
</h3>
<div class="calendar-graph-container">
<div class="calendar-graph">
<svg width="676" height="104" @mouseout="mouseoverDate=null">
<g transform="translate(16, 20)">
<g v-for="week in calendar" :transform="week.transform">
<rect v-for="day in week.days"
:x="day.x"
:y="day.y"
:fill="day.fill"
@click="selectedDate=day.date"
@mouseover="mouseoverDate=day.date"
:class="{active:selectedDate===day.date}"
data-count="{{day.posts.length}}"
data-date="{{day.date}}"
class="day" width="10" height="10"
></rect>
</g>
<text v-for="month in monthLabels"
:x="month.x"
y="-5"
class="month">{{month.text}}
</text>
<text text-anchor="start" class="wday" dx="-14" dy="8"
style="display: none;">S
</text>
<text text-anchor="start" class="wday" dx="-14" dy="20">Mon</text>
<text text-anchor="start" class="wday" dx="-14" dy="32"
style="display: none;">T
</text>
<text text-anchor="start" class="wday" dx="-14" dy="44">Wed</text>
<text text-anchor="start" class="wday" dx="-14" dy="57"
style="display: none;">T
</text>
<text text-anchor="start" class="wday" dx="-14" dy="69">Fri</text>
<text text-anchor="start" class="wday" dx="-14" dy="81"
style="display: none;">S
</text>
</g>
</svg>
<div class="svg-tip svg-tip-one-line"
v-bind:style="{ top: svgtip.top, left: svgtip.left, display: svgtip.display}">
<strong>{{svgtip.text}}</strong> on
{{moment(mouseoverDate).format('MMM DD, YYYY')}}
</div>
</div>
<div class="calendar-footer clearfix">
<span>
<a href="#">Learn how we count contributions.</a>
</span>
<div class="calendar-legend">
<span>Less</span>
<ul class="legend">
<li style="background-color: #eee"></li>
<li style="background-color: #d6e685"></li>
<li style="background-color: #8cc665"></li>
<li style="background-color: #44a340"></li>
<li style="background-color: #1e6823"></li>
</ul>
<span>More</span>
</div>
</div>
</div>
</div>
<h3>Contribution activity</h3>
<div class="contribution-list">
<ul>
<li v-for="post in posts | filterBy selectedDate in 'date'">
<a href="{{post.url}}">{{post.title}}
</a>
<span>{{post.date}}</span>
</li>
</ul>
</div>
</div>
<script>
var posts = [{"date":"2019-12-15","title":"Hello World","url":"https://github.com/chaoweimt/2019/12/15/hello-world/"}];
var today = moment().format('YYYY-MM-DD');
var oneYearAgo = moment(today).subtract(1, 'years');
posts = posts.filter(function(post) {
return new Date(post.date) > oneYearAgo;
});
var monthLabels = [];
var monthName = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var calendar = getCalendar(posts);
var dateRange = {
start: moment(oneYearAgo).format('MMM D, YYYY'),
end: moment().format('MMM D, YYYY')
}
var app = new Vue({
el: '#calendar',
data: {
posts: posts,
selectedDate: null,
calendar: calendar,
dateRange: dateRange,
mouseoverDate: null,
moment: moment,
monthLabels: monthLabels
},
created: function() {
this.selectedDate = 'none';
},
methods: {},
computed: {
svgtip: function() {
var date = this.mouseoverDate;
var display = date ? 'block' : 'none';
if (date) {
var coordinator = getIndexByDate(date);
var x = coordinator[0];
var y = coordinator[1];
var len = this.calendar[x].days[y].posts.length;
var text = len ? len + ' contributions' : 'No contributions';
var left = coordinator[0] * 12 - 37 + 'px';
coordinator[1] = coordinator[0] ? coordinator[1] : coordinator[1] + oneYearAgo.day();
var top = coordinator[1] * 12 + 12 - 32 + 'px';
}
return {
text: text,
left: left,
top: top,
display: display
}
}
}
});
function getCalendar(posts) {
// raw calendar
var maxCount = 0;
var tmr = new Date();
tmr.setDate(tmr.getDate() + 1);
var tmrStr = tmr.toISOString().slice(0, 10);
var date = new Date();
date.setYear(date.getFullYear() - 1); // start date is a year ago;
var calendar = [];
while (date.toISOString().slice(0, 10) !== tmrStr) {
var day = date.getDay();
if (day === 0 || calendar.length === 0) {
var x = calendar.length * 13;
calendar.push({
transform: 'translate(' + x + ',0)',
days: []
})
}
calendar[calendar.length - 1].days.push({
x: 14 - calendar.length,
y: day * 12,
date: date.toISOString().slice(0, 10),
posts: []
});
if (day === 0 && date.getDate() < 8) {
monthLabels.push({
x: 14 - calendar.length + x,
text: monthName[date.getMonth() - 1]
})
}
date.setDate(date.getDate() + 1);
}
// handle post info
posts.forEach(function(post) {
var x = getIndexByDate(post.date)[0];
var y = getIndexByDate(post.date)[1];
calendar[x].days[y].posts.push({
title: post.title,
url: post.url
});
var len = calendar[x].days[y].posts.length;
maxCount = Math.max(len, maxCount);
})
// handle fill color
calendar.forEach(function(week) {
week.days.forEach(function(day) {
day.fill = getColorByLength(day.posts.length, maxCount);
})
})
return calendar;
}
function getIndexByDate(date) {
date = moment(date);
var firstColumnLen = 7 - oneYearAgo.day();
var days = date.diff(oneYearAgo, 'days');
var x = days > firstColumnLen - 1 ? Math.ceil((days - firstColumnLen + 1) / 7) : 0;
var y = days > firstColumnLen - 1 ? date.day() : date.day() - oneYearAgo.day();
return [x, y];
}
function getColorByLength(len, max) {
var colors = ['#eee', '#d6e685', '#8cc665', '#44a340', '#1e6823'];
var colorsLen = colors.length - 1;
var color = len ? colors[0] : colors[1];
var interval = max / colorsLen;
if (max < colorsLen) {
color = colors[len];
} else {
color = colors[Math.ceil(len / interval)];
}
return color;
}
</script>
</div>
</div>
</div>
</div>
<div class="footer-wrapper container">
<footer class="footer clearfix">
<div class="clearfix">
<a href="https://github.com/chaoweimt" class="footer-logo">
<i class="fa fa-github"></i>
</a>
<ul class="footer-social-link">
<li>© 2019 alex</li>
<li><a href="https://github.com/chaoweimt">Home</a></li>
</ul>
<div class="footer-theme-info">
Theme <a href="//github.com/sabrinaluo/hexo-theme-replica">Replica</a>
by <a href="//github.com/sabrinaluo">Hiitea</a> ❤ Powered by Hexo
</div>
</div>
</footer>
</div>
<script src="/js/main.js"></script>
</body>
</html>