hexo-theme-fluid 1.9.4 → 1.9.5

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/README.md CHANGED
@@ -106,29 +106,66 @@ layout: about
106
106
  - [x] 支持 LaTeX 数学公式
107
107
  - [x] 支持 mermaid 流程图
108
108
 
109
- ## 支持我们
110
-
111
- 你可以扫描下方微信赞赏码支持我们的开源创作,让我们可以补贴服务器及域名等日常开销。
112
-
113
- <img src="https://github.com/fluid-dev/static/blob/master/hexo-theme-fluid/sponsor.png?s=200&v=4" width="200" alt="微信赞赏码">
109
+ ## 鸣谢
114
110
 
115
- 同时我们正在**寻求商业赞助**,如果贵司想在本页显著位置展示广告位(每月 6K+ Views 定向流量曝光),或者有其他赞助形式,可将联系方式发送邮件至 zkqiang#126.com (#替换为@)。
111
+ <table>
112
+ <thead>
113
+ <tr>
114
+ <th align="center" style="width: 240px;">
115
+ <a href="https://flowus.cn/share/eebf2144-8db7-4d68-b31e-bc2c116871de">
116
+ <img src="https://github-production-user-asset-6210df.s3.amazonaws.com/32983588/243899272-092eeb46-9172-4c10-9e72-53561ff37a00.png" height="200px"><br>
117
+ <sub>首席赞助商 ORENCEAI</sub><br>
118
+ <sub>全新的 ChatGPT 人工智能对话平台</sub>
119
+ </a>
120
+ </th>
121
+ <th align="center" style="width: 240px;">
122
+ <a href="https://www.jetbrains.com/?from=hexo-theme-fluid">
123
+ <img src="https://raw.githubusercontent.com/fluid-dev/static/690616966f34a58d66aa15ac7b550dd7bbc03967/hexo-theme-fluid/jetbrains.svg" height="200px"><br>
124
+ <sub>免费开发工具提供方 JetBrains</sub><br>
125
+ <sub>专注于创建智能开发工具</sub>
126
+ </a>
127
+ </th>
128
+ </tr>
129
+ </thead>
130
+ </table>
116
131
 
117
132
  ## 贡献者
118
133
 
