Skip to content

Commit fe18011

Browse files
committed
Merge branch 'feature/v6-core'
2 parents 016a9ba + 25ec764 commit fe18011

File tree

16 files changed

+229
-195
lines changed

16 files changed

+229
-195
lines changed

.github/workflows/commitlint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
commitlint:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v3
99
with:
1010
fetch-depth: 0
11-
- uses: wagoid/commitlint-github-action@v4
11+
- uses: wagoid/commitlint-github-action@v5
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:w
1616
# Libraries
1717

1818
jquery:
19-
js: https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js
19+
js: https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js
2020

2121
bootstrap:
2222
css: https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css
2323
js: https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js
2424

2525
toc:
26-
css: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.css
27-
js: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.js
26+
css: https://cdn.jsdelivr.net/npm/tocbot@4.21.0/dist/tocbot.min.css
27+
js: https://cdn.jsdelivr.net/npm/tocbot@4.21.0/dist/tocbot.min.js
2828

2929
fontawesome:
30-
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.1/css/all.min.css
30+
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css
3131

3232
search:
3333
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
3434

3535
mermaid:
36-
js: https://cdn.jsdelivr.net/npm/mermaid@9.2.2/dist/mermaid.min.js
36+
js: https://cdn.jsdelivr.net/npm/mermaid@9.4.3/dist/mermaid.min.js
3737

3838
dayjs:
3939
js:
40-
common: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/dayjs.min.js
41-
locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/locale/:LOCALE.min.js
42-
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/relativeTime.min.js
43-
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/localizedFormat.min.js
40+
common: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/dayjs.min.js
41+
locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/locale/:LOCALE.min.js
42+
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/plugin/relativeTime.min.js
43+
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.7/plugin/localizedFormat.min.js
4444

4545
countup:
4646
js: https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js

