hexo-theme-volantis 5.0.0-rc.7 → 5.1.0

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +4 -4
  3. package/_config.yml +173 -69
  4. package/layout/_meta/counter.ejs +27 -5
  5. package/layout/_meta/walinecount.ejs +2 -1
  6. package/layout/_partial/article.ejs +2 -2
  7. package/layout/_partial/head.ejs +29 -25
  8. package/layout/_partial/header.ejs +1 -1
  9. package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +1 -0
  10. package/layout/_partial/scripts/content-visibility-scroll-fix.ejs +71 -69
  11. package/layout/_partial/scripts/global.ejs +49 -23
  12. package/layout/_partial/scripts/index.ejs +26 -9
  13. package/layout/_partial/scripts/toc.ejs +61 -38
  14. package/layout/_plugins/_page_plugins/indent/index.ejs +1 -1
  15. package/layout/_plugins/_page_plugins/index.ejs +27 -7
  16. package/layout/_plugins/_page_plugins/snackbar/index.ejs +1 -1
  17. package/layout/_plugins/analytics/script.ejs +11 -1
  18. package/layout/_plugins/aplayer/script.ejs +2 -2
  19. package/layout/_plugins/comments/artalk/script.ejs +17 -11
  20. package/layout/_plugins/comments/beaudar/script.ejs +2 -2
  21. package/layout/_plugins/comments/discuss/script.ejs +30 -0
  22. package/layout/_plugins/comments/hashover/script.ejs +2 -2
  23. package/layout/_plugins/comments/index.ejs +4 -4
  24. package/layout/_plugins/comments/twikoo/script.ejs +1 -1
  25. package/layout/_plugins/comments/waline/script.ejs +40 -22
  26. package/layout/_plugins/parallax/script.ejs +1 -1
  27. package/layout/_plugins/pjax/index.ejs +3 -4
  28. package/layout/_plugins/pjax/pdata.ejs +0 -1
  29. package/layout/_plugins/rightmenu/layout.ejs +2 -2
  30. package/layout/_plugins/rightmenus/layout.ejs +137 -0
  31. package/layout/_plugins/search/script.ejs +14 -7
  32. package/layout/_widget/lastupdate.ejs +27 -27
  33. package/layout/_widget/webinfo.ejs +7 -7
  34. package/layout/layout.ejs +20 -3
  35. package/layout/tag.ejs +1 -1
  36. package/package.json +1 -1
  37. package/scripts/events/index.js +1 -0
  38. package/scripts/events/lib/check-configuration.js +43 -0
  39. package/scripts/events/lib/check-environment.js +74 -0
  40. package/scripts/events/lib/render-stylus.js +1 -1
  41. package/scripts/filters/content-visibility.js +2 -2
  42. package/scripts/helpers/custom-files.js +3 -1
  43. package/scripts/helpers/head/generate_seo.js +1 -1
  44. package/scripts/helpers/head/generate_title__keywords__description.js +14 -4
  45. package/scripts/helpers/structured-data/lib/blogposting.js +18 -6
  46. package/scripts/helpers/structured-data/lib/breadcrumblist.js +25 -1
  47. package/scripts/helpers/structured-data/lib/index.js +1 -9
  48. package/scripts/tags/fancybox.js +1 -1
  49. package/scripts/tags/note.js +24 -1
  50. package/scripts/tags/tabs.js +85 -86
  51. package/source/css/_defines/AutoPrefixCSS.styl +16 -16
  52. package/source/css/_defines/color.styl +23 -2
  53. package/source/css/_first/base_first.styl +5 -0
  54. package/source/css/_first/dark_first.styl +30 -29
  55. package/source/css/_first/navbar_first.styl +1 -1
  56. package/source/css/_style/_base/base.styl +2 -2
  57. package/source/css/_style/_layout/toc.styl +2 -2
  58. package/source/css/_style/_plugins/_dark/dark_async.styl +1 -1
  59. package/source/css/_style/_plugins/_dark/dark_plugins.styl +21 -5
  60. package/source/css/_style/_plugins/_highlight/highlightjs/clipboard.styl +1 -1
  61. package/source/css/_style/_plugins/_rightmenu/reading.styl +2 -2
  62. package/source/css/_style/_plugins/_rightmenu/rightmenu.styl +3 -2
  63. package/source/css/_style/_plugins/fontcolor.styl +1 -1
  64. package/source/css/_style/_plugins/index.styl +1 -1
  65. package/source/css/first.styl +5 -7
  66. package/source/js/app.js +69 -41
  67. package/source/js/plugins/aplayer.js +1 -3
  68. package/source/js/plugins/rightMenu.js +22 -22
  69. package/source/js/plugins/rightMenus.js +616 -0
  70. package/source/js/search/hexo.js +3 -0
  71. package/layout/_partial/scripts/import.ejs +0 -3
  72. package/scripts/filters/CSP.js +0 -74
