hexo-theme-volantis 5.8.0 → 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,12 @@
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
+
3
10
  ## [5.8.0](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.10...5.8.0) (2023-05-06)
4
11
 
5
12
 
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.8.0",
3
+ "version": "5.8.1",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {