jekyll-theme-chirpy 5.0.2 → 6.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +64 -74
  3. data/_data/locales/ar.yml +91 -0
  4. data/_data/locales/bg-BG.yml +81 -0
  5. data/_data/locales/cs-CZ.yml +89 -0
  6. data/_data/locales/de-DE.yml +80 -0
  7. data/_data/locales/el-GR.yml +91 -0
  8. data/_data/locales/en.yml +23 -23
  9. data/_data/locales/es-ES.yml +77 -0
  10. data/_data/locales/fi-FI.yml +90 -0
  11. data/_data/locales/fr-FR.yml +77 -0
  12. data/_data/locales/hu-HU.yml +79 -0
  13. data/_data/locales/id-ID.yml +5 -19
  14. data/_data/locales/it-IT.yml +90 -0
  15. data/_data/locales/ko-KR.yml +12 -19
  16. data/_data/locales/my-MM.yml +77 -0
  17. data/_data/locales/pt-BR.yml +77 -0
  18. data/_data/locales/ru-RU.yml +77 -0
  19. data/_data/locales/sl-SI.yml +91 -0
  20. data/_data/locales/sv-SE.yml +91 -0
  21. data/_data/locales/th.yml +91 -0
  22. data/_data/locales/tr-TR.yml +77 -0
  23. data/_data/locales/uk-UA.yml +77 -0
  24. data/_data/locales/vi-VN.yml +76 -0
  25. data/_data/locales/zh-CN.yml +13 -20
  26. data/_data/locales/zh-TW.yml +83 -0
  27. data/_data/origin/basic.yml +48 -0
  28. data/_data/origin/cors.yml +59 -0
  29. data/_includes/comments/disqus.html +27 -31
  30. data/_includes/comments/giscus.html +64 -0
  31. data/_includes/comments/utterances.html +2 -2
  32. data/_includes/datetime.html +20 -0
  33. data/_includes/embed/twitch.html +4 -0
  34. data/_includes/embed/youtube.html +6 -0
  35. data/_includes/footer.html +31 -32
  36. data/_includes/head.html +66 -46
  37. data/_includes/js-selector.html +83 -45
  38. data/_includes/jsdelivr-combine.html +26 -0
  39. data/_includes/lang.html +1 -1
  40. data/_includes/mermaid.html +30 -29
  41. data/_includes/metadata-hook.html +1 -0
  42. data/_includes/mode-toggle.html +66 -51
  43. data/_includes/notification.html +24 -0
  44. data/_includes/origin-type.html +13 -0
  45. data/_includes/post-nav.html +26 -22
  46. data/_includes/post-paginator.html +79 -76
  47. data/_includes/post-sharing.html +27 -16
  48. data/_includes/read-time.html +17 -10
  49. data/_includes/refactor-content.html +129 -73
  50. data/_includes/related-posts.html +48 -58
  51. data/_includes/search-loader.html +32 -31
  52. data/_includes/search-results.html +4 -5
  53. data/_includes/sidebar.html +79 -67
  54. data/_includes/toc.html +4 -7
  55. data/_includes/topbar.html +62 -56
  56. data/_includes/trending-tags.html +15 -19
  57. data/_includes/update-list.html +14 -15
  58. data/_layouts/archives.html +25 -29
  59. data/_layouts/categories.html +97 -58
  60. data/_layouts/category.html +8 -10
  61. data/_layouts/default.html +67 -31
  62. data/_layouts/home.html +67 -56
  63. data/_layouts/page.html +20 -58
  64. data/_layouts/post.html +85 -94
  65. data/_layouts/tag.html +8 -10
  66. data/_layouts/tags.html +6 -5
  67. data/_sass/addon/commons.scss +679 -878
  68. data/_sass/addon/module.scss +70 -23
  69. data/_sass/addon/syntax.scss +127 -110
  70. data/_sass/addon/variables.scss +16 -18
  71. data/_sass/colors/syntax-dark.scss +138 -0
  72. data/_sass/colors/syntax-light.scss +179 -0
  73. data/_sass/colors/{dark-typography.scss → typography-dark.scss} +58 -56
  74. data/_sass/colors/typography-light.scss +110 -0
  75. data/_sass/layout/archives.scss +86 -89
  76. data/_sass/layout/categories.scss +29 -13
  77. data/_sass/layout/category-tag.scss +9 -10
  78. data/_sass/layout/home.scss +132 -114
  79. data/_sass/layout/post.scss +213 -173
  80. data/_sass/layout/tags.scss +1 -1
  81. data/_sass/main.scss +13 -0
  82. data/assets/404.html +1 -20
  83. data/assets/css/jekyll-theme-chirpy.scss +6 -0
  84. data/assets/feed.xml +2 -2
  85. data/assets/js/data/search.json +8 -5
  86. data/assets/js/data/swcache.js +14 -29
  87. data/assets/js/dist/categories.min.js +2 -4
  88. data/assets/js/dist/commons.min.js +2 -4
  89. data/assets/js/dist/home.min.js +2 -4
  90. data/assets/js/dist/misc.min.js +4 -0
  91. data/assets/js/dist/page.min.js +2 -4
  92. data/assets/js/dist/post.min.js +2 -4
  93. data/assets/js/pwa/app.js +42 -4
  94. data/assets/js/pwa/sw.js +46 -44
  95. data/assets/js/pwa/unregister.js +12 -0
  96. metadata +64 -32
  97. data/_config.yml +0 -175
  98. data/_data/contact.yml +0 -30
  99. data/_data/share.yml +0 -27
  100. data/_includes/css-selector.html +0 -15
  101. data/_includes/no-zero-date.html +0 -13
  102. data/_includes/timeago.html +0 -26
  103. data/_plugins/posts-lastmod-hook.rb +0 -14
  104. data/_sass/colors/dark-syntax.scss +0 -87
  105. data/_sass/colors/light-syntax.scss +0 -79
  106. data/_sass/colors/light-typography.scss +0 -81
  107. data/_sass/jekyll-theme-chirpy.scss +0 -24
  108. data/_tabs/about.md +0 -8
  109. data/_tabs/archives.md +0 -7
  110. data/_tabs/categories.md +0 -6
  111. data/_tabs/tags.md +0 -6
  112. data/assets/css/style.scss +0 -12
  113. data/assets/js/dist/pvreport.min.js +0 -6
  114. data/index.html +0 -4
