hexo-theme-volantis 5.7.10 → 5.8.1

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.8.1](https://github.com/volantis-x/hexo-theme-volantis/compare/5.8.0...5.8.1) (2025-08-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * 修改artalk的ejs文件适配2.9.1新版本 ([#943](https://github.com/volantis-x/hexo-theme-volantis/issues/943)) ([2447977](https://github.com/volantis-x/hexo-theme-volantis/commit/2447977efad1a17177686cf4ed68d23c49809bce))
9
+
10
+ ## [5.8.0](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.10...5.8.0) (2023-05-06)
11
+
12
+
13
+ ### Features
14
+
15
+ * **head and body template:** 支持在front-matter中动态插入css和js,支持引入多个 ([#883](https://github.com/volantis-x/hexo-theme-volantis/issues/883)) ([3146360](https://github.com/volantis-x/hexo-theme-volantis/commit/3146360ecf3955314768fde46226632bf86b4e45))
16
+
3
17
  ## [5.7.10](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.9...5.7.10) (2023-04-28)
4
18
 
5
19
 
@@ -34,6 +34,13 @@
34
34
  <!-- Custom Files headBegin begin-->
35
35
  <%- volantis_inject('headBegin') %>
36
36
  <!-- Custom Files headBegin end-->
37
+ <!-- front-matter head_begin begin -->
38
+ <%_ if (page.import && page.import.head_begin){ _%>
39
+ <%_ getList(page.import.head_begin).forEach(function(item){ _%>
40
+ <%- item %>
41
+ <%_ }) _%>
42
+ <%_ } _%>
43
+ <!-- front-matter head_begin end -->
37
44
  <%_ if (config.favicon) { _%>
38
45
  <link rel="shortcut icon" type='image/x-icon' href="<%- url_for(config.favicon) %>">
39
46
  <%_ } _%>
@@ -76,4 +83,11 @@
76
83
  <!-- Custom Files headEnd begin-->
77
84
  <%- volantis_inject('headEnd') %>
78
85
  <!-- Custom Files headEnd end-->
86
+ <!-- front-matter head_end begin -->
87
+ <%_ if (page.import && page.import.head_end){ _%>
88
+ <%_ getList(page.import.head_end).forEach(function(item){ _%>
89
+ <%- item %>
90
+ <%_ }) _%>
91
+ <%_ } _%>
92
+ <!-- front-matter head_end end -->
79
93
  </head>
@@ -1,23 +1,37 @@
1
1
  <script>
2
- volantis.layoutHelper("comments",`<div id="artalk_container"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`);
2
+ volantis.layoutHelper("comments", `<div id="artalk_container"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`);
3
+
3
4
  function load_artalk() {
4
- if(!document.querySelectorAll("#artalk_container")[0])return;
5
+ if (!document.querySelector("#artalk_container")) return;
6
+
5
7
  volantis.css("<%- theme.comments.artalk.css %>");
6
- volantis.js("<%- theme.comments.artalk.js %>").then(pjax_artalk);
8
+
9
+ volantis.js("<%- theme.comments.artalk.js %>")
10
+ .then(() => {
11
+ if (typeof Artalk === 'undefined') {
12
+ console.error('Artalk.js loaded but Artalk is not defined');
13
+ return;
14
+ }
15
+ return pjax_artalk();
16
+ })
17
+ .catch(err => {
18
+ console.error('Failed to load Artalk.js:', err);
19
+ });
7
20
  }
8
21
 
9
22
  function pjax_artalk() {
10
- if(!document.querySelectorAll("#artalk_container")[0])return;
23
+ if (!document.querySelector("#artalk_container")) return;
24
+
11
25
  let path = pdata.commentPath;
12
26
  let placeholder = pdata.commentPlaceholder || "<%= theme.comments.artalk.placeholder %>" || "";
13
- if (path.length == 0) {
27
+ if (!path) {
14
28
  path = '<%= theme.comments.artalk.path %>' || decodeURI(window.location.pathname);
15
29
  }
16
- if(!'<%= config.permalink %>'.includes('/index.html')) {
17
- path = path.replaceAll('/index.html', '/').replaceAll('.html', '')
30
+ if (!'<%= config.permalink %>'.includes('/index.html')) {
31
+ path = path.replace(/\/index\.html$/, '/').replace(/\.html$/, '');
18
32
  }
19
33
 
20
- volantis.artalk = new Artalk(Object.assign(<%- JSON.stringify(theme.comments.artalk) %>, {
34
+ volantis.artalk = Artalk.init(Object.assign(<%- JSON.stringify(theme.comments.artalk) %>, {
21
35
  el: '#artalk_container',
22
36
  pageKey: path,
23
37
  pageTitle: document.title,
@@ -32,49 +46,51 @@
32
46
  let headers = new Headers();
33
47
  headers.set('Accept', 'application/json');
34
48
  <% if(!!theme.comments.artalk.imageUploader?.token) { %>
35
- headers.set('Authorization', '<%= theme.comments.artalk.imageUploader?.token %>')
49
+ headers.set('Authorization', '<%= theme.comments.artalk.imageUploader?.token %>');
36
50
  <% } %>
37
51
  let formData = new FormData();
38
52
  formData.append('file', file);
39
- return fetch('<%= theme.comments.artalk.imageUploader?.api %>',{
53
+ return fetch('<%= theme.comments.artalk.imageUploader?.api %>', {
40
54
  method: 'POST',
41
55
  body: formData,
42
56
  headers: headers
43
- }).then((resp) => resp.json())
44
- .then((resp) => resp.<%= theme.comments.artalk.imageUploader?.resp %>)
57
+ })
58
+ .then(resp => resp.json())
59
+ .then(resp => resp.<%= theme.comments.artalk.imageUploader?.resp %>);
45
60
  },
46
61
  <% } %>
47
62
  }));
48
63
 
49
64
  Artalk.use(ctx => {
50
65
  ctx.on('list-loaded', () => {
51
- if (typeof VolantisFancyBox === "undefined"){
66
+ if (typeof VolantisFancyBox === "undefined") {
52
67
  const checkFancyBox = setInterval(() => {
53
- if(typeof VolantisFancyBox === "undefined") return;
68
+ if (typeof VolantisFancyBox === "undefined") return;
54
69
  clearInterval(checkFancyBox);
55
70
  VolantisFancyBox.groupBind('.atk-content img:not([atk-emoticon])', 'Comments');
56
- })
71
+ }, 100);
57
72
  } else {
58
73
  VolantisFancyBox.groupBind('.atk-content img:not([atk-emoticon])', 'Comments');
59
74
  }
60
- })
61
- })
75
+ });
76
+ });
62
77
  }
63
78
 
64
79
  load_artalk();
65
- volantis.pjax.push(()=>{
80
+
81
+ volantis.pjax.push(() => {
66
82
  if (typeof Artalk === "undefined") {
67
83
  load_artalk();
68
84
  } else {
69
85
  pjax_artalk();
70
86
  }
71
- },'artalk');
87
+ }, 'artalk');
72
88
 
73
89
  function dark_artalk() {
74
- if(!document.querySelectorAll("#artalk_container")[0]) return;
75
- volantis.artalk.then(ctx => {
76
- ctx.setDarkMode(volantis.dark.mode === "dark")
77
- })
90
+ if (!document.querySelector("#artalk_container")) return;
91
+ if (volantis.artalk && typeof volantis.artalk.setDarkMode === 'function') {
92
+ volantis.artalk.setDarkMode(volantis.dark.mode === "dark");
93
+ }
78
94
  }
79
95
  volantis.dark.push(dark_artalk);
80
96
  </script>
package/layout/layout.ejs CHANGED
@@ -13,6 +13,13 @@
13
13
  <!-- Custom Files bodyBegin begin-->
14
14
  <%- volantis_inject('bodyBegin') %>
15
15
  <!-- Custom Files bodyBegin end-->
16
+ <!-- front-matter body_begin begin -->
17
+ <%_ if (page.import && page.import.body_begin){ _%>
18
+ <%_ getList(page.import.body_begin).forEach(function(item){ _%>
19
+ <%- item %>
20
+ <%_ }) _%>
21
+ <%_ } _%>
22
+ <!-- front-matter body_begin end -->
16
23
  <%- partial('_partial/header', null, {cache: false, path: path}) %>
17
24
  <div id="l_body">
18
25
  <%- partial('_partial/cover') %>
@@ -41,5 +48,12 @@
41
48
  <!-- Custom Files bodyEnd begin-->
42
49
  <%- volantis_inject('bodyEnd') %>
43
50
  <!-- Custom Files bodyEnd end-->
51
+ <!-- front-matter body_end begin -->
52
+ <%_ if (page.import && page.import.body_end){ _%>
53
+ <%_ getList(page.import.body_end).forEach(function(item){ _%>
54
+ <%- item %>
55
+ <%_ }) _%>
56
+ <%_ } _%>
57
+ <!-- front-matter body_end end -->
44
58
  </body>
45
59
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.7.10",
3
+ "version": "5.8.1",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {