hexo-theme-volantis 4.3.1 → 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 (309) hide show
  1. package/README.md +6 -4
  2. package/_config.yml +599 -246
  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 -1
  7. package/layout/_meta/author.ejs +4 -4
  8. package/layout/_meta/category.ejs +11 -8
  9. package/layout/_meta/counter.ejs +29 -7
  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/walinecount.ejs +2 -1
  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 -16
  25. package/layout/_partial/categories.ejs +1 -1
  26. package/layout/_partial/cover.ejs +8 -28
  27. package/layout/_partial/footer.ejs +19 -11
  28. package/layout/_partial/head.ejs +70 -116
  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} +17 -25
  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 +422 -109
  37. package/layout/_partial/scripts/index.ejs +91 -46
  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/{_third-party → _plugins}/analytics/script.ejs +43 -5
  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/{_third-party → _plugins}/end-of-support/script.ejs +25 -8
  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/{_third-party → _plugins}/nodewaves/script.ejs +1 -1
  80. package/layout/_plugins/parallax/script.ejs +74 -0
  81. package/layout/{_third-party → _plugins}/pjax/animate.ejs +31 -31
  82. package/layout/_plugins/pjax/index.ejs +73 -0
  83. package/layout/_plugins/pjax/pdata.ejs +56 -0
  84. package/layout/{_third-party → _plugins}/preload/script.ejs +3 -3
  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 +30 -12
  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 +5 -3
  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 +34 -9
  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 +0 -0
  127. package/scripts/filters/replace.js +15 -0
  128. package/scripts/{z-lazyload/lib/process.js → filters/z-lazyload.js} +6 -3
  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} +1 -1
  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 +6 -1
  146. package/scripts/tags/btns.js +7 -2
  147. package/scripts/tags/checkbox.js +12 -2
  148. package/scripts/tags/contributors.js +100 -0
  149. package/scripts/tags/dropmenu.js +18 -3
  150. package/scripts/tags/fancybox.js +44 -10
  151. package/scripts/tags/folding.js +6 -1
  152. package/scripts/tags/frame.js +6 -1
  153. package/scripts/tags/friends.js +99 -0
  154. package/scripts/tags/ghcard.js +6 -1
  155. package/scripts/tags/image.js +14 -2
  156. package/scripts/tags/link.js +6 -1
  157. package/scripts/tags/md.js +59 -0
  158. package/scripts/tags/media.js +25 -1
  159. package/scripts/tags/note.js +36 -3
  160. package/scripts/tags/site.js +87 -51
  161. package/scripts/tags/span.js +12 -2
  162. package/scripts/tags/swiper.js +38 -0
  163. package/scripts/tags/tabs.js +33 -3
  164. package/scripts/tags/timeline.js +6 -1
  165. package/source/css/Readme.md +28 -0
  166. package/source/css/_defines/AutoPrefixCSS.styl +347 -0
  167. package/source/css/_defines/Readme.md +3 -0
  168. package/source/css/_defines/color.styl +41 -1
  169. package/source/css/_defines/effect.styl +0 -13
  170. package/source/css/_defines/fonts.styl +17 -18
  171. package/source/css/_defines/func.styl +12 -30
  172. package/source/css/_first/base_first.styl +118 -0
  173. package/source/css/_first/{cover.styl → cover_first.styl} +113 -87
  174. package/source/css/_first/dark_first.styl +76 -0
  175. package/source/css/_first/fontfamily_first.styl +17 -0
  176. package/source/css/_first/{navbar.styl → navbar_first.styl} +4 -10
  177. package/source/css/_first/search_first.styl +12 -0
  178. package/source/css/{_base/index.styl → _style/_base/base.styl} +9 -93
  179. package/source/css/_style/_base/fontfamily_async.styl +8 -0
  180. package/source/css/{_layout → _style/_layout}/archive.styl +0 -0
  181. package/source/css/{_layout → _style/_layout}/article.styl +3 -30
  182. package/source/css/{_layout → _style/_layout}/footer.styl +0 -0
  183. package/source/css/_style/_layout/friends-simpleuser.styl +23 -0
  184. package/source/css/_style/_layout/friends-traditional.styl +81 -0
  185. package/source/css/{_layout → _style/_layout}/img.styl +0 -0
  186. package/source/css/_style/_layout/loading.styl +14 -0
  187. package/source/css/{_layout → _style/_layout}/main.styl +19 -7
  188. package/source/css/{_layout → _style/_layout}/md.styl +0 -0
  189. package/source/css/{_layout → _style/_layout}/pagination.styl +1 -1
  190. package/source/css/{_layout → _style/_layout}/posts.styl +2 -0
  191. package/source/css/{_first → _style/_layout}/search.styl +0 -103
  192. package/source/css/{_layout → _style/_layout}/sidebar.styl +23 -3
  193. package/source/css/{_layout → _style/_layout}/snackbar.styl +0 -0
  194. package/source/css/{_layout → _style/_layout}/toc.styl +3 -3
  195. package/source/css/{_layout → _style/_layout}/video.styl +0 -0
  196. package/source/css/_style/_plugins/_dark/dark_async.styl +41 -0
  197. package/source/css/_style/_plugins/_dark/dark_plugins.styl +136 -0
  198. package/source/css/_style/_plugins/_highlight/highlightjs/clipboard.styl +36 -0
  199. package/source/css/_style/_plugins/_highlight/highlightjs/color.styl +96 -0
  200. package/source/css/_style/_plugins/_highlight/highlightjs/index.styl +102 -0
  201. package/source/css/_style/_plugins/_highlight/highlightjs/language.styl +63 -0
  202. package/source/css/_style/_plugins/_highlight/index.styl +1 -0
  203. package/source/css/_style/_plugins/_highlight/prismjs/clipboard.styl +33 -0
  204. package/source/css/_style/_plugins/_highlight/prismjs/index.styl +8 -0
  205. package/source/css/_style/_plugins/_highlight/prismjs/language.styl +63 -0
  206. package/source/css/_style/_plugins/_rightmenu/reading.styl +56 -0
  207. package/source/css/{_plugins → _style/_plugins/_rightmenu}/rightmenu.styl +22 -2
  208. package/source/css/{_plugins → _style/_plugins}/aplayer.styl +8 -1
  209. package/source/css/{_plugins → _style/_plugins}/cursor.styl +49 -19
  210. package/source/css/_style/_plugins/fontcolor.styl +84 -0
  211. package/source/css/{_plugins → _style/_plugins}/gitalk.styl +0 -0
  212. package/source/css/_style/_plugins/index.styl +24 -0
  213. package/source/css/{_plugins → _style/_plugins}/mathjax.styl +0 -0
  214. package/source/css/_style/_plugins/message.styl +14 -0
  215. package/source/css/{_plugins → _style/_plugins}/pjaxanimate.styl +0 -0
  216. package/source/css/_style/_tag-plugins/Readme.md +6 -0
  217. package/source/css/{_tag-plugins → _style/_tag-plugins}/btns.styl +0 -0
  218. package/source/css/{_tag-plugins → _style/_tag-plugins}/checkbox.styl +0 -0
  219. package/source/css/{_tag-plugins → _style/_tag-plugins}/dropmenu.styl +0 -0
  220. package/source/css/{_plugins → _style/_tag-plugins}/fancybox.styl +8 -9
  221. package/source/css/{_tag-plugins → _style/_tag-plugins}/folding.styl +0 -0
  222. package/source/css/{_tag-plugins → _style/_tag-plugins}/frame.styl +0 -0
  223. package/source/css/_style/_tag-plugins/friends.styl +72 -0
  224. package/source/css/{_tag-plugins → _style/_tag-plugins}/ghcard.styl +0 -0
  225. package/source/css/{_tag-plugins → _style/_tag-plugins}/image.styl +0 -0
  226. package/source/css/{_tag-plugins → _style/_tag-plugins}/link.styl +0 -0
  227. package/source/css/{_tag-plugins → _style/_tag-plugins}/media.styl +0 -0
  228. package/source/css/{_tag-plugins → _style/_tag-plugins}/note.styl +0 -0
  229. package/source/css/_style/_tag-plugins/sites.styl +87 -0
  230. package/source/css/{_tag-plugins → _style/_tag-plugins}/span.styl +0 -0
  231. package/source/css/_style/_tag-plugins/swiper.styl +44 -0
  232. package/source/css/{_tag-plugins → _style/_tag-plugins}/table.styl +0 -0
  233. package/source/css/{_tag-plugins → _style/_tag-plugins}/tabs.styl +0 -0
  234. package/source/css/_style/_tag-plugins/tag.json +35 -0
  235. package/source/css/_style/_tag-plugins/text.styl +31 -0
  236. package/source/css/{_tag-plugins → _style/_tag-plugins}/timeline.styl +0 -0
  237. package/source/css/_style/index.styl +8 -0
  238. package/source/css/first.styl +17 -6
  239. package/source/css/style.styl +9 -7
  240. package/source/js/app.js +1051 -278
  241. package/source/js/plugins/aplayer.js +186 -0
  242. package/source/js/plugins/parallax.js +191 -0
  243. package/source/js/plugins/rightMenu.js +577 -0
  244. package/source/js/plugins/rightMenus.js +616 -0
  245. package/source/js/plugins/tags/contributors.js +92 -0
  246. package/source/js/plugins/tags/friends.js +93 -0
  247. package/source/js/plugins/tags/sites.js +96 -0
  248. package/source/js/search/hexo.js +180 -373
  249. package/.eslintrc.json +0 -111
  250. package/layout/_meta/valinecount.ejs +0 -15
  251. package/layout/_partial/rightmenu.ejs +0 -199
  252. package/layout/_partial/scripts/cover.ejs +0 -45
  253. package/layout/_partial/scripts/darkmode.ejs +0 -85
  254. package/layout/_partial/scripts/import.ejs +0 -3
  255. package/layout/_partial/scripts/issues.ejs +0 -18
  256. package/layout/_partial/scripts/search.ejs +0 -62
  257. package/layout/_partial/snackbar.ejs +0 -22
  258. package/layout/_third-party/aplayer/script.ejs +0 -26
  259. package/layout/_third-party/clipboard/script.ejs +0 -54
  260. package/layout/_third-party/comments/disqus/layout.ejs +0 -5
  261. package/layout/_third-party/comments/disqus/script.ejs +0 -90
  262. package/layout/_third-party/comments/disqusjs/layout.ejs +0 -1
  263. package/layout/_third-party/comments/disqusjs/script.ejs +0 -34
  264. package/layout/_third-party/comments/gitalk/layout.ejs +0 -1
  265. package/layout/_third-party/comments/gitalk/script.ejs +0 -22
  266. package/layout/_third-party/comments/hashover/layout.ejs +0 -2
  267. package/layout/_third-party/comments/hashover/script.ejs +0 -1
  268. package/layout/_third-party/comments/isso/layout.ejs +0 -1
  269. package/layout/_third-party/comments/isso/script.ejs +0 -1
  270. package/layout/_third-party/comments/livere/layout.ejs +0 -3
  271. package/layout/_third-party/comments/livere/script.ejs +0 -10
  272. package/layout/_third-party/comments/minivaline/layout.ejs +0 -3
  273. package/layout/_third-party/comments/minivaline/script.ejs +0 -34
  274. package/layout/_third-party/comments/twikoo/layout.ejs +0 -3
  275. package/layout/_third-party/comments/twikoo/script.ejs +0 -32
  276. package/layout/_third-party/comments/valine/layout.ejs +0 -3
  277. package/layout/_third-party/comments/valine/script.ejs +0 -49
  278. package/layout/_third-party/comments/vssue/layout.ejs +0 -1
  279. package/layout/_third-party/comments/vssue/script.ejs +0 -21
  280. package/layout/_third-party/comments/waline/layout.ejs +0 -3
  281. package/layout/_third-party/comments/waline/script.ejs +0 -33
  282. package/layout/_third-party/fancybox/script.ejs +0 -61
  283. package/layout/_third-party/highlightjs/script.ejs +0 -11
  284. package/layout/_third-party/pjax/index.ejs +0 -78
  285. package/layout/_third-party/pjax/pdata.ejs +0 -53
  286. package/layout/_third-party/scrollreveal/script.ejs +0 -21
  287. package/layout/_third-party/tidio/script.ejs +0 -3
  288. package/layout/artitalk.ejs +0 -13
  289. package/layout/bb.ejs +0 -10
  290. package/package-lock.json +0 -916
  291. package/scripts/tags/issues.js +0 -41
  292. package/scripts/z-lazyload/index.js +0 -4
  293. package/source/css/_highlight/index.styl +0 -316
  294. package/source/css/_layout/friends.styl +0 -79
  295. package/source/css/_plugins/clipboard.styl +0 -37
  296. package/source/css/_plugins/dark.styl +0 -149
  297. package/source/css/_plugins/darkmode.styl +0 -9
  298. package/source/css/_plugins/index.styl +0 -18
  299. package/source/css/_plugins/twikoo.styl +0 -21
  300. package/source/css/_plugins/valine.styl +0 -183
  301. package/source/css/_tag-plugins/simpleuser.styl +0 -21
  302. package/source/css/_tag-plugins/site-card.styl +0 -70
  303. package/source/js/aplayer.js +0 -167
  304. package/source/js/issues.js +0 -186
  305. package/source/js/search/algolia.js +0 -344
  306. package/source/js/search/azure.js +0 -355
  307. package/source/js/search/baidu.js +0 -340
  308. package/source/js/search/google.js +0 -339
  309. package/source/js/valine.js +0 -5137