@@ -1,55 +1,44 @@
1
1
  ---
2
2
  layout: compress
3
-
4
3
  # The list to be cached by PWA
5
4
  ---
6
5
 
7
6
  const resource = [
8
-
9
7
  /* --- CSS --- */
10
- '{{ "/assets/css/style.css" | relative_url }}',
8
+ '{{ "/assets/css/:THEME.css" | replace: ':THEME', site.theme | relative_url }}',
11
9
 
12
- /* --- JavaScripts --- */
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',
10
+ /* --- PWA --- */
19
11
  '{{ "/app.js" | relative_url }}',
20
12
  '{{ "/sw.js" | relative_url }}',
21
13
 
22
14
  /* --- HTML --- */
23
15
  '{{ "/index.html" | relative_url }}',
24
16
  '{{ "/404.html" | relative_url }}',
17
+
25
18
  {% for tab in site.tabs %}
26
19
  '{{ tab.url | relative_url }}',
27
20
  {% endfor %}
28
21
 
29
- /* --- Favicons --- */
30
- {% assign favicon_path = "/assets/img/favicons" | relative_url %}
31
-
32
- '{{ favicon_path }}/android-chrome-192x192.png',
33
- '{{ favicon_path }}/android-chrome-512x512.png',
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'
41
-
22
+ /* --- Favicons & compressed JS --- */
23
+ {% assign cache_list = site.static_files | where: 'swcache', true %}
24
+ {% for file in cache_list %}
25
+ '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
26
+ {% endfor %}
42
27
  ];
43
28
 
44
29
  /* The request url with below domain will be cached */
