-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1082 lines (806 loc) · 32.7 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
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<!-- Head tag (contains Google-Analytics、Baidu-Tongji)-->
<head>
<!-- Google Analytics -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxx-xx"></script>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-xxxxxx-xx');
</script>
<!-- Baidu Tongji -->
<script type="text/javascript">
// Originial
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- Baidu Push -->
<script>
(function() {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="google-site-verification" content="lxDfCplOZbIzjhG34NuQBgu2gdyRlAtMB4utP5AgEBc" />
<meta name="baidu-site-verification" content="PpzM9WxOJU" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="It's an IT blog..." />
<meta name="keyword" content="一个·程序员" />
<link rel="shortcut icon" href="/img/avatar/roguerabbit.jpg" />
<!-- Place this tag in your head or just before your close body tag. -->
<script async="async" defer="defer" src="https://buttons.github.io/buttons.js"></script>
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="/css/bootstrap.min.css" />
<!-- Custom CSS -->
<link rel="stylesheet" href="/css/beantech.min.css" />
<!-- Pygments Highlight CSS -->
<link rel="stylesheet" href="css/highlight.css">
<link rel="stylesheet" href="css/widget.css">
<link rel="stylesheet" href="css/rocket.css">
<link rel="stylesheet" href="css/signature.css">
<link rel="stylesheet" href="css/catalog.css">
<link rel="stylesheet" href="css/livemylife.css">
<!-- wave start -->
<link rel="stylesheet" href="/css/wave.css" />
<!-- wave end -->
<!-- top start (article top hot config) -->
<link rel="stylesheet" href="/css/top.css" />
<!-- top end -->
<!-- ThemeColor start -->
<link rel="stylesheet" href="/css/scroll.css" />
<!-- ThemeColor end -->
<!-- viewer start (Picture preview) -->
<link rel="stylesheet" href="/css/viewer.min.css" />
<!-- viewer end -->
<!-- Search start -->
<link rel="stylesheet" href="/css/search.css" />
<!-- Search end -->
<!-- ThemeColor start -->
<link rel="stylesheet" href="/css/themecolor.css" />
<!-- ThemeColor end -->
<!-- gitalk start -->
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css"> -->
<link rel="stylesheet" href="/css/gitalk.css" />
<!-- gitalk end -->
<!-- Custom Fonts -->
<!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
<!-- Hux change font-awesome CDN to qiniu -->
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Hux Delete, sad but pending in China <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'> <link
href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/ css'> -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]-->
<!-- ga & ba script hoook -->
<link rel="canonical" href="http://yoursite-url/">
<title>
一个·程序员
</title>
<meta name="generator" content="Hexo 4.2.1"></head>
<!-- hack iOS CSS :active style -->
<body ontouchstart="" class="body--home">
<!-- ThemeColor -->
<!-- ThemeColor -->
<!-- <div class="toggle" onclick="document.body.classList.toggle('body--dark')">Switch Color</div> -->
<div class="toggle" onclick="document.body.classList.toggle('body--dark')">
<i class="mdui-icon material-icons bright-mode"></i>
<i class="mdui-icon material-icons dark-mode"></i>
</div>
<!-- Gitter -->
<!-- Gitter -->
<!-- Docs:https://gitter.im/?utm_source=left-menu-logo -->
<script>
((window.gitter = {}).chat = {}).options = {
room: 'hi_gaoyang/programmer'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
<!-- Navigation (contains search)-->
<!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">一个 · 程序员</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<!-- Known Issue, found by Hux:
<nav>'s height woule be hold on by its content.
so, when navbar scale out, the <nav> will cover tags.
also mask any touch event of tags, unfortunately.
-->
<div id="huxblog_navbar">
<div class="navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/archive/">Archives</a>
</li>
<li>
<a href="/categories/">Categories</a>
</li>
<li>
<a href="/tags/">Tags</a>
</li>
<li><a class="popup-trigger" title="Search"><i class="fa fa-search" style="font: \f002;"></i></a></li>
</ul>
</div>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- progress -->
<div id="progress">
<div class="line" style="width: 0%;"></div>
</div>
<script>
// Drop Bootstarp low-performance Navbar
// Use customize navbar with high-quality material design animation
// in high-perf jank-free CSS3 implementation
var $body = document.body;
var $toggle = document.querySelector('.navbar-toggle');
var $navbar = document.querySelector('#huxblog_navbar');
var $collapse = document.querySelector('.navbar-collapse');
$toggle.addEventListener('click', handleMagic)
function handleMagic(e) {
if ($navbar.className.indexOf('in') > 0) {
// CLOSE
$navbar.className = " ";
// wait until animation end.
setTimeout(function() {
// prevent frequently toggle
if ($navbar.className.indexOf('in') < 0) {
$collapse.style.height = "0px"
}
}, 400)
} else {
// OPEN
$collapse.style.height = "auto"
$navbar.className += " in";
}
}
</script>
<!-- Post Header (contains intro-header、signature、wordcount、busuanzi、waveoverlay) -->
<!-- Modified by Yu-Hsuan Yen -->
<!-- Post Header -->
<style type="text/css">
header.intro-header {
/*config*/
background-image: url('/img/header_img/newhome_bg.jpg');
}
</style>
<header class="intro-header">
<!-- Signature -->
<div id="signature">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="site-heading">
<h1>一个 · 程序员</h1>
<!--<hr class="small">-->
<span class="subheading">敬畏每一行代码</span>
</div>
</div>
</div>
</div>
</div>
<!-- waveoverlay start -->
<div class="preview-overlay">
<svg class="preview-waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
<defs>
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"></path>
</defs>
<g class="preview-parallax">
<use xlink:href="#gentle-wave" x="48" y="0" fill=var(--gentle-wave1)></use>
<use xlink:href="#gentle-wave" x="48" y="3" fill=var(--gentle-wave2)></use>
<use xlink:href="#gentle-wave" x="48" y="5" fill=var(--gentle-wave3)></use>
<use xlink:href="#gentle-wave" x="48" y="7" fill=var(--gentle-wave)></use>
</g>
</svg>
</div>
<!-- waveoverlay end -->
</header>
<!-- Main Content (Post contains
Pager、
tip、
socialshare、
gitalk、gitment、disqus-comment、
Catalog、
Sidebar、
Featured-Tags、
Friends Blog、
anchorjs、
) -->
<!-- Main Content -->
<div class="container">
<div class="row">
<!-- USE SIDEBAR -->
<!-- Post Container -->
<div class="
col-lg-8 col-lg-offset-1
col-md-8 col-md-offset-1
col-sm-12
col-xs-12
post-container
">
<!-- Main Content -->
<div class="post-preview">
<!-- top start (article top hot config) -->
<div class="top">
<div class="iconfont icon-hot animated infinite tada"></div>
</div>
<!-- top end -->
<a href="/2020/10/21/iOS 14 Widget Extension 开发记录/">
<h2 class="post-title">
iOS 14 Widget Extension 开发记录
</h2>
<h3 class="post-subtitle">
</h3>
<div class="post-content-preview">
为顺应历史潮流,跟进苹果大大的步伐。公司决定适配 iOS 14 新特性 —— Widget Extension。笔者有幸作为该需求的“打工人”,现将开发过程及一些心得记录如下,如有不当之处,欢迎讨论。
关于 Widget ExtensionWidget Extension 是 iOS 14 新出的一种扩展形式,类似于 Today Extension。不过,Today Extension ......
</div>
</a>
<p class="post-meta" style="margin: 10px 0;">
Posted by 高扬 on
2020-10-21
</p>
<div class="tags">
<a href="/tags/#iOS 14" title="iOS 14">iOS 14</a>
<a href="/tags/#Widget Extension" title="Widget Extension">Widget Extension</a>
</div>
</div>
<hr>
<div class="post-preview">
<!-- top start (article top hot config) -->
<!-- top end -->
<a href="/2020/12/01/如何让Xcode10与模拟器同时进入分屏模式/">
<h2 class="post-title">
如何让Xcode10与模拟器同时进入分屏模式
</h2>
<h3 class="post-subtitle">
</h3>
<div class="post-content-preview">
看到有朋友分享了如何让 Xcode9 上进入分屏模式的命令,但 Xcode10 上已经不奏效了,原因跟显示器没关系。在 Xcode10 上必须要先禁用系统的 SIP 功能才可以实现。所以这个 feature 应该是Apple的 A/B-Testing,估计会在将来放开。视频里演示了步骤。Apple 在 Xcode10 去掉了 Xcode9 上隐藏菜单 Internal 和手动开启模拟器分屏选......
</div>
</a>
<p class="post-meta" style="margin: 10px 0;">
Posted by 高扬 on
2020-12-01
</p>
<div class="tags">
</div>
</div>
<hr>
<!-- Pager -->
<ul class="pager">
</ul>
<!-- 如果开启评论功能 -->
</div>
<!-- Sidebar Container -->
<div class="
col-lg-3 col-lg-offset-0
col-md-3 col-md-offset-0
col-sm-12
col-xs-12
sidebar-container
">
<!-- Featured Tags -->
<section>
<!-- no hr -->
<h5><a href="/tags/">FEATURED TAGS</a></h5>
<div class="tags">
<a href="/tags/#Hexo" title="Hexo"
rel="2">Hexo</a>
<a href="/tags/#Hexo-Theme-LiveMyLife" title="Hexo-Theme-LiveMyLife"
rel="1">Hexo-Theme-LiveMyLife</a>
<a href="/tags/#iOS 14" title="iOS 14"
rel="1">iOS 14</a>
<a href="/tags/#Widget Extension" title="Widget Extension"
rel="1">Widget Extension</a>
</div>
</section>
<hr>
<!-- Categories -->
<!-- <h5>categories</h5> -->
<h5><a href="/categories/">CATEGORIES</a></h5>
<div class="widget">
<ul>
<a href="/categories/#Hexo">
<li>Hexo</li>
</a>
<a href="/categories/#Hexo-Theme-LiveMyLife">
<li>Hexo-Theme-LiveMyLife</li>
</a>
<a href="/categories/#iOS">
<li>iOS</li>
</a>
</ul>
</div>
<hr>
<!-- <h5>RECENT POSTS</h5> -->
<h5><a href="/">RECENT POSTS</a></h5>
<div class="widget">
<ul>
<a href="2020/12/01/%E5%A6%82%E4%BD%95%E8%AE%A9Xcode10%E4%B8%8E%E6%A8%A1%E6%8B%9F%E5%99%A8%E5%90%8C%E6%97%B6%E8%BF%9B%E5%85%A5%E5%88%86%E5%B1%8F%E6%A8%A1%E5%BC%8F/">
<li>如何让Xcode10与模拟器同时进入分屏模式</li>
</a>
<a href="2020/10/21/iOS%2014%20Widget%20Extension%20%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95/">
<li>iOS 14 Widget Extension 开发记录</li>
</a>
<a href="2020/10/06/Hexo-Theme-LiveMyLife/">
<li>Hexo-Theme-LiveMyLife</li>
</a>
<a href="2020/10/05/hello-world/">
<li>Hello World</li>
</a>
</ul>
</div>
<hr>
<!-- <h5>ARCHIVES</h5> -->
<h5><a href="/archives/">ARCHIVES</a></h5>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="archives/2020/12/">十二月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="archives/2020/10/">十月 2020</a><span class="archive-list-count">3</span></li></ul>
</div>
<hr>
<!-- Short About -->
<section class="visible-md visible-lg">
<!-- <h5><a href="/about/">ABOUT ME</a></h5> -->
<h5>ABOUT ME</h5>
<div class="short-about">
<img id="avatar_pic" src="/img/avatar/hacker.jpg" alt="avatar_pic" style="box-shadow: 5px 5px 10px 5px rgba(0, 0, 0, .5);
-moz-box-shadow: 5px 5px 10px 5px rgba(0, 0, 0, .5);
-webkit-box-shadow: 5px 5px 10px 5px rgba(0, 0, 0, .5);" />
<p>互联网打工人</p>
<!-- SNS Link -->
<ul class="list-inline">
<li>
<a target="_blank" href="https://github.com/GithubGaoYang">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
</ul>
</div>
</section>
<hr>
</div>
</div>
</div>
<!-- Footer (contains ThemeColor、viewer) -->
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<ul class="list-inline text-center">
<!--
<li>
<a target="_blank" href="https://github.com/GithubGaoYang">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
-->
</ul>
<p class="copyright text-muted">
Copyright ©
高扬
2020
<!-- <br>
Theme by
<a href="http://beantech.org" target="_blank" rel="noopener">BeanTech</a>
<span style="display: inline-block; margin: 0 5px;">
<i class="fa fa-heart"></i>
</span>
re-Ported by
<a href="https://v-vincen.life/" target="_blank" rel="noopener">Live My Life</a>
|
<iframe style="margin-left: 2px; margin-bottom:-5px;" frameborder="0" scrolling="0" width="91px" height="20px" src="https://ghbtns.com/github-btn.html?user=V-Vincen&repo=V-Vincen.github.io&type=star&count=true"></iframe> -->
</p>
</div>
</div>
</div>
</footer>
<a id="rocket" href="#top" class=""></a>
<!-- jQuery -->
<script type="text/javascript" src="/js/jquery.min.js"></script>
<!-- <script type="text/javascript" src="/js/jquery.js"></script> -->
<!-- <script type="text/javascript" src="//cdnjs.loli.net/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<!-- Bootstrap Core JavaScript -->
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<!-- Custom Theme JavaScript -->
<script type="text/javascript" src="/js/hux-blog.min.js"></script>
<!-- catalog -->
<script type="text/javascript" async="true" src="/js/catalog.js?v=1.0.0"></script>
<!-- totop(rocket) -->
<script type="text/javascript" async="true" src="/js/totop.js?v=1.0.0"></script>
<!-- Busuanzi JavaScript -->
<script type="text/javascript" async="true" src="/js/busuanzi.pure.mini.js"></script>
<!-- Scroll start -->
<script type="text/javascript" src="/js/scroll.js"></script>
<!-- Scroll end -->
<!-- ThemeColor start -->
<script type="text/javascript" src="/js/themecolor.js"></script>
<!-- ThemeColor end -->
<!-- viewer start -->
<!-- viewer start (Picture preview) -->
<script type="text/javascript" src="/js/viewer/viewer.min.js"></script>
<script type="text/javascript" src="/js/viewer/pic-viewer.js"></script>
<!-- viewer end -->
<script>
// async load function
function async (u, c) {
var d = document,
t = 'script',
o = d.createElement(t),
s = d.getElementsByTagName(t)[0];
o.src = u;
if (c) {
o.addEventListener('load', function (e) {
c(null, e);
}, false);
}
s.parentNode.insertBefore(o, s);
}
// fastClick.js
async ("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function () {
var $nav = document.querySelector("nav");
if ($nav)
FastClick.attach($nav);
}
)
</script>
<!-- Because of the native support for backtick-style fenced code blocks right within the Markdown is landed in Github Pages, From V1.6, There is no need for Highlight.js, so Huxblog drops it officially. -
https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0 - https://help.github.com/articles/creating-and-highlighting-code-blocks/ -->
<!-- <script> async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){ hljs.initHighlightingOnLoad(); }) </script> <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet"> -->
<!-- jquery.tagcloud.js -->
<!-- <script> // only load tagcloud.js in tag.html if($('#tag_cloud').length !== 0){ async("http://yoursite-url/js/jquery.tagcloud.js",function(){ $.fn.tagcloud.defaults = { //size: {start: 1, end: 1, unit: 'em'}, color: {start:
'#bbbbee', end: '#0085a1'}, }; $('#tag_cloud a').tagcloud(); }) } </script> -->
<!-- Search -->
<div class="popup search-popup local-search-popup">
<span class="popup-btn-close">
ESC
</span>
<div class="container">
<div class="row">
<!-- <div class="col-md-9 col-md-offset-1"> -->
<div class="col-lg-9 col-lg-offset-1 col-md-10 col-md-offset-1 local-search-content">
<div class="local-search-header clearfix">
<div class="local-search-input-wrapper">
<span class="search-icon">
<i class="fa fa-search fa-lg" style="margin: 25px 10px 25px 20px;"></i>
</span>
<input autocomplete="off" placeholder="Search..." type="text" id="local-search-input">
</div>
</div>
<div id="local-search-result"></div>
</div>
</div>
</div>
</div>
<script src="/js/ziploader.js"></script>
<script>
// Popup Window;
var isfetched = false;
var isXml = true;
// Search DB path;
var search_path = "search.json";
if (search_path.length === 0) {
search_path = "search.xml";
} else if (/json$/i.test(search_path)) {
isXml = false;
}
// monitor main search box;
var onPopupClose = function (e) {
$('.popup').fadeOut(300);
$('#local-search-input').val('');
$('.search-result-list').remove();
$('#no-result').remove();
$('body').css('overflow', '');
}
function proceedsearch() {
$('.popup').fadeIn(300);
var $localSearchInput = $('#local-search-input');
$localSearchInput.attr("autocapitalize", "none");
$localSearchInput.attr("autocorrect", "off");
$localSearchInput.focus();
}
// get search zip version
$.get('/searchVersion.json?t=' + (+new Date()), function (res) {
if (localStorage.getItem('searchVersion') !== res) {
localStorage.setItem('searchVersion', res);
initSearchJson();
}
});
function initSearchJson() {
initLoad(['/search.flv'], {
loadOptions: {
success: function (obj) {
localStorage.setItem('searchJson', obj['search.json'])
},
error: function (e) {
return console.log(e)
}
},
returnOptions: {
'json': TYPE_TEXT
},
mimeOptions: {
'json': 'application/json'
}
})
}
// search function;
var searchFunc = function (search_id, content_id) {
'use strict';
isfetched = true;
var datas = JSON.parse(localStorage.getItem('searchJson'));
// console.log(search_id)
var input = document.getElementById(search_id);
var resultContent = document.getElementById(content_id);
var inputEventFunction = function () {
var searchText = input.value.trim().toLowerCase();
var keywords = searchText.split(/[\s\-]+/);
if (keywords.length > 1) {
keywords.push(searchText);
}
var resultItems = [];
if (searchText.length > 0) {
// perform local searching
datas.forEach(function (data) {
var isMatch = false;
var hitCount = 0;
var searchTextCount = 0;
var title = data.title
? data.title.trim()
: '';
var titleInLowerCase = title.toLowerCase();
var content = data.content
? data.content.trim().replace(/<[^>]+>/g, "")
: '';
var contentInLowerCase = content.toLowerCase();
var articleUrl = decodeURIComponent(data.url);
var date = data.date;
var dateTime = date.replace(/T/, " ").replace(/.000Z/, "");
var imgUrl = data.header_img;
var indexOfTitle = [];
var indexOfContent = [];
// only match articles with not empty titles
keywords.forEach(function (keyword) {
function getIndexByWord(word, text, caseSensitive) {
var wordLen = word.length;
if (wordLen === 0) {
return [];
}
var startPosition = 0,
position = [],
index = [];
if (!caseSensitive) {
text = text.toLowerCase();
word = word.toLowerCase();
}
while ((position = text.indexOf(word, startPosition)) > -1) {
index.push({position: position, word: word});
startPosition = position + wordLen;
}
return index;
}
indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
});
if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
isMatch = true;
hitCount = indexOfTitle.length + indexOfContent.length;
}
// show search results
if (isMatch) {
// sort index by position of keyword
[indexOfTitle, indexOfContent].forEach(function (index) {
index.sort(function (itemLeft, itemRight) {
if (itemRight.position !== itemLeft.position) {
return itemRight.position - itemLeft.position;
} else {
return itemLeft.word.length - itemRight.word.length;
}
});
});
// merge hits into slices
function mergeIntoSlice(text, start, end, index) {
var item = index[index.length - 1];
var position = item.position;
var word = item.word;
var hits = [];
var searchTextCountInSlice = 0;
while (position + word.length <= end && index.length != 0) {
if (word === searchText) {
searchTextCountInSlice++;
}
hits.push({position: position, length: word.length});
var wordEnd = position + word.length;
// move to next position of hit
index.pop();
while (index.length != 0) {
item = index[index.length - 1];
position = item.position;
word = item.word;
if (wordEnd > position) {
index.pop();
} else {
break;
}
}
}
searchTextCount += searchTextCountInSlice;
return {hits: hits, start: start, end: end, searchTextCount: searchTextCountInSlice};
}
var slicesOfTitle = [];
if (indexOfTitle.length != 0) {
slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
}
var slicesOfContent = [];
while (indexOfContent.length != 0) {
var item = indexOfContent[indexOfContent.length - 1];
var position = item.position;
var word = item.word;
// cut out 100 characters
var start = position - 20;
var end = position + 80;
if (start < 0) {
start = 0;
}
if (end < position + word.length) {
end = position + word.length;
}
if (end > content.length) {
end = content.length;
}
slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
}
// sort slices in content by search text's count and hits' count
slicesOfContent.sort(function (sliceLeft, sliceRight) {
if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
return sliceRight.searchTextCount - sliceLeft.searchTextCount;
} else if (sliceLeft.hits.length !== sliceRight.hits.length) {
return sliceRight.hits.length - sliceLeft.hits.length;
} else {
return sliceLeft.start - sliceRight.start;
}
});
// select top N slices in content
var upperBound = parseInt('1');
if (upperBound >= 0) {
slicesOfContent = slicesOfContent.slice(0, upperBound);
}
// highlight title and content
function highlightKeyword(text, slice) {
var result = '';
var prevEnd = slice.start;
slice.hits.forEach(function (hit) {
result += text.substring(prevEnd, hit.position);
var end = hit.position + hit.length;
result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
prevEnd = end;
});
result += text.substring(prevEnd, slice.end);
return result;
}
var resultItem = '';
// if (slicesOfTitle.length != 0) { resultItem += "<li><a target='_blank' href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>"; } else { resultItem += "<li><a target='_blank' href='" +
// articleUrl + "' class='search-result-title'>" + title + "</a>"; } slicesOfContent.forEach(function (slice) { resultItem += "<a target='_blank' href='" + articleUrl + "'><p class=\"search-result\">" + highlightKeyword(content, slice) +
// "...</p></a>"; }); resultItem += "</li>";
if (slicesOfTitle.length != 0) {
resultItem += "<a target='_blank' href='" + articleUrl + "' class='search-result'><div class='search-result-left'><div class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</div><time class='search-result-date'>" + dateTime + "</time>";
} else {
resultItem += "<a target='_blank' href='" + articleUrl + "' class='search-result'><div class='search-result-left'><div class='search-result-title'>" + title + "</div><time class='search-result-date'>" + dateTime + "</time>";
}
slicesOfContent.forEach(function (slice) {
resultItem += "<p class=\"search-result-content\">" + highlightKeyword(content, slice) + "...</p>";
});
resultItem += "</div><div class='search-result-right'><img class='media-image' src='" + imgUrl + "' width='64px' height='48px'></img></div></a>";