hexo-theme-volantis 5.7.3 → 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,28 @@
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
+
11
+ ## [5.7.5](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.4...v5.7.5) (2022-08-25)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **pandown:** Uncaught TypeError: pandown is not a function ([371b1ec](https://github.com/volantis-x/hexo-theme-volantis/commit/371b1ece729a719f102854d3175ce440f90b4a14))
17
+ * search ([7f11915](https://github.com/volantis-x/hexo-theme-volantis/commit/7f11915c4c672f427a6044e2614ed85e7e052587))
18
+
19
+ ## [5.7.4](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.3...v5.7.4) (2022-08-15)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **#793:** 修复空值 ([302c98f](https://github.com/volantis-x/hexo-theme-volantis/commit/302c98fc5b0c725fb77c6bb33d7537f8f1f2062f))
25
+
3
26
  ## [5.7.3](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.2...v5.7.3) (2022-08-15)
4
27
 
5
28
 
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
@@ -65,7 +65,7 @@
65
65
  const element = n[key];
66
66
  if(element && typeof element !="string"){
67
67
  dfs(element,path.concat(key))
68
- }else{
68
+ }else if(element){
69
69
  let op=path.concat(key)
70
70
  let source=""
71
71
  for (let index = 1; index < op.length; index++) {
@@ -122,5 +122,6 @@
122
122
  // ?time=' + Date.now() 替换为 theme.getStartTime 保证相同资源 hash 不变
123
123
  // 更新:
124
124
  // 本地文件使用文件内容的hash值作为版本号 app.8c1e7c88.js see: /scripts/helpers/revisioned.js
125
+
125
126
  dfs(theme.cdn.set,[])
126
127
  _%>
@@ -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.3",
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
  }
@@ -160,7 +160,7 @@ const replaceRevisionPlaceholder = async () => {
160
160
  })
161
161
  );
162
162
  } catch (error) {
163
-
163
+ hexo.log.error("cdn_version ERROR: " + error);
164
164
  }
165
165
  };
166
166
 
@@ -24,10 +24,10 @@ hexo.extend.tag.register('pandown', function(args) {
24
24
  }
25
25
  let result = '';
26
26
  // js
27
- result += '<div class="tag pandown-tags"><script type="text/javascript" src="https://unpkg.com/pandown"></script>';
27
+ result += '<div class="tag pandown-tags">';
28
28
  //pandown
29
29
  result += '<pandown type="'+type+'" url="'+url+'" pwd="'+pwd+'" fname="'+fname+'"></pandown>'
30
30
  //调用
31
- result += '<script>pandown()</script></div>'
31
+ result += '<script>volantis.js("https://unpkg.com/pandown").then(pandown)</script></div>'
32
32
  return result;
33
33
  });
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,
@@ -1,5 +1,5 @@
1
1
  let SearchService = (() => {
2
- fn = {};
2
+ const fn = {};
3
3
  fn.queryText = null;
4
4
  fn.data = null;
5
5
  fn.template = `<div id="u-search">
@@ -58,8 +58,8 @@ let SearchService = (() => {
58
58
  fn.data = await fn.fetchData();
59
59
  }
60
60
  let results = "";
61
- results += fn.buildResultList(data.pages);
62
- results += fn.buildResultList(data.posts);
61
+ results += fn.buildResultList(fn.data.pages);
62
+ results += fn.buildResultList(fn.data.posts);
63
63
  document.querySelector("#u-search .modal-results").innerHTML = results;
64
64
  window.pjax && pjax.refresh(document.querySelector("#u-search"));
65
65
  document.addEventListener("keydown", function f(event) {
@@ -76,7 +76,7 @@ let SearchService = (() => {
76
76
  return fetch(SearchServiceDataPath)
77
77
  .then((response) => response.text())
78
78
  .then((res) => {
79
- data = JSON.parse(res);
79
+ const data = JSON.parse(res);
80
80
  // console.log(data);
81
81
  return data;
82
82
  });
@@ -87,8 +87,8 @@ let SearchService = (() => {
87
87
  if (post.text) {
88
88
  post.text = post.text.replace(/12345\d*/g, "") // 简易移除代码行号
89
89
  }
90
- if (!post.title&&post.text) {
91
- post.title = post.text.trim().slice(0,15)
90
+ if (!post.title && post.text) {
91
+ post.title = post.text.trim().slice(0, 15)
92
92
  }
93
93
  if (fn.contentSearch(post)) {
94
94
  html += fn.buildResult(post.permalink, post.title, post.digest);