hexo-theme-volantis 4.2.0 → 5.0.0-alpha.112

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 (302) hide show
  1. package/README.md +7 -5
  2. package/_config.yml +651 -234
  3. package/languages/en.yml +7 -0
  4. package/languages/zh-CN.yml +13 -2
  5. package/languages/zh-TW.yml +7 -0
  6. package/layout/404.ejs +1 -2
  7. package/layout/_meta/author.ejs +4 -4
  8. package/layout/_meta/category.ejs +11 -8
  9. package/layout/_meta/counter.ejs +51 -2
  10. package/layout/_meta/date.ejs +1 -1
  11. package/layout/_meta/music.ejs +1 -1
  12. package/layout/_meta/share.ejs +1 -1
  13. package/layout/_meta/tags.ejs +3 -0
  14. package/layout/_meta/thumbnail.ejs +3 -1
  15. package/layout/_meta/updated.ejs +1 -1
  16. package/layout/_meta/{valinecount.ejs → walinecount.ejs} +16 -15
  17. package/layout/{_cover → _partial/_cover}/blank.ejs +0 -0
  18. package/layout/{_cover → _partial/_cover}/dock.ejs +1 -1
  19. package/layout/{_cover → _partial/_cover}/featured.ejs +1 -1
  20. package/layout/{_cover → _partial/_cover}/focus.ejs +1 -1
  21. package/layout/_partial/_cover/layout.ejs +8 -0
  22. package/layout/{_cover → _partial/_cover}/search.ejs +2 -2
  23. package/layout/_partial/archive.ejs +2 -2
  24. package/layout/_partial/article.ejs +21 -13
  25. package/layout/_partial/categories.ejs +1 -1
  26. package/layout/_partial/cover.ejs +10 -30
  27. package/layout/_partial/footer.ejs +19 -11
  28. package/layout/_partial/head.ejs +70 -110
  29. package/layout/_partial/header.ejs +17 -11
  30. package/layout/_partial/meta.ejs +18 -4
  31. package/layout/_partial/post.ejs +35 -9
  32. package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +126 -0
  33. package/layout/_partial/scripts/{coverCtrl.ejs → _ctrl/coverCtrl.ejs} +22 -26
  34. package/layout/_partial/scripts/_ctrl.ejs +2 -0
  35. package/layout/_partial/scripts/content-visibility-scroll-fix.ejs +88 -0
  36. package/layout/_partial/scripts/global.ejs +423 -0
  37. package/layout/_partial/scripts/index.ejs +89 -73
  38. package/layout/_partial/scripts/toc.ejs +98 -68
  39. package/layout/_partial/side.ejs +4 -1
  40. package/layout/_plugins/_page_plugins/artitalk/index.ejs +15 -0
  41. package/layout/_plugins/_page_plugins/bbtalk/index.ejs +10 -0
  42. package/layout/_plugins/_page_plugins/fcircle/index.ejs +12 -0
  43. package/layout/_plugins/_page_plugins/gitter/index.ejs +14 -0
  44. package/layout/_plugins/_page_plugins/indent/index.ejs +16 -0
  45. package/layout/_plugins/_page_plugins/index.ejs +27 -0
  46. package/layout/_plugins/_page_plugins/katex/index.ejs +13 -0
  47. package/layout/{_third-party/math/mathjax/script.ejs → _plugins/_page_plugins/mathjax/index.ejs} +2 -2
  48. package/layout/_plugins/_page_plugins/snackbar/index.ejs +55 -0
  49. package/layout/{_partial/scripts/counter.ejs → _plugins/analytics/LCCounter.ejs} +0 -0
  50. package/layout/_plugins/analytics/script.ejs +74 -0
  51. package/layout/{_third-party → _plugins}/aplayer/layout.ejs +0 -0
  52. package/layout/_plugins/aplayer/script.ejs +74 -0
  53. package/layout/_plugins/chat/gitter/script.ejs +17 -0
  54. package/layout/_plugins/chat/index.ejs +1 -0
  55. package/layout/_plugins/chat/tidio/script.ejs +1 -0
  56. package/layout/_plugins/comments/artalk/script.ejs +59 -0
  57. package/layout/_plugins/comments/beaudar/script.ejs +61 -0
  58. package/layout/_plugins/comments/discuss/script.ejs +30 -0
  59. package/layout/_plugins/comments/disqus/script.ejs +98 -0
  60. package/layout/_plugins/comments/disqusjs/script.ejs +35 -0
  61. package/layout/_plugins/comments/giscus/script.ejs +47 -0
  62. package/layout/_plugins/comments/gitalk/script.ejs +24 -0
  63. package/layout/_plugins/comments/hashover/script.ejs +5 -0
  64. package/layout/{_third-party → _plugins}/comments/index.ejs +10 -3
  65. package/layout/_plugins/comments/isso/script.ejs +27 -0
  66. package/layout/_plugins/comments/livere/script.ejs +15 -0
  67. package/layout/_plugins/comments/twikoo/script.ejs +40 -0
  68. package/layout/_plugins/comments/utterances/script.ejs +43 -0
  69. package/layout/_plugins/comments/vssue/script.ejs +37 -0
  70. package/layout/_plugins/comments/waline/script.ejs +62 -0
  71. package/layout/_plugins/comments/z-custom/script.ejs +1 -0
  72. package/layout/_plugins/darkmode/script.ejs +114 -0
  73. package/layout/_plugins/end-of-support/script.ejs +62 -0
  74. package/layout/_plugins/github-api/script.ejs +27 -0
  75. package/layout/_plugins/highlight/highlightjs/script.ejs +26 -0
  76. package/layout/_plugins/highlight/prismjs/script.ejs +25 -0
  77. package/layout/_plugins/highlight/script.ejs +1 -0
  78. package/layout/{_third-party → _plugins}/lazyload/script.ejs +1 -1
  79. package/layout/_plugins/nodewaves/script.ejs +12 -0
  80. package/layout/_plugins/parallax/script.ejs +74 -0
  81. package/layout/{_third-party → _plugins}/pjax/animate.ejs +31 -26
  82. package/layout/_plugins/pjax/index.ejs +73 -0
  83. package/layout/_plugins/pjax/pdata.ejs +56 -0
  84. package/layout/_plugins/preload/script.ejs +14 -0
  85. package/layout/_plugins/rightmenu/layout.ejs +119 -0
  86. package/layout/_plugins/rightmenus/layout.ejs +137 -0
  87. package/layout/_plugins/scrollreveal/script.ejs +25 -0
  88. package/layout/_plugins/search/script.ejs +50 -0
  89. package/layout/{_third-party → _plugins}/share/layout.ejs +0 -0
  90. package/layout/_plugins/swiper/script.ejs +37 -0
  91. package/layout/_pre.ejs +2 -2
  92. package/layout/_widget/_pre.ejs +5 -0
  93. package/layout/_widget/blogger.ejs +1 -1
  94. package/layout/_widget/category.ejs +2 -2
  95. package/layout/_widget/copyright.ejs +1 -1
  96. package/layout/_widget/grid.ejs +3 -3
  97. package/layout/_widget/lastupdate.ejs +27 -0
  98. package/layout/_widget/list.ejs +2 -2
  99. package/layout/_widget/load.ejs +18 -0
  100. package/layout/_widget/music.ejs +3 -2
  101. package/layout/_widget/page.ejs +1 -1
  102. package/layout/_widget/qrcode.ejs +1 -1
  103. package/layout/_widget/related_posts.ejs +1 -1
  104. package/layout/_widget/tagcloud.ejs +1 -1
  105. package/layout/_widget/text.ejs +1 -1
  106. package/layout/_widget/toc.ejs +6 -2
  107. package/layout/_widget/webinfo.ejs +13 -76
  108. package/layout/archive.ejs +4 -4
  109. package/layout/category.ejs +9 -4
  110. package/layout/docs.ejs +1 -1
  111. package/layout/friends.ejs +6 -25
  112. package/layout/index.ejs +1 -1
  113. package/layout/layout.ejs +40 -24
  114. package/layout/list.ejs +1 -1
  115. package/layout/page.ejs +1 -1
  116. package/layout/post.ejs +1 -1
  117. package/layout/tag.ejs +8 -3
  118. package/package.json +6 -2
  119. package/scripts/events/index.js +13 -0
  120. package/scripts/events/lib/check-configuration.js +43 -0
  121. package/scripts/events/lib/check-environment.js +74 -0
  122. package/scripts/events/lib/config.js +35 -10
  123. package/scripts/events/lib/render-stylus.js +78 -0
  124. package/scripts/events/lib/stellar-tag-utils.js +76 -0
  125. package/scripts/filters/content-visibility.js +25 -0
  126. package/scripts/{render → filters}/img.js +1 -1
  127. package/scripts/filters/replace.js +15 -0
  128. package/scripts/{z-lazyload/lib/process.js → filters/z-lazyload.js} +18 -15
  129. package/scripts/helpers/custom-files.js +165 -0
  130. package/scripts/helpers/first-style.js +19 -0
  131. package/scripts/helpers/head/autoCanonical.js +15 -0
  132. package/scripts/helpers/head/generate_preload_fontfamily.js +22 -0
  133. package/scripts/helpers/head/generate_seo.js +24 -0
  134. package/scripts/helpers/head/generate_title__keywords__description.js +101 -0
  135. package/scripts/{related_posts/index.js → helpers/related-posts.js} +9 -9
  136. package/scripts/helpers/revisioned.js +158 -0
  137. package/scripts/helpers/structured-data/index.js +2 -0
  138. package/scripts/helpers/structured-data/lib/blogposting.js +77 -0
  139. package/scripts/helpers/structured-data/lib/breadcrumblist.js +152 -0
  140. package/scripts/helpers/structured-data/lib/config.js +31 -0
  141. package/scripts/helpers/structured-data/lib/index.js +30 -0
  142. package/scripts/helpers/structured-data/lib/organization.js +15 -0
  143. package/scripts/helpers/structured-data/lib/person.js +16 -0
  144. package/scripts/helpers/structured-data/lib/website.js +42 -0
  145. package/scripts/tags/btn.js +31 -26
  146. package/scripts/tags/btns.js +18 -13
  147. package/scripts/tags/checkbox.js +32 -22
  148. package/scripts/tags/contributors.js +100 -0
  149. package/scripts/tags/dropmenu.js +50 -35
  150. package/scripts/tags/fancybox.js +44 -10
  151. package/scripts/tags/folding.js +14 -9
  152. package/scripts/tags/frame.js +8 -3
  153. package/scripts/tags/friends.js +99 -0
  154. package/scripts/tags/ghcard.js +11 -6
  155. package/scripts/tags/image.js +18 -6
  156. package/scripts/tags/link.js +15 -10
  157. package/scripts/tags/md.js +59 -0
  158. package/scripts/tags/media.js +32 -8
  159. package/scripts/tags/note.js +41 -8
  160. package/scripts/tags/site.js +87 -51
  161. package/scripts/tags/span.js +16 -6
  162. package/scripts/tags/swiper.js +38 -0
  163. package/scripts/tags/table.js +1 -1
  164. package/scripts/tags/tabs.js +33 -3
  165. package/scripts/tags/timeline.js +9 -4
  166. package/source/css/Readme.md +28 -0
  167. package/source/css/_defines/AutoPrefixCSS.styl +347 -0
  168. package/source/css/_defines/Readme.md +3 -0
  169. package/source/css/_defines/color.styl +41 -1
  170. package/source/css/_defines/effect.styl +0 -13
  171. package/source/css/_defines/fonts.styl +17 -18
  172. package/source/css/_defines/func.styl +12 -30
  173. package/source/css/_first/base_first.styl +118 -0
  174. package/source/css/_first/{cover.styl → cover_first.styl} +113 -87
  175. package/source/css/_first/dark_first.styl +76 -0
  176. package/source/css/_first/fontfamily_first.styl +17 -0
  177. package/source/css/_first/{navbar.styl → navbar_first.styl} +4 -10
  178. package/source/css/_first/search_first.styl +12 -0
  179. package/source/css/{_base/index.styl → _style/_base/base.styl} +9 -93
  180. package/source/css/_style/_base/fontfamily_async.styl +8 -0
  181. package/source/css/{_layout → _style/_layout}/archive.styl +0 -0
  182. package/source/css/{_layout → _style/_layout}/article.styl +3 -30
  183. package/source/css/{_layout → _style/_layout}/footer.styl +0 -0
  184. package/source/css/_style/_layout/friends-simpleuser.styl +23 -0
  185. package/source/css/_style/_layout/friends-traditional.styl +81 -0
  186. package/source/css/{_layout → _style/_layout}/img.styl +0 -0
  187. package/source/css/_style/_layout/loading.styl +14 -0
  188. package/source/css/{_layout → _style/_layout}/main.styl +20 -7
  189. package/source/css/{_layout → _style/_layout}/md.styl +0 -0
  190. package/source/css/{_layout → _style/_layout}/pagination.styl +1 -1
  191. package/source/css/{_layout → _style/_layout}/posts.styl +2 -0
  192. package/source/css/{_first → _style/_layout}/search.styl +0 -103
  193. package/source/css/{_layout → _style/_layout}/sidebar.styl +23 -3
  194. package/source/css/{_layout → _style/_layout}/snackbar.styl +2 -1
  195. package/source/css/{_layout → _style/_layout}/toc.styl +3 -3
  196. package/source/css/{_layout → _style/_layout}/video.styl +0 -0
  197. package/source/css/_style/_plugins/_dark/dark_async.styl +41 -0
  198. package/source/css/_style/_plugins/_dark/dark_plugins.styl +136 -0
  199. package/source/css/_style/_plugins/_highlight/highlightjs/clipboard.styl +36 -0
  200. package/source/css/_style/_plugins/_highlight/highlightjs/color.styl +96 -0
  201. package/source/css/_style/_plugins/_highlight/highlightjs/index.styl +102 -0
  202. package/source/css/_style/_plugins/_highlight/highlightjs/language.styl +63 -0
  203. package/source/css/_style/_plugins/_highlight/index.styl +1 -0
  204. package/source/css/_style/_plugins/_highlight/prismjs/clipboard.styl +33 -0
  205. package/source/css/_style/_plugins/_highlight/prismjs/index.styl +8 -0
  206. package/source/css/_style/_plugins/_highlight/prismjs/language.styl +63 -0
  207. package/source/css/_style/_plugins/_rightmenu/reading.styl +56 -0
  208. package/source/css/{_plugins → _style/_plugins/_rightmenu}/rightmenu.styl +22 -2
  209. package/source/css/{_plugins → _style/_plugins}/aplayer.styl +11 -0
  210. package/source/css/{_plugins → _style/_plugins}/cursor.styl +49 -19
  211. package/source/css/_style/_plugins/fontcolor.styl +84 -0
  212. package/source/css/{_plugins → _style/_plugins}/gitalk.styl +0 -0
  213. package/source/css/_style/_plugins/index.styl +24 -0
  214. package/source/css/{_plugins → _style/_plugins}/mathjax.styl +0 -0
  215. package/source/css/_style/_plugins/message.styl +14 -0
  216. package/source/css/{_plugins → _style/_plugins}/pjaxanimate.styl +0 -0
  217. package/source/css/_style/_tag-plugins/Readme.md +6 -0
  218. package/source/css/{_tag-plugins → _style/_tag-plugins}/btns.styl +0 -0
  219. package/source/css/{_tag-plugins → _style/_tag-plugins}/checkbox.styl +0 -0
  220. package/source/css/{_tag-plugins → _style/_tag-plugins}/dropmenu.styl +0 -0
  221. package/source/css/{_plugins → _style/_tag-plugins}/fancybox.styl +8 -9
  222. package/source/css/{_tag-plugins → _style/_tag-plugins}/folding.styl +0 -0
  223. package/source/css/{_tag-plugins → _style/_tag-plugins}/frame.styl +0 -0
  224. package/source/css/_style/_tag-plugins/friends.styl +72 -0
  225. package/source/css/{_tag-plugins → _style/_tag-plugins}/ghcard.styl +0 -0
  226. package/source/css/{_tag-plugins → _style/_tag-plugins}/image.styl +0 -0
  227. package/source/css/{_tag-plugins → _style/_tag-plugins}/link.styl +0 -0
  228. package/source/css/{_tag-plugins → _style/_tag-plugins}/media.styl +0 -0
  229. package/source/css/{_tag-plugins → _style/_tag-plugins}/note.styl +0 -0
  230. package/source/css/_style/_tag-plugins/sites.styl +87 -0
  231. package/source/css/{_tag-plugins → _style/_tag-plugins}/span.styl +0 -0
  232. package/source/css/_style/_tag-plugins/swiper.styl +44 -0
  233. package/source/css/{_tag-plugins → _style/_tag-plugins}/table.styl +0 -0
  234. package/source/css/{_tag-plugins → _style/_tag-plugins}/tabs.styl +0 -0
  235. package/source/css/_style/_tag-plugins/tag.json +35 -0
  236. package/source/css/_style/_tag-plugins/text.styl +31 -0
  237. package/source/css/{_tag-plugins → _style/_tag-plugins}/timeline.styl +0 -0
  238. package/source/css/_style/index.styl +8 -0
  239. package/source/css/first.styl +17 -6
  240. package/source/css/style.styl +9 -7
  241. package/source/js/app.js +1128 -359
  242. package/source/js/plugins/aplayer.js +186 -0
  243. package/source/js/plugins/parallax.js +191 -0
  244. package/source/js/plugins/rightMenu.js +577 -0
  245. package/source/js/plugins/rightMenus.js +616 -0
  246. package/source/js/plugins/tags/contributors.js +92 -0
  247. package/source/js/plugins/tags/friends.js +93 -0
  248. package/source/js/plugins/tags/sites.js +96 -0
  249. package/source/js/search/hexo.js +180 -378
  250. package/layout/_partial/rightmenu.ejs +0 -204
  251. package/layout/_partial/scripts/cover.ejs +0 -45
  252. package/layout/_partial/scripts/darkmode.ejs +0 -96
  253. package/layout/_partial/scripts/import.ejs +0 -3
  254. package/layout/_partial/scripts/loadfunction.ejs +0 -72
  255. package/layout/_partial/scripts/search.ejs +0 -62
  256. package/layout/_partial/snackbar.ejs +0 -22
  257. package/layout/_third-party/analytics/script.ejs +0 -24
  258. package/layout/_third-party/aplayer/script.ejs +0 -24
  259. package/layout/_third-party/clipboard/script.ejs +0 -53
  260. package/layout/_third-party/comments/disqus/layout.ejs +0 -5
  261. package/layout/_third-party/comments/disqus/script.ejs +0 -93
  262. package/layout/_third-party/comments/gitalk/layout.ejs +0 -1
  263. package/layout/_third-party/comments/gitalk/script.ejs +0 -29
  264. package/layout/_third-party/comments/hashover/layout.ejs +0 -2
  265. package/layout/_third-party/comments/hashover/script.ejs +0 -1
  266. package/layout/_third-party/comments/isso/layout.ejs +0 -1
  267. package/layout/_third-party/comments/isso/script.ejs +0 -1
  268. package/layout/_third-party/comments/livere/layout.ejs +0 -3
  269. package/layout/_third-party/comments/livere/script.ejs +0 -10
  270. package/layout/_third-party/comments/minivaline/layout.ejs +0 -3
  271. package/layout/_third-party/comments/minivaline/script.ejs +0 -29
  272. package/layout/_third-party/comments/twikoo/layout.ejs +0 -3
  273. package/layout/_third-party/comments/twikoo/script.ejs +0 -17
  274. package/layout/_third-party/comments/valine/layout.ejs +0 -3
  275. package/layout/_third-party/comments/valine/script.ejs +0 -75
  276. package/layout/_third-party/comments/vssue/layout.ejs +0 -1
  277. package/layout/_third-party/comments/vssue/script.ejs +0 -22
  278. package/layout/_third-party/fancybox/script.ejs +0 -50
  279. package/layout/_third-party/issues/script.ejs +0 -15
  280. package/layout/_third-party/pjax/index.ejs +0 -143
  281. package/layout/_third-party/pjax/pdata.ejs +0 -47
  282. package/layout/_third-party/scrollreveal/script.ejs +0 -15
  283. package/layout/artitalk.ejs +0 -48
  284. package/scripts/tags/issues.js +0 -41
  285. package/scripts/z-lazyload/index.js +0 -4
  286. package/source/css/_highlight/index.styl +0 -316
  287. package/source/css/_layout/friends.styl +0 -79
  288. package/source/css/_plugins/clipboard.styl +0 -37
  289. package/source/css/_plugins/dark.styl +0 -149
  290. package/source/css/_plugins/darkmode.styl +0 -9
  291. package/source/css/_plugins/index.styl +0 -16
  292. package/source/css/_plugins/valine.styl +0 -173
  293. package/source/css/_tag-plugins/simpleuser.styl +0 -21
  294. package/source/css/_tag-plugins/site-card.styl +0 -70
  295. package/source/js/aplayer.js +0 -161
  296. package/source/js/issues.js +0 -186
  297. package/source/js/search/algolia.js +0 -348
  298. package/source/js/search/azure.js +0 -359
  299. package/source/js/search/baidu.js +0 -342
  300. package/source/js/search/google.js +0 -343
  301. package/source/js/twikoo.js +0 -13
  302. package/source/js/valine.js +0 -5265
