-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2194 lines (1840 loc) · 93.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
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>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="./favicon.ico" />
<title></title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/font-awesome.min.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/katex.min.css">
<link rel='stylesheet' href="https://unpkg.com/@waline/[email protected]/dist/waline.css">
</head>
<body>
<style id="bootstrap_css">
</style>
<style id="body_opacity">
body:before {
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
content: "";
position: fixed;
opacity: 0.3;
}
</style>
<style id="blogcss">
.article-item,
.article-content,
.bbg-comment-area,
.page-content,
.tag-content {
background-color: white;
margin-top: 30px;
margin-bottom: 30px;
padding: 16px;
box-shadow: 0 1px 1px -2px rgb(0 0 0 / 60%),
0 2px 1px 0 rgb(0 0 0 / 36%), 0 1px 2px 1px rgb(0 0 0 / 32%);
opacity: 0.8;
border-radius: 6px;
}
.article-content {
padding: 30px 4%;
}
.copyright_hint {
border-left-color: #5cb85c !important;
border-radius: 3px;
margin-bottom: 20px;
padding: 1em;
position: relative;
border: 1px solid #eee;
border-left-width: 5px;
font-size: 110%;
}
ref {
display: none;
}
info-hint,
warning-hint,
success-hint,
danger-hint {
display: block;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 15px;
background-color: rgb(235, 234, 234);
}
.hint-heading {
font-size: 110%;
}
info-hint .hint-heading {
color: #0550ae;
}
warning-hint .hint-heading {
color: #ae8105;
}
success-hint .hint-heading {
color: #1b6e08;
}
danger-hint .hint-heading {
color: #ae2105;
}
info-hint {
border-left: #0550ae solid 2px;
}
warning-hint {
border-left: #ae8105 solid 2px;
}
success-hint {
border-left: #1b6e08 solid 2px;
}
danger-hint {
border-left: #ae2105 solid 2px;
}
.article-content, .page-content {
word-break: break-all;
}
.articlebottomnav {
background-color: white;
box-shadow: 0 1px 1px -2px rgb(0 0 0 / 60%),
0 2px 1px 0 rgb(0 0 0 / 36%), 0 1px 5px 0 rgb(0 0 0 / 32%);
opacity: 0.8;
border-radius: 6px;
}
.nav-item-active {
border-bottom: 2px solid white;
}
.friend-card {
box-shadow: 0 1px 1px -2px rgb(0 0 0 / 60%),
0 2px 1px 0 rgb(0 0 0 / 36%), 0 1px 5px 0 rgb(0 0 0 / 32%);
border-radius: 6px;
font-size: 10px !important;
width: 168px;
padding: 0;
display: inline-flex;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .12);
background: #fffefe;
margin: 0;
margin-bottom: 5px;
margin-right: 5px;
transition: box-shadow 0.2s ease;
}
.friend-card:hover {
box-shadow: 0 3px 1px -2px rgb(0 0 0 / 60%), 0 2px 2px 0 rgb(0 0 0 / 36%), 0 1px 5px 0 rgb(0 0 0 / 32%);
}
.friend-card h5 {
font-size: 1rem !important;
text-align: center;
;
}
.friend-card a {
text-decoration: none;
font-weight: bold;
}
.ellipsis {
display: none;
}
.friend-card-img {
width: 100%;
}
.title_that_should_not_have_underline {
text-decoration: none !important;
}
@media (max-width: 1050px) {
#empty_friend_book_list {
display: none;
}
}
@media (max-width: 520px) {
#article-bottom-bar {
display: none;
}
}
.article_tag {
border-radius: 40px;
color: white;
border: none;
}
.article_tag::before {
content: "#";
}
.article-item-sub,
.article-content-sub {
color: #999;
}
.article-item-sub-dotted {
border-bottom: 1px dashed #676161;
}
.small_empty_between_lines {
margin-top: 6px;
}
.small_empty_inline {
margin-left: 2px;
display: inline-block;
}
.article-tag-underlined {
text-decoration: 1px underline;
text-underline-position: under;
margin-left: 8px;
}
nav {
box-shadow: 0 3px 1px -2px rgb(0 0 0 / 20%),
0 2px 2px 0 rgb(0 0 0 / 14%), 0 1px 5px 0 rgb(0 0 0 / 12%);
padding: 0 !important;
}
.nav-link {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-brand {
padding-top: 10px;
padding-bottom: 10px;
font-size: 16px;
font-weight: bolder;
}
.archive-nav-item {
background-color: white !important;
}
@keyframes fade-in-right {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@-webkit-keyframes fade-in-right {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
table,
thead,
tr,
th,
td {
border: 1px solid #ddd;
padding-left: 15px;
padding-right: 30px;
padding-top: 5px;
padding-bottom: 5px;
text-align: left;
}
</style>
<style>
blockquote {
color: #666666;
margin: 0;
padding-left: 12px;
border-left: 4px #eee solid;
}
hr {
display: block;
border: 0;
border-top: 1px solid #aaa;
border-bottom: 1px solid #eee;
margin: 1em 0;
padding: 0;
}
pre,
code,
kbd,
samp {
border-radius: 4px;
background-color: #f2f5f8;
padding-top: 4px;
padding-bottom: 4px;
padding-left: 12px;
padding-right: 12px;
color: #0550ae;
display: inline-block;
word-break: break-all !important;
white-space: pre-wrap;
}
#back_to_top_btn {
position: fixed;
z-index: 99;
right: 20px;
bottom: 30px;
}
#back_to_top_btn * i {
width: 0.8em;
}
#setting_theme_btn {
position: fixed;
z-index: 99;
right: 20px;
bottom: 80px;
}
#setting_theme_btn * i {
width: 0.8em;
}
</style>
<style id="theme_css">
</style>
<style id="dark_mode">
body {
background-color: #000000c7;
}
info-hint, warning-hint, success-hint, danger-hint {
background-color: #000000f4;
}
.hint-heading {
color: white!important;
}
.blog_title_jumbotron,
.bg-light {
background-color: #363232 !important;
}
.copyright_hint {
color: white;
}
#blog_index_title,
#blog_index_subtitle,
.article-content h2,
.page-content h2,
#article-content-html p,
#page-content-html p {
color: white;
}
.article-item,
.article-content,
.page-content {
background-color: #000000a8
}
.article-item p,
.article-item-sub,
.article-content-sub,
#page_order_html,
#bottom_info_html {
color: lightgrey !important;
}
.card,
.tag-content {
background-color: black;
color: white
}
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
th,
td,
.vcontent *,
#veditor {
color: white
}
.vcontent p,
.vnick,
.vlink,
.vmail,
.vinput,
.vsubmit {
color: white !important
}
.vcontent * {
background-color: black !important;
}
.expand::after {
background: black !important;
color: white !important;
}
.expand::before {
background: rgba(0, 0, 0, 0.5) !important
}
a {
color: rgb(148, 187, 255);
}
pre,
code,
kbd,
samp {
border-radius: 4px;
background-color: black !important;
padding-top: 4px;
padding-bottom: 4px;
padding-left: 12px;
padding-right: 12px;
display: inline-block;
color: white!important
}
code * {
color: white!important
}
.bbg-comment-area {
background-color: black;
color: white
}
.modal-header, .modal-body {
background-color: rgb(139, 132, 132)!important;
color: white;
}
.archive-nav {
border-bottom: 1px solid var(--bs-dark);
}
.archive-nav-item {
background-color: black !important;
}
.archive-nav-link {
background-color: unset !important;
border-color: var(--bs-dark) var(--bs-dark) #000 !important;
}
</style>
<style id="highlight_css">
</style>
<style id="theme_settings">
</style>
<style id="custom_css"></style>
<div id="loading" style="font-family: sans-serif">
<br /><br /><br />
<center>
<h2>Loading...</h2>
</center>
</div>
<div id="top"></div>
<div id="root" style="display:none;"></div>
<div id="setting_theme_btn">
<a href="javascript:toggle_theme_setting();" class="btn btn-secondary"><i class="fa fa-cog"></i></a>
</div>
<div id="back_to_top_btn">
<a href="javascript:scrollTo(0,0);" class="btn btn-secondary"><i class="fa fa-angle-up"></i></a>
</div>
<div class="modal" tabindex="-1" id="search_dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="search_dialog_title"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="search_dialog_body">
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="image_viewer_dialog">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="image_viewer_dialog_title"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="image_viewer_dialog_body">
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="theme_setting_dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="theme_setting_dialog_title"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="theme_setting_dialog_body">
</div>
</div>
</div>
</div>
<script src="https://unpkg.com/[email protected]/marked.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/axios.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/Valine.min.js"></script>
<script src="https://unpkg.com/@waline/[email protected]/dist/waline.js"></script>
<script src="https://unpkg.com/@highlightjs/[email protected]/highlight.min.js"></script>
<script src="https://unpkg.com/[email protected]/sjcl.js"></script>
<script src="https://unpkg.com/[email protected]/dist/katex.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/contrib/auto-render.min.js"></script>
<script>
const image_viewer_dialog = new bootstrap.Modal(document.getElementById('image_viewer_dialog'));
const theme_setting_dialog = new bootstrap.Modal(document.getElementById('theme_setting_dialog'));
function toggle_theme_setting() {
theme_setting_dialog.toggle();
loadThemeSettingsDialog();
}
function hook_after_dark_mode_setting_has_been_modified(){
const dark_mode_setting = document.querySelector("#selection_dark_mode_setting").value;
localStorage.setItem("dark_mode_setting", dark_mode_setting);
reload_dark_mode_setting();
}
function hook_after_use_serif_font_setting_has_been_modified(){
const use_serif_font = document.querySelector("#use_serif_font").checked;
localStorage.setItem("use_serif_font", use_serif_font?"true":"false");
reload_serif_font_setting();
}
function reload_dark_mode_setting(){
switch (localStorage.getItem("dark_mode_setting")) {
case "light_mode":
switch_night_mode("light");
break;
case "dark_mode":
switch_night_mode("dark");
break;
default:
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
switch_night_mode("dark");
} else {
switch_night_mode("light");
}
}
}
function loadThemeSettingsDialog() {
document.getElementById("theme_setting_dialog_title").innerHTML = `<i class="fa fa-cog"></i> 主题设置`;
document.getElementById("theme_setting_dialog_body").innerHTML = `<h4><i class="fa fa-moon-o"></i> 暗色模式设置</h4>
<select class="form-select" onchange="hook_after_dark_mode_setting_has_been_modified()" id="selection_dark_mode_setting">
<option value="auto_switch">跟随系统</option>
<option value="light_mode">亮色模式</option>
<option value="dark_mode">暗色模式</option>
</select>
<br />
<h4><i class="fa fa-font"></i> 字体</h4>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="use_serif_font" onchange="hook_after_use_serif_font_setting_has_been_modified();">
<label class="form-check-label" for="use_serif_font">使用衬线字体</label>
</div>`;
if(localStorage.getItem("dark_mode_setting") === null){
localStorage.setItem("dark_mode_setting", "auto_switch");
}
if(localStorage.getItem("use_serif_font") === null){
localStorage.setItem("use_serif_font", "false");
}
document.getElementById("selection_dark_mode_setting").value = localStorage.getItem("dark_mode_setting");
document.getElementById("use_serif_font").checked = localStorage.getItem("use_serif_font") === "true";
}
function reload_serif_font_setting(){
if(localStorage.getItem("use_serif_font") === "true"){
document.body.style.fontFamily = "serif";
}else{
document.body.style.fontFamily = "sans-serif";
}
}
markdown_renderer = new marked.Renderer();
markdown_renderer.heading = (text, level, raw, slugger) => {
return `<h${level} style="border-bottom: solid 1px rgba(137,137,137,0.3);padding-bottom: 4px"><a href="javascript:void(0)" class="title_that_should_not_have_underline">##</a> ${text}</h${level}>`;
}
markdown_renderer.link = (href, title, text) => {
return `<a href="${href}" ${title === null || title === undefined || title === "" ? "" : `title="${title}"`} style="text-decoration: underline">${text} <i class="fa fa-external-link"></i></a>`
}
var highlightFunc = function (code) {
return hljs.highlightAuto(code).value;
}
marked.setOptions({
renderer: markdown_renderer,
highlight: highlightFunc
})
baseurl = "";
String.prototype.hashCode = function () {
let hash = 0, i, chr;
if (this.length === 0) return hash;
for (i = 0; i < this.length; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
return hash;
}
function getTagColor(tagname) {
let color_list = ["#000099", "#330099", "#660099", "#990099", "#cc0099", "#ff0099", "#0000cc", "#3300cc", "#6600cc", "#9900cc"];
let color_id = parseInt(tagname.hashCode().toString().replace("-", "").slice(0, 1));
return color_list[color_id];
}
window.onpopstate = function () {
if (window.location.href.indexOf("#top") === -1 && window.location.href.indexOf("#reference") === -1) {
window.location.reload();
}
}
function openImageViewer(url) {
document.querySelector("#image_viewer_dialog_body").innerHTML = `<button onclick="window.open('${url.indexOf("https://") === -1 && url.indexOf("http://") === -1 ? baseurl : ""}${url}')" class="btn btn-success"><i class="fa fa-file-image-o"></i> 在新标签页打开此图像</button><br /><br /><img src="${url.indexOf("https://") === -1 && url.indexOf("http://") === -1 ? baseurl : ""}${url}" style="max-width: 100%" /><br /><br /><button onclick="window.open('${url.indexOf("https://") === -1 && url.indexOf("http://") === -1 ? baseurl : ""}${url}')" class="btn btn-success"><i class="fa fa-file-image-o"></i> 在新标签页打开此图像</button><button onclick="image_viewer_dialog.hide()" class="btn btn-primary"><i class="fa fa-times"></i> 关闭此对话框</button>`;
image_viewer_dialog.toggle();
}
function content_decrypt(content, password) {
return sjcl.decrypt(password, content);
}
currentArticleListPageOrder = 1; //这个变量表示目前在显示文章列表中的第几页,是从1开始数的
success_locate_article_id = false;
success_locate_page_id = false;
function detect_whether_ui_load_finished() {
if (bootstrap_css_import_finished === true && content_load_finished === true) {
document.getElementById("root").setAttribute("style", "");
document.getElementById("loading").setAttribute("style", "display:none");
}
}
function copy_full_article_to_clipboard() {
navigator.clipboard.writeText(document.querySelector("#article-content-html").innerText);
document.getElementById("copy_to_clipboard_button").innerHTML = `<i class="fa fa-check"></i> 已复制!`;
}
bootstrap_css_import_finished = false;
content_load_finished = false;
highlight_css_import_finished = false;
let langdata = {
"ARCHIVE_AND_TAGS": {
"简体中文": "归档和标签",
"English": "Archive and tags",
"日本語": "アーカイブとタグ"
},
"ARTICLE_LIST": {
"简体中文": "文章列表",
"English": "Article List",
"日本語": "記事一覧"
},
"ARTICLE_CREATEDAT": {
"简体中文": "此文章编写于",
"English": "This article is written at ",
"日本語": "作成日"
},
"LASTMODIFIEDAT": {
"简体中文": "最近修改于",
"English": "Last modified at ",
"日本語": "修正日"
},
"TAGS": {
"简体中文": "标签",
"English": "Tags: ",
"日本語": "タグ"
},
"COMMENT_UNAVAILABLE_DUE_TO_PREVIEW": {
"简体中文": "由于你目前正在预览环境之中,评论功能暂时被禁用了。当你的站点被从互联网访问时,评论系统会正常地显示在这里。",
"English": "Comment function banned because you are now in the preview environment. When the site is visited from the Internet, the comment system will be available here.",
"日本語": "現在プレビュー環境のため、コメント機能が禁止されています。インターネットからサイトにアクセスすると、ここにコメントシステムが表示されます。"
},
"FRIEND_BOOK": {
"简体中文": "友人帐",
"English": "Friend book",
"日本語": "友人帳"
},
"COPYRIGHT_HINT": {
"简体中文": "版权声明",
"English": "About the copyright of the article",
"日本語": "記事の著作権について"
},
"PREVIOUS_POST": {
"简体中文": "上一篇文章",
"English": "Previous post",
"日本語": "前の記事へ"
},
"NEXT_POST": {
"简体中文": "下一篇文章",
"English": "Next post",
"日本語": "次の記事へ"
},
"NOTHING": {
"简体中文": "没有了",
"English": "nothing",
"日本語": "記事が存在しない"
},
"COPYRIGHT_RESERVED": {
"简体中文": "除特别声明外,本博客上的内容由博主保留所有权利,进行转载前需先获得博主同意。",
"English": "Unless otherwise stated, the content on this blog is reserved by the blogger, and the blogger's consent must be obtained before reprinting.",
"日本語": "特別な記載がない限り、このブログ内の記事はブロガーの所有物であり、転載にはブロガーの同意が必要です。"
},
"COPYRIGHT_CC_BY_NC_SA_FOUR_DOT_ZERO": {
"简体中文": "除特别声明外,本博客上的内容采用 <a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh' target='_blank'>CC BY-NC-SA 4.0 许可协议</a> 授权。转载请注明出处!",
"English": "Unless otherwise stated, the content on this blog is licensed under the <a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en' target='_blank'>CC BY-NC-SA 4.0 license</a>. Please indicate the source when reprinting!",
"日本語": "特別な記載がない限り、このブログ内の記事は<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.ja' target='_blank'>CC BY-NC-SA 4.0ライセンス</a>を使用しています。転載の際は出典を明記してください!"
},
"COPYRIGHT_UNLICENSED": {
"简体中文": "除特别声明外,本博客上的内容属于公有领域,这意味着你可以不受限制地使用和加工它们。",
"English": "Unless otherwise stated, the content on this blog is in the public domain, which means you can use and process it without restriction.",
"日本語": "特別な記載がない限り、このブログ内の記事はパブリックドメインであり、制限なく使用・加工できます。"
},
"SEARCH_SOMETHING": {
"简体中文": "在站点内搜索",
"English": "Search something...",
"日本語": "検索..."
},
"START_SEARCH": {
"简体中文": "开始搜索",
"English": "Search",
"日本語": "検索"
},
"KEYWORD": {
"简体中文": "关键词",
"English": "Keyword",
"日本語": "キーワード"
},
"SEARCH_RESULT": {
"简体中文": "搜索结果",
"English": "Results",
"日本語": "検索結果"
},
"REFERENCE": {
"简体中文": "参考",
"English": "References",
"日本語": "References"
},
"INFO": {
"简体中文": "提示",
"English": "Hint",
"日本語": "Hint"
},
"WARNING": {
"简体中文": "注意",
"English": "Warning",
"日本語": "Warning"
},
"SUCCESS": {
"简体中文": "成功",
"English": "Success",
"日本語": "Success"
},
"DANGER": {
"简体中文": "危险",
"English": "Danger",
"日本語": "Danger"
},
"COULD_NOT_FIND_RESULT": {
"简体中文": "未找到结果",
"English": "Could not find a result",
"日本語": "検索結果はありません"
}
}
function render_ref_tags() {
let ref_tags = [];
let current_number = 1;
for (let i = 0; i < document.getElementsByTagName("ref").length; i++) {
let ref = document.getElementsByTagName("ref")[i];
ref_tags.push({
"ref_name": ref.innerText,
"ref_id": current_number,
"ref_has_target": ref.getAttribute("url") !== undefined && ref.getAttribute("url") !== null && ref.getAttribute("url") !== ""
});
document.getElementsByTagName("ref")[i].innerHTML = `<sup style="font-size: 14px;"><a href="#reference_list_id_${current_number}">[${current_number}]</a></sup>`;
document.getElementsByTagName("ref")[i].setAttribute("style", "display:inline");
document.getElementsByTagName("ref")[i].setAttribute("id", `reference_id_${current_number}`);
if (ref_tags[ref_tags.length - 1].ref_has_target === true) {
ref_tags[ref_tags.length - 1].ref_target = ref.getAttribute("url");
}
current_number += 1;
}
if (ref_tags.length !== 0) {
ref_html = `<div id="content_reference_list"><h3>${langdata.REFERENCE[lang_name]}</h3><hr />`;
for (const ref of ref_tags) {
ref_html += `<div id="reference_list_id_${ref.ref_id}"><b>${ref.ref_id}.<a href="#reference_id_${ref.ref_id}">^</a></b> ${ref.ref_has_target === false ? ref.ref_name : `<a href="${ref.ref_target}" target="_blank">${ref.ref_name}</a>`} </div>`;
}
ref_html += `</div>`;
document.getElementById("article-content-html").insertAdjacentHTML("beforeend", ref_html);
}
}
function render_hint_tags() {
for (let i = 0; i < document.getElementsByTagName("info-hint").length; i++) {
document.getElementsByTagName("info-hint")[i].innerHTML = `<span class="hint-heading"><i class="fa fa-info-circle"></i> ${langdata["INFO"][lang_name]} </span><br />` + document.getElementsByTagName("info-hint")[i].innerHTML;
}
for (let i = 0; i < document.getElementsByTagName("warning-hint").length; i++) {
document.getElementsByTagName("warning-hint")[i].innerHTML = `<span class="hint-heading"><i class="fa fa-exclamation-circle"></i> ${langdata["WARNING"][lang_name]} </span><br />` + document.getElementsByTagName("warning-hint")[i].innerHTML;
}
for (let i = 0; i < document.getElementsByTagName("danger-hint").length; i++) {
document.getElementsByTagName("danger-hint")[i].innerHTML = `<span class="hint-heading"><i class="fa fa-exclamation-triangle"></i> ${langdata["DANGER"][lang_name]} </span><br />` + document.getElementsByTagName("danger-hint")[i].innerHTML;
}
for (let i = 0; i < document.getElementsByTagName("success-hint").length; i++) {
document.getElementsByTagName("success-hint")[i].innerHTML = `<span class="hint-heading"><i class="fa fa-check-circle-o"></i> ${langdata["SUCCESS"][lang_name]} </span><br />` + document.getElementsByTagName("success-hint")[i].innerHTML;
}
}
function preview_env_public_comment_fix() {
if (window.location.href.indexOf("localhost") !== -1 || window.location.href.indexOf("127.0.0.1") !== -1) {
if (blog["全局评论设置"]["valine设置"]["是否使用bbg公共评论服务"]) {
document.getElementById("vcomments").innerHTML = `<p style="color:red;">${langdata["COMMENT_UNAVAILABLE_DUE_TO_PREVIEW"][lang_name]}</p>`;
}
}
}
function resetPage() {
document.querySelector("#root").innerHTML = "";
console.log("reset ok");
}
function start_search() {
let keyword = document.getElementById("search_keyword").value.toLowerCase();
let totalSearchResultNumber = 0;
document.getElementById("search_dialog_results").innerHTML = `<br /><hr />`;
if (history.state.type === "article" || history.state.type === "short_article") {
// 在文章内检索
let articleContent = document.querySelector("#article-content-html").innerText.toLowerCase();
if (articleContent.indexOf(keyword) !== -1) {
document.getElementById("search_dialog_results").insertAdjacentHTML("afterend", `<h3>在当前文章中找到了一处结果</h3><div class="card" style="padding:20px"><a href="javascript:void(0)" data-bs-dismiss="modal" onclick="return false;"><h5>${document.getElementById("current_article_title").innerText}</h5></a><p class="search_result_detail">${articleContent.substring(articleContent.indexOf(keyword) - 20, articleContent.indexOf(keyword) + 20)}</p></div>`);
totalSearchResultNumber++;
}
}
document.getElementById("search_dialog_results").insertAdjacentHTML("beforeend", `<br /><h3>全部搜索结果</h3><br />`);
for (let i = 0; i < blog["文章列表"].length; i++) {
const articleTitle = blog["文章列表"][i]["文章标题"].toLowerCase();
const articleAbstract = blog["文章列表"][i]["摘要"].toLowerCase();
if (articleTitle.indexOf(keyword) !== -1 || articleAbstract.indexOf(keyword) !== -1) {
if (blog["文章列表"][i]["是否隐藏"] === false) {
document.getElementById("search_dialog_results").insertAdjacentHTML("beforeend", `<div class="card" style="padding:20px"><a href="javascript:void(0)" data-bs-dismiss="modal" onclick="enter_article(${i});return false;"><h5>${blog["文章列表"][i]["文章标题"]}</h5></a><p class="search_result_detail">${blog["文章列表"][i]["摘要"]}</p></div>`);
totalSearchResultNumber++;
}
}
}
if (totalSearchResultNumber === 0) {
document.getElementById("search_dialog_results").insertAdjacentHTML("beforeend", `<br /><p>${langdata["COULD_NOT_FIND_RESULT"][lang_name]}</p>`);
} else {
for (let i = 0; i < document.getElementsByClassName("search_result_detail").length; i++) {
document.getElementsByClassName("search_result_detail")[i].innerHTML = document.getElementsByClassName("search_result_detail")[i].innerHTML.replaceAll(keyword, `<span style="background-color:yellow">${keyword}</span>`)
}
}
}
function start_search_dialog() {
const dialog = new bootstrap.Modal(document.getElementById('search_dialog'))
dialog.toggle();
document.getElementById("search_dialog_title").innerHTML = langdata["SEARCH_SOMETHING"][lang_name];
document.getElementById("search_dialog_body").innerHTML = `<div class="row g-2"><div class="col-auto"><input class="form-control" id="search_keyword" placeholder="${langdata["KEYWORD"][lang_name]}" autocomplete="off" autocapitalize="off" spellcheck="false"></div><div class="col-auto"><button class="btn btn-primary" onclick="start_search()"> ${langdata["START_SEARCH"][lang_name]}</button></div></div><div id="search_dialog_results"></div>`;
document.getElementById("search_keyword").focus();
document.getElementById("search_keyword").addEventListener('input', start_search);
}
function render_nav(isIndexPage) {
//todo: fix router
let nav_base = `<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light" id="navbar">
<div class="container-fluid">
<a class="navbar-brand" id="navbar_title" href="./index.html" onclick="currentArticleListPageOrder=1;enter_indexPage();return false;">${blog["博客标题"]}</a>
<button class="navbar-toggler" style="border:none;color:white;margin-left:2px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fa fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0" id="navbar_items">
<li class="nav-item" id="navbar_article_list">
<a class="nav-link" href="./index.html?type=internal&function=article_list" onclick="currentArticleListPageOrder=1;enter_indexPage();return false;">${langdata["ARTICLE_LIST"][lang_name]}</a>
</li>
<li class="nav-item" id="navbar_archive_and_tags">
<a class="nav-link" href="./index.html?type=internal&function=archive_and_tags" onclick="enter_archive_and_tags();return false;">${langdata["ARCHIVE_AND_TAGS"][lang_name]}</a>
</li>
</ul>
<div class="d-flex" role="search">
<button class="btn btn-outline-${blog["搜索按钮边框颜色设置为暗色"] ? "dark" : "light"}" onclick="start_search_dialog()" style="color: ${blog["全局主题设置"]["标题栏文字颜色"]}"><i class="fa fa-search"></i> ${langdata["SEARCH_SOMETHING"][lang_name]}</button>
</div>
<div class="d-flex">
<div style="display:block;padding:2px"></div>
</div>
</div>
</div>
</nav>`;
document.querySelector("#root").insertAdjacentHTML("beforeend", nav_base);
document
.querySelector("#navbar_title")
.setAttribute(
"style",
"color:" + blog["全局主题设置"]["标题栏文字颜色"] + "!important"
);
if (blog["页面列表"].length === 0) {
} else {
for (let i = 0; i < blog["页面列表"].length; i++) {
if (blog["页面列表"][i]["是否显示在菜单中"]) {
document.querySelector("#navbar_items").insertAdjacentHTML("beforeend", `<li class="nav-item" id="navbar_page_${i}"><a class="nav-link" href="./index.html?type=page&filename=${blog["页面列表"][i]["文件名"]}" onclick="enter_page(${i});return false;">${blog["页面列表"][i]["若显示在菜单中,则在菜单中显示为"]}</a></li>`);
}
}
}
if (blog["启用内建友人帐页面"] === true) {
document.querySelector("#navbar_items").insertAdjacentHTML("beforeend", `<li class="nav-item" id="navbar_friendbook"><a class="nav-link" href="./index.html?type=internal&function=friendbook" onclick="enter_friend_book();return false;">${langdata.FRIEND_BOOK[lang_name]}</a></li>`);
}
if (blog["菜单中的外部链接"].length === 0) {
} else {
for (let i = 0; i < blog["菜单中的外部链接"].length; i++) {
if (blog["菜单中的外部链接"][i]["是否在新标签页打开"]) {
document.querySelector("#navbar_items").insertAdjacentHTML("beforeend", `<li class="nav-item"><a class="nav-link" target="_blank" href="${blog["菜单中的外部链接"][i]["url"]}">${blog["菜单中的外部链接"][i]["显示名称"]}</a></li>`);
} else {
document.querySelector("#navbar_items").insertAdjacentHTML("beforeend", `<li class="nav-item"><a class="nav-link" href="${blog["菜单中的外部链接"][i]["url"]}">${blog["菜单中的外部链接"][i]["显示名称"]}</a></li>`);
}
}
}
document
.querySelector("#navbar")
.setAttribute(
"style",
"background-color:" +
blog["全局主题设置"]["标题栏背景颜色"] +
"!important"
);
for (
let i = 0;
i < document.getElementsByClassName("nav-link").length;
i++
) {
document
.getElementsByClassName("nav-link")
[i].setAttribute(