hexo-theme-volantis 5.7.8 → 5.7.10

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.7.10](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.9...5.7.10) (2023-04-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * 修复移动端菜单栏按钮点击没有收起二级子菜单的问题 ([#880](https://github.com/volantis-x/hexo-theme-volantis/issues/880)) ([bb7738b](https://github.com/volantis-x/hexo-theme-volantis/commit/bb7738b9dcfa375e263ee4ca648d437703b15182))
9
+
10
+ ## [5.7.9](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.8...5.7.9) (2023-04-26)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 修复移动端web菜单栏无法收缩;特性:浏览器滚动条复杂样式从配置文件传入 ([#877](https://github.com/volantis-x/hexo-theme-volantis/issues/877)) ([91288f9](https://github.com/volantis-x/hexo-theme-volantis/commit/91288f916dee43baadac9750a39de6d3933a6737))
16
+
3
17
  ## [5.7.8](https://github.com/volantis-x/hexo-theme-volantis/compare/5.7.7...5.7.8) (2023-04-01)
4
18
 
5
19
 
package/_config.yml CHANGED
@@ -1219,6 +1219,8 @@ custom_css:
1219
1219
  scrollbar:
1220
1220
  size: 4px
1221
1221
  border: 2px
1222
+ background: rgb(84,181,160) linear-gradient(45deg, rgba(255, 255, 255, 0.4) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.4) 75%, transparent 75%, transparent)
1223
+ hover_background: rgb(84,181,160) linear-gradient(45deg, rgba(255, 255, 255, 0.4) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.4) 75%, transparent 75%, transparent)
1222
1224
  navbar:
1223
1225
  height: 64px
1224
1226
  width: auto # auto, max
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.7.8",
3
+ "version": "5.7.10",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -37,7 +37,7 @@ html
37
37
  font-size: $fontsize-root
38
38
  >
39
39
  if hexo-config('custom_css.scrollbar.size')
40
- scrollbar(convert(hexo-config('custom_css.scrollbar.size')), convert(hexo-config('custom_css.scrollbar.border')) || 0px)
40
+ scrollbar(convert(hexo-config('custom_css.scrollbar.size')), convert(hexo-config('custom_css.scrollbar.border')) || 0px, convert(hexo-config('custom_css.scrollbar.background')), convert(hexo-config('custom_css.scrollbar.hover_background')))
41
41
 
42
42
  body
43
43
  background-color: var(--color-site-body)
package/source/js/app.js CHANGED
@@ -285,31 +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 (e) {
289
- if (e.querySelector(".list-v")) {
288
+ document.querySelectorAll('#l_header .m-phone li').forEach(function (_e) {
289
+ if (_e.querySelector(".list-v")) {
290
290
  // 点击菜单
291
- volantis.dom.$(e).click(function (e) {
291
+ volantis.dom.$(_e).click(function (e) {
292
292
  e.stopPropagation();
293
- // 关闭已经展开的子菜单
294
- e.currentTarget.parentElement.childNodes.forEach(function (e) {
295
- if (Object.prototype.toString.call(e) == '[object HTMLLIElement]') {
296
- e.childNodes.forEach(function (e) {
297
- if (Object.prototype.toString.call(e) == '[object HTMLUListElement]') {
298
- volantis.dom.$(e).hide()
299
- }
300
- })
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
301
303
  }
302
304
  })
303
- // 点击展开子菜单
304
- let array = e.currentTarget.children
305
- for (let index = 0; index < array.length; index++) {
306
- const element = array[index];
307
- if (volantis.dom.$(element).title === 'menu') { // 移动端菜单栏异常
308
- volantis.dom.$(element).display = "flex" // https://github.com/volantis-x/hexo-theme-volantis/issues/706
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
329
+ } else {
330
+ volantis.dom.$(element).show()
331
+ }
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()
309
338
  } else {
310
- volantis.dom.$(element).show()
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
+ })
311
352
  }
312
353
  }
354
+
313
355
  }, 0);
314
356
  }
315
357
  })
@@ -328,7 +370,7 @@ const VolantisApp = (() => {
328
370
  }
329
371
  fn.setPageHeaderMenuEvent();
330
372
  }
331
-
373
+
332
374
  // 【移动端】隐藏子菜单
333
375
  fn.setPageHeaderMenuEvent = () => {
334
376
  if (!volantis.isMobile) return