hexo-theme-fluid 1.9.0 → 1.9.3
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 +31 -14
- package/languages/ru.yml +69 -0
- package/layout/_partials/category-list.ejs +2 -2
- package/layout/_partials/comments/giscus.ejs +36 -0
- package/layout/_partials/head.ejs +2 -1
- package/layout/_partials/header/banner.ejs +2 -2
- package/layout/_partials/header.ejs +1 -1
- package/layout/_partials/markdown-plugins.ejs +24 -0
- package/layout/_partials/plugins/analytics.ejs +6 -6
- package/layout/_partials/plugins/anchorjs.ejs +15 -0
- package/layout/_partials/plugins/code-widget.ejs +4 -68
- package/layout/_partials/plugins/encrypt.ejs +18 -0
- package/layout/_partials/plugins/math.ejs +34 -29
- package/layout/_partials/plugins/mermaid.ejs +6 -0
- package/layout/_partials/post/category-bar.ejs +5 -5
- package/layout/_partials/post/copyright.ejs +19 -17
- package/layout/_partials/post/toc.ejs +17 -5
- package/layout/_partials/scripts.ejs +0 -1
- package/layout/about.ejs +1 -1
- package/layout/index.ejs +7 -7
- package/layout/layout.ejs +1 -1
- package/layout/links.ejs +1 -0
- package/layout/page.ejs +1 -24
- package/layout/post.ejs +12 -28
- package/package.json +1 -1
- package/scripts/events/lib/footnote.js +10 -10
- package/scripts/events/lib/highlight.js +14 -18
- package/scripts/helpers/date.js +25 -0
- package/scripts/helpers/scope.js +11 -5
- package/scripts/helpers/wordcount.js +3 -7
- package/source/css/_pages/_base/_widget/header.styl +1 -0
- package/source/css/_pages/_base/_widget/pagination.styl +6 -3
- package/source/css/_pages/_category/category-bar.styl +1 -2
- package/source/css/_pages/_index/index.styl +4 -1
- package/source/css/_pages/_post/highlight.styl +3 -0
- package/source/css/_pages/_post/markdown.styl +3 -2
- package/source/css/_pages/_post/post-page.styl +0 -4
- package/source/css/_variables/base.styl +2 -2
- package/source/js/boot.js +6 -0
- package/source/js/color-schema.js +14 -5
- package/source/js/events.js +17 -0
- package/source/js/leancloud.js +4 -6
- package/source/js/plugins.js +65 -0
- package/source/js/utils.js +13 -1
- package/layout/.DS_Store +0 -0
- package/scripts/.DS_Store +0 -0
- package/scripts/events/.DS_Store +0 -0
- package/scripts/utils/.DS_Store +0 -0
- package/source/.DS_Store +0 -0
- package/source/img/.DS_Store +0 -0
package/_config.yml
CHANGED
|
@@ -291,7 +291,7 @@ web_analytics: # 网页访问统计
|
|
|
291
291
|
# Get the attribute of the page path during statistics
|
|
292
292
|
path: window.location.pathname
|
|
293
293
|
# 开启后不统计本地路径( localhost 与 127.0.0.1 )
|
|
294
|
-
# If
|
|
294
|
+
# If true, ignore localhost & 127.0.0.1
|
|
295
295
|
ignore_local: false
|
|
296
296
|
|
|
297
297
|
# 对页面中的图片和评论插件进行懒加载处理,可见范围外的元素不会提前加载
|
|
@@ -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.28.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.2/
|
|
1057
1074
|
|
|
1058
|
-
katex: https://lib.baomitu.com/KaTeX/0.
|
|
1075
|
+
katex: https://lib.baomitu.com/KaTeX/0.16.2/
|
|
1059
1076
|
|
|
1060
1077
|
busuanzi: https://busuanzi.ibruce.info/busuanzi/2.3/
|
|
1061
1078
|
|
|
1062
|
-
clipboard: https://lib.baomitu.com/clipboard.js/2.0.
|
|
1079
|
+
clipboard: https://lib.baomitu.com/clipboard.js/2.0.11/
|
|
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.
|
|
1083
|
+
valine: https://lib.baomitu.com/valine/1.5.1/
|
|
1067
1084
|
|
|
1068
|
-
waline: https://lib.baomitu.com/waline/2.3
|
|
1085
|
+
waline: https://lib.baomitu.com/waline/2.6.3/
|
|
1069
1086
|
|
|
1070
|
-
gitalk: https://lib.baomitu.com/gitalk/1.
|
|
1087
|
+
gitalk: https://lib.baomitu.com/gitalk/1.8.0/
|
|
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.6.7/
|
|
1075
1092
|
|
|
1076
1093
|
hint: https://lib.baomitu.com/hint.css/2.7.0/
|
package/languages/ru.yml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: 'Русский'
|
|
2
|
+
|
|
3
|
+
home:
|
|
4
|
+
menu: 'Главная'
|
|
5
|
+
title: 'Главная'
|
|
6
|
+
|
|
7
|
+
archive:
|
|
8
|
+
menu: 'Архивы'
|
|
9
|
+
title: 'Архивы'
|
|
10
|
+
subtitle: 'Архивы'
|
|
11
|
+
post_total: '%d сообщений всего'
|
|
12
|
+
|
|
13
|
+
category:
|
|
14
|
+
menu: 'Категории'
|
|
15
|
+
title: 'Категории'
|
|
16
|
+
subtitle: 'Категории'
|
|
17
|
+
post_total: '%d сообщений всего'
|
|
18
|
+
more: 'More...'
|
|
19
|
+
|
|
20
|
+
tag:
|
|
21
|
+
menu: 'Теги'
|
|
22
|
+
title: 'Теги'
|
|
23
|
+
subtitle: 'Теги'
|
|
24
|
+
post_total: '%d сообщений всего'
|
|
25
|
+
|
|
26
|
+
about:
|
|
27
|
+
menu: 'О'
|
|
28
|
+
title: 'О'
|
|
29
|
+
subtitle: 'О'
|
|
30
|
+
|
|
31
|
+
links:
|
|
32
|
+
menu: 'Ссылки'
|
|
33
|
+
title: 'Ссылки'
|
|
34
|
+
subtitle: 'Ссылки'
|
|
35
|
+
|
|
36
|
+
page404:
|
|
37
|
+
menu: 'Страница не найдена'
|
|
38
|
+
title: 'Страница не найдена'
|
|
39
|
+
subtitle: 'Страница не найдена'
|
|
40
|
+
|
|
41
|
+
post:
|
|
42
|
+
toc: 'Оглавление'
|
|
43
|
+
prev_post: 'Предыдущий'
|
|
44
|
+
next_post: 'Следующий'
|
|
45
|
+
updated: 'Последнее обновление %s'
|
|
46
|
+
meta:
|
|
47
|
+
wordcount: '%s слов'
|
|
48
|
+
min2read: '%s минут'
|
|
49
|
+
views: '{} просмотров'
|
|
50
|
+
copyright:
|
|
51
|
+
author: 'Автор'
|
|
52
|
+
posted: 'Опубликовано на'
|
|
53
|
+
updated: 'Обновлено'
|
|
54
|
+
license: 'Лицензировано под'
|
|
55
|
+
CC: 'CC - Creative Commons license'
|
|
56
|
+
BY: 'BY - Attribution'
|
|
57
|
+
SA: 'SA - Share-alike'
|
|
58
|
+
NC: 'NC - Non-commercial'
|
|
59
|
+
ND: 'ND - No derivative works'
|
|
60
|
+
|
|
61
|
+
footer:
|
|
62
|
+
pv: 'Просмотров: {}'
|
|
63
|
+
uv: 'Посетителей: {}'
|
|
64
|
+
|
|
65
|
+
search:
|
|
66
|
+
title: 'Поиск'
|
|
67
|
+
keyword: 'Ключевое слово'
|
|
68
|
+
|
|
69
|
+
noscript_warning: 'Блог лучше всего работает с включенным JavaScript'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<% return curCats.each((cat) => { %>
|
|
3
3
|
<% var subCats = site.categories.find({ parent: cat._id }).sort(params.orderBy || 'name').filter(cat => cat.length) %>
|
|
4
4
|
<% var collapsed = subCats.length === 0 || depth >= theme.category.collapse_depth %>
|
|
5
|
-
<% if ((params.
|
|
5
|
+
<% if ((params.filterIds || []).includes(cat._id)) collapsed = false %>
|
|
6
6
|
<div class="<%= depth <= 0 ? 'category' : 'category-sub' %> row nomargin-x">
|
|
7
7
|
<a class="<%= depth <= 0 ? 'category-item' : 'category-subitem' %> <%= collapsed ? 'collapsed' : '' %>
|
|
8
8
|
list-group-item category-item-action col-10 col-md-11 col-xm-11" title="<%= cat.name.trim() %>"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<% } else { %>
|
|
50
50
|
<a href="<%= url_for(post.path) %>" title="<%= post.title %>"
|
|
51
51
|
class="list-group-item list-group-item-action
|
|
52
|
-
<%= (params.
|
|
52
|
+
<%= (params.filterIds || []).includes(post._id) ? 'active' : '' %>">
|
|
53
53
|
<span class="category-post"><%= post.title %></span>
|
|
54
54
|
</a>
|
|
55
55
|
<% } %>
|
|
@@ -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
|
+
<% } %>
|
|
@@ -7,7 +7,7 @@ if (keywords instanceof Array) {
|
|
|
7
7
|
}
|
|
8
8
|
var description = page.description || page.excerpt || (is_post() && page.content) || config.description
|
|
9
9
|
if (description) {
|
|
10
|
-
description =
|
|
10
|
+
description = strip_html(description).substring(0, 200).trim().replace(/\n/g, ' ')
|
|
11
11
|
}
|
|
12
12
|
var ogImage = page.og_img || page.index_img
|
|
13
13
|
var ogConfig = Object.assign({ image: ogImage && url_for(ogImage) }, theme.open_graph)
|
|
@@ -43,6 +43,7 @@ var ogConfig = Object.assign({ image: ogImage && url_for(ogImage) }, theme.open_
|
|
|
43
43
|
<%- export_config() %>
|
|
44
44
|
<%- js_ex(theme.static_prefix.internal_js, 'utils.js') %>
|
|
45
45
|
<%- js_ex(theme.static_prefix.internal_js, 'color-schema.js') %>
|
|
46
|
+
<%- partial('_partials/plugins/analytics.ejs') %>
|
|
46
47
|
|
|
47
48
|
<%- inject_point('head') %>
|
|
48
49
|
</head>
|
|
@@ -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;">
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<% import_css(theme.static_prefix.github_markdown, 'github-markdown.min.css') %>
|
|
2
|
+
<% import_css(theme.static_prefix.hint, 'hint.min.css') %>
|
|
3
|
+
|
|
4
|
+
<% if (theme.code.highlight.enable) { %>
|
|
5
|
+
<%- partial('_partials/plugins/highlight.ejs') %>
|
|
6
|
+
<% } %>
|
|
7
|
+
<% if ((theme.code.language.enable && theme.code.language.default) || theme.code.copy_btn) { %>
|
|
8
|
+
<%- partial('_partials/plugins/code-widget.ejs') %>
|
|
9
|
+
<% } %>
|
|
10
|
+
<% if (theme.fun_features.anchorjs.enable && page.anchorjs !== false) { %>
|
|
11
|
+
<%- partial('_partials/plugins/anchorjs.ejs') %>
|
|
12
|
+
<% } %>
|
|
13
|
+
<% if (theme.post.image_zoom.enable && page.image_zoom !== false) { %>
|
|
14
|
+
<%- partial('_partials/plugins/fancybox.ejs') %>
|
|
15
|
+
<% } %>
|
|
16
|
+
<% if (theme.post.image_caption.enable) { %>
|
|
17
|
+
<% import_script('<script>Fluid.plugins.imageCaption();</script>') %>
|
|
18
|
+
<% } %>
|
|
19
|
+
<% if (theme.post.math.enable && (!theme.post.math.specific || (theme.post.math.specific && page.math))) { %>
|
|
20
|
+
<%- partial('_partials/plugins/math.ejs') %>
|
|
21
|
+
<% } %>
|
|
22
|
+
<% if (theme.post.mermaid.enable && (!theme.post.mermaid.specific || (theme.post.mermaid.specific && page.mermaid))) { %>
|
|
23
|
+
<%- partial('_partials/plugins/mermaid.ejs') %>
|
|
24
|
+
<% } %>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<% if(theme.web_analytics.baidu) { %>
|
|
4
4
|
<!-- Baidu Analytics -->
|
|
5
|
-
<script
|
|
5
|
+
<script async>
|
|
6
6
|
if (!Fluid.ctx.dnt) {
|
|
7
7
|
var _hmt = _hmt || [];
|
|
8
8
|
(function() {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<% if (theme.web_analytics.google){ %>
|
|
19
19
|
<!-- Google Analytics -->
|
|
20
|
-
<script
|
|
20
|
+
<script async>
|
|
21
21
|
if (!Fluid.ctx.dnt) {
|
|
22
22
|
Fluid.utils.createScript('https://www.google-analytics.com/analytics.js', function() {
|
|
23
23
|
window.ga = window.ga || function() { (ga.q = ga.q || []).push(arguments) };
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
<% if (theme.web_analytics.gtag){ %>
|
|
33
33
|
<!-- Google gtag.js -->
|
|
34
|
-
<script
|
|
34
|
+
<script async>
|
|
35
35
|
if (!Fluid.ctx.dnt) {
|
|
36
36
|
Fluid.utils.createScript('https://www.googletagmanager.com/gtag/js?id=<%= theme.web_analytics.gtag %>', function() {
|
|
37
37
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
<% if(theme.web_analytics.tencent && theme.web_analytics.tencent.sid && theme.web_analytics.tencent.cid) { %>
|
|
47
47
|
<!-- Tencent Analytics -->
|
|
48
|
-
<script
|
|
48
|
+
<script async>
|
|
49
49
|
if (!Fluid.ctx.dnt) {
|
|
50
50
|
var _mtac = {};
|
|
51
51
|
(function() {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
|
|
66
66
|
<% if(theme.web_analytics.woyaola) { %>
|
|
67
67
|
<!-- 51.la Analytics -->
|
|
68
|
-
<script
|
|
68
|
+
<script async>
|
|
69
69
|
if (!Fluid.ctx.dnt) {
|
|
70
70
|
Fluid.utils.createScript('//js.users.51.la/<%= theme.web_analytics.woyaola %>.js');
|
|
71
71
|
}
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
|
|
75
75
|
<% if(theme.web_analytics.cnzz) { %>
|
|
76
76
|
<!-- cnzz Analytics -->
|
|
77
|
-
<script
|
|
77
|
+
<script async>
|
|
78
78
|
if (!Fluid.ctx.dnt) {
|
|
79
79
|
Fluid.utils.createScript('//s4.cnzz.com/z_stat.php?id=<%= theme.web_analytics.cnzz %>&show=pic');
|
|
80
80
|
}
|
|
@@ -18,6 +18,21 @@ import_script(`
|
|
|
18
18
|
window.anchors.options.class = 'anchorjs-link-left';
|
|
19
19
|
}
|
|
20
20
|
window.anchors.add(res.join(', '));
|
|
21
|
+
|
|
22
|
+
Fluid.events.registerRefreshCallback(function() {
|
|
23
|
+
if ('anchors' in window) {
|
|
24
|
+
anchors.removeAll();
|
|
25
|
+
var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
|
|
26
|
+
var res = [];
|
|
27
|
+
for (var item of el) {
|
|
28
|
+
res.push('.markdown-body > ' + item.trim());
|
|
29
|
+
}
|
|
30
|
+
if (CONFIG.anchorjs.placement === 'left') {
|
|
31
|
+
anchors.options.class = 'anchorjs-link-left';
|
|
32
|
+
}
|
|
33
|
+
anchors.add(res.join(', '));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
21
36
|
});
|
|
22
37
|
</script>
|
|
23
38
|
`)
|
|
@@ -1,71 +1,7 @@
|
|
|
1
1
|
<%
|
|
2
|
-
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!enableLang && !enableCopy) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function getBgClass(ele) {
|
|
11
|
-
return Fluid.utils.getBackgroundLightness(ele) >= 0 ? 'code-widget-light' : 'code-widget-dark';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
var copyTmpl = '';
|
|
15
|
-
copyTmpl += '<div class="code-widget">';
|
|
16
|
-
copyTmpl += 'LANG';
|
|
17
|
-
copyTmpl += '</div>';
|
|
18
|
-
jQuery('.markdown-body pre').each(function() {
|
|
19
|
-
var $pre = jQuery(this);
|
|
20
|
-
if ($pre.find('code.mermaid').length > 0) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if ($pre.find('span.line').length > 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var lang = '';
|
|
28
|
-
|
|
29
|
-
if (enableLang) {
|
|
30
|
-
lang = CONFIG.code_language.default;
|
|
31
|
-
if ($pre[0].children.length > 0 && $pre[0].children[0].classList.length >= 2 && $pre.children().hasClass('hljs')) {
|
|
32
|
-
lang = $pre[0].children[0].classList[1];
|
|
33
|
-
} else if ($pre[0].getAttribute('data-language')) {
|
|
34
|
-
lang = $pre[0].getAttribute('data-language');
|
|
35
|
-
} else if ($pre.parent().hasClass('sourceCode') && $pre[0].children.length > 0 && $pre[0].children[0].classList.length >= 2) {
|
|
36
|
-
lang = $pre[0].children[0].classList[1];
|
|
37
|
-
$pre.parent().addClass('code-wrapper');
|
|
38
|
-
} else if ($pre.parent().hasClass('markdown-body') && $pre[0].classList.length === 0) {
|
|
39
|
-
$pre.wrap('<div class="code-wrapper"></div>');
|
|
40
|
-
}
|
|
41
|
-
lang = lang.toUpperCase().replace('NONE', CONFIG.code_language.default);
|
|
42
|
-
}
|
|
43
|
-
$pre.append(copyTmpl.replace('LANG', lang).replace('code-widget">',
|
|
44
|
-
getBgClass($pre[0]) + (enableCopy ? ' code-widget copy-btn" data-clipboard-snippet><i class="iconfont icon-copy"></i>' : ' code-widget">')));
|
|
45
|
-
|
|
46
|
-
if (enableCopy) {
|
|
47
|
-
Fluid.utils.createScript('${url_join(theme.static_prefix.clipboard, 'clipboard.min.js')}', function() {
|
|
48
|
-
var clipboard = new window.ClipboardJS('.copy-btn', {
|
|
49
|
-
target: function(trigger) {
|
|
50
|
-
var nodes = trigger.parentNode.childNodes;
|
|
51
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
52
|
-
if (nodes[i].tagName === 'CODE') {
|
|
53
|
-
return nodes[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
clipboard.on('success', function(e) {
|
|
59
|
-
e.clearSelection();
|
|
60
|
-
e.trigger.innerHTML = e.trigger.innerHTML.replace('icon-copy', 'icon-success');
|
|
61
|
-
setTimeout(function() {
|
|
62
|
-
e.trigger.innerHTML = e.trigger.innerHTML.replace('icon-success', 'icon-copy');
|
|
63
|
-
}, 2000);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
})();
|
|
69
|
-
</script>
|
|
2
|
+
if (theme.code.copy_btn) {
|
|
3
|
+
import_script(`<script src=${url_join(theme.static_prefix.clipboard, 'clipboard.min.js')}></script>`)
|
|
4
|
+
}
|
|
5
|
+
import_script(`<script>Fluid.plugins.codeWidget();</script>
|
|
70
6
|
`)
|
|
71
7
|
%>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%
|
|
2
|
+
import_script(`
|
|
3
|
+
<script defer>
|
|
4
|
+
if (document.getElementById('hbePass')) {
|
|
5
|
+
Fluid.utils.waitElementLoaded('hbe-prefix', function() {
|
|
6
|
+
var hbePrefix = document.querySelector('hbe-prefix');
|
|
7
|
+
hbePrefix.parentElement.classList.add('markdown-body');
|
|
8
|
+
Fluid.utils.retry(function() {
|
|
9
|
+
if (Fluid.boot && Fluid.boot.refresh) {
|
|
10
|
+
Fluid.boot.refresh();
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}, 100, 10);
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
`)
|
|
18
|
+
%>
|
|
@@ -4,37 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
import_script(`
|
|
6
6
|
<script>
|
|
7
|
-
MathJax
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, '', false],
|
|
27
|
-
insertedScript: [200, () => {
|
|
28
|
-
document.querySelectorAll('mjx-container').forEach(node => {
|
|
29
|
-
let target = node.parentNode;
|
|
30
|
-
if (target.nodeName.toLowerCase() === 'li') {
|
|
31
|
-
target.parentNode.classList.add('has-jax');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}, '', false]
|
|
7
|
+
if (!window.MathJax) {
|
|
8
|
+
window.MathJax = {
|
|
9
|
+
tex : {
|
|
10
|
+
inlineMath: { '[+]': [['$', '$']] }
|
|
11
|
+
},
|
|
12
|
+
loader : {
|
|
13
|
+
${ lazy ? 'load: \[\'ui/lazy\'\]' : '' }
|
|
14
|
+
},
|
|
15
|
+
options: {
|
|
16
|
+
renderActions: {
|
|
17
|
+
insertedScript: [200, () => {
|
|
18
|
+
document.querySelectorAll('mjx-container').forEach(node => {
|
|
19
|
+
let target = node.parentNode;
|
|
20
|
+
if (target.nodeName.toLowerCase() === 'li') {
|
|
21
|
+
target.parentNode.classList.add('has-jax');
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}, '', false]
|
|
25
|
+
}
|
|
35
26
|
}
|
|
27
|
+
};
|
|
28
|
+
} else {
|
|
29
|
+
MathJax.startup.document.state(0);
|
|
30
|
+
MathJax.texReset();
|
|
31
|
+
MathJax.typeset();
|
|
32
|
+
MathJax.typesetPromise();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Fluid.events.registerRefreshCallback(function() {
|
|
36
|
+
if ('MathJax' in window && MathJax.startup.document && typeof MathJax.startup.document.state === 'function') {
|
|
37
|
+
MathJax.startup.document.state(0);
|
|
38
|
+
MathJax.texReset();
|
|
39
|
+
MathJax.typeset();
|
|
40
|
+
MathJax.typesetPromise();
|
|
36
41
|
}
|
|
37
|
-
};
|
|
42
|
+
});
|
|
38
43
|
</script>
|
|
39
44
|
`)
|
|
40
45
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
Fluid.utils.createScript('<%= url_join(theme.static_prefix.mermaid, 'mermaid.min.js') %>', function() {
|
|
3
3
|
mermaid.initialize(<%- JSON.stringify(theme.post.mermaid.options || {}) %>);
|
|
4
|
+
|
|
5
|
+
Fluid.events.registerRefreshCallback(function() {
|
|
6
|
+
if ('mermaid' in window) {
|
|
7
|
+
mermaid.init();
|
|
8
|
+
}
|
|
9
|
+
});
|
|
4
10
|
});
|
|
5
11
|
</script>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<%
|
|
2
|
-
var parent = page.categories
|
|
2
|
+
var parent = page.categories.filter(c => !c.parent)
|
|
3
3
|
if (Array.isArray(page.category_bar)) {
|
|
4
|
-
parent =
|
|
4
|
+
parent = page.categories.filter(cat => page.category_bar.indexOf(cat.name) !== -1)
|
|
5
5
|
}
|
|
6
|
-
var
|
|
7
|
-
|
|
6
|
+
var filterIds = page.categories.map(c => c._id)
|
|
7
|
+
filterIds.push(page._id)
|
|
8
8
|
%>
|
|
9
9
|
|
|
10
10
|
<%- partial('_partials/category-list', {
|
|
11
11
|
curCats : parent,
|
|
12
12
|
params: {
|
|
13
13
|
type : 'post',
|
|
14
|
-
|
|
14
|
+
filterIds: filterIds,
|
|
15
15
|
postLimit: theme.post.category_bar.post_limit,
|
|
16
16
|
postOrderBy: theme.post.category_bar.post_order_by || config.index_generator.order_by
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% if (theme.post.copyright.enable && page.copyright !== false) { %>
|
|
2
2
|
<%
|
|
3
|
-
var license = theme.post.copyright.license
|
|
3
|
+
var license = theme.post.copyright.license || ''
|
|
4
4
|
if (typeof page.copyright === 'string') {
|
|
5
5
|
license = page.copyright
|
|
6
6
|
} else if (typeof page.license === 'string') {
|
|
@@ -27,29 +27,31 @@
|
|
|
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>
|
|
34
34
|
</div>
|
|
35
35
|
<% } %>
|
|
36
|
-
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<%
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
<% if (license) { %>
|
|
37
|
+
<div class="license-meta-item">
|
|
38
|
+
<div><%- __('post.copyright.licensed') %></div>
|
|
39
|
+
<div>
|
|
40
|
+
<% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
|
|
41
|
+
<% var items = license.split('-') %>
|
|
42
|
+
<% for (var idx = 0; idx < items.length; idx++) { %>
|
|
43
|
+
<a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
|
|
44
|
+
<span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
|
|
45
|
+
<i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
|
|
46
|
+
</span>
|
|
47
|
+
</a>
|
|
48
|
+
<% } %>
|
|
49
|
+
<% } else { %>
|
|
50
|
+
<%- license %>
|
|
47
51
|
<% } %>
|
|
48
|
-
|
|
49
|
-
<%- license %>
|
|
50
|
-
<% } %>
|
|
52
|
+
</div>
|
|
51
53
|
</div>
|
|
52
|
-
|
|
54
|
+
<% } %>
|
|
53
55
|
</div>
|
|
54
56
|
<div class="license-icon iconfont"></div>
|
|
55
57
|
</div>
|