hexo-theme-volantis 5.8.1 → 6.0.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +5 -39
  2. package/_cdn.yml +449 -0
  3. package/_config.yml +155 -157
  4. package/languages/en.yml +9 -10
  5. package/languages/zh-CN.yml +11 -15
  6. package/languages/zh-TW.yml +10 -11
  7. package/layout/_meta/category.ejs +10 -5
  8. package/layout/_meta/counter.ejs +14 -17
  9. package/layout/_meta/tags.ejs +3 -0
  10. package/layout/_meta/walinecount.ejs +1 -1
  11. package/layout/_partial/article.ejs +14 -9
  12. package/layout/_partial/cover.ejs +4 -4
  13. package/layout/_partial/footer.ejs +1 -1
  14. package/layout/_partial/head.ejs +7 -18
  15. package/layout/_partial/header.ejs +6 -6
  16. package/layout/_partial/post.ejs +4 -4
  17. package/layout/_partial/scripts/_ctrl.ejs +43 -2
  18. package/layout/_partial/scripts/config.ejs +69 -0
  19. package/layout/_partial/scripts/global.ejs +136 -60
  20. package/layout/_partial/scripts/index.ejs +16 -23
  21. package/layout/_plugins/_page_plugins/artitalk/index.ejs +1 -1
  22. package/layout/_plugins/_page_plugins/bbtalk/index.ejs +1 -1
  23. package/layout/_plugins/_page_plugins/fcircle/index.ejs +9 -8
  24. package/layout/_plugins/_page_plugins/katex/index.ejs +3 -3
  25. package/layout/_plugins/_page_plugins/mathjax/index.ejs +1 -1
  26. package/layout/_plugins/aplayer/layout.ejs +31 -23
  27. package/layout/_plugins/aplayer/script.ejs +93 -65
  28. package/layout/_plugins/comments/artalk/script.ejs +31 -40
  29. package/layout/_plugins/comments/discuss/script.ejs +1 -1
  30. package/layout/_plugins/comments/disqusjs/script.ejs +2 -2
  31. package/layout/_plugins/comments/gitalk/script.ejs +1 -1
  32. package/layout/_plugins/comments/twikoo/script.ejs +1 -1
  33. package/layout/_plugins/comments/vssue/script.ejs +3 -3
  34. package/layout/_plugins/comments/waline/script.ejs +2 -2
  35. package/layout/_plugins/github-api/script.ejs +3 -3
  36. package/layout/_plugins/lazyload/script.ejs +1 -1
  37. package/layout/_plugins/nodewaves/script.ejs +1 -1
  38. package/layout/_plugins/pace/script.ejs +15 -0
  39. package/layout/_plugins/parallax/script.ejs +1 -1
  40. package/layout/_plugins/pjax/index.ejs +66 -11
  41. package/layout/_plugins/pjax/pdata.ejs +5 -5
  42. package/layout/_plugins/preload/script.ejs +2 -2
  43. package/layout/_plugins/rightmenus/layout.ejs +4 -4
  44. package/layout/_plugins/scrollreveal/script.ejs +2 -2
  45. package/layout/_plugins/search/script.ejs +11 -8
  46. package/layout/_plugins/swiper/script.ejs +2 -2
  47. package/layout/{_partial/scripts/toc.ejs → _plugins/toc/script.ejs} +40 -36
  48. package/layout/_widget/blogger.ejs +4 -4
  49. package/layout/_widget/webinfo.ejs +13 -14
  50. package/layout/friends.ejs +2 -2
  51. package/layout/layout.ejs +1 -15
  52. package/package.json +4 -4
  53. package/scripts/events/lib/cdn.js +206 -0
  54. package/scripts/events/lib/check-configuration.js +7 -7
  55. package/scripts/events/lib/check-environment.js +17 -17
  56. package/scripts/events/lib/config.js +0 -24
  57. package/scripts/events/lib/render-stylus.js +5 -5
  58. package/scripts/events/lib/stellar-tag-utils.js +2 -2
  59. package/scripts/filters/hexo-blog-encrypt-callback.js +44 -0
  60. package/scripts/filters/img.js +1 -1
  61. package/scripts/filters/replace.js +3 -3
  62. package/scripts/filters/z-lazyload.js +3 -5
  63. package/scripts/helpers/first-style.js +2 -2
  64. package/scripts/helpers/head/generate_seo.js +24 -10
  65. package/scripts/helpers/head/generate_title__keywords__description.js +28 -9
  66. package/scripts/helpers/related-posts.js +3 -3
  67. package/scripts/helpers/structured-data/lib/blogposting.js +1 -1
  68. package/scripts/helpers/structured-data/lib/breadcrumblist.js +1 -1
  69. package/scripts/helpers/structured-data/lib/config.js +1 -1
  70. package/scripts/helpers/structured-data/lib/website.js +1 -1
  71. package/scripts/helpers//346/226/207/347/253/240/346/216/250/350/215/220.js +184 -0
  72. package/scripts/tags/btn.js +2 -2
  73. package/scripts/tags/btns.js +3 -3
  74. package/scripts/tags/checkbox.js +6 -6
  75. package/scripts/tags/contributors.js +7 -7
  76. package/scripts/tags/dropmenu.js +8 -8
  77. package/scripts/tags/fancybox.js +6 -6
  78. package/scripts/tags/folding.js +5 -5
  79. package/scripts/tags/frame.js +3 -3
  80. package/scripts/tags/friends.js +8 -8
  81. package/scripts/tags/ghcard.js +7 -7
  82. package/scripts/tags/image.js +6 -6
  83. package/scripts/tags/inline-labels.js +6 -6
  84. package/scripts/tags/link.js +5 -5
  85. package/scripts/tags/md.js +4 -4
  86. package/scripts/tags/media.js +5 -5
  87. package/scripts/tags/note.js +12 -12
  88. package/scripts/tags/pandown.js +29 -29
  89. package/scripts/tags/site.js +4 -4
  90. package/scripts/tags/span.js +4 -4
  91. package/scripts/tags/table.js +2 -2
  92. package/scripts/tags/tabs.js +23 -23
  93. package/scripts/tags/timeline.js +5 -5
  94. package/source/css/_first/base_first.styl +1 -1
  95. package/source/css/_style/_layout/article.styl +43 -0
  96. package/source/css/_style/_layout/main.styl +1 -1
  97. package/source/css/_style/_layout/search.styl +206 -14
  98. package/source/css/_style/_plugins/index.styl +1 -3
  99. package/source/js/app.js +133 -160
  100. package/source/js/plugins/parallax.js +1 -1
  101. package/source/js/plugins/rightMenus.js +24 -20
  102. package/source/js/search/algolia.js +239 -0
  103. package/source/js/search/hexo.js +8 -2
  104. package/source/js/search/meilisearch.js +220 -0
  105. package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +0 -127
  106. package/layout/_partial/scripts/_ctrl/coverCtrl.ejs +0 -43
  107. package/layout/_plugins/analytics/LCCounter.ejs +0 -207
  108. package/layout/_plugins/pjax/animate.ejs +0 -31
  109. package/layout/_plugins/rightmenu/layout.ejs +0 -119
  110. package/scripts/helpers/revisioned.js +0 -167
  111. package/source/css/_style/_plugins/pjaxanimate.styl +0 -160
  112. package/source/js/plugins/rightMenu.js +0 -577
  113. /package/layout/{_partial/scripts/content-visibility-scroll-fix.ejs → _plugins/content-visibility/script.ejs} +0 -0