@@ -0,0 +1,30 @@
1
+ <script>
2
+ volantis.layoutHelper("comments",`<div id="discuss_container"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`)
3
+ function load_discuss() {
4
+ if(!document.querySelectorAll("#discuss_container")[0])return;
5
+ volantis.js("<%- theme.comments.discuss.js %>", pjax_discuss)
6
+ }
7
+ function pjax_discuss() {
8
+ if(!document.querySelectorAll("#discuss_container")[0])return;
9
+ let path = pdata.commentPath;
10
+ let placeholder = pdata.commentPlaceholder || "<%= theme.comments.discuss.ph %>" || "";
11
+ if (path.length == 0) {
12
+ let defaultPath = '<%= theme.comments.discuss.path %>';
13
+ path = defaultPath || decodeURI(window.location.pathname);
14
+ }
15
+
16
+ Discuss.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.discuss) %>, {
17
+ el: '#discuss_container',
18
+ path: path,
19
+ ph: placeholder
20
+ }),pdata.commentConfig))
21
+ }
22
+ load_discuss();
23
+ volantis.pjax.push(()=>{
24
+ if (typeof Discuss == "undefined") {
25
+ load_discuss();
26
+ } else {
27
+ pjax_discuss();
28
+ }
29
+ },'discuss');
30
+ </script>
@@ -1,5 +1,5 @@
1
1
  <script>
2
2
  volantis.layoutHelper("comments",`<p>未注册者输入用户名和密码登录即相当于注册,之后以同一用户名和密码登录可以编辑自己之前的评论。留邮箱可接收回复通知。支持全匿名评论。</p>
3
3
  <div id="hashover"></div>`)
4
- </script>
5
- <script data-pjax type="text/javascript" src="<%= theme.comments.hashover.src %>"></script>
4
+ </script>
5
+ <script data-pjax type="text/javascript" src="<%= theme.comments.hashover.src %>"></script>
@@ -5,8 +5,8 @@
5
5
  }
6
6
  %>
7
7
  <% if (checkComment&&(theme.comments.service && theme.comments.service.length > 0)) { %>
8
-
9
- <article class="post white-box reveal <%- theme.custom_css.body.effect.join(' ') %>" id="comments">
8
+
9
+ <article class="post white-box <%- theme.custom_css.body.effect.join(' ') %>" id="comments">
10
10
  <span hidden>
11
11
  <meta itemprop="discussionUrl" content="<%- url_for(path) %>#comments">
12
12
  </span>
@@ -14,11 +14,11 @@
14
14
  <% if (theme.comments && theme.comments.subtitle) { %>
15
15
  <p cst><%- theme.comments.subtitle %></p>
16
16
  <% } %>
17
-
17
+
18
18
  <div id="layoutHelper-comments"></div>
19
19
 
20
20
  </article>
21
-
21
+
22
22
  <% } else { %>
23
23
  <% page.comments = false; %>
24
24
  <% } %>
@@ -10,7 +10,7 @@
10
10
  let placeholder = pdata.commentPlaceholder || "<%= theme.comments.twikoo.placeholder %>" || "";
11
11
  if (path.length == 0) {
12
12
  let defaultPath = '<%= theme.comments.twikoo.path %>';
13
- path = defaultPath || "decodeURI(window.location.pathname)"; //神奇的pathname 没错,twikoo这里就是字符串,不要乱动了
13
+ path = defaultPath || decodeURI(window.location.pathname);
14
14
  }
