diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 1e05511..affd492 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -5,7 +5,7 @@ jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 + - uses: wagoid/commitlint-github-action@v5 diff --git a/_data/assets/self_host.yml b/_data/origin/basic.yml similarity index 100% rename from _data/assets/self_host.yml rename to _data/origin/basic.yml diff --git a/_data/assets/cross_origin.yml b/_data/origin/cors.yml similarity index 72% rename from _data/assets/cross_origin.yml rename to _data/origin/cors.yml index 594e9dc..cf8f0ec 100644 --- a/_data/assets/cross_origin.yml +++ b/_data/origin/cors.yml @@ -16,31 +16,31 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:w # Libraries jquery: - js: https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js + js: https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js bootstrap: css: https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css js: https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.21.0/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.21.0/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.1/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@9.2.2/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@9.4.3/dist/mermaid.min.js dayjs: js: - common: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/dayjs.min.js - locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/locale/:LOCALE.min.js - relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/relativeTime.min.js - localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/localizedFormat.min.js + common: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/dayjs.min.js + locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/locale/:LOCALE.min.js + relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/plugin/relativeTime.min.js + localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/plugin/localizedFormat.min.js countup: js: https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js diff --git a/_includes/comments/giscus.html b/_includes/comments/giscus.html index 29b848f..ed918a9 100644 --- a/_includes/comments/giscus.html +++ b/_includes/comments/giscus.html @@ -1,44 +1,54 @@ diff --git a/_includes/head.html b/_includes/head.html index 6407c9c..0c85fe1 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -58,15 +58,15 @@ {% include favicons.html %} {% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %} - + {% else %} - {% for cdn in site.data.assets[origin].cdns %} + {% for cdn in site.data.origin[type].cdns %} {% endfor %} - + {% endif %} @@ -90,30 +90,27 @@ {% endif %} - + - + {% if site.toc and page.toc %} - + {% endif %} {% if page.layout == 'page' or page.layout == 'post' %} - + {% endif %} - - {% unless site.theme_mode %} {% include mode-toggle.html %} {% endunless %} {% include metadata-hook.html %} - diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 7d2224c..177aaf2 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -1,27 +1,35 @@ + + +{% assign urls = site.data.origin[type].jquery.js + | append: ',' + | append: site.data.origin[type].bootstrap.js + | append: ',' + | append: site.data.origin[type].search.js +%} + {% if page.layout == 'post' %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} - + {% assign urls = urls | append: ',' | append: site.data.origin[type].countup.js %} {% endif %} {% endif %} {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} - {% assign _urls = site.data.assets[origin].lazysizes.js %} + {% assign urls = urls | append: ',' | append: site.data.origin[type].lazysizes.js %} {% unless page.layout == 'home' %} - {% assign _urls = _urls + + {% assign urls = urls | append: ',' - | append: site.data.assets[origin]['magnific-popup'].js + | append: site.data.origin[type]['magnific-popup'].js | append: ',' - | append: site.data.assets[origin].clipboard.js + | append: site.data.origin[type].clipboard.js %} {% endunless %} - - {% include jsdelivr-combine.html urls=_urls %} {% endif %} {% if page.layout == 'home' @@ -32,29 +40,39 @@ %} {% assign locale = site.lang | split: '-' | first %} - {% assign _urls = site.data.assets[origin].dayjs.js.common + {% assign urls = urls | append: ',' - | append: site.data.assets[origin].dayjs.js.locale + | append: site.data.origin[type].dayjs.js.common + | append: ',' + | append: site.data.origin[type].dayjs.js.locale | replace: ':LOCALE', locale | append: ',' - | append: site.data.assets[origin].dayjs.js.relativeTime + | append: site.data.origin[type].dayjs.js.relativeTime | append: ',' - | append: site.data.assets[origin].dayjs.js.localizedFormat + | append: site.data.origin[type].dayjs.js.localizedFormat %} - - {% include jsdelivr-combine.html urls=_urls %} {% endif %} +{% if page.content contains ' {% if page.math %} @@ -76,14 +94,10 @@ } }; - - + + {% endif %} - - - - {% if jekyll.environment == 'production' %} {% if site.pwa.enabled %} diff --git a/_includes/jsdelivr-combine.html b/_includes/jsdelivr-combine.html index 960eeb1..cffa699 100644 --- a/_includes/jsdelivr-combine.html +++ b/_includes/jsdelivr-combine.html @@ -5,7 +5,6 @@ {% assign domain = 'https://cdn.jsdelivr.net/' %} {% for url in urls %} - {% if url contains domain %} {% assign url_snippet = url | slice: domain.size, url.size %} @@ -16,15 +15,10 @@ {% endif %} {% elsif url contains '//' %} - - {% else %} - - {% endif %} - {% endfor %} {% if combined_urls %} diff --git a/_includes/mermaid.html b/_includes/mermaid.html index 2ec8029..967cfb4 100644 --- a/_includes/mermaid.html +++ b/_includes/mermaid.html @@ -1,59 +1,58 @@ - - - - - diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html index ada0061..a347750 100644 --- a/_includes/mode-toggle.html +++ b/_includes/mode-toggle.html @@ -1,14 +1,22 @@ - + - diff --git a/_includes/toc.html b/_includes/toc.html index 6b18693..1eb3dcd 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -10,7 +10,4 @@
{{- site.data.locales[include.lang].panel.toc -}}
- - - {% endif %} diff --git a/_javascript/modules/components/topbar-switcher.js b/_javascript/modules/components/topbar-switcher.js index f3eebb7..1b0d025 100644 --- a/_javascript/modules/components/topbar-switcher.js +++ b/_javascript/modules/components/topbar-switcher.js @@ -6,7 +6,6 @@ import ScrollHelper from './utils/scroll-helper'; const $searchInput = $('#search-input'); const delta = ScrollHelper.getTopbarHeight(); -let didScroll; let lastScrollTop = 0; function hasScrolled() { @@ -60,34 +59,41 @@ function handleLandscape() { export function switchTopbar() { const orientation = screen.orientation; - if (orientation) { - orientation.onchange = () => { - const type = orientation.type; - if (type === 'landscape-primary' || type === 'landscape-secondary') { - handleLandscape(); - } - }; - } else { - // for the browsers that not support `window.screen.orientation` API - $(window).on('orientationchange', () => { - if ($(window).width() < $(window).height()) { - // before rotating, it is still in portrait mode. - handleLandscape(); - } - }); - } + let didScroll = false; - $(window).on('scroll', () => { - if (didScroll) { - return; + const handleOrientationChange = () => { + const type = orientation.type; + if (type === 'landscape-primary' || type === 'landscape-secondary') { + handleLandscape(); } - didScroll = true; - }); + }; - setInterval(() => { + const handleWindowChange = () => { + if ($(window).width() < $(window).height()) { + // before rotating, it is still in portrait mode. + handleLandscape(); + } + }; + + const handleScroll = () => { + didScroll = true; + }; + + const checkScroll = () => { if (didScroll) { hasScrolled(); didScroll = false; } - }, 250); + }; + + if (orientation) { + orientation.addEventListener('change', handleOrientationChange); + } else { + // for the browsers that not support `window.screen.orientation` API + $(window).on('orientationchange', handleWindowChange); + } + + $(window).on('scroll', handleScroll); + + setInterval(checkScroll, 250); } diff --git a/_layouts/default.html b/_layouts/default.html index 2349852..d6ff29c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,7 +5,7 @@ layout: compress -{% include assets-origin.html %} +{% include origin-type.html %} {% include lang.html %} @@ -21,7 +21,6 @@ layout: compress {% include sidebar.html lang=lang %} - {% include topbar.html lang=lang %}
@@ -31,14 +30,9 @@ layout: compress {% include search-results.html lang=lang %}
- {% include footer.html lang=lang %} - {% if page.mermaid %} - {% include mermaid.html %} - {% endif %} -
@@ -72,8 +66,12 @@ layout: compress {% endif %} - {% include search-loader.html %} - {% include js-selector.html %} + + {% if page.mermaid %} + {% include mermaid.html %} + {% endif %} + + {% include search-loader.html %} diff --git a/_layouts/page.html b/_layouts/page.html index 917a4f4..fc2c915 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -3,7 +3,7 @@ layout: default --- {% include lang.html %} -{% include assets-origin.html %} +{% include origin-type.html %}
diff --git a/assets/lib b/assets/lib index 24ebdb7..5f28c7d 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit 24ebdb708f3f5451df953cb5f9deb3ad4433404a +Subproject commit 5f28c7d5107a1c2e30381765194269680a3d0eae