hexo-theme-volantis 5.7.5 → 5.7.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.7.6](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.5...v5.7.6) (2022-09-05)
4
+
5
+
6
+ ### Performance Improvements
7
+
8
+ * **debug:** env pjax rightMenus ([7b569cc](https://github.com/volantis-x/hexo-theme-volantis/commit/7b569cce425c0b630f00e378449c4d8809e471fe))
9
+ * **side:** 如果 sidebar 为空,隐藏 sidebar ([a264a8c](https://github.com/volantis-x/hexo-theme-volantis/commit/a264a8c6f7cb8fd2537af227bd0297fcb17d720c))
10
+
3
11
  ## [5.7.5](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.4...v5.7.5) (2022-08-25)
4
12
 
5
13
 
package/_config.yml CHANGED
@@ -4,7 +4,7 @@ info:
4
4
  theme_docs: https://volantis.js.org/ # This is theme's URL.
5
5
  theme_repo: https://github.com/volantis-x/hexo-theme-volantis
6
6
  # Debug 调试模式
7
- debug: false
7
+ debug: env # false: 关闭调试模式, env:环境配置检查, pjax:调试pjax,rightMenus: 调试右键
8
8
  ############################### 默认占位图 ###############################
9
9
  default:
10
10
  avatar: volantis-static/media/placeholder/avatar/round/3442075.svg # https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  /************这个文件存放不需要重载的全局变量和全局函数*********/
3
3
  window.volantis = {}; // volantis 全局变量
4
- volantis.debug = <%- theme.debug %>; // 开启调试模式
4
+ volantis.debug = "<%- theme.debug %>"; // 调试模式
5
5
  volantis.dom = {}; // 页面Dom see: /source/js/app.js etc.
6
6
 
7
7
  volantis.GLOBAL_CONFIG ={
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  cacheBust: <%= theme.plugins.pjax.cacheBust %>, // url 地址追加时间戳,用以避免浏览器缓存
33
33
  timeout: <%= theme.plugins.pjax.timeout %>,
34
- <% if (theme.debug){ %> debug: true,<% } %>
34
+ <% if (theme.debug === "pjax"){ %> debug: true,<% } %>
35
35
  });
36
36
  });
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.7.5",
3
+ "version": "5.7.6",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -7,7 +7,9 @@ hexo.on('generateBefore', () => {
7
7
  require('./lib/config')(hexo);
8
8
  require('./lib/stellar-tag-utils')(hexo);
9
9
  require('./lib/render-stylus')(hexo);
10
- require('./lib/check-environment')(hexo);
10
+ if (hexo.theme.config.debug === "env") {
11
+ require('./lib/check-environment')(hexo);
12
+ }
11
13
  });
12
14
 
13
15
  hexo.on('ready', () => {
@@ -57,6 +57,10 @@ Hexo: 5.4 ~ 6.x
57
57
  hexo-cli: 4.3 ~ latest
58
58
  node.js: 16.x LTS ~ latest LTS
59
59
  npm: 8.x ~ latest LTS
60
+ ============================================================
61
+ # 当前 Debug 调试模式
62
+ debug: env
63
+ 关闭调试模式主题配置文件设置 debug: false
60
64
  ============================================================`);
61
65
  throw new Error('环境配置检查失败!| Environment configuration check failed!');
62
66
  }
@@ -67,6 +71,10 @@ function CheckConfError(hexo,msg) {
67
71
  配置文件检查失败!| Configuration check failed!
68
72
  ============================================================
69
73
  ${msg}
74
+ ============================================================
75
+ # 当前 Debug 调试模式
76
+ debug: env
77
+ 关闭调试模式主题配置文件设置 debug: false
70
78
  ============================================================`);
71
79
  throw new Error('配置文件检查失败!| Configuration check failed!');
72
80
  }
package/source/js/app.js CHANGED
@@ -29,10 +29,10 @@ const locationHash = () => {
29
29
  if (target) {
30
30
  setTimeout(() => {
31
31
  if (window.location.hash.startsWith('#fn')) { // hexo-reference https://github.com/volantis-x/hexo-theme-volantis/issues/647
32
- volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant', observer:true })
32
+ volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant', observer: true })
33
33
  } else {
34
34
  // 锚点中上半部有大片空白 高度大概是 volantis.dom.header.offsetHeight
35
- volantis.scroll.to(target, { addTop: 5, behavior: 'instant', observer:true })
35
+ volantis.scroll.to(target, { addTop: 5, behavior: 'instant', observer: true })
36
36
  }
37
37
  }, 1000)
38
38
  }
@@ -71,6 +71,15 @@ const VolantisApp = (() => {
71
71
  fn.scrolltoElement(volantis.dom.bodyAnchor);
72
72
  });
73
73
 
74
+ // 如果 sidebar 为空,隐藏 sidebar。
75
+ const sidebar = document.querySelector("#l_side")
76
+ if (sidebar) {
77
+ const sectionList = sidebar.querySelectorAll("section")
78
+ if (!sectionList.length) {
79
+ document.querySelector("#l_main").classList.add("no_sidebar")
80
+ }
81
+ }
82
+
74
83
  // 站点信息 最后活动日期
75
84
  if (volantis.GLOBAL_CONFIG.sidebar.for_page.includes('webinfo') || volantis.GLOBAL_CONFIG.sidebar.for_post.includes('webinfo')) {
76
85
  const lastupd = volantis.GLOBAL_CONFIG.sidebar.webinfo.lastupd;
@@ -381,7 +381,7 @@ RightMenus.fun = (() => {
381
381
  fn[eventName]()
382
382
  }
383
383
  } catch (error) {
384
- if (volantis.GLOBAL_CONFIG.debug) {
384
+ if (volantis.GLOBAL_CONFIG.debug === "rightMenus") {
385
385
  console.error({
386
386
  id: id,
387
387
  error: error,