15
15
  twikoo.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.twikoo) %>, {
16
16
  el: '#twikoo_container',
@@ -1,44 +1,62 @@
1
1
  <script>
2
2
  volantis.layoutHelper("comments",`<div id="waline"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`)
3
+
3
4
  function pjax_waline() {
4
5
  if(!document.querySelector("#waline"))return;
5
- let pagePlaceholder = pdata.commentPlaceholder || "<%= theme.comments.waline.placeholder %>";
6
+ let locale = {};
6
7
  let path = pdata.commentPath;
8
+ let pagePlaceholder = pdata.commentPlaceholder || "<%= theme.comments.waline.placeholder %>";
7
9
  if (path.length == 0) {
8
10
  let defaultPath = '<%= theme.comments.waline.path %>';
9
11
  path = defaultPath || decodeURI(window.location.pathname);
10
12
  }
11
- new Waline(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
12
- el: '#waline',
13
- path: path,
14
- placeholder: pagePlaceholder,
15
-
16
- // https://github.com/volantis-x/hexo-theme-volantis/issues/713
17
- <% if(theme.comments.waline.imageHosting){ %>
18
- uploadImage: function(file) {
19
- const formData = new FormData();
20
- formData.append('image', file);
21
- return fetch('<%= theme.comments.waline.imageHosting %>', {
22
- method: 'POST',
23
- body: formData
24
- }).then(resp => resp.json()).then(resp => resp.data.url);
25
- }
26
- <% } %>
27
-
28
- }),pdata.commentConfig));
13
+ if(pagePlaceholder.length != 0) {
14
+ locale.placeholder = pagePlaceholder;
15
+ }
16
+
17
+ try {
18
+ Waline.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
19
+ el: '#waline',
20
+ path: path,
21
+ // https://github.com/volantis-x/hexo-theme-volantis/issues/713
22
+ <% if(!!theme.comments.waline.imageUploader?.api){ %>
23
+ imageUploader: function(file) {
24
+ let headers = new Headers();
25
+ headers.set('Accept', 'application/json');
26
+ <% if(!!theme.comments.waline.imageUploader?.token) { %>
27
+ headers.set('Authorization', '<%= theme.comments.waline.imageUploader?.token %>')
28
+ <% } %>
29
+ let formData = new FormData();
30
+ formData.append('file', file);
31
+ return fetch('<%= theme.comments.waline.imageUploader?.api %>',{
32
+ method: 'POST',
33
+ body: formData,
34
+ headers: headers
35
+ }).then((resp) => resp.json())
36
+ .then((resp) => resp.<%= theme.comments.waline.imageUploader?.resp %>)
37
+ },
38
+ <% } %>
39
+ locale,
40
+ }),pdata.commentConfig));
41
+ } catch (error) {
42
+ alert(`Waline ${error}`)
43
+ }
29
44
  fancybox_waline()
30
45
  }
46
+
31
47
  function fancybox_waline() {
32
48
  if(typeof VolantisFancyBox === "undefined") {
33
49
  const checkFancyBox = setInterval(() => {
34
50
  if(typeof VolantisFancyBox === "undefined") return;
35
51
  clearInterval(checkFancyBox);
36
- VolantisFancyBox.bind('#waline .vcontent img:not(.vemoji)');
52
+ VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
37
53
  })
38
54
  } else {
39
- VolantisFancyBox.bind('#waline .vcontent img:not(.vemoji)');
55
+ VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
40
56
  }
41
57
  }
58
+
59
+ volantis.css('<%= theme.comments.waline.css %>')
42
60
  volantis.js('<%- theme.comments.waline.js %>').then(pjax_waline)
43
61
  volantis.pjax.push(pjax_waline);
44
- </script>
62
+ </script>
@@ -1,5 +1,5 @@
1
1
  <%_
