hexo-theme-fluid 1.9.2 → 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 CHANGED
@@ -1060,7 +1060,7 @@ static_prefix:
1060
1060
 
1061
1061
  bootstrap: https://lib.baomitu.com/twitter-bootstrap/4.6.1/
1062
1062
 
1063
- prismjs: https://lib.baomitu.com/prism/1.27.0/
1063
+ prismjs: https://lib.baomitu.com/prism/1.28.0/
1064
1064
 
1065
1065
  tocbot: https://lib.baomitu.com/tocbot/4.18.2/
1066
1066
 
@@ -1070,24 +1070,24 @@ static_prefix:
1070
1070
 
1071
1071
  nprogress: https://lib.baomitu.com/nprogress/0.2.0/
1072
1072
 
1073
- mathjax: https://lib.baomitu.com/mathjax/3.2.1/
1073
+ mathjax: https://lib.baomitu.com/mathjax/3.2.2/
1074
1074
 
1075
- katex: https://lib.baomitu.com/KaTeX/0.15.6/
1075
+ katex: https://lib.baomitu.com/KaTeX/0.16.2/
1076
1076
 
1077
1077
  busuanzi: https://busuanzi.ibruce.info/busuanzi/2.3/
1078
1078
 
1079
- clipboard: https://lib.baomitu.com/clipboard.js/2.0.10/
1079
+ clipboard: https://lib.baomitu.com/clipboard.js/2.0.11/
1080
1080
 
1081
1081
  mermaid: https://lib.baomitu.com/mermaid/8.14.0/
1082
1082
 
1083
- valine: https://lib.baomitu.com/valine/1.4.17/
1083
+ valine: https://lib.baomitu.com/valine/1.5.1/
1084
1084
 
1085
- waline: https://lib.baomitu.com/waline/2.5.1/
1085
+ waline: https://lib.baomitu.com/waline/2.6.3/
1086
1086
 
1087
- gitalk: https://lib.baomitu.com/gitalk/1.7.2/
1087
+ gitalk: https://lib.baomitu.com/gitalk/1.8.0/
1088
1088
 
1089
1089
  disqusjs: https://lib.baomitu.com/disqusjs/1.3.0/
1090
1090
 
1091
- twikoo: https://lib.baomitu.com/twikoo/1.5.11/
1091
+ twikoo: https://lib.baomitu.com/twikoo/1.6.7/
1092
1092
 
1093
1093
  hint: https://lib.baomitu.com/hint.css/2.7.0/
@@ -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.activeIds || []).includes(cat._id)) collapsed = false %>
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.activeIds || []).includes(post._id) ? 'active' : '' %>">
52
+ <%= (params.filterIds || []).includes(post._id) ? 'active' : '' %>">
53
53
  <span class="category-post"><%= post.title %></span>
54
54
  </a>
55
55
  <% } %>
@@ -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 = escape_html(strip_html(description).substring(0, 200).trim()).replace(/\n/g, ' ')
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)
@@ -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
  `)
@@ -6,8 +6,8 @@ import_script(`
6
6
  var hbePrefix = document.querySelector('hbe-prefix');
7
7
  hbePrefix.parentElement.classList.add('markdown-body');
8
8
  Fluid.utils.retry(function() {
9
- if (Fluid.boot && Fluid.boot.refreshPlugins) {
10
- Fluid.boot.refreshPlugins();
9
+ if (Fluid.boot && Fluid.boot.refresh) {
10
+ Fluid.boot.refresh();
11
11
  return true;
12
12
  }
13
13
  }, 100, 10);
@@ -31,6 +31,15 @@
31
31
  MathJax.typeset();
32
32
  MathJax.typesetPromise();
33
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();
41
+ }
42
+ });
34
43
  </script>
35
44
  `)
36
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 = parent.filter(cat => page.category_bar.indexOf(cat.name) !== -1)
4
+ parent = page.categories.filter(cat => page.category_bar.indexOf(cat.name) !== -1)
5
5
  }
6
- var activeIds = page.categories.map(c => c._id)
7
- activeIds.push(page._id)
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
- activeIds: activeIds,
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') {
@@ -33,23 +33,25 @@
33
33
  <div><%= full_date(page.updated, theme.post.copyright.update_date.format || 'LL') %></div>
34
34
  </div>
35
35
  <% } %>
36
- <div class="license-meta-item">
37
- <div><%- __('post.copyright.licensed') %></div>
38
- <div>
39
- <% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
40
- <% var items = license.split('-') %>
41
- <% for (var idx = 0; idx < items.length; idx++) { %>
42
- <a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
43
- <span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
44
- <i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
45
- </span>
46
- </a>
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
- <% } else { %>
49
- <%- license %>
50
- <% } %>
52
+ </div>
51
53
  </div>
52
- </div>
54
+ <% } %>
53
55
  </div>
54
56
  <div class="license-icon iconfont"></div>
55
57
  </div>
@@ -12,22 +12,34 @@ import_script(`
12
12
  var boardCtn = jQuery('#board-ctn');
13
13
  var boardTop = boardCtn.offset().top;
14
14
 
15
- window.tocbot.init({
15
+ window.tocbot.init(Object.assign({
16
16
  tocSelector : '#toc-body',
17
17
  contentSelector : '.markdown-body',
18
- headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
19
18
  linkClass : 'tocbot-link',
20
19
  activeLinkClass : 'tocbot-active-link',
21
20
  listClass : 'tocbot-list',
22
21
  isCollapsedClass: 'tocbot-is-collapsed',
23
22
  collapsibleClass: 'tocbot-is-collapsible',
24
- collapseDepth : CONFIG.toc.collapseDepth || 0,
25
23
  scrollSmooth : true,
26
- headingsOffset : -boardTop
27
- });
24
+ includeTitleTags: true,
25
+ headingsOffset : -boardTop,
26
+ }, CONFIG.toc));
28
27
  if (toc.find('.toc-list-item').length > 0) {
29
28
  toc.css('visibility', 'visible');
30
29
  }
30
+
31
+ Fluid.events.registerRefreshCallback(function() {
32
+ if ('tocbot' in window) {
33
+ tocbot.refresh();
34
+ var toc = jQuery('#toc');
35
+ if (toc.length === 0 || !tocbot) {
36
+ return;
37
+ }
38
+ if (toc.find('.toc-list-item').length > 0) {
39
+ toc.css('visibility', 'visible');
40
+ }
41
+ }
42
+ });
31
43
  });
32
44
  </script>
33
45
  `)
package/layout/index.ejs CHANGED
@@ -30,7 +30,7 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
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 %>">
32
32
  <div>
33
- <%- escape_html(strip_html(excerpt).substring(0, 200).trim()).replace(/\n/g, ' ') %>
33
+ <%- strip_html(excerpt).substring(0, 200).trim().replace(/\n/g, ' ') %>
34
34
  </div>
35
35
  </a>
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-fluid",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "An elegant Material-Design theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "files": [
@@ -7,20 +7,26 @@ const pageInScope = (page, scope) => {
7
7
  case 'home':
8
8
  return Boolean(page.__index);
9
9
  case 'post':
10
+ case 'posts':
10
11
  return Boolean(page.__post);
11
- case 'archives' || 'archive':
12
+ case 'archives':
13
+ case 'archive':
12
14
  return Boolean(page.archive);
13
- case 'categories' || 'category':
15
+ case 'categories':
16
+ case 'category':
14
17
  return page.layout === 'categories' || page.layout === 'category';
15
- case 'tags' || 'tag':
18
+ case 'tags':
19
+ case 'tag':
16
20
  return page.layout === 'tags' || page.layout === 'tag';
17
21
  case 'about':
18
22
  return page.layout === 'about';
19
- case 'links' || 'link':
23
+ case 'links':
24
+ case 'link':
20
25
  return page.layout === 'links';
21
26
  case '404':
22
27
  return page.layout === '404';
23
- case 'page' || 'custom':
28
+ case 'page':
29
+ case 'custom':
24
30
  return Boolean(page.__page);
25
31
  }
26
32
  };
@@ -5,6 +5,9 @@
5
5
  const { stripHTML } = require('hexo-util');
6
6
 
7
7
  const getWordCount = (post) => {
8
+ if (!post.wordcount) {
9
+ post.wordcount = stripHTML(post.content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
10
+ }
8
11
  return post.wordcount;
9
12
  };
10
13
 
@@ -32,10 +35,3 @@ hexo.extend.helper.register('wordtotal', (site) => {
32
35
  });
33
36
  return symbolsCount(count);
34
37
  });
35
-
36
- hexo.extend.filter.register('after_post_render', (page) => {
37
- const meta = hexo.theme.config.post.meta;
38
- if (meta.wordcount.enable || meta.min2read.enable) {
39
- page.wordcount = stripHTML(page.content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
40
- }
41
- }, 0);
@@ -52,6 +52,7 @@
52
52
  color var(--navbar-text-color)
53
53
  background-color rgba(0, 0, 0, 0.3)
54
54
  border none
55
+ min-width 8rem
55
56
  -webkit-transition background .5s ease-in-out,padding .5s ease-in-out
56
57
  transition background .5s ease-in-out,padding .5s ease-in-out
57
58
 
@@ -46,8 +46,7 @@
46
46
  &::before
47
47
  content "\e61f"
48
48
  font-weight initial
49
- position absolute
50
- left -1.25rem
49
+ margin-right .25rem
51
50
 
52
51
  .list-group-count
53
52
  margin-left .2rem
@@ -10,10 +10,12 @@
10
10
  padding-bottom 1.45rem
11
11
  padding-right 1rem
12
12
  line-height 1.5
13
+ margin-bottom 1rem
13
14
 
14
15
  .code-wrapper
15
16
  position relative
16
17
  border-radius 4px
18
+ margin-bottom 1rem
17
19
 
18
20
  .hljs, .highlight pre, .code-wrapper pre, figure.highlight td.gutter
19
21
  transition color .2s ease-in-out, background-color .2s ease-in-out
package/source/js/boot.js CHANGED
@@ -11,43 +11,11 @@ Fluid.boot.registerEvents = function() {
11
11
  Fluid.events.registerImageLoadedEvent();
12
12
  };
13
13
 
14
- Fluid.boot.refreshPlugins = function() {
14
+ Fluid.boot.refresh = function() {
15
15
  Fluid.plugins.fancyBox();
16
16
  Fluid.plugins.codeWidget();
17
-
18
- if ('tocbot' in window) {
19
- tocbot.refresh();
20
- var toc = jQuery('#toc');
21
- if (toc.length === 0 || !tocbot) { return; }
22
- if (toc.find('.toc-list-item').length > 0) {
23
- toc.css('visibility', 'visible');
24
- }
25
- }
26
-
27
- if ('anchors' in window) {
28
- anchors.removeAll();
29
- var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
30
- var res = [];
31
- for (var item of el) {
32
- res.push('.markdown-body > ' + item.trim());
33
- }
34
- if (CONFIG.anchorjs.placement === 'left') {
35
- anchors.options.class = 'anchorjs-link-left';
36
- }
37
- anchors.add(res.join(', '));
38
- }
39
-
40
- if ('MathJax' in window && MathJax.startup.document && typeof MathJax.startup.document.state === 'function') {
41
- MathJax.startup.document.state(0);
42
- MathJax.texReset();
43
- MathJax.typeset();
44
- MathJax.typesetPromise();
45
- }
46
-
47
- if ('mermaid' in window) {
48
- mermaid.init();
49
- }
50
- }
17
+ Fluid.events.refresh();
18
+ };
51
19
 
52
20
  document.addEventListener('DOMContentLoaded', function() {
53
21
  Fluid.boot.registerEvents();
@@ -143,6 +143,23 @@ Fluid.events = {
143
143
  }
144
144
  },
145
145
 
146
+ registerRefreshCallback: function(callback) {
147
+ if (!Array.isArray(Fluid.events._refreshCallbacks)) {
148
+ Fluid.events._refreshCallbacks = [];
149
+ }
150
+ Fluid.events._refreshCallbacks.push(callback);
151
+ },
152
+
153
+ refresh: function() {
154
+ if (Array.isArray(Fluid.events._refreshCallbacks)) {
155
+ for (var callback of Fluid.events._refreshCallbacks) {
156
+ if (callback instanceof Function) {
157
+ callback();
158
+ }
159
+ }
160
+ }
161
+ },
162
+
146
163
  billboard: function() {
147
164
  if (!('console' in window)) {
148
165
  return;
package/layout/.DS_Store DELETED
Binary file
package/scripts/.DS_Store DELETED
Binary file
Binary file
Binary file
package/source/.DS_Store DELETED
Binary file
Binary file