hexo-theme-volantis 5.7.9 → 5.8.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 +14 -0
- package/layout/_partial/head.ejs +14 -0
- package/layout/layout.ejs +14 -0
- package/package.json +1 -1
- package/source/js/app.js +62 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.8.0](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.10...5.8.0) (2023-05-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **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))
|
|
9
|
+
|
|
10
|
+
## [5.7.10](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.9...5.7.10) (2023-04-28)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 修复移动端菜单栏按钮点击没有收起二级子菜单的问题 ([#880](https://github.com/volantis-x/hexo-theme-volantis/issues/880)) ([bb7738b](https://github.com/volantis-x/hexo-theme-volantis/commit/bb7738b9dcfa375e263ee4ca648d437703b15182))
|
|
16
|
+
|
|
3
17
|
## [5.7.9](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.8...5.7.9) (2023-04-26)
|
|
4
18
|
|
|
5
19
|
|
package/layout/_partial/head.ejs
CHANGED
|
@@ -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>
|
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
package/source/js/app.js
CHANGED
|
@@ -285,49 +285,73 @@ const VolantisApp = (() => {
|
|
|
285
285
|
fn.setGlobalHeaderMenuEvent = () => {
|
|
286
286
|
if (volantis.isMobile) {
|
|
287
287
|
// 【移动端】 关闭已经展开的子菜单 点击展开子菜单
|
|
288
|
-
document.querySelectorAll('#l_header .m-phone li').forEach(function (
|
|
289
|
-
if (
|
|
288
|
+
document.querySelectorAll('#l_header .m-phone li').forEach(function (_e) {
|
|
289
|
+
if (_e.querySelector(".list-v")) {
|
|
290
290
|
// 点击菜单
|
|
291
|
-
volantis.dom.$(
|
|
291
|
+
volantis.dom.$(_e).click(function (e) {
|
|
292
292
|
e.stopPropagation();
|
|
293
|
-
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
293
|
+
let menuType = ''
|
|
294
|
+
// 关闭.menu-phone
|
|
295
|
+
Array.from(e.currentTarget.children).some(val => {
|
|
296
|
+
if(val.classList.contains('s-menu')) {
|
|
297
|
+
menuType = 'menu' // 代表点击的是一级菜单外层的icon
|
|
298
|
+
return
|
|
299
|
+
}
|
|
300
|
+
if(val.classList.contains('menuitem')) {
|
|
301
|
+
menuType = 'item' // 点击的是下拉一级菜单
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
if(menuType === 'item') {
|
|
306
|
+
// 关闭已经展开的子菜单, 这一步是针对点击多个拥有二级子菜单的一级菜单,关闭其他所有一级菜单的二级菜单
|
|
307
|
+
// ①
|
|
308
|
+
e.currentTarget.parentElement.childNodes.forEach(function (e2) {
|
|
309
|
+
if (Object.prototype.toString.call(e2) == '[object HTMLLIElement]') {
|
|
310
|
+
e2.childNodes.forEach(function (e1) {
|
|
311
|
+
if (Object.prototype.toString.call(e1) == '[object HTMLUListElement]') {
|
|
312
|
+
volantis.dom.$(e1).hide()
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
// 点击展开二级子菜单
|
|
318
|
+
|
|
319
|
+
/*
|
|
320
|
+
由于采用事件委托,因此此处点击, 两种情况,currentTarget指向菜单按钮a.s-menu和ul的共同父元素li, 第二,指向ul中的li元素,也就是子菜单
|
|
321
|
+
区分:情况一的第一个子元素a的类名是s-menu;情况二的子元素a的类名为menuitem
|
|
322
|
+
我们要点击外部的menu icon时要关闭的是.menu-phone而不是.menuitem
|
|
323
|
+
*/
|
|
324
|
+
let array = e.currentTarget.children
|
|
325
|
+
for (let index = 0; index < array.length; index++) {
|
|
326
|
+
const element = array[index];
|
|
327
|
+
if (volantis.dom.$(element).title === 'menu') { // 移动端菜单栏异常
|
|
328
|
+
volantis.dom.$(element).style.display = "flex" // https://github.com/volantis-x/hexo-theme-volantis/issues/706
|
|
326
329
|
} else {
|
|
327
|
-
volantis.dom.$(element).
|
|
330
|
+
volantis.dom.$(element).show()
|
|
328
331
|
}
|
|
329
332
|
}
|
|
333
|
+
} else {
|
|
334
|
+
let menuPhone = document.querySelector('.switcher .menu-phone')
|
|
335
|
+
let isHiding = window.getComputedStyle(menuPhone).display === 'none'
|
|
336
|
+
if(isHiding) {
|
|
337
|
+
volantis.dom.$(menuPhone).show()
|
|
338
|
+
} else {
|
|
339
|
+
volantis.dom.$(menuPhone).hide()
|
|
340
|
+
// 别忘了再执行①
|
|
341
|
+
// 准备关闭所有二级菜单, 注意此时的e和点击一级菜单时候的e层级不同
|
|
342
|
+
// 此处好像不能使用变量存储的menuPhone?要重新查询
|
|
343
|
+
document.querySelector('.switcher .menu-phone').childNodes.forEach(function (e2) {
|
|
344
|
+
if (Object.prototype.toString.call(e2) == '[object HTMLLIElement]') {
|
|
345
|
+
e2.childNodes.forEach(function (e1) {
|
|
346
|
+
if (Object.prototype.toString.call(e1) == '[object HTMLUListElement]') {
|
|
347
|
+
volantis.dom.$(e1).hide()
|
|
348
|
+
}
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
})
|
|
352
|
+
}
|
|
330
353
|
}
|
|
354
|
+
|
|
331
355
|
}, 0);
|
|
332
356
|
}
|
|
333
357
|
})
|
|
@@ -346,7 +370,7 @@ const VolantisApp = (() => {
|
|
|
346
370
|
}
|
|
347
371
|
fn.setPageHeaderMenuEvent();
|
|
348
372
|
}
|
|
349
|
-
|
|
373
|
+
|
|
350
374
|
// 【移动端】隐藏子菜单
|
|
351
375
|
fn.setPageHeaderMenuEvent = () => {
|
|
352
376
|
if (!volantis.isMobile) return
|