2
- theme.plugins.parallax.images = theme.plugins.parallax.images || page.images;
2
+ theme.plugins.parallax.images = theme.plugins.parallax.images || page.images;
3
3
  if (theme.plugins.parallax.shuffle) {
4
4
  // shuffle 只一次 防止 hash 变化
5
5
  if (typeof theme.plugins.parallax.shuffle_end==='undefined') {
@@ -1,4 +1,4 @@
1
- <!--
1
+ <!--
2
2
  pjax重载区域接口:
3
3
  1. <pjax></pjax> 标签 pjax 标签必须存在于所有页面 否则 pjax error
4
4
  2. script[data-pjax]
@@ -20,9 +20,8 @@
20
20
  elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox]):not([onclick="return false;"]):not([onclick="return!1"]):not([target="_blank"]):not([target="view_window"]):not([href$=".xml"])',
21
21
  selectors: [
22
22
  "head title",
23
- "head meta[name='description']",
24
- "head meta[name='keywords']",
25
- "head meta[property^='og']",
23
+ "head meta[name=keywords]",
24
+ "head meta[name=description]",
26
25
  <% if (!theme.plugins.pjax.cover){ %>"#l_cover",<% } %>
27
26
  "#l_main",
28
27
  "#pjax-header-nav-list",
@@ -31,7 +31,6 @@ if (page && page.layout == 'post' && page.title) {
31
31
  <script>
32
32
  window.pdata={}
33
33
  pdata.ispage=<%=ispage%>;
34
- pdata.postTitle="<%=postTitle%>";
35
34
  pdata.commentPath="<%=commentPath%>";
36
35
  pdata.commentPlaceholder="<%=commentPlaceholder%>";
37
36
  pdata.commentConfig=<%- JSON.stringify(commentConfig) %>;
@@ -80,13 +80,13 @@
80
80
  <span class='vlts-menu opt fix-cursor-default' id='printHtml'>
81
81
  <i class='<%= theme.rightmenu.print.icon %> fa-fw '></i> <%- trim(theme.rightmenu.print.name) %>
82
82
  </span>
83
- </li>
83
+ </li>
84
84
  <% } else if (item == 'reading') { %>
85
85
  <li class='option menuOption-Content'>
86
86
  <span class='vlts-menu opt fix-cursor-default' id='readingModel'>
87
87
  <i class='<%= theme.rightmenu.reading.icon %> fa-fw '></i> <%- trim(theme.rightmenu.reading.name) %>
88
88
  </span>
89
- </li>
89
+ </li>
90
90
  <% } else if (item == 'music' && theme.plugins.aplayer.enable == true) { %>
91
91
  <div id="menuMusic">
92
92
  <li class='music name menuOption-Content'>
@@ -0,0 +1,137 @@
1
+ <%
2
+ const rightMenu = {
3
+ defaultEvent: ['copyText', 'copyLink', 'copyPaste', 'copyAll', 'copyCut', 'copyImg', 'printMode', 'readMode'],
4
+ defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'elementImage', 'articlePage'],
5
+ dataGet: (data, keyStr) => {
6
+ const keys = keyStr.split('.');
7
+ let currentData = data;
8
+ for (const key of keys) {
9
+ currentData = currentData?.[key];
10
+ }
11
+ return currentData;
12
+ },
13
+ initMenu: () => {
14
+ theme.rightmenus.order.forEach(item => {
15
+ let data = rightMenu.dataGet(theme.rightmenus, item);
16
+ if(item.includes('navigation')) {
17
+ rightMenu.loadNavigation(data)
18
+ } else if (item === 'music') {
19
+ rightMenu.loadMusic()
20
+ } else {
21
+ if(Array.isArray(data)) {
22
+ data.forEach(item => {
23
+ rightMenu.loadMenu(item)
24
+ })
25
+ } else {
26
+ rightMenu.loadMenu(data)
27
+ }
28
+ }
29
+ })
30
+ },
31
+ initFunction: () => {
32
+ theme.rightmenus.order.forEach(item => {
33
+ let data = rightMenu.dataGet(theme.rightmenus, item);
34
+ if(Array.isArray(data)) {
35
+ data.forEach(item => {
36
+ rightMenu.rederFunction(item)
37
+ })
38
+ } else {
39
+ rightMenu.rederFunction(data)
40
+ }
41
+ })
42
+ }
43
+ }
44
+ %>
45
+
46
+ <% rightMenu.loadMenu = item => { %>
47
+ <% if(item === undefined) { %>
48
+ <hr class="menuLoad-Content" >
49
+ <% } else if(item['id'] === undefined) { %>
50
+ <hr class="menuLoad-Content" >
51
+ <% } else if(item['link'] === undefined) { %>
52
+ <li class="menuLoad-Content">
53
+ <span class="vlts-menu fix-cursor-default event" id="<%- item.id %>" data-event="<%- item.event %>" data-group="<%- item.group %>">
54
+ <i class="<%- item.icon %> fa-fw"></i>
55
+ <%- item.name %>
56
+ </span>
57
+ </li>
58
+ <% } else { %>
59
+ <li class="menuLoad-Content">
60
+ <a class="vlts-menu fix-cursor-default" id="<%- item.id %>" href="<%- item.link %>" data-group="<%- item.group %>">
61
+ <i class="<%- item.icon %> fa-fw"></i>
62
+ <%- item.name %>
63
+ </a>
64
+ </li>
65
+ <% } %>
66
+ <% } %>
67
+
68
+
69
+ <% rightMenu.loadNavigation = objs => { %>
70
+ <li class='navigation menuNavigation-Content'>
71
+ <% objs.forEach(item => { %>
72
+ <% if(item.link === undefined) { %>
73
+ <a class="nav icon-only fix-cursor-default" onclick="<%- item.event %>"><i class="<%- item.icon %> fa-fw"></i></a>
74
+ <% } else { %>
75
+ <a class="nav icon-only fix-cursor-default" href="<%- item.link %>"><i class="<%- item.icon %> fa-fw"></i></a>
76
+ <% } %>
77
+ <% }) %>
78
+ </li>
79
+ <% } %>
80
+
81
+
82
+ <% rightMenu.rederFunction = item => { %>
83
+ <% if (!!item && !!item['event'] && item['group'] !== 'navigation') { %>
84
+ <% if (rightMenu.defaultEvent.some(value => { return value === item['event'] })) { %>
85
+ <!-- RightMenusFunction['<%- item.id %>'] = (fun) => {fun()} -->
86
+ <% } else if (item['group'] === 'seletctText') { %>
87
+ RightMenusFunction['<%- item.id %>'] = (__text__) => {<%- item.event %>}
88
+ <% } else if (item['group'] === 'elementCheck' || item['group'] === 'elementImage') { %>
89
+ RightMenusFunction['<%- item.id %>'] = (__link__) => {<%- item.event %>}
90
+ <% } else { %>
91
+ RightMenusFunction['<%- item.id %>'] = () => {<%- item.event %>}
92
+ <% } %>
93
+ <% } %>
94
+ <% } %>
95
+
96
+
97
+ <% rightMenu.loadMusic = () => { %>
98
+ <div id="menuMusic">
99
+ <li class='music name menuOption-Content'>
100
+ <p class='nav music-title fix-cursor-default'></p>
101
+ </li>
102
+ <li class='music ctrl'>
103
+ <a class='nav icon-only backward fix-cursor-default' href="/" onclick="return false;" title="backward">
104
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-step-backward fa-fw'></i>
105
+ </a>
106
+ <a class='nav icon-only toggle fix-cursor-default' href="/" onclick="return false;" title="toggle">
107
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-play fa-fw'></i>
108
+ </a>
109
+ <a class='nav icon-only forward fix-cursor-default' href="/" onclick="return false;" title="forward">
110
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-step-forward fa-fw'></i>
111
+ </a>
112
+ </li>
113
+ <li class='music volume'>
114
+ <div class='nav volume'>
115
+ <div class="aplayer-volume-bar-wrap">
116
+ <div class="aplayer-volume-bar fix-cursor-pointer">
117
+ <div class="aplayer-volume"></div>
118
+ <i class='left <%= theme.rightmenus.options.iconPrefix %> fa-volume-off fa-fw'></i>
119
+ <i class='right <%= theme.rightmenus.options.iconPrefix %> fa-volume-up fa-fw'></i>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </li>
124
+ </div>
125
+ <% } %>
126
+
127
+
128
+ <div id="rightmenu-wrapper">
129
+ <ul class="list-v rightmenu" id="rightmenu-content">
130
+ <% rightMenu.initMenu() %>
131
+ </ul>
132
+ </div>
133
+ <script src="<%- theme.cdn.map.js.rightMenus %>"></script>
134
+ <script>
135
+ const RightMenusFunction = {};
136
+ <% rightMenu.initFunction() %>
137
+ </script>
@@ -1,7 +1,7 @@
1
1
  <script>
2
- const SearchServiceDataPathRoot = ("<%- config.root %>" || "/").endsWith("/")
3
- ? "<%- config.root %>" || "/"
4
- : "<%- config.root %>/" || "/";
2
+ const SearchServiceDataPathRoot = ("<%- config.root %>" || "/").endsWith("/") ?
3
+ "<%- config.root %>" || "/" :
4
+ "<%- config.root %>/" || "/";
5
5
  const SearchServiceDataPath = SearchServiceDataPathRoot + "content.json";
6
6
 
7
7
  function loadSearchScript() {
@@ -16,16 +16,23 @@
16
16
  });