@@ -0,0 +1,62 @@
1
+ <script>
2
+ volantis.layoutHelper("comments",`<div id="waline"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`)
3
+
4
+ function pjax_waline() {
5
+ if(!document.querySelector("#waline"))return;
6
+ let locale = {};
7
+ let path = pdata.commentPath;
8
+ let pagePlaceholder = pdata.commentPlaceholder || "<%= theme.comments.waline.placeholder %>";
9
+ if (path.length == 0) {
10
+ let defaultPath = '<%= theme.comments.waline.path %>';
11
+ path = defaultPath || decodeURI(window.location.pathname);
12
+ }
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
+ }
44
+ fancybox_waline()
45
+ }
46
+
47
+ function fancybox_waline() {
48
+ if(typeof VolantisFancyBox === "undefined") {
49
+ const checkFancyBox = setInterval(() => {
50
+ if(typeof VolantisFancyBox === "undefined") return;
51
+ clearInterval(checkFancyBox);
52
+ VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
53
+ })
54
+ } else {
55
+ VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
56
+ }
57
+ }
58
+
59
+ volantis.css('<%= theme.comments.waline.css %>')
60
+ volantis.js('<%- theme.comments.waline.js %>').then(pjax_waline)
61
+ volantis.pjax.push(pjax_waline);
62
+ </script>
@@ -0,0 +1 @@
1
+ <!-- 这里是使用 Custom Files 自定义文件 注入评论系统的占位 -->
@@ -0,0 +1,114 @@
1
+ <script>
2
+ const rootElement = document.documentElement;
3
+ const darkModeStorageKey = "color-scheme";
4
+ const rootElementDarkModeAttributeName = "color-scheme";
5
+ const setLS = (k, v) => {
6
+ localStorage.setItem(k, v);
7
+ };
8
+ const removeLS = (k) => {
9
+ localStorage.removeItem(k);
10
+ };
11
+ const getLS = (k) => {
12
+ return localStorage.getItem(k);
13
+ };
14
+ const getModeFromCSSMediaQuery = () => {
15
+ return window.matchMedia("(prefers-color-scheme: dark)").matches
16
+ ? "dark"
17
+ : "light";
18
+ };
19
+ const resetRootDarkModeAttributeAndLS = () => {
20
+ rootElement.removeAttribute(rootElementDarkModeAttributeName);
21
+ removeLS(darkModeStorageKey);
22
+ };
23
+ const validColorModeKeys = {
24
+ dark: true,
25
+ light: true,
26
+ };
27
+ const applyCustomDarkModeSettings = (mode) => {
28
+ const currentSetting = mode || getLS(darkModeStorageKey);
29
+ getCustomDarkMode();
30
+ if (currentSetting === getModeFromCSSMediaQuery()) {
31
+ resetRootDarkModeAttributeAndLS();
32
+ } else if (validColorModeKeys[currentSetting]) {
33
+ rootElement.setAttribute(rootElementDarkModeAttributeName, currentSetting);
34
+ } else {
35
+ resetRootDarkModeAttributeAndLS();
36
+ }
37
+ };
38
+ const invertDarkModeObj = {
39
+ dark: "light",
40
+ light: "dark",
41
+ };
42
+ /**
43
+ * get target mode
44
+ */
45
+ const getCustomDarkMode = () => {
46
+ let currentSetting = getLS(darkModeStorageKey);
47
+ if (validColorModeKeys[currentSetting]) {
48
+ currentSetting = invertDarkModeObj[currentSetting];
49
+ } else if (currentSetting === null) {
50
+ currentSetting = invertDarkModeObj[getModeFromCSSMediaQuery()];
51
+ } else {
52
+ return;
53
+ }
54
+ if(currentSetting=="dark"){
55
+ volantis.dark.mode="light";
56
+ }else{
57
+ volantis.dark.mode="dark";
58
+ }
59
+ // console.log(volantis.dark.mode)
60
+ };
61
+ const toggleCustomDarkMode = () => {
62
+ let currentSetting = getLS(darkModeStorageKey);
63
+ if (validColorModeKeys[currentSetting]) {
64
+ currentSetting = invertDarkModeObj[currentSetting];
65
+ } else if (currentSetting === null) {
66
+ currentSetting = invertDarkModeObj[getModeFromCSSMediaQuery()];
67
+ } else {
68
+ return;
69
+ }
70
+ setLS(darkModeStorageKey, currentSetting);
71
+ return currentSetting;
72
+ };
73
+ /**
74
+ * 暗黑模式触发器
75
+ */
76
+ volantis.dark.toggle=()=>{
77
+ const mode = toggleCustomDarkMode();
78
+ applyCustomDarkModeSettings(mode);
79
+ // 使用 volantis.dark.push 方法传入volantis.dark.toggle回调函数 参见layout/_partial/scripts/global.ejs
80
+ volantis.dark.method.toggle.start();
81
+ }
82
+ /**
83
+ * bind event for toggle button
84
+ */
85
+
86
+ function bindToggleButton() {
87
+ var btn= document.querySelectorAll("#wrapper .toggle-mode-btn,#rightmenu-wrapper .toggle-mode-btn")
88
+ btn.forEach(function (e) {
89
+ volantis.dom.$(e).on('click',volantis.dark.toggle);
90
+ })
91
+ }
92
+ applyCustomDarkModeSettings();
93
+ document.addEventListener("DOMContentLoaded", ()=>{
94
+ volantis.requestAnimationFrame(bindToggleButton)
95
+ });
96
+ volantis.pjax.push(bindToggleButton);
97
+
98
+ const darkModelListeners={
99
+ dark:(mediaQueryList )=>{
100
+ if(mediaQueryList.matches){
101
+ volantis.dark.mode = "dark";
102
+ }
103
+ volantis.dark.method.toggle.start();
104
+ },
105
+ light:(mediaQueryList)=>{
106
+ if(mediaQueryList.matches){
107
+ volantis.dark.mode = "light";
108
+ }
109
+ volantis.dark.method.toggle.start();
110
+ }
111
+ }
112
+ window.matchMedia('(prefers-color-scheme: dark)').addListener(darkModelListeners.dark)
113
+ window.matchMedia('(prefers-color-scheme: light)').addListener(darkModelListeners.light)
114
+ </script>
@@ -13,12 +13,20 @@ if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMo
13
13
  'margin-top: 15%;'+
