hexo-theme-fluid 1.8.12 → 1.8.13

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
@@ -255,6 +255,9 @@ web_analytics: # 网页访问统计
255
255
  # 统计页面时获取路径的属性
256
256
  # Get the attribute of the page path during statistics
257
257
  path: window.location.pathname
258
+ # 开启后不统计本地路径( localhost 与 127.0.0.1 )
259
+ # If ture, ignore localhost & 127.0.0.1
260
+ ignore_local: false
258
261
 
259
262
  # 对页面中的图片和评论插件进行懒加载处理,可见范围外的元素不会提前加载
260
263
  # Lazy loading of images and comment plugin on the page
@@ -275,7 +278,7 @@ lazyload:
275
278
 
276
279
  # 图标库,包含了大量社交类图标,主题依赖的不包含在内,因此可自行修改,详见 https://hexo.fluid-dev.com/docs/icon/
277
280
  # Icon library, which includes many social icons, does not include those theme dependent, so your can modify link by yourself. See: https://hexo.fluid-dev.com/docs/en/icon/
278
- iconfont: //at.alicdn.com/t/font_1736178_kmeydafke9r.css
281
+ iconfont: //at.alicdn.com/t/font_1736178_lbnruvf0jn.css
279
282
 
280
283
 
281
284
  #---------------------------
@@ -369,6 +372,7 @@ scroll_top_arrow:
369
372
  # Open Graph metadata
370
373
  # See: https://hexo.io/docs/helpers.html#open-graph
371
374
  open_graph:
375
+ enable: true
372
376
  twitter_card: summary_large_image
373
377
  twitter_id:
374
378
  twitter_site:
@@ -536,12 +540,12 @@ post:
536
540
  min2read:
537
541
  enable: true
538
542
  format: "{} 分钟"
539
- # 每个字词的长度,建议:中文≈2,英文≈5
543
+ # 每个字词的长度,建议:中文≈2,英文≈5,中英混合可自行调节
540
544
  # Average word length (chars count in word), ZH ≈ 2, EN ≈ 5
541
545
  awl: 2
542
- # 每分钟阅读字数
546
+ # 每分钟阅读字数,如果大部分是技术文章可适度调低
543
547
  # Words per minute
544
- wpm: 160
548
+ wpm: 60
545
549
 
546
550
  # 浏览量计数
547
551
  # Number of visits
@@ -1001,4 +1005,4 @@ static_prefix:
1001
1005
 
1002
1006
  twikoo: https://cdn.jsdelivr.net/npm/twikoo@1/dist/
1003
1007
 
1004
- hint: /lib/hint/
1008
+ hint: https://cdn.jsdelivr.net/npm/hint.css@2/
@@ -5,12 +5,12 @@ var keywords = page.keywords || config.keywords
5
5
  if (keywords instanceof Array) {
6
6
  keywords = keywords.join(',')
7
7
  }