17
17
 
18
18
  document.querySelectorAll(".u-search-form").forEach((e) => {
19
- e.addEventListener("submit", (event)=>{event.preventDefault();}, false);
19
+ e.addEventListener("submit", (event) => {
20
+ event.preventDefault();
21
+ }, false);
20
22
  });
21
23
  }
22
24
 
23
25
  // 打开并搜索 字符串 s
24
26
  function OpenSearch(s) {
25
- loadSearchScript().then(() => {
27
+ if (typeof SearchService === 'undefined')
28
+ loadSearchScript().then(() => {
29
+ SearchService.setQueryText(s);
30
+ SearchService.search();
31
+ });
32
+ else {
26
33
  SearchService.setQueryText(s);
27
34
  SearchService.search();
28
- });
35
+ }
29
36
  }
30
37
 
31
38
  // 访问含有 ?s=xxx 的链接时打开搜索 // 与搜索引擎 structured data 相关: /scripts/helpers/structured-data/lib/config.js
@@ -40,4 +47,4 @@
40
47
  document.querySelectorAll(".input.u-search-input").forEach((e) => {
41
48
  e.addEventListener("focus", loadSearchService, false);
42
49
  });
43
- </script>
50
+ </script>
@@ -1,27 +1,27 @@
1
- <%
2
- function genList() {
3
- let content = '';
4
- site.posts.filter(p => {
5
- return p.title && p.title.length > 0;
6
- }).sort("updated", -1).limit(5).each(item => {
7
- content += `<li><a class="widget-last" href="${url_for(item.link || item.path)}">`;
8
- content += '<div class="item">';
9
- content += `<time>${date(item.updated, config.date_format)}</time>`;
10
- item.categories.limit(1).forEach((cat, i) => {
11
- content += `<span>${cat.name}</span>`;
12
- });
13
- content += '</div>';
14
- content += `<span>${item.title}</span>`;
15
- content += '</a></li>';
16
- content += '';
17
- })
18
- return `<ul class="list entry navigation">${content}</ul>`;
19
- }
20
- %>
21
- <%- partial('_pre') %>
22
- <section class="widget <%- page.widget_style %> <%- page.widget_platform %> <%- page.widget_pjax %>">
23
- <%- partial('header', {item: item}) %>
24
- <div class='content'>
25
- <%- genList() %>
26
- </div>
27
- </section>
1
+ <%
2
+ function genList() {
3
+ let content = '';
4
+ site.posts.filter(p => {
5
+ return p.title && p.title.length > 0;
6
+ }).sort("updated", -1).limit(5).each(item => {
7
+ content += `<li><a class="widget-last" href="${url_for(item.link || item.path)}">`;
8
+ content += '<div class="item">';
9
+ content += `<time>${date(item.updated, config.date_format)}</time>`;
10
+ item.categories.limit(1).forEach((cat, i) => {
11
+ content += `<span>${cat.name}</span>`;
12
+ });
13
+ content += '</div>';
14
+ content += `<span>${item.title}</span>`;
15
+ content += '</a></li>';
16
+ content += '';
17
+ })
18
+ return `<ul class="list entry navigation">${content}</ul>`;
19
+ }
20
+ %>
21
+ <%- partial('_pre') %>
22
+ <section class="widget <%- page.widget_style %> <%- page.widget_platform %> <%- page.widget_pjax %>">
23
+ <%- partial('header', {item: item}) %>
24
+ <div class='content'>
25
+ <%- genList() %>
26
+ </div>
27
+ </section>
@@ -25,23 +25,23 @@
25
25
  </div>
