-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
820 lines (779 loc) · 78.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
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
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" name="viewport"><script>!function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-MTMKNL9T",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer")</script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","GTM-MTMKNL9T")</script><meta name="google-site-verification" content="c69mes6CkZcMtkt4sAaWhVssMYhQjAk0Kkdt3YnzS5k"><title>Alex-Li-Blog</title><link rel="icon" type="image/x-icon, image/vnd.microsoft.icon" href="/favicon.ico"><link rel="stylesheet" href="https://at.alicdn.com/t/font_1911880_c1nvbyezg17.css"><link href="https://unpkg.com/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"><link href="/js/swiper/swiper@5.4.1.min.css" rel="stylesheet"><link rel="stylesheet" href="/css/animate.min.css"><link rel="stylesheet" href="/css/style.css"><link href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" rel="stylesheet"><link rel="stylesheet" href="/js/shareJs/share.min.css"><style>@media (max-width:992px){#waifu{display:none}}</style><script defer src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script><link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet"><script src="https://unpkg.com/jquery@3.5.1/dist/jquery.min.js"></script><script src="https://unpkg.com/vue@2.6.11/dist/vue.min.js"></script><meta name="generator" content="Hexo 6.3.0"></head><div id="loader"><link rel="stylesheet" href="/js/loaded/index.css"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">loading...</div></div></div><script>var endLoading=function(){document.body.style.overflow="auto",document.getElementById("loader").classList.add("loading")};window.addEventListener("DOMContentLoaded",endLoading)</script><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MTMKNL9T" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><script>let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
if (isDark) {
$(document.body).addClass('darkModel');
}</script><script>function loadScript(src, cb) {
return new Promise(resolve => {
setTimeout(function () {
var HEAD = document.getElementsByTagName("head")[0] || document.documentElement;
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
if (cb) {
if (JSON.stringify(cb)) {
for (let p in cb) {
if (p == "onload") {
script[p] = () => {
cb[p]()
resolve()
}
} else {
script[p] = cb[p]
script.onload = resolve
}
}
} else {
script.onload = () => {
cb()
resolve()
};
}
} else {
script.onload = resolve
}
script.setAttribute("src", src);
HEAD.appendChild(script);
});
});
}
//https://github.com/filamentgroup/loadCSS
var loadCSS = function (src) {
return new Promise(resolve => {
setTimeout(function () {
var link = document.createElement('link');
link.rel = "stylesheet";
link.href = src;
link.onload = resolve;
document.getElementsByTagName("head")[0].appendChild(link);
});
});
};</script><script src="/js/swiper/swiper.min.js"></script><script src="/js/swiper/vue-awesome-swiper.js"></script><script src="/js/swiper/swiper.animate1.0.3.min.js"></script><script type="text/javascript">Vue.use(window.VueAwesomeSwiper)</script><script src="/js/vue-typed-js/index.js"></script><script src="/js/vue-seamless-scroll/index.js"></script><script src="https://unpkg.com/typed.js@2.0.11"></script><div id="safearea"><main class="main" id="pjax-container"><header class="header" id="navHeader" style="position:fixed;left:0;top:0;z-index:10;width:100%"><div class="header-content"><div class="bars"><div id="appDrawer" class="sidebar-image"><div class="drawer-box-icon"><i class="fas fa-bars" aria-hidden="true" @click="showDialogDrawer"></i></div><transition name="fade"><div class="drawer-box_mask" v-cloak style="display:none" v-show="visible" @click.self="cancelDialogDrawer"></div></transition><div class="drawer-box" :class="{'active': visible}"><div class="drawer-box-head bg-color"><img class="drawer-box-head_logo lazyload placeholder" src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt="logo"><h3 class="drawer-box-head_title">Alex-Li-Blog</h3><h5 class="drawer-box-head_desc">This is my blog about front-end skills.</h5></div><div class="drawer-box-content"><ul class="drawer-box-content_menu"><li class="drawer-box-content_item" style="position:relative"><a href="/" class="drawer-menu-item-link"><i class="fas fa-home" aria-hidden="true"></i> <span class="name">Home</span></a></li><li class="drawer-box-content_item" style="position:relative"><a href="/archives" class="drawer-menu-item-link"><i class="fas fa-archive" aria-hidden="true"></i> <span class="name">Archives</span></a></li><li class="drawer-box-content_item" style="position:relative"><a href="/tags" class="drawer-menu-item-link"><i class="fas fa-tags" aria-hidden="true"></i> <span class="name">Tags</span></a></li><li class="drawer-box-content_item" style="position:relative"><a href="javascript:;" class="drawer-menu-item-link has-children" @click="openOrCloseMenu(3)"><span><i class="fas fa-bookmark"></i> <span class="name">Categories</span> </span><i class="fas fa-chevron-left arrow" :class="{'icon-rotate': isOpen(3)}" aria-hidden="true"></i></a><ul class="drawer-sub-menu" v-if="isOpen(3)"><li><a href="/categories/frontend"><i class="fa-solid fa-display" style="margin-top:-20px"></i> <span>FrontEnd</span></a></li><li><a href="/categories/backend"><i class="fa-solid fa-server" style="margin-top:-20px"></i> <span>BackEnd</span></a></li><li><a href="/categories/algorithm"><i class="fa-solid fa-diagram-project" style="margin-top:-20px"></i> <span>Algorithm</span></a></li><li><a href="/categories/other"><i class="fa-solid fa-book" style="margin-top:-20px"></i> <span>Other</span></a></li></ul></li><li class="drawer-box-content_item"><a target="_blank" rel="noopener" href="https://github.com/alexlili"><i class="fa-brands fa-github" aria-hidden="true"></i> <span>Github</span></a></li></ul></div></div></div><script>var body = document.body || document.documentElement || window;
var vm = new Vue({
el: '#appDrawer',
data: {
visible: false,
top: 0,
openArr: [],
},
computed: {
},
mounted() {
},
methods: {
isOpen(index) {
if (this.openArr.includes(index)) {
return true;
} else {
return false;
}
},
openOrCloseMenu(curIndex) {
const index = this.openArr.indexOf(curIndex);
if (index !== -1) {
this.openArr.splice(index, 1);
} else {
this.openArr.push(curIndex);
}
},
showDialogDrawer() {
this.visible = true;
// 防止页面滚动,只能让弹框滚动
this.top = $(document).scrollTop()
body.style.cssText = 'width: 100%; height: 100%;overflow: hidden;';
},
cancelDialogDrawer() {
this.visible = false;
body.removeAttribute('style');
$(document).scrollTop(this.top)
}
},
created() {}
})</script></div><div class="blog-title" id="author-avatar"><div class="avatar"><img src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt="logo"></div><a href="/" class="logo">Alex-Li-Blog</a></div><nav class="navbar"><ul class="menu"><li class="menu-item" style="position:relative"><a href="/" class="menu-item-link" title="Home"><i class="fas fa-home" aria-hidden="true"></i> <span class="name">Home</span></a></li><li class="menu-item" style="position:relative"><a href="/archives" class="menu-item-link" title="Archives"><i class="fas fa-archive" aria-hidden="true"></i> <span class="name">Archives</span></a></li><li class="menu-item" style="position:relative"><a href="/tags" class="menu-item-link" title="Tags"><i class="fas fa-tags" aria-hidden="true"></i> <span class="name">Tags</span></a></li><li class="menu-item" style="position:relative"><a href="javascript:;" class="menu-item-link" title="Categories"><i class="fas fa-bookmark"></i> <span class="name">Categories</span> <i class="fas fa-chevron-down arrow" aria-hidden="true"></i></a><ul class="sub-menu"><li><a href="/categories/frontend"><i class="fa-solid fa-display" style="margin-top:-20px"></i> <span>FrontEnd</span></a></li><li><a href="/categories/backend"><i class="fa-solid fa-server" style="margin-top:-20px"></i> <span>BackEnd</span></a></li><li><a href="/categories/algorithm"><i class="fa-solid fa-diagram-project" style="margin-top:-20px"></i> <span>Algorithm</span></a></li><li><a href="/categories/other"><i class="fa-solid fa-book" style="margin-top:-20px"></i> <span>Other</span></a></li></ul></li></ul><div id="appSearch"><div class="search" @click="showDialog()"><i class="fas fa-search" aria-hidden="true"></i></div><transition name="fade"><div class="message-box_wrapper" style="display:none" v-cloak v-show="dialogVisible" @click.self="cancelDialogVisible()"><div class="message-box animated bounceInDown"><h2><span><i class="fas fa-search" aria-hidden="true"></i> <span class="title">Search</span> </span><i class="fas fa-times close" pointer style="float:right" aria-hidden="true" @click.self="cancelDialogVisible()"></i></h2><form class="site-search-form"><input type="text" placeholder="Please enter keywords" id="local-search-input" @click="getSearchFile()" class="st-search-input" v-model="searchInput"></form><div class="result-wrapper"><div id="local-search-result" class="local-search-result-cls"></div></div></div></div></transition></div><script src="/js/local_search.js"></script><script>var body = document.body || document.documentElement || window;
var vm = new Vue({
el: '#appSearch',
data: {
dialogVisible: false,
searchInput: '',
top: 0,
},
computed: {
},
mounted() {
window.addEventListener('pjax:complete', () => {
this.cancelDialogVisible();
})
},
methods: {
showDialog() {
this.dialogVisible = true;
// 防止页面滚动,只能让弹框滚动
this.top = $(document).scrollTop()
body.style.cssText = 'overflow: hidden;';
},
getSearchFile() {
if (!this.searchInput) {
getSearchFile("/search.xml");
}
},
cancelDialogVisible() {
this.dialogVisible = false;
body.removeAttribute('style');
$(document).scrollTop(this.top)
},
},
created() {}
})</script></nav></div><a target="_blank" rel="noopener" href="https://github.com/alexlili" class="github-corner color-primary" aria-label="View source on GitHub"><svg width="60" height="60" viewBox="0 0 250 250" style="fill:#fff;position:absolute;top:0;border:0;right:0" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin:130px 106px" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style><div id="he-plugin-simple"></div><script>WIDGET={CONFIG:{modules:"012",background:5,tmpColor:"4A4A4A",tmpSize:16,cityColor:"4A4A4A",citySize:16,aqiSize:16,weatherIconSize:24,alertIconSize:18,padding:"10px 10px 10px 10px",shadow:"1",language:"auto",borderRadius:5,fixed:"false",vertical:"middle",horizontal:"center",key:"2784dd3fcb1e4f0f9a9b579bf69641f2"}}</script><script defer src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script></header><link href="/js/vue-typed-js/index.css" rel="stylesheet"><div class="swiper-length" style="display:none">0</div><div id="appSwiper" class="swiper-no-swiping" @mouseenter="stopAutoPlay()" @mouseleave="startAutoPlay()"><swiper v-cloak ref="mySwiper" :options="swiperOptions" @slidechangetransitionend="slideChangeTransitionEnd"><swiper-slide><div class="item swiper-lazy" data-background="/medias/kaikoura.jpg" style="background-size:300000px;background-position:left center" style="position:relative"><div class="swiper-bgmask" style="position:absolute;top:0;left:0;width:100%;height:100%"></div><div class="flag"><div class="img-mask swiper-lazy swiper-default-bgImg" data-background="/medias/kaikoura.jpg" style="height:100%;background-size:cover;background-position:center center"><div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div><div class="flag-text"><div class="flag-text-content"><div class="title ani animated" swiper-animate-effect="fadeInDown" swiper-animate-duration="0.2s" swiper-animate-delay="0.1s">Live your life the way you like.</div><div class="ani animated default-excerpt" swiper-animate-effect="fadeInDown" swiper-animate-duration="0.2s" swiper-animate-delay="0.1s"><vue-typed-js :strings="defaultDesc" :loop="defaultDescTypedLoop" :type-speed="100" :back-speed="50"><h1 class="typing"></h1></vue-typed-js></div></div><div style="display:flex" class="flag-text-btns"><div class="ani animated" swiper-animate-effect="fadeInDown" swiper-animate-duration="0.2s" swiper-animate-delay="0.1s"><a target="_blank" rel="noopener" href="https://github.com/alexlili" class="read-more swiper-btn-color" style="display:inline-block;z-index:1"><i class="fa-brands fa-github" style="padding-right:10px"></i>GitHub</a></div><div class="ani animated" style="margin-left:10px" swiper-animate-effect="fadeInDown" swiper-animate-duration="0.2s" swiper-animate-delay="0.1s"><a target="_blank" rel="noopener" href="https://www.linkedin.com/in/alex-li-8866b3298/" class="read-more swiper-btn-color2" style="display:inline-block;z-index:1;border:1px solid #fff"><i class="fa-brands fa-linkedin" style="padding-right:10px"></i>LinkedIn</a></div></div></div></div></div></swiper-slide></swiper><div id="scroll-down" @click="toPostContent()"><a href="javascript:;"><i class="fas fa-angle-down scroll-down-effects"></i></a></div><canvas id="header_canvas" style="position:absolute;bottom:0;width:100%;pointer-events:none"></canvas></div><script>var autoplay = JSON.parse('false');
var delay = '5000';
var loop = JSON.parse('true') ? false : JSON.parse('true');
var effect = 'slide';
var swiperLength = parseInt(document.querySelector(".swiper-length").innerText);
var defaultDesc = 'This background pic was taken when I travelled to KAIKOURA.';
defaultDesc = defaultDesc.split(',');
var defaultDescTypedLoop = JSON.parse('false');
var vm = new Vue({
el: '#appSwiper',
data: {
defaultDesc: defaultDesc,
defaultDescTypedLoop,
swiperOptions: {
pagination: {
el: '.swiper-pagination',
clickable: true // 允许点击小圆点跳转
},
loop: loop ? true : false,
effect, // fade
autoplay: (autoplay && swiperLength > 1) ? {
delay,
disableOnInteraction: false // 手动切换之后继续自动轮播
} : false,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
lazy: {
loadPrevNext: true,
},
on:{
init: function() {
swiperAnimateCache(this); //隐藏动画元素
swiperAnimate(this); //初始化完成开始动画
},
slideChangeTransitionEnd: function(){
swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
}
}
// Some Swiper option/callback...
}
},
computed: {
swiper() {
return this.$refs.mySwiper.$swiper
}
},
mounted() {
// console.log('Current Swiper instance object', this.swiper)
// this.swiper.slideTo(0, 1000, false)
},
methods: {
stopAutoPlay() {
(autoplay && swiperLength > 1) && this.swiper.autoplay.stop();
},
startAutoPlay() {
(autoplay && swiperLength > 1) && this.swiper.autoplay.start();
},
slideChangeTransitionEnd() {
console.log('1');
},
toPostContent() {
const fullHeight = $(window).height() - 60;
$('html,body').animate({scrollTop: fullHeight},500);
}
},
created() {}
})</script><script src="/js/bubble/homeBubble.js"></script><style>#appSwiper{position:relative;user-select:none;overflow:hidden;font-family:Titillium Web,'PingFang SC','Hiragino Sans GB','Microsoft JhengHei','Microsoft YaHei',sans-serif}.default-excerpt{font-size:1.6em;margin-top:1em;color:#eee}.bottom-one-btn{margin-top:15px}.swiper-container{overflow:hidden;z-index:0}.swiper-slide{height:350px;position:relative}.swiper-button-next,.swiper-button-prev{padding:10px 10px;transition:background .2s}.swiper-button-next:hover,.swiper-button-prev:hover{background:rgba(0,0,0,.2)}.swiper-slide .item{width:100%;height:100%}.flag{position:relative;width:70%;margin:0 auto;color:#fff;height:100%;background:#000}.flag img{min-height:100%}.flag-text{position:absolute;top:50px;left:50px;width:80%;height:280px;display:flex;flex-direction:column;justify-content:space-between;z-index:9999}.flag-text .title{font-size:1.8em}.flag-text .title a{color:#fff;transition:color .3s}.flag-text .title a:hover{color:rgba(66,185,133,.8)}.flag-text .excerpt{color:#eee;width:70%;line-height:30px;height:150px;margin-top:2%;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden}.swiper-pagination-bullet-active{opacity:1;background-color:#42b983}.img-mask{opacity:.6}.flag-text .read-more{margin-bottom:30px;padding:5px 15px;color:#fff;border-radius:20px}#scroll-down{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);font-size:2.5em;color:#fff;cursor:pointer;z-index:2}#scroll-down a{color:#fff}@-webkit-keyframes rightan{0%{transform:translateY(0);opacity:.5}50%{transform:translateY(-30px);opacity:1}100%{transform:translateY(0);opacity:.5}}.scroll-down-effects{animation:rightan 1.5s infinite}.swiper-slide{height:400px}.flag-text{top:80px}@media (min-width:992px){.swiper-button-prev{margin-left:15%;transform:translateX(-180%)}.swiper-button-next{margin-right:15%;transform:translateX(180%)}.flag-text .title{width:80%;line-height:35px;max-height:70px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}}@media screen and (max-width:1200px){.flag{width:80%}.swiper-button-prev{margin-left:10%;transform:translateX(-180%)}.swiper-button-next{margin-right:10%;transform:translateX(180%)}}@media (max-width:992px){.flag{width:100%}.flag-text .title{font-size:1.5em;margin-top:50px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.flag-text{position:absolute;top:0;left:0;width:80%;height:100%;margin-left:50%;transform:translateX(-50%)}.flag-text .excerpt{width:100%;line-height:25px;height:125px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden}.flag-text .read-more{margin-bottom:80px}}@media (max-width:992px) and (min-width:551px){.flag-text .excerpt{width:70%}}@media (max-width:551px){.swiper-slide{height:250px}.flag-text .title{line-height:30px;max-height:60px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin-top:20px}.flag-text .excerpt{font-size:1em;line-height:20px;height:80px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}.flag-text .excerpt{margin-top:10px}.flag-text .read-more{margin-top:10px;margin-bottom:50px}.swiper-button-next,.swiper-button-prev{transform:scale(.5)}.swiper-button-prev{left:0}.swiper-button-next{right:0}}@media (max-width:992px){.flag-text{top:60px;height:80%}}@media (max-width:551px){.swiper-slide{height:310px}}.flag-text{left:10%}.flag-text .flag-text-content{width:100%;text-align:center}.flag-text .title{width:100%;text-align:center}.flag-text .excerpt{width:100%;text-align:center}.bottom-one-btn{display:flex;justify-content:center}.default-excerpt{display:flex;justify-content:center;font-size:1.6em}.flag-text-btns{justify-content:center}@media (min-width:992px){.flag-text .excerpt{line-height:30px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden}}@media (max-width:992px){.flag-text{margin-left:0;transform:translateX(0)}}.flag{width:100%}.swiper-slide{height:100vh}.flag-text{top:50%;left:15%;transform:translateY(-50%);width:72%;height:auto}.flag-text .title{font-size:2.8em;line-height:1.5em;max-height:none}.flag-text .excerpt{font-size:1.25em;height:150px}.flag-text .read-more{margin-top:10px}.swiper-button-next,.swiper-button-prev{margin-top:-60px!important}.swiper-btn-color,.swiper-btn-color2{background-color:transparent;border:1px solid #fff}.swiper-btn-color2:hover,.swiper-btn-color:hover{background-color:rgba(66,185,133,.8);border:1px solid rgba(66,185,133,.8)!important}.flag-text-btns{justify-content:center}.swiper-button-prev{margin-left:10px;transform:translateX(0);border-radius:50%;padding:0;width:50px;height:50px}.swiper-button-next{margin-right:10px;transform:translateX(0);border-radius:50%;padding:0;width:50px;height:50px}.swiper-button-next:after,.swiper-button-prev:after{font-size:1.2em}@media (min-width:992px){.flag-text .excerpt{line-height:35px;height:175px}.default-excerpt{min-height:150px}.typed-element{align-items:unset}}@media (max-width:992px){.flag-text{margin-left:0;height:60%;top:55%}.flag-text .title{font-size:2.4em;margin-top:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.flag-text .excerpt{line-height:35px;height:185px}.flag-text .read-more{margin-top:20px}}@media (max-width:551px){.flag-text{height:60%}.flag-text .title{font-size:2.2em}.flag-text .excerpt{line-height:30px}.flag-text .read-more{margin-top:50px;padding:10px 30px}.swiper-button-prev{margin-left:0}.swiper-button-next{margin-right:0}.default-excerpt{margin-top:1em}}.swiper-video{width:100%;height:100%}.swiper-video video{pointer-events:none}.swiper-video-maskBox{position:absolute;top:0;left:0;height:100%;width:100%;background-color:#000;opacity:.2;z-index:1}@media (min-width:992px){.swiper-video{display:none}.swiper-default-bgImg{display:block}}@media (max-width:992px){.swiper-video{display:none}.swiper-default-bgImg{display:block}}</style><div id="l_main"><div class="l_content"><div class="motto"><h3 class="motto-title">MOTTO</h3><div class="motto-content"><p>After settling down, I want to be a warm person, with my own preferences, my own principles, my own beliefs. Staying calm and contented, with your mind as calm as water and never forgetting your original intention, can you always succeed.</p></div></div><div class="topArticle reveal"><h3><i class="fas fa-thumbs-o-up" aria-hidden="true"></i>Recommend Articles</h3><div class="articles"></div></div><div class="github-calendar"><div id="calendar_box" style="width:100%;overflow-x:auto;overflow-y:hidden"><div id="calendar" style="width:550px;height:165px"></div></div><script src="https://cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js"></script><script type="text/javascript">(function(){
function dateFormat(date){
date = new Date(date)
return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0')
}
let calendarChart = echarts.init(document.getElementById('calendar'));
let endDate = new Date().getTime()
let startDate = new Date(endDate - 36*7*24*3600*1000).getTime()
let startDay = Math.ceil(startDate/(24*3600*1000))
let endDay = Math.ceil(endDate/(24*3600*1000))
let commitData = {"2024-08-28":2}
let seriesData = []
for(let i = startDay;i <= endDay;i++){
let date = i*24*3600*1000
let formatDate = dateFormat(date)
let times = commitData[formatDate] || 0
seriesData.push([formatDate, times])
}
let option = {
title: {
text: "Github Calendar",
x: "center"
},
backgroundColor: "#f9f9f9",
tooltip: {
padding: 10,
backgroundColor: "#555",
borderColor: "#777",
borderWidth: 1,
formatter: function(a) {
var b = a.value;
return '<div style="font-size: 14px;">' + b[0] + ":" + b[1] + "</div>"
}
},
visualMap: {
show: !1,
showLabel: !0,
min: 0,
max: 4,
calculable: !1,
inRange: {
symbol: "rect",
color: ["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"]
},
itemWidth: 12,
itemHeight: 12,
orient: "horizontal",
left: "center",
top: 0
},
calendar: [{
top: 50,
left: "center",
range: [dateFormat(startDate), dateFormat(endDate)],
cellSize: [13, 13],
splitLine: {
show: !1
},
name: {
textStyle: {
color: "#3C4858"
}
},
itemStyle: {
borderColor: "#fff",
borderWidth: 2
},
yearLabel: {
show: !1
},
monthLabel: {
nameMap: "en",
fontSize: 11,
color: "#3C4858"
},
dayLabel: {
formatter: "{start} 1st",
nameMap: "en",
fontSize: 11,
color: "#3C4858"
}
}],
series: [{
type: "heatmap",
coordinateSystem: "calendar",
calendarIndex: 0,
data: seriesData
}]
};
calendarChart.setOption(option);
let box = document.getElementById("calendar_box")
let child = document.getElementById("calendar")
window.addEventListener('load',function(){
box.scrollLeft = (child.clientWidth - box.clientWidth) / 2
})
})();</script></div><div class="bg-floor" id="home-bg-floor" style="position:fixed;left:0;top:0;width:100%;height:100%;z-index:-2"></div><section class="posts"><article class="post reveal" style="flex-direction:row-reverse"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/Return-Types-and-Void-Functions/">Return Types and Void Functions</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/27/Return-Types-and-Void-Functions/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Return Types and Void Functions:a. Define a function calculateArea that takes the radius of a circle as a parameter and</div></div><div class="post-more"><a href="/2023/11/27/Return-Types-and-Void-Functions/"><i class="iconfont iconmore" pointer style="float:right" title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/Return-Types-and-Void-Functions/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/Passing-Arguments/">Passing Arguments</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"><div class="article-category"><i class="iconfont iconbookmark1"></i> <a class="article-category-link" href="/categories/frontend/">frontend</a> <a class="article-category-link" href="/categories/frontend/backend/">backend</a></div></div></div><div class="post-img-mobile"><a href="/2023/11/27/Passing-Arguments/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Passing Arguments (By Value, By Reference):a. Write a function incrementByValue that takes an integer parameter and incr</div></div><div class="post-more"><a href="/2023/11/27/Passing-Arguments/"><i class="iconfont iconmore" pointer title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/Passing-Arguments/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal" style="flex-direction:row-reverse"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/Intro-Pointers-and-Their-Role/">Intro Pointers and Their Role:</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"><div class="article-category"><i class="iconfont iconbookmark1"></i> <a class="article-category-link" href="/categories/backend/">backend</a></div></div></div><div class="post-img-mobile"><a href="/2023/11/27/Intro-Pointers-and-Their-Role/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Introduction to Pointers and Their Role:a. Declare a pointer variable to an integer named ptr.b. Assign the address of a</div></div><div class="post-more"><a href="/2023/11/27/Intro-Pointers-and-Their-Role/"><i class="iconfont iconmore" pointer style="float:right" title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/Intro-Pointers-and-Their-Role/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/Array-Manipulation-and-Traversal/">Array Manipulation and Traversal</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/27/Array-Manipulation-and-Traversal/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" class="lazyload placeholder" data-srcset="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Array Manipulation and Traversal:a. Calculate the average of the scores array.b. Convert all characters in the name to u</div></div><div class="post-more"><a href="/2023/11/27/Array-Manipulation-and-Traversal/"><i class="iconfont iconmore" pointer title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/Array-Manipulation-and-Traversal/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" class="lazyload placeholder" data-srcset="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal" style="flex-direction:row-reverse"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/Declaring-and-Accessing-Arrays/">Declaring and Accessing Arrays</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/27/Declaring-and-Accessing-Arrays/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" class="lazyload placeholder" data-srcset="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Declaring and Accessing Arrays:a. Initialize the scores array with some sample test scores.b. Input the name into the na</div></div><div class="post-more"><a href="/2023/11/27/Declaring-and-Accessing-Arrays/"><i class="iconfont iconmore" pointer style="float:right" title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/Declaring-and-Accessing-Arrays/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" class="lazyload placeholder" data-srcset="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-27</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/27/c-Definition-Functions/">c++ Definition Functions</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/27/c-Definition-Functions/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/80/v2-7cfc909ebe8d83683909846edd6b5232_1440w.webp" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/80/v2-7cfc909ebe8d83683909846edd6b5232_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Definition and Declaration of Functions:a. Define a function called greet that prints “Hello, World!” to the console.b.</div></div><div class="post-more"><a href="/2023/11/27/c-Definition-Functions/"><i class="iconfont iconmore" pointer title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/27/c-Definition-Functions/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/80/v2-7cfc909ebe8d83683909846edd6b5232_1440w.webp" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/80/v2-7cfc909ebe8d83683909846edd6b5232_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal" style="flex-direction:row-reverse"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-26</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/26/C-combined-list/">C++ combined list</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/26/C-combined-list/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" class="lazyload placeholder" data-srcset="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Task 4: Combining Data Structures Create a stack of strings named stringStack. Push at least three strings onto the stac</div></div><div class="post-more"><a href="/2023/11/26/C-combined-list/"><i class="iconfont iconmore" pointer style="float:right" title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/26/C-combined-list/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" class="lazyload placeholder" data-srcset="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-25</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/25/C-singly-linked-list/">C++ singly linked list</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/25/C-singly-linked-list/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" class="lazyload placeholder" data-srcset="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Define a structure for a singly linked list node with an integer value. Create a linked list named intList with at leas</div></div><div class="post-more"><a href="/2023/11/25/C-singly-linked-list/"><i class="iconfont iconmore" pointer title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/25/C-singly-linked-list/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" class="lazyload placeholder" data-srcset="https://pica.zhimg.com/80/v2-573ac3e25de03fad9c32add5a05e5cfc_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal" style="flex-direction:row-reverse"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-25</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/25/C-create-duplicate-queue/">C++ create,duplicate queue</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/25/C-create-duplicate-queue/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">Task 2: Queue Operations Create a queue of characters named charQueue. Enqueue at least four characters into the queue.</div></div><div class="post-more"><a href="/2023/11/25/C-create-duplicate-queue/"><i class="iconfont iconmore" pointer style="float:right" title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/25/C-create-duplicate-queue/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article><article class="post reveal"><div class="post-main"><div class="post-info"><div class="post-time"><i class="fas fa-clock" aria-hidden="true"></i> <span class="post-time">2023-11-25</span></div><div class="post-title"><a class="post-title-link" href="/2023/11/25/C-create-print-reverse-stack/">C++ create, print,reverse stack</a></div><div class="post-meta"><div class="post-tags"></div><div class="post-categories"></div></div><div class="post-img-mobile"><a href="/2023/11/25/C-create-print-reverse-stack/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" class="lazyload placeholder" data-srcset="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-content">TASK 1 Stack Operations Create a stack of integers named intStack. Push at least five integers onto the stack. Print the</div></div><div class="post-more"><a href="/2023/11/25/C-create-print-reverse-stack/"><i class="iconfont iconmore" pointer title="阅读更多"></i></a></div></div><div class="post-img"><a href="/2023/11/25/C-create-print-reverse-stack/" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" src="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" class="lazyload placeholder" data-srcset="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div></article></section><div class="page-nav"><div class="page-info"><div class="page-info-text">1 / 2</div></div><a href="/page/2/" class="page-nav-next"><span class="mr-5">Next</span><i class="fas fa-angle-right"></i></a></div></div><aside id="l_side"><section class="widget side_blogger"><div class="content"><a class="avatar flat-box rectangle" href="/about/"><img src="/medias/avatar.jpg" class="lazyload placeholder" data-srcset="/medias/avatar.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp"></a><div class="text"><h2>Live your life the way you like.</h2><p><span id="jinrishici-sentence">Alex-Li-Blog</span></p><script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script></div><div class="social-wrapper"><a href="https://www.linkedin.com/in/alex-li-8866b3298/" class="social fab fa-linkedin-in flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a> <a href="mailto:liguangyao365@gmail.com" class="social fas fa-envelope flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a> <a href="https://github.com/alexlili" class="social fab fa-github flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a> <a href="https://alex-li-life.netlify.com" class="social fas fa-user-secret flat-btn" target="_blank" rel="external nofollow noopener noreferrer"></a></div></div></section><div class="layout_sticky"><section class="widget side_category"><header><a href="/blog/categories/"><i class="fas fa-folder-open fa-fw" aria-hidden="true"></i><span class="name">Article Categories</span></a></header><div class="content"><ul class="entry navigation"><li><a class="flat-box" title="/categories/algorithm/" href="/categories/algorithm/" id="categoriesalgorithm"><div class="name">algorithm</div><div class="badge">(3)</div></a></li><li><a class="flat-box" title="/categories/backend/" href="/categories/backend/" id="categoriesbackend"><div class="name">backend</div><div class="badge">(1)</div></a></li><li><a class="flat-box" title="/categories/frontend/" href="/categories/frontend/" id="categoriesfrontend"><div class="name">frontend</div><div class="badge">(1)</div></a></li><li><a class="flat-box child" title="/categories/frontend/backend/" href="/categories/frontend/backend/" id="categoriesfrontendbackend"><div class="name">backend</div><div class="badge">(1)</div></a></li><li><a class="flat-box" title="/categories/other/" href="/categories/other/" id="categoriesother"><div class="name">other</div><div class="badge">(1)</div></a></li></ul></div></section><section class="widget side_tagcloud"><header><a href="/tags/"><i class="fas fa-tags fa-fw" aria-hidden="true"></i><span class="name">Article Tags</span></a></header><div class="content"><a href="/tags/C/" style="font-size:14px;color:#999">C++</a> <a href="/tags/Hexo/" style="font-size:14px;color:#999">Hexo</a> <a href="/tags/Javascript/" style="font-size:24px;color:#555">Javascript</a> <a href="/tags/Leetcode/" style="font-size:24px;color:#555">Leetcode</a> <a href="/tags/Palindrome-Number/" style="font-size:14px;color:#999">Palindrome Number</a> <a href="/tags/Two-Sum/" style="font-size:14px;color:#999">Two Sum</a></div></section><section class="widget side_recent_post"><header><a href="/tags/"><i class="fas fa-book fa-fw" aria-hidden="true"></i><span class="name">Latest</span></a></header><div class="content"><div class="aside-list"><div class="aside-list-item"><div class="post-img-box"><a href="/2023/11/27/Return-Types-and-Void-Functions/" class="post-img" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" style="width:100%;height:100%;object-fit:cover" data-src="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-83ea273b88e119d9615aed0d89aad4ab_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-date-title"><div><span class="post-date">11-27</span></div><a class="post-title" href="/2023/11/27/Return-Types-and-Void-Functions/">Return Types and Void Functions</a></div></div><div class="aside-list-item"><div class="post-img-box"><a href="/2023/11/27/Passing-Arguments/" class="post-img" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" style="width:100%;height:100%;object-fit:cover" data-src="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" class="lazyload placeholder" data-srcset="https://pic3.zhimg.com/v2-a5267dfbf175991d4b3a69b41f3f678a_b.jpg" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-date-title"><div><span class="post-date">11-27</span></div><a class="post-title" href="/2023/11/27/Passing-Arguments/">Passing Arguments</a></div></div><div class="aside-list-item"><div class="post-img-box"><a href="/2023/11/27/Intro-Pointers-and-Their-Role/" class="post-img" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" style="width:100%;height:100%;object-fit:cover" data-src="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" class="lazyload placeholder" data-srcset="https://pic4.zhimg.com/80/v2-e434e3a2888fb4efb1844845b8791d1f_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-date-title"><div><span class="post-date">11-27</span></div><a class="post-title" href="/2023/11/27/Intro-Pointers-and-Their-Role/">Intro Pointers and Their Role:</a></div></div><div class="aside-list-item"><div class="post-img-box"><a href="/2023/11/27/Array-Manipulation-and-Traversal/" class="post-img" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" style="width:100%;height:100%;object-fit:cover" data-src="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" class="lazyload placeholder" data-srcset="https://pic2.zhimg.com/80/v2-29e78b52051ce542adf6d786d61fbd19_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-date-title"><div><span class="post-date">11-27</span></div><a class="post-title" href="/2023/11/27/Array-Manipulation-and-Traversal/">Array Manipulation and Traversal</a></div></div><div class="aside-list-item"><div class="post-img-box"><a href="/2023/11/27/Declaring-and-Accessing-Arrays/" class="post-img" style="background-size:cover;background-position:center center"><img class="lazyload lazyload placeholder" style="width:100%;height:100%;object-fit:cover" data-src="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" class="lazyload placeholder" data-srcset="https://pic1.zhimg.com/80/v2-03a22891ccba9bccf6424dfd7cbf4be7_1440w.webp" srcset="https://pic1.zhimg.com/v2-cd38920285d125be80b3eb504052c550_b.webp" alt=""></a></div><div class="post-date-title"><div><span class="post-date">11-27</span></div><a class="post-title" href="/2023/11/27/Declaring-and-Accessing-Arrays/">Declaring and Accessing Arrays</a></div></div></div></div></section><section class="widget side_archives"><header><a style="color:red" href="/archives/"><i class="fas fa-archive fa-fw" aria-hidden="true"></i><span class="name">Archive</span></a></header><div class="content"><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/11/"><span class="card-archive-list-date">November 2023</span><span class="card-archive-list-count">14</span></a></li></ul></div></section><section class="widget side_webinfo"><header><i class="fas fa-chart-line fa-fw" aria-hidden="true"></i><span class="name">Site Info</span></header><div class="content"><div class="webinfo"><div class="webinfo-item"><div>Article Count:</div><div>14 pieces</div></div><div class="webinfo-item"><div>Runtime:</div><div id="webinfo-runtime-count" publish_date="03/24/2020 21:34:09"></div></div><script>var BirthDay=new Date(new Date("2017/01/01")),today=new Date,timeold=today.getTime()-BirthDay.getTime(),daysold=Math.floor(timeold/864e5);document.getElementById("webinfo-runtime-count").innerHTML=daysold+" days"</script><div class="webinfo-item"><div>Total Words:</div><div>6.2k words</div></div><div class="webinfo-item"><div>UV:</div><div><span id="busuanzi_value_site_uv"><i class="fas fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> people</div></div><div class="webinfo-item"><div>PV:</div><div><span id="busuanzi_value_site_pv"><i class="fas fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> times</div></div><div class="webinfo-item"><div>Last update:</div><div id="last-update" style="display:none">Thu Aug 29 2024 01:41:30 GMT+1200 (新西兰标准时间)</div><div id="last-update-show">2024-08-29 days</div></div><script>function timeago(e){var t=864e5,n=(new Date).getTime()-e;if(!(n<0)){var a,s,g,r,o=n/6e4,u=n/36e5,d=n/t,i=n/6048e5,l=n/2592e6;return result=1<=l&&l<=3?" "+parseInt(l)+" 月前":1<=i&&i<=3?" "+parseInt(i)+" 周前":1<=d&&d<=6?" "+parseInt(d)+" 天前":1<=u&&u<=23?" "+parseInt(u)+" 小时前":1<=o&&o<=59?" "+parseInt(o)+" 分钟前":0<=n&&n<=6e4?"刚刚":((a=new Date).setTime(e),s=a.getFullYear(),g=a.getMonth()+1<10?"0"+(a.getMonth()+1):a.getMonth()+1,r=a.getDate()<10?"0"+a.getDate():a.getDate(),a.getHours()<10?a.getHours():a.getHours(),a.getMinutes()<10?a.getMinutes():a.getMinutes(),a.getSeconds()<10?a.getSeconds():a.getSeconds(),s+"-"+g+"-"+r),result}}var lastUpDate=document.getElementById("last-update").innerHTML;try{document.getElementById("last-update-show").innerHTML=timeago(new Date(lastUpDate))}catch(e){document.getElementById("last-update-show").innerHTML="2024-08-29 days"}</script></div></div></section></div></aside></div></main></div><div id="j-fish-skip" style="position:relative;height:153px;width:auto"></div><script>var RENDERER = {
POINT_INTERVAL: 5,
FISH_COUNT: 3,
MAX_INTERVAL_COUNT: 50,
INIT_HEIGHT_RATE: .5,
THRESHOLD: 50,
FISH_COLOR: '',
init: function () {
this.setFishColor(); this.setParameters(), this.reconstructMethods(), this.setup(), this.bindEvent(), this.render()
},
setFishColor: function () {
let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
if (isDark) {
this.FISH_COLOR = '#222'; // 暗黑色,有时间把这整成一个变量
} else {
this.FISH_COLOR = '' || 'rgba(66, 185, 133, 0.8)';
}
},
setParameters: function () {
this.$window = $(window), this.$container = $("#j-fish-skip"), this.$canvas = $("<canvas />"), this.context = this.$canvas.appendTo(this.$container).get(0).getContext("2d"), this.points = [], this.fishes = [], this.watchIds = []
},
createSurfacePoints: function () {
var t = Math.round(this.width / this.POINT_INTERVAL);
this.pointInterval = this.width / (t - 1), this.points.push(new SURFACE_POINT(this, 0));
for (var i = 1; i < t; i++) {
var e = new SURFACE_POINT(this, i * this.pointInterval),
h = this.points[i - 1];
e.setPreviousPoint(h), h.setNextPoint(e), this.points.push(e)
}
},
reconstructMethods: function () {
this.watchWindowSize = this.watchWindowSize.bind(this), this.jdugeToStopResize = this.jdugeToStopResize.bind(this), this.startEpicenter = this.startEpicenter.bind(this), this.moveEpicenter = this.moveEpicenter.bind(this), this.reverseVertical = this.reverseVertical.bind(this), this.render = this.render.bind(this)
},
setup: function () {
this.points.length = 0, this.fishes.length = 0, this.watchIds.length = 0, this.intervalCount = this.MAX_INTERVAL_COUNT, this.width = this.$container.width(), this.height = this.$container.height(), this.fishCount = this.FISH_COUNT * this.width / 500 * this.height / 500, this.$canvas.attr({
width: this.width,
height: this.height
}), this.reverse = !1, this.fishes.push(new FISH(this)), this.createSurfacePoints()
},
watchWindowSize: function () {
this.clearTimer(), this.tmpWidth = this.$window.width(), this.tmpHeight = this.$window.height(), this.watchIds.push(setTimeout(this.jdugeToStopResize, this.WATCH_INTERVAL))
},
clearTimer: function () {
for (; this.watchIds.length > 0;) clearTimeout(this.watchIds.pop())
},
jdugeToStopResize: function () {
var t = this.$window.width(),
i = this.$window.height(),
e = t == this.tmpWidth && i == this.tmpHeight;
this.tmpWidth = t, this.tmpHeight = i, e && this.setup()
},
bindEvent: function () {
this.$window.on("resize", this.watchWindowSize), this.$container.on("mouseenter", this.startEpicenter), this.$container.on("mousemove", this.moveEpicenter)
},
getAxis: function (t) {
var i = this.$container.offset();
return {
x: t.clientX - i.left + this.$window.scrollLeft(),
y: t.clientY - i.top + this.$window.scrollTop()
}
},
startEpicenter: function (t) {
this.axis = this.getAxis(t)
},
moveEpicenter: function (t) {
var i = this.getAxis(t);
this.axis || (this.axis = i), this.generateEpicenter(i.x, i.y, i.y - this.axis.y), this.axis = i
},
generateEpicenter: function (t, i, e) {
if (!(i < this.height / 2 - this.THRESHOLD || i > this.height / 2 + this.THRESHOLD)) {
var h = Math.round(t / this.pointInterval);
h < 0 || h >= this.points.length || this.points[h].interfere(i, e)
}
},
reverseVertical: function () {
this.reverse = !this.reverse;
for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].reverseVertical()
},
controlStatus: function () {
for (var t = 0, i = this.points.length; t < i; t++) this.points[t].updateSelf();
for (t = 0, i = this.points.length; t < i; t++) this.points[t].updateNeighbors();
this.fishes.length < this.fishCount && 0 == --this.intervalCount && (this.intervalCount = this.MAX_INTERVAL_COUNT, this.fishes.push(new FISH(this)))
},
render: function () {
requestAnimationFrame(this.render), this.controlStatus(), this.context.clearRect(0, 0, this.width, this.height), this.context.fillStyle = this.FISH_COLOR;
for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].render(this.context);
this.context.save(), this.context.globalCompositeOperation = "xor", this.context.beginPath(), this.context.moveTo(0, this.reverse ? 0 : this.height);
for (t = 0, i = this.points.length; t < i; t++) this.points[t].render(this.context);
this.context.lineTo(this.width, this.reverse ? 0 : this.height), this.context.closePath(), this.context.fill(), this.context.restore()
}
},
SURFACE_POINT = function (t, i) {
this.renderer = t, this.x = i, this.init()
};
SURFACE_POINT.prototype = {
SPRING_CONSTANT: .03,
SPRING_FRICTION: .9,
WAVE_SPREAD: .3,
ACCELARATION_RATE: .01,
init: function () {
this.initHeight = this.renderer.height * this.renderer.INIT_HEIGHT_RATE, this.height = this.initHeight, this.fy = 0, this.force = {
previous: 0,
next: 0
}
},
setPreviousPoint: function (t) {
this.previous = t
},
setNextPoint: function (t) {
this.next = t
},
interfere: function (t, i) {
this.fy = this.renderer.height * this.ACCELARATION_RATE * (this.renderer.height - this.height - t >= 0 ? -1 : 1) * Math.abs(i)
},
updateSelf: function () {
this.fy += this.SPRING_CONSTANT * (this.initHeight - this.height), this.fy *= this.SPRING_FRICTION, this.height += this.fy
},
updateNeighbors: function () {
this.previous && (this.force.previous = this.WAVE_SPREAD * (this.height - this.previous.height)), this.next && (this.force.next = this.WAVE_SPREAD * (this.height - this.next.height))
},
render: function (t) {
this.previous && (this.previous.height += this.force.previous, this.previous.fy += this.force.previous), this.next && (this.next.height += this.force.next, this.next.fy += this.force.next), t.lineTo(this.x, this.renderer.height - this.height)
}
};
var FISH = function (t) {
this.renderer = t, this.init()
};
FISH.prototype = {
GRAVITY: .4,
init: function () {
this.direction = Math.random() < .5, this.x = this.direction ? this.renderer.width + this.renderer.THRESHOLD : -this.renderer.THRESHOLD, this.previousY = this.y, this.vx = this.getRandomValue(4, 10) * (this.direction ? -1 : 1), this.renderer.reverse ? (this.y = this.getRandomValue(1 * this.renderer.height / 10, 4 * this.renderer.height / 10), this.vy = this.getRandomValue(2, 5), this.ay = this.getRandomValue(.05, .2)) : (this.y = this.getRandomValue(6 * this.renderer.height / 10, 9 * this.renderer.height / 10), this.vy = this.getRandomValue(-5, -2), this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1, this.theta = 0, this.phi = 0
},
getRandomValue: function (t, i) {
return t + (i - t) * Math.random()
},
reverseVertical: function () {
this.isOut = !this.isOut, this.ay *= -1
},
controlStatus: function (t) {
this.previousY = this.y, this.x += this.vx, this.y += this.vy, this.vy += this.ay, this.renderer.reverse ? this.y > this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy -= this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(.05, .2)), this.isOut = !1) : this.y < this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy += this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1), this.isOut || (this.theta += Math.PI / 20, this.theta %= 2 * Math.PI, this.phi += Math.PI / 30, this.phi %= 2 * Math.PI), this.renderer.generateEpicenter(this.x + (this.direction ? -1 : 1) * this.renderer.THRESHOLD, this.y, this.y - this.previousY), (this.vx > 0 && this.x > this.renderer.width + this.renderer.THRESHOLD || this.vx < 0 && this.x < -this.renderer.THRESHOLD) && this.init()
},
render: function (t) {
t.save(), t.translate(this.x, this.y), t.rotate(Math.PI + Math.atan2(this.vy, this.vx)), t.scale(1, this.direction ? 1 : -1), t.beginPath(), t.moveTo(-30, 0), t.bezierCurveTo(-20, 15, 15, 10, 40, 0), t.bezierCurveTo(15, -10, -20, -15, -30, 0), t.fill(), t.save(), t.translate(40, 0), t.scale(.9 + .2 * Math.sin(this.theta), 1), t.beginPath(), t.moveTo(0, 0), t.quadraticCurveTo(5, 10, 20, 8), t.quadraticCurveTo(12, 5, 10, 0), t.quadraticCurveTo(12, -5, 20, -8), t.quadraticCurveTo(5, -10, 0, 0), t.fill(), t.restore(), t.save(), t.translate(-3, 0), t.rotate((Math.PI / 3 + Math.PI / 10 * Math.sin(this.phi)) * (this.renderer.reverse ? -1 : 1)), t.beginPath(), this.renderer.reverse ? (t.moveTo(5, 0), t.bezierCurveTo(10, 10, 10, 30, 0, 40), t.bezierCurveTo(-12, 25, -8, 10, 0, 0)) : (t.moveTo(-5, 0), t.bezierCurveTo(-10, -10, -10, -30, 0, -40), t.bezierCurveTo(12, -25, 8, -10, 0, 0)), t.closePath(), t.fill(), t.restore(), t.restore(), this.controlStatus(t)
}
}, $(function () {
RENDERER.init()
$('.dark').click(function () {
setTimeout(() => {
RENDERER.setFishColor();
RENDERER.context.fill();
});
})
});</script><div class="footer bg-color"><div class="footer-main"><div class="link"></div><div class="footer-copyright"><p>Copyright © 2017 - 2024 <a target="_blank" rel="noopener" href="https://github.com/alexlili">alexlili</a> | Powered by <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">Hexo</a></p></div><div class="footer-custom"></div></div></div><div class="dark"><div class="dark-content"><i class="fas fa-moon" aria-hidden="true"></i></div></div><script>$(function() {
let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
if (isDark) {
$(".dark-content").replaceWith(
`
<div class='dark-content'>
<i class="fas fa-lightbulb" aria-hidden="true"></i>
</div>
`
);
}
$('.dark').click(function() {
if ($(document.body).is('.darkModel')) {
$(document.body).removeClass('darkModel');
localStorage.setItem('dark', false);
$(".dark-content").replaceWith(
`
<div class='dark-content'>
<i class="fas fa-moon" aria-hidden="true"></i>
</div>
`
);
} else {
$(document.body).addClass('darkModel');
localStorage.setItem('dark', true);
$(".dark-content").replaceWith(
`
<div class='dark-content'>
<i class="fas fa-lightbulb" aria-hidden="true"></i>
</div>
`
);
}
})
})</script><div class="goTop top-btn-color" pointer><i class="fas fa-arrow-up" aria-hidden="true"></i></div><script src="/js/goTop.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script><script src="/js/utils/index.js"></script><script src="/js/app.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.18.2/tocbot.min.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.18.2/tocbot.css"><script>var headerEl = 'h2, h3, h4', //headers
content = '.post-detail',//文章容器
idArr = {}; //标题数组以确定是否增加索引id
//add #id
var option = {
// Where to render the table of contents.
tocSelector: '.toc',
// Where to grab the headings to build the table of contents.
contentSelector: content,
// Which headings to grab inside of the contentSelector element.
headingSelector: headerEl,
scrollSmooth: true,
scrollSmoothOffset: -70,
// headingsOffset: -($(window).height() * 0.4 - 45),
headingsOffset: -($(window).height() * 0.4 - 70),
// positionFixedSelector: '.toc-main',
// positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto',
activeLinkClass: 'is-active-link',
orderedList: true,
collapseDepth: 20,
// onClick: function (e) {},
}
if ($('.toc').length > 0) {
$(content).children(headerEl).each(function () {
//去除空格以及多余标点
var headerId = $(this).text().replace(/[\s|\~|`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\=|\||\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\:|\,|\。]/g, '');
headerId = headerId.toLowerCase();
if (idArr[headerId]) {
//id已经存在
$(this).attr('id', headerId + '-' + idArr[headerId]);
idArr[headerId]++;
}
else {
//id未存在
idArr[headerId] = 1;
$(this).attr('id', headerId);
}
});
document.addEventListener("DOMContentLoaded", function () {
tocbot.init(option);
mobileTocClick();
});
}
window.tocScrollFn = function () {
return bamboo.throttle(function () {
findHeadPosition();
}, 100)()
}
window.addEventListener('scroll', tocScrollFn);
const findHeadPosition = function (top) {
if ($('.toc-list').length <= 0) {
return false;
}
setTimeout(() => { // or DOMContentLoaded
autoScrollToc();
}, 0);
}
const autoScrollToc = function () {
const $activeItem = document.querySelector('.is-active-link');
const $cardToc = document.querySelector('.toc-content');
const activePosition = $activeItem.getBoundingClientRect().top
const sidebarScrollTop = $cardToc.scrollTop
if (activePosition > (document.documentElement.clientHeight - 100)) {
$cardToc.scrollTop = sidebarScrollTop + 150
}
if (activePosition < 150) {
$cardToc.scrollTop = sidebarScrollTop - 150
}
}
document.addEventListener('pjax:send', function () {
if ($('.toc').length) {
tocbot.destroy();
}
});
document.addEventListener('pjax:complete', function () {
if ($('.toc').length) {
tocbot.init(option);
mobileTocClick();
}
});
// 手机端toc按钮点击出现目录
const mobileTocClick = function () {
const $cardTocLayout = document.getElementsByClassName('side_toc')[0];
const $cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0];
let right = '45px';
if (window.innerWidth >= 551 && window.innerWidth <= 992) {
right = '100px'
}
const mobileToc = {
open: () => {
$cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: ' + right
},
close: () => {
$cardTocLayout.style.animation = 'toc-close .2s'
setTimeout(() => {
$cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''"
}, 100)
}
}
document.getElementById('toc-mobile-btn').addEventListener('click', () => {
if (window.getComputedStyle($cardTocLayout).getPropertyValue('opacity') === '0') mobileToc.open()
else mobileToc.close()
})
$cardToc.addEventListener('click', (e) => {
if (window.innerWidth < 992) { // 小于992px的时候
mobileToc.close()
}
})
}</script><style></style><script>let setHeaderClass = () => {
const nav = $('#navHeader');
const navTop = nav.outerHeight();
const winTop = $(window).scrollTop();
if(winTop > navTop) {
nav.addClass('header-bg-color');
}
else {
nav.removeClass('header-bg-color');
}
};
let scrollCollect = () => {
return bamboo.throttle(function (e) {
setHeaderClass();
}, 200)()
}
let initHeaderBg = () => {
setHeaderClass();
}
setHeaderClass();
window.addEventListener('scroll', scrollCollect);
document.addEventListener('pjax:send', function () {
window.removeEventListener('scroll', scrollCollect)
})
document.addEventListener('pjax:complete', function () {
window.addEventListener('scroll', scrollCollect);
setHeaderClass();
})</script><script>function loadIssuesJS(){0!=$(".post-detail").find(".issues-api").length&&loadScript("/js/issues/index.js")}$(function(){loadIssuesJS()}),document.addEventListener("pjax:complete",function(){"undefined"==typeof IssuesAPI&&loadIssuesJS()})</script><script>function loadPhotoOnlineJS(){0!=$(".post-detail").find(".getJsonPhoto-api").length&&loadScript("/js/getPhotoOnline/index.js")}$(function(){loadPhotoOnlineJS()}),document.addEventListener("pjax:complete",function(){"undefined"==typeof getPhotoJson&&loadPhotoOnlineJS()})</script><script>function loadTalkOnlineJS(){0!=$(".post-detail").find(".getJsonTalk-api").length&&(loadScript("https://cdnjs.cloudflare.com/ajax/libs/waterfall.js/1.0.2/waterfall.min.js"),loadScript("/js/getTalkOnline/index.js"))}$(function(){loadTalkOnlineJS()}),document.addEventListener("pjax:complete",function(){"undefined"==typeof getTalkJson&&loadTalkOnlineJS()})</script><script>function loadSiteOnlineJS(){0!=$(".post-detail").find(".getJsonSite-api").length&&loadScript("/js/getSiteOnline/index.js")}$(function(){loadSiteOnlineJS()}),document.addEventListener("pjax:complete",function(){"undefined"==typeof getSiteJson&&loadSiteOnlineJS()})</script><script src="/js/activate-power-mode.js"></script><script>POWERMODE.colorful=!0,POWERMODE.shake=!1,document.body.addEventListener("input",POWERMODE)</script><link rel="stylesheet" href="https://unpkg.com/v-plugs-ayu/lib/ayu.css"><script src="https://unpkg.com/v-plugs-ayu/lib/ayu.umd.min.js"></script><script src="/js/clipboard/clipboard.min.js"></script><div id="appCopy"></div><script data-pjax>var vm = new Vue({
el: '#appCopy',
data: {
},
computed: {
},
mounted() {
const that = this;
var copy = 'copy';
/* code */
var initCopyCode = function () {
var copyHtml = '';
copyHtml += '<button class="btn-copy" data-clipboard-snippet="" style="position:absolute;top:0;right:0;z-index:1;">';
copyHtml += '<i class="fas fa-copy"></i><span>' + copy + '</span>';
copyHtml += '</button>';
$(".post-detail pre").not('.gutter pre').wrap("<div class='codeBox' style='position:relative;width:100%;'></div>")
$(".post-detail pre").not('.gutter pre').before(copyHtml);
new ClipboardJS('.btn-copy', {
target: function (trigger) {
return trigger.nextElementSibling;
}
});
}
initCopyCode();
$('.btn-copy').unbind('click').bind('click', function () {
doSomething();
})
$(document).unbind('keypress').bind('keypress', function (e) {
if (e.ctrlKey && e.keyCode == 67) {
doSomething();
}
})
function doSomething() {
that.$notify({
title: "success",
content: "Code has been copied.",
type: 'success'
})
}
},
methods: {
},
created() { }
})</script><script defer src="https://unpkg.com/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script><script>window.lazyLoadOptions={elements_selector:".lazyload",threshold:0},window.addEventListener("LazyLoad::Initialized",function(n){window.lazyLoadInstance=n.detail.instance},!1),document.addEventListener("DOMContentLoaded",function(){lazyLoadInstance.update()}),document.addEventListener("pjax:complete",function(){lazyLoadInstance.update()})</script><script type="text/javascript">var utteranceCommon = {};
function check_utterance() {
let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
if (isDark) {
utteranceCommon.Theme = 'github-dark';
} else {
utteranceCommon.Theme = 'github-light';
}
return document.getElementById("gitment-container");
}
comment_el = '#gitment-container';
load_utterance = function () {
if ($(comment_el).length) {
// 匿名函数,防止污染全局变量
const HEAD = check_utterance();
var utterances = document.createElement('script');
utterances.type = 'text/javascript';
utterances.async = true;
utterances.setAttribute('issue-term', 'pathname')
utterances.setAttribute('theme', utteranceCommon.Theme)
utterances.setAttribute('repo', 'alexlili/alex_li_blog')
utterances.crossorigin = 'anonymous';
utterances.src = 'https://utteranc.es/client.js';
// content 是要插入评论的地方
document.getElementById('gitment-container').appendChild(utterances);
}
}
function dark_utterance() {
const HEAD = check_utterance();
if (!HEAD) return;
const message = {
type: 'set-theme',
theme: utteranceCommon.Theme
};
const utteranceIframe = document.querySelector('iframe');
utteranceIframe.contentWindow.postMessage(message, 'https://utteranc.es');
}
$(document).ready(load_utterance);
document.addEventListener('pjax:complete', function () {
load_utterance();
});
$('.dark').click(function () {
setTimeout(() => {
dark_utterance();
});
})</script><style>.utterances{max-width:inherit!important}</style><script src="/js/cursor/fireworks.js"></script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" data-pjax></script><script>var bambooSwiperTag = {};
function load_swiper() {
if (!document.querySelectorAll(".post-swiper-container")[0]) return;
loadCSS("https://unpkg.com/swiper@6/swiper-bundle.min.css")
loadScript("https://unpkg.com/swiper@6/swiper-bundle.min.js").then(() => {
pjax_swiper();
});
}
load_swiper();
function pjax_swiper() {
bambooSwiperTag.swiper = new Swiper('.post-swiper-container', {
slidesPerView: 'auto',
spaceBetween: 8,
centeredSlides: true,
loop: true,
autoplay: true ? {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: false,
} : false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
on:{
init: function(){
swiperAnimateCache(this); //隐藏动画元素
swiperAnimate(this); //初始化完成开始动画
},
slideChangeTransitionEnd: function(){
swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
//this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名
}
}
});
}
document.addEventListener('pjax:complete', function () {
if (!document.querySelectorAll(".post-swiper-container")[0]) return;
if (typeof bambooSwiperTag.swiper === "undefined") {
load_swiper();
} else {
pjax_swiper();
}
});</script><script src="/js/pjax@0.2.8/index.js"></script><div class="pjax-animate"><div class="loading-circle"><div id="loader-circle"></div></div><script>window.ShowLoading=function(){$(".loading-circle").css("display","block")},window.HideLoading=function(){$(".loading-circle").css("display","none")}</script><script>document.addEventListener("pjax:complete",function(){window.HideLoading()}),document.addEventListener("pjax:send",function(){window.ShowLoading()}),document.addEventListener("pjax:error",function(){window.HideLoading()})</script></div><script>var pjax = new Pjax({
elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([no-pjax])', // 拦截正常带链接的 a 标签
selectors: ["#pjax-container","title"], // 根据实际需要确认重载区域
cacheBust: false, // url 地址追加时间戳,用以避免浏览器缓存
timeout: 5000
});
document.addEventListener('pjax:send', function (e) {
try {
var currentUrl = window.location.pathname;
var targetUrl = e.triggerElement.href;
var banUrl = [""];
if (banUrl[0] != "") {
banUrl.forEach(item => {
if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
window.location.href = targetUrl;
}
});
}
} catch (error) {}
$(window).unbind('resize');
$(window).unbind('scroll');
$(document).unbind('scroll');
$(document).unbind('click');
$('body').unbind('click');
})
document.addEventListener('pjax:complete', function () {
$('script[data-pjax], .pjax-reload script').each(function () {
$(this).parent().append($(this).remove());
});
});
document.addEventListener('pjax:error', function (e) {
window.location.href = e.triggerElement.href;
})
// 刷新不从顶部开始
document.addEventListener("DOMContentLoaded", function () {
history.scrollRestoration = 'auto';
})</script></body></html>