-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1678 lines (1341 loc) · 55.8 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>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://is-whale.github.io//media/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/850552586/[email protected]/css/live2d.css">
<link rel="stylesheet" href="https://is-whale.github.io//styles/main.css">
<script src="https://is-whale.github.io//media/js/valine.min.js"></script>
<script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
<meta name="description" content="生当复来归,死亦长相思。" />
<meta http-equiv="x-pjax-version" content="v123">
<title>whale</title>
</head>
<body>
<div id="content">
<div class="nav-large">
<div class="row">
<!-- ----------------左侧菜单栏html 👇-------------------------------------->
<!--------------- pc端菜单栏👇 ---------------->
<div class="side"><head>
<link rel="stylesheet" href="https://is-whale.github.io//media/css/bootstrap.min.css">
<link rel="stylesheet" href="https://is-whale.github.io//styles/main.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/rainbow.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/850552586/[email protected]/js/clipboard.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/850552586/[email protected]/css/live2d.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- fancybox -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
<!--------- 数学公式👇---- -->
<!--------- 数学公式👆----------------- -->
<!--------- daovocie功能👇 ------------------->
<!--------- daovocie功能👆 ------------------->
<!-- -----------------twikoo评论系统引入👇 --------->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/twikoo.all.min.js"></script>
<!-- -----------------twikoo评论系统引入👆 --------->
<!---------------- leancloud api 功能依赖引入👇 -------->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/av-min.js"></script>
<!---------------- leancloud api 功能依赖引入👆 -------->
<!------------------ valine评论系统引入👇 ------------------>
<script src="https://is-whale.github.io//media/js/valine.min.js"></script>
<!------------------ valine评论系统引入👆 ------------------>
<!---------------- 今日诗词api功能依赖👇 ----------------------->
<script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
<!---------------- 今日诗词api功能依赖👆 ----------------------->
<!---------------- 今日诗词api功能依赖👇 ----------------------->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ispeak-bber/ispeak-bber.min.js" charset="utf-8"></script>
<!---------------- 哔哔功能依赖👆 ----------------------->
</head>
<style>
body {
overflow-x: hidden;
height: 100vh;
overflow-y: scroll;
cursor: url("https://is-whale.github.io//media/images/mouse_cursor.png"), auto
}
</style>
<body>
<!--=------ 页面加载动态画面👇 --------------->
<div class="pjaxloading" onclick="pjaxloadingClose()">
<div class="loadingbackground"></div>
<div id="loading-aname">
<div class="loading-aname">
</div>
</div>
</div>
<!--=------ 页面加载动态画面👆 --------------->
<!--------------- 左侧菜单栏👇 ------------------------>
<div id=side>
<div class="r_m_div">
<a onclick="showAaplayer()"><i style="font-size: 20px;"><img
src='https://is-whale.github.io//media/images/music.png' alt="音乐播放器" class="musicbtn"></i></a>
</div>
<div class="avatar-border">
<img src="https://is-whale.github.io//images/avatar.png?v=1719812050930" class="avatar">
</div>
<div class="sitename">whale</div>
<span class="description" data-text='["生当复来归,死亦长相思。"]'> </span>
<div class="siteinfocontainer">
<span class="siteinfo">文章</span>
<span class="siteinfo">标签</span>
</div>
<div class="siteinfocontainer">
<span class="siteinfo" id="siteinfo-postsnum"></span>
<span class="siteinfo">7</span>
</div>
<div class="search">
<!-- <input type="text" class="search-input" placeholder="标题搜索(●'◡'●)" /> -->
<input type="text" class="search-input" placeholder="标题搜索 ⚆_⚆ つ♡">
<div class="search-results"></div>
</div>
<div class="share-button">
<span></span>
<a href="https://github.com/is-whale/" target="_blank"><i style="font-size: 20px;"><img class="icon"
src="https://is-whale.github.io//media/images/github.png" alt=""></i></a>
</div>
<div id="qq" style="display:none"></div>
<!------------ 加载菜单按钮👇 ------------------------->
<div class="menucontainer">
<div class="mchocie description">
<a data-pjax href="/" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="首页"></i> <span
data-text="首页">首页</span>
</a>
</div>
<div class="mchocie description">
<a data-pjax href="/archives" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="归档"></i> <span
data-text="归档">归档</span>
</a>
</div>
<div class="mchocie description">
<a data-pjax href="/tags" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="标签"></i> <span
data-text="标签">标签</span>
</a>
</div>
<div class="mchocie description">
<a data-pjax href="/post/about" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="关于"></i> <span
data-text="关于">关于</span>
</a>
</div>
<div class="mchocie description">
<a data-pjax href="https://is-whale.github.io//talk" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="说说"></i> <span data-text="说说">说说</span>
</a>
</div>
<div class="mchocie description">
<a data-pjax href="https://is-whale.github.io//friends" class="menubutton" style="margin-right: 15px;">
<i><img class="icon menuicon" src="" alt="友人帐"></i> <span data-text="友人帐">友人帐</span>
</a>
</div>
<!-- -->
</div>
<!------------ 加载菜单按钮👆 ------------------------->
<hr>
<style>
.copyright {
font-size: 15px;
color: #d9d9d9;
}
@media screen and (min-width: 1200px) {
.foot {
width: 100%;
height: 130px;
}
}
@media screen and (max-width: 1200px) {
.foot {
display: none;
}
}
</style>
<body>
<div class="foot">
<div id="footinfo">Powered by <a href="https://github.com/getgridea/gridea" target="_blank">Gridea</a> | Theme: <a
href="https://github.com/850552586/gridea-theme-fog">Fog</a>
<div>
<div id="sitegotimeDate">载入天数...</div>
<div id="sitegotimes">载入时分秒...</div>
<div id="cussitetime" style="display:none">01/21/2020</div>
</div>
<div>
</div>
<div class="copyright" style="color:white;text-align: center;">Copyright © 2020 备案号: 鄂ICP备...号
</div>
</div>
</div>
</body>
<script>
//----------------------站点运行时间
var now = new Date();
function createtime() {
var sitegotime = document.getElementById("cussitetime").innerHTML + " 00:00:00";
var grt = new Date(sitegotime); //此处修改你的建站时间或者网站上线时间
now.setTime(now.getTime() + 250);
days = (now - grt) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (now - grt) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if (String(hnum).length == 1) {
hnum = "0" + hnum;
}
minutes = (now - grt) / 1000 / 60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if (String(mnum).length == 1) {
mnum = "0" + mnum;
}
seconds = (now - grt) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if (String(snum).length == 1) {
snum = "0" + snum;
}
document.getElementById("sitegotimeDate").innerHTML = "本站已安全运行 " + dnum + " 天 ";
document.getElementById("sitegotimes").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
}
let intervalId = setInterval("createtime()", 250);
</script>
</div>
<script src="https://is-whale.github.io//media/js/wordshow.js"></script>
<!--------------- 左侧菜单栏👆 ------------------------>
<!----------------- 顶部菜单栏👇 ------------------------>
<!----------------- 顶部菜单栏👆 ------------------------>
<!--核心功能加载-->
<script src="https://is-whale.github.io//media/js/mainfunc.js"></script>
<!------------- Fog1.0版本彩蛋👇 -------------->
<!-- <section id="terrestrial" class="popup">
<a href="#" class="back">< back</a>
</section>
<div class="flycontainer">
<div class="flyword">御风飞行中...</div>
</div>
<script>
$("#fog_go").click(function(){fog_go()});
async function fog_go(){
$(".bars").hide()
$("#live2d").hide()
await sleep(3000);
$(".flycontainer").css("display","flex");
$(".popup").fadeOut(500)
await sleep(2000);
var sitename = "whale";
getFogUser(sitename);
}
function fog_goregis(){
var sitename = "whale";
var siteurl = "https://is-whale.github.io/";
regisFogUser(sitename,siteurl);
}
fog_goregis();
</script> -->
<!------------- Fog1.0版本彩蛋👆 -------------->
<!------ 根据自定义配置声明变量👇 --------------------->
<script>
let postnumChoice = false
</script>
<script>
let shareChoice = true
</script>
<script>
let donateChoice = false
</script>
<script>
let searchChoice = true
</script>
<script>let postsnum = 0;</script>
<div id="side-posttitle" style="display: none;">
智能指针
<script>
postsnum += 1
</script>
隐式构造函数
<script>
postsnum += 1
</script>
对象生存期
<script>
postsnum += 1
</script>
纯虚函数
<script>
postsnum += 1
</script>
成员初始化列表
<script>
postsnum += 1
</script>
auto关键字
<script>
postsnum += 1
</script>
双系统删除引导的修复
<script>
postsnum += 1
</script>
修复Gridea远端文章
<script>
postsnum += 1
</script>
dell调节亮度
<script>
postsnum += 1
</script>
加密压缩包暴力破解
<script>
postsnum += 1
</script>
文件恢复软件
<script>
postsnum += 1
</script>
电控远程调参的一个方案
<script>
postsnum += 1
</script>
机械组图纸协作体系
<script>
postsnum += 1
</script>
解决Gridea打开空白
<script>
postsnum += 1
</script>
Robomaster移植官方代码使用DAP
<script>
postsnum += 1
</script>
记录Gridea同步不成功的解决方案
<script>
postsnum += 1
</script>
Gridea配置
<script>
postsnum += 1
</script>
Hello Gridea
<script>
postsnum += 1
</script>
</div>
<script>
let menupos = 'left';
$("#siteinfo-postsnum").html(postsnum);
</script>
<script>
let commentsHide = false
</script>
<!------ 根据自定义配置声明变量👆 --------------------->
<!----------根据自定义配置设置图标信息👇---------->
<script>
var icondict = new Array();
</script>
<!----------根据自定义配置设置图标信息👆---------->
</body>
<script src="https://is-whale.github.io//media/share/dist/Share.js"></script>
<!-- 页面pjax测试 -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery.pjax/2.0.1/jquery.pjax.js"></script>
<!--确保jQuery已经在此之前加载-->
<!-- <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> -->
<script src="https://is-whale.github.io//media/js/all-pjax.js"></script>
<script>
//-------------------------------说说功能👇--------------------------------------
let talksall = [];
let talks = [];
let talkindex = 0;
get();
function get() {
var t = JSON.parse('[{"author":"","img":"","text":"","time":""}]');
talkindex = t.length - 1;
for (var i = 0; i <= t.length - 1; i++) {
var d = {};
d["time"] = t[i].time;
d["author"] = t[i].author;
d["text"] = t[i].text;
d["img"] = t[i].img;
talksall.push(d);
}
}
function add() {
for (var i = talkindex; i >= 0 && i > talkindex - 3; i--) {
talks.push(talksall[i]);
}
talkindex = (talkindex - 3) >= 0 ? (talkindex - 3) : -1;
if (talkindex < 0) $("#getmorebt").hide();
show();
}
function show() {
var talkT = document.getElementById("talkContainer");
talkT.innerHTML = "";
for (var i = 0; i < talks.length; i++) {
if (talks[i].img != '') {
talkT.innerHTML += '\
<div class="talk" v-for="t in talks"> \
<span data-fancybox="images" href="' + talks[i].img + '"><img src="' + talks[i].img + '" class="talkimg"></span> \
<div class="ainfo">\
<div class="ainfo-intro">\
<div class="author">' + talks[i].author + '</div>·\
<div class="time">' + talks[i].time + '</div>\
</div>\
</div>\
<div class="talkcontent">' + talks[i].text + '\
</div\>\
';
} else {
talkT.innerHTML += '\
<div class="talk" v-for="t in talks"> \
<div class="ainfo">\
<div class="ainfo-intro">\
<div class="author">' + talks[i].author + '</div>·\
<div class="time">' + talks[i].time + '</div>\
</div>\
</div>\
<div class="talkcontent">' + talks[i].text + '\
</div\>\
';
}
}
}
//-------------------------------说说功能👆--------------------------------------
</script>
<!---->
<script>
function replaceAvatar() {
twikoo_avatar = $(".tk-avatar-img");
for (var i = 0; i < twikoo_avatar.length; i++) {
var asrc = twikoo_avatar.eq(i).attr('src');
if (asrc.search('cn.gravatar.com') != -1) {
twikoo_avatar.eq(i).attr('src', 'https://is-whale.github.io//media/images/comavatar.png');
}
}
}
function showWechat() {
var wechat = '';
alert("博主微信号:" + wechat);
return false;
}
</script>
<script>
/**
* https://github.com/tangkaichuan/gridea-search
*/
// 检查缓存是否最新
function checkCache() {
var caches_postsnum = localStorage.getItem("postsnum");
var pt = document.getElementById("side-posttitle").innerHTML;
pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "")
var ptlen = pt.length;
var ptlen_storage = localStorage.getItem("poststitlelen");
if (caches_postsnum != postsnum || ptlen != ptlen_storage) {
console.log("更新缓存");
return false
}
return true;
}
(function () {
var CACHES = checkCache()
if (!CACHES) {
var NOW = Date.now()
var API_CONTENT = '../api-content/index.html' + '?_=' + NOW
preload(API_CONTENT);
getContents(show_getContentresult);
}
function show_getContentresult(data) {
console.log("获取成功");
var postslen = data["posts"].length;
localStorage.setItem('postsnum', postslen);
var poststitlelen = 0;
var pt = document.getElementById("side-posttitle").innerHTML;
pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "");
localStorage.setItem('poststitlelen', pt.length);
}
// preload
function preload(url) {
var preloadLink = document.createElement('link')
preloadLink.href = url
preloadLink.rel = 'preload'
preloadLink.as = 'fetch'
preloadLink.crossOrigin = 'anonymous'
document.head.appendChild(preloadLink)
}
// 异步 GET 请求
function get(obj) {
var xhr = new XMLHttpRequest()
xhr.open('get', obj.url, true)
xhr.send(null)
xhr.onreadystatechange = function () {
// 异步请求:响应状态为4,数据加载完毕
if (xhr.readyState === 4) {
if (xhr.status === 200) {
obj.success(xhr.responseText)
} else {
obj.error(xhr.status)
}
}
}
}
// 获取博客全文 api
function getContents(callback) {
if (CACHES) {
callback(CACHES.contents)
} else {
get({
url: API_CONTENT,
success: function (data) {
callback(JSON.parse(data));
localStorage.setItem('ContentsCache', data);
getStorageContent();
}
})
}
}
})()
//------------------------核心功能--pjax全局渲染👇-------------------
let talkinit = false;
$(document).pjax('a[data-pjax]', '#main', {
fragment: '#main',
timeout: 8000
}).on('pjax:complete', function () {
//代码块高亮渲染
document.querySelectorAll('pre code').forEach((block) => {
hljs.highlightBlock(block);
});
//文章热度
if(postnumChoice){
getHotnum();
}
//文章索引
toginit();
//清空搜索栏
if (searchChoice) {
searchInit();
searchInput.value = "";
}
var pl = window.location.pathname;
//说说更新
if (pl.search("talk") != -1 && !talkinit) {
add();
talkinit = true;
} else if (pl.search("talk") != -1) {
show();
}
if (pl.search("post") != -1) {
if (shareChoice)
shareInit();
if (donateChoice)
donateInit();
if ("default" == "default"&&!commentsHide) {
$("#comment").hide()
commentsHide = true
}
lazyload();
codeinit();
if ("default" == "twikoo") {
//twikoo头像更换
setTimeout(replaceAvatar, 3000);
setTimeout(replaceAvatar, 8000); //部分博主站点速度加载过慢,再添加一个延迟
}
}
if (btstate == true)
dropdown();
}).on('pjax:start', function () {
$(".pjaxloading").fadeIn(50);
}).on('pjax:end', function () {
$(".pjaxloading").fadeOut(50);
});
//------------------------核心功能--pjax全局渲染👆-------------------
//-------------------------------------------------搜索
// 获取搜索框、搜索按钮、清空搜索、结果输出对应的元素
if (searchChoice) {
var searchInput = document.querySelector('.search-input');
var searchResults = document.querySelector('.search-results');
}
// 申明保存文章的标题、链接、内容的数组变量
var searchValue = '',
arrItems = [],
arrLinks = [],
arrTitles = [],
arrContents = [],
arrResults = [],
indexItem = [],
itemLength = 0;
var tmpDiv = document.createElement('div');
tmpDiv.className = 'result-item';
function getStorageContent() {
var data = localStorage.getItem('ContentsCache');
data = JSON.parse(data);
posts = data["posts"];
for (var i = 0; i < posts.length; i++) {
arrLinks[i] = posts[i].link;
arrTitles[i] = posts[i].title;
arrContents[i] = posts[i].content;
itemLength++;
}
}
if (checkCache())
getStorageContent();
// 输入框内容变化后就开始匹配,可以不用点按钮
// 经测试,onkeydown, onchange 等方法效果不太理想,
// 存在输入延迟等问题,最后发现触发 input 事件最理想,
// 并且可以处理中文输入法拼写的变化
searchInput.oninput = function () {
setTimeout(searchConfirm, 0);
}
searchInput.onfocus = function () {
searchResults.style.display = 'block';
}
function searchConfirm() {
if (searchInput.value == '') {
searchResults.style.display = 'none';
} else if (searchInput.value.search(/^\s+$/) >= 0) {
// 检测输入值全是空白的情况
searchInit();
var itemDiv = tmpDiv.cloneNode(true);
itemDiv.innerText = '请输入有效内容...';
searchResults.appendChild(itemDiv);
} else {
// 合法输入值的情况
searchInit();
searchValue = searchInput.value;
// 在标题、内容中查找
searchMatching(arrTitles, arrContents, searchValue);
}
}
// 每次搜索完成后的初始化
function searchInit() {
arrResults = [];
indexItem = [];
searchResults.innerHTML = '';
searchResults.style.display = 'block';
}
function searchMatching(arr1, arr2, input) {
// 忽略输入大小写
input = new RegExp(input, 'i');
var step = 10;
// 在所有文章标题、内容中匹配查询值
for (i = 0; i < itemLength; i++) {
var indexContent = arr2[i].search(input);
//标题匹配
if (arr1[i].search(input) != -1) {
indexItem.push(i); // 保存匹配值的索引
if (indexContent != -1) {
startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
arrResults.push("....." + searchcontent + ".....");
} else
arrResults.push("");
}
//内容匹配
else if (indexContent != -1) {
indexItem.push(i); // 保存匹配值的索引
startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
arrResults.push("....." + searchcontent + ".....");
}
}
// 输出总共匹配到的数目
var totalDiv = tmpDiv.cloneNode(true);
totalDiv.innerHTML = '<b>总匹配:' + indexItem.length + ' 项<hr></b>';
searchResults.appendChild(totalDiv);
// 未匹配到内容的情况
if (indexItem.length == 0) {
var itemDiv = tmpDiv.cloneNode(true);
itemDiv.innerText = '未匹配到内容...';
searchResults.appendChild(itemDiv);
}
// 将所有匹配内容进行组合
for (i = 0; i < arrResults.length; i++) {
var itemDiv = tmpDiv.cloneNode(true);
itemDiv.innerHTML = '<a data-pjax class="searchresults" href="' + arrLinks[indexItem[i]] + '"><b>[' +
arrTitles[indexItem[i]] +
']</b><p>' + arrResults[i] + '</p></a><hr />';
searchResults.appendChild(itemDiv);
}
}
</script>
<!--------------------- 菜单栏图标加载功能👇 ----------------------->
<script>
var menulist = $(".menuicon");
var menulength = menulist.length;
for (var i = 0; i < menulength; i++) {
var altname = menulist.eq(i).attr("alt");
var iconurl = icondict[altname];
if (iconurl == undefined || iconurl == '')
continue;
if (iconurl == 'Home') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/Home.png");
menulist.eq(i).show();
} else if (iconurl == 'Archive') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/Archive.png");
menulist.eq(i).show();
} else if (iconurl == 'Tag') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/Tag.png");
menulist.eq(i).show();
} else if (iconurl == 'About') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/About.png");
menulist.eq(i).show();
} else if (iconurl == 'Talk') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/Talk.png");
menulist.eq(i).show();
} else if (iconurl == 'Friends') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/Friends.png");
menulist.eq(i).show();
} else if (iconurl == 'Fly') {
menulist.eq(i).attr("src", "https://is-whale.github.io//media/images/wind.png");
menulist.eq(i).show();
} else {
menulist.eq(i).attr("src", iconurl);
menulist.eq(i).show();
}
}
</script>
<!--------------------- 菜单栏图标加载功能👆 ----------------------->
<script>
//--------------------bber-onetalk加载👇--------------------------------
function bberonetalkLoad(){
bberjsonurl = '';
if ( $("#bber-talk").length > 0 ) {
jsonUrl = bberjsonurl
$.getJSON(jsonUrl+"?t="+Date.parse( new Date()),function(res){
var bberHtml = ''
$.each(res.data, function(i, item){
d = new Date(item.date)
date = d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate() +' '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()
dataTime = '<span class="datatime">'+date+'</span>'
bberHtml += '<li class="item item-'+(i+1)+'">'+dataTime+': <a data-pjax href="https://is-whale.github.io//bber">'+item.content+'</a></li>'
});
$('#bber-talk').append('<span class="index-talk-icon"><svg viewBox="0 0 1024 1024" width="21" height="21"><path d="M184.32 891.667692c-12.603077 0-25.206154-2.363077-37.809231-7.876923-37.021538-14.966154-59.864615-49.624615-59.864615-89.009231v-275.692307c0-212.676923 173.292308-385.969231 385.969231-385.969231h78.76923c212.676923 0 385.969231 173.292308 385.969231 385.969231 0 169.353846-137.846154 307.2-307.2 307.2H289.083077l-37.021539 37.021538c-18.904615 18.116923-43.323077 28.356923-67.741538 28.356923zM472.615385 195.347692c-178.018462 0-322.953846 144.935385-322.953847 322.953846v275.692308c0 21.267692 15.753846 29.144615 20.48 31.507692 4.726154 2.363077 22.055385 7.876923 37.021539-7.08923l46.473846-46.473846c6.301538-6.301538 14.178462-9.452308 22.055385-9.452308h354.461538c134.695385 0 244.184615-109.489231 244.184616-244.184616 0-178.018462-144.935385-322.953846-322.953847-322.953846H472.615385z"></path><path d="M321.378462 512m-59.076924 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M518.301538 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M715.224615 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153846 0 59.076923 59.076923 0 1 0-118.153846 0Z"></path></svg></span><ul class="talk-list">'+bberHtml+'</ul>')
//Lately({ 'target': '#bber-talk .datatime' });
});
function Roll (){
var list_li = $('.talk-list li'),cur_li = list_li.first(),last_li = list_li.last();
last_li.after(cur_li);
};
setInterval(Roll,3000);
}
}
//--------------------bber-onetalk加载👆--------------------------------
</script>
</div>
<!--------------- pc端菜单栏👆 ---------------->
<div id="tab1" class="tab">
<div class="bars">
<span></span>
<span></span>
<span></span>
</div>
<div class="close"></div>
</div>
<div class="col-md-1 col-lg-3"></div>
<!----------- 移动端导航栏👇 ----------------->
<div class="mobilebar"><head>
<!-- 引入Bootstrap核心样式文件 -->
<link rel="stylesheet" href="https://is-whale.github.io//media/css/bootstrap.min.css">
</head>
<style>
.navmobile {
z-index: 15;
max-height: 40vh;
overflow-y: scroll;
overflow-x: hidden;
}
@media screen and (max-width: 1200px) {
.navbar {
max-width: 100vw;
}
}
@media screen and (max-width:1200px) and (min-width: 768px) {
@media (min-width: 768px) {
.navbar-nav {
float: right;
margin: 0;
}
}
}
@media screen and (max-width:768px) {
.mbapspan {
padding: 0;
}
}
</style>
<div class="pjaxloading" onclick="pjaxloadingClose()">
<div class="loadingbackground"></div>
<div id="loading">
<div class="loading">
</div>
</div>
</div>
<nav class="navbar navbar-inverse navbar-fixed-top navmobile">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#barmenu"
aria-expanded="false" id="barbutton">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a data-pjax class="navbar-brand" href="https://is-whale.github.io/">whale |</a>
<span class="navbar-brand mbapspan"><i id="mbaplayer" class="fa fa-play-circle-o" aria-hidden="true"
style="font-size: 28px;top: 12px;position: absolute;" onclick="aplayerPlay();"></i></span>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="barmenu">
<ul class="nav navbar-nav">
<li>
<a data-pjax href="/">
首页
</a>
</li>
<li>
<a data-pjax href="/archives">
归档
</a>
</li>
<li>
<a data-pjax href="/tags">
标签
</a>
</li>
<li>
<a data-pjax href="/post/about">
关于
</a>
</li>