_includes/comments/giscus.html

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,54 @@
11
<!-- https://giscus.app/ -->
22
<script type="text/javascript">
3-
$(function () {
4-
const origin = "https://giscus.app";
5-
const iframe = "iframe.giscus-frame";
6-
const lightTheme = "light";
7-
const darkTheme = "dark_dimmed";
3+
(function () {
4+
const origin = 'https://giscus.app';
5+
const iframe = 'iframe.giscus-frame';
6+
const lightTheme = 'light';
7+
const darkTheme = 'dark_dimmed';
8+
89
let initTheme = lightTheme;
10+
const html = document.documentElement;
911

10-
if ($("html[data-mode=dark]").length > 0
11-
|| ($("html[data-mode]").length == 0
12-
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
12+
if (
13+
(html.hasAttribute('data-mode') &&
14+
html.getAttribute('data-mode') === 'dark') ||
15+
(!html.hasAttribute('data-mode') &&
16+
window.matchMedia('(prefers-color-scheme: dark)').matches)
17+
) {
1318
initTheme = darkTheme;
1419
}
1520

1621
let giscusAttributes = {
17-
"src": "https://giscus.app/client.js",
18-
"data-repo": "{{ site.comments.giscus.repo}}",
19-
"data-repo-id": "{{ site.comments.giscus.repo_id }}",
20-
"data-category": "{{ site.comments.giscus.category }}",
21-
"data-category-id": "{{ site.comments.giscus.category_id }}",
22-
"data-mapping": "{{ site.comments.giscus.mapping | default: 'pathname' }}",
23-
"data-reactions-enabled": "{{ site.comments.giscus.reactions_enabled | default: '1' }}",
24-
"data-emit-metadata": "0",
25-
"data-theme": initTheme,
26-
"data-input-position": "{{ site.comments.giscus.input_position | default: 'bottom' }}",
27-
"data-lang": "{{ site.comments.giscus.lang | default: lang }}",
28-
"crossorigin": "anonymous",
29-
"async": ""
22+
src: 'https://giscus.app/client.js',
23+
'data-repo': '{{ site.comments.giscus.repo}}',
24+
'data-repo-id': '{{ site.comments.giscus.repo_id }}',
25+
'data-category': '{{ site.comments.giscus.category }}',
26+
'data-category-id': '{{ site.comments.giscus.category_id }}',
27+
'data-mapping': '{{ site.comments.giscus.mapping | default: 'pathname' }}',
28+
'data-reactions-enabled': '{{ site.comments.giscus.reactions_enabled | default: '1' }}',
29+
'data-emit-metadata': '0',
30+
'data-theme': initTheme,
31+
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
32+
'data-lang': '{{ site.comments.giscus.lang | default: lang }}',
33+
crossorigin: 'anonymous',
34+
async: ''
3035
};
3136

32-
let giscusScript = document.createElement("script");
33-
Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value));
34-
document.getElementById("tail-wrapper").appendChild(giscusScript);
37+
let giscusScript = document.createElement('script');
38+
Object.entries(giscusAttributes).forEach(([key, value]) =>
39+
giscusScript.setAttribute(key, value)
40+
);
41+
document.getElementById('tail-wrapper').appendChild(giscusScript);
3542

36-
addEventListener("message", (event) => {
37-
if (event.source === window && event.data &&
38-
event.data.direction === ModeToggle.ID) {
43+
addEventListener('message', (event) => {
44+
if (
45+
event.source === window &&
46+
event.data &&
47+
event.data.direction === ModeToggle.ID
48+
) {
3949
/* global theme mode changed */
4050
const mode = event.data.message;
41-
const theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
51+
const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
4252

4353
const message = {
4454
setConfig: {
@@ -49,8 +59,6 @@
4959
const giscus = document.querySelector(iframe).contentWindow;
5060
giscus.postMessage({ giscus: message }, origin);
5161
}
52-
5362
});
54-
55-
});
63+
})();
5664
</script>

_includes/head.html

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@
5858
{% include favicons.html %}
5959

6060
{% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
61-
<link href="{{ site.data.assets[origin].webfonts | relative_url }}" rel="stylesheet">
61+
<link href="{{ site.data.origin[type].webfonts | relative_url }}" rel="stylesheet">
6262

6363
{% else %}
64-
{% for cdn in site.data.assets[origin].cdns %}
64+
{% for cdn in site.data.origin[type].cdns %}
6565
<link rel="preconnect" href="{{ cdn.url }}" {{ cdn.args }}>
6666
<link rel="dns-prefetch" href="{{ cdn.url }}" {{ cdn.args }}>
6767
{% endfor %}
6868

69-
<link rel="stylesheet" href="{{ site.data.assets[origin].webfonts | relative_url }}">
69+
<link rel="stylesheet" href="{{ site.data.origin[type].webfonts | relative_url }}">
7070
{% endif %}
7171

7272
<!-- GA -->
@@ -90,30 +90,27 @@
9090
{% endif %}
9191

9292
<!-- Bootstrap -->
93-
<link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap.css | relative_url}}">
93+
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url}}">
9494

9595
<!-- Font Awesome -->
96-
<link rel="stylesheet" href="{{ site.data.assets[origin].fontawesome.css | relative_url }}">
96+
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">
9797

9898
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
9999

100100
{% if site.toc and page.toc %}
101-
<link rel="stylesheet" href="{{ site.data.assets[origin].toc.css | relative_url }}">
101+
<link rel="stylesheet" href="{{ site.data.origin[type].toc.css | relative_url }}">
102102
{% endif %}
103103

104104
{% if page.layout == 'page' or page.layout == 'post' %}
105105
<!-- Manific Popup -->
106-
<link rel="stylesheet" href="{{ site.data.assets[origin].magnific-popup.css | relative_url }}">
106+
<link rel="stylesheet" href="{{ site.data.origin[type].magnific-popup.css | relative_url }}">
107107
{% endif %}
108108

109109
<!-- JavaScript -->
110110

111-
<script src="{{ site.data.assets[origin].jquery.js | relative_url }}"></script>
112-
113111
{% unless site.theme_mode %}
114112
{% include mode-toggle.html %}
115113
{% endunless %}
116114

117115
{% include metadata-hook.html %}
118-
119116
</head>

_includes/js-selector.html

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
<!-- JS selector for site. -->
22

3+
<!-- commons -->
4+
5+
{% assign urls = site.data.origin[type].jquery.js
6+
| append: ','
7+
| append: site.data.origin[type].bootstrap.js
8+
| append: ','
9+
| append: site.data.origin[type].search.js
10+
%}
11+
312
<!-- layout specified -->
413

514
{% if page.layout == 'post' %}
615
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
716
<!-- pv-report needs countup.js -->
8-
<script async src="{{ site.data.assets[origin].countup.js | relative_url }}"></script>
17+
{% assign urls = urls | append: ',' | append: site.data.origin[type].countup.js %}
918
{% endif %}
1019
{% endif %}
1120

1221
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
13-
{% assign _urls = site.data.assets[origin].lazysizes.js %}
22+
{% assign urls = urls | append: ',' | append: site.data.origin[type].lazysizes.js %}
1423

1524
{% unless page.layout == 'home' %}
16-
{% assign _urls = _urls
25+
<!-- image lazy-loading & popup & clipboard -->
26+
{% assign urls = urls
1727
| append: ','
18-
| append: site.data.assets[origin]['magnific-popup'].js
28+
| append: site.data.origin[type]['magnific-popup'].js
1929
| append: ','
20-
| append: site.data.assets[origin].clipboard.js
30+
| append: site.data.origin[type].clipboard.js
2131
%}
2232
{% endunless %}
23-
24-
{% include jsdelivr-combine.html urls=_urls %}
2533
{% endif %}
2634

2735
{% if page.layout == 'home'
@@ -32,29 +40,39 @@
3240
%}
3341
{% assign locale = site.lang | split: '-' | first %}
3442

35-
{% assign _urls = site.data.assets[origin].dayjs.js.common
43+
{% assign urls = urls
44+
| append: ','
45+
| append: site.data.origin[type].dayjs.js.common
3646
| append: ','
37-
| append: site.data.assets[origin].dayjs.js.locale
47+
| append: site.data.origin[type].dayjs.js.locale
3848
| replace: ':LOCALE', locale
3949
| append: ','
40-
| append: site.data.assets[origin].dayjs.js.relativeTime
50+
| append: site.data.origin[type].dayjs.js.relativeTime
4151
| append: ','
42-
| append: site.data.assets[origin].dayjs.js.localizedFormat
52+
| append: site.data.origin[type].dayjs.js.localizedFormat
4353
%}
54+
{% endif %}
4455

45-
{% include jsdelivr-combine.html urls=_urls %}
56+
{% if page.content contains '<h2' or page.content contains '<h3' and site.toc and page.toc %}
57+
{% assign urls = urls | append: ',' | append: site.data.origin[type].toc.js %}
4658
{% endif %}
4759

60+
{% if page.mermaid %}
61+
{% assign urls = urls | append: ',' | append: site.data.origin[type].mermaid.js %}
62+
{% endif %}
63+
64+
{% include jsdelivr-combine.html urls=urls %}
65+
4866
{% case page.layout %}
4967
{% when 'home', 'categories', 'post', 'page' %}
50-
{% assign type = page.layout %}
68+
{% assign js = page.layout %}
5169
{% when 'archives', 'category', 'tag' %}
52-
{% assign type = 'misc' %}
70+
{% assign js = 'misc' %}
5371
{% else %}
54-
{% assign type = 'commons' %}
72+
{% assign js = 'commons' %}
5573
{% endcase %}
5674

57-
{% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
75+
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
5876
<script defer src="{{ script | relative_url }}"></script>
5977

6078
{% if page.math %}
@@ -76,14 +94,10 @@
7694
}
7795
};
7896
</script>
79-
<script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script>
80-
<script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}"></script>
97+
<script src="{{ site.data.origin[type].polyfill.js | relative_url }}"></script>
98+
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
8199
{% endif %}
82100

83-
<!-- commons -->
84-
85-
<script src="{{ site.data.assets[origin].bootstrap.js | relative_url }}"></script>
86-
87101
{% if jekyll.environment == 'production' %}
88102
<!-- PWA -->
89103
{% if site.pwa.enabled %}

_includes/jsdelivr-combine.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
{% assign domain = 'https://cdn.jsdelivr.net/' %}
66

77
{% for url in urls %}
8-
98
{% if url contains domain %}
109
{% assign url_snippet = url | slice: domain.size, url.size %}
1110

@@ -16,15 +15,10 @@
1615
{% endif %}
1716

1817
{% elsif url contains '//' %}
19-
2018
<script src="{{ url }}"></script>
21-
2219
{% else %}
23-
2420
<script src="{{ url | relative_url }}"></script>
25-
2621
{% endif %}
27-
2822
{% endfor %}
2923

3024
{% if combined_urls %}

0 commit comments

Comments
 (0)