-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
917 lines (761 loc) · 27.9 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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="温故而知新">
<meta name="theme-color" content="#000">
<title>Gridea</title>
<link rel="shortcut icon" href="/favicon.ico?v=1723367500959">
<link rel="stylesheet" href="/media/css/muse.css">
<link rel="stylesheet" href="/media/fonts/font-awesome.css">
<link
href="//fonts.loli.net/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|Rosario:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext"
rel="stylesheet" type="text/css">
<link href="/media/hljs/styles/default.css"
rel="stylesheet">
<link rel="stylesheet" href="/styles/main.css">
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="/media/js/jquery.js"></script>
<script src="/media/hljs/highlight.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/velocity.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/velocity.ui.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
<body>
<div class="head-top-line"></div>
<div class="header-box">
<div class="muse">
<header class="header bg-color ">
<div class="blog-header box-shadow-wrapper " id="header">
<div class="nav-toggle" id="nav_toggle">
<div class="toggle-box">
<div class="line line-top"></div>
<div class="line line-center"></div>
<div class="line line-bottom"></div>
</div>
</div>
<div class="site-meta">
<div class="site-title">
<a href="/" class="brand">
<span>Gridea</span>
</a>
</div>
<p class="subtitle">精于心,简于形</p>
</div>
<nav class="site-nav" id="site_nav">
<ul id="nav_ul">
<li class="nav-item nav-item-active">
<a href="/" target="_self">
<i class="fa fa-globe"></i> 首页
</a>
</li>
<li class="nav-item ">
<a href="/archives" target="_self">
<i class="fa fa-globe"></i> 归档
</a>
</li>
<li class="nav-item ">
<a href="/tags" target="_self">
<i class="fa fa-globe"></i> 标签
</a>
</li>
<li class="nav-item ">
<a href="/post/about" target="_self">
<i class="fa fa-globe"></i> 关于
</a>
</li>
<li class="nav-item ">
<a href="/friends/" target="_self">
<i class="fa fa-address-book"></i> 友链
</a>
</li>
<li id="fa_search" class="nav-item">
<a href="javascript:void(0);">
<i class="fa fa-search"></i> <span class="language" data-lan="search">搜索</span>
</a>
</li>
</ul>
</nav>
</div>
</header>
</div>
<script type="text/javascript">
let showNav = true;
let navToggle = document.querySelector('#nav_toggle'),
siteNav = document.querySelector('#site_nav');
function navClick() {
let sideBar = document.querySelector('.sidebar');
let navUl = document.querySelector('#nav_ul');
navToggle.classList.toggle('nav-toggle-active');
siteNav.classList.toggle('nav-menu-active');
if (siteNav.classList.contains('nav-menu-active')) {
siteNav.style = "height: " + (navUl.children.length * 42) +"px !important";
} else {
siteNav.style = "";
}
}
navToggle.addEventListener('click',navClick);
</script>
</div>
<div class="main-continer">
<div
class="section-layout muse bg-color">
<div class="section-layout-wrapper">
<div id="sidebarMeta" class="sidebar">
<div class="sidebar-wrapper box-shadow-wrapper ">
<div class="sidebar-item">
<img class="site-author-image right-motion" src="/images/avatar.png"/>
<p class="site-author-name">我是谁</p>
</div>
<div class="sidebar-item side-item-stat right-motion">
<div class="sidebar-item-box">
<a href="/archives/">
<span class="site-item-stat-count">1</span>
<span class="site-item-stat-name language" data-lan="article">文章</span>
</a>
</div>
<div class="sidebar-item-box">
<a href="/tags/">
<span class="site-item-stat-count">1</span>
<span class="site-item-stat-name language" data-lan="tag">标签</span>
</a>
</div>
</div>
</div>
</div>
<script>
let sidebarMeta = document.querySelector('#sidebarMeta');
let scheme = 'muse';
let sidebarWrapper = document.querySelector('.sidebar-wrapper');
if (sidebarMeta && (scheme === 'pisces' || scheme === 'gemini')) {
document.addEventListener('scroll', function(e) {
if (document.scrollingElement.scrollTop > parseInt(sidebarMeta.style.marginTop) + 10) {
sidebarWrapper.classList.add('home-sidebar-fixed')
} else {
sidebarWrapper.classList.remove('home-sidebar-fixed')
}
});
}
</script>
<div class="section-box muse">
<section class="section bg-color posts-expand slide-down-in">
<article class="post-list-box bg-color post box-shadow-wrapper">
<div class="article-wrapper bg-color">
<section class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="https://tekkensteve.github.io/post/hello-gridea/"> Hello Gridea </a>
</h1>
<div class="post-meta">
<span class="meta-item pc-show">
<i class="fa fa-calendar-o"></i>
<span class="language" data-lan="publish">发布于</span>
<span class="publish-time" data-t="2018-12-12 00:00:00">2018-12-12</span>
<span class="post-meta-divider pc-show">|</span>
</span>
<span class="meta-item">
<i class="fa fa-folder-o"></i>
<span class="pc-show language" data-lan="category-in">标签:</span>
<a href="https://tekkensteve.github.io/tag/vmT-CVSXu/">
<span>Gridea</span>
</a>
</span>
<span class="post-meta-divider">|</span>
<span class="meta-item">
<i class="fa fa-clock-o"></i>
<span
>2<span class="language" data-lan="minute"
>分钟</span
></span
>
</span>
<span class="meta-item">
<span class="post-meta-divider">|</span>
<i class="fa fa-file-word-o"></i>
<span
>298<span class="pc-show language" data-lan="words"
>字数</span
></span
>
</span>
</div>
</section>
<div class="post-body">
<p>👏 欢迎使用 <strong>Gridea</strong> !<br>
✍️ <strong>Gridea</strong> 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...</p>
<div class="post-button text-center">
<a class="btn language" data-lan="read-more" href="https://tekkensteve.github.io/post/hello-gridea/" rel="contents">
阅读全文 »
</a>
</div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<div class="page bg-color">
<ul class="pagination-ul">
<li class="pagination-li pagination-active">
<a href="/page/../">
1
</a>
</li>
</ul>
</div>
</section>
</div>
</div>
</div>
<div class="footer-box">
<footer class="footer">
<center id="runTimeBox">
已运行:<span id="run_time"></span>
</center>
<span id="busuanzi_container_site_pv">浏览数:<span id="busuanzi_value_site_pv"></span> 次</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv">访客数:<span id="busuanzi_value_site_uv"></span> 人</span>
<script>
BirthDay = new Date('');
if (BirthDay.getTime()) {
function runTime() {
str = "";
today = new Date();
timeold = today.getTime() - BirthDay.getTime();
msPerDay = 24 * 60 * 60 * 1000;
e_daysold = timeold / msPerDay;
daysold = Math.floor(e_daysold);
str += daysold + "天";
return str;
}
setInterval(function () {
$("#run_time").html(runTime());
}, 1000);
} else {
document.querySelector('.footer').removeChild(document.querySelector('#runTimeBox'));
}
</script>
<div class="poweredby">
Powered by <a href="https://github.com/getgridea/gridea" target="_blank">Gridea</a>
</div>
</footer>
<div class="drawer-box left" id="drawer_box">
<span class="muse-line muse-line-first"></span>
<span class="muse-line muse-line-middle"></span>
<span class="muse-line muse-line-last"></span>
</div>
<div class="muse back-to-top" id="back_to_top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script>
let sideBarOpen = "sidebar-open";
let body = document.body;
let back2Top = document.querySelector("#back_to_top"),
back2TopText = document.querySelector("#back_to_top_text"),
drawerBox = document.querySelector("#drawer_box"),
rightSideBar = document.querySelector(".sidebar"),
viewport = document.querySelector("body");
function scrollAnimation(currentY, targetY) {
let needScrollTop = targetY - currentY;
let _currentY = currentY;
setTimeout(() => {
const dist = Math.ceil(needScrollTop / 10);
_currentY += dist;
window.scrollTo(_currentY, currentY);
if (needScrollTop > 10 || needScrollTop < -10) {
scrollAnimation(_currentY, targetY);
} else {
window.scrollTo(_currentY, targetY);
}
}, 1);
}
back2Top.addEventListener("click", function (e) {
scrollAnimation(document.scrollingElement.scrollTop, 0);
e.stopPropagation();
return false;
});
window.addEventListener("scroll", function (e) {
let percent =
(document.scrollingElement.scrollTop /
(document.scrollingElement.scrollHeight -
document.scrollingElement.clientHeight)) *
100;
if (percent > 1 && !back2Top.classList.contains("back-top-active")) {
back2Top.classList.add("back-top-active");
}
if (percent == 0) {
back2Top.classList.remove("back-top-active");
}
if (back2TopText) {
back2TopText.textContent = Math.floor(percent);
}
});
let hasCacu = false;
window.addEventListener("resize", function (e) {
calcuHeight();
});
function calcuHeight() {
// 动态调整站点概览高度
if (
(!hasCacu && back2Top.classList.contains("pisces")) ||
back2Top.classList.contains("gemini")
) {
let sideBar = document.querySelector(".sidebar");
let navUl = document.querySelector("#site_nav");
sideBar.style =
"margin-top:" + (navUl.offsetHeight + navUl.offsetTop + 15) + "px;";
hasCacu = true;
}
}
calcuHeight();
let open = false,
MOTION_TIME = 300,
RIGHT_MOVE_DIS = "320px";
if (drawerBox) {
let rightMotions = document.querySelectorAll(".right-motion");
let right = drawerBox.classList.contains("right");
let transitionDir = right
? "transition.slideRightIn"
: "transition.slideLeftIn";
let openProp, closeProp;
if (right) {
openProp = {
paddingRight: RIGHT_MOVE_DIS,
};
closeProp = {
paddingRight: "0px",
};
} else {
openProp = {
paddingLeft: RIGHT_MOVE_DIS,
};
closeProp = {
paddingLeft: "0px",
};
}
drawerBox.onclick = function () {
open = !open;
jQuery.Velocity(rightSideBar, "stop");
jQuery.Velocity(viewport, "stop");
jQuery.Velocity(rightMotions, "stop");
if (open) {
jQuery.Velocity(
rightSideBar,
{
width: RIGHT_MOVE_DIS,
},
{
duration: MOTION_TIME,
begin: function () {
jQuery.Velocity(rightMotions, transitionDir, {});
},
}
);
jQuery.Velocity(viewport, openProp, {
duration: MOTION_TIME,
});
} else {
jQuery.Velocity(
rightSideBar,
{
width: "0px",
},
{
duration: MOTION_TIME,
begin: function () {
jQuery.Velocity(rightMotions, {
opacity: 0,
});
},
}
);
jQuery.Velocity(viewport, closeProp, {
duration: MOTION_TIME,
});
}
for (let i = 0; i < drawerBox.children.length; i++) {
drawerBox.children[i].classList.toggle("muse-line");
}
drawerBox.classList.toggle(sideBarOpen);
};
}
// 链接跳转
let newWindow = "false";
if (newWindow === "true") {
let links = document.querySelectorAll(".post-body a");
links.forEach((item) => {
if (!item.classList.contains("btn")) {
item.setAttribute("target", "_blank");
}
});
}
let faSearch = document.querySelector("#fa_search");
faSearch &&
faSearch.addEventListener("click", function () {
document.querySelector("#search_mask").style = "";
});
// 代码高亮
hljs.initHighlightingOnLoad();
// 离开当前页title变化
var leaveTitle = "";
var normal_title = document.title;
if (leaveTitle) {
document.addEventListener("visibilitychange", function () {
if (document.visibilityState == "hidden") {
normal_title = document.title;
document.title = leaveTitle;
} else {
document.title = normal_title;
}
});
}
</script>
<link rel="stylesheet" href="/media/css/jquery.fancybox.css" />
<script src="/media/js/jquery.fancybox.js"></script>
<script>
let images = document.querySelectorAll(".section img");
images.forEach((image) => {
var parent = image.parentElement;
var next = image.nextElementSibling;
parent.removeChild(image);
var aelem = document.createElement("a");
aelem.href = image.src;
aelem.dataset["fancybox"] = "images";
aelem.dataset["rel"] = "fancybox-button";
aelem.classList.add("fancybox");
aelem.appendChild(image);
parent.insertBefore(aelem, next);
});
</script>
</div>
</body>
<div class="search-mask" id="search_mask" style="display: none;">
<div class="search-box">
<div class="search-title">
<i class="fa fa-search"></i>
<div class="input-box">
<input id="search" type="text" class="language" data-lan="search" placeholder="搜索">
</div>
<i id="close" class="fa fa-times-circle"></i>
</div>
<div class="stat-box">
<span id="stat_count">0</span><span class="language" data-lan="stat">条相关条目,使用了</span><span id="stat_times">0</span><span class="language" data-lan="stat-time">毫秒</span>
<hr>
</div>
<div class="result" id="result">
<div class="item">
<a class="result-title" style="opacity: 0;" href="https://tekkensteve.github.io/post/about/"" data-c="
<blockquote>
<p>欢迎来到我的小站呀,很高兴遇见你!🤝</p>
</blockquote>
<h2 id="关于本站">🏠 关于本站</h2>
<h2 id="博主是谁">👨💻 博主是谁</h2>
<h2 id="兴趣爱好">⛹ 兴趣爱好</h2>
<h2 id="联系我呀">📬 联系我呀</h2>
">关于</a>
</div>
<div class="item">
<a class="result-title" style="opacity: 0;" href="https://tekkensteve.github.io/post/hello-gridea/"" data-c="
<p>👏 欢迎使用 <strong>Gridea</strong> !<br>
✍️ <strong>Gridea</strong> 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...</p>
<!-- more -->
<p><a href="https://github.com/getgridea/gridea">Github</a><br>
<a href="https://gridea.dev/">Gridea 主页</a><br>
<a href="https://fehey.com/">示例网站</a></p>
<h2 id="特性">特性👇</h2>
<p>📝 你可以使用最酷的 <strong>Markdown</strong> 语法,进行快速创作</p>
<p>🌉 你可以给文章配上精美的封面图和在文章任意位置插入图片</p>
<p>🏷️ 你可以对文章进行标签分组</p>
<p>📋 你可以自定义菜单,甚至可以创建外部链接菜单</p>
<p>💻 你可以在 <strong>Windows</strong>,<strong>MacOS</strong> 或 <strong>Linux</strong> 设备上使用此客户端</p>
<p>🌎 你可以使用 <strong>𝖦𝗂𝗍𝗁𝗎𝖻 𝖯𝖺𝗀𝖾𝗌</strong> 或 <strong>Coding Pages</strong> 向世界展示,未来将支持更多平台</p>
<p>💬 你可以进行简单的配置,接入 <a href="https://github.com/gitalk/gitalk">Gitalk</a> 或 <a href="https://github.com/SukkaW/DisqusJS">DisqusJS</a> 评论系统</p>
<p>🇬🇧 你可以使用<strong>中文简体</strong>或<strong>英语</strong></p>
<p>🌁 你可以任意使用应用内默认主题或任意第三方主题,强大的主题自定义能力</p>
<p>🖥 你可以自定义源文件夹,利用 OneDrive、百度网盘、iCloud、Dropbox 等进行多设备同步</p>
<p>🌱 当然 <strong>Gridea</strong> 还很年轻,有很多不足,但请相信,它会不停向前 🏃</p>
<p>未来,它一定会成为你离不开的伙伴</p>
<p>尽情发挥你的才华吧!</p>
<p>😘 Enjoy~</p>
">Hello Gridea</a>
</div>
</div>
<div class="page">
<div id="page_ul"></div>
</div>
</div>
</div>
<script>
!function () {
let searchMask = document.querySelector('#search_mask');
let result = document.querySelector('#result');
let items = document.querySelectorAll('.item');
let searchBox = document.querySelector('#search');
let statCount = document.querySelector('#stat_count');
let statTimes = document.querySelector('#stat_times');
let pageUl = document.querySelector('#page_ul');
let close = document.querySelector('#close');
close.addEventListener('click', function() {
searchMask.style = 'display: none;'
})
let finds = [];
let contents = [];
let pageSize = 10;
items.forEach(item => {
let a = item.querySelector('a');
contents.push({
title: a.innerText,
details: a.dataset.c,
link: a.href
})
item.remove();
})
function insertStr(soure, start, count) {
let newStr = soure.substr(start, count);
return soure.slice(0, start) + '<em>' + newStr + '</em>' + soure.slice(start + count);
}
pageUl.addEventListener('click', function(event) {
let target = event.target;
if (target.__proto__ === HTMLSpanElement.prototype) {
appendResults(parseInt(target.dataset.i));
}
})
function appendResults(index) {
let htmlResult = '';
let start = index || 0;
let end = Math.min(start + pageSize, finds.length);
for (let i = start; i < end; i++) {
const current = finds[i];
let html = current.title;
let sum = 0;
let positions = current.positions;
positions.forEach(position => {
html = insertStr(html, position.start + sum, position.count);
sum += 9;
})
htmlResult += `<div class="item"><a class="result-title" href="${current.link}">${html}</a></div>`;
}
result.innerHTML = htmlResult;
pageUl.innerHTML = '';
let count = finds.length / pageSize;
let lis = '';
if (start !== 0) {
lis += `<span class="fa fa-angle-left" data-i='${start - 1}'></span>`;
}
for (let i = 0; i < count; i++) {
lis += `<span class='${i === start?'current':''}' data-i='${i}'>${i+1}</span>`;
}
if (start+1 < count) {
lis += `<span class="fa fa-angle-right" data-i='${start+1}'></span>`;
}
pageUl.innerHTML = lis;
}
function search(delay) {
let timer = null
return function () {
clearTimeout(timer)
timer = setTimeout(() => {
let start = Date.now();
let segments = searchBox.value.split(' ').filter(c => c != '');
if (segments.length <= 0) {
return;
}
finds = [];
let htmlResult = '';
contents.forEach(content => {
let title = content.title;
let positions = [];
let find = false;
segments.forEach((segment) => {
if (content.title.includes(segment)) {
find = true;
positions.push({
start: content.title.indexOf(segment),
count: segment.length
})
} else if (content.details.includes(segment)) {
find = true;
}
});
if (find) {
finds.push({
title: content.title,
link: content.link,
positions
});
}
})
appendResults(0);
statCount.textContent = finds.length;
statTimes.textContent = Date.now() - start;
}, delay)
}
}
searchBox.addEventListener('input', search(200));
}()
</script>
<input hidden id="copy" />
<script>
!function () {
let times = document.querySelectorAll('.publish-time');
for (let i = 0; i < times.length; i++) {
let date = times[i].dataset.t;
let time = Math.floor((new Date().getTime() - new Date(date).getTime()) / 1000);
if (time < 60) {
str = time + '秒之前';
} else if (time < 3600) {
str = Math.floor(time / 60) + '分钟之前';
} else if (time >= 3600 && time < 86400) {
str = Math.floor(time / 3600) + '小时之前';
} else if (time >= 86400 && time < 259200) {
str = Math.floor(time / 86400) + '天之前';
} else {
str = times[i].textContent;
}
times[i].textContent = str;
}
}();
</script>
<script>
let language = '';
if (language !== '') {
let map = new Map();
if (language === 'en') {
map.set('search', 'Search');
map.set('category', 'Categories');
map.set('article', 'Articles');
map.set('tag', 'Tags');
map.set('top', 'Top');
map.set('publish', 'published');
map.set('minute', ' minutes');
map.set('read-more', 'Read More');
map.set('view', 'View');
map.set('words', ' words');
map.set('category-in', 'category in');
map.set('preview', 'Meta');
map.set('index', 'Toc');
map.set('no-archives', "You haven't created yet");
map.set('archives', " articles in total");
map.set('cloud-tags', " tags in total");
map.set('copyright', "Copyright: ");
map.set('author', "Author: ");
map.set('link', "Link: ");
map.set('leave-message', "Leave a message");
map.set('format', "Links Format");
map.set('site-name', "Name: ");
map.set('site-link', "Link: ");
map.set('site-desc', "Desc: ");
map.set('stat', " related results, taking ");
map.set('stat-time', " ms");
map.set('site-img', "Image: ");
}
if (map.size > 0) {
let lanElems = document.querySelectorAll('.language');
lanElems.forEach(elem => {
let lan = elem.dataset.lan, text = map.get(lan);
if (elem.__proto__ === HTMLInputElement.prototype) {
elem.placeholder = text
} else {
if (elem.dataset.count) {
text = elem.dataset.count + text;
}
elem.textContent = text;
}
})
}
}
window.Clipboard = (function (window, document, navigator) {
var textArea,
copy;
// 判断是不是ios端
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
//创建文本元素
function createTextArea(text) {
textArea = document.createElement('textArea');
textArea.value = text;
textArea.style.width = 0;
textArea.style.height = 0;
textArea.clientHeight = 0;
textArea.clientWidth = 0;
document.body.appendChild(textArea);
}
//选择内容
function selectText() {
var range,
selection;
if (isOS()) {
range = document.createRange();
range.selectNodeContents(textArea);
selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
textArea.setSelectionRange(0, 999999);
} else {
textArea.select();
}
}
//复制到剪贴板
function copyToClipboard() {
try {
document.execCommand("Copy")
} catch (err) {
alert("复制错误!请手动复制!")
}
document.body.removeChild(textArea);
}
copy = function (text) {
createTextArea(text);
selectText();
copyToClipboard();
};
return {
copy: copy
};
})(window, document, navigator);
function copyCode(e) {
if (e.srcElement.tagName === 'SPAN' && e.srcElement.classList.contains('copy-code')) {
let code = e.currentTarget.querySelector('code');
var text = code.innerText;
if (e.srcElement.textContent === '复制成功') {
return;
}
e.srcElement.textContent = '复制成功';
(function (elem) {
setTimeout(() => {
if (elem.textContent === '复制成功') {
elem.textContent = '复制代码'
}
}, 1000);
})(e.srcElement)
Clipboard.copy(text);
}
}
let pres = document.querySelectorAll('pre');
pres.forEach(pre => {
let code = pre.querySelector('code');
let copyElem = document.createElement('span');
copyElem.classList.add('copy-code');
copyElem.textContent = '复制代码';
pre.appendChild(copyElem);
pre.onclick = copyCode
})
</script>
<script src="/media/js/motion.js"></script>
<script
src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll/dist/smooth-scroll.polyfills.min.js"></script>
<script>
var scroll = new SmoothScroll('a[href*="#"]', {
speed: 200
});
</script>
</html>