jekyll-theme-chirpy 5.3.0 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/_data/assets/cross_origin.yml +2 -2
  4. data/_data/assets/self_host.yml +1 -1
  5. data/_data/locales/en.yml +10 -0
  6. data/_data/locales/hu-HU.yml +2 -2
  7. data/_data/locales/ko-KR.yml +7 -0
  8. data/_data/locales/pt-BR.yml +1 -1
  9. data/_data/locales/zh-CN.yml +8 -1
  10. data/_includes/comments/giscus.html +1 -1
  11. data/_includes/datetime.html +2 -8
  12. data/_includes/footer.html +26 -26
  13. data/_includes/head.html +0 -5
  14. data/_includes/js-selector.html +1 -5
  15. data/_includes/post-nav.html +4 -4
  16. data/_includes/post-sharing.html +3 -3
  17. data/_includes/read-time.html +3 -3
  18. data/_includes/refactor-content.html +9 -5
  19. data/_includes/related-posts.html +1 -1
  20. data/_includes/search-loader.html +1 -1
  21. data/_includes/sidebar.html +3 -3
  22. data/_includes/toc.html +1 -1
  23. data/_includes/topbar.html +9 -9
  24. data/_includes/trending-tags.html +1 -1
  25. data/_includes/update-list.html +1 -1
  26. data/_layouts/archives.html +2 -9
  27. data/_layouts/categories.html +12 -14
  28. data/_layouts/category.html +0 -2
  29. data/_layouts/default.html +6 -9
  30. data/_layouts/home.html +1 -3
  31. data/_layouts/page.html +4 -6
  32. data/_layouts/post.html +8 -10
  33. data/_layouts/tag.html +0 -2
  34. data/_sass/addon/commons.scss +131 -136
  35. data/_sass/addon/module.scss +5 -2
  36. data/_sass/addon/syntax.scss +14 -20
  37. data/_sass/addon/variables.scss +0 -4
  38. data/_sass/colors/dark-syntax.scss +17 -18
  39. data/_sass/colors/dark-typography.scss +22 -22
  40. data/_sass/colors/light-syntax.scss +2 -3
  41. data/_sass/colors/light-typography.scss +13 -14
  42. data/_sass/jekyll-theme-chirpy.scss +1 -1
  43. data/_sass/layout/archives.scss +4 -12
  44. data/_sass/layout/categories.scss +12 -13
  45. data/_sass/layout/category-tag.scss +4 -4
  46. data/_sass/layout/home.scss +19 -25
  47. data/_sass/layout/post.scss +132 -136
  48. data/_sass/layout/tags.scss +1 -1
  49. data/assets/404.html +1 -3
  50. data/assets/js/data/search.json +1 -1
  51. data/assets/js/data/swcache.js +35 -36
  52. data/assets/js/dist/categories.min.js +2 -2
  53. data/assets/js/dist/commons.min.js +2 -2
  54. data/assets/js/dist/home.min.js +2 -2
  55. data/assets/js/dist/misc.min.js +2 -2
  56. data/assets/js/dist/page.min.js +2 -2
  57. data/assets/js/dist/post.min.js +2 -2
  58. data/assets/js/dist/pvreport.min.js +2 -2
  59. data/assets/js/pwa/app.js +33 -33
  60. data/assets/js/pwa/sw.js +54 -53
  61. data/assets/js/pwa/unregister.js +5 -5
  62. metadata +2 -10
  63. data/_config.yml +0 -201
  64. data/_includes/lang.html +0 -8
  65. data/_plugins/posts-lastmod-hook.rb +0 -14
  66. data/_tabs/about.md +0 -8
  67. data/_tabs/archives.md +0 -6
  68. data/_tabs/categories.md +0 -5
  69. data/_tabs/tags.md +0 -5
  70. data/index.html +0 -4
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
2
+ * Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
3
  * © 2019 Cotes Chung
4
4
  * MIT Licensed