26
26
  <% } %>
27
27
 
28
- <% if (item.type.visitcounter.siteuv.enable && item.type.visitcounter.service) { %>
28
+ <% if (item.type.visitcounter.siteuv.enable && (!!theme.analytics.busuanz || !!theme.analytics.leancloud.app_id)) { %>
29
29
  <div class="webinfo-item">
30
30
  <div><%= item.type.visitcounter.siteuv.text %></div>
31
- <% if (item.type.visitcounter.service == "busuanzi") {%>
31
+ <% if (!!theme.analytics.busuanz) {%>
32
32
  <div><span id="busuanzi_value_site_uv"><i class="fa-solid fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> <%= item.type.visitcounter.siteuv.unit %></div>
33
- <% } else if (item.type.visitcounter.service == "leancloud") { %>
33
+ <% } else { %>
34
34
  <div><span id="lc-uv"><span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.siteuv.unit %></div>
35
35
  <% } %>
36
36
  </div>
37
37
  <% } %>
38
38
 
39
- <% if (item.type.visitcounter.sitepv.enable && item.type.visitcounter.service) { %>
39
+ <% if (item.type.visitcounter.sitepv.enable && (!!theme.analytics.busuanz || !!theme.analytics.leancloud.app_id)) { %>
40
40
  <div class="webinfo-item">
41
41
  <div><%= item.type.visitcounter.sitepv.text %></div>
42
- <% if (item.type.visitcounter.service == "busuanzi") {%>
42
+ <% if (!!theme.analytics.busuanz) {%>
43
43
  <div><span id="busuanzi_value_site_pv"><i class="fa-solid fa-fan fa-spin fa-fw" aria-hidden="true"></i></span> <%= item.type.visitcounter.sitepv.unit %></div>
44
- <% } else if (item.type.visitcounter.service == "leancloud") { %>
44
+ <% } else { %>
45
45
  <div><span id="lc-sv"><span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span></span> <%= item.type.visitcounter.sitepv.unit %></div>
46
46
  <% } %>
47
47
  </div>
@@ -50,7 +50,7 @@
50
50
  <% if (item.type.lastupd.enable) { %>
51
51
  <div class="webinfo-item">
52
52
  <div><%= item.type.lastupd.text %></div>
53
- <div id="last-update-show"><%- date(Date.now()) %> <%= item.type.lastupd.unit %></div>
53
+ <div id="last-update-show"><%- date(Date.now()) %> <%= item.type.lastupd.unit %></div>
54
54
  </div>
55
55
  <% } %>
56
56
  </div>
package/layout/layout.ejs CHANGED
@@ -3,6 +3,16 @@
3
3
  <%- partial('_partial/scripts/_ctrl') _%>
4
4
  <%- partial('_partial/head') _%>
5
5
  <body itemscope itemtype="http://schema.org/WebPage">
6
+ <!-- import body_begin begin-->
7
+ <%_ if (config.import && config.import.body_begin){ _%>
8
+ <%_ ([...config.import.body_begin]).forEach(function(item){ _%>
9
+ <%- item %>
10
+ <%_ }) _%>
11
+ <%_ } _%>
12
+ <!-- import body_begin end-->
13
+ <!-- Custom Files bodyBegin begin-->
14
+ <%- volantis_inject('bodyBegin') %>
15
+ <!-- Custom Files bodyBegin end-->
6
16
  <%- partial('_partial/header', null, {cache: false, path: path}) %>
7
17
  <div id="l_body">
8
18
  <%- partial('_partial/cover') %>
@@ -21,8 +31,15 @@
21
31
  <%- partial('_plugins/pjax/index') %>
22
32
  <% } %>
23
33
  </div>
24
- <!-- Custom Files bodyEnd begin-->
25
- <%- volantis_inject('bodyEnd') %>
26
- <!-- Custom Files bodyEnd end-->
34
+ <!-- import body_end begin-->
35
+ <%_ if (config.import && config.import.body_end){ _%>
36
+ <%_ ([...config.import.body_end]).forEach(function(item){ _%>
37
+ <%- item %>
38
+ <%_ }) _%>
39
+ <%_ } _%>
40
+ <!-- import body_end end-->
41
+ <!-- Custom Files bodyEnd begin-->
42
+ <%- volantis_inject('bodyEnd') %>
43
+ <!-- Custom Files bodyEnd end-->
27
44
  </body>
28
45
  </html>
package/layout/tag.ejs CHANGED
@@ -1,5 +1,5 @@
1
1
  <%- partial('_pre') %>
2
- <%
2
+ <%
3
3
  page.comments = false;
4
4
  if (!page.robots) {
5
5
  page.robots = 'noindex,follow';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.0.0-rc.7",
3
+ "version": "5.1.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -7,6 +7,7 @@ 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
11
  });
11
12
 
12
13
  hexo.on('ready', () => {
@@ -0,0 +1,43 @@
1
+ module.exports =(hexo) => {
2
+ try {
3
+ let config = hexo.config;
4
+ let themeConfig = hexo.theme.config;
5
+ if (!config.title) {
6
+ return `title 未配置!
7
+ 请在站点配置 _config.yml 中配置 title
8
+ see: https://hexo.io/zh-cn/docs/configuration
9
+ title not configured!
10
+ see: https://hexo.io/zh-cn/docs/configuration`
11
+ }
12
+ if (!config.description) {
13
+ return `description 未配置!
14
+ 请在站点配置 _config.yml 中配置 description
15
+ description主要用于SEO,告诉搜索引擎一个关于您站点的简单描述,通常建议在其中包含您网站的关键词。
16
+ see: https://hexo.io/zh-cn/docs/configuration
17
+ description not configured!
18
+ see: https://hexo.io/zh-cn/docs/configuration`
19
+ }
20
+ if (themeConfig?.search?.service===`google`||themeConfig?.search?.service===`algolia`||themeConfig?.search?.service===`azure`||themeConfig?.search?.service===`baidu`) {
21
+ return `原 google, algolia, azure, baidu 站内搜索 系祖传代码, 且文档丢失, 不便后续维护 在 5.0 版本被移除
22
+ The google, algolia, azure, baidu site search is ancestral code, and the document is lost, which is inconvenient for subsequent maintenance. It was removed in version 5.0
23
+ see: https://volantis.js.org/v5/theme-settings/#站内搜索`
24
+ }
25
+ if (`backstretch` in themeConfig?.plugins) {
26
+ return `jquery.backstretch 在 5.0 版本被移除, 被 parallax 替代
27
+ jquery.backstretch was removed in version 5.0, replaced by parallax
28
+ see: https://volantis.js.org/v5/theme-settings/#幻灯片背景-视差滚动效果`
29
+ }
30
+ if ("valinecount" in themeConfig?.article?.body?.top_meta||"valinecount" in themeConfig?.article?.body?.bottom_meta||"valinecount" in themeConfig?.article?.body?.meta_library) {
31
+ return `ValineCount 在 5.0 版本被移除
32
+ ValineCount has been removed in 5.0 version
33
+ see: https://volantis.js.org/v5/theme-settings/#文章布局配置`
34
+ }
35
+ if (themeConfig?.comments?.service=="valine"||themeConfig?.comments?.service=="minivaline") {
36
+ return `Valine 在 5.0 版本被移除
37
+ Valine has been removed in 5.0 version
38
+ see: https://volantis.js.org/v5/theme-settings/#选择评论系统`
39
+ }
40
+ } catch (error) {}
41
+ return true;
42
+ };
43
+