14
14
  'margin-bottom: 5500%;'+
15
15
  '}'+
16
+ '.kill-t{'+
17
+ 'font-size: 2rem;'+
18
+ '}'+
19
+ '.kill-c{'+
20
+ 'font-size: 1.2rem;'+
21
+ '}'+
22
+ '#l_header,#l_body{'+
23
+ 'display: none;'+
24
+ '}'+
16
25
  '</style>'+
17
26
  '<div class="kill-ie">'+
18
- '<h1><b>抱歉,您的浏览器无法访问本站</b></h1>'+
19
- '<h3>微软已经于2016年终止了对 Internet Explorer (IE) 10 及更早版本的支持,<br/>'+
20
- '继续使用存在极大的安全隐患,请使用当代主流的浏览器进行访问。</h3><br/>'+
21
- '<a href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong>了解详情 ></strong></a>'+
27
+ `<span class="kill-t"><b><%- __('kill.title')%></b></span><br/>`+
28
+ `<span class="kill-c"><%- __('kill.ie')%></span><br/>`+
29
+ `<a href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong><%- __('kill.more')%></strong></a>`+
22
30
  '</div>');
23
31
  </script>
24
32
  <% } %>
@@ -35,11 +43,20 @@ if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMo
35
43
  margin-top: 15%;