45
30
  const allowedDomains = [
46
- {% if site.google_analytics.id != '' %}
31
+ {% if site.google_analytics.id != empty and site.google_analytics.id %}
47
32
  'www.googletagmanager.com',
48
33
  'www.google-analytics.com',
49
34
  {% endif %}
50
35
 
51
36
  '{{ site.url | split: "//" | last }}',
52
37
 
38
+ {% if site.img_cdn contains '//' and site.img_cdn %}
39
+ '{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
40
+ {% endif %}
41
+
53
42
  'fonts.gstatic.com',
54
43
  'fonts.googleapis.com',
55
44
  'cdn.jsdelivr.net',
@@ -57,8 +46,4 @@ const allowedDomains = [
57
46
  ];
58
47
 
59
48
  /* Requests that include the following path will be banned */
60
- const denyUrls = [
61
- {% if site.google_analytics.pv.cache_path %}
62
- '{{ site.google_analytics.pv.cache_path | absolute_url }}'
63
- {% endif %}
64
- ];
49
+ const denyUrls = [];
@@ -1,6 +1,4 @@
1
1
  /*!
2
- * Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
- * © 2019 Cotes Chung
4
- * MIT Licensed
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
5
3
  */
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))}),$(function(){$(".mode-toggle").click(e=>{const o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),d=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),r.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(u.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function h(){return t.hasClass("loaded")}o.click(function(){f.on(),p.on(),i.focus()}),t.click(function(){f.off(),p.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),s.hasClass("visible")||s.addClass("visible"),h()&&c.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),d.empty()):p.off(),i.focus(),s.removeClass("visible")})}),$(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 t=$("#topbar-wrapper"),o=$("#topbar-title"),s=$("#panel-wrapper"),a=$("#search-input"),l="topbar-up",r="topbar-down",n="toc-scrolling-up";let d,i=0;const c=t.outerHeight(),u=t.outerHeight();$(window).scroll(function(e){o.is(":hidden")&&(d=!0)}),setInterval(function(){d&&(function(){var e,o=$(this).scrollTop();Math.abs(i-o)<=c||(o>i?o>u&&(t.removeClass(r).addClass(l),s.removeClass(r),a.is(":focus")&&a.blur()):o+$(window).height()<$(document).height()&&(void 0!==(e=t.attr(n))?"false"===e&&t.removeAttr(n):(t.removeClass(l).addClass(r),s.addClass(r))),i=o)}(),d=!1)},250)}),$(function(){var o="div.post>h1:first-of-type";const t=$(o),r=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!r.is(":hidden")){const n=r.text().trim();let s=t.text().trim(),a=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim());let e=new IntersectionObserver(e=>{var o,t;a?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&r.text(s):1===e.intersectionRatio&&r.text(n)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),r.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"))})});
4
+ !function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,i(o.key),o)}}function r(e,r,o){return r&&t(e.prototype,r),o&&t(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var l=$(".mode-toggle");var s=$("body"),c="sidebar-display",u=function(){function t(){e(this,t)}return r(t,null,[{key:"toggle",value:function(){!1===t.isExpanded?s.attr(c,""):s.removeAttr(c),t.isExpanded=!t.isExpanded}}]),t}();o(u,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),p=$("#search-cancel"),b=$("#main-wrapper>.container>.row"),v=$("#topbar-title"),m=$("search"),g=$("#search-result-wrapper"),y=$("#search-results"),h=$("#search-input"),C=$("#search-hints"),w=$("html,body"),k="loaded",A="unloaded",S="input-focus",T="d-flex",j=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){t.offset=window.scrollY,w.scrollTop(0)}},{key:"off",value:function(){w.scrollTop(t.offset)}}]),t}();o(j,"offset",0),o(j,"resultVisible",!1);var E=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){f.addClass(A),v.addClass(A),d.addClass(A),m.addClass(T),p.addClass(k)}},{key:"off",value:function(){p.removeClass(k),m.removeClass(T),f.removeClass(A),v.removeClass(A),d.removeClass(A)}}]),t}(),O=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){j.resultVisible||(j.on(),g.removeClass(A),b.addClass(A),j.resultVisible=!0)}},{key:"off",value:function(){j.resultVisible&&(y.empty(),C.hasClass(A)&&C.removeClass(A),g.addClass(A),b.removeClass(A),j.off(),h.val(""),j.resultVisible=!1)}}]),t}();function x(){return p.hasClass(k)}var P=$(".collapse");var V,I;$(".code-header>button").children().attr("class"),V=$(window),I=$("#back-to-top"),V.on("scroll",(function(){V.scrollTop()>50?I.fadeIn():I.fadeOut()})),I.on("click",(function(){V.scrollTop(0)})),n(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(e){return new bootstrap.Tooltip(e)})),0!==l.length&&l.off().on("click",(function(e){var t=$(e.target),r=t.prop("tagName")==="button".toUpperCase()?t:t.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",u.toggle),$("#mask").on("click",u.toggle),d.on("click",(function(){E.on(),O.on(),h.trigger("focus")})),p.on("click",(function(){E.off(),O.off()})),h.on("focus",(function(){m.addClass(S)})),h.on("focusout",(function(){m.removeClass(S)})),h.on("input",(function(){""===h.val()?x()?C.removeClass(A):O.off():(O.on(),x()&&C.addClass(A))})),P.on("hide.bs.collapse",(function(){var e="h_"+$(this).attr("id").substring(2);e&&($("#".concat(e," .far.fa-folder-open")).attr("class","far fa-folder fa-fw"),$("#".concat(e," i.fas")).addClass("rotate"),$("#".concat(e)).removeClass("hide-border-bottom"))})),P.on("show.bs.collapse",(function(){var e="h_"+$(this).attr("id").substring(2);e&&($("#".concat(e," .far.fa-folder")).attr("class","far fa-folder-open fa-fw"),$("#".concat(e," i.fas")).removeClass("rotate"),$("#".concat(e)).addClass("hide-border-bottom"))}))}();
@@ -1,6 +1,4 @@
1
1
  /*!
2
- * Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
- * © 2019 Cotes Chung
4
- * MIT Licensed
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
5
3
  */
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))}),$(function(){$(".mode-toggle").click(e=>{const o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=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"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible(){return e}}}();function m(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?m()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),m()&&c.addClass("unloaded"))}),s.on("click",function(){d.val(""),m()?(c.removeClass("unloaded"),i.empty()):f.off(),d.focus(),s.removeClass("visible")})}),$(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 t=$("#topbar-wrapper"),o=$("#topbar-title"),s=$("#panel-wrapper"),a=$("#search-input"),l="topbar-up",n="topbar-down",r="toc-scrolling-up";let i,d=0;const c=t.outerHeight(),u=t.outerHeight();$(window).scroll(function(e){o.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var e,o=$(this).scrollTop();Math.abs(d-o)<=c||(o>d?o>u&&(t.removeClass(n).addClass(l),s.removeClass(n),a.is(":focus")&&a.blur()):o+$(window).height()<$(document).height()&&(void 0!==(e=t.attr(r))?"false"===e&&t.removeAttr(r):(t.removeClass(l).addClass(n),s.addClass(n))),d=o)}(),i=!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 r=n.text().trim();let s=t.text().trim(),a=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim());let e=new IntersectionObserver(e=>{var o,t;a?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&n.text(s):1===e.intersectionRatio&&n.text(r)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}});
4
+ !function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function r(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var l=$(".mode-toggle");var s=$("body"),u="sidebar-display",c=function(){function t(){e(this,t)}return r(t,null,[{key:"toggle",value:function(){!1===t.isExpanded?s.attr(u,""):s.removeAttr(u),t.isExpanded=!t.isExpanded}}]),t}();n(c,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),p=$("#search-cancel"),b=$("#main-wrapper>.container>.row"),m=$("#topbar-title"),v=$("search"),y=$("#search-result-wrapper"),g=$("#search-results"),h=$("#search-input"),C=$("#search-hints"),w=$("html,body"),k="loaded",A="unloaded",S="input-focus",T="d-flex",j=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){t.offset=window.scrollY,w.scrollTop(0)}},{key:"off",value:function(){w.scrollTop(t.offset)}}]),t}();n(j,"offset",0),n(j,"resultVisible",!1);var E,O,x=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){f.addClass(A),m.addClass(A),d.addClass(A),v.addClass(T),p.addClass(k)}},{key:"off",value:function(){p.removeClass(k),v.removeClass(T),f.removeClass(A),m.removeClass(A),d.removeClass(A)}}]),t}(),P=function(){function t(){e(this,t)}return r(t,null,[{key:"on",value:function(){j.resultVisible||(j.on(),y.removeClass(A),b.addClass(A),j.resultVisible=!0)}},{key:"off",value:function(){j.resultVisible&&(g.empty(),C.hasClass(A)&&C.removeClass(A),y.addClass(A),b.removeClass(A),j.off(),h.val(""),j.resultVisible=!1)}}]),t}();function V(){return p.hasClass(k)}E=$(window),O=$("#back-to-top"),E.on("scroll",(function(){E.scrollTop()>50?O.fadeIn():O.fadeOut()})),O.on("click",(function(){E.scrollTop(0)})),o(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(e){return new bootstrap.Tooltip(e)})),0!==l.length&&l.off().on("click",(function(e){var t=$(e.target),r=t.prop("tagName")==="button".toUpperCase()?t:t.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",c.toggle),$("#mask").on("click",c.toggle),d.on("click",(function(){x.on(),P.on(),h.trigger("focus")})),p.on("click",(function(){x.off(),P.off()})),h.on("focus",(function(){v.addClass(S)})),h.on("focusout",(function(){v.removeClass(S)})),h.on("input",(function(){""===h.val()?V()?C.removeClass(A):P.off():(P.on(),V()&&C.addClass(A))}))}();
@@ -1,6 +1,4 @@
1
1
  /*!
2
- * Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
- * © 2019 Cotes Chung
4
- * MIT Licensed
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
5
3
  */
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))}),$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})}),$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=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"),l.addClass("unloaded"),e.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),t.removeClass("unloaded"),l.removeClass("unloaded"),e.removeClass("unloaded")}},f=function(){let t=!1;return{on(){t||(u.block(),r.removeClass("unloaded"),s.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),d.val(""),t=!1)},isVisible(){return t}}}();function m(){return o.hasClass("loaded")}e.click(function(){p.on(),f.on(),d.focus()}),o.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(t){8===t.keyCode&&""===d.val()?m()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),m()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),m()?(c.removeClass("unloaded"),i.empty()):f.off(),d.focus(),a.removeClass("visible")})}),$(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 o=$("#topbar-wrapper"),e=$("#topbar-title"),a=$("#panel-wrapper"),s=$("#search-input"),l="topbar-up",n="topbar-down",r="toc-scrolling-up";let i,d=0;const c=o.outerHeight(),u=o.outerHeight();$(window).scroll(function(t){e.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var t,e=$(this).scrollTop();Math.abs(d-e)<=c||(e>d?e>u&&(o.removeClass(n).addClass(l),a.removeClass(n),s.is(":focus")&&s.blur()):e+$(window).height()<$(document).height()&&(void 0!==(t=o.attr(r))?"false"===t&&o.removeAttr(r):(o.removeClass(l).addClass(n),a.addClass(n))),d=e)}(),i=!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 r=n.text().trim();let a=o.text().trim(),s=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim());let t=new IntersectionObserver(t=>{var e,o;s?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(r)):s=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){let o=$(".timeago").length,t=void 0;const s=$("meta[name=day-prompt]").attr("content"),l=$("meta[name=hour-prompt]").attr("content"),n=$("meta[name=minute-prompt]").attr("content"),r=$("meta[name=justnow-prompt]").attr("content");function e(){return $(".timeago").each(function(){var t,e;!1!==$(this)[0].hasAttribute("date")?(e=function(t,e){let o=new Date,a=new Date(t);return a.getFullYear()!==o.getFullYear()||a.getMonth()!==o.getMonth()?e:(t=Math.floor((o-a)/1e3),1<=(e=Math.floor(t/86400))?` ${e} `+s:1<=(e=Math.floor(t/3600))?` ${e} `+l:1<=(t=Math.floor(t/60))?` ${t} `+n:r)}($(this).attr("date"),t=$(this).text()))===t?$(this).removeAttr("date"):$(this).text(e):--o}),0===o&&void 0!==t&&clearInterval(t),o}0!==o&&0<e()&&(t=setInterval(e,6e4))});
4
+ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var l=$(".mode-toggle");var s=$("body"),u="sidebar-display",c=function(){function e(){t(this,e)}return r(e,null,[{key:"toggle",value:function(){!1===e.isExpanded?s.attr(u,""):s.removeAttr(u),e.isExpanded=!e.isExpanded}}]),e}();n(c,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),m=$("#search-cancel"),p=$("#main-wrapper>.container>.row"),g=$("#topbar-title"),v=$("search"),y=$("#search-result-wrapper"),b=$("#search-results"),h=$("#search-input"),C=$("#search-hints"),k=$("html,body"),w="loaded",T="unloaded",j="input-focus",A="d-flex",S=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){e.offset=window.scrollY,k.scrollTop(0)}},{key:"off",value:function(){k.scrollTop(e.offset)}}]),e}();n(S,"offset",0),n(S,"resultVisible",!1);var x=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){f.addClass(T),g.addClass(T),d.addClass(T),v.addClass(A),m.addClass(w)}},{key:"off",value:function(){m.removeClass(w),v.removeClass(A),f.removeClass(T),g.removeClass(T),d.removeClass(T)}}]),e}(),E=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){S.resultVisible||(S.on(),y.removeClass(T),p.addClass(T),S.resultVisible=!0)}},{key:"off",value:function(){S.resultVisible&&(b.empty(),C.hasClass(T)&&C.removeClass(T),y.addClass(T),p.removeClass(T),S.off(),h.val(""),S.resultVisible=!1)}}]),e}();function F(){return m.hasClass(w)}$(".collapse");function O(t){t.parent().removeClass("shimmer")}$(".code-header>button").children().attr("class");var D,P,V,I=function(){function e(){t(this,e)}return r(e,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(t){return Number(t.attr(e.attrTimestamp))}},{key:"getDateFormat",value:function(t){return t.attr(e.attrDateFormat)}}]),e}();D=$(window),P=$("#back-to-top"),D.on("scroll",(function(){D.scrollTop()>50?P.fadeIn():P.fadeOut()})),P.on("click",(function(){D.scrollTop(0)})),o(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)})),0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),r=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",c.toggle),$("#mask").on("click",c.toggle),d.on("click",(function(){x.on(),E.on(),h.trigger("focus")})),m.on("click",(function(){x.off(),E.off()})),h.on("focus",(function(){v.addClass(j)})),h.on("focusout",(function(){v.removeClass(j)})),h.on("input",(function(){""===h.val()?F()?C.removeClass(T):E.off():(E.on(),F()&&C.addClass(T))})),dayjs.locale(I.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(I.attrTimestamp,"]")).each((function(){var t=dayjs.unix(I.getTimestamp($(this))),e=t.format(I.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(I.attrTimestamp),$(this).removeAttr(I.attrDateFormat);var r=$(this).attr("data-bs-toggle");if(void 0!==r&&"tooltip"===r){var n=t.format("llll");$(this).attr("data-bs-title",n),new bootstrap.Tooltip($(this))}})),(V=$("main img[data-src]")).length<=0||(document.addEventListener("lazyloaded",(function(t){O($(t.target))})),V.each((function(){$(this).hasClass("ls-is-cached")&&O($(this))})))}();
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
3
+ */
4
+ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var l=$(".mode-toggle");var s=$("body"),u="sidebar-display",c=function(){function e(){t(this,e)}return r(e,null,[{key:"toggle",value:function(){!1===e.isExpanded?s.attr(u,""):s.removeAttr(u),e.isExpanded=!e.isExpanded}}]),e}();n(c,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),m=$("#search-cancel"),p=$("#main-wrapper>.container>.row"),v=$("#topbar-title"),g=$("search"),y=$("#search-result-wrapper"),b=$("#search-results"),h=$("#search-input"),C=$("#search-hints"),k=$("html,body"),w="loaded",T="unloaded",j="input-focus",A="d-flex",S=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){e.offset=window.scrollY,k.scrollTop(0)}},{key:"off",value:function(){k.scrollTop(e.offset)}}]),e}();n(S,"offset",0),n(S,"resultVisible",!1);var x=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){f.addClass(T),v.addClass(T),d.addClass(T),g.addClass(A),m.addClass(w)}},{key:"off",value:function(){m.removeClass(w),g.removeClass(A),f.removeClass(T),v.removeClass(T),d.removeClass(T)}}]),e}(),E=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){S.resultVisible||(S.on(),y.removeClass(T),p.addClass(T),S.resultVisible=!0)}},{key:"off",value:function(){S.resultVisible&&(b.empty(),C.hasClass(T)&&C.removeClass(T),y.addClass(T),p.removeClass(T),S.off(),h.val(""),S.resultVisible=!1)}}]),e}();function F(){return m.hasClass(w)}$(".collapse");$(".code-header>button").children().attr("class");var O,D,P=function(){function e(){t(this,e)}return r(e,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(t){return Number(t.attr(e.attrTimestamp))}},{key:"getDateFormat",value:function(t){return t.attr(e.attrDateFormat)}}]),e}();O=$(window),D=$("#back-to-top"),O.on("scroll",(function(){O.scrollTop()>50?D.fadeIn():D.fadeOut()})),D.on("click",(function(){O.scrollTop(0)})),o(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)})),0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),r=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",c.toggle),$("#mask").on("click",c.toggle),d.on("click",(function(){x.on(),E.on(),h.trigger("focus")})),m.on("click",(function(){x.off(),E.off()})),h.on("focus",(function(){g.addClass(j)})),h.on("focusout",(function(){g.removeClass(j)})),h.on("input",(function(){""===h.val()?F()?C.removeClass(T):E.off():(E.on(),F()&&C.addClass(T))})),dayjs.locale(P.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(P.attrTimestamp,"]")).each((function(){var t=dayjs.unix(P.getTimestamp($(this))),e=t.format(P.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(P.attrTimestamp),$(this).removeAttr(P.attrDateFormat);var r=$(this).attr("data-bs-toggle");if(void 0!==r&&"tooltip"===r){var n=t.format("llll");$(this).attr("data-bs-title",n),new bootstrap.Tooltip($(this))}}))}();
@@ -1,6 +1,4 @@
1
1
  /*!
2
- * Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
- * © 2019 Cotes Chung
4
- * MIT Licensed
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
5
3
  */
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))}),$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})}),$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),i=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=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"),l.addClass("unloaded"),e.addClass("unloaded"),r.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),r.removeClass("d-flex"),t.removeClass("unloaded"),l.removeClass("unloaded"),e.removeClass("unloaded")}},f=function(){let t=!1;return{on(){t||(u.block(),n.removeClass("unloaded"),s.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),c.val(""),t=!1)},isVisible(){return t}}}();function h(){return o.hasClass("loaded")}e.click(function(){p.on(),f.on(),c.focus()}),o.click(function(){p.off(),f.off()}),c.focus(function(){r.addClass("input-focus")}),c.focusout(function(){r.removeClass("input-focus")}),c.on("keyup",function(t){8===t.keyCode&&""===c.val()?h()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),h()?(d.removeClass("unloaded"),i.empty()):f.off(),c.focus(),a.removeClass("visible")})}),$(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 o=$("#topbar-wrapper"),e=$("#topbar-title"),a=$("#panel-wrapper"),s=$("#search-input"),l="topbar-up",r="topbar-down",n="toc-scrolling-up";let i,c=0;const d=o.outerHeight(),u=o.outerHeight();$(window).scroll(function(t){e.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var t,e=$(this).scrollTop();Math.abs(c-e)<=d||(e>c?e>u&&(o.removeClass(r).addClass(l),a.removeClass(r),s.is(":focus")&&s.blur()):e+$(window).height()<$(document).height()&&(void 0!==(t=o.attr(n))?"false"===t&&o.removeAttr(n):(o.removeClass(l).addClass(r),a.addClass(r))),c=e)}(),i=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),r=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!r.is(":hidden")){const n=r.text().trim();let a=o.text().trim(),s=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim());let t=new IntersectionObserver(t=>{var e,o;s?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&r.text(a):1===t.intersectionRatio&&r.text(n)):s=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),r.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";function s(t){if($(t)[0].hasAttribute(e)){t=$(t).attr(e);if(Number(t)>Date.now())return 1}}function l(t){$(t).attr(e,Date.now()+2e3)}function r(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;s(e)||(function(t){let e=$(t),o=e.children();o.attr("class","fas fa-check")}(e),o=e,t=$(o).attr("title-succeed"),$(o).attr("data-original-title",t).tooltip("show"),l(e),setTimeout(()=>{var t;t=e,$(t).tooltip("hide").removeAttr("data-original-title"),function(t){let e=$(t),o=e.children();o.attr("class",a)}(e),r(e)},2e3))}),$("#copy-link").click(t=>{let e=$(t.target);if(!s(e)){t=window.location.href;const o=$("<input>");$("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove();const a=e.attr("data-original-title");t=e.attr("title-succeed");e.attr("data-original-title",t).tooltip("show"),l(e),setTimeout(()=>{e.attr("data-original-title",a),r(e)},2e3)}})}),$(function(){const i=$("#topbar-wrapper"),c=i.outerHeight(),t=$("#topbar-title"),d="toc-scrolling-up",u="scroll-focus";let p=0;$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(s){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const n=decodeURI(this.hash);let e=RegExp(/^#fnref:/).test(n),o=!e&&RegExp(/^#fn:/).test(n);var l=n.includes(":")?n.replace(/\:/g,"\\:"):n;let a=$(l);var r=$(this).parent().prop("tagName"),l=RegExp(/^H\d/).test(r),r=!t.is(":hidden");if(void 0!==a){s.preventDefault(),history.pushState&&history.pushState(null,null,n);s=l?$(this).offset().top:$(window).scrollTop();let t=a.offset().top-=8;t<s?(l||o||r||(i.removeClass("topbar-down").addClass("topbar-up"),i.attr(d,!0),p+=1),(l||e)&&r&&(t-=c)):r&&(t-=c),$("html").animate({scrollTop:t},500,()=>(a.focus(),$(`[${u}=true]`).length&&$(`[${u}=true]`).attr(u,!1),$(":target").length&&$(":target").attr(u,!1),(o||e)&&a.attr(u,!0),a.is(":focus")?!1:(a.attr("tabindex","-1"),a.focus(),void(void 0!==i.attr(d)&&(--p,p<=0&&i.attr(d,"false"))))))}}})});
4
+ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,i(o.key),o)}}function n(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e,n){return(e=i(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var l=$(".mode-toggle");var u=$("body"),s="sidebar-display",c=function(){function e(){t(this,e)}return n(e,null,[{key:"toggle",value:function(){!1===e.isExpanded?u.attr(s,""):u.removeAttr(s),e.isExpanded=!e.isExpanded}}]),e}();o(c,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),p=$("#search-cancel"),m=$("#main-wrapper>.container>.row"),v=$("#topbar-title"),g=$("search"),b=$("#search-result-wrapper"),h=$("#search-results"),y=$("#search-input"),C=$("#search-hints"),w=$("html,body"),k="loaded",S="unloaded",A="input-focus",T="d-flex",E=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){e.offset=window.scrollY,w.scrollTop(0)}},{key:"off",value:function(){w.scrollTop(e.offset)}}]),e}();o(E,"offset",0),o(E,"resultVisible",!1);var j=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){f.addClass(S),v.addClass(S),d.addClass(S),g.addClass(T),p.addClass(k)}},{key:"off",value:function(){p.removeClass(k),g.removeClass(T),f.removeClass(S),v.removeClass(S),d.removeClass(S)}}]),e}(),x=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){E.resultVisible||(E.on(),b.removeClass(S),m.addClass(S),E.resultVisible=!0)}},{key:"off",value:function(){E.resultVisible&&(h.empty(),C.hasClass(S)&&C.removeClass(S),b.addClass(S),m.removeClass(S),E.off(),y.val(""),E.resultVisible=!1)}}]),e}();function O(){return p.hasClass(k)}$(".collapse");var P=".code-header>button",V="fas fa-check",I="timeout",N="data-title-succeed",q="data-bs-original-title",z=2e3;function D(t){if($(t)[0].hasAttribute(I)){var e=$(t).attr(I);if(Number(e)>Date.now())return!0}return!1}function M(t){$(t).attr(I,Date.now()+z)}function U(t){$(t).removeAttr(I)}var B,J,L,Y=$(P).children().attr("class");function F(t){t.parent().removeClass("shimmer")}B=$(window),J=$("#back-to-top"),B.on("scroll",(function(){B.scrollTop()>50?J.fadeIn():J.fadeOut()})),J.on("click",(function(){B.scrollTop(0)})),r(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)})),0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),n=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),n.trigger("blur")})),$("#sidebar-trigger").on("click",c.toggle),$("#mask").on("click",c.toggle),d.on("click",(function(){j.on(),x.on(),y.trigger("focus")})),p.on("click",(function(){j.off(),x.off()})),y.on("focus",(function(){g.addClass(A)})),y.on("focusout",(function(){g.removeClass(A)})),y.on("input",(function(){""===y.val()?O()?C.removeClass(S):x.off():(x.on(),O()&&C.addClass(S))})),(L=$("main img[data-src]")).length<=0||(document.addEventListener("lazyloaded",(function(t){F($(t.target))})),L.each((function(){$(this).hasClass("ls-is-cached")&&F($(this))}))),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),function(){if($(P).length){var t=new ClipboardJS(P,{target:function(t){return t.parentNode.nextElementSibling.querySelector("code .rouge-code")}});r(document.querySelectorAll(P)).map((function(t){return new bootstrap.Tooltip(t,{placement:"left"})})),t.on("success",(function(t){t.clearSelection();var e=t.trigger;D(e)||(!function(t){$(t).children().attr("class",V)}(e),function(t){var e=$(t).attr(N);$(t).attr(q,e).tooltip("show")}(e),M(e),setTimeout((function(){!function(t){$(t).tooltip("hide").removeAttr(q)}(e),function(t){$(t).children().attr("class",Y)}(e),U(e)}),z))}))}var e=$("#copy-link");e.on("click",(function(t){var e=$(t.target);D(e)||navigator.clipboard.writeText(window.location.href).then((function(){var t=e.attr(q),n=e.attr(N);e.attr(q,n).tooltip("show"),M(e),setTimeout((function(){e.attr(q,t),U(e)}),z)}))})),e.on("mouseleave",(function(t){$(t.target).tooltip("hide"),console.log("mouse leave...")}))}()}();
@@ -1,6 +1,4 @@
1
1
  /*!
2
- * Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
- * © 2019 Cotes Chung
4
- * MIT Licensed
2
+ * Chirpy v6.2.2 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
5
3
  */
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))}),$(function(){$(".mode-toggle").click(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})}),$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),n=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),s=$("#search-result-wrapper"),i=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=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")}},f=function(){let t=!1;return{on(){t||(u.block(),s.removeClass("unloaded"),n.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),s.addClass("unloaded"),a.removeClass("visible"),n.removeClass("unloaded"),u.release(),c.val(""),t=!1)},isVisible(){return t}}}();function h(){return o.hasClass("loaded")}e.click(function(){p.on(),f.on(),c.focus()}),o.click(function(){p.off(),f.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("keyup",function(t){8===t.keyCode&&""===c.val()?h()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),h()?(d.removeClass("unloaded"),i.empty()):f.off(),c.focus(),a.removeClass("visible")})}),$(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 o=$("#topbar-wrapper"),e=$("#topbar-title"),a=$("#panel-wrapper"),n=$("#search-input"),r="topbar-up",l="topbar-down",s="toc-scrolling-up";let i,c=0;const d=o.outerHeight(),u=o.outerHeight();$(window).scroll(function(t){e.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var t,e=$(this).scrollTop();Math.abs(c-e)<=d||(e>c?e>u&&(o.removeClass(l).addClass(r),a.removeClass(l),n.is(":focus")&&n.blur()):e+$(window).height()<$(document).height()&&(void 0!==(t=o.attr(s))?"false"===t&&o.removeAttr(s):(o.removeClass(r).addClass(l),a.addClass(l))),c=e)}(),i=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),l=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!l.is(":hidden")){const s=l.text().trim();let a=o.text().trim(),n=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim());let t=new IntersectionObserver(t=>{var e,o;n?(e=$(window).scrollTop(),o=r<e,r=e,t=t[0],o?0===t.intersectionRatio&&l.text(a):1===t.intersectionRatio&&l.text(s)):n=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),l.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(){let o=$(".timeago").length,t=void 0;const n=$("meta[name=day-prompt]").attr("content"),r=$("meta[name=hour-prompt]").attr("content"),l=$("meta[name=minute-prompt]").attr("content"),s=$("meta[name=justnow-prompt]").attr("content");function e(){return $(".timeago").each(function(){var t,e;!1!==$(this)[0].hasAttribute("date")?(e=function(t,e){let o=new Date,a=new Date(t);return a.getFullYear()!==o.getFullYear()||a.getMonth()!==o.getMonth()?e:(t=Math.floor((o-a)/1e3),1<=(e=Math.floor(t/86400))?` ${e} `+n:1<=(e=Math.floor(t/3600))?` ${e} `+r:1<=(t=Math.floor(t/60))?` ${t} `+l:s)}($(this).attr("date"),t=$(this).text()))===t?$(this).removeAttr("date"):$(this).text(e):--o}),0===o&&void 0!==t&&clearInterval(t),o}0!==o&&0<e()&&(t=setInterval(e,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";function n(t){if($(t)[0].hasAttribute(e)){t=$(t).attr(e);if(Number(t)>Date.now())return 1}}function r(t){$(t).attr(e,Date.now()+2e3)}function l(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("title-succeed"),$(o).attr("data-original-title",t).tooltip("show"),r(e),setTimeout(()=>{var t;t=e,$(t).tooltip("hide").removeAttr("data-original-title"),function(t){let e=$(t),o=e.children();o.attr("class",a)}(e),l(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("data-original-title");t=e.attr("title-succeed");e.attr("data-original-title",t).tooltip("show"),r(e),setTimeout(()=>{e.attr("data-original-title",a),l(e)},2e3)}})}),$(function(){const i=$("#topbar-wrapper"),c=i.outerHeight(),t=$("#topbar-title"),d="toc-scrolling-up",u="scroll-focus";let p=0;$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(n){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const s=decodeURI(this.hash);let e=RegExp(/^#fnref:/).test(s),o=!e&&RegExp(/^#fn:/).test(s);var r=s.includes(":")?s.replace(/\:/g,"\\:"):s;let a=$(r);var l=$(this).parent().prop("tagName"),r=RegExp(/^H\d/).test(l),l=!t.is(":hidden");if(void 0!==a){n.preventDefault(),history.pushState&&history.pushState(null,null,s);n=r?$(this).offset().top:$(window).scrollTop();let t=a.offset().top-=8;t<n?(r||o||l||(i.removeClass("topbar-down").addClass("topbar-up"),i.attr(d,!0),p+=1),(r||e)&&l&&(t-=c)):l&&(t-=c),$("html").animate({scrollTop:t},500,()=>(a.focus(),$(`[${u}=true]`).length&&$(`[${u}=true]`).attr(u,!1),$(":target").length&&$(":target").attr(u,!1),(o||e)&&a.attr(u,!0),a.is(":focus")?!1:(a.attr("tabindex","-1"),a.focus(),void(void 0!==i.attr(d)&&(--p,p<=0&&i.attr(d,"false"))))))}}})});
4
+ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,i(o.key),o)}}function n(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e,n){return(e=i(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var l=$(".mode-toggle");var s=$("body"),c="sidebar-display",u=function(){function e(){t(this,e)}return n(e,null,[{key:"toggle",value:function(){!1===e.isExpanded?s.attr(c,""):s.removeAttr(c),e.isExpanded=!e.isExpanded}}]),e}();o(u,"isExpanded",!1);var f=$("#sidebar-trigger"),d=$("#search-trigger"),m=$("#search-cancel"),p=$("#main-wrapper>.container>.row"),g=$("#topbar-title"),v=$("search"),h=$("#search-result-wrapper"),b=$("#search-results"),y=$("#search-input"),w=$("#search-hints"),C=$("html,body"),k="loaded",S="unloaded",T="input-focus",A="d-flex",j=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){e.offset=window.scrollY,C.scrollTop(0)}},{key:"off",value:function(){C.scrollTop(e.offset)}}]),e}();o(j,"offset",0),o(j,"resultVisible",!1);var x=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){f.addClass(S),g.addClass(S),d.addClass(S),v.addClass(A),m.addClass(k)}},{key:"off",value:function(){m.removeClass(k),v.removeClass(A),f.removeClass(S),g.removeClass(S),d.removeClass(S)}}]),e}(),E=function(){function e(){t(this,e)}return n(e,null,[{key:"on",value:function(){j.resultVisible||(j.on(),h.removeClass(S),p.addClass(S),j.resultVisible=!0)}},{key:"off",value:function(){j.resultVisible&&(b.empty(),w.hasClass(S)&&w.removeClass(S),h.addClass(S),p.removeClass(S),j.off(),y.val(""),j.resultVisible=!1)}}]),e}();function D(){return m.hasClass(k)}$(".collapse");var O=".code-header>button",F="fas fa-check",P="timeout",N="data-title-succeed",V="data-bs-original-title",q=2e3;function I(t){if($(t)[0].hasAttribute(P)){var e=$(t).attr(P);if(Number(e)>Date.now())return!0}return!1}function z(t){$(t).attr(P,Date.now()+q)}function L(t){$(t).removeAttr(P)}var M=$(O).children().attr("class");function U(t){t.parent().removeClass("shimmer")}var _,B,J,Y=function(){function e(){t(this,e)}return n(e,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(t){return Number(t.attr(e.attrTimestamp))}},{key:"getDateFormat",value:function(t){return t.attr(e.attrDateFormat)}}]),e}();_=$(window),B=$("#back-to-top"),_.on("scroll",(function(){_.scrollTop()>50?B.fadeIn():B.fadeOut()})),B.on("click",(function(){_.scrollTop(0)})),r(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)})),0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),n=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),n.trigger("blur")})),$("#sidebar-trigger").on("click",u.toggle),$("#mask").on("click",u.toggle),d.on("click",(function(){x.on(),E.on(),y.trigger("focus")})),m.on("click",(function(){x.off(),E.off()})),y.on("focus",(function(){v.addClass(T)})),y.on("focusout",(function(){v.removeClass(T)})),y.on("input",(function(){""===y.val()?D()?w.removeClass(S):E.off():(E.on(),D()&&w.addClass(S))})),(J=$("main img[data-src]")).length<=0||(document.addEventListener("lazyloaded",(function(t){U($(t.target))})),J.each((function(){$(this).hasClass("ls-is-cached")&&U($(this))}))),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),dayjs.locale(Y.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(Y.attrTimestamp,"]")).each((function(){var t=dayjs.unix(Y.getTimestamp($(this))),e=t.format(Y.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(Y.attrTimestamp),$(this).removeAttr(Y.attrDateFormat);var n=$(this).attr("data-bs-toggle");if(void 0!==n&&"tooltip"===n){var o=t.format("llll");$(this).attr("data-bs-title",o),new bootstrap.Tooltip($(this))}})),function(){if($(O).length){var t=new ClipboardJS(O,{target:function(t){return t.parentNode.nextElementSibling.querySelector("code .rouge-code")}});r(document.querySelectorAll(O)).map((function(t){return new bootstrap.Tooltip(t,{placement:"left"})})),t.on("success",(function(t){t.clearSelection();var e=t.trigger;I(e)||(!function(t){$(t).children().attr("class",F)}(e),function(t){var e=$(t).attr(N);$(t).attr(V,e).tooltip("show")}(e),z(e),setTimeout((function(){!function(t){$(t).tooltip("hide").removeAttr(V)}(e),function(t){$(t).children().attr("class",M)}(e),L(e)}),q))}))}var e=$("#copy-link");e.on("click",(function(t){var e=$(t.target);I(e)||navigator.clipboard.writeText(window.location.href).then((function(){var t=e.attr(V),n=e.attr(N);e.attr(V,n).tooltip("show"),z(e),setTimeout((function(){e.attr(V,t),L(e)}),q)}))})),e.on("mouseleave",(function(t){$(t.target).tooltip("hide"),console.log("mouse leave...")}))}(),document.querySelector("main h2")&&tocbot.init({tocSelector:"#toc",contentSelector:".content",ignoreSelector:"[data-toc-skip]",headingSelector:"h2, h3, h4",orderedList:!1,scrollSmooth:!1})}();
data/assets/js/pwa/app.js CHANGED
@@ -3,7 +3,45 @@ layout: compress
3
3
  permalink: '/app.js'