package/source/js/app.js CHANGED
@@ -26,10 +26,16 @@ const locationHash = () => {
26
26
  if (window.location.hash) {
27
27
  let locationID = decodeURI(window.location.hash.split('#')[1]).replace(/\ /g, '-');
28
28
  let target = document.getElementById(locationID);
29
+ if (locationID && !target) {
30
+ locationID = decodeURIComponent(window.location.hash.split('#')[1]).replace(/\ /g, '-');
31
+ target = document.getElementById(locationID);
32
+ }
29
33
  if (target) {
30
34
  setTimeout(() => {
31
35
  if (window.location.hash.startsWith('#fn')) { // hexo-reference https://github.com/volantis-x/hexo-theme-volantis/issues/647
32
36
  volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant', observer: true })
37
+ } else if (window.location.hash.startsWith('#mjx')) { // mathjax
38
+ volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 25, behavior: 'instant', observer: true })
33
39
  } else {
34
40
  // 锚点中上半部有大片空白 高度大概是 volantis.dom.header.offsetHeight
35
41
  volantis.scroll.to(target, { addTop: 5, behavior: 'instant', observer: true })
@@ -119,7 +125,7 @@ const VolantisApp = (() => {
119
125
  // 校正页面定位(被导航栏挡住的区域)
120
126
  fn.scrolltoElement = (elem, correction = scrollCorrection) => {
121
127
  volantis.scroll.to(elem, {
122
- top: elem.offsetTop - correction
128
+ top: elem.getBoundingClientRect().top + document.documentElement.scrollTop - correction
123
129
  })
124
130
  }
125
131
 
@@ -210,6 +216,7 @@ const VolantisApp = (() => {
210
216
  volantis.dom.comment.click(e => { // 评论按钮点击后 跳转到评论区域
211
217
  e.preventDefault();
212
218
  e.stopPropagation();
219
+ volantis.cleanContentVisibility();
213
220
  fn.scrolltoElement(volantis.dom.commentTarget);
214
221
  e.stopImmediatePropagation();
215
222
  });
@@ -234,7 +241,7 @@ const VolantisApp = (() => {
234
241
  }
235
242
  volantis.dom.toc.removeClass('active');
236
243
  });
237
- } else volantis.dom.toc.style.display = 'none'; // 隐藏toc目录按钮
244
+ } else if (volantis.dom.toc) volantis.dom.toc.style.display = 'none'; // 隐藏toc目录按钮
238
245
  }
239
246
  }
240
247
 
@@ -285,73 +292,31 @@ const VolantisApp = (() => {
285
292
  fn.setGlobalHeaderMenuEvent = () => {
286
293
  if (volantis.isMobile) {
287
294
  // 【移动端】 关闭已经展开的子菜单 点击展开子菜单
288
- document.querySelectorAll('#l_header .m-phone li').forEach(function (_e) {
289
- if (_e.querySelector(".list-v")) {
295
+ document.querySelectorAll('#l_header .m-phone li').forEach(function (e) {
296
+ if (e.querySelector(".list-v")) {
290
297
  // 点击菜单
291
- volantis.dom.$(_e).click(function (e) {
298
+ volantis.dom.$(e).click(function (e) {
292
299
  e.stopPropagation();
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
300
+ // 关闭已经展开的子菜单
301
+ e.currentTarget.parentElement.childNodes.forEach(function (e) {
302
+ if (Object.prototype.toString.call(e) == '[object HTMLLIElement]') {
303
+ e.childNodes.forEach(function (e) {
304
+ if (Object.prototype.toString.call(e) == '[object HTMLUListElement]') {
305
+ volantis.dom.$(e).hide()
306
+ }
307
+ })
303
308
  }
304
309
  })
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()
310
+ // 点击展开子菜单
311
+ let array = e.currentTarget.children
312
+ for (let index = 0; index < array.length; index++) {
313
+ const element = array[index];
314
+ if (volantis.dom.$(element).title === 'menu') { // 移动端菜单栏异常
315
+ volantis.dom.$(element).display = "flex" // https://github.com/volantis-x/hexo-theme-volantis/issues/706
338
316
  } 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
- })
317
+ volantis.dom.$(element).show()
352
318
  }
353
319
  }
354
-
355
320
  }, 0);
356
321
  }
357
322
  })
@@ -370,7 +335,7 @@ const VolantisApp = (() => {
370
335
  }
371
336
  fn.setPageHeaderMenuEvent();
372
337
  }
373
-
338
+
374
339
  // 【移动端】隐藏子菜单
375
340
  fn.setPageHeaderMenuEvent = () => {
376
341
  if (!volantis.isMobile) return
@@ -423,6 +388,23 @@ const VolantisApp = (() => {
423
388
  })
424
389
  }
425
390
 
391
+ // mathjax 引用跳转
392
+ fn.mathjaxRef = () => {
393
+ let ref = document.querySelectorAll('mjx-container a[href]');
394
+ ref.forEach(function (e, i) {
395
+ ref[i].click = () => { }; // 强制清空原 click 事件
396
+ let targetID = decodeURIComponent(ref[i].getAttribute('href').split('#')[1]).replace(/\ /g, '-');
397
+ volantis.dom.$(e).on('click', (e) => {
398
+ e.stopPropagation();
399
+ e.preventDefault();
400
+ let target = document.getElementById(targetID);
401
+ if (target) {
402
+ volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 25, behavior: 'instant' })
403
+ }
404
+ });
405
+ })
406
+ }
407
+
426
408
  // hexo-reference 页脚跳转 https://github.com/volantis-x/hexo-theme-volantis/issues/647
427
409
  fn.footnotes = () => {
428
410
  let ref = document.querySelectorAll('#l_main .footnote-backref, #l_main .footnote-ref > a');
@@ -557,8 +539,8 @@ const VolantisApp = (() => {
557
539
  // 消息提示:标准
558
540
  fn.message = (title, message, option = {}, done = null) => {
559
541
  if (typeof iziToast === "undefined") {
560
- volantis.css(volantis.GLOBAL_CONFIG.plugins.message.css)
561
- volantis.js(volantis.GLOBAL_CONFIG.plugins.message.js, () => {
542
+ volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css)
543
+ volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js, () => {
562
544
  tozashMessage(title, message, option, done);
563
545
  });
564
546
  } else {
@@ -603,8 +585,8 @@ const VolantisApp = (() => {
603
585
  // 消息提示:询问
604
586
  fn.question = (title, message, option = {}, success = null, cancel = null, done = null) => {
605
587
  if (typeof iziToast === "undefined") {
606
- volantis.css(volantis.GLOBAL_CONFIG.plugins.message.css)
607
- volantis.js(volantis.GLOBAL_CONFIG.plugins.message.js, () => {
588
+ volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css)
589
+ volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js, () => {
608
590
  tozashQuestion(title, message, option, success, cancel, done);
609
591
  });
610
592
  } else {
@@ -664,8 +646,8 @@ const VolantisApp = (() => {
664
646
  }
665
647
 
666
648
  if (typeof iziToast === "undefined") {
667
- volantis.css(volantis.GLOBAL_CONFIG.plugins.message.css)
668
- volantis.js(volantis.GLOBAL_CONFIG.plugins.message.js, () => {
649
+ volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css)
650
+ volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js, () => {
669
651
  hideMessage(done);
670
652
  });
671
653
  } else {
@@ -710,6 +692,7 @@ const VolantisApp = (() => {
710
692
  fn.setScrollAnchor();
711
693
  fn.setTabs();
712
694
  fn.footnotes();
695
+ fn.mathjaxRef();
713
696
  },
714
697
  pjaxReload: () => {
715
698
  fn.event();
@@ -720,6 +703,7 @@ const VolantisApp = (() => {
720
703
  fn.setScrollAnchor();
721
704
  fn.setTabs();
722
705
  fn.footnotes();
706
+ fn.mathjaxRef();
723
707
 
724
708
  // 移除小尾巴的移除
725
709
  document.querySelector("#l_header .nav-main").querySelectorAll('.list-v:not(.menu-phone)').forEach(function (e) {
@@ -745,8 +729,8 @@ const VolantisFancyBox = (() => {
745
729
  const fn = {};
746
730
 
747
731
  fn.loadFancyBox = (done) => {
748
- volantis.css(volantis.GLOBAL_CONFIG.plugins.fancybox.css);
749
- volantis.js(volantis.GLOBAL_CONFIG.plugins.fancybox.js).then(() => {
732
+ volantis.css(volantis.GLOBAL_CONFIG.cdn.fancybox_css);
733
+ volantis.js(volantis.GLOBAL_CONFIG.cdn.fancybox_js).then(() => {
750
734
  if (done) done();
751
735
  })
752
736
  }
@@ -855,17 +839,6 @@ const VolantisFancyBox = (() => {
855
839
  Object.freeze(VolantisFancyBox);
856
840
 
857
841
  // highlightKeyWords 与 搜索功能搭配 https://github.com/next-theme/hexo-theme-next/blob/eb194a7258058302baf59f02d4b80b6655338b01/source/js/third-party/search/local-search.js
858
- // Question: 锚点稳定性未知
859
- // ToDo: 查找模式
860
- // 0. (/////////要知道浏览器自带全页面查找功能 CTRL + F)
861
- // 1. 右键开启查找模式 / 导航栏菜单开启?? / CTRL + F ???
862
- // 2. 查找模式面板 (可拖动? or 固定?)
863
- // 3. keyword mark id 从 0 开始编号 查找下一处 highlightKeyWords.scrollToNextHighlightKeywordMark() 查找上一处 scrollToPrevHighlightKeywordMark() 循环查找(取模%)
864
- // 4. 可输入修改 查找关键词 keywords(type:list)
865
- // 5. 区分大小写 caseSensitive (/ 全字匹配?? / 正则匹配??)
866
- // 6. 在选定区域中查找 querySelector ??
867
- // 7. 关闭查找模式
868
- // 8. 搜索跳转 (URL 入口) 自动开启查找模式 调用 scrollToNextHighlightKeywordMark()
869
842
  const highlightKeyWords = (() => {
870
843
  let fn = {}
871
844
  fn.markNum = 0
@@ -902,21 +875,21 @@ const highlightKeyWords = (() => {
902
875
  // Current target
903
876
  return target
904
877
  }
905
- fn.scrollToPrevHighlightKeywordMark = (id) => {
906
- // Prev Id
907
- let input = id || (fn.markNextId - 1 + fn.markNum) % fn.markNum;
908
- fn.markNextId = parseInt(input)
909
- let target = document.getElementById("keyword-mark-" + fn.markNextId);
910
- if (!target) {
911
- fn.markNextId = (fn.markNextId - 1 + fn.markNum) % fn.markNum;
912
- target = document.getElementById("keyword-mark-" + fn.markNextId);
913
- }
914
- if (target) {
915
- volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant' })
916
- }
917
- // Current target
918
- return target
919
- }
878
+ // fn.scrollToPrevHighlightKeywordMark = (id) => {
879
+ // // Prev Id
880
+ // let input = id || (fn.markNextId - 1 + fn.markNum) % fn.markNum;
881
+ // fn.markNextId = parseInt(input)
882
+ // let target = document.getElementById("keyword-mark-" + fn.markNextId);
883
+ // if (!target) {
884
+ // fn.markNextId = (fn.markNextId - 1 + fn.markNum) % fn.markNum;
885
+ // target = document.getElementById("keyword-mark-" + fn.markNextId);
886
+ // }
887
+ // if (target) {
888
+ // volantis.scroll.to(target, { addTop: - volantis.dom.header.offsetHeight - 5, behavior: 'instant' })
889
+ // }
890
+ // // Current target
891
+ // return target
892
+ // }
920
893
  fn.start = (keywords, querySelector) => {
921
894
  fn.markNum = 0
922
895
  if (!keywords.length || !querySelector || (keywords.length == 1 && keywords[0] == "null")) return;
@@ -1024,30 +997,30 @@ const highlightKeyWords = (() => {
1024
997
  mark.style["font-weight"] = "bold";
1025
998
  return mark
1026
999
  }
1027
- fn.cleanHighlightStyle = () => {
1028
- document.querySelectorAll(".keyword").forEach(mark => {
1029
- mark.style.background = "transparent";
1030
- mark.style["border-bottom"] = null;
1031
- mark.style["color"] = null;
1032
- mark.style["font-weight"] = null;
1033
- })
1034
- }
1000
+ // fn.cleanHighlightStyle = () => {
1001
+ // document.querySelectorAll(".keyword").forEach(mark => {
1002
+ // mark.style.background = "transparent";
1003
+ // mark.style["border-bottom"] = null;
1004
+ // mark.style["color"] = null;
1005
+ // mark.style["font-weight"] = null;
1006
+ // })
1007
+ // }
1035
1008
  return {
1036
- start: (keywords, querySelector) => {
1037
- fn.start(keywords, querySelector)
1038
- },
1009
+ // start: (keywords, querySelector) => {
1010
+ // fn.start(keywords, querySelector)
1011
+ // },
1039
1012
  startFromURL: () => {
1040
1013
  fn.startFromURL()
1041
1014
  },
1042
- scrollToNextHighlightKeywordMark: (id) => {
1043
- fn.scrollToNextHighlightKeywordMark(id)
1044
- },
1045
- scrollToPrevHighlightKeywordMark: (id) => {
1046
- fn.scrollToPrevHighlightKeywordMark(id)
1047
- },
1048
- cleanHighlightStyle: () => {
1049
- fn.cleanHighlightStyle()
1050
- },
1015
+ // scrollToNextHighlightKeywordMark: (id) => {
1016
+ // fn.scrollToNextHighlightKeywordMark(id)
1017
+ // },
1018
+ // scrollToPrevHighlightKeywordMark: (id) => {
1019
+ // fn.scrollToPrevHighlightKeywordMark(id)
1020
+ // },
1021
+ // cleanHighlightStyle: () => {
1022
+ // fn.cleanHighlightStyle()
1023
+ // },
1051
1024
  }
1052
1025
  })()
1053
1026
  Object.freeze(highlightKeyWords);
@@ -1178,46 +1151,46 @@ const DOMController = {
1178
1151
  }
1179
1152
  Object.freeze(DOMController);
1180
1153
 
1181
- const VolantisRequest = {
1182
- timeoutFetch: (url, ms, requestInit) => {
1183
- const controller = new AbortController()
1184
- requestInit.signal?.addEventListener('abort', () => controller.abort())
1185
- let promise = fetch(url, { ...requestInit, signal: controller.signal })
1186
- if (ms > 0) {
1187
- const timer = setTimeout(() => controller.abort(), ms)
1188
- promise.finally(() => { clearTimeout(timer) })
1189
- }
1190
- promise = promise.catch((err) => {
1191
- throw ((err || {}).name === 'AbortError') ? new Error(`Fetch timeout: ${url}`) : err
1192
- })
1193
- return promise
1194
- },
1195
-
1196
- Fetch: async (url, requestInit, timeout = 15000) => {
1197
- const resp = await VolantisRequest.timeoutFetch(url, timeout, requestInit);
1198
- if (!resp.ok) throw new Error(`Fetch error: ${url} | ${resp.status}`);
1199
- let json = await resp.json()
1200
- if (!json.success) throw json
1201
- return json
1202
- },
1203
-
1204
- POST: async (url, data) => {
1205
- const requestInit = {
1206
- method: 'POST',
1207
- }
1208
- if (data) {
1209
- const formData = new FormData();
1210
- Object.keys(data).forEach(key => formData.append(key, String(data[key])))
1211
- requestInit.body = formData;
1212
- }
1213
- const json = await VolantisRequest.Fetch(url, requestInit)
1214
- return json.data;
1215
- },
1216
-
1217
- Get: async (url, data) => {
1218
- const json = await VolantisRequest.Fetch(url + (data ? (`?${new URLSearchParams(data)}`) : ''), {
1219
- method: 'GET'
1220
- })
1221
- }
1222
- }
1223
- Object.freeze(VolantisRequest);
1154
+ // const VolantisRequest = {
1155
+ // timeoutFetch: (url, ms, requestInit) => {
1156
+ // const controller = new AbortController()
1157
+ // requestInit.signal?.addEventListener('abort', () => controller.abort())
1158
+ // let promise = fetch(url, { ...requestInit, signal: controller.signal })
1159
+ // if (ms > 0) {
1160
+ // const timer = setTimeout(() => controller.abort(), ms)
1161
+ // promise.finally(() => { clearTimeout(timer) })
1162
+ // }
1163
+ // promise = promise.catch((err) => {
1164
+ // throw ((err || {}).name === 'AbortError') ? new Error(`Fetch timeout: ${url}`) : err
1165
+ // })
1166
+ // return promise
1167
+ // },
1168
+
1169
+ // Fetch: async (url, requestInit, timeout = 15000) => {
1170
+ // const resp = await VolantisRequest.timeoutFetch(url, timeout, requestInit);
1171
+ // if (!resp.ok) throw new Error(`Fetch error: ${url} | ${resp.status}`);
1172
+ // let json = await resp.json()
1173
+ // if (!json.success) throw json
1174
+ // return json
1175
+ // },
1176
+
1177
+ // POST: async (url, data) => {
1178
+ // const requestInit = {
1179
+ // method: 'POST',
1180
+ // }
1181
+ // if (data) {
1182
+ // const formData = new FormData();
1183
+ // Object.keys(data).forEach(key => formData.append(key, String(data[key])))
1184
+ // requestInit.body = formData;
1185
+ // }
1186
+ // const json = await VolantisRequest.Fetch(url, requestInit)
1187
+ // return json.data;
1188
+ // },
1189
+
1190
+ // Get: async (url, data) => {
1191
+ // const json = await VolantisRequest.Fetch(url + (data ? (`?${new URLSearchParams(data)}`) : ''), {
1192
+ // method: 'GET'
1193
+ // })
1194
+ // }
1195
+ // }
1196
+ // Object.freeze(VolantisRequest);
@@ -14,7 +14,7 @@ Parallax.slidein = () => {
14
14
  opac = opac + 0.1;
15
15
  slider.style.opacity = opac;
16
16
  setTimeout(Parallax.slidein, Parallax.options.fade / 10);
17
- }else{
17
+ } else {
18
18
  slider.style.opacity = 1;
19
19
  }
20
20
  } else {
@@ -545,14 +545,17 @@ RightMenus.fun = (() => {
545
545
  DOMController.removeList([
546
546
  '.cus-article-bkg', '.iziToast-overlay', '.iziToast-wrapper', '.prev-next',
547
547
  'footer', '#l_header', '#l_cover', '#l_side', '#comments', '#s-top', '#BKG',
548
- '#rightmenu-wrapper', '.nav-tabs', '.parallax-mirror', '.new-meta-item.share', 'div.footer'
548
+ '#rightmenu-wrapper', '.nav-tabs', '.parallax-mirror', '.new-meta-item.share',
549
+ '.new-meta-box', 'button.btn-copy', 'iframe'
549
550
  ]);
550
551
  DOMController.setStyleList([
551
- ['body', 'backgroundColor', 'unset'], ['#l_main', 'width', '100%'], ['#post', 'boxShadow', 'none'],
552
- ['#post', 'background', 'none'], ['#post', 'padding', '0'], ['h1', 'textAlign', 'center'],
553
- ['h1', 'fontWeight', '600'], ['h1', 'fontSize', '2rem'], ['h1', 'marginBottom', '20px'],
552
+ ['body', 'backgroundColor', 'unset'], ['#l_main, .copyright.license', 'width', '100%'],
553
+ ['#post', 'boxShadow', 'none'], ['#post', 'background', 'none'], ['#post', 'padding', '0'],
554
+ ['h1', 'textAlign', 'center'], ['h1', 'fontWeight', '600'], ['h1', 'fontSize', '2rem'], ['h1', 'marginBottom', '20px'],
554
555
  ['.tab-pane', 'display', 'block'], ['.tab-content', 'borderTop', 'none'], ['.highlight>table pre', 'whiteSpace', 'pre-wrap'],
555
- ['.highlight>table pre', 'wordBreak', 'break-all'], ['.fancybox img', 'height', 'auto'], ['.fancybox img', 'weight', 'auto']
556
+ ['.highlight>table pre', 'wordBreak', 'break-all'], ['.fancybox img', 'height', 'auto'], ['.fancybox img', 'weight', 'auto'],
557
+ ['.copyright.license', 'margin', '0'], ['.copyright.license', 'padding', '1.25em 20px'],
558
+ ['figure.highlight, .copyright.license', 'display', 'inline-block'],
556
559
  ]);
557
560
  setTimeout(() => {
558
561
  window.print();
@@ -563,20 +566,21 @@ RightMenus.fun = (() => {
563
566
 
564
567
  fn.readMode = () => {
565
568
  if (typeof ScrollReveal === 'function') ScrollReveal().clean('#comments');
566
- DOMController.fadeToggleList([
567
- document.querySelector('#l_header'), document.querySelector('footer'),
568
- document.querySelector('#s-top'), document.querySelector('.article-meta#bottom'),
569
- document.querySelector('.prev-next'), document.querySelector('#l_side'),
570
- document.querySelector('#comments')
571
- ]);
572
- DOMController.toggleClassList([
573
- [document.querySelector('#l_main'), 'common_read'], [document.querySelector('#l_main'), 'common_read_main'],
574
- [document.querySelector('#l_body'), 'common_read'], [document.querySelector('#safearea'), 'common_read'],
575
- [document.querySelector('#pjax-container'), 'common_read'], [document.querySelector('#read_bkg'), 'common_read_hide'],
576
- [document.querySelector('h1'), 'common_read_h1'], [document.querySelector('#post'), 'post_read'],
577
- [document.querySelector('#l_cover'), 'read_cover'], [document.querySelector('.widget.toc-wrapper'), 'post_read']
569
+ DOMController.setStyle('#l_header', 'opacity', 0);
570
+ DOMController.fadeToggleList([
571
+ document.querySelector('#l_cover'), document.querySelector('footer'),
572
+ document.querySelector('#s-top'), document.querySelector('.article-meta#bottom'),
573
+ document.querySelector('.prev-next'), document.querySelector('#l_side'),
574
+ document.querySelector('#comments'),
578
575
  ]);
579
- DOMController.setStyle('.copyright.license', 'margin', '15px 0');
576
+ DOMController.toggleClassList([
577
+ [document.querySelector('#l_main'), 'common_read'], [document.querySelector('#l_main'), 'common_read_main'],
578
+ [document.querySelector('#l_body'), 'common_read'], [document.querySelector('#safearea'), 'common_read'],
579
+ [document.querySelector('#pjax-container'), 'common_read'], [document.querySelector('#read_bkg'), 'common_read_hide'],
580
+ [document.querySelector('h1'), 'common_read_h1'], [document.querySelector('#post'), 'post_read'],
581
+ [document.querySelector('#l_cover'), 'read_cover'], [document.querySelector('.widget.toc-wrapper'), 'post_read']
582
+ ]);
583
+ DOMController.setStyle('.copyright.license', 'margin', '15px 0');
580
584
  volantis.isReadModel = volantis.isReadModel === undefined ? true : !volantis.isReadModel;
581
585
  if (volantis.isReadModel) {
582
586
  if (RightMenus.messageRightMenu) VolantisApp.message('系统提示', '阅读模式已开启,您可以点击屏幕空白处退出。', {
@@ -594,8 +598,8 @@ RightMenus.fun = (() => {
594
598
  } else {
595
599
  document.querySelector('#l_body').removeEventListener('click', fn.readMode);
596
600
  document.querySelector('#post').removeEventListener('click', fn.readMode);
597
- DOMController.setStyle('.prev-next', 'display', 'flex');
598
- DOMController.setStyle('.copyright.license', 'margin', '15px -40px');
601
+ DOMController.setStyle('.prev-next', 'display', 'flex');
602
+ DOMController.setStyle('.copyright.license', 'margin', '15px -40px');
599
603
  }
600
604
  }
601
605