jekyll-theme-chirpy 4.3.4 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -162
- data/_config.yml +44 -18
- data/_data/assets/cross_origin.yml +62 -0
- data/_data/assets/self_host.yml +51 -0
- data/_data/locales/en.yml +3 -15
- data/_data/locales/id-ID.yml +2 -14
- data/_data/locales/ko-KR.yml +78 -0
- data/_data/locales/my-MM.yml +78 -0
- data/_data/locales/ru-RU.yml +78 -0
- data/_data/locales/uk-UA.yml +78 -0
- data/_data/locales/zh-CN.yml +2 -14
- data/_data/share.yml +1 -1
- data/_includes/assets-origin.html +12 -0
- data/_includes/{disqus.html → comments/disqus.html} +4 -4
- data/_includes/comments/giscus.html +56 -0
- data/_includes/comments/utterances.html +51 -0
- data/_includes/comments.html +5 -0
- data/_includes/footer.html +1 -1
- data/_includes/head.html +35 -20
- data/_includes/js-selector.html +43 -11
- data/_includes/jsdelivr-combine.html +32 -0
- data/_includes/mermaid.html +31 -3
- data/_includes/mode-toggle.html +49 -65
- data/_includes/post-sharing.html +2 -2
- data/_includes/read-time.html +3 -3
- data/_includes/refactor-content.html +160 -36
- data/_includes/related-posts.html +1 -1
- data/_includes/search-loader.html +1 -1
- data/_includes/search-results.html +0 -8
- data/_includes/sidebar.html +16 -17
- data/_includes/timeago.html +11 -23
- data/_includes/toc.html +16 -0
- data/_includes/topbar.html +2 -3
- data/_includes/trending-tags.html +14 -0
- data/_includes/update-list.html +16 -0
- data/_layouts/archives.html +5 -7
- data/_layouts/category.html +3 -5
- data/_layouts/default.html +10 -4
- data/_layouts/home.html +14 -11
- data/_layouts/page.html +47 -22
- data/_layouts/post.html +128 -127
- data/_layouts/tag.html +3 -5
- data/_sass/addon/commons.scss +276 -290
- data/_sass/addon/module.scss +67 -31
- data/_sass/addon/syntax.scss +90 -66
- data/_sass/addon/variables.scss +7 -7
- data/_sass/colors/dark-syntax.scss +4 -4
- data/_sass/colors/dark-typography.scss +21 -9
- data/_sass/colors/light-syntax.scss +9 -4
- data/_sass/colors/light-typography.scss +18 -6
- data/_sass/jekyll-theme-chirpy.scss +1 -1
- data/_sass/layout/home.scss +6 -2
- data/_sass/layout/post.scss +52 -46
- data/_tabs/about.md +2 -2
- data/assets/404.html +0 -2
- data/assets/js/data/search.json +1 -0
- data/assets/js/data/swcache.js +11 -20
- data/assets/js/dist/categories.min.js +2 -2
- data/assets/js/dist/commons.min.js +2 -2
- data/assets/js/dist/home.min.js +2 -2
- data/assets/js/dist/misc.min.js +6 -0
- data/assets/js/dist/page.min.js +2 -2
- data/assets/js/dist/post.min.js +2 -2
- data/assets/js/dist/pvreport.min.js +2 -2
- metadata +16 -6
- data/_includes/css-selector.html +0 -15
- data/_includes/no-zero-date.html +0 -13
- data/_includes/panel.html +0 -59
data/_sass/layout/post.scss
CHANGED
@@ -16,27 +16,37 @@
|
|
16
16
|
border-color: var(--btn-border-color);
|
17
17
|
}
|
18
18
|
|
19
|
-
@mixin dot($pl: 0.
|
19
|
+
@mixin dot($pl: 0.25rem, $pr: 0.25rem) {
|
20
20
|
content: "\2022";
|
21
|
-
color: rgba(158, 158, 158, 0.8);
|
22
21
|
padding-left: $pl;
|
23
22
|
padding-right: $pr;
|
24
23
|
}
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
%text-color {
|
26
|
+
color: var(--text-color);
|
27
|
+
}
|
28
|
+
|
29
|
+
h1 + .post-meta {
|
30
|
+
span + span::before {
|
31
|
+
@include dot;
|
32
|
+
}
|
33
|
+
|
34
|
+
em {
|
35
|
+
@extend %text-color;
|
36
|
+
|
37
|
+
a {
|
38
|
+
@extend %text-color;
|
30
39
|
}
|
31
40
|
}
|
32
41
|
}
|
33
42
|
|
34
|
-
.
|
35
|
-
|
36
|
-
|
43
|
+
img.preview-img {
|
44
|
+
margin-top: 3.75rem;
|
45
|
+
margin-bottom: 0;
|
46
|
+
border-radius: 6px;
|
37
47
|
|
38
|
-
|
39
|
-
|
48
|
+
&.bg[data-loaded=true] {
|
49
|
+
background: var(--preview-img-bg);
|
40
50
|
}
|
41
51
|
}
|
42
52
|
|
@@ -44,6 +54,10 @@
|
|
44
54
|
margin-top: 6rem;
|
45
55
|
border-bottom: 1px double var(--main-border-color);
|
46
56
|
font-size: 0.85rem;
|
57
|
+
|
58
|
+
.post-meta a:not(:hover) {
|
59
|
+
@extend %link-underline;
|
60
|
+
}
|
47
61
|
}
|
48
62
|
|
49
63
|
.post-tags {
|
@@ -109,7 +123,7 @@
|
|
109
123
|
white-space: normal;
|
110
124
|
}
|
111
125
|
|
112
|
-
}
|
126
|
+
} /* .post-navigation */
|
113
127
|
|
114
128
|
@keyframes fade-up {
|
115
129
|
from {
|
@@ -131,14 +145,6 @@
|
|
131
145
|
top: 4rem;
|
132
146
|
transition: top 0.2s ease-in-out;
|
133
147
|
animation: fade-up 0.8s;
|
134
|
-
|
135
|
-
&.topbar-down {
|
136
|
-
top: 6rem;
|
137
|
-
}
|
138
|
-
|
139
|
-
> span {
|
140
|
-
@include panel-label;
|
141
|
-
}
|
142
148
|
}
|
143
149
|
|
144
150
|
#toc li a {
|
@@ -165,6 +171,10 @@ nav[data-toggle=toc] {
|
|
165
171
|
@include label(1.1rem, 600);
|
166
172
|
}
|
167
173
|
|
174
|
+
em {
|
175
|
+
@extend %normal-font-style;
|
176
|
+
}
|
177
|
+
|
168
178
|
.card {
|
169
179
|
border-color: var(--card-border-color);
|
170
180
|
background-color: var(--card-bg);
|
@@ -174,7 +184,7 @@ nav[data-toggle=toc] {
|
|
174
184
|
transition: all 0.3s ease-in-out;
|
175
185
|
|
176
186
|
h3 {
|
177
|
-
|
187
|
+
@extend %text-color;
|
178
188
|
}
|
179
189
|
|
180
190
|
&:hover {
|
@@ -220,14 +230,17 @@ nav[data-toggle=toc] {
|
|
220
230
|
}
|
221
231
|
}
|
222
232
|
|
223
|
-
#
|
233
|
+
#tail-wrapper {
|
224
234
|
min-height: 2rem;
|
225
235
|
|
226
|
-
|
227
|
-
min-height: 7.5rem;
|
236
|
+
> div:last-of-type {
|
228
237
|
margin-bottom: 2rem;
|
229
238
|
}
|
230
239
|
|
240
|
+
#disqus_thread {
|
241
|
+
min-height: 8.5rem;
|
242
|
+
}
|
243
|
+
|
231
244
|
}
|
232
245
|
|
233
246
|
.post-tail-bottom a {
|
@@ -288,13 +301,13 @@ nav[data-toggle=toc] {
|
|
288
301
|
}
|
289
302
|
}
|
290
303
|
|
291
|
-
}
|
304
|
+
} /* .share-icons */
|
292
305
|
|
293
306
|
.fas.fa-link {
|
294
307
|
@include btn-sharing-color(rgb(171, 171, 171));
|
295
308
|
}
|
296
309
|
|
297
|
-
}
|
310
|
+
} /* .share-wrapper */
|
298
311
|
|
299
312
|
.share-label {
|
300
313
|
@include label(inherit, 400, inherit);
|
@@ -308,7 +321,7 @@ nav[data-toggle=toc] {
|
|
308
321
|
line-height: 1.2rem;
|
309
322
|
|
310
323
|
> a {
|
311
|
-
|
324
|
+
color: var(--text-color);
|
312
325
|
|
313
326
|
&:hover {
|
314
327
|
@extend %link-hover;
|
@@ -318,9 +331,14 @@ nav[data-toggle=toc] {
|
|
318
331
|
span:last-child {
|
319
332
|
font-size: 0.85rem;
|
320
333
|
}
|
321
|
-
|
334
|
+
|
335
|
+
} /* .license-wrapper */
|
322
336
|
|
323
337
|
@media all and (max-width: 576px) {
|
338
|
+
.preview-img[data-src] {
|
339
|
+
margin-top: 2.2rem;
|
340
|
+
}
|
341
|
+
|
324
342
|
.post-tail-bottom {
|
325
343
|
-ms-flex-wrap: wrap-reverse !important;
|
326
344
|
flex-wrap: wrap-reverse !important;
|
@@ -338,29 +356,17 @@ nav[data-toggle=toc] {
|
|
338
356
|
}
|
339
357
|
}
|
340
358
|
|
341
|
-
@media all and (min-width: 768px) {
|
342
|
-
#post-wrapper {
|
343
|
-
.post-meta {
|
344
|
-
> div:not(:first-child)::before {
|
345
|
-
@include dot(0.5rem, 0.2rem);
|
346
|
-
}
|
347
|
-
|
348
|
-
&.flex-column {
|
349
|
-
-webkit-box-orient: horizontal !important;
|
350
|
-
-webkit-box-direction: normal !important;
|
351
|
-
-ms-flex-direction: row !important;
|
352
|
-
flex-direction: row !important;
|
353
|
-
}
|
354
|
-
}
|
355
|
-
} // .post
|
356
|
-
}
|
357
|
-
|
358
359
|
/* Hide SideBar and TOC */
|
359
|
-
@media all and (max-width:
|
360
|
+
@media all and (max-width: 849px) {
|
360
361
|
.post-navigation {
|
361
362
|
padding-left: 0;
|
362
363
|
padding-right: 0;
|
363
364
|
margin-left: -0.5rem;
|
364
365
|
margin-right: -0.5rem;
|
365
366
|
}
|
367
|
+
|
368
|
+
.preview-img[data-src] {
|
369
|
+
max-width: 100vw;
|
370
|
+
border-radius: 0;
|
371
|
+
}
|
366
372
|
}
|
data/_tabs/about.md
CHANGED
@@ -4,5 +4,5 @@ icon: fas fa-info-circle
|
|
4
4
|
order: 4
|
5
5
|
---
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
> Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
|
8
|
+
{: .prompt-tip }
|
data/assets/404.html
CHANGED
data/assets/js/data/search.json
CHANGED
data/assets/js/data/swcache.js
CHANGED
@@ -9,13 +9,7 @@ const resource = [
|
|
9
9
|
/* --- CSS --- */
|
10
10
|
'{{ "/assets/css/style.css" | relative_url }}',
|
11
11
|
|
12
|
-
/* ---
|
13
|
-
{% assign js_path = "/assets/js" | relative_url %}
|
14
|
-
'{{ js_path }}/dist/home.min.js',
|
15
|
-
'{{ js_path }}/dist/page.min.js',
|
16
|
-
'{{ js_path }}/dist/post.min.js',
|
17
|
-
'{{ js_path }}/dist/categories.min.js',
|
18
|
-
'{{ js_path }}/data/search.json',
|
12
|
+
/* --- PWA --- */
|
19
13
|
'{{ "/app.js" | relative_url }}',
|
20
14
|
'{{ "/sw.js" | relative_url }}',
|
21
15
|
|
@@ -26,30 +20,27 @@ const resource = [
|
|
26
20
|
'{{ tab.url | relative_url }}',
|
27
21
|
{% endfor %}
|
28
22
|
|
29
|
-
/* --- Favicons --- */
|
30
|
-
{% assign
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
'{{ favicon_path }}/apple-touch-icon.png',
|
35
|
-
'{{ favicon_path }}/favicon-16x16.png',
|
36
|
-
'{{ favicon_path }}/favicon-32x32.png',
|
37
|
-
'{{ favicon_path }}/favicon.ico',
|
38
|
-
'{{ favicon_path }}/mstile-150x150.png',
|
39
|
-
'{{ favicon_path }}/site.webmanifest',
|
40
|
-
'{{ favicon_path }}/browserconfig.xml'
|
23
|
+
/* --- Favicons & compressed JS --- */
|
24
|
+
{% assign cache_list = site.static_files | where: 'swcache', true %}
|
25
|
+
{% for file in cache_list %}
|
26
|
+
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
|
27
|
+
{% endfor %}
|
41
28
|
|
42
29
|
];
|
43
30
|
|
44
31
|
/* The request url with below domain will be cached */
|
45
32
|
const allowedDomains = [
|
46
|
-
{% if site.google_analytics.id !=
|
33
|
+
{% if site.google_analytics.id != empty and site.google_analytics.id %}
|
47
34
|
'www.googletagmanager.com',
|
48
35
|
'www.google-analytics.com',
|
49
36
|
{% endif %}
|
50
37
|
|
51
38
|
'{{ site.url | split: "//" | last }}',
|
52
39
|
|
40
|
+
{% if site.img_cdn contains '//' and site.img_cdn %}
|
41
|
+
'{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
|
42
|
+
{% endif %}
|
43
|
+
|
53
44
|
'fonts.gstatic.com',
|
54
45
|
'fonts.googleapis.com',
|
55
46
|
'cdn.jsdelivr.net',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
$(function(){$(window).scroll(()=>{
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const e=$('meta[name="prefer-datetime-locale"]'),o=0<e.length?e.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),t="data-ts",a="data-df";return{locale:()=>o,attrTimestamp:()=>t,attrDateFormat:()=>a,getTimestamp:e=>Number(e.attr(t)),getDateFormat:e=>e.attr(a)}}();$(function(){$(".mode-toggle").click(e=>{const o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),o="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>e.attr(o,!1),showTopbar:()=>e.attr(o,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),r.addClass("unloaded"),o.addClass("unloaded"),l.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),r.removeClass("unloaded"),o.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return t.hasClass("loaded")}o.click(function(){p.on(),u.on(),i.focus()}),t.click(function(){p.off(),u.off()}),i.focus(function(){l.addClass("input-focus")}),i.focusout(function(){l.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const t=$("body");return{toggle(){!1===o?t.attr(e,""):t.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#search-input"),t=ScrollHelper.getTopbarHeight();let e,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=t)){if(e>a)ScrollHelper.hideTopbar(),o.is(":focus")&&o.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var o="div.post>h1:first-of-type";const t=$(o),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=t.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(a);let e=new IntersectionObserver(e=>{var o,t;r?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&n.text(a):1===e.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$("#"+e).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$("#"+e).addClass("hide-border-bottom"))})});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
$(function(){$(window).scroll(()=>{
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const e=$('meta[name="prefer-datetime-locale"]'),o=0<e.length?e.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),t="data-ts",a="data-df";return{locale:()=>o,attrTimestamp:()=>t,attrDateFormat:()=>a,getTimestamp:e=>Number(e.attr(t)),getDateFormat:e=>e.attr(a)}}();$(function(){$(".mode-toggle").click(e=>{const o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),o="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>e.attr(o,!1),showTopbar:()=>e.attr(o,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),c=$("#search-input"),i=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),r.addClass("unloaded"),o.addClass("unloaded"),l.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),r.removeClass("unloaded"),o.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),i.hasClass("unloaded")&&i.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),c.val(""),e=!1)},isVisible(){return e}}}();function f(){return t.hasClass("loaded")}o.click(function(){p.on(),u.on(),c.focus()}),t.click(function(){p.off(),u.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("input",()=>{""===c.val()?f()?i.removeClass("unloaded"):u.off():(u.on(),f()&&i.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const t=$("body");return{toggle(){!1===o?t.attr(e,""):t.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#search-input"),t=ScrollHelper.getTopbarHeight();let e,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=t)){if(e>a)ScrollHelper.hideTopbar(),o.is(":focus")&&o.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var o="div.post>h1:first-of-type";const t=$(o),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=t.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(a);let e=new IntersectionObserver(e=>{var o,t;r?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&n.text(a):1===e.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}});
|
data/assets/js/dist/home.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
$(function(){$(window).scroll(()=>{
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const t=$('meta[name="prefer-datetime-locale"]'),e=0<t.length?t.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>e,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:t=>Number(t.attr(o)),getDateFormat:t=>t.attr(a)}}();$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const t=$("body"),e="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>t.attr(e,!1),showTopbar:()=>t.attr(e,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),i=$("#search-results"),s=$("#search-input"),c=$("#search-hints"),d=function(){let t=0;return{block(){t=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(t)},getOffset(){return t}}}(),p={on(){t.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),t.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let t=!1;return{on(){t||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),s.val(""),t=!1)},isVisible(){return t}}}();function f(){return o.hasClass("loaded")}e.click(function(){p.on(),u.on(),s.focus()}),o.click(function(){p.off(),u.off()}),s.focus(function(){l.addClass("input-focus")}),s.focusout(function(){l.removeClass("input-focus")}),s.on("input",()=>{""===s.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var t=function(){const t="sidebar-display";let e=!1;const o=$("body");return{toggle(){!1===e?o.attr(t,""):o.removeAttr(t),e=!e}}}();$("#sidebar-trigger").click(t.toggle),$("#mask").click(t.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),o=ScrollHelper.getTopbarHeight();let t,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var t=screen.orientation.type;"landscape-primary"!==t&&"landscape-secondary"!==t||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{t=t||!0}),setInterval(()=>{t&&(function(){var t=$(this).scrollTop();if(!(Math.abs(a-t)<=o)){if(t>a)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(t+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=t}}(),t=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const i=n.text().trim();let a=o.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let t=new IntersectionObserver(t=>{var e,o;r?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(i)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){const a=LocaleHelper.attrTimestamp(),t=$(".timeago");let o=t.length,e=void 0;function r(){return t.each(function(){if(void 0!==$(this).attr(a)){let t=function(t){const e=dayjs(),o=dayjs.unix(LocaleHelper.getTimestamp(t));return 10<e.diff(o,"month",!0)?(t.removeAttr(a),o.format("ll")):(44<e.diff(o,"minute",!0)&&t.removeAttr(a),o.fromNow())}($(this));var e=$(this).attr("data-capitalize");void 0!==e&&"true"===e&&(t=t.replace(/^\w/,t=>t.toUpperCase())),$(this).text()!==t&&$(this).text(t)}else--o}),0===o&&void 0!==e&&clearInterval(e),o}dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_relativeTime),dayjs.extend(window.dayjs_plugin_localizedFormat),0!==o&&(t.each(function(){var t,e=$(this).attr("data-toggle");void 0!==e&&"tooltip"===e&&(t=$(this).attr("data-tooltip-df"),e=LocaleHelper.getTimestamp($(this)),t=dayjs.unix(e).format(t),$(this).attr("data-original-title",t),$(this).removeAttr("data-tooltip-df"))}),r()&&(e=setInterval(r,6e4)))});
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/*!
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
|
+
* © 2019 Cotes Chung
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const e=$('meta[name="prefer-datetime-locale"]'),t=0<e.length?e.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>t,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:e=>Number(e.attr(o)),getDateFormat:e=>e.attr(a)}}();$(function(){$(".mode-toggle").click(e=>{const t=$(e.target);let o=t.prop("tagName")==="button".toUpperCase()?t:t.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),r.addClass("unloaded"),t.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),r.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return o.hasClass("loaded")}t.click(function(){p.on(),u.on(),i.focus()}),o.click(function(){p.off(),u.off()}),i.focus(function(){l.addClass("input-focus")}),i.focusout(function(){l.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=o)){if(e>a)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var t="div.post>h1:first-of-type";const o=$(t),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=o.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let e=new IntersectionObserver(e=>{var t,o;r?(t=$(window).scrollTop(),o=l<t,l=t,e=e[0],o?0===e.intersectionRatio&&n.text(a):1===e.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(t)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){const e=dayjs.unix(LocaleHelper.getTimestamp($(this)));var t=LocaleHelper.getDateFormat($(this)),t=e.format(t);$(this).text(t),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat())})});
|
data/assets/js/dist/page.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
$(function(){$(window).scroll(()=>{
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const t=$('meta[name="prefer-datetime-locale"]'),e=0<t.length?t.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>e,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:t=>Number(t.attr(o)),getDateFormat:t=>t.attr(a)}}();$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const t=$("body"),e="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>t.attr(e,!1),showTopbar:()=>t.attr(e,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),i=$("#search-results"),c=$("#search-input"),s=$("#search-hints"),d=function(){let t=0;return{block(){t=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(t)},getOffset(){return t}}}(),p={on(){t.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),t.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let t=!1;return{on(){t||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),s.hasClass("unloaded")&&s.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),c.val(""),t=!1)},isVisible(){return t}}}();function h(){return o.hasClass("loaded")}e.click(function(){p.on(),u.on(),c.focus()}),o.click(function(){p.off(),u.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("input",()=>{""===c.val()?h()?s.removeClass("unloaded"):u.off():(u.on(),h()&&s.addClass("unloaded"))})}),$(function(){var t=function(){const t="sidebar-display";let e=!1;const o=$("body");return{toggle(){!1===e?o.attr(t,""):o.removeAttr(t),e=!e}}}();$("#sidebar-trigger").click(t.toggle),$("#mask").click(t.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),o=ScrollHelper.getTopbarHeight();let t,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var t=screen.orientation.type;"landscape-primary"!==t&&"landscape-secondary"!==t||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{t=t||!0}),setInterval(()=>{t&&(function(){var t=$(this).scrollTop();if(!(Math.abs(a-t)<=o)){if(t>a)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(t+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=t}}(),t=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const i=n.text().trim();let a=o.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let t=new IntersectionObserver(t=>{var e,o;r?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(i)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){var t="#main > div.row:first-child > div:first-child";if(!($(t+" img").length<=0)){var e=document.querySelectorAll(t+" img[data-src]");const o=lozad(e);o.observe(),$(t+` p > img[data-src],${t} img[data-src].preview-img`).each(function(){let t=$(this).next();var e="EM"===t.prop("tagName")?t.text():"",o=$(this).attr("data-src");$(this).wrap(`<a href="${o}" title="${e}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(t+" a").has("img").addClass("img-link")}}),$(function(){var t=".code-header>button";const e="timeout",r="data-title-succeed",l="data-original-title";function n(t){if($(t)[0].hasAttribute(e)){t=$(t).attr(e);if(Number(t)>Date.now())return 1}}function i(t){$(t).attr(e,Date.now()+2e3)}function c(t){$(t).removeAttr(e)}const o=new ClipboardJS(t,{target(t){let e=t.parentNode.nextElementSibling;return e.querySelector("code .rouge-code")}});$(t).tooltip({trigger:"hover",placement:"left"});const a=function(t){let e=$(t).children();return e.attr("class")}(t);o.on("success",t=>{t.clearSelection();const e=t.trigger;var o;n(e)||(function(t){let e=$(t),o=e.children();o.attr("class","fas fa-check")}(e),o=e,t=$(o).attr(r),$(o).attr(l,t).tooltip("show"),i(e),setTimeout(()=>{var t;t=e,$(t).tooltip("hide").removeAttr(l),function(t){let e=$(t),o=e.children();o.attr("class",a)}(e),c(e)},2e3))}),$("#copy-link").click(t=>{let e=$(t.target);if(!n(e)){t=window.location.href;const o=$("<input>");$("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove();const a=e.attr(l);t=e.attr(r);e.attr(l,t).tooltip("show"),i(e),setTimeout(()=>{e.attr(l,a),c(e)},2e3)}})}),$(function(){const t=$("#topbar-title"),c="scroll-focus";$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(r){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const i=decodeURI(this.hash);let e=RegExp(/^#fnref:/).test(i),o=!e&&RegExp(/^#fn:/).test(i);var l=i.includes(":")?i.replace(/\:/g,"\\:"):i;let a=$(l);var n=t.is(":visible"),l=$(window).width()<$(window).height();if(void 0!==a){r.preventDefault(),history.pushState&&history.pushState(null,null,i);r=$(window).scrollTop();let t=a.offset().top-=8;t<r&&(ScrollHelper.hideTopbar(),ScrollHelper.addScrollUpTask()),n&&l&&(t-=ScrollHelper.getTopbarHeight()),$("html").animate({scrollTop:t},500,()=>(a.focus(),$(`[${c}=true]`).length&&$(`[${c}=true]`).attr(c,!1),$(":target").length&&$(":target").attr(c,!1),(o||e)&&a.attr(c,!0),a.is(":focus")?!1:(a.attr("tabindex","-1"),a.focus(),void(ScrollHelper.hasScrollUpTask()&&ScrollHelper.popScrollUpTask()))))}}})});
|
data/assets/js/dist/post.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
$(function(){$(window).scroll(()=>{
|
6
|
+
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))});const LocaleHelper=function(){const t=$('meta[name="prefer-datetime-locale"]'),e=0<t.length?t.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>e,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:t=>Number(t.attr(o)),getDateFormat:t=>t.attr(a)}}();$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const t=$("body"),e="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>t.attr(e,!1),showTopbar:()=>t.attr(e,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),i=$("#search-results"),c=$("#search-input"),s=$("#search-hints"),d=function(){let t=0;return{block(){t=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(t)},getOffset(){return t}}}(),p={on(){t.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),t.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let t=!1;return{on(){t||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),s.hasClass("unloaded")&&s.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),c.val(""),t=!1)},isVisible(){return t}}}();function f(){return o.hasClass("loaded")}e.click(function(){p.on(),u.on(),c.focus()}),o.click(function(){p.off(),u.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("input",()=>{""===c.val()?f()?s.removeClass("unloaded"):u.off():(u.on(),f()&&s.addClass("unloaded"))})}),$(function(){var t=function(){const t="sidebar-display";let e=!1;const o=$("body");return{toggle(){!1===e?o.attr(t,""):o.removeAttr(t),e=!e}}}();$("#sidebar-trigger").click(t.toggle),$("#mask").click(t.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),o=ScrollHelper.getTopbarHeight();let t,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var t=screen.orientation.type;"landscape-primary"!==t&&"landscape-secondary"!==t||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{t=t||!0}),setInterval(()=>{t&&(function(){var t=$(this).scrollTop();if(!(Math.abs(a-t)<=o)){if(t>a)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(t+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=t}}(),t=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const i=n.text().trim();let a=o.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let t=new IntersectionObserver(t=>{var e,o;r?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(i)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){var t="#main > div.row:first-child > div:first-child";if(!($(t+" img").length<=0)){var e=document.querySelectorAll(t+" img[data-src]");const o=lozad(e);o.observe(),$(t+` p > img[data-src],${t} img[data-src].preview-img`).each(function(){let t=$(this).next();var e="EM"===t.prop("tagName")?t.text():"",o=$(this).attr("data-src");$(this).wrap(`<a href="${o}" title="${e}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(t+" a").has("img").addClass("img-link")}}),$(function(){const a=LocaleHelper.attrTimestamp(),t=$(".timeago");let o=t.length,e=void 0;function r(){return t.each(function(){if(void 0!==$(this).attr(a)){let t=function(t){const e=dayjs(),o=dayjs.unix(LocaleHelper.getTimestamp(t));return 10<e.diff(o,"month",!0)?(t.removeAttr(a),o.format("ll")):(44<e.diff(o,"minute",!0)&&t.removeAttr(a),o.fromNow())}($(this));var e=$(this).attr("data-capitalize");void 0!==e&&"true"===e&&(t=t.replace(/^\w/,t=>t.toUpperCase())),$(this).text()!==t&&$(this).text(t)}else--o}),0===o&&void 0!==e&&clearInterval(e),o}dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_relativeTime),dayjs.extend(window.dayjs_plugin_localizedFormat),0!==o&&(t.each(function(){var t,e=$(this).attr("data-toggle");void 0!==e&&"tooltip"===e&&(t=$(this).attr("data-tooltip-df"),e=LocaleHelper.getTimestamp($(this)),t=dayjs.unix(e).format(t),$(this).attr("data-original-title",t),$(this).removeAttr("data-tooltip-df"))}),r()&&(e=setInterval(r,6e4)))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){var t=".code-header>button";const e="timeout",r="data-title-succeed",l="data-original-title";function n(t){if($(t)[0].hasAttribute(e)){t=$(t).attr(e);if(Number(t)>Date.now())return 1}}function i(t){$(t).attr(e,Date.now()+2e3)}function c(t){$(t).removeAttr(e)}const o=new ClipboardJS(t,{target(t){let e=t.parentNode.nextElementSibling;return e.querySelector("code .rouge-code")}});$(t).tooltip({trigger:"hover",placement:"left"});const a=function(t){let e=$(t).children();return e.attr("class")}(t);o.on("success",t=>{t.clearSelection();const e=t.trigger;var o;n(e)||(function(t){let e=$(t),o=e.children();o.attr("class","fas fa-check")}(e),o=e,t=$(o).attr(r),$(o).attr(l,t).tooltip("show"),i(e),setTimeout(()=>{var t;t=e,$(t).tooltip("hide").removeAttr(l),function(t){let e=$(t),o=e.children();o.attr("class",a)}(e),c(e)},2e3))}),$("#copy-link").click(t=>{let e=$(t.target);if(!n(e)){t=window.location.href;const o=$("<input>");$("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove();const a=e.attr(l);t=e.attr(r);e.attr(l,t).tooltip("show"),i(e),setTimeout(()=>{e.attr(l,a),c(e)},2e3)}})}),$(function(){const t=$("#topbar-title"),c="scroll-focus";$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(r){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const i=decodeURI(this.hash);let e=RegExp(/^#fnref:/).test(i),o=!e&&RegExp(/^#fn:/).test(i);var l=i.includes(":")?i.replace(/\:/g,"\\:"):i;let a=$(l);var n=t.is(":visible"),l=$(window).width()<$(window).height();if(void 0!==a){r.preventDefault(),history.pushState&&history.pushState(null,null,i);r=$(window).scrollTop();let t=a.offset().top-=8;t<r&&(ScrollHelper.hideTopbar(),ScrollHelper.addScrollUpTask()),n&&l&&(t-=ScrollHelper.getTopbarHeight()),$("html").animate({scrollTop:t},500,()=>(a.focus(),$(`[${c}=true]`).length&&$(`[${c}=true]`).attr(c,!1),$(":target").length&&$(":target").attr(c,!1),(o||e)&&a.attr(c,!0),a.is(":focus")?!1:(a.attr("tabindex","-1"),a.focus(),void(ScrollHelper.hasScrollUpTask()&&ScrollHelper.popScrollUpTask()))))}}})});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy
|
2
|
+
* Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
3
3
|
* © 2019 Cotes Chung
|
4
4
|
* MIT Licensed
|
5
5
|
*/
|
6
|
-
const getInitStatus=function(){let
|
6
|
+
const getInitStatus=function(){let t=!1;return()=>{var e=t;return t=t||!0,e}}(),PvOpts=function(){function t(e){return $(e).attr("content")}function e(e){e=t(e);return void 0!==e&&!1!==e}return{getProxyMeta(){return t("meta[name=pv-proxy-endpoint]")},getLocalMeta(){return t("meta[name=pv-cache-path]")},hasProxyMeta(){return e("meta[name=pv-proxy-endpoint]")},hasLocalMeta(){return e("meta[name=pv-cache-path]")}}}(),PvStorage=function(){const a={KEY_PV:"pv",KEY_PV_SRC:"pv_src",KEY_CREATION:"pv_created_date"},t={LOCAL:"same-origin",PROXY:"cors"};function r(e){return localStorage.getItem(e)}function o(e,t){localStorage.setItem(e,t)}function n(e,t){o(a.KEY_PV,e),o(a.KEY_PV_SRC,t),o(a.KEY_CREATION,(new Date).toJSON())}return{keysCount(){return Object.keys(a).length},hasCache(){return null!==localStorage.getItem(a.KEY_PV)},getCache(){return JSON.parse(localStorage.getItem(a.KEY_PV))},saveLocalCache(e){n(e,t.LOCAL)},saveProxyCache(e){n(e,t.PROXY)},isExpired(){let e=new Date(r(a.KEY_CREATION));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()},isFromLocal(){return r(a.KEY_PV_SRC)===t.LOCAL},isFromProxy(){return r(a.KEY_PV_SRC)===t.PROXY},newerThan(e){return PvStorage.getCache().totalsForAllResults["ga:pageviews"]>e.totalsForAllResults["ga:pageviews"]},inspectKeys(){if(localStorage.length===PvStorage.keysCount())for(let e=0;e<localStorage.length;e++)switch(localStorage.key(e)){case a.KEY_PV:case a.KEY_PV_SRC:case a.KEY_CREATION:break;default:return void localStorage.clear()}else localStorage.clear()}}}();function countUp(t,a,r){if(t<a){let e=new CountUp(r,t,a);e.error?console.error(e.error):e.start()}}function countPV(t,a){let r=0;if(void 0!==a)for(let e=0;e<a.length;++e)if(a[parseInt(e,10)][0]===t){r+=parseInt(a[parseInt(e,10)][1],10);break}return r}function tacklePV(e,t,a,r){let o=countPV(t,e);o=0===o?1:o,r?(r=parseInt(a.text().replace(/,/g,""),10),o>r&&countUp(r,o,a.attr("id"))):a.text((new Intl.NumberFormat).format(o))}function displayPageviews(e){if(void 0!==e){let t=getInitStatus();const a=e.rows;0<$("#post-list").length?$(".post-preview").each(function(){var e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)}):0<$(".post").length&&(e=window.location.pathname,tacklePV(a,e,$("#pv"),t))}}function fetchProxyPageviews(){PvOpts.hasProxyMeta()&&$.ajax({type:"GET",url:PvOpts.getProxyMeta(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:e=>{PvStorage.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchLocalPageviews(t=!1){return fetch(PvOpts.getLocalMeta()).then(e=>e.json()).then(e=>{t&&PvStorage.isFromProxy()&&PvStorage.newerThan(e)||(displayPageviews(e),PvStorage.saveLocalCache(JSON.stringify(e)))})}$(function(){$(".pageviews").length<=0||(PvStorage.inspectKeys(),PvStorage.hasCache()?(displayPageviews(PvStorage.getCache()),PvStorage.isExpired()?PvOpts.hasLocalMeta()?fetchLocalPageviews(!0).then(fetchProxyPageviews):fetchProxyPageviews():PvStorage.isFromLocal()&&fetchProxyPageviews()):PvOpts.hasLocalMeta()?fetchLocalPageviews().then(fetchProxyPageviews):fetchProxyPageviews())});
|