4
4
  ---
5
5
 
6
- /* Registering Service Worker */
7
- if('serviceWorker' in navigator) {
8
- navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}');
9
- };
6
+ const $notification = $('#notification');
7
+ const $btnRefresh = $('#notification .toast-body>button');
8
+
9
+ if ('serviceWorker' in navigator) {
10
+ /* Registering Service Worker */
11
+ navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
12
+ .then(registration => {
13
+
14
+ /* in case the user ignores the notification */
15
+ if (registration.waiting) {
16
+ $notification.toast('show');
17
+ }
18
+
19
+ registration.addEventListener('updatefound', () => {
20
+ registration.installing.addEventListener('statechange', () => {
21
+ if (registration.waiting) {
22
+ if (navigator.serviceWorker.controller) {
23
+ $notification.toast('show');
24
+ }
25
+ }
26
+ });
27
+ });
28
+
29
+ $btnRefresh.click(() => {
30
+ if (registration.waiting) {
31
+ registration.waiting.postMessage('SKIP_WAITING');
32
+ }
33
+ $notification.toast('hide');
34
+ });
35
+ });
36
+
37
+ let refreshing = false;
38
+
39
+ /* Detect controller change and refresh all the opened tabs */
40
+ navigator.serviceWorker.addEventListener('controllerchange', () => {
41
+ if (!refreshing) {
42
+ window.location.reload();
43
+ refreshing = true;
44
+ }
45
+ });
46
+ }
47
+
data/assets/js/pwa/sw.js CHANGED
@@ -6,7 +6,7 @@ permalink: '/sw.js'
6
6
 
