hexo-theme-fluid 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_config.yml +28 -11
- package/layout/_partials/comments/giscus.ejs +36 -0
- package/layout/_partials/header/banner.ejs +2 -2
- package/layout/_partials/header.ejs +1 -1
- package/layout/_partials/post/copyright.ejs +1 -1
- package/layout/index.ejs +6 -6
- package/layout/layout.ejs +1 -1
- package/layout/post.ejs +1 -1
- package/package.json +1 -1
- package/scripts/events/lib/highlight.js +1 -1
- package/scripts/helpers/date.js +25 -0
- package/source/css/_pages/_base/_widget/pagination.styl +6 -3
- package/source/css/_pages/_index/index.styl +4 -1
- package/source/css/_pages/_post/highlight.styl +1 -0
- package/source/js/color-schema.js +14 -5
package/_config.yml
CHANGED
|
@@ -727,7 +727,7 @@ post:
|
|
|
727
727
|
enable: false
|
|
728
728
|
# 指定的插件,需要同时设置对应插件的必要参数
|
|
729
729
|
# The specified plugin needs to set the necessary parameters at the same time
|
|
730
|
-
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis
|
|
730
|
+
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
|
|
731
731
|
type: disqus
|
|
732
732
|
|
|
733
733
|
|
|
@@ -864,6 +864,23 @@ cusdis:
|
|
|
864
864
|
app_id:
|
|
865
865
|
lang: zh-cn
|
|
866
866
|
|
|
867
|
+
# Giscus
|
|
868
|
+
# 基于 GitHub Discussions,类似于 Utterances
|
|
869
|
+
# Based on GitHub Discussions, similar to Utterances
|
|
870
|
+
# See: https://giscus.app/
|
|
871
|
+
giscus:
|
|
872
|
+
repo:
|
|
873
|
+
repo-id:
|
|
874
|
+
category:
|
|
875
|
+
category-id:
|
|
876
|
+
theme-light: light
|
|
877
|
+
theme-dark: dark
|
|
878
|
+
mapping: pathname
|
|
879
|
+
reactions-enabled: 1
|
|
880
|
+
emit-metadata: 0
|
|
881
|
+
input-position: top
|
|
882
|
+
lang: zh-CN
|
|
883
|
+
|
|
867
884
|
#---------------------------
|
|
868
885
|
# 归档页
|
|
869
886
|
# Archive Page
|
|
@@ -1014,13 +1031,13 @@ links:
|
|
|
1014
1031
|
enable: false
|
|
1015
1032
|
# 指定的插件,需要同时设置对应插件的必要参数
|
|
1016
1033
|
# The specified plugin needs to set the necessary parameters at the same time
|
|
1017
|
-
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis
|
|
1034
|
+
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
|
|
1018
1035
|
type: disqus
|
|
1019
1036
|
|
|
1020
1037
|
|
|
1021
1038
|
#---------------------------
|
|
1022
1039
|
# 以下是配置 JS CSS 等静态资源的 URL 前缀,可以自定义成 CDN 地址,
|
|
1023
|
-
#
|
|
1040
|
+
# 如果需要修改,最好使用与默认配置相同的版本,以避免潜在的问题,
|
|
1024
1041
|
# ** 如果你不知道如何设置,请不要做任何改动 **
|
|
1025
1042
|
#
|
|
1026
1043
|
# Here is the url prefix to configure the static assets. Set CDN addresses you want to customize.
|
|
@@ -1043,9 +1060,9 @@ static_prefix:
|
|
|
1043
1060
|
|
|
1044
1061
|
bootstrap: https://lib.baomitu.com/twitter-bootstrap/4.6.1/
|
|
1045
1062
|
|
|
1046
|
-
prismjs: https://lib.baomitu.com/prism/1.
|
|
1063
|
+
prismjs: https://lib.baomitu.com/prism/1.27.0/
|
|
1047
1064
|
|
|
1048
|
-
tocbot: https://lib.baomitu.com/tocbot/4.18.
|
|
1065
|
+
tocbot: https://lib.baomitu.com/tocbot/4.18.2/
|
|
1049
1066
|
|
|
1050
1067
|
typed: https://lib.baomitu.com/typed.js/2.0.12/
|
|
1051
1068
|
|
|
@@ -1053,24 +1070,24 @@ static_prefix:
|
|
|
1053
1070
|
|
|
1054
1071
|
nprogress: https://lib.baomitu.com/nprogress/0.2.0/
|
|
1055
1072
|
|
|
1056
|
-
mathjax: https://lib.baomitu.com/mathjax/3.2.
|
|
1073
|
+
mathjax: https://lib.baomitu.com/mathjax/3.2.1/
|
|
1057
1074
|
|
|
1058
|
-
katex: https://lib.baomitu.com/KaTeX/0.15.
|
|
1075
|
+
katex: https://lib.baomitu.com/KaTeX/0.15.6/
|
|
1059
1076
|
|
|
1060
1077
|
busuanzi: https://busuanzi.ibruce.info/busuanzi/2.3/
|
|
1061
1078
|
|
|
1062
1079
|
clipboard: https://lib.baomitu.com/clipboard.js/2.0.10/
|
|
1063
1080
|
|
|
1064
|
-
mermaid: https://lib.baomitu.com/mermaid/8.
|
|
1081
|
+
mermaid: https://lib.baomitu.com/mermaid/8.14.0/
|
|
1065
1082
|
|
|
1066
|
-
valine: https://lib.baomitu.com/valine/1.4.
|
|
1083
|
+
valine: https://lib.baomitu.com/valine/1.4.18/
|
|
1067
1084
|
|
|
1068
|
-
waline: https://lib.baomitu.com/waline/2.
|
|
1085
|
+
waline: https://lib.baomitu.com/waline/2.5.1/
|
|
1069
1086
|
|
|
1070
1087
|
gitalk: https://lib.baomitu.com/gitalk/1.7.2/
|
|
1071
1088
|
|
|
1072
1089
|
disqusjs: https://lib.baomitu.com/disqusjs/1.3.0/
|
|
1073
1090
|
|
|
1074
|
-
twikoo: https://lib.baomitu.com/twikoo/1.
|
|
1091
|
+
twikoo: https://lib.baomitu.com/twikoo/1.5.11/
|
|
1075
1092
|
|
|
1076
1093
|
hint: https://lib.baomitu.com/hint.css/2.7.0/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<% if (theme.giscus && theme.giscus['repo'] && theme.giscus['repo-id']) { %>
|
|
2
|
+
<div id="giscus" class="giscus"></div>
|
|
3
|
+
<script type="text/javascript">
|
|
4
|
+
Fluid.utils.loadComments('#giscus', function() {
|
|
5
|
+
var options = <%- JSON.stringify(theme.giscus || {}) %>;
|
|
6
|
+
var attributes = {};
|
|
7
|
+
for (let option in options) {
|
|
8
|
+
if (!option.startsWith('theme-')) {
|
|
9
|
+
var key = option.startsWith('data-') ? option : 'data-' + option;
|
|
10
|
+
attributes[key] = options[option];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
var light = '<%= theme.giscus['theme-light'] || 'light' %>';
|
|
14
|
+
var dark = '<%= theme.giscus['theme-dark'] || 'dark' %>';
|
|
15
|
+
window.GiscusThemeLight = light;
|
|
16
|
+
window.GiscusThemeDark = dark;
|
|
17
|
+
attributes['data-theme'] = document.documentElement.getAttribute('data-user-color-scheme') === 'dark' ? dark : light;
|
|
18
|
+
for (let attribute in attributes) {
|
|
19
|
+
var value = attributes[attribute];
|
|
20
|
+
if (value === undefined || value === null || value === '') {
|
|
21
|
+
delete attributes[attribute];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var s = document.createElement('script');
|
|
25
|
+
s.setAttribute('src', 'https://giscus.app/client.js');
|
|
26
|
+
s.setAttribute('crossorigin', 'anonymous');
|
|
27
|
+
for (let attribute in attributes) {
|
|
28
|
+
s.setAttribute(attribute, attributes[attribute]);
|
|
29
|
+
}
|
|
30
|
+
var ss = document.getElementsByTagName('script');
|
|
31
|
+
var e = ss.length > 0 ? ss[ss.length - 1] : document.head || document.documentElement;
|
|
32
|
+
e.parentNode.insertBefore(s, e.nextSibling);
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
<noscript>Please enable JavaScript to view the comments</noscript>
|
|
36
|
+
<% } %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%
|
|
2
2
|
var banner_img = page.banner_img || theme.index.banner_img
|
|
3
|
-
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
|
|
4
|
-
var banner_mask_alpha = parseFloat(page.banner_mask_alpha || theme.index.banner_mask_alpha)
|
|
3
|
+
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
|
|
4
|
+
var banner_mask_alpha = parseFloat(page.banner_mask_alpha || theme.index.banner_mask_alpha)
|
|
5
5
|
var subtitle = page.subtitle || page.title
|
|
6
6
|
%>
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%
|
|
2
|
-
var banner_img_height =
|
|
2
|
+
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
|
|
3
3
|
%>
|
|
4
4
|
|
|
5
5
|
<div class="header-inner" style="height: <%= banner_img_height %>vh;">
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<div><%= full_date(page.date, theme.post.copyright.post_date.format || 'LL') %></div>
|
|
28
28
|
</div>
|
|
29
29
|
<% } %>
|
|
30
|
-
<% if (theme.post.copyright.update_date.enable && page.updated) { %>
|
|
30
|
+
<% if (theme.post.copyright.update_date.enable && page.updated && compare_date(page.date, page.updated)) { %>
|
|
31
31
|
<div class="license-meta-item license-meta-date">
|
|
32
32
|
<div><%- __('post.copyright.updated') %></div>
|
|
33
33
|
<div><%= full_date(page.updated, theme.post.copyright.update_date.format || 'LL') %></div>
|
package/layout/index.ejs
CHANGED
|
@@ -10,7 +10,7 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
|
|
|
10
10
|
<% page.posts.each(function (post) { %>
|
|
11
11
|
<div class="row mx-auto index-card">
|
|
12
12
|
<% var post_url = url_for(post.path), index_img = post.index_img || theme.post.default_index_img %>
|
|
13
|
-
<% if(index_img) { %>
|
|
13
|
+
<% if (index_img) { %>
|
|
14
14
|
<div class="col-12 col-md-4 m-auto index-img">
|
|
15
15
|
<a href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
|
|
16
16
|
<img src="<%= url_for(index_img) %>" alt="<%= post.title %>">
|
|
@@ -27,15 +27,15 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
|
|
|
27
27
|
</a>
|
|
28
28
|
</h1>
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
<% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
|
|
31
|
+
<a class="index-excerpt <%= index_img ? '' : 'index-excerpt__noimg' %>" href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
|
|
31
32
|
<div>
|
|
32
|
-
<% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
|
|
33
33
|
<%- escape_html(strip_html(excerpt).substring(0, 200).trim()).replace(/\n/g, ' ') %>
|
|
34
34
|
</div>
|
|
35
35
|
</a>
|
|
36
36
|
|
|
37
37
|
<div class="index-btm post-metas">
|
|
38
|
-
<% if(theme.index.post_meta.date
|
|
38
|
+
<% if (theme.index.post_meta.date) { %>
|
|
39
39
|
<div class="post-meta mr-3">
|
|
40
40
|
<i class="iconfont icon-date"></i>
|
|
41
41
|
<time datetime="<%= full_date(post.date, 'YYYY-MM-DD HH:mm') %>" pubdate>
|
|
@@ -43,13 +43,13 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
|
|
|
43
43
|
</time>
|
|
44
44
|
</div>
|
|
45
45
|
<% } %>
|
|
46
|
-
<% if(theme.index.post_meta.category && post.categories.length > 0) { %>
|
|
46
|
+
<% if (theme.index.post_meta.category && post.categories.length > 0) { %>
|
|
47
47
|
<div class="post-meta mr-3 d-flex align-items-center">
|
|
48
48
|
<i class="iconfont icon-category"></i>
|
|
49
49
|
<%- partial('_partials/category-chains', { categories: post.categories, limit: 1 }) %>
|
|
50
50
|
</div>
|
|
51
51
|
<% } %>
|
|
52
|
-
<% if(theme.index.post_meta.tag && post.tags.length > 0) { %>
|
|
52
|
+
<% if (theme.index.post_meta.tag && post.tags.length > 0) { %>
|
|
53
53
|
<div class="post-meta">
|
|
54
54
|
<i class="iconfont icon-tags"></i>
|
|
55
55
|
<% post.tags.each(function(tag){ %>
|
package/layout/layout.ejs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%
|
|
2
|
-
var banner_img_height =
|
|
2
|
+
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
|
|
3
3
|
var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.default ? theme.dark_mode.default : ''
|
|
4
4
|
%>
|
|
5
5
|
|
package/layout/post.ejs
CHANGED
|
@@ -16,7 +16,7 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
|
|
|
16
16
|
<article class="post-content mx-auto">
|
|
17
17
|
<!-- SEO header -->
|
|
18
18
|
<h1 style="display: none"><%= page.subtitle || page.title %></h1>
|
|
19
|
-
<% if(theme.post.updated && theme.post.updated.
|
|
19
|
+
<% if (theme.post.updated.enable && theme.post.updated && compare_date(page.date, page.updated)) { %>
|
|
20
20
|
<p class="note note-<%= theme.post.updated.note_class || 'info' %>">
|
|
21
21
|
<% if (theme.post.updated.relative) { %>
|
|
22
22
|
<% if (theme.post.updated.content) { %>
|
package/package.json
CHANGED
|
@@ -134,7 +134,7 @@ module.exports = (hexo) => {
|
|
|
134
134
|
.replace(/<span[^>]+?>(.+?)<\/span>/gims, '$1');
|
|
135
135
|
return str;
|
|
136
136
|
}
|
|
137
|
-
return `<div class="code-wrapper">${str}</div>`;
|
|
137
|
+
return `<figure><div class="code-wrapper">${str}</div></figure>`;
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
// 适配缩进型代码块
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* global hexo */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const moment = require('moment');
|
|
6
|
+
const { isMoment } = moment;
|
|
7
|
+
|
|
8
|
+
hexo.extend.helper.register('compare_date', function(date1, date2) {
|
|
9
|
+
if (!date1) {
|
|
10
|
+
return -1;
|
|
11
|
+
}
|
|
12
|
+
if (!date2) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
const m1 = isMoment(date1) ? date1 : moment(date1);
|
|
16
|
+
const m2 = isMoment(date2) ? date2 : moment(date2);
|
|
17
|
+
const diff = m1.diff(m2);
|
|
18
|
+
if (diff < 0) {
|
|
19
|
+
return -1;
|
|
20
|
+
} else if (diff > 0) {
|
|
21
|
+
return 1;
|
|
22
|
+
} else {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.space
|
|
7
7
|
align-self flex-end
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
.page-number, .current, .extend
|
|
10
10
|
outline 0
|
|
11
11
|
border 0
|
|
12
12
|
background-color transparent
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
padding .5rem .75rem
|
|
15
15
|
line-height 1.25
|
|
16
16
|
border-radius .125rem
|
|
17
|
-
transition background-color .2s ease-in-out
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
.page-number
|
|
19
|
+
margin 0 .05rem
|
|
20
|
+
|
|
21
|
+
.page-number:hover, .current
|
|
22
|
+
transition background-color .2s ease-in-out
|
|
20
23
|
background-color var(--link-hover-bg-color)
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
height calc(1.4rem * 3)
|
|
46
46
|
overflow hidden
|
|
47
47
|
display flex
|
|
48
|
-
align-items center
|
|
49
48
|
|
|
50
49
|
& > div
|
|
51
50
|
width 100%
|
|
@@ -55,6 +54,10 @@
|
|
|
55
54
|
-webkit-box-orient vertical
|
|
56
55
|
-webkit-line-clamp 3
|
|
57
56
|
|
|
57
|
+
.index-excerpt__noimg
|
|
58
|
+
height auto
|
|
59
|
+
max-height calc(1.4rem * 3)
|
|
60
|
+
|
|
58
61
|
@media (max-width: 767px)
|
|
59
62
|
.index-info
|
|
60
63
|
padding-top 1.25rem
|
|
@@ -226,16 +226,25 @@
|
|
|
226
226
|
// 设置 utterances 评论主题
|
|
227
227
|
var utterances = document.querySelector('.utterances-frame');
|
|
228
228
|
if (utterances) {
|
|
229
|
-
var
|
|
230
|
-
if (schema === 'dark') {
|
|
231
|
-
theme = window.UtterancesThemeDark;
|
|
232
|
-
}
|
|
229
|
+
var utterancesTheme = schema === 'dark' ? window.UtterancesThemeDark : window.UtterancesThemeLight;
|
|
233
230
|
const message = {
|
|
234
231
|
type : 'set-theme',
|
|
235
|
-
theme:
|
|
232
|
+
theme: utterancesTheme
|
|
236
233
|
};
|
|
237
234
|
utterances.contentWindow.postMessage(message, 'https://utteranc.es');
|
|
238
235
|
}
|
|
236
|
+
|
|
237
|
+
// 设置 giscus 评论主题
|
|
238
|
+
var giscus = document.querySelector('iframe.giscus-frame');
|
|
239
|
+
if (giscus) {
|
|
240
|
+
var giscusTheme = schema === 'dark' ? window.GiscusThemeDark : window.GiscusThemeLight;
|
|
241
|
+
const message = {
|
|
242
|
+
setConfig: {
|
|
243
|
+
theme: giscusTheme,
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
giscus.contentWindow.postMessage({ 'giscus': message }, 'https://giscus.app');
|
|
247
|
+
}
|
|
239
248
|
}
|
|
240
249
|
|
|
241
250
|
// 当页面加载时,将显示模式设置为 localStorage 中自定义的值(如果有的话)
|