jekyll-theme-chirpy 5.0.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/_config.yml +38 -13
- data/_data/assets/cross_origin.yml +62 -0
- data/_data/assets/self_host.yml +51 -0
- data/_data/authors.yml +17 -0
- data/_data/locales/en.yml +12 -20
- data/_data/locales/es-ES.yml +79 -0
- data/_data/locales/fr-FR.yml +79 -0
- data/_data/locales/id-ID.yml +4 -16
- data/_data/locales/ko-KR.yml +4 -16
- data/_data/locales/my-MM.yml +79 -0
- data/_data/locales/pt-BR.yml +79 -0
- data/_data/locales/ru-RU.yml +79 -0
- data/_data/locales/uk-UA.yml +79 -0
- data/_data/locales/vi-VN.yml +77 -0
- data/_data/locales/zh-CN.yml +4 -16
- data/_data/share.yml +1 -1
- data/_includes/assets-origin.html +12 -0
- data/_includes/comments/giscus.html +56 -0
- data/_includes/comments/utterances.html +2 -2
- data/_includes/datetime.html +21 -0
- data/_includes/footer.html +5 -6
- data/_includes/head.html +62 -21
- data/_includes/js-selector.html +47 -11
- data/_includes/jsdelivr-combine.html +32 -0
- data/_includes/mermaid.html +3 -3
- data/_includes/mode-toggle.html +4 -3
- data/_includes/post-nav.html +4 -4
- data/_includes/post-paginator.html +2 -2
- data/_includes/post-sharing.html +3 -2
- data/_includes/refactor-content.html +62 -10
- data/_includes/related-posts.html +1 -4
- data/_includes/search-loader.html +1 -1
- data/_includes/sidebar.html +8 -8
- data/_includes/toc.html +1 -1
- data/_includes/topbar.html +3 -4
- data/_layouts/archives.html +15 -6
- data/_layouts/categories.html +25 -4
- data/_layouts/category.html +1 -3
- data/_layouts/default.html +23 -8
- data/_layouts/home.html +4 -8
- data/_layouts/page.html +11 -11
- data/_layouts/post.html +52 -44
- data/_layouts/tag.html +1 -3
- data/_layouts/tags.html +3 -1
- data/_sass/addon/commons.scss +241 -305
- data/_sass/addon/module.scss +33 -17
- data/_sass/addon/syntax.scss +38 -25
- data/_sass/addon/variables.scss +9 -9
- data/_sass/colors/dark-syntax.scss +1 -0
- data/_sass/colors/dark-typography.scss +10 -1
- data/_sass/colors/light-syntax.scss +6 -1
- data/_sass/colors/light-typography.scss +14 -1
- data/_sass/jekyll-theme-chirpy.scss +1 -1
- data/_sass/layout/post.scss +4 -7
- data/_tabs/about.md +2 -2
- data/assets/404.html +0 -17
- data/assets/js/data/search.json +6 -5
- data/assets/js/data/swcache.js +11 -20
- data/assets/js/dist/categories.min.js +2 -2
- data/assets/js/dist/commons.min.js +2 -2
- data/assets/js/dist/home.min.js +2 -2
- data/assets/js/dist/misc.min.js +6 -0
- data/assets/js/dist/page.min.js +2 -2
- data/assets/js/dist/post.min.js +2 -2
- data/assets/js/dist/pvreport.min.js +2 -2
- data/assets/js/pwa/app.js +55 -4
- data/assets/js/pwa/sw.js +42 -40
- data/assets/js/pwa/unregister.js +12 -0
- metadata +20 -7
- data/_includes/css-selector.html +0 -15
- data/_includes/no-zero-date.html +0 -13
- data/_includes/timeago.html +0 -26
data/assets/js/dist/page.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy v5.0
|
2
|
+
* Chirpy v5.2.0 (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(
|
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 t=$(e.target);let o=t.prop("tagName")==="button".toUpperCase()?t:t.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let r=0,a=!1,l=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{r+=1,a=a||!0},popScrollUpTask:()=>--r,hasScrollUpTask:()=>0<r,topbarLocked:()=>!0===a,unlockTopbar:()=>a=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),r=$("#main"),a=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),i=$("#search-results"),c=$("#search-input"),s=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),a.addClass("unloaded"),t.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),a.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),r.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),s.hasClass("unloaded")&&s.removeClass("unloaded"),n.addClass("unloaded"),r.removeClass("unloaded"),d.release(),c.val(""),e=!1)},isVisible(){return e}}}();function h(){return o.hasClass("loaded")}t.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 e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,r=0;function a(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||a()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&a()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(!function(){var e=$(this).scrollTop();if(!(Math.abs(r-e)<=o)){if(e>r)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}r=e}}(),e=!1)},250)}),$(function(){var t="div.post>h1:first-of-type";const o=$(t),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const i=n.text().trim();let r=o.text().trim(),a=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(r)&&(r=r.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(r);let e=new IntersectionObserver(e=>{var t,o;a?(o=$(window).scrollTop(),t=l<o,l=o,o=e[0],t?0===o.intersectionRatio&&n.text(r):1===o.intersectionRatio&&n.text(i)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(t)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){var e="#main > div.row:first-child > div:first-child";if(!($(e+" img").length<=0)){var t=document.querySelectorAll(e+" img[data-src]");const o=lozad(t);o.observe(),$(e+` p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();var t="EM"===e.prop("tagName")?e.text():"",o=$(this).attr("data-src");$(this).wrap(`<a href="${o}" 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(){var e=".code-header>button";const t="timeout",a="data-title-succeed",l="data-original-title";function n(e){if($(e)[0].hasAttribute(t)){e=$(e).attr(t);if(Number(e)>Date.now())return 1}}function i(e){$(e).attr(t,Date.now()+2e3)}function c(e){$(e).removeAttr(t)}const o=new ClipboardJS(e,{target(e){let t=e.parentNode.nextElementSibling;return t.querySelector("code .rouge-code")}});$(e).tooltip({trigger:"hover",placement:"left"});const s=function(e){let t=$(e).children();return t.attr("class")}(e);o.on("success",o=>{o.clearSelection();const r=o.trigger;if(!n(r)){{o=r;let e=$(o),t=e.children();t.attr("class","fas fa-check")}var e;o=r,e=$(o).attr(a),$(o).attr(l,e).tooltip("show"),i(r),setTimeout(()=>{o=r,$(o).tooltip("hide").removeAttr(l);{var o=r;let e=$(o),t=e.children();t.attr("class",s)}c(r)},2e3)}}),$("#copy-link").click(e=>{let t=$(e.target);if(!n(t)){e=window.location.href;const o=$("<input>"),r=($("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),t.attr(l));e=t.attr(a);t.attr(l,e).tooltip("show"),i(t),setTimeout(()=>{t.attr(l,r),c(t)},2e3)}})}),$(function(){const e=$("#topbar-title"),c="scroll-focus";$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(a){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const i=decodeURI(this.hash);let t=RegExp(/^#fnref:/).test(i),o=!t&&RegExp(/^#fn:/).test(i);var l=i.includes(":")?i.replace(/\:/g,"\\:"):i;let r=$(l);var l=e.is(":visible"),n=$(window).width()<$(window).height();if(void 0!==r){a.preventDefault(),history.pushState&&history.pushState(null,null,i);a=$(window).scrollTop();let e=r.offset().top-=8;e<a&&(ScrollHelper.hideTopbar(),ScrollHelper.addScrollUpTask()),l&&n&&(e-=ScrollHelper.getTopbarHeight()),$("html").animate({scrollTop:e},500,()=>{if(r.focus(),$(`[${c}=true]`).length&&$(`[${c}=true]`).attr(c,!1),$(":target").length&&$(":target").attr(c,!1),(o||t)&&r.attr(c,!0),r.is(":focus"))return!1;r.attr("tabindex","-1"),r.focus(),ScrollHelper.hasScrollUpTask()&&ScrollHelper.popScrollUpTask()})}}})});
|
data/assets/js/dist/post.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy v5.0
|
2
|
+
* Chirpy v5.2.0 (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()})})
|
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()})}}})});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* Chirpy v5.0
|
2
|
+
* Chirpy v5.2.0 (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
|
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())});
|
data/assets/js/pwa/app.js
CHANGED
@@ -3,7 +3,58 @@ layout: compress
|
|
3
3
|
permalink: '/app.js'
|
4
4
|
---
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
const keyWaiting = 'sw-waiting';
|
7
|
+
const $notification = $('#notification');
|
8
|
+
const $btnRefresh = $('#notification .toast-body>button');
|
9
|
+
|
10
|
+
function skipWating(registration) {
|
11
|
+
registration.waiting.postMessage('SKIP_WAITING');
|
12
|
+
localStorage.removeItem(keyWaiting);
|
13
|
+
}
|
14
|
+
|
15
|
+
if ('serviceWorker' in navigator) {
|
16
|
+
/* Registering Service Worker */
|
17
|
+
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
|
18
|
+
.then(registration => {
|
19
|
+
if (registration) {
|
20
|
+
registration.addEventListener('updatefound', () => {
|
21
|
+
let serviceWorker = registration.installing;
|
22
|
+
|
23
|
+
serviceWorker.addEventListener('statechange', () => {
|
24
|
+
if (serviceWorker.state === 'installed') {
|
25
|
+
if (navigator.serviceWorker.controller) {
|
26
|
+
$notification.toast('show');
|
27
|
+
/* in case the user ignores the notification */
|
28
|
+
localStorage.setItem(keyWaiting, true);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
$btnRefresh.click(() => {
|
35
|
+
skipWating(registration);
|
36
|
+
$notification.toast('hide');
|
37
|
+
});
|
38
|
+
|
39
|
+
if (localStorage.getItem(keyWaiting)) {
|
40
|
+
if (registration.waiting) {
|
41
|
+
/* there's a new Service Worker waiting to be activated */
|
42
|
+
$notification.toast('show');
|
43
|
+
} else {
|
44
|
+
/* closed all open pages after receiving notification */
|
45
|
+
localStorage.removeItem(keyWaiting);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
let refreshing = false;
|
52
|
+
|
53
|
+
/* Detect controller change and refresh all the opened tabs */
|
54
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
55
|
+
if (!refreshing) {
|
56
|
+
window.location.reload();
|
57
|
+
refreshing = true;
|
58
|
+
}
|
59
|
+
});
|
60
|
+
}
|
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',
|
32
|
-
|
33
|
-
e.waitUntil(
|
31
|
+
self.addEventListener('install', event => {
|
32
|
+
event.waitUntil(
|
34
33
|
caches.open(cacheName).then(cache => {
|
35
34
|
return cache.addAll(resource);
|
36
35
|
})
|
37
36
|
);
|
38
37
|
});
|
39
38
|
|
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
|
+
});
|
52
|
+
|
53
|
+
self.addEventListener('message', (event) => {
|
54
|
+
if (event.data === 'SKIP_WAITING') {
|
55
|
+
self.skipWaiting();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
40
59
|
self.addEventListener('fetch', event => {
|
41
60
|
event.respondWith(
|
42
|
-
caches.match(event.request)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
61
|
+
caches.match(event.request).then(response => {
|
62
|
+
if (response) {
|
63
|
+
return response;
|
64
|
+
}
|
47
65
|
|
48
|
-
|
49
|
-
|
50
|
-
const url = event.request.url;
|
66
|
+
return fetch(event.request).then(response => {
|
67
|
+
const url = event.request.url;
|
51
68
|
|
52
|
-
|
69
|
+
if (event.request.method !== 'GET' ||
|
53
70
|
!verifyDomain(url) ||
|
54
71
|
isExcluded(url)) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
/*
|
59
|
-
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
|
60
|
-
*/
|
61
|
-
let responseToCache = response.clone();
|
72
|
+
return response;
|
73
|
+
}
|
62
74
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
});
|
75
|
+
/*
|
76
|
+
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
|
77
|
+
*/
|
78
|
+
let responseToCache = response.clone();
|
68
79
|
|
69
|
-
|
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
|
-
|
76
|
-
|
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
|
});
|
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.0
|
4
|
+
version: 5.2.0
|
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-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -104,27 +104,39 @@ files:
|
|
104
104
|
- LICENSE
|
105
105
|
- README.md
|
106
106
|
- _config.yml
|
107
|
+
- _data/assets/cross_origin.yml
|
108
|
+
- _data/assets/self_host.yml
|
109
|
+
- _data/authors.yml
|
107
110
|
- _data/contact.yml
|
108
111
|
- _data/locales/en.yml
|
112
|
+
- _data/locales/es-ES.yml
|
113
|
+
- _data/locales/fr-FR.yml
|
109
114
|
- _data/locales/id-ID.yml
|
110
115
|
- _data/locales/ko-KR.yml
|
116
|
+
- _data/locales/my-MM.yml
|
117
|
+
- _data/locales/pt-BR.yml
|
118
|
+
- _data/locales/ru-RU.yml
|
119
|
+
- _data/locales/uk-UA.yml
|
120
|
+
- _data/locales/vi-VN.yml
|
111
121
|
- _data/locales/zh-CN.yml
|
112
122
|
- _data/share.yml
|
123
|
+
- _includes/assets-origin.html
|
113
124
|
- _includes/comments.html
|
114
125
|
- _includes/comments/disqus.html
|
126
|
+
- _includes/comments/giscus.html
|
115
127
|
- _includes/comments/utterances.html
|
116
|
-
- _includes/
|
128
|
+
- _includes/datetime.html
|
117
129
|
- _includes/favicons.html
|
118
130
|
- _includes/footer.html
|
119
131
|
- _includes/google-analytics.html
|
120
132
|
- _includes/head.html
|
121
133
|
- _includes/js-selector.html
|
134
|
+
- _includes/jsdelivr-combine.html
|
122
135
|
- _includes/lang.html
|
123
136
|
- _includes/language-alias.html
|
124
137
|
- _includes/mermaid.html
|
125
138
|
- _includes/mode-toggle.html
|
126
139
|
- _includes/no-linenos.html
|
127
|
-
- _includes/no-zero-date.html
|
128
140
|
- _includes/post-nav.html
|
129
141
|
- _includes/post-paginator.html
|
130
142
|
- _includes/post-sharing.html
|
@@ -134,7 +146,6 @@ files:
|
|
134
146
|
- _includes/search-loader.html
|
135
147
|
- _includes/search-results.html
|
136
148
|
- _includes/sidebar.html
|
137
|
-
- _includes/timeago.html
|
138
149
|
- _includes/toc.html
|
139
150
|
- _includes/topbar.html
|
140
151
|
- _includes/trending-tags.html
|
@@ -187,11 +198,13 @@ files:
|
|
187
198
|
- assets/js/dist/categories.min.js
|
188
199
|
- assets/js/dist/commons.min.js
|
189
200
|
- assets/js/dist/home.min.js
|
201
|
+
- assets/js/dist/misc.min.js
|
190
202
|
- assets/js/dist/page.min.js
|
191
203
|
- assets/js/dist/post.min.js
|
192
204
|
- assets/js/dist/pvreport.min.js
|
193
205
|
- assets/js/pwa/app.js
|
194
206
|
- assets/js/pwa/sw.js
|
207
|
+
- assets/js/pwa/unregister.js
|
195
208
|
- assets/robots.txt
|
196
209
|
- index.html
|
197
210
|
homepage: https://github.com/cotes2020/jekyll-theme-chirpy
|
@@ -199,7 +212,7 @@ licenses:
|
|
199
212
|
- MIT
|
200
213
|
metadata:
|
201
214
|
bug_tracker_uri: https://github.com/cotes2020/jekyll-theme-chirpy/issues
|
202
|
-
documentation_uri: https://github.com/cotes2020/jekyll-theme-chirpy
|
215
|
+
documentation_uri: https://github.com/cotes2020/jekyll-theme-chirpy/#readme
|
203
216
|
homepage_uri: https://cotes2020.github.io/chirpy-demo
|
204
217
|
source_code_uri: https://github.com/cotes2020/jekyll-theme-chirpy
|
205
218
|
wiki_uri: https://github.com/cotes2020/jekyll-theme-chirpy/wiki
|
@@ -212,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
225
|
requirements:
|
213
226
|
- - ">="
|
214
227
|
- !ruby/object:Gem::Version
|
215
|
-
version: '2.
|
228
|
+
version: '2.5'
|
216
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
230
|
requirements:
|
218
231
|
- - ">="
|
data/_includes/css-selector.html
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
CSS selector for site.
|
3
|
-
-->
|
4
|
-
|
5
|
-
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
|
6
|
-
|
7
|
-
{% if site.toc and page.toc %}
|
8
|
-
<link rel="stylesheet"
|
9
|
-
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
|
10
|
-
{% endif %}
|
11
|
-
|
12
|
-
{% if page.layout == 'page' or page.layout == 'post' %}
|
13
|
-
<!-- Manific Popup -->
|
14
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
|
15
|
-
{% endif %}
|
data/_includes/no-zero-date.html
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{% comment %}
|
2
|
-
Remove the zero padding from a month/day string
|
3
|
-
{% endcomment %}
|
4
|
-
|
5
|
-
{% assign ret = include.date_str %}
|
6
|
-
{% assign _first_chat = ret | slice: 0 %}
|
7
|
-
|
8
|
-
{% if _first_chat == '0' %}
|
9
|
-
{% assign _last_idx = ret.size | minus: 1 %}
|
10
|
-
{% assign ret = ret | slice: 1, _last_idx %}
|
11
|
-
{% endif %}
|
12
|
-
|
13
|
-
{{ ret | replace: ' 0', ' ' }}
|
data/_includes/timeago.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
Date format snippet
|
3
|
-
See: ${JS_ROOT}/utils/timeago.js
|
4
|
-
-->
|
5
|
-
|
6
|
-
{% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
|
7
|
-
{% assign post_long_df = site.data.locales[lang].date_format.post.long %}
|
8
|
-
{% assign post_short_df = site.data.locales[lang].date_format.post.short %}
|
9
|
-
|
10
|
-
<em class="timeago{% if include.class %} {{ include.class }}{% endif %}"
|
11
|
-
date="{{ include.date }}"
|
12
|
-
{% if include.tooltip %}
|
13
|
-
data-toggle="tooltip"
|
14
|
-
data-placement="bottom"
|
15
|
-
title="{{ include.date | date: tooltip_df }}"
|
16
|
-
{% endif %}>
|
17
|
-
|
18
|
-
{%- assign this_year = site.time | date: "%Y" -%}
|
19
|
-
{%- assign post_year = include.date | date: "%Y" -%}
|
20
|
-
|
21
|
-
{%- if post_year == this_year -%}
|
22
|
-
{{ include.date | date: post_short_df }}
|
23
|
-
{%- else -%}
|
24
|
-
{{ include.date | date: post_long_df }}
|
25
|
-
{%- endif -%}
|
26
|
-
</em>
|