5
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))}),$(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}}(),LocaleHelper=($(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?(o=$(window).scrollTop(),e=l<o,l=o,o=t[0],e?0===o.intersectionRatio&&n.text(a):1===o.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 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(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){const t=dayjs.unix(LocaleHelper.getTimestamp($(this)));var e=t.format(LocaleHelper.getDateFormat($(this))),e=($(this).text(e),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==e&&"tooltip"===e&&(e=t.format("llll"),$(this).attr("data-original-title",e))})}),$(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 s=function(t){let e=$(t).children();return e.attr("class")}(t);o.on("success",o=>{o.clearSelection();const a=o.trigger;if(!n(a)){{o=a;let t=$(o),e=t.children();e.attr("class","fas fa-check")}var t;o=a,t=$(o).attr(r),$(o).attr(l,t).tooltip("show"),i(a),setTimeout(()=>{o=a,$(o).tooltip("hide").removeAttr(l);{var o=a;let t=$(o),e=t.children();e.attr("class",s)}c(a)},2e3)}}),$("#copy-link").click(t=>{let e=$(t.target);if(!n(e)){t=window.location.href;const o=$("<input>"),a=($("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove(),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 l=t.is(":visible"),n=$(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()),l&&n&&(t-=ScrollHelper.getTopbarHeight()),$("html").animate({scrollTop:t},500,()=>{if(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"))return!1;a.attr("tabindex","-1"),a.focus(),ScrollHelper.hasScrollUpTask()&&ScrollHelper.popScrollUpTask()})}}})});
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=>{t=$(t.target);(t.prop("tagName")==="button".toUpperCase()?t:t.parent()).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}}(),LocaleHelper=($(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 h(){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()?h()?c.removeClass("unloaded"):u.off():(u.on(),h()&&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 t="div.post>h1:first-of-type",e=$(t);const n=$("#topbar-title");if(0!==e.length&&!e.hasClass("dynamic-title")&&!n.is(":hidden")){const i=n.text().trim();let a=e.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),e.offset().top<$(window).scrollTop()&&n.text(a);new IntersectionObserver(t=>{var e,o;r?(o=$(window).scrollTop(),e=l<o,l=o,o=t[0],e?0===o.intersectionRatio&&n.text(a):1===o.intersectionRatio&&n.text(i)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(t)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){var t,e="#main > div.row:first-child > div:first-child";$(e+" img").length<=0||(t=document.querySelectorAll(e+" img[data-src]"),lozad(t).observe(),$(e+` p > img[data-src], ${e} img[data-src].preview-img`).each(function(){var t=$(this).next(),t="EM"===t.prop("tagName")?t.text():"",e=$(this).attr("data-src");$(this).wrap(`<a href="${e}" title="${t}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(e+" a").has("img").addClass("img-link"))}),function(){const t=$("html").attr("lang").substr(0,2),e="data-ts",o="data-df";return{locale:()=>t,attrTimestamp:()=>e,attrDateFormat:()=>o,getTimestamp:t=>Number(t.attr(e)),getDateFormat:t=>t.attr(o)}}());$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){var t=dayjs.unix(LocaleHelper.getTimestamp($(this))),e=t.format(LocaleHelper.getDateFormat($(this))),e=($(this).text(e),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==e&&"tooltip"===e&&(e=t.format("llll"),$(this).attr("data-original-title",e))})}),$(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 s(t){$(t).removeAttr(e)}var o=new ClipboardJS(t,{target(t){return t.parentNode.nextElementSibling.querySelector("code .rouge-code")}});$(t).tooltip({trigger:"hover",placement:"left"});const a=$(t).children().attr("class");o.on("success",t=>{t.clearSelection();const e=t.trigger;var o;n(e)||(t=e,$(t).children().attr("class","fas fa-check"),t=e,o=$(t).attr(r),$(t).attr(l,o).tooltip("show"),i(e),setTimeout(()=>{var t;t=e,$(t).tooltip("hide").removeAttr(l),t=e,$(t).children().attr("class",a),s(e)},2e3))}),$("#copy-link").click(t=>{let e=$(t.target);if(!n(e)){var t=window.location.href,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),s(e)},2e3)}})}),$(function(){const t=$("#topbar-title"),s="scroll-focus";$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(r){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){var l=decodeURI(this.hash);let e=RegExp(/^#fnref:/).test(l),o=!e&&RegExp(/^#fn:/).test(l);var n=l.includes(":")?l.replace(/:/g,"\\:"):l;let a=$(n);var n=t.is(":visible"),i=$(window).width()<$(window).height();if(void 0!==a){r.preventDefault(),history.pushState&&history.pushState(null,null,l);r=$(window).scrollTop();let t=a.offset().top-=8;t<r&&(ScrollHelper.hideTopbar(),ScrollHelper.addScrollUpTask()),n&&i&&(t-=ScrollHelper.getTopbarHeight()),$("html").animate({scrollTop:t},500,()=>{if(a.focus(),$(`[${s}=true]`).length&&$(`[${s}=true]`).attr(s,!1),$(":target").length&&$(":target").attr(s,!1),(o||e)&&a.attr(s,!0),a.is(":focus"))return!1;a.attr("tabindex","-1"),a.focus(),ScrollHelper.hasScrollUpTask()&&ScrollHelper.popScrollUpTask()})}}})});
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
2
+ * Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
3
3
  * © 2019 Cotes Chung
4
4
  * MIT Licensed
5
5
  */
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())localStorage.clear();else 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()}}}}();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?(t=parseInt(a.text().replace(/,/g,""),10),o>t&&countUp(t,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())});
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(){var 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())localStorage.clear();else 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()}}}}();function countUp(e,t,a){e<t&&((a=new CountUp(a,e,t)).error?console.error(a.error):a.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){t=0===(t=countPV(t,e))?1:t;r?(e=parseInt(a.text().replace(/,/g,""),10))<t&&countUp(e,t,a.attr("id")):a.text((new Intl.NumberFormat).format(t))}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())});
data/assets/js/pwa/app.js CHANGED
@@ -7,41 +7,41 @@ const $notification = $('#notification');
7
7
  const $btnRefresh = $('#notification .toast-body>button');
8
8
 
9
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');
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');
24
17
  }
25
- }
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
+ });
26
35
  });
27
- });
28
36
 
29
- $btnRefresh.click(() => {
30
- if (registration.waiting) {
31
- registration.waiting.postMessage('SKIP_WAITING');
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;
32
44
  }
33
- $notification.toast('hide');
34
- });
35
- }
36
- );
37
-
38
- let refreshing = false;
39
-
40
- /* Detect controller change and refresh all the opened tabs */
41
- navigator.serviceWorker.addEventListener('controllerchange', () => {
42
- if (!refreshing) {
43
- window.location.reload();
44
- refreshing = true;
45
- }
46
- });
45
+ });
47
46
  }
47
+
data/assets/js/pwa/sw.js CHANGED
@@ -9,81 +9,82 @@ self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
9
9
  const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}';
10
10
 
11
11
  function verifyDomain(url) {
12
- for (const domain of allowedDomains) {
13
- const regex = RegExp(`^http(s)?:\/\/${domain}\/`);
14
- if (regex.test(url)) {
15
- return true;
12
+ for (const domain of allowedDomains) {
13
+ const regex = RegExp(`^http(s)?:\/\/${domain}\/`);
14
+ if (regex.test(url)) {
15
+ return true;
16
+ }
16
17
  }
17
- }
18
18
 
19
- return false;
19
+ return false;
20
20
  }
21
21
 
22
22
  function isExcluded(url) {
23
- for (const item of denyUrls) {
24
- if (url === item) {
25
- return true;
23
+ for (const item of denyUrls) {
24
+ if (url === item) {
25
+ return true;
26
+ }
26
27
  }
27
- }
28
- return false;
28
+ return false;
29
29
  }
30
30
 
31
31
  self.addEventListener('install', event => {
32
- event.waitUntil(
33
- caches.open(cacheName).then(cache => {
34
- return cache.addAll(resource);
35
- })
36
- );
32
+ event.waitUntil(
33
+ caches.open(cacheName).then(cache => {
34
+ return cache.addAll(resource);
35
+ })
36
+ );
37
37
  });
38
38
 
39
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
- }
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
+ );
47
49
  })
48
- );
49
- })
50
- );
50
+ );
51
51
  });
52
52
 
53
53
  self.addEventListener('message', (event) => {
54
- if (event.data === 'SKIP_WAITING') {
55
- self.skipWaiting();
56
- }
54
+ if (event.data === 'SKIP_WAITING') {
55
+ self.skipWaiting();
56
+ }
57
57
  });
58
58
 
59
59
  self.addEventListener('fetch', event => {
60
- event.respondWith(
61
- caches.match(event.request).then(response => {
62
- if (response) {
63
- return response;
64
- }
60
+ event.respondWith(
61
+ caches.match(event.request).then(response => {
62
+ if (response) {
63
+ return response;
64
+ }
65
65
 
66
- return fetch(event.request).then(response => {
67
- const url = event.request.url;
66
+ return fetch(event.request).then(response => {
67
+ const url = event.request.url;
68
68
 
69
- if (event.request.method !== 'GET' ||
70
- !verifyDomain(url) ||
71
- isExcluded(url)) {
72
- return response;
73
- }
69
+ if (event.request.method !== 'GET' ||
70
+ !verifyDomain(url) ||
71
+ isExcluded(url)) {
72
+ return response;
73
+ }
74
74
 
75
- /*
76
- see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
77
- */
78
- let responseToCache = response.clone();
75
+ /*
76
+ see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
77
+ */
78
+ let responseToCache = response.clone();
79
79
 
80
- caches.open(cacheName).then(cache => {
81
- /* console.log('[sw] Caching new resource: ' + event.request.url); */
82
- cache.put(event.request, responseToCache);
83
- });
80
+ caches.open(cacheName).then(cache => {
81
+ /* console.log('[sw] Caching new resource: ' + event.request.url); */
82
+ cache.put(event.request, responseToCache);
83
+ });
84
84
 
85
- return response;
86
- });
87
- })
88
- );
85
+ return response;
86
+ });
87
+ })
88
+ );
89
89
  });
90
+
@@ -4,9 +4,9 @@ permalink: '/unregister.js'
4
4
  ---
5
5
 
6
6
  if ('serviceWorker' in navigator) {
7
- navigator.serviceWorker.getRegistrations().then((registrations) => {
8
- for (let reg of registrations) {
9
- reg.unregister();
10
- }
11
- });
7
+ navigator.serviceWorker.getRegistrations().then((registrations) => {
8
+ for (let reg of registrations) {
9
+ reg.unregister();
10
+ }
11
+ });
12
12
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-chirpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cotes Chung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-23 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -103,7 +103,6 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - LICENSE
105
105
  - README.md
106
- - _config.yml
107
106
  - _data/assets/cross_origin.yml
108
107
  - _data/assets/self_host.yml
109
108
  - _data/authors.yml
@@ -136,7 +135,6 @@ files:
136
135
  - _includes/head.html
137
136
  - _includes/js-selector.html
138
137
  - _includes/jsdelivr-combine.html
139
- - _includes/lang.html
140
138
  - _includes/language-alias.html
141
139
  - _includes/mermaid.html
142
140
  - _includes/mode-toggle.html
@@ -164,7 +162,6 @@ files:
164
162
  - _layouts/post.html
165
163
  - _layouts/tag.html
166
164
  - _layouts/tags.html
167
- - _plugins/posts-lastmod-hook.rb
168
165
  - _sass/addon/commons.scss
169
166
  - _sass/addon/module.scss
170
167
  - _sass/addon/syntax.scss
@@ -181,10 +178,6 @@ files:
181
178
  - _sass/layout/post.scss
182
179
  - _sass/layout/tags.scss
183
180
  - _sass/variables-hook.scss
184
- - _tabs/about.md
185
- - _tabs/archives.md
186
- - _tabs/categories.md
187
- - _tabs/tags.md
188
181
  - assets/404.html
189
182
  - assets/css/style.scss
190
183
  - assets/feed.xml
@@ -210,7 +203,6 @@ files:
210
203
  - assets/js/pwa/sw.js
211
204
  - assets/js/pwa/unregister.js
212
205
  - assets/robots.txt
213
- - index.html
214
206
  homepage: https://github.com/cotes2020/jekyll-theme-chirpy
215
207
  licenses:
216
208
  - MIT
data/_config.yml DELETED
@@ -1,201 +0,0 @@
1
- # The Site Configuration
2
-
3
- # Import the theme
4
- theme: jekyll-theme-chirpy
5
-
6
- # Change the following value to '/PROJECT_NAME' ONLY IF your site type is GitHub Pages Project sites
7
- # and doesn't have a custom domain.
8
- baseurl: ''
9
-
10
- # The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
11
- # If it has the same name as one of the files in folder `_data/locales`, the layout language will also be changed,
12
- # otherwise, the layout language will use the default value of 'en'.
13
- lang: en
14
-
15
- # Additional parameters for datetime localization, optional. › https://github.com/iamkun/dayjs/tree/dev/src/locale
16
- prefer_datetime_locale:
17
-
18
- # Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
19
- timezone: Asia/Shanghai
20
-
21
- # jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
22
- # ↓ --------------------------
23
-
24
- title: Chirpy # the main title
25
-
26
- tagline: A text-focused Jekyll theme # it will display as the sub-title
27
-
28
- description: >- # used by seo meta and the atom feed
29
- A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
30
-
31
- # fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
32
- url: ''
33
-
34
- github:
35
- username: github_username # change to your github username
36
-
37
- twitter:
38
- username: twitter_username # change to your twitter username
39
-
40
- social:
41
- # Change to your full name.
42
- # It will be displayed as the default author of the posts and the copyright owner in the Footer
43
- name: your_full_name
44
- email: example@doamin.com # change to your email address
45
- links:
46
- # The first element serves as the copyright owner's link
47
- - https://twitter.com/username # change to your twitter homepage
48
- - https://github.com/username # change to your github homepage
49
- # Uncomment below to add more social links
50
- # - https://www.facebook.com/username
51
- # - https://www.linkedin.com/in/username
52
-
53
- google_site_verification: # fill in to your verification string
54
-
55
- # ↑ --------------------------
56
- # The end of `jekyll-seo-tag` settings
57
-
58
- google_analytics:
59
- id: # fill in your Google Analytics ID
60
- # Google Analytics pageviews report settings
61
- pv:
62
- proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
63
- cache_path: # the local PV cache data, friendly to visitors from GFW region
64
-
65
- # Prefer color scheme setting.
66
- #
67
- # Note: Keep empty will follow the system prefer color by default,
68
- # and there will be a toggle to switch the theme between dark and light
69
- # on the bottom left of the sidebar.
70
- #
71
- # Available options:
72
- #
73
- # light - Use the light color scheme
74
- # dark - Use the dark color scheme
75
- #
76
- theme_mode: # [light|dark]
77
-
78
- # The CDN endpoint for images.
79
- # Notice that once it is assigned, the CDN url
80
- # will be added to all image (site avatar & posts' images) paths starting with '/'
81
- #
82
- # e.g. 'https://cdn.com'
83
- img_cdn:
84
-
85
- # the avatar on sidebar, support local or CORS resources
86
- avatar:
87
-
88
- # boolean type, the global switch for ToC in posts.
89
- toc: true
90
-
91
- comments:
92
- active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
93
- # The active options are as follows:
94
- disqus:
95
- shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
96
- # utterances settings › https://utteranc.es/
97
- utterances:
98
- repo: # <gh-username>/<repo>
99
- issue_term: # < url | pathname | title | ...>
100
- # Giscus options › https://giscus.app
101
- giscus:
102
- repo: # <gh-username>/<repo>
103
- repo_id:
104
- category:
105
- category_id:
106
- mapping: # optional, default to 'pathname'
107
- input_position: # optional, default to 'bottom'
108
- lang: # optional, default to the value of `site.lang`
109
-
110
- # Self-hosted static assets, optional › https://github.com/cotes2020/chirpy-static-assets
111
- assets:
112
- self_host:
113
- enabled: # boolean, keep empty means false
114
- # specify the Jekyll environment, empty means both
115
- # only works if `assets.self_host.enabled` is 'true'
116
- env: # [development|production]
117
-
118
- pwa:
119
- enabled: true # the option for PWA feature
120
-
121
- paginate: 10
122
-
123
- # ------------ The following options are not recommended to be modified ------------------
124
-
125
- kramdown:
126
- syntax_highlighter: rouge
127
- syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options
128
- css_class: highlight
129
- # default_lang: console
130
- span:
131
- line_numbers: false
132
- block:
133
- line_numbers: true
134
- start_line: 1
135
-
136
- collections:
137
- tabs:
138
- output: true
139
- sort_by: order
140
-
141
- defaults:
142
- - scope:
143
- path: '' # An empty string here means all files in the project
144
- type: posts
145
- values:
146
- layout: post
147
- comments: true # Enable comments in posts.
148
- toc: true # Display TOC column in posts.
149
- # DO NOT modify the following parameter unless you are confident enough
150
- # to update the code of all other post links in this project.
151
- permalink: /posts/:title/
152
- - scope:
153
- path: _drafts
154
- values:
155
- comments: false
156
- - scope:
157
- path: ''
158
- type: tabs # see `site.collections`
159
- values:
160
- layout: page
161
- permalink: /:title/
162
- - scope:
163
- path: assets/img/favicons
164
- values:
165
- swcache: true
166
- - scope:
167
- path: assets/js/dist
168
- values:
169
- swcache: true
170
-
171
- sass:
172
- style: compressed
173
-
174
- compress_html:
175
- clippings: all
176
- comments: all
177
- endings: all
178
- profile: false
179
- blanklines: false
180
- ignore:
181
- envs: [development]
182
-
183
- exclude:
184
- - '*.gem'
185
- - '*.gemspec'
186
- - tools
187
- - README.md
188
- - CHANGELOG.md
189
- - LICENSE
190
- - gulpfile.js
191
- - node_modules
192
- - package*.json
193
-
194
- jekyll-archives:
195
- enabled: [categories, tags]
196
- layouts:
197
- category: category
198
- tag: tag
199
- permalinks:
200
- tag: /tags/:name/
201
- category: /categories/:name/
data/_includes/lang.html DELETED
@@ -1,8 +0,0 @@
1
- {% comment %}
2
- Detect appearance language and return it through variable "lang"
3
- {% endcomment %}
4
- {% if site.data.locales[site.lang] %}
5
- {% assign lang = site.lang %}
6
- {% else %}
7
- {% assign lang = 'en' %}
8
- {% endif %}
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Check for changed posts
4
-
5
- Jekyll::Hooks.register :posts, :post_init do |post|
6
-
7
- commit_num = `git rev-list --count HEAD "#{ post.path }"`
8
-
9
- if commit_num.to_i > 1
10
- lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"`
11
- post.data['last_modified_at'] = lastmod_date
12
- end
13
-
14
- end
data/_tabs/about.md DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- # the default layout is 'page'
3
- icon: fas fa-info-circle
4
- order: 4
5
- ---
6
-
7
- > Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
8
- {: .prompt-tip }
data/_tabs/archives.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- layout: archives
3
- icon: fas fa-archive
4
- order: 3
5
- ---
6
-
data/_tabs/categories.md DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- layout: categories
3
- icon: fas fa-stream
4
- order: 1
5
- ---
data/_tabs/tags.md DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- layout: tags
3
- icon: fas fa-tag
4
- order: 2
5
- ---
data/index.html DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- layout: home
3
- # Index page
4
- ---