@@ -1,128 +1,144 @@
1
- <%- partial('loadfunction') %>
1
+ <script>
2
+ /******************** volantis.dom ********************************/
3
+ // 页面选择器 将dom对象缓存起来 see: /source/js/app.js etc.
4
+ volantis.dom.bodyAnchor = volantis.dom.$(document.getElementById("safearea")); // 页面主体
5
+ volantis.dom.topBtn = volantis.dom.$(document.getElementById('s-top')); // 向上
6
+ volantis.dom.wrapper = volantis.dom.$(document.getElementById('wrapper')); // 整个导航栏
7
+ volantis.dom.coverAnchor = volantis.dom.$(document.querySelector('#l_cover .cover-wrapper')); // 1个
8
+ volantis.dom.switcher = volantis.dom.$(document.querySelector('#l_header .switcher .s-search')); // 搜索按钮 移动端 1个
9
+ volantis.dom.header = volantis.dom.$(document.getElementById('l_header')); // 移动端导航栏
10
+ volantis.dom.search = volantis.dom.$(document.querySelector('#l_header .m_search')); // 搜索框 桌面端 移动端 1个
11
+ volantis.dom.mPhoneList = volantis.dom.$(document.querySelectorAll('#l_header .m-phone .list-v')); // 手机端 子菜单 多个
12
+ </script>
13
+
2
14
  <script>