8
- var description = config.description
9
- if (page.description) {
10
- description = page.description
11
- } else if(page.excerpt) {
12
- description = strip_html(page.excerpt).substr(0, 200)
8
+ var description = page.description || page.excerpt || (is_post() && page.content) || config.description
9
+ if (description) {
10
+ description = escape_html(strip_html(description).substring(0, 200).trim()).replace(/\n/g, ' ')
13
11
  }
12
+ var ogImage = page.og_img || page.index_img
13
+ var ogConfig = Object.assign({ image: ogImage && url_for(ogImage) }, theme.open_graph)
14
14
  %>
15
15
 
16
16
  <head>
@@ -23,10 +23,13 @@ if (page.description) {
23
23
  <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
24
24
  <% } %>
25
25
  <meta name="theme-color" content="<%= theme.color.navbar_bg_color %>">
26
- <meta name="description" content="<%= description %>">
27
26
  <meta name="author" content="<%= page.author || config.author %>">
28
27
  <meta name="keywords" content="<%= keywords %>">
29
- <%- open_graph(theme.open_graph || {}) %>
28
+ <% if (theme.open_graph.enable) { %>
29
+ <%- open_graph(ogConfig) %>
30
+ <% } else { %>
31
+ <meta name="description" content="<%= description %>">
32
+ <% } %>
30
33
  <% if (theme.custom_head) { %>
31
34
  <%- theme.custom_head %>
32
35
  <% } %>
@@ -1,4 +1,4 @@
1
- <% if(theme.fun_features.typing.enable && page.subtitle !== false){ %>
1
+ <% if(theme.fun_features.typing.enable && page.subtitle !== false) { %>
2
2
  <%- js_ex(theme.static_prefix.typed, '/typed.min.js') %>
3
3
  <script>
4
4
  (function (window, document) {
@@ -10,31 +10,31 @@
10
10
  url: '<%= theme.index.slogan.api.url %>',
11
11
  headers: <%- JSON.stringify(theme.index.slogan.api.headers || {}) %>,
12
12
  dataType: 'json',
13
- success: function (result) {
13
+ success: function(result) {
14
14
  var text;
15
15
  if (result) {
16
- var keys = '<%= theme.index.slogan.api.keys %>'.split('.')
16
+ var keys = '<%= theme.index.slogan.api.keys %>'.split(',');
17
17
  if (result instanceof Array) {
18
- result = result[0]
18
+ result = result[0];
19
19
  }
20
20
  for (const k of keys) {
21
- var value = result[k]
21
+ var value = result[k];
22
22
  if (typeof value === 'string') {
23
- text = value
24
- break
23
+ text = value;
24
+ break;
25
25
  } else if (value instanceof Object) {
26
- result = value
26
+ result = value;
27
27
  }
28
28
  }
29
29
  }
30
30
  text ? typing(text) : typing(title);
31
31
  },
32
- error: function () {
33
- typing(title)
32
+ error: function() {
33
+ typing(title);
34
34
  }
35
35
  })
36
36
  <% } else { %>
37
- typing(title)
37
+ typing(title);
38
38
  <% } %>
39
39
  })(window, document);
40
40
  </script>
package/layout/index.ejs CHANGED
@@ -29,15 +29,8 @@ page.banner_mask_alpha = theme.index.banner_mask_alpha
29
29
 
30
30
  <p class="index-excerpt">
31
31
  <a href="<%= post_url %>" target="<%- theme.index.post_url_target %>">
32
- <% var excerpt = '' %>
33
- <% if(post.description) { %>
34
- <% excerpt = post.description %>
35
- <% } else if(post.excerpt){ %>
36
- <% excerpt = strip_html(post.excerpt).substr(0, 200) %>
37
- <% } else if(theme.index.auto_excerpt.enable){ %>
38
- <% excerpt = strip_html(post.content).substr(0, 200) %>
39
- <% } %>
40
- <%- excerpt %>
32
+ <% var excerpt = post.description || post.excerpt || (theme.index.auto_excerpt.enable && post.content) %>
33
+ <%- escape_html(strip_html(excerpt).substring(0, 200).trim()).replace(/\n/g, ' ') %>
41
34
  </a>
42
35
  </p>
43
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-fluid",
3
- "version": "1.8.12",
3
+ "version": "1.8.13",
4
4
  "description": "An elegant Material-Design theme for Hexo.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,9 +17,8 @@ const symbolsCount = (count) => {
17
17
  return count;
18
18
  };
19
19
 
20
- hexo.extend.helper.register('min2read', (post, { awl = 2, wpm = 200 }) => {
21
- const minutes = Math.round(getWordCount(post) / (awl * wpm));
22
- return minutes < 1 ? 1 : minutes;
20
+ hexo.extend.helper.register('min2read', (post, { awl, wpm }) => {
21
+ return Math.floor(getWordCount(post) / ((awl || 2) * (wpm || 60))) + 1;
23
22
  });
24
23
 
25
24
  hexo.extend.helper.register('wordcount', (post) => {
@@ -7,3 +7,7 @@
7
7
  z-index 3
8
8
  -webkit-box-shadow 0 12px 15px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19)
9
9
  box-shadow 0 12px 15px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19)
10
+
11
+ @media (max-width: 767px)
12
+ #board
13
+ overflow-x hidden
@@ -146,6 +146,10 @@
146
146
  font-size 1rem
147
147
  line-height 2.5rem
148
148
 
149
+ // Rewrite reboot.scss
150
+ label
151
+ margin-bottom 0
152
+
149
153
  // Rewrite github-markdown.css
150
154
  .markdown-body
151
155
  font-size 1rem
@@ -68,6 +68,17 @@
68
68
  };
69
69
  }
70
70
 
71
+ // 校验是否为有效的 Host
72
+ function validHost() {
73
+ if (CONFIG.web_analytics.leancloud.ignore_local) {
74
+ var hostname = window.location.hostname;
75
+ if (hostname === 'localhost' || hostname === '127.0.0.1') {
76
+ return false;
77
+ }
78
+ }
79
+ return true;
80
+ }
81
+
71
82
  // 校验是否为有效的 UV
72
83
  function validUV() {
73
84
  var key = 'LeanCloud_UV_Flag';
@@ -83,7 +94,7 @@
83
94
  }
84
95
 
85
96
  function addCount(Counter) {
86
- var enableIncr = CONFIG.web_analytics.enable === true;
97
+ var enableIncr = CONFIG.web_analytics.enable && validHost();
87
98
  var getterArr = [];
88
99
  var incrArr = [];
89
100
 
@@ -94,10 +105,8 @@
94
105
  enableIncr && incrArr.push(buildIncrement(record.objectId));
95
106
  var ele = document.querySelector('#leancloud-site-pv');
96
107
  if (ele) {
97
- ele.innerText = record.time + 1;
98
- if (pvCtn) {
99
- pvCtn.style.display = 'inline';
100
- }
108
+ ele.innerText = (record.time || 0) + (enableIncr ? 1 : 0);
109
+ pvCtn.style.display = 'inline';
101
110
  }
102
111
  });