119
134
  [![contributors](https://opencollective.com/hexo-theme-fluid/contributors.svg?width=890&button=false)](https://github.com/fluid-dev/hexo-theme-fluid/graphs/contributors)
120
135
 
121
- 英文文档翻译:[@EatRice](https://eatrice.top/) [@橙子杀手](https://ruru.eatrice.top)
136
+ 英文文档翻译:[@EatRice](https://eatrice.top/) [@橙子杀手](https://ruru.eatrice.top) [@Sinetian](https://sinetian.github.io/)
122
137
 
123
138
  其他贡献:[@zhugaoqi](https://github.com/zhugaoqi) [@julydate](https://github.com/julydate)
124
139
 
125
140
  如你也想贡献代码,可参照[贡献指南](https://hexo.fluid-dev.com/docs/contribute/)
126
141
 
127
- ## 鸣谢
142
+ ## 支持我们
128
143
 
129
- <a title="鸣谢 JetBrains 免费授权开发工具" href="https://www.jetbrains.com/?from=hexo-theme-fluid" target="_blank">
130
- <img src="https://raw.githubusercontent.com/fluid-dev/static/690616966f34a58d66aa15ac7b550dd7bbc03967/hexo-theme-fluid/jetbrains.svg" width="150" alt="JetBrains">
131
- </a>
144
+ 如果你觉得这个项目有帮助,并愿意支持它的发展,可以通过以下方式支持我们的开源创作:
145
+
146
+ <table>
147
+ <thead>
148
+ <tr>
149
+ <th align="center" style="width: 240px;">
150
+ <div>
151
+ <img src="https://github.com/fluid-dev/static/blob/master/hexo-theme-fluid/sponsor.png?s=200&v=4" height="200px" alt="微信赞赏码"><br>
152
+ <sub>微信赞赏码</sub>
153
+ </div>
154
+ </th>
155
+ <th align="center" style="width: 240px;">
156
+ <div>
157
+ <a href="https://etherscan.io/address/0x0021395954710be29c0BFDCB3f98f4D2fa5A1448">
158
+ <img src="https://avatars.githubusercontent.com/u/6250754?s=200&v=4" height="200px" alt="ERC20 Token">
159
+ </a>
160
+ <br>
161
+ <sub>ERC20 Token: 0x0021395954710<br>be29c0BFDCB3f98f4D2fa5A1448</sub>
162
+ </div>
163
+ </th>
164
+ </tr>
165
+ </thead>
166
+ </table>
167
+
168
+ 同时我们正在**寻求商业赞助**,如果贵司想在本页显著位置展示广告位(每月 6K+ Views 定向流量曝光),或者有其他赞助形式,可将联系方式发送邮件至 zkqiang#126.com (#替换为@)。
132
169
 
133
170
  ## Star 趋势
134
171
 
package/_config.yml CHANGED
@@ -252,15 +252,11 @@ web_analytics: # 网页访问统计
252
252
  # See: https://tongji.baidu.com/sc-web/10000033910/home/site/getjs?siteId=13751376
253
253
  baidu:
254
254
 
255
- # Google 统计的 Tracking ID
256
- # Google analytics, set Tracking ID
257
- # See: https://developers.google.com/analytics/devguides/collection/analyticsjs
255
+ # Google Analytics 4 的媒体资源 ID
256
+ # Google Analytics 4 MEASUREMENT_ID
257
+ # See: https://support.google.com/analytics/answer/9744165#zippy=%2Cin-this-article
258
258
  google:
259
-
260
- # Google gtag.js 的媒体资源 ID
261
- # Google gtag.js GA_MEASUREMENT_ID
262
- # See: https://developers.google.com/analytics/devguides/collection/gtagjs/
263
- gtag:
259
+ measurement_id:
264
260
 
265
261
  # 腾讯统计的 H5 App ID,开启高级功能才有cid
266
262
  # Tencent analytics, set APP ID
@@ -727,7 +723,7 @@ post:
727
723
  enable: false
728
724
  # 指定的插件,需要同时设置对应插件的必要参数
729
725
  # 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 | giscus
726
+ # Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss
731
727
  type: disqus
732
728
 
733
729
 
@@ -847,7 +843,7 @@ remark42:
847
843
  components: ['embed']
848
844
 
849
845
  # Twikoo
850
- # 基于腾讯云开发
846
+ # 支持腾讯云、Vercel、Railway 等多种平台部署
851
847
  # Based on Tencent CloudBase
852
848
  # See: https://twikoo.js.org
853
849
  twikoo:
@@ -881,6 +877,15 @@ giscus:
881
877
  input-position: top
882
878
  lang: zh-CN
883
879
 
880
+ # Discuss
881
+ # 多平台、多数据库、自托管、免费开源评论系统
882
+ # Self-hosted, small size, multi-platform, multi-database, free and open source commenting system
883
+ # See: https://discuss.js.org
884
+ discuss:
885
+ serverURLs:
886
+ path: window.location.pathname
887
+
888
+
884
889
  #---------------------------
885
890
  # 归档页
886
891
  # Archive Page
@@ -1031,7 +1036,7 @@ links:
1031
1036
  enable: false
1032
1037
  # 指定的插件,需要同时设置对应插件的必要参数
1033
1038
  # The specified plugin needs to set the necessary parameters at the same time
1034
- # Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
1039
+ # Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss
1035
1040
  type: disqus
1036
1041
 
1037
1042
 
@@ -1056,13 +1061,13 @@ static_prefix:
1056
1061
 
1057
1062
  github_markdown: https://lib.baomitu.com/github-markdown-css/4.0.0/
1058
1063
 
1059
- jquery: https://lib.baomitu.com/jquery/3.6.0/
1064
+ jquery: https://lib.baomitu.com/jquery/3.6.4/
1060
1065
 
1061
1066
  bootstrap: https://lib.baomitu.com/twitter-bootstrap/4.6.1/
1062
1067
 
1063
1068
  prismjs: https://lib.baomitu.com/prism/1.29.0/
1064
1069
 
1065
- tocbot: https://lib.baomitu.com/tocbot/4.18.2/
1070
+ tocbot: https://lib.baomitu.com/tocbot/4.20.1/
1066
1071
 
1067
1072
  typed: https://lib.baomitu.com/typed.js/2.0.12/
1068
1073
 
@@ -1082,7 +1087,7 @@ static_prefix:
1082
1087
 
1083
1088
  valine: https://lib.baomitu.com/valine/1.5.1/
1084
1089
 
1085
- waline: https://lib.baomitu.com/waline/2.14.1/
1090
+ waline: https://cdn.staticfile.org/waline/2.15.5/
1086
1091
 
1087
1092
  gitalk: https://lib.baomitu.com/gitalk/1.8.0/
1088
1093
 
@@ -1090,4 +1095,6 @@ static_prefix:
1090
1095
 
1091
1096
  twikoo: https://lib.baomitu.com/twikoo/1.6.8/
1092
1097
 
1098
+ discuss: https://lib.baomitu.com/discuss/1.2.1/
1099
+
1093
1100
  hint: https://lib.baomitu.com/hint.css/2.7.0/
Binary file
@@ -0,0 +1,17 @@
1
+ <% if (theme.discuss && theme.discuss.serverURLs) { %>
2
+ <div id="discuss-comments"></div>
3
+ <script type="text/javascript">
4
+ Fluid.utils.loadComments('#comments', function() {
5
+ Fluid.utils.createScript('<%= url_join(theme.static_prefix.discuss, 'discuss.js') %>', function() {
6
+ var options = Object.assign(
7
+ <%- JSON.stringify(theme.discuss || {}) %>,
8
+ { el: '#discuss-comments',
9
+ path: <%= theme.discuss.path %>
10
+ }
11
+ )
12
+ discuss.init(options)
13
+ });
14
+ });
15
+ </script>
16
+ <noscript>Please enable JavaScript to view the comments</noscript>
17
+ <% } %>
@@ -9,9 +9,11 @@
9
9
  el: '#twikoo',
10
10
  path: '<%= theme.twikoo.path %>',
11
11
  onCommentLoaded: function() {
12
- var imgSelector = '#twikoo .tk-content img:not(.tk-owo-emotion)';
13
- Fluid.plugins.imageCaption(imgSelector);
14
- Fluid.plugins.fancyBox(imgSelector);
12
+ Fluid.utils.listenDOMLoaded(function() {
13
+ var imgSelector = '#twikoo .tk-content img:not(.tk-owo-emotion)';
14
+ Fluid.plugins.imageCaption(imgSelector);
15
+ Fluid.plugins.fancyBox(imgSelector);
16
+ });
15
17
  }
16
18
  }
17
19
  )
@@ -16,28 +16,16 @@
16
16
  <% } %>
17
17
 
18
18
  <% if (theme.web_analytics.google){ %>
19
- <!-- Google Analytics -->
19
+ <!-- Google tag (gtag.js) -->
20
20
  <script async>
21
21
  if (!Fluid.ctx.dnt) {
22
- Fluid.utils.createScript('https://www.google-analytics.com/analytics.js', function() {
23
- window.ga = window.ga || function() { (ga.q = ga.q || []).push(arguments) };
24
- ga.l = +new Date;
25
- ga('create', '<%= theme.web_analytics.google %>', 'auto');
26
- ga('send', 'pageview');
27
- });
28
- }
29
- </script>
30
- <% } %>
31
-
32
- <% if (theme.web_analytics.gtag){ %>
33
- <!-- Google gtag.js -->
34
- <script async>
35
- if (!Fluid.ctx.dnt) {
36
- Fluid.utils.createScript('https://www.googletagmanager.com/gtag/js?id=<%= theme.web_analytics.gtag %>', function() {
22
+ Fluid.utils.createScript("https://www.googletagmanager.com/gtag/js?id=<%= theme.web_analytics.google.measurement_id %>", function() {
37
23
  window.dataLayer = window.dataLayer || [];
38
- function gtag(){dataLayer.push(arguments);}
24
+ function gtag() {
25
+ dataLayer.push(arguments);
26
+ }
39
27
  gtag('js', new Date());
40
- gtag('config', '<%- theme.web_analytics.gtag %>');
28
+ gtag('config', '<%- theme.web_analytics.google.measurement_id %>');
41
29
  });
42
30
  }
43
31
  </script>
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  import_script(`
3
3
  <script defer>
4
- if (document.getElementById('hbePass')) {
4
+ if (document.getElementById('hbePass') || document.querySelector('hbe-prefix')) {
5
5
  Fluid.utils.waitElementLoaded('hbe-prefix', function() {
6
6
  var hbePrefix = document.querySelector('hbe-prefix');
7
7
  hbePrefix.parentElement.classList.add('markdown-body');
@@ -2,10 +2,12 @@
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
4
 
5
- Fluid.events.registerRefreshCallback(function() {
6
- if ('mermaid' in window) {
7
- mermaid.init();
8
- }
5
+ Fluid.utils.listenDOMLoaded(function() {
6
+ Fluid.events.registerRefreshCallback(function() {
7
+ if ('mermaid' in window) {
8
+ mermaid.init();
9
+ }
10
+ });
9
11
  });
10
12
  });
11
13
  </script>
@@ -11,7 +11,7 @@
11
11
  <% if (is_home() && theme.index.slogan.api && theme.index.slogan.api.enable) { %>
12
12
  jQuery.ajax({
13
13
  type: '<%= theme.index.slogan.api.method %>',
14
- url: '<%= theme.index.slogan.api.url %>',
14
+ url: '<%- theme.index.slogan.api.url %>',
15
15
  headers: <%- JSON.stringify(theme.index.slogan.api.headers || {}) %>,
16
16
  dataType: 'json',
17
17
  success: function(result) {
@@ -40,7 +40,7 @@
40
40
  <% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
41
41
  <% var items = license.split('-') %>
42
42
  <% for (var idx = 0; idx < items.length; idx++) { %>
43
- <a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
43
+ <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
44
44
  <span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
45
45
  <i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
46
46
  </span>
@@ -9,7 +9,7 @@
9
9
  <div class="post-meta">
10
10
  <i class="iconfont icon-tags"></i>
11
11
  <% page.tags.each(function(tag) { %>
12
- <a href="<%= url_for(tag.path) %>">#<%- tag.name %></a>
12
+ <a href="<%= url_for(tag.path) %>" class="print-no-link">#<%- tag.name %></a>
13
13
  <% }) %>
14
14
  </div>
15
15
  <% } %>
package/layout/index.ejs CHANGED
@@ -18,14 +18,14 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
18
18
  </div>
19
19
  <% } %>
20
20
  <article class="col-12 col-md-<%= index_img ? '8' : '12' %> mx-auto index-info">
21
- <h1 class="index-header">
21
+ <h2 class="index-header">
22
22
  <% if (theme.index.post_sticky && theme.index.post_sticky.enable && post.sticky > 0) { %>
23
23
  <i class="index-pin <%= theme.index.post_sticky && theme.index.post_sticky.icon %>" title="Pin on top"></i>
24
24
  <% } %>
25
25
  <a href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
26
26
  <%= post.title %>
27
27
  </a>
28
- </h1>
28
+ </h2>
29
29
 
30
30
  <% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
31
31
  <a class="index-excerpt <%= index_img ? '' : 'index-excerpt__noimg' %>" href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
package/layout/post.ejs CHANGED
@@ -14,8 +14,7 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
14
14
  <div class="container nopadding-x-md" id="board-ctn">
15
15
  <div id="board">
16
16
  <article class="post-content mx-auto">
17
- <!-- SEO header -->
18
- <h1 style="display: none"><%= page.subtitle || page.title %></h1>
17
+ <h1 id="seo-header"><%= page.subtitle || page.title %></h1>
19
18
  <% if (theme.post.updated.enable && theme.post.updated && compare_date(page.date, page.updated)) { %>
20
19
  <p class="note note-<%= theme.post.updated.note_class || 'info' %>">
21
20
  <% if (theme.post.updated.relative) { %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-fluid",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "An elegant Material-Design theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "files": [
Binary file
Binary file
@@ -6,8 +6,10 @@ const { stripHTML } = require('hexo-util');
6
6
  module.exports = (hexo) => {
7
7
  const config = hexo.theme.config;
8
8
  if (config.post.footnote.enable) {
9
- hexo.extend.filter.register('before_post_render', function(page) {
10
- page.content = renderFootnotes(page.content, page.footnote);
9
+ hexo.extend.filter.register('before_post_render', (page) => {
10
+ if (page.footnote !== false) {
11
+ page.content = renderFootnotes(page.content, page.footnote);
12
+ }
11
13
  return page;
12
14
  });
13
15
  }
@@ -24,8 +26,17 @@ module.exports = (hexo) => {
24
26
  const reFootnoteContent = /\[\^(\d+)]: ?([\S\s]+?)(?=\[\^(?:\d+)]|\n\n|$)/g;
25
27
  const reInlineFootnote = /\[\^(\d+)]\((.+?)\)/g;
26
28
  const reFootnoteIndex = /\[\^(\d+)]/g;
29
+ const reCodeBlock = /<pre>[\s\S]*?<\/pre>/g;
30
+
27
31
  let footnotes = [];
28
32
  let html = '';
33
+ let codeBlocks = [];
34
+
35
+ // extract code block
36
+ text = text.replace(reCodeBlock, function(match) {
37
+ codeBlocks.push(match);
38
+ return 'CODE_BLOCK_PLACEHOLDER';
39
+ });
29
40
 
30
41
  // threat all inline footnotes
31
42
  text = text.replace(reInlineFootnote, function(match, index, content) {
@@ -95,6 +106,12 @@ module.exports = (hexo) => {
95
106
  text += '<ol>' + html + '</ol>';
96
107
  text += '</div></section>';
97
108
  }
109
+
110
+ // restore code block
111
+ text = text.replace(/CODE_BLOCK_PLACEHOLDER/g, function() {
112
+ return codeBlocks.shift();
113
+ });
114
+
98
115
  return text;
99
116
  }
100
117
  };
@@ -1,7 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ let css;
4
+ try {
5
+ css = require('css');
6
+ } catch (error) {
7
+ if (error.code === 'MODULE_NOT_FOUND') {
8
+ css = require('@adobe/css-tools');
9
+ } else {
10
+ throw error;
11
+ }
12
+ }
13
+
3
14
  const fs = require('fs');
4
- const css = require('css');
5
15
  const objUtil = require('../../utils/object');
6
16
  const resolveModule = require('../../utils/resolve');
7
17
 
@@ -26,10 +26,12 @@ hexo.extend.filter.register('before_generate', function() {
26
26
  });
27
27
  const hidePosts = allPosts.filter(post => post.hide);
28
28
  const normalPosts = allPosts.filter(post => !post.hide);
29
+ const indexPost = allPosts.filter(post => !post.hide && !post.archive)
29
30
 
30
31
  this.locals.set('all_posts', allPosts);
31
32
  this.locals.set('hide_posts', hidePosts);
32
33
  this.locals.set('posts', normalPosts);
34
+ this.locals.set('index_posts', indexPost);
33
35
  });
34
36
 
35
37
  const original_post_generator = hexo.extend.generator.get('post');
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const pagination = require('hexo-pagination');
4
+
5
+ module.exports = function(locals) {
6
+ const config = this.config;
7
+ const posts = locals.index_posts.sort(config.index_generator.order_by);
8
+
9
+ posts.data.sort((a, b) => (b.sticky || 0) - (a.sticky || 0));
10
+
11
+ const paginationDir = config.pagination_dir || 'page';
12
+ const path = config.index_generator.path || '';
13
+
14
+ return pagination(path, posts, {
15
+ perPage: config.index_generator.per_page,
16
+ layout: 'index',
17
+ format: paginationDir + '/%d/',
18
+ data: {
19
+ __index: true
20
+ }
21
+ });
22
+ };
@@ -35,7 +35,7 @@ hexo.extend.generator.register('_hexo_generator_search', function(locals) {
35
35
 
36
36
  const searchConfig = config.search;
37
37
  let searchField = searchConfig.field;
38
- const content = searchConfig.content || true;
38
+ const content = searchConfig.content && true;
39
39
 
40
40
  let posts, pages;
41
41
 
@@ -50,3 +50,6 @@ hexo.extend.generator.register('_links', function(locals) {
50
50
  };
51
51
  }
52
52
  });
53
+
54
+ // generate index page
55
+ hexo.extend.generator.register('index', require('./index-generator'));
@@ -8,23 +8,24 @@ const urlJoin = require('../utils/url-join');
8
8
  /**
9
9
  * Export theme config to js
10
10
  */
11
- hexo.extend.helper.register('export_config', function() {
11
+ hexo.extend.helper.register('export_config', function () {
12
12
  let { config, theme, fluid_version } = this;
13
13
  const exportConfig = {
14
- hostname : url.parse(config.url).hostname || config.url,
15
- root : config.root,
16
- version : fluid_version,
17
- typing : theme.fun_features.typing,
18
- anchorjs : theme.fun_features.anchorjs,
19
- progressbar : theme.fun_features.progressbar,
14
+ hostname: url.parse(config.url).hostname || config.url,
15
+ root: config.root,
16
+ version: fluid_version,
17
+ typing: theme.fun_features.typing,
18
+ anchorjs: theme.fun_features.anchorjs,
19
+ progressbar: theme.fun_features.progressbar,
20
20
  code_language: theme.code.language,
21
- copy_btn : theme.code.copy_btn,
21
+ copy_btn: theme.code.copy_btn,
22
22
  image_caption: theme.post.image_caption,
23
- image_zoom : theme.post.image_zoom,
24
- toc : theme.post.toc,
25
- lazyload : theme.lazyload,
23
+ image_zoom: theme.post.image_zoom,
24
+ toc: theme.post.toc,
25
+ lazyload: theme.lazyload,
26
26
  web_analytics: theme.web_analytics,
27
- search_path : urlJoin(config.root, theme.search.path)
27
+ search_path: urlJoin(config.root, theme.search.path),
28
+ include_content_in_search: theme.search.content,
28
29
  };
29
30
  return `<script id="fluid-configs">
30
31
  var Fluid = window.Fluid || {};
@@ -3,8 +3,8 @@
3
3
  'use strict';
4
4
 
5
5
  const note = (args, content) => {
6
- if (!args || !args[0]) {
7
- args = ['default'];
6
+ if (!args || !args[0] || args[0].toLowerCase() === "default") {
7
+ args = [ hexo.theme.config.post.updated.note_class || "info"];
8
8
  }
9
9
  return `<div class="note note-${args.join(' ')}">
10
10
  ${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
Binary file
Binary file
@@ -59,12 +59,13 @@ dark-colors()
59
59
  transition background-color .2s ease-in-out
60
60
 
61
61
  if (hexo-config("dark_mode.enable"))
62
- @media (prefers-color-scheme: dark)
62
+ @media not print and (prefers-color-scheme: dark)
63
63
  :root
64
64
  --color-mode "dark"
65
65
 
66
66
  :root:not([data-user-color-scheme])
67
67
  dark-colors()
68
68
 
69
- [data-user-color-scheme="dark"]
70
- dark-colors()
69
+ @media not print
70
+ [data-user-color-scheme="dark"]
71
+ dark-colors()
@@ -0,0 +1,38 @@
1
+ @media print
2
+ header, footer, .side-col, #scroll-top-button, .post-prevnext, #comments
3
+ display none !important
4
+
5
+ .markdown-body
6
+ a:not([href^='#']):not([href^='javascript:']):not(.print-no-link)::after
7
+ content ' (' attr(href) ')'
8
+ font-size 0.8rem
9
+ color var(--post-text-color)
10
+ opacity 0.8
11
+
12
+ & > h1, h2
13
+ border-bottom-color transparent !important
14
+
15
+ & > h1, h2, h3, h4, h5, h6
16
+ margin-top 1.25em !important
17
+ margin-bottom 0.25em !important
18
+
19
+ [data-anchorjs-icon]::after
20
+ display none
21
+
22
+ figure.highlight
23
+ table, tbody, tr, td.code, td.code pre
24
+ width 100% !important
25
+ display block !important
26
+
27
+ pre > code
28
+ white-space pre-wrap
29
+
30
+ .gutter, .code-widget
31
+ display none !important
32
+
33
+ .post-metas a
34
+ text-decoration none
35
+
36
+ @media not print
37
+ #seo-header
38
+ display none
@@ -125,6 +125,16 @@
125
125
  -webkit-transform translateX(0)
126
126
  transform translateX(0)
127
127
 
128
+ #seo-header
129
+ color var(--post-heading-color)
130
+ font-weight bold
131
+ margin-top 0.5em
132
+ margin-bottom 0.75em
133
+ border-bottom-color var(--line-color)
134
+ border-bottom-style solid
135
+ border-bottom-width 2px
136
+ line-height 1.5
137
+
128
138
  .custom, #comments
129
139
  margin-top 2rem
130
140
 
Binary file
@@ -62,9 +62,11 @@
62
62
  var index_title = -1;
63
63
  var index_content = -1;
64
64
  var first_occur = -1;
65
- // only match articles with not empty contents
66
- if (data_content !== '') {
67
- keywords.forEach(function(keyword, i) {
65
+ // Skip matching when content is included in search and content is empty
66
+ if (CONFIG.include_content_in_search && data_content === '') {
67
+ isMatch = false;
68
+ } else {
69
+ keywords.forEach(function (keyword, i) {
68
70
  index_title = data_title.indexOf(keyword);
69
71
  index_content = data_content.indexOf(keyword);
70
72
 
@@ -77,11 +79,8 @@
77
79
  if (i === 0) {
78
80
  first_occur = index_content;
79
81
  }
80
- //content_index.push({index_content:index_content, keyword_len:keyword_len});
81
82
  }
82
83
  });
83
- } else {
84
- isMatch = false;
85
84
  }
86
85
  // 0x05. show search results
87
86
  if (isMatch) {
@@ -15,6 +15,16 @@ Fluid.utils = {
15
15
  window.removeEventListener('scroll', callback);
16
16
  },
17
17
 
18
+ listenDOMLoaded(callback) {
19
+ if (document.readyState !== 'loading') {
20
+ callback();
21
+ } else {
22
+ document.addEventListener('DOMContentLoaded', function () {
23
+ callback();
24
+ });
25
+ }
26
+ },
27
+
18
28
  scrollToElement: function(target, offset) {
19
29
  var of = jQuery(target).offset();
20
30
  if (of) {
@@ -28,10 +38,11 @@ Fluid.utils = {
28
38
  elementVisible: function(element, offsetFactor) {
29
39
  offsetFactor = offsetFactor && offsetFactor >= 0 ? offsetFactor : 0;
30
40
  var rect = element.getBoundingClientRect();
31
- var height = window.innerHeight || document.documentElement.clientHeight;
32
- var top = rect.top;
33
- return (top >= 0 && top <= height * (offsetFactor + 1))
34
- || (top <= 0 && top >= -(height * offsetFactor) - rect.height);
41
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
42
+ return (
43
+ (rect.top >= 0 && rect.top <= viewportHeight * (1 + offsetFactor) + rect.height / 2) ||
44
+ (rect.bottom >= 0 && rect.bottom <= viewportHeight * (1 + offsetFactor) + rect.height / 2)
45
+ );
35
46
  },
36
47
 
37
48
  waitElementVisible: function(selectorOrElement, callback, offsetFactor) {
@@ -45,29 +56,31 @@ Fluid.utils = {
45
56
  offsetFactor = offsetFactor && offsetFactor >= 0 ? offsetFactor : 0;
46
57
 
47
58
  function waitInViewport(element) {
48
- if (Fluid.utils.elementVisible(element, offsetFactor)) {
49
- callback();
50
- return;
51
- }
52
- if ('IntersectionObserver' in window) {
53
- var io = new IntersectionObserver(function(entries, ob) {
54
- if (entries[0].isIntersecting) {
55
- callback();
56
- ob.disconnect();
57
- }
58
- }, {
59
- threshold : [0],
60
- rootMargin: (window.innerHeight || document.documentElement.clientHeight) * offsetFactor + 'px'
61
- });
62
- io.observe(element);
63
- } else {
64
- var wrapper = Fluid.utils.listenScroll(function() {
65
- if (Fluid.utils.elementVisible(element, offsetFactor)) {
66
- Fluid.utils.unlistenScroll(wrapper);
67
- callback();
68
- }
69
- });
70
- }
59
+ Fluid.utils.listenDOMLoaded(function() {
60
+ if (Fluid.utils.elementVisible(element, offsetFactor)) {
61
+ callback();
62
+ return;
63
+ }
64
+ if ('IntersectionObserver' in window) {
65
+ var io = new IntersectionObserver(function(entries, ob) {
66
+ if (entries[0].isIntersecting) {
67
+ callback();
68
+ ob.disconnect();
69
+ }
70
+ }, {
71
+ threshold : [0],
72
+ rootMargin: (window.innerHeight || document.documentElement.clientHeight) * offsetFactor + 'px'
73
+ });
74
+ io.observe(element);
75
+ } else {
76
+ var wrapper = Fluid.utils.listenScroll(function() {
77
+ if (Fluid.utils.elementVisible(element, offsetFactor)) {
78
+ Fluid.utils.unlistenScroll(wrapper);
79
+ callback();
80
+ }
81
+ });
82
+ }
83
+ });
71
84
  }
72
85
 
73
86
  if (typeof selectorOrElement === 'string') {
@@ -97,7 +110,7 @@ Fluid.utils = {
97
110
  });
98
111
  mo.observe(document, { childList: true, subtree: true });
99
112
  } else {
100
- document.addEventListener('DOMContentLoaded', function() {
113
+ Fluid.utils.listenDOMLoaded(function() {
101
114
  var waitLoop = function() {
102
115
  var ele = document.querySelector(selector);
103
116
  if (ele) {
@@ -141,8 +154,8 @@ Fluid.utils = {
141
154
  l.setAttribute('type', 'text/css');
142
155
  l.setAttribute('href', url);
143
156
  var e = document.getElementsByTagName('link')[0]
144
- || document.getElementsByTagName('head')[0]
145
- || document.head || document.documentElement;
157
+ || document.getElementsByTagName('head')[0]
158
+ || document.head || document.documentElement;
146
159
  e.parentNode.insertBefore(l, e);
147
160
  },
148
161
 
@@ -186,7 +199,7 @@ Fluid.utils = {
186
199
  }
187
200
  };
188
201
  setTimeout(next, interval);
189
- },
202
+ }
190
203
 
191
204
  };
192
205
 
@@ -199,6 +212,7 @@ function Debouncer(callback) {
199
212
  this.callback = callback;
200
213
  this.ticking = false;
201
214
  }
215
+
202
216
  Debouncer.prototype = {
203
217
  constructor: Debouncer,
204
218