3
15
  <% if (theme.plugins.fontawesome) { %>
4
- loadCSS("<%- theme.plugins.fontawesome %>", window.volantis.loadcss);
16
+ volantis.css("<%- theme.plugins.fontawesome %>");
5
17
  <% } %>
6
18
  <% if (theme.plugins.fontawesome_animation.enable) { %>
7
- loadCSS("<%- theme.plugins.fontawesome_animation.css %>", window.volantis.loadcss);
19
+ volantis.css("<%- theme.plugins.fontawesome_animation.css %>");
8
20
  <% } %>
9
21
  <% if (theme.plugins.nodewaves.enable) { %>
10
- loadCSS("<%- theme.plugins.nodewaves.css %>", window.volantis.loadcss);
11
- <% } %>
12
- <% if ((theme.plugins.highlightjs.enable == true)&&(theme.plugins.highlightjs.css)) { %>
13
- loadCSS("<%- theme.plugins.highlightjs.css %>", window.volantis.loadcss);
22
+ volantis.css("<%- theme.plugins.nodewaves.css %>");
14
23
  <% } %>
15
24
  </script>
25
+
16
26
  <!-- required -->
17
- <%- js(theme.plugins.jquery) %>
18
- <%- partial('../../_third-party/fancybox/script') %>
27
+ <% if (theme.plugins.globalJquery) { %>
28
+ <%- js(theme.plugins.jquery) %>
29
+ <% } %>
19
30
 