7
7
  self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
8
8
 
9
- const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
9
+ const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}';
10
10
 
11
11
  function verifyDomain(url) {
12
12
  for (const domain of allowedDomains) {
@@ -28,60 +28,62 @@ function isExcluded(url) {
28
28
  return false;
29
29
  }
30
30
 
31
- self.addEventListener('install', e => {
32
- self.skipWaiting();
33
- e.waitUntil(
34
- caches.open(cacheName).then(cache => {
31
+ self.addEventListener('install', (event) => {
32
+ event.waitUntil(
33
+ caches.open(cacheName).then((cache) => {
35
34
  return cache.addAll(resource);
36
35
  })
37
36
  );
38
37
  });
39
38
 
40
- self.addEventListener('fetch', event => {
41
- event.respondWith(
42
- caches.match(event.request)
43
- .then(response => {
44
- if (response) {
45
- return response;
46
- }
39
+ self.addEventListener('activate', (event) => {
40
+ event.waitUntil(
41
+ caches.keys().then((keyList) => {
42
+ return Promise.all(
43
+ keyList.map((key) => {
44
+ if (key !== cacheName) {
45
+ return caches.delete(key);
46
+ }
47
+ })
48
+ );
49
+ })
50
+ );
51
+ });
47
52
 
48
- return fetch(event.request)
49
- .then(response => {
50
- const url = event.request.url;
53
+ self.addEventListener('message', (event) => {
54
+ if (event.data === 'SKIP_WAITING') {
55
+ self.skipWaiting();
56
+ }
57
+ });
58
+
59
+ self.addEventListener('fetch', (event) => {
60
+ event.respondWith(
61
+ caches.match(event.request).then((response) => {
62
+ if (response) {
63
+ return response;
64
+ }
51
65
 
52
- if (event.request.method !== 'GET' ||
53
- !verifyDomain(url) ||
54
- isExcluded(url)) {
55
- return response;
56
- }
66
+ return fetch(event.request).then((response) => {
67
+ const url = event.request.url;
57
68
 
58
- /*
59
- see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
60
- */
61
- let responseToCache = response.clone();
69
+ if (
70
+ event.request.method !== 'GET' ||
71
+ !verifyDomain(url) ||
72
+ isExcluded(url)
73
+ ) {
74
+ return response;
75
+ }
62
76
 
63
- caches.open(cacheName)
64
- .then(cache => {
65
- /* console.log('[sw] Caching new resource: ' + event.request.url); */
66
- cache.put(event.request, responseToCache);
67
- });
77
+ /* see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests> */
78
+ let responseToCache = response.clone();
68
79
 
69
- return response;
70
- });
71
- })
72
- );
73
- });
80
+ caches.open(cacheName).then((cache) => {
81
+ /* console.log('[sw] Caching new resource: ' + event.request.url); */
82
+ cache.put(event.request, responseToCache);
83
+ });
74
84
 
75
- self.addEventListener('activate', e => {
76
- e.waitUntil(
77
- caches.keys().then(keyList => {
78
- return Promise.all(
79
- keyList.map(key => {
80
- if(key !== cacheName) {
81
- return caches.delete(key);
82
- }
83
- })
84
- );
85
+ return response;
86
+ });
85
87
  })
86
88
  );
87
89
  });
@@ -0,0 +1,12 @@
1
+ ---
2
+ layout: compress
3
+ permalink: '/unregister.js'
4
+ ---
5
+
6
+ if ('serviceWorker' in navigator) {
7
+ navigator.serviceWorker.getRegistrations().then((registrations) => {
8
+ for (let reg of registrations) {
9
+ reg.unregister();
10
+ }
11
+ });
12
+ }