36
44
  margin-bottom: 5500%;
37
45
  }
46
+ .kill-t{
47
+ font-size: 2rem;
48
+ }
49
+ .kill-c{
50
+ font-size: 1.2rem;
51
+ }
52
+ #l_header,#l_body{
53
+ display: none;
54
+ }
38
55
  </style>
39
56
  <div class="kill-noscript">
40
- <h1><b>抱歉,您的浏览器无法访问本站</b></h1>
41
- <h3>本页面需要浏览器支持(启用)JavaScript</h3><br/>
42
- <a href="https://www.baidu.com/s?wd=启用JavaScript"><strong>了解详情 ></strong></a>
57
+ <span class="kill-t"><b><%- __('kill.title')%></b></span><br/>
58
+ <span class="kill-c"><%- __('kill.noscript')%></span><br/>
59
+ <a href="https://www.baidu.com/s?wd=启用JavaScript"><strong><%- __('kill.more')%></strong></a>
43
60
  </div>
44
61
  </noscript>
45
- <% } %>
62
+ <% } %>
@@ -0,0 +1,27 @@
1
+ <script>
2
+ function loadIssuesJS() {
3
+ <% if (theme.plugins.sitesjs.enable) { %>
4
+ const sites_api = document.getElementById('sites-api');
5
+ if (sites_api != undefined && typeof SitesJS === 'undefined') {
6
+ volantis.js("<%- theme.cdn.map.js.sites %>")
7
+ }
8
+ <% } %>
9
+ <% if (theme.plugins.friendsjs.enable) { %>
10
+ const friends_api = document.getElementById('friends-api');
11
+ if (friends_api != undefined && typeof FriendsJS === 'undefined') {
12
+ volantis.js("<%- theme.cdn.map.js.friends %>")
13
+ }
14
+ <% } %>
15
+ <% if (theme.plugins.contributorsjs.enable) { %>
16
+ const contributors_api = document.getElementById('contributors-api');
17
+ if (contributors_api != undefined && typeof ContributorsJS === 'undefined') {
18
+ volantis.js("<%- theme.cdn.map.js.contributors %>")
19
+ }
20
+ <% } %>
21
+ };
22
+ loadIssuesJS()
23
+ volantis.pjax.push(()=>{
24
+ loadIssuesJS();
25
+ })
26
+
27
+ </script>
@@ -0,0 +1,26 @@
1
+ <script>
2
+ <% if (theme.plugins.highlightjs.css) { %>
3
+ volantis.css("<%- theme.plugins.highlightjs.css %>");
4
+ <% } %>
5
+ <% if (theme.plugins.highlightjs.js) { %>
6
+ volantis.js("<%- theme.plugins.highlightjs.js %>").then(()=>{
7
+ volantis.requestAnimationFrame(hljs.highlightAll)
8
+ })
9
+ volantis.pjax.push(()=>{
10
+ document.querySelectorAll('pre code').forEach((block) => {
11
+ hljs.highlightElement(block);
12
+ });
13
+ },"highlightjs")
14
+ <% } %>
15
+ <% if(theme.plugins.highlightjs.copy_code){ %>
16
+ function pjax_highlightjs_copyCode(){
17
+ if (!(document.querySelector(".highlight .code pre") ||
18
+ document.querySelector(".article pre code"))) {
19
+ return;
20
+ }
21
+ VolantisApp.utilCopyCode(".highlight .code pre, .article pre code")
22
+ }
23
+ volantis.requestAnimationFrame(pjax_highlightjs_copyCode)
24
+ volantis.pjax.push(pjax_highlightjs_copyCode)
25
+ <% } %>
26
+ </script>
@@ -0,0 +1,25 @@
1
+ <% (theme.plugins.prismjs.js||[]).forEach(function(item) { %>
2
+ <%- js(item) %>
3
+ <% }) %>
4
+ <% (theme.plugins.prismjs.css||[]).forEach(function(item) { %>
5
+ <%- css(item) %>
6
+ <% }) %>
7
+ <script>
8
+ <% if(theme.plugins.prismjs.copy_code){ %>
9
+ function pjax_prismjs_copyCode(){
10
+ if (!document.querySelector("pre")) {
11
+ return;
12
+ }
13
+ let pres = document.querySelectorAll("pre")
14
+ pres.forEach(pre=>{
15
+ var wrapper = document.createElement('div');
16
+ wrapper.classList.add('code-toolbar');
17
+ pre.parentNode.insertBefore(wrapper, pre);
18
+ wrapper.appendChild(pre);
19
+ })
20
+ VolantisApp.utilCopyCode(".code-toolbar pre")
21
+ }
22
+ volantis.requestAnimationFrame(pjax_prismjs_copyCode)
23
+ volantis.pjax.push(pjax_prismjs_copyCode)
24
+ <% } %>
25
+ </script>
@@ -0,0 +1 @@
1
+ <%- partial(theme.plugins.code_highlight + '/script') %>
@@ -1,4 +1,4 @@
1
- <script defer src="<%- theme.plugins.lazyload.js || 'https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1/dist/lazyload.min.js' %>"></script>
1
+ <script defer src="<%- theme.plugins.lazyload.js %>"></script>
2
2
  <script>
3
3
  // https://www.npmjs.com/package/vanilla-lazyload
4
4
  // Set the options globally
@@ -1,6 +1,6 @@
1
1
  <%- js({src: theme.plugins.nodewaves.js}) %>
2
2
  <script type="text/javascript">
3
- $(function () {
3
+ document.addEventListener("DOMContentLoaded", function () {
4
4
  Waves.attach('.flat-btn', ['waves-button']);
5
5
  Waves.attach('.float-btn', ['waves-button', 'waves-float']);
6
6
  Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
@@ -0,0 +1,74 @@
1
+ <%_
2
+ theme.plugins.parallax.images = theme.plugins.parallax.images || page.images;
3
+ if (theme.plugins.parallax.shuffle) {
4
+ // shuffle 只一次 防止 hash 变化
5
+ if (typeof theme.plugins.parallax.shuffle_end==='undefined') {
6
+ shuffle(theme.plugins.parallax.images);
7
+ theme.plugins.parallax.shuffle_end=1;
8
+ }
9
+ }
10
+ function shuffle(arr){
11
+ var n = arr.length;
12
+ while(n--) {
13
+ var index = Math.floor(Math.random() * n);
14
+ var temp = arr[index];
15
+ arr[index] = arr[n];
16
+ arr[n] = temp;
17
+ }
18
+ }
19
+ _%>
20
+ <script>
21
+ let imgs = <%- JSON.stringify(theme.plugins.parallax.images) %>;
22
+ let index = 0;
23
+ let IntervalParallax = null;
24
+
25
+ function parallax(){
26
+ let ParallaxWindow = document.querySelector("#parallax-window");
27
+ <% if (theme.plugins.parallax.position=="fixed") { %>
28
+ ParallaxWindow = document.querySelector("html");
29
+ <% } %>
30
+ Parallax.window = ParallaxWindow;
31
+ Parallax.options.fade = <%- theme.plugins.parallax.fade %>;
32
+ Parallax.cache = 1;
33
+ next_parallax();
34
+ Parallax.init();
35
+ if (imgs.length>1) {
36
+ IntervalParallax = setInterval(function () {
37
+ next_parallax();
38
+ }, '<%- theme.plugins.parallax.duration %>');
39
+ }
40
+ }
41
+
42
+ function next_parallax() {
43
+ if (typeof Parallax == "undefined") {
44
+ return
45
+ }
46
+ <% if (theme.plugins.parallax.position!="fixed") { %>
47
+ if (!document.querySelector("#full")&&!document.querySelector("#half")) {
48
+ return
49
+ }
50
+ <% } %>
51
+ if (imgs.length>=1) {
52
+ Parallax.options.src = imgs[index % imgs.length];
53
+ Parallax.start();
54
+ index++;
55
+ if (Parallax.cache) {
56
+ fetch(imgs[index % imgs.length] +"?t=" + new Date().getTime());
57
+ if (index == imgs.length) {
58
+ Parallax.cache = 0;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ var runningOnBrowser = typeof window !== "undefined";
64
+ var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro|msn)bot|crawl|spider|yand|duckgo/i.test(navigator.userAgent);
65
+ if (!isBot) {
66
+ volantis.js('<%- theme.cdn.map.js.parallax %>').then(()=>{
67
+ parallax()
68
+ })
69
+ volantis.pjax.send(()=>{
70
+ clearInterval(IntervalParallax)
71
+ },"clearIntervalParallax");
72
+ volantis.pjax.push(parallax);
73
+ }
74
+ </script>
@@ -1,31 +1,31 @@
1
- <!-- 样式位于:source/css/_third-party/pjaxanimate.styl -->
2
-
3
- <div class="pjax-animate">
4
- <% if (theme.plugins.pjax.animation == 'nprogress') { %>
5
- <script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script>
6
- <div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed: 100})</script></div>
7
- <script>
8
- window.ShowLoading = function() {
9
- NProgress.start();
10
- };
11
- window.HideLoading = function() {
12
- NProgress.done();
13
- }
14
- </script>
15
- <%} else if (theme.plugins.pjax.animation == 'circle') { %>
16
- <div class="loading-circle"><div id="loader-circle"></div></div>
17
- <script>
18
- window.ShowLoading = function() {
19
- $(".loading-circle").css("display", "block");
20
- };
21
- window.HideLoading = function() {
22
- $(".loading-circle").css("display", "none");
23
- }
24
- </script>
25
- <% } %>
26
- <script>
27
- volantis.pjax.push(window.HideLoading,'HideLoading');
28
- volantis.pjax.send(window.ShowLoading,'ShowLoading');
29
- volantis.pjax.error(window.HideLoading,'HideLoading');
30
- </script>
31
- </div>
1
+ <!-- 样式位于:source/css/_plugins/pjaxanimate.styl -->
2
+
3
+ <div class="pjax-animate">
4
+ <% if (theme.plugins.pjax.animation == 'nprogress') { %>
5
+ <script src="<%- theme.plugins.pjax.nprogress %>"></script>
6
+ <div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed: 100})</script></div>
7
+ <script>
8
+ window.ShowLoading = function() {
9
+ NProgress.start();
10
+ };
11
+ window.HideLoading = function() {
12
+ NProgress.done();
13
+ }
14
+ </script>
15
+ <%} else if (theme.plugins.pjax.animation == 'circle') { %>
16
+ <div class="loading-circle"><div id="loader-circle"></div></div>
17
+ <script>
18
+ window.ShowLoading = function() {
19
+ document.querySelector(".loading-circle").style.display="block"
20
+ };
21
+ window.HideLoading = function() {
22
+ document.querySelector(".loading-circle").style.display="none"
23
+ }
24
+ </script>
25
+ <% } %>
26
+ <script>
27
+ volantis.pjax.push(window.HideLoading,'HideLoading');
28
+ volantis.pjax.send(window.ShowLoading,'ShowLoading');
29
+ volantis.pjax.error(window.HideLoading,'HideLoading');
30
+ </script>
31
+ </div>
@@ -0,0 +1,73 @@
1
+ <!--
2
+ pjax重载区域接口:
3
+ 1. <pjax></pjax> 标签 pjax 标签必须存在于所有页面 否则 pjax error
4
+ 2. script[data-pjax]
5
+ 3. .pjax-reload script
6
+ 4. .pjax
7
+ -->
8
+ <%
9
+ var banUrl = theme.plugins.pjax.banUrl || [];
10
+ %>
11
+
12
+ <%- js(theme.plugins.pjax.js) %>
13
+ <% if (theme.plugins.pjax.animation){ %>
14
+ <%- partial('animate') %>
15
+ <% } %>
16
+ <script>
17
+ var pjax;
18
+ document.addEventListener('DOMContentLoaded', function () {
19
+ pjax = new Pjax({
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
+ selectors: [
22
+ "head title",
23
+ "head meta[name=keywords]",
24
+ "head meta[name=description]",
25
+ <% if (!theme.plugins.pjax.cover){ %>"#l_cover",<% } %>
26
+ "#l_main",
27
+ "#pjax-header-nav-list",
28
+ ".pjax",
29
+ "pjax", // <pjax></pjax> 标签
30
+ "script[data-pjax], .pjax-reload script" // script标签添加data-pjax 或 script标签外层添加.pjax-reload 的script代码段重载
31
+ ],
32
+ cacheBust: <%= theme.plugins.pjax.cacheBust %>, // url 地址追加时间戳,用以避免浏览器缓存
33
+ timeout: <%= theme.plugins.pjax.timeout %>,
34
+ <% if (theme.debug){ %> debug: true,<% } %>
35
+ });
36
+ });
37
+
38
+ document.addEventListener('pjax:send', function (e) {
39
+ //window.stop(); // 相当于点击了浏览器的停止按钮
40
+
41
+ try {
42
+ var currentUrl = window.location.pathname;
43
+ var targetUrl = e.triggerElement.href;
44
+ var banUrl = <%- '["' + banUrl.join('", "') + '"]' %>;
45
+ if (banUrl[0] != "") {
46
+ banUrl.forEach(item => {
47
+ if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
48
+ window.location.href = targetUrl;
49
+ }
50
+ });
51
+ }
52
+ } catch (error) {}
53
+
54
+ // 使用 volantis.pjax.send 方法传入pjax:send回调函数 参见layout/_partial/scripts/global.ejs
55
+ volantis.pjax.method.send.start();
56
+ });
57
+
58
+ document.addEventListener('pjax:complete', function () {
59
+ // 使用 volantis.pjax.push 方法传入重载函数 参见layout/_partial/scripts/global.ejs
60
+ volantis.pjax.method.complete.start();
61
+ });
62
+
63
+ document.addEventListener('pjax:error', function (e) {
64
+ if(volantis.debug) {
65
+ console.error(e);
66
+ console.log('pjax error: \n' + JSON.stringify(e));
67
+ }else{
68
+ // 使用 volantis.pjax.error 方法传入pjax:error回调函数 参见layout/_partial/scripts/global.ejs
69
+ volantis.pjax.method.error.start();
70
+ window.location.href = e.triggerElement.href;
71
+ }
72
+ });
73
+ </script>
@@ -0,0 +1,56 @@
1
+ <!--此文件用来存放一些不方便取值的变量-->
2
+ <!--思路大概是将值藏到重加载的区域内-->
3
+ <%
4
+ var commentPath = ''; // 自定义的评论路径
5
+ var commentPlaceholder = ''; // 自定义的评论描述
6
+ var commentConfig = {}; // 自定义的评论配置
7
+ var ispage = false; // 一二级导航栏切换控制
8
+ var postTitle = ''; // 当前文章标题,用于二级导航栏赋值
9
+ if (theme.comments.service && theme.comments.service.length > 0) {
10
+ let service = theme.comments.service;
11
+ if (page.comments == undefined || page.comments != false) {
12
+ if (service in page) {
13
+ if (page[service].path) {
14
+ commentPath = page[service].path;
15
+ }
16
+ if (page[service].placeholder) {
17
+ commentPlaceholder = page[service].placeholder;
18
+ }
19
+ if (page[service].config) {
20
+ commentConfig = page[service].config;
21
+ }
22
+ }
23
+ }
24
+ }
25
+ if (page && page.layout == 'post' && page.title) {
26
+ ispage = true;
27
+ postTitle = page.title;
28
+ }
29
+ %>
30
+ <pjax>
31
+ <script>
32
+ window.pdata={}
33
+ pdata.ispage=<%=ispage%>;
34
+ pdata.commentPath="<%=commentPath%>";
35
+ pdata.commentPlaceholder="<%=commentPlaceholder%>";
36
+ pdata.commentConfig=<%- JSON.stringify(commentConfig) %>;
37
+ // see: /layout/_partial/scripts/_ctrl/coverCtrl.ejs
38
+ <% if (theme.plugins.pjax.enable) {%>
39
+ // header
40
+ var l_header=document.getElementById("l_header");
41
+ <% if (theme.pjax_cover.frontMatterCover == "none") {%>
42
+ l_header.classList.add("show");
43
+ <% } else {%>
44
+ l_header.classList.remove("show");
45
+ <% }%>
46
+ <% if (theme.plugins.pjax.cover) {%>
47
+ // cover
48
+ var cover_wrapper=document.querySelector('#l_cover .cover-wrapper');
49
+ var scroll_down=document.getElementById('scroll-down');
50
+ cover_wrapper.id="<%=theme.pjax_cover.frontMatterCover%>";
51
+ cover_wrapper.style.display="<%=theme.pjax_cover.coverWrapperDisplay%>";
52
+ scroll_down.style.display="<%=theme.pjax_cover.scrollDownDisplay%>";
53
+ <% }%>
54
+ <% }%>
55
+ </script>
56
+ </pjax>
@@ -5,9 +5,9 @@
5
5
  <script>
6
6
  window.FPConfig = {
7
7
  delay: 0,
8
- ignoreKeywords: [],
9
- maxRPS: 5,
10
- hoverDelay: 25
8
+ ignoreKeywords: ["#"],
9
+ maxRPS: 6,
10
+ hoverDelay: 0
11
11
  };
12
12
  </script>
13
13
  <script defer src="<%- preload.flying_pages %>"></script>