20
31
  <!-- internal -->
21
- <%- partial('cover') %>
22
- <% if (theme.rightmenu.enable == true) { %>
23
- <%- partial('../rightmenu') %>
32
+ <%- js(theme.cdn.map.js.app) %>
33
+
34
+ <% if (theme.rightmenu.enable) { %>
35
+ <%- partial('../../_plugins/rightmenu/layout') %>
24
36
  <% } %>
25
37
 
26
- <% if (theme.plugins.issues.enable) { %>
27
- <%- partial('../../_third-party/issues/script') %>
38
+ <% if (theme.rightmenus.enable) { %>
39
+ <%- partial('../../_plugins/rightmenus/layout') %>
28
40
  <% } %>
29
41
 
30
- <% if (theme.plugins.lazyload && theme.plugins.lazyload.enable) { %>
31
- <%- partial('../../_third-party/lazyload/script') %>
42
+ <!-- rightmenu要在darkmode之前(ToggleButton) darkmode要在comments之前(volantis.dark.push)-->
43
+ <% if (theme.plugins.darkmode.enable) { %>
44
+ <%- partial('../../_plugins/darkmode/script') %>
32
45
  <% } %>
33
46
 
34
- <% if (theme.plugins.preload.enable && theme.plugins.preload.service) { %>
35
- <% let preload = theme.plugins.preload; %>
36
- <% if (preload.service == 'instant_page') { %>
37
- <script async src="<%- preload.instant_page %>" type="module" defer integrity="sha384-OeDn4XE77tdHo8pGtE1apMPmAipjoxUQ++eeJa6EtJCfHlvijigWiJpD7VDPWXV1"></script>
38
- <% } else if (preload.service == 'flying_pages') { %>
39
- <script>
40
- window.FPConfig = {
41
- delay: 0,
42
- ignoreKeywords: [],
43
- maxRPS: 5,
44
- hoverDelay: 25
45
- };
46
- </script>
47
- <script defer src="<%- preload.flying_pages %>"></script>
48
- <% } %>
47
+ <% if (theme.plugins.sitesjs.enable || theme.plugins.friendsjs.enable || theme.plugins.contributorsjs.enable) { %>
48
+ <%- partial('../../_plugins/github-api/script') %>
49
49
  <% } %>
50
50
 
51
+ <% if (theme.plugins.lazyload && theme.plugins.lazyload.enable) { %>
52
+ <%- partial('../../_plugins/lazyload/script') %>
53
+ <% } %>
51
54
 
52
- <% if (theme.plugins.clipboard.enable && (theme.custom_css.body.highlight.copy_btn == true)) { %>
53
- <%- partial('../../_third-party/clipboard/script') %>
55
+ <% if (theme.plugins.preload.enable && theme.plugins.preload.service) { %>
56
+ <%- partial('../../_plugins/preload/script') %>
54
57
  <% } %>
55
58
 
56
59
  <% if (theme.plugins.scrollreveal.enable && theme.plugins.scrollreveal.js) { %>
57
- <%- partial('../../_third-party/scrollreveal/script') %>
60
+ <%- partial('../../_plugins/scrollreveal/script') %>
58
61
  <% } %>
59
62
 
60
63
  <% if (theme.plugins.aplayer && theme.plugins.aplayer.enable && theme.plugins.aplayer.js) { %>
61
- <%- partial('../../_third-party/aplayer/script') %>
62
- <% } %>
64
+ <%- partial('../../_plugins/aplayer/script') %>
65
+ <% } %>
66
+
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
+
63
87
 
64
- <% if (theme.comments.service && theme.comments.service.length > 0) { %>
65
- <%- partial('../../_third-party/comments/' + theme.comments.service + '/script') %>
66
- <% } %>
67
88
 
68
89
  <% if (theme.analytics.busuanzi) { %>
69
90
  <script defer src="<%- theme.analytics.busuanzi %>" data-pjax></script>
70
91
  <% } %>
71
- <% if (theme.use_cdn && theme.info.cdn && theme.info.cdn.js) { %>
72
- <%- js(theme.info.cdn.js) %>
73
- <% } else if(theme.use_cdn) { %>
74
- <%- js(['https://cdn.jsdelivr.net/npm/hexo-theme-volantis@'+theme.info.theme_version+'/source/js/app.min.js']) %>
75
- <% } else { %>
76
- <%- js(['js/app.js']) %>
77
- <% } %>
78
92
 
79
93
  <!-- optional -->
80
94
  <% if (theme.search && theme.search.enable) { %>
81
- <%- partial('search') %>
95
+ <%- partial('../../_plugins/search/script') %>
82
96
  <% } %>
83
97
 
84
-
85
98
  <% if (theme.plugins.nodewaves.enable) { %>
86
- <%- js({src: theme.plugins.nodewaves.js}) %>
87
- <script type="text/javascript">
88
- $(function () {
89
- Waves.attach('.flat-btn', ['waves-button']);
90
- Waves.attach('.float-btn', ['waves-button', 'waves-float']);
91
- Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
92
- Waves.attach('.flat-box', ['waves-block']);
93
- Waves.attach('.float-box', ['waves-block', 'waves-float']);
94
- Waves.attach('.waves-image');
95
- Waves.init();
96
- });
97
- </script>
99
+ <%- partial('../../_plugins/nodewaves/script') %>
98
100
  <% } %>
99
101
 
100
102
  <% if (theme.plugins.comment_typing.enable) { %>
101
103
  <%- js(theme.plugins.comment_typing.js) %>
102
104
  <% } %>
103
105
 
104
- <% if (theme.plugins.highlightjs.enable) { %>
105
- <% if (theme.plugins.highlightjs.js) { %>
106
- <%- js(theme.plugins.highlightjs.js) %>
107
- <script>hljs.initHighlightingOnLoad();</script>
108
- <% } %>
106
+ <% if (theme.plugins.code_highlight) { %>
107
+ <%- partial('../../_plugins/highlight/script') %>
109
108
  <% } %>
110
109
 
111
110
  <% if (theme.analytics && theme.analytics.leancloud && theme.analytics.leancloud.app_id) { %>
112
- <%- partial('counter') %>
111
+ <%- partial('../../_plugins/analytics/LCCounter') %>
113
112
  <% } %>
114
113
 
115
- <% if (theme.plugins.darkmodejs.enable) { %>
116
- <%- partial('darkmode') %>
114
+ <% if (config.google_analytics_key || config.baidu_analytics_key || config.tencent_aegis_id || config.v6_51_la) { %>
115
+ <%- partial('../../_plugins/analytics/script') %>
117
116
  <% } %>
118
117
 
119
- <%- partial('../../_third-party/analytics/script') %>
118
+ <% if (theme.plugins.chat_service) { %>
119
+ <%- partial('../../_plugins/chat/index') %>
120
+ <% } %>
120
121
 
121
- <%- partial('toc') %>
122
+ <% if (theme.plugins.parallax.enable) { %>
123
+ <%- partial('../../_plugins/parallax/script') %>
124
+ <% } %>
125
+
126
+ <% if (theme.plugins.swiper.enable) { %>
127
+ <%- partial('../../_plugins/swiper/script') %>
128
+ <% } %>
122
129
 
123
- <!-- more -->
124
- <% if (config.import && config.import.script) { %>
125
- <%- partial('import') %>
130
+ <!-- pjax 标签必须存在于所有页面 否则 pjax error -->
131
+ <pjax>
132
+ <% if (page.plugins) { %>
133
+ <%- partial('../../_plugins/_page_plugins/index') %>
126
134
  <% } %>
135
+ </pjax>
127
136
 
137
+ <%- partial('toc') %>
138
+
139
+ <%- partial('content-visibility-scroll-fix') %>
140
+
141
+ <% if (theme.structured_data && theme.structured_data.enable) { %>
142
+ <%- structured_data() %>
143
+ <% } %>
128
144
 
@@ -1,80 +1,110 @@
1
1
  <script>
2
- function listennSidebarTOC() {
3
- const navItems = document.querySelectorAll(".toc li");
4
- if (!navItems.length) return;
5
- const sections = [...navItems].map((element) => {
6
- const link = element.querySelector(".toc-link");
7
- const target = document.getElementById(
8
- decodeURI(link.getAttribute("href")).replace("#", "")
9
- );
10
- link.addEventListener("click", (event) => {
11
- event.preventDefault();
12
- window.scrollTo({
13
- top: target.offsetTop + 100,
14
- <% if (theme.custom_css.toc_smooth) { %>
15
- behavior: "smooth"
16
- <% } %>
17
- });
2
+ function listennSidebarTOC() {
3
+ const navItems = document.querySelectorAll(".toc li");
4
+ if (!navItems.length) return;
5
+ let targets = []
6
+ const sections = [...navItems].map((element) => {
7
+ const link = element.querySelector(".toc-link");
8
+ const target = document.getElementById(
9
+ decodeURI(link.getAttribute("href")).replace("#", "")
10
+ );
11
+ targets.push(target)
12
+ // 解除 a 标签 href 的 锚点定位, a 标签 href 的 锚点定位 会随机启用?? 产生错位???
13
+ link.setAttribute("onclick","return false;")
14
+ link.setAttribute("toc-action","toc-"+decodeURI(link.getAttribute("href")).replace("#", ""))
15
+ link.setAttribute("href","/")
16
+ // 配置 点击 触发新的锚点定位
17
+ link.addEventListener("click", (event) => {
18
+ event.preventDefault();
19
+ // 这里的 addTop 是通过错位使得 toc 自动展开.
20
+ volantis.scroll.to(target,{addTop: 5, observer:true})
21
+ // Anchor id
22
+ history.pushState(null, document.title, "#" + target.id);
23
+ });
24
+ return target;
18
25
  });
19
- return target;
20
- });
21
26
 
22
- function activateNavByIndex(target) {
23
- if (target.classList.contains("active-current")) return;
27
+ function activateNavByIndex(target) {
28
+ if (target.classList.contains("active-current")) return;
24
29
 
25
- document.querySelectorAll(".toc .active").forEach((element) => {
26
- element.classList.remove("active", "active-current");
27
- });
28
- target.classList.add("active", "active-current");
29
- let parent = target.parentNode;
30
- while (!parent.matches(".toc")) {
31
- if (parent.matches("li")) parent.classList.add("active");
32
- parent = parent.parentNode;
33
- }
34
- }
35
-
36
- function findIndex(entries) {
37
- let index = 0;
38
- let entry = entries[index];
39
- if (entry.boundingClientRect.top > 0) {
40
- index = sections.indexOf(entry.target);
41
- return index === 0 ? 0 : index - 1;
42
- }
43
- for (; index < entries.length; index++) {
44
- if (entries[index].boundingClientRect.top <= 0) {
45
- entry = entries[index];
46
- } else {
47
- return sections.indexOf(entry.target);
30
+ document.querySelectorAll(".toc .active").forEach((element) => {
31
+ element.classList.remove("active", "active-current");
32
+ });
33
+ target.classList.add("active", "active-current");
34
+ let parent = target.parentNode;
35
+ while (!parent.matches(".toc")) {
36
+ if (parent.matches("li")) parent.classList.add("active");
37
+ parent = parent.parentNode;
48
38
  }
49
39
  }
50
- return sections.indexOf(entry.target);
51
- }
52
40
 
53
- function createIntersectionObserver(marginTop) {
54
- marginTop = Math.floor(marginTop + 10000);
55
- let intersectionObserver = new IntersectionObserver(
56
- (entries, observe) => {
57
- let scrollHeight = document.documentElement.scrollHeight + 100;
58
- if (scrollHeight > marginTop) {
59
- observe.disconnect();
60
- createIntersectionObserver(scrollHeight);
61
- 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;
56
+ }
62
57
  }
63
- let index = findIndex(entries);
64
- activateNavByIndex(navItems[index]);
65
- },
66
- {
67
- rootMargin: marginTop + "px 0px -100% 0px",
68
- threshold: 0,
69
58
  }
70
- );
71
- sections.forEach((element) => {
72
- element && intersectionObserver.observe(element);
73
- });
59
+ activateNavByIndex(navItems[volantis.activateNavIndex])
60
+ })
61
+
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);
74
102
  }
75
- createIntersectionObserver(document.documentElement.scrollHeight);
76
- }
77
103
 
78
- document.addEventListener("DOMContentLoaded", listennSidebarTOC);
79
- document.addEventListener("pjax:success", listennSidebarTOC);
104
+ document.addEventListener("DOMContentLoaded", ()=>{
105
+ volantis.requestAnimationFrame(listennSidebarTOC)
106
+ });
107
+ document.addEventListener("pjax:success", ()=>{
108
+ volantis.requestAnimationFrame(listennSidebarTOC)
109
+ });
80
110
  </script>
@@ -1,3 +1,6 @@
1
- <aside class='l_side'>
1
+ <aside id='l_side' itemscope itemtype="http://schema.org/WPSideBar">
2
2
  <%- partial('../_widget/load', {widgets: page.sidebar, where: 'sidebar'}) %>
3
+ <!-- Custom Files side begin -->
4
+ <%- volantis_inject('side') %>
5
+ <!-- Custom Files side end -->
3
6
  </aside>
@@ -0,0 +1,15 @@
1
+ <script>
2
+ volantis.layoutHelper("page-plugins",`<div id="artitalk_main"></div>`,{pjax:false}) // 外层有 pjax 标签
3
+ </script>
4
+ <script>
5
+ volantis.import.jQuery().then(()=>{
6
+ volantis.js("<%= theme.plugins.artitalk.js %>").then(()=>{
7
+ new Artitalk(Object.assign(<%- JSON.stringify(theme.plugins.artitalk) %>, {}))
8
+ })
9
+ })
10
+ </script>
11
+ <style>
12
+ #artitalk_main #lazy {
13
+ background: transparent !important;
14
+ }
15
+ </style>
@@ -0,0 +1,10 @@
1
+ <script>
2
+ volantis.layoutHelper("page-plugins",`<div id="bbtalk"></div>`,{pjax:false}) // 外层有 pjax 标签
3
+ </script>
4
+ <script>
5
+ volantis.import.jQuery().then(()=>{
6
+ volantis.js("<%= theme.plugins.bbtalk.js %>").then(()=>{
7
+ bbtalk.init(Object.assign(<%- JSON.stringify(theme.plugins.bbtalk) %>, {}))
8
+ })
9
+ })
10
+ </script>
@@ -0,0 +1,12 @@
1
+ <script>
2
+ volantis.layoutHelper("page-plugins",`<div class="post-content"><div id="cf-container"><%- theme.plugins.fcircle.message %></div></div>`,{pjax:false}) // 外层有 pjax 标签
3
+ </script>
4
+ <script type="text/javascript">
5
+ var fdataUser = {
6
+ apiurl: '<%- theme.plugins.fcircle.api %>'
7
+ }
8
+ </script>
9
+ <link rel="stylesheet" href="<%- theme.plugins.fcircle.css %>">
10
+ <script type="text/javascript"
11
+ src="<%- theme.plugins.fcircle.js %>">
12
+ </script>
@@ -0,0 +1,14 @@
1
+ <%- partial( "../../chat/gitter/script") %>
2
+
3
+ <script>
4
+ // 这里是 page plugin
5
+ volantis.removeGitter=()=>{
6
+ document.querySelectorAll(".gitter-chat-embed").forEach(e=>{
7
+ e.remove()
8
+ })
9
+ document.querySelectorAll(".gitter-open-chat-button").forEach(e=>{
10
+ e.remove()
11
+ })
12
+ }
13
+ volantis.pjax.send(volantis.removeGitter)
14
+ </script>
@@ -0,0 +1,16 @@
1
+ <style>
2
+ #post-body p {
3
+ text-indent: 2em;
4
+ }
5
+ #post-body .new-meta-box p,
6
+ #post-body .note p,
7
+ #post-body .prev-next p,
8
+ #post-body .tag p,
9
+ #post-body blockquote p,
10
+ #post-body details p,
11
+ #post-body p.p,
12
+ #post-body .tab-pane .checkbox
13
+ #post-body section p {
14
+ text-indent: initial;
15
+ }
16
+ </style>
@@ -0,0 +1,27 @@
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
+ _%>
@@ -0,0 +1,13 @@
1
+ <script>
2
+ // https://www.micdz.cn/article/katex-on-volantis/
3
+ if (typeof renderMathInElement == "undefined") {
4
+ volantis.css("<%= theme.plugins.katex.css %>")
5
+ function pjax_katex() {
6
+ volantis.js("<%= theme.plugins.katex.render %>").then(()=>{
7
+ renderMathInElement(document.body);
8
+ })
9
+ }
10
+ volantis.js("<%= theme.plugins.katex.js %>").then(pjax_katex)
11
+ volantis.pjax.push(pjax_katex)
12
+ }
13
+ </script>
@@ -38,7 +38,7 @@
38
38
  };
39
39
  (function () {
40
40
  var script = document.createElement('script');
41
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.0/es5/tex-mml-chtml.js';
41
+ script.src = "<%= theme.plugins.mathjax %>";
42
42
  script.defer = true;
43
43
  document.head.appendChild(script);
44
44
  })();
@@ -46,6 +46,6 @@
46
46
  // 文章章节标题不能为 “MathJax” ,否则会报错。
47
47
  MathJax.startup.document.state(0);
48
48
  MathJax.texReset();
49
- MathJax.typeset();
49
+ MathJax.typesetPromise();
50
50
  }
51
51
  </script>
@@ -0,0 +1,55 @@
1
+ <% if (site.data.notification && (pagePlugin.snackbar in site.data.notification)) { %>
2
+ <% let snackbar = site.data.notification[pagePlugin.snackbar] %>
3
+ <% if (snackbar.position == 'bottom') { %>
4
+ <div id="snackbar"></div>
5
+ <script>
6
+ function Snackbar(){
7
+ document.getElementById("snackbar").innerHTML=`<div class='snackbar-wrap' theme='<%- snackbar.theme %>'>
8
+ <div class="snackbar-content">
9
+ <div class='title'><%- markdown(snackbar.title) %></div>
10
+ <div class='message'><%- markdown(snackbar.message) %></div>
11
+ <% if (snackbar.buttons && snackbar.buttons.length > 0) { %>
12
+ <div class="action">
13
+ <% snackbar.buttons.forEach((ac, i) => { %>
14
+ <% if (ac.dismiss) { %>
15
+ <a onclick="document.getElementsByClassName('snackbar-wrap')[0].style.display = 'none'">
16
+ <%- ac.title %>
17
+ </a>
18
+ <% } else { %>
19
+ <a href='<%- ac.url %>'>
20
+ <%- ac.title %>
21
+ </a>
22
+ <% } %>
23
+ <% }) %>
24
+ </div>
25
+ <% } %>
26
+ </div>
27
+ </div>`
28
+ }
29
+ </script>
30
+ <% } else if (snackbar.position == 'right') { %>
31
+ <% if (snackbar.buttons && snackbar.buttons.length > 0) { %>
32
+ <script>
33
+ function Snackbar(){
34
+ <% snackbar.buttons.forEach((ac, i) => { %>
35
+ VolantisApp.message(
36
+ '<%- snackbar.title %>',
37
+ '<%- snackbar.message %><br>' + "<a href='<%- ac.url %>'><%- ac.title %></a>"
38
+ );
39
+ <% }) %>
40
+ }
41
+ </script>
42
+ <% } %>
43
+ <% } %>
44
+
45
+ <script>
46
+ <% if (snackbar.cache) { %>
47
+ if (!localStorage.getItem('Snackbar')) {
48
+ localStorage.setItem('Snackbar', '1');
49
+ Snackbar();
50
+ }
51
+ <% } else { %>
52
+ Snackbar()
53
+ <% }%>
54
+ </script>
55
+ <% } %>