hexo-theme-volantis 5.0.0-rc.9 → 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.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/_config.yml +60 -46
- package/layout/_meta/counter.ejs +27 -5
- package/layout/_meta/walinecount.ejs +2 -1
- package/layout/_partial/article.ejs +2 -2
- package/layout/_partial/head.ejs +29 -28
- package/layout/_partial/header.ejs +1 -1
- package/layout/_partial/scripts/content-visibility-scroll-fix.ejs +71 -69
- package/layout/_partial/scripts/global.ejs +47 -23
- package/layout/_partial/scripts/index.ejs +22 -9
- package/layout/_partial/scripts/toc.ejs +61 -38
- package/layout/_plugins/_page_plugins/indent/index.ejs +1 -1
- package/layout/_plugins/_page_plugins/index.ejs +27 -7
- package/layout/_plugins/_page_plugins/snackbar/index.ejs +1 -1
- package/layout/_plugins/analytics/script.ejs +11 -1
- package/layout/_plugins/aplayer/script.ejs +1 -1
- package/layout/_plugins/comments/artalk/script.ejs +17 -11
- package/layout/_plugins/comments/beaudar/script.ejs +2 -2
- package/layout/_plugins/comments/discuss/script.ejs +30 -0
- package/layout/_plugins/comments/hashover/script.ejs +2 -2
- package/layout/_plugins/comments/index.ejs +4 -4
- package/layout/_plugins/comments/twikoo/script.ejs +1 -1
- package/layout/_plugins/comments/waline/script.ejs +40 -22
- package/layout/_plugins/parallax/script.ejs +1 -1
- package/layout/_plugins/pjax/index.ejs +4 -1
- package/layout/_plugins/rightmenu/layout.ejs +2 -2
- package/layout/_plugins/rightmenus/layout.ejs +17 -17
- package/layout/_widget/lastupdate.ejs +27 -27
- package/layout/_widget/webinfo.ejs +7 -7
- package/layout/layout.ejs +20 -3
- package/layout/tag.ejs +1 -1
- package/package.json +1 -1
- package/scripts/events/lib/check-configuration.js +43 -0
- package/scripts/events/lib/check-environment.js +20 -1
- package/scripts/events/lib/render-stylus.js +1 -1
- package/scripts/filters/content-visibility.js +2 -2
- package/scripts/helpers/custom-files.js +3 -1
- package/scripts/helpers/head/generate_seo.js +1 -1
- package/scripts/helpers/structured-data/lib/blogposting.js +18 -6
- package/scripts/helpers/structured-data/lib/breadcrumblist.js +25 -1
- package/scripts/helpers/structured-data/lib/index.js +1 -9
- package/scripts/tags/fancybox.js +1 -1
- package/scripts/tags/tabs.js +85 -86
- package/source/css/_defines/AutoPrefixCSS.styl +16 -16
- package/source/css/_first/base_first.styl +4 -0
- package/source/css/_first/navbar_first.styl +1 -1
- package/source/css/_style/_base/base.styl +2 -2
- package/source/css/_style/_layout/toc.styl +2 -2
- package/source/css/_style/_plugins/_dark/dark_async.styl +1 -1
- package/source/css/_style/_plugins/_dark/dark_plugins.styl +8 -4
- package/source/css/_style/_plugins/_rightmenu/reading.styl +2 -2
- package/source/css/_style/_plugins/_rightmenu/rightmenu.styl +1 -1
- package/source/css/_style/_plugins/fontcolor.styl +1 -1
- package/source/css/first.styl +5 -7
- package/source/js/app.js +32 -35
- package/source/js/plugins/aplayer.js +1 -3
- package/source/js/plugins/rightMenu.js +22 -22
- package/source/js/plugins/rightMenus.js +115 -78
- package/source/js/search/hexo.js +3 -0
- package/layout/_partial/scripts/import.ejs +0 -3
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
layout: <%- JSON.stringify(theme.rightmenu.layout) %>,
|
|
36
36
|
music_alwaysShow: <%- JSON.stringify(theme.rightmenu.music.alwaysShow) %>,
|
|
37
37
|
customPicUrl: <%- JSON.stringify(theme.rightmenu.customPicUrl) %>
|
|
38
|
-
},
|
|
38
|
+
},
|
|
39
39
|
rightmenus: <%- JSON.stringify(theme.rightmenus) %>
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -181,12 +181,21 @@
|
|
|
181
181
|
error: new RunItem(),
|
|
182
182
|
send: new RunItem(),
|
|
183
183
|
};
|
|
184
|
-
volantis.pjax = {
|
|
185
|
-
...volantis.pjax,
|
|
184
|
+
volantis.pjax = Object.assign(volantis.pjax, {
|
|
186
185
|
push: volantis.pjax.method.complete.push,
|
|
187
186
|
error: volantis.pjax.method.error.push,
|
|
188
187
|
send: volantis.pjax.method.send.push,
|
|
189
|
-
};
|
|
188
|
+
});
|
|
189
|
+
/******************** RightMenu ********************************/
|
|
190
|
+
// volantis.rightmenu.handle(callBack[,"callBackName"]) 外部菜单项控制
|
|
191
|
+
// 可在 volantis.mouseEvent 处获取右键事件
|
|
192
|
+
volantis.rightmenu = {};
|
|
193
|
+
volantis.rightmenu.method = {
|
|
194
|
+
handle: new RunItem(),
|
|
195
|
+
}
|
|
196
|
+
volantis.rightmenu = Object.assign(volantis.rightmenu, {
|
|
197
|
+
handle: volantis.rightmenu.method.handle.push,
|
|
198
|
+
});
|
|
190
199
|
/******************** Dark Mode ********************************/
|
|
191
200
|
// /layout/_partial/scripts/darkmode.ejs
|
|
192
201
|
// volantis.dark.mode 当前模式 dark or light
|
|
@@ -196,10 +205,9 @@
|
|
|
196
205
|
volantis.dark.method = {
|
|
197
206
|
toggle: new RunItem(),
|
|
198
207
|
};
|
|
199
|
-
volantis.dark = {
|
|
200
|
-
...volantis.dark,
|
|
208
|
+
volantis.dark = Object.assign(volantis.dark, {
|
|
201
209
|
push: volantis.dark.method.toggle.push,
|
|
202
|
-
};
|
|
210
|
+
});
|
|
203
211
|
/******************** Message ********************************/
|
|
204
212
|
// VolantisApp.message
|
|
205
213
|
/******************** isMobile ********************************/
|
|
@@ -309,10 +317,9 @@
|
|
|
309
317
|
engine: new RunItem(),
|
|
310
318
|
unengine: new RunItem(),
|
|
311
319
|
};
|
|
312
|
-
volantis.scroll = {
|
|
313
|
-
...volantis.scroll,
|
|
320
|
+
volantis.scroll = Object.assign(volantis.scroll, {
|
|
314
321
|
push: volantis.scroll.engine.push,
|
|
315
|
-
};
|
|
322
|
+
});
|
|
316
323
|
// 滚动条距离顶部的距离
|
|
317
324
|
volantis.scroll.getScrollTop = () =>{
|
|
318
325
|
let scrollPos;
|
|
@@ -339,6 +346,8 @@
|
|
|
339
346
|
// } else {
|
|
340
347
|
// console.log("向上滚动");
|
|
341
348
|
// }
|
|
349
|
+
// 注销过期的unengine未滚动事件
|
|
350
|
+
volantis.scroll.unengine.list=[]
|
|
342
351
|
volantis.scroll.engine.start();
|
|
343
352
|
}else{
|
|
344
353
|
volantis.scroll.unengine.start();
|
|
@@ -366,24 +375,39 @@
|
|
|
366
375
|
opt.top += option.addTop
|
|
367
376
|
}
|
|
368
377
|
if (!("observerDic" in option)) {
|
|
369
|
-
option.observerDic =
|
|
378
|
+
option.observerDic = 100
|
|
370
379
|
}
|
|
371
380
|
// 滚动
|
|
372
381
|
window.scrollTo(opt);
|
|
373
382
|
// 监视器
|
|
374
|
-
// 监视并矫正元素滚动到指定位置
|
|
375
|
-
//
|
|
376
|
-
//
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
// 监视并矫正元素滚动到指定位置
|
|
384
|
+
// 用于处理 lazyload 引起的 cls 导致的定位失败问题
|
|
385
|
+
// option.observer = false
|
|
386
|
+
if (option.observer) {
|
|
387
|
+
setTimeout(()=>{
|
|
388
|
+
volantis.scroll.unengine.push(()=>{
|
|
389
|
+
let me = ele.getBoundingClientRect().top
|
|
390
|
+
if(!(me >= -option.observerDic && me <= option.observerDic)){
|
|
391
|
+
volantis.scroll.to(ele, option)
|
|
392
|
+
}
|
|
393
|
+
volantis.scroll.unengine.remove("unengineObserver")
|
|
394
|
+
},"unengineObserver")
|
|
395
|
+
},1000)
|
|
396
|
+
}
|
|
386
397
|
}
|
|
398
|
+
/********************** Content Visibility ********************************/
|
|
399
|
+
// 见 source/css/first.styl 如果遇到任何问题 删除 .post-story 即可
|
|
400
|
+
// 一个元素被声明 content-visibility 属性后 如果元素不在 viewport 中 浏览器不会计算其后代元素样式和属性 从而节省 Style & Layout 耗时
|
|
401
|
+
// content-visibility 的副作用: 锚点失效 等等(实验初期 暂不明确), 使用此方法清除样式
|
|
402
|
+
volantis.cleanContentVisibility = ()=>{
|
|
403
|
+
if (document.querySelector(".post-story")) {
|
|
404
|
+
console.log("cleanContentVisibility");
|
|
405
|
+
document.querySelectorAll(".post-story").forEach(e=>{
|
|
406
|
+
e.classList.remove("post-story")
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/******************************************************************************/
|
|
387
411
|
/******************************************************************************/
|
|
388
412
|
/******************************************************************************/
|
|
389
413
|
//图像加载出错时的处理
|
|
@@ -64,9 +64,27 @@
|
|
|
64
64
|
<%- partial('../../_plugins/aplayer/script') %>
|
|
65
65
|
<% } %>
|
|
66
66
|
|
|
67
|
-
<%
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
<%
|
|
68
|
+
if (theme.comments.service && theme.comments.service.length > 0) {
|
|
69
|
+
try { %>
|
|
70
|
+
<%- partial('../../_plugins/comments/' + theme.comments.service + '/script') %>
|
|
71
|
+
<% } catch (e) {
|
|
72
|
+
// error friendly
|
|
73
|
+
console.log(`
|
|
74
|
+
===============================================================================
|
|
75
|
+
没有找到评论插件:${theme.comments.service}
|
|
76
|
+
请检查是否存在该插件,或者检查插件名称是否正确:${theme.comments.service}
|
|
77
|
+
see: https://volantis.js.org/v5/theme-settings/#选择评论系统
|
|
78
|
+
================================================================================
|
|
79
|
+
There is no comments plugin: ${theme.comments.service}
|
|
80
|
+
Please check if the plugin exists, or check the plugin name is correct: ${theme.comments.service}
|
|
81
|
+
see: https://volantis.js.org/v5/theme-settings/#选择评论系统
|
|
82
|
+
=================================================================================`)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
%>
|
|
86
|
+
|
|
87
|
+
|
|
70
88
|
|
|
71
89
|
<% if (theme.analytics.busuanzi) { %>
|
|
72
90
|
<script defer src="<%- theme.analytics.busuanzi %>" data-pjax></script>
|
|
@@ -93,7 +111,7 @@
|
|
|
93
111
|
<%- partial('../../_plugins/analytics/LCCounter') %>
|
|
94
112
|
<% } %>
|
|
95
113
|
|
|
96
|
-
<% if (config.google_analytics_key || config.baidu_analytics_key || config.tencent_aegis_id) { %>
|
|
114
|
+
<% if (config.google_analytics_key || config.baidu_analytics_key || config.tencent_aegis_id || config.v6_51_la) { %>
|
|
97
115
|
<%- partial('../../_plugins/analytics/script') %>
|
|
98
116
|
<% } %>
|
|
99
117
|
|
|
@@ -124,8 +142,3 @@
|
|
|
124
142
|
<%- structured_data() %>
|
|
125
143
|
<% } %>
|
|
126
144
|
|
|
127
|
-
<!-- more -->
|
|
128
|
-
<% if (config.import && config.import.script) { %>
|
|
129
|
-
<%- partial('import') %>
|
|
130
|
-
<% } %>
|
|
131
|
-
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
function listennSidebarTOC() {
|
|
3
3
|
const navItems = document.querySelectorAll(".toc li");
|
|
4
4
|
if (!navItems.length) return;
|
|
5
|
+
let targets = []
|
|
5
6
|
const sections = [...navItems].map((element) => {
|
|
6
7
|
const link = element.querySelector(".toc-link");
|
|
7
8
|
const target = document.getElementById(
|
|
8
9
|
decodeURI(link.getAttribute("href")).replace("#", "")
|
|
9
10
|
);
|
|
11
|
+
targets.push(target)
|
|
10
12
|
// 解除 a 标签 href 的 锚点定位, a 标签 href 的 锚点定位 会随机启用?? 产生错位???
|
|
11
13
|
link.setAttribute("onclick","return false;")
|
|
12
14
|
link.setAttribute("toc-action","toc-"+decodeURI(link.getAttribute("href")).replace("#", ""))
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
link.addEventListener("click", (event) => {
|
|
16
18
|
event.preventDefault();
|
|
17
19
|
// 这里的 addTop 是通过错位使得 toc 自动展开.
|
|
18
|
-
volantis.scroll.to(target,{addTop: 5, observer:
|
|
20
|
+
volantis.scroll.to(target,{addTop: 5, observer:true})
|
|
19
21
|
// Anchor id
|
|
20
22
|
history.pushState(null, document.title, "#" + target.id);
|
|
21
23
|
});
|
|
@@ -36,46 +38,67 @@
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function createIntersectionObserver(marginTop) {
|
|
57
|
-
marginTop = Math.floor(marginTop + 10000);
|
|
58
|
-
let intersectionObserver = new IntersectionObserver(
|
|
59
|
-
(entries, observe) => {
|
|
60
|
-
let scrollHeight = document.documentElement.scrollHeight;
|
|
61
|
-
if (scrollHeight > marginTop) {
|
|
62
|
-
observe.disconnect();
|
|
63
|
-
createIntersectionObserver(scrollHeight);
|
|
64
|
-
return;
|
|
41
|
+
// 方案一:
|
|
42
|
+
volantis.activateNavIndex=0
|
|
43
|
+
activateNavByIndex(navItems[volantis.activateNavIndex])
|
|
44
|
+
volantis.scroll.push(()=>{
|
|
45
|
+
if (targets[0].getBoundingClientRect().top >= 0) {
|
|
46
|
+
volantis.activateNavIndex = 0
|
|
47
|
+
}else if (targets[targets.length-1].getBoundingClientRect().top < 0) {
|
|
48
|
+
volantis.activateNavIndex = targets.length-1
|
|
49
|
+
} else {
|
|
50
|
+
for (let index = 0; index < targets.length; index++) {
|
|
51
|
+
const target0 = targets[index];
|
|
52
|
+
const target1 = targets[(index+1)%targets.length];
|
|
53
|
+
if (target0.getBoundingClientRect().top < 0&&target1.getBoundingClientRect().top >= 0) {
|
|
54
|
+
volantis.activateNavIndex=index
|
|
55
|
+
break;
|
|
65
56
|
}
|
|
66
|
-
let index = findIndex(entries);
|
|
67
|
-
activateNavByIndex(navItems[index]);
|
|
68
|
-
}, {
|
|
69
|
-
rootMargin: marginTop + "px 0px -100% 0px",
|
|
70
|
-
threshold: 0,
|
|
71
57
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
}
|
|
58
|
+
}
|
|
59
|
+
activateNavByIndex(navItems[volantis.activateNavIndex])
|
|
60
|
+
})
|
|
77
61
|
|
|
78
|
-
|
|
62
|
+
// 方案二:
|
|
63
|
+
// IntersectionObserver 不是完美精确到像素级别 也不是低延时性的
|
|
64
|
+
// function findIndex(entries) {
|
|
65
|
+
// let index = 0;
|
|
66
|
+
// let entry = entries[index];
|
|
67
|
+
// if (entry.boundingClientRect.top > 0) {
|
|
68
|
+
// index = sections.indexOf(entry.target);
|
|
69
|
+
// return index === 0 ? 0 : index - 1;
|
|
70
|
+
// }
|
|
71
|
+
// for (; index < entries.length; index++) {
|
|
72
|
+
// if (entries[index].boundingClientRect.top <= 0) {
|
|
73
|
+
// entry = entries[index];
|
|
74
|
+
// } else {
|
|
75
|
+
// return sections.indexOf(entry.target);
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
78
|
+
// return sections.indexOf(entry.target);
|
|
79
|
+
// }
|
|
80
|
+
// function createIntersectionObserver(marginTop) {
|
|
81
|
+
// marginTop = Math.floor(marginTop + 10000);
|
|
82
|
+
// let intersectionObserver = new IntersectionObserver(
|
|
83
|
+
// (entries, observe) => {
|
|
84
|
+
// let scrollHeight = document.documentElement.scrollHeight;
|
|
85
|
+
// if (scrollHeight > marginTop) {
|
|
86
|
+
// observe.disconnect();
|
|
87
|
+
// createIntersectionObserver(scrollHeight);
|
|
88
|
+
// return;
|
|
89
|
+
// }
|
|
90
|
+
// let index = findIndex(entries);
|
|
91
|
+
// activateNavByIndex(navItems[index]);
|
|
92
|
+
// }, {
|
|
93
|
+
// rootMargin: marginTop + "px 0px -100% 0px",
|
|
94
|
+
// threshold: 0,
|
|
95
|
+
// }
|
|
96
|
+
// );
|
|
97
|
+
// sections.forEach((element) => {
|
|
98
|
+
// element && intersectionObserver.observe(element);
|
|
99
|
+
// });
|
|
100
|
+
// }
|
|
101
|
+
// createIntersectionObserver(document.documentElement.scrollHeight);
|
|
79
102
|
}
|
|
80
103
|
|
|
81
104
|
document.addEventListener("DOMContentLoaded", ()=>{
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
<%_
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<%_
|
|
2
|
+
(page.plugins||[]).forEach(function(item){
|
|
3
|
+
try {
|
|
4
|
+
if (typeof item == "string") { _%>
|
|
5
|
+
<%- partial( item + "/index") %>
|
|
6
|
+
<%_ }else if(typeof item == "object"){ _%>
|
|
7
|
+
<%- partial( Object.keys(item)[0] + "/index", { pagePlugin:item }) %>
|
|
8
|
+
<%_ }
|
|
9
|
+
} catch (error) {
|
|
10
|
+
// error friendly
|
|
11
|
+
console.log(`
|
|
12
|
+
===============================================================================
|
|
13
|
+
没有找到页面插件:${item}
|
|
14
|
+
请检查是否存在该插件,或者检查插件名称是否正确:${item}
|
|
15
|
+
出问题的页面:${page.path}
|
|
16
|
+
see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
|
|
17
|
+
================================================================================
|
|
18
|
+
There is no page plugin: ${item}
|
|
19
|
+
Please check if the plugin exists, or check the plugin name is correct: ${item}
|
|
20
|
+
The page that has problem: ${page.path}
|
|
21
|
+
see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
|
|
22
|
+
=================================================================================`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
_%>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if (site.data.notification && (pagePlugin.snackbar in site.data.notification)) { %>
|
|
1
|
+
<% if (site.data.notification && (pagePlugin.snackbar in site.data.notification)) { %>
|
|
2
2
|
<% let snackbar = site.data.notification[pagePlugin.snackbar] %>
|
|
3
3
|
<% if (snackbar.position == 'bottom') { %>
|
|
4
4
|
<div id="snackbar"></div>
|
|
@@ -35,6 +35,7 @@ var _hmt = _hmt || [];
|
|
|
35
35
|
volantis.pjax.push(()=>{_hmt.push(['_trackPageview', document.location.pathname]);},'baidu_analytics')
|
|
36
36
|
</script>
|
|
37
37
|
<% } %>
|
|
38
|
+
|
|
38
39
|
<% if (config.tencent_aegis_id) { %>
|
|
39
40
|
<script>
|
|
40
41
|
const genUuid = () => {
|
|
@@ -61,4 +62,13 @@ volantis.pjax.push(()=>{_hmt.push(['_trackPageview', document.location.pathname]
|
|
|
61
62
|
}, 1000)
|
|
62
63
|
</script>
|
|
63
64
|
<% } %>
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
<% if (config.v6_51_la) { %>
|
|
67
|
+
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
|
|
68
|
+
<script>
|
|
69
|
+
volantis.js("https://sdk.51.la/js-sdk-pro.min.js").then(() => {
|
|
70
|
+
LA.init({id: "<%= config.v6_51_la %>",ck: "<%= config.v6_51_la %>",autoTrack:true,hashMode:true})
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
<% } %>
|
|
74
|
+
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
Metings.forEach((item, index) => {
|
|
26
26
|
const aplayerItem = item.aplayer; if(!aplayerItem) return;
|
|
27
27
|
const rightAplayerCheck = '<%= theme.rightmenu.layout.includes("music") %>' === 'true'
|
|
28
|
-
&& item.meta.id === '<%= theme.plugins.aplayer.id %>';
|
|
28
|
+
&& item.meta.id === '<%= theme.plugins.aplayer.id %>';
|
|
29
29
|
if(rightAplayerCheck) RightMenuAplayer.checkAPlayer();
|
|
30
30
|
if(aplayerItem.events.events.play.every(item => {return item.name !== 'messagePlay'})) {
|
|
31
31
|
aplayerItem.on('play', function messagePlay() {
|
|
@@ -19,20 +19,24 @@
|
|
|
19
19
|
pageKey: path,
|
|
20
20
|
pageTitle: document.title,
|
|
21
21
|
placeholder: placeholder,
|
|
22
|
+
useBackendConf: true,
|
|
22
23
|
site: '<%= config.title %>',
|
|
23
|
-
darkMode: volantis.dark.mode === "dark"
|
|
24
|
+
darkMode: volantis.dark.mode === "dark",
|
|
25
|
+
pvEl: '#artalk_visitors'
|
|
24
26
|
}));
|
|
25
27
|
|
|
26
|
-
volantis.artalk.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
volantis.artalk.then(ctx => {
|
|
29
|
+
ctx.on('comments-loaded', () => {
|
|
30
|
+
if (typeof VolantisFancyBox === "undefined"){
|
|
31
|
+
const checkFancyBox = setInterval(() => {
|
|
32
|
+
if(typeof VolantisFancyBox === "undefined") return;
|
|
33
|
+
clearInterval(checkFancyBox);
|
|
34
|
+
VolantisFancyBox.groupBind('.atk-content img:not([atk-emoticon])', 'Comments');
|
|
35
|
+
})
|
|
36
|
+
} else {
|
|
31
37
|
VolantisFancyBox.groupBind('.atk-content img:not([atk-emoticon])', 'Comments');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
VolantisFancyBox.groupBind('.atk-content img:not([atk-emoticon])', 'Comments');
|
|
35
|
-
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
36
40
|
})
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -47,7 +51,9 @@
|
|
|
47
51
|
|
|
48
52
|
function dark_artalk() {
|
|
49
53
|
if(!document.querySelectorAll("#artalk_container")[0]) return;
|
|
50
|
-
volantis.artalk.
|
|
54
|
+
volantis.artalk.then(ctx => {
|
|
55
|
+
ctx.setDarkMode(volantis.dark.mode === "dark")
|
|
56
|
+
})
|
|
51
57
|
}
|
|
52
58
|
volantis.dark.push(dark_artalk);
|
|
53
59
|
</script>
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
const beaudarIframe = document.querySelector('iframe');
|
|
47
47
|
beaudarIframe.contentWindow.postMessage(message, 'https://beaudar.lipk.org');
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
function check_beaudar_style() {
|
|
51
51
|
// Beaudar 会往 HEAD 的首节点追加样式元素,而这个追加没有添加判断
|
|
52
52
|
// 所以 Pjax 下会多次添加样式文件,略微麻烦。
|
|
53
53
|
const checkStyle = document.querySelector('head').firstElementChild;
|
|
54
54
|
if(checkStyle.innerText.includes('beaudar')) checkStyle.remove();
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
pjax_beaudar();
|
|
58
58
|
volantis.pjax.push(check_beaudar_style);
|
|
59
59
|
volantis.pjax.push(pjax_beaudar);
|
|
@@ -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
|
|
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 ||
|
|
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
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 .
|
|
52
|
+
VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
|
|
37
53
|
})
|
|
38
54
|
} else {
|
|
39
|
-
VolantisFancyBox.bind('#waline .
|
|
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]
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
pjax = new Pjax({
|
|
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
|
+
"head title",
|
|
23
|
+
"head meta[name=keywords]",
|
|
24
|
+
"head meta[name=description]",
|
|
22
25
|
<% if (!theme.plugins.pjax.cover){ %>"#l_cover",<% } %>
|
|
23
26
|
"#l_main",
|
|
24
27
|
"#pjax-header-nav-list",
|
|
@@ -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'>
|