103
112
  getterArr.push(pvGetter);
@@ -107,14 +116,12 @@
107
116
  var uvCtn = document.querySelector('#leancloud-site-uv-container');
108
117
  if (uvCtn) {
109
118
  var uvGetter = getRecord(Counter, 'site-uv').then((record) => {
110
- var vuv = validUV();
111
- vuv && enableIncr && incrArr.push(buildIncrement(record.objectId));
119
+ var incrUV = validUV() && enableIncr;
120
+ incrUV && incrArr.push(buildIncrement(record.objectId));
112
121
  var ele = document.querySelector('#leancloud-site-uv');
113
122
  if (ele) {
114
- ele.innerText = record.time + (vuv ? 1 : 0);
115
- if (uvCtn) {
116
- uvCtn.style.display = 'inline';
117
- }
123
+ ele.innerText = (record.time || 0) + (incrUV ? 1 : 0);
124
+ uvCtn.style.display = 'inline';
118
125
  }
119
126
  });
120
127
  getterArr.push(uvGetter);
@@ -127,12 +134,10 @@
127
134
  var target = decodeURI(path.replace(/\/*(index.html)?$/, '/'));
128
135
  var viewGetter = getRecord(Counter, target).then((record) => {
129
136
  enableIncr && incrArr.push(buildIncrement(record.objectId));
130
- if (viewCtn) {
131
- var ele = document.querySelector('#leancloud-page-views');
132
- if (ele) {
133
- ele.innerText = (record.time || 0) + 1;
134
- viewCtn.style.display = 'inline';
135
- }
137
+ var ele = document.querySelector('#leancloud-page-views');
138
+ if (ele) {
139
+ ele.innerText = (record.time || 0) + (enableIncr ? 1 : 0);
140
+ viewCtn.style.display = 'inline';
136
141
  }
137
142
  });
138
143
  getterArr.push(viewGetter);
@@ -1,5 +0,0 @@
1
- /*! Hint.css - v2.6.0 - 2019-04-27
2
- * http://kushagragour.in/lab/hint/
3
- * Copyright (c) 2019 Kushagra Gour */
4
-
5
- [class*=hint--]{position:relative;display:inline-block}[class*=hint--]:after,[class*=hint--]:before{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0s;-moz-transition-delay:0s;transition-delay:0s}[class*=hint--]:hover:after,[class*=hint--]:hover:before{visibility:visible;opacity:1;-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}[class*=hint--]:before{content:'';position:absolute;background:0 0;border:6px solid transparent;z-index:1000001}[class*=hint--]:after{background:#383838;color:#fff;padding:8px 10px;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap;text-shadow:0 -1px 0 #000;box-shadow:4px 4px 8px rgba(0,0,0,.3)}[class*=hint--][aria-label]:after{content:attr(aria-label)}[class*=hint--][data-hint]:after{content:attr(data-hint)}[aria-label='']:after,[aria-label='']:before,[data-hint='']:after,[data-hint='']:before{display:none!important}.hint--top-left:before,.hint--top-right:before,.hint--top:before{border-top-color:#383838}.hint--bottom-left:before,.hint--bottom-right:before,.hint--bottom:before{border-bottom-color:#383838}.hint--top:after,.hint--top:before{bottom:100%;left:50%}.hint--top:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--bottom:after,.hint--bottom:before{top:100%;left:50%}.hint--bottom:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--right:before{border-right-color:#383838;margin-left:-11px;margin-bottom:-6px}.hint--right:after{margin-bottom:-14px}.hint--right:after,.hint--right:before{left:100%;bottom:50%}.hint--right:hover:after,.hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--left:before{border-left-color:#383838;margin-right:-11px;margin-bottom:-6px}.hint--left:after{margin-bottom:-14px}.hint--left:after,.hint--left:before{right:100%;bottom:50%}.hint--left:hover:after,.hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--top-left:after,.hint--top-left:before{bottom:100%;left:50%}.hint--top-left:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--top-right:after,.hint--top-right:before{bottom:100%;left:50%}.hint--top-right:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--top-right:hover:after,.hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--bottom-left:after,.hint--bottom-left:before{top:100%;left:50%}.hint--bottom-left:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--bottom-right:after,.hint--bottom-right:before{top:100%;left:50%}.hint--bottom-right:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--bottom-right:hover:after,.hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--large:after,.hint--medium:after,.hint--small:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.hint--small:after{width:80px}.hint--medium:after{width:150px}.hint--large:after{width:300px}.hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0 #592726}.hint--error.hint--top-left:before,.hint--error.hint--top-right:before,.hint--error.hint--top:before{border-top-color:#b34e4d}.hint--error.hint--bottom-left:before,.hint--error.hint--bottom-right:before,.hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.hint--error.hint--left:before{border-left-color:#b34e4d}.hint--error.hint--right:before{border-right-color:#b34e4d}.hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0 #6c5328}.hint--warning.hint--top-left:before,.hint--warning.hint--top-right:before,.hint--warning.hint--top:before{border-top-color:#c09854}.hint--warning.hint--bottom-left:before,.hint--warning.hint--bottom-right:before,.hint--warning.hint--bottom:before{border-bottom-color:#c09854}.hint--warning.hint--left:before{border-left-color:#c09854}.hint--warning.hint--right:before{border-right-color:#c09854}.hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0 #1a3c4d}.hint--info.hint--top-left:before,.hint--info.hint--top-right:before,.hint--info.hint--top:before{border-top-color:#3986ac}.hint--info.hint--bottom-left:before,.hint--info.hint--bottom-right:before,.hint--info.hint--bottom:before{border-bottom-color:#3986ac}.hint--info.hint--left:before{border-left-color:#3986ac}.hint--info.hint--right:before{border-right-color:#3986ac}.hint--success:after{background-color:#458746;text-shadow:0 -1px 0 #1a321a}.hint--success.hint--top-left:before,.hint--success.hint--top-right:before,.hint--success.hint--top:before{border-top-color:#458746}.hint--success.hint--bottom-left:before,.hint--success.hint--bottom-right:before,.hint--success.hint--bottom:before{border-bottom-color:#458746}.hint--success.hint--left:before{border-left-color:#458746}.hint--success.hint--right:before{border-right-color:#458746}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--always.hint--top-right:after,.hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--always.hint--bottom-right:after,.hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--left:after,.hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--always.hint--right:after,.hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--rounded:after{border-radius:4px}.hint--no-animate:after,.hint--no-animate:before{-webkit-transition-duration:0s;-moz-transition-duration:0s;transition-duration:0s}.hint--bounce:after,.hint--bounce:before{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.hint--no-shadow:after,.hint--no-shadow:before{text-shadow:initial;box-shadow:initial}