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
@@ -3,19 +3,24 @@
3
3
  // {% link title, url %}
4
4
  // {% link title, url, img %}
5
5
  hexo.extend.tag.register('link', function(args) {
6
- args = args.join(' ').split(',')
7
- let text = ''
8
- let url = ''
9
- let img = ''
6
+ if(/::/g.test(args)){
7
+ args = args.join(' ').split('::');
8
+ }
9
+ else{
10
+ args = args.join(' ').split(',');
11
+ }
12
+ let text = '';
13
+ let url = '';
14
+ let img = '';
10
15
  if (args.length < 2) {
11
- return
16
+ return;
12
17
  } else if (args.length == 2) {
13
- text = args[0].trim()
14
- url = args[1].trim()
18
+ text = args[0].trim();
19
+ url = args[1].trim();
15
20
  } else if (args.length == 3) {
16
- text = args[0].trim()
17
- url = args[1].trim()
18
- img = args[2].trim()
21
+ text = args[0].trim();
22
+ url = args[1].trim();
23
+ img = args[2].trim();
19
24
  }
20
25
  let result = '';
21
26
  // 发现如果不套一层 div 在其它可渲染 md 的容器中容易被分解
@@ -0,0 +1,59 @@
1
+
2
+ hexo.extend.tag.register('md', function(args) {
3
+ const {config} = hexo;
4
+ const md_path = args[0].trim();
5
+ let md_id = "md-" + hexo.createUuid()
6
+ let mat = `
7
+ <div id="${md_id}" class="tag-md markdown-body"></div>
8
+ <script>
9
+ (()=>{
10
+ volantis.css("${hexo.theme.config.plugins.markdown}");
11
+ const contentEl = document.getElementById("${md_id}");
12
+ const loadMarkdown = (url) => {
13
+ if (!window.fetch) {
14
+ contentEl.innerHTML =
15
+ '<div style="font-size: 24px"><p>Your browser outdated. Please use the latest version of Chrome or Firefox!</p><p>您的浏览器版本过低,请使用最新版的 Chrome 或 Firefox 浏览器!</p></div>';
16
+ } else {
17
+ contentEl.innerHTML =
18
+ '<div style="font-size: 24px">Loading ... | 加载中。。。</div>';
19
+ fetch(url, { method: "GET" })
20
+ .then((resp) => {
21
+ return Promise.all([
22
+ resp.ok,
23
+ resp.status,
24
+ resp.text(),
25
+ resp.headers,
26
+ ]);
27
+ })
28
+ .then(([ok, status, data, headers]) => {
29
+ if (ok) {
30
+ return {
31
+ ok,
32
+ status,
33
+ data,
34
+ headers,
35
+ };
36
+ } else {
37
+ throw new Error(JSON.stringify(json.error));
38
+ }
39
+ })
40
+ .then((resp) => {
41
+ let data = marked.parse(resp.data);
42
+ contentEl.innerHTML = data;
43
+ })
44
+ .catch((error) => {
45
+ console.log(error);
46
+ contentEl.innerHTML =
47
+ '<div style="font-size: 24px"><p>There was a problem loading the file!</p><p>加载文件时出现问题!</p></div>';
48
+ });
49
+ };
50
+ };
51
+ volantis.js("${hexo.theme.config.plugins.marked}").then(()=>{
52
+ loadMarkdown("${md_path}?t=" + new Date().getTime());
53
+ })
54
+ })();
55
+ </script>
56
+ `
57
+
58
+ return mat
59
+ });
@@ -1,27 +1,51 @@
1
1
  'use strict';
2
2
 
3
3
  function postAudio(args) {
4
- let src = args[0].trim()
4
+ const src = args[0].trim();
5
5
  return `<div class="audio"><audio controls preload><source src='${src}' type='audio/mp3'>Your browser does not support the audio tag.</audio></div>`;
6
6
  }
7
7
 
8
8
  function postVideo(args) {
9
- let src = args[0].trim()
9
+ const {config} = hexo;
10
+ const src = args[0].trim();
11
+ // m3u8 https://github.com/volantis-x/hexo-theme-volantis/issues/606
12
+ // 文件扩展名为 .m3u8
13
+ if (hexo.getType(src) === "m3u8") {
14
+ let video_id = `video-${hexo.createUuid()}`
15
+ return `<div clsss="video"><video id="${video_id}" controls loop="false" width="100%"></video></div>
16
+ <script>
17
+ volantis.js("${hexo.theme.config.plugins.hlsjs}").then(()=>{
18
+ var video = document.getElementById('${video_id}');
19
+ if(Hls.isSupported()) {
20
+ var hls = new Hls();
21
+ hls.loadSource('${src}');
22
+ hls.attachMedia(video);
23
+ }else if (video.canPlayType('application/vnd.apple.mpegurl')) {
24
+ video.src = '${src}';
25
+ }
26
+ })
27
+ </script>`;
28
+ }
10
29
  return `<div class="video"><video controls preload><source src='${src}' type='video/mp4'>Your browser does not support the video tag.</video></div>`;
11
30
  }
12
31
 
13
32
  function postVideos(args, content) {
14
- args = args.join(' ').split(',')
15
- var cls = args[0]
33
+ if(/::/g.test(args)){
34
+ args = args.join(' ').split('::');
35
+ }
36
+ else{
37
+ args = args.join(' ').split(',');
38
+ }
39
+ var cls = args[0];
16
40
  if (cls.length > 0) {
17
- cls = ' ' + cls
41
+ cls = ' ' + cls;
18
42
  }
19
43
  var col = Number(args[1]) || 0;
20
44
  if (col > 0) {
21
- return `<div class="videos${cls}" col='${col}'>${content}</div>`
22
- } else {
23
- return `<div class="videos${cls}">${content}</div>`
45
+ return `<div class="videos${cls}" col='${col}'>${content}</div>`;
24
46
  }
47
+ return `<div class="videos${cls}">${content}</div>`;
48
+
25
49
  }
26
50
 
27
51
  hexo.extend.tag.register('audio', postAudio);
@@ -6,13 +6,18 @@
6
6
 
7
7
  // {% note style, content %}
8
8
  function postNote(args) {
9
- args = args.join(' ').split(', ')
9
+ if(/::/g.test(args)){
10
+ args = args.join(' ').split('::');
11
+ }
12
+ else{
13
+ args = args.join(' ').split(',');
14
+ }
10
15
  if (args.length > 1) {
11
- let cls = args[0].trim()
12
- let text = args[1].trim()
16
+ const cls = args[0].trim();
17
+ const text = args[1].trim();
13
18
  return `<div class="note ${cls}">${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}</div>`;
14
19
  } else if (args.length > 0) {
15
- let text = args[0].trim()
20
+ const text = args[0].trim();
16
21
  return `<div class="note">${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}</div>`;
17
22
  }
18
23
  }
@@ -21,15 +26,20 @@ function postNote(args) {
21
26
  // content
22
27
  // {% endnoteblock %}
23
28
  function postNoteBlock(args, content) {
24
- args = args.join(' ').split(', ');
29
+ if(/::/g.test(args)){
30
+ args = args.join(' ').split('::');
31
+ }
32
+ else{
33
+ args = args.join(' ').split(',');
34
+ }
25
35
  if (args.length < 1) {
26
36
  return;
27
37
  }
28
- let cls = args[0].trim();
38
+ const cls = args[0].trim();
29
39
  let ret = '';
30
40
  ret += '<div class="note ' + cls + '">';
31
41
  if (args.length > 1) {
32
- let title = args[1].trim();
42
+ const title = args[1].trim();
33
43
  ret += '<p><strong>' + title + '</strong></p>';
34
44
  }
35
45
  ret += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
@@ -38,4 +48,27 @@ function postNoteBlock(args, content) {
38
48
  }
39
49
 
40
50
  hexo.extend.tag.register('note', postNote);
41
- hexo.extend.tag.register('noteblock', postNoteBlock, {ends: true});
51
+
52
+ // https://github.com/volantis-x/hexo-theme-volantis/issues/712
53
+ // {% blocknote style, title %}
54
+ // content
55
+ // {% endblocknote %}
56
+ hexo.extend.tag.register('blocknote', postNoteBlock, {ends: true});
57
+ // 兼容 noteblock
58
+ hexo.extend.filter.register('before_post_render', function(data) {
59
+ data.content = data.content.replace(/{%\s+noteblock(.*)%}/g, (p,q)=>{
60
+ return `{% blocknote ${q} %}`
61
+ });
62
+ data.content = data.content.replace(/{%\s+endnoteblock\s+%}/g, '{% endblocknote %}');
63
+ return data;
64
+ });
65
+ // 兼容 noteblock 失败
66
+ hexo.extend.tag.register('noteblock', postNoteBlockDeprecated, {ends: true});
67
+ function postNoteBlockDeprecated(args, content) {
68
+ throw new Error(`
69
+ ==================================================================================
70
+ {% noteblock %} is deprecated. Use {% blocknote %} instead.
71
+ see: https://github.com/volantis-x/hexo-theme-volantis/issues/712
72
+ ==================================================================================
73
+ `);
74
+ }
@@ -1,59 +1,95 @@
1
+ /**
2
+ * sites.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% sites [only:group1] [not:group2] %}
6
+ */
7
+
1
8
  'use strict';
2
9
 
3
- function postSiteCardGroup(args, content) {
4
- if (args.length > 0) {
5
- return `<div class="site-card-group"><p class='p h2'>${args}</p>${content}</div>`;
6
- } else {
7
- return `<div class="site-card-group">${content}</div>`;
10
+ hexo.extend.tag.register('sites', function(args) {
11
+ args = hexo.args.map(args, ['only', 'not', 'repo', 'api']);
12
+ if (args.only) {
13
+ args.only = args.only.split(',');
14
+ }
15
+ if (args.not) {
16
+ args.not = args.not.split(',');
17
+ }
18
+ var sites = hexo.locals.get('data').sites;
19
+ if (sites == undefined) {
20
+ sites = {};
8
21
  }
9
- }
10
- function postSiteCard(args) {
11
- args = args.join(' ').split(', ')
12
- // 所有支持的参数
13
- let title = args[0].trim();
14
- let url = '';
15
- let screenshot = '';
16
- let avatar = '';
17
- let description = '';
18
- // 解析
19
- if (args.length > 1) {
20
- for (let i = 1; i < args.length; i++) {
21
- let tmp = args[i].trim();
22
- if (tmp.includes('url=')) {
23
- url = tmp.substring(4, tmp.length);
24
- } else if (tmp.includes('screenshot=')) {
25
- screenshot = tmp.substring(11, tmp.length);
26
- } else if (tmp.includes('avatar=')) {
27
- avatar = tmp.substring(7, tmp.length);
28
- } else if (tmp.includes('description=')) {
29
- description = tmp.substring(12, tmp.length);
22
+ if (args.repo) {
23
+ sites = {
24
+ group: {
25
+ api: args.api,
26
+ repo: args.repo
30
27
  }
31
28
  }
32
29
  }
33
- // 布局
34
- let result = '';
35
- result += '<a class="site-card" href="' + url + '">';
36
- result += '<div class="img"><img src="' + screenshot + '"/></div>';
37
- result += '<div class="info">';
38
- if (avatar.length > 0) {
39
- result += '<img src="' + avatar + '"/>';
40
- } else {
41
-
30
+ var el = '<div class="tag-plugin sites-wrap">';
31
+ function groupHeader(group) {
32
+ var header = '<div class="group-header">';
33
+ if (group.title) {
34
+ header += hexo.render.renderSync({text: group.title, engine: 'markdown'}).split('\n').join('');
35
+ }
36
+ if (group.description) {
37
+ header += hexo.render.renderSync({text: group.description, engine: 'markdown'}).split('\n').join('');
38
+ }
39
+ header += '</div>';
40
+ return header;
42
41
  }
43
-
44
- result += '<span class="title">' + title + '</span>';
45
- if (description.length > 0) {
46
- result += '<span class="desc">' + description + '</span>';
47
- } else {
48
-
42
+ function cell(site) {
43
+ if (site.url && site.title) {
44
+ var cell = '<div class="site-card">';
45
+ cell += '<a class="card-link" target="_blank" rel="external noopener noreferrer" href="' + site.url + '">';
46
+ cell += '<img src="' + (site.screenshot || ('https://image.thum.io/get/width/1024/crop/768/' + site.url)) + '" onerror="errorImgCover(this)"/>';
47
+ cell += '<div class="info">';
48
+ cell += '<img src="' + (site.avatar || hexo.theme.config.default.link) + '" onerror="errorImgAvatar(this)"/>';
49
+ cell += '<span class="title">' + site.title + '</span>';
50
+ cell += '<span class="desc">' + (site.description || site.url) + '</span>';
51
+ cell += '</div>';
52
+ cell += '</a></div>'
53
+ return cell;
54
+ } else {
55
+ return '';
56
+ }
49
57
  }
50
-
51
- result += '</div></a>';
52
- return result;
53
-
54
- }
55
-
56
- // {% site link, img, title %}
57
- // {% site link, img, title, description %}
58
- hexo.extend.tag.register('site', postSiteCard);
59
- hexo.extend.tag.register('sitegroup', postSiteCardGroup, {ends: true});
58
+ for (let groupId of Object.keys(sites)) {
59
+ function f() {
60
+ if (args.not && args.not.includes(groupId)) {
61
+ return;
62
+ }
63
+ if (groupId in sites) {
64
+ let group = sites[groupId];
65
+ if (group.title || group.description) {
66
+ el += groupHeader(group);
67
+ }
68
+ if (group.repo) {
69
+ el += '<div class="sitesjs-wrap"';
70
+ el += ' id="sites-api"';
71
+ el += ' api="' + (group.api || 'https://issues-api.vercel.app') + '/v1/' + group.repo + '"';
72
+ el += '>';
73
+ el += '<div class="loading-wrap"><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg><p></p></div>';
74
+ el += '<div class="group-body"></div>';
75
+ el += '</div>';
76
+ } else if (group.items) {
77
+ el += '<div class="group-body">';
78
+ group.items.forEach((site, i) => {
79
+ el += cell(site);
80
+ });
81
+ el += '</div>';
82
+ }
83
+ }
84
+ }
85
+ if (args.only) {
86
+ if (args.only.includes(groupId)) {
87
+ f();
88
+ }
89
+ } else {
90
+ f();
91
+ }
92
+ }
93
+ el += '</div>';
94
+ return el;
95
+ });
@@ -1,15 +1,25 @@
1
1
  'use strict';
2
2
 
3
3
  function postP(args) {
4
- args = args.join(' ').split(',')
5
- let p0 = args[0].trim()
6
- let p1 = args[1].trim()
4
+ if(/::/g.test(args)){
5
+ args = args.join(' ').split('::');
6
+ }
7
+ else{
8
+ args = args.join(' ').split(',');
9
+ }
10
+ const p0 = args[0].trim();
11
+ const p1 = args[1].trim();
7
12
  return `<p class='p ${p0}'>${p1}</p>`;
8
13
  }
9
14
  function postSpan(args) {
10
- args = args.join(' ').split(',')
11
- let p0 = args[0].trim()
12
- let p1 = args[1].trim()
15
+ if(/::/g.test(args)){
16
+ args = args.join(' ').split('::');
17
+ }
18
+ else{
19
+ args = args.join(' ').split(',');
20
+ }
21
+ const p0 = args[0].trim();
22
+ const p1 = args[1].trim();
13
23
  return `<span class='p ${p0}'>${p1}</span>`;
14
24
  }
15
25
 
@@ -0,0 +1,38 @@
1
+ /**
2
+ * swiper.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% swiper %}
6
+ * ![img](src)
7
+ * {% endswiper %}
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ hexo.extend.tag.register('swiper', function (args, content) {
13
+ args = hexo.args.map(args, ['width']);
14
+ var el = '';
15
+ function slide() {
16
+ let imgs = hexo.render.renderSync({ text: content, engine: 'markdown' });
17
+ imgs = imgs.match(/<img(.*?)src="(.*?)"(.*?)>/gi);
18
+ if (imgs && imgs.length > 0) {
19
+ imgs.forEach((img, i) => {
20
+ img = img.replace('<img src', '<img no-lazy src');
21
+ el += '<div class="swiper-slide">' + img + '</div>';
22
+ });
23
+ }
24
+ }
25
+ el += '<div class="tag-plugin swiper-container"';
26
+ if (args.width && args.width.length > 0) {
27
+ el += ' ' + hexo.args.joinTags(args, 'width').join(' ');
28
+ }
29
+ el += '>';
30
+ el += '<div class="swiper-wrapper">';
31
+ slide();
32
+ el += '</div>';
33
+ el += '<div class="swiper-pagination"></div>';
34
+ el += '<div class="swiper-button-prev blur"></div>';
35
+ el += '<div class="swiper-button-next blur"></div>';
36
+ el += '</div>';
37
+ return el;
38
+ }, { ends: true });
@@ -14,6 +14,6 @@ function postTable(args, content) {
14
14
  ret += hexo.render.renderSync({text: content, engine: 'markdown'});
15
15
  ret += '</div>';
16
16
  return ret;
17
- };
17
+ }
18
18
 
19
19
  hexo.extend.tag.register('table', postTable, {ends: true});
@@ -7,7 +7,12 @@
7
7
  function postTabs(args, content) {
8
8
  var tabBlock = /<!--\s*tab (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtab\s*-->/g;
9
9
 
10
- args = args.join(' ').split(',');
10
+ if(/::/g.test(args)){
11
+ args = args.join(' ').split('::');
12
+ }
13
+ else{
14
+ args = args.join(' ').split(',');
15
+ }
11
16
  var tabName = args[0];
12
17
  var tabActive = Number(args[1]) || 0;
13
18
 
@@ -31,8 +36,33 @@ function postTabs(args, content) {
31
36
  var tabIcon = tabParameters[1] || '';
32
37
  var tabHref = '';
33
38
 
39
+
40
+ // 兼容aplayer插件 https://github.com/volantis-x/hexo-theme-volantis/issues/575
41
+ var aplayerTag=0
42
+ var aplayerTagReg=/\<div.*class=\"aplayer aplayer-tag-marker\"(.|\n)*\<\/script\>/g
43
+ if(/class="aplayer aplayer-tag-marker"/g.test(postContent)){
44
+ aplayerTag=aplayerTagReg.exec(postContent)[0]
45
+ postContent=postContent.replace(aplayerTagReg,"@aplayerTag@")
46
+ }
47
+
48
+ // 兼容 gallery 标签
49
+ var fancyboxTag=0
50
+ var fancyboxTagReg = /\<div.*galleryFlag(.|\n)*\<\/span\>\<\/div\>\<\/div\>/g
51
+ if(/galleryFlag/g.test(postContent)) {
52
+ fancyboxTag=fancyboxTagReg.exec(postContent)[0]
53
+ postContent=postContent.replace(fancyboxTagReg,"@fancyboxTag@")
54
+ }
55
+
34
56
  postContent = hexo.render.renderSync({text: postContent, engine: 'markdown'}).trim();
35
57
 
58
+ if(aplayerTag){
59
+ postContent=postContent.replace(/\<pre\>\<code\>.*@aplayerTag@.*\<\/code><\/pre>/,aplayerTag)
60
+ }
61
+
62
+ if(fancyboxTag){
63
+ postContent=postContent.replace(/.*@fancyboxTag@.*/,fancyboxTag)
64
+ }
65
+
36
66
  tabId += 1;
37
67
  tabHref = (tabName + ' ' + tabId).toLowerCase().split(' ').join('-');
38
68
 
@@ -50,8 +80,8 @@ function postTabs(args, content) {
50
80
 
51
81
  tabNav = `<ul class="nav-tabs">${tabNav}</ul>`;
52
82
  tabContent = `<div class="tab-content">${tabContent}</div>`;
53
-
54
- return `<div class="tabs" id="${tabName.toLowerCase().split(' ').join('-')}">${tabNav + tabContent}</div>`;
83
+ // https://github.com/volantis-x/hexo-theme-volantis/issues/703
84
+ return `<div class="tabs" id="tab-${tabName.toLowerCase().split(' ').join('-')}">${tabNav + tabContent}</div>`;
55
85
  }
56
86
 
57
87
  hexo.extend.tag.register('tabs', postTabs, {ends: true});
@@ -7,14 +7,19 @@
7
7
  function postTimeline(args, content) {
8
8
  if (args.length > 0) {
9
9
  return `<div class="timeline"><p class='p h2'>${args}</p>${content}</div>`;
10
- } else {
11
- return `<div class="timeline">${content}</div>`;
12
10
  }
11
+ return `<div class="timeline">${content}</div>`;
12
+
13
13
  }
14
14
 
15
15
  function postTimenode(args, content) {
16
- args = args.join(' ').split(',')
17
- var time = args[0]
16
+ if(/::/g.test(args)){
17
+ args = args.join(' ').split('::');
18
+ }
19
+ else{
20
+ args = args.join(' ').split(',');
21
+ }
22
+ var time = args[0];
18
23
  return `<div class="timenode"><div class="meta"><p>${hexo.render.renderSync({text: time, engine: 'markdown'})}</p></div><div class="body">${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}</div></div>`;
19
24
  }
20
25
 
@@ -0,0 +1,28 @@
1
+ # 样式文件说明
2
+
3
+ ## 样式拆分说明
4
+
5
+ 方案是对 https://blog.skk.moe/post/improve-fcp-for-my-blog/ 的开源实现
6
+
7
+ ### first.styl
8
+
9
+ 首屏样式, 内含 首屏基础样式、 cover、 navbar、 首屏search、首屏暗黑模式、首屏字体 等样式, 首屏样式采用硬编码的方式写在HTML中.
10
+
11
+ 内联硬编码自动化方案 see:scripts/helpers/first-style/index.js
12
+
13
+ ### style.styl
14
+
15
+ 异步加载样式, 除首屏样式外的其他样式, 最终生成 /css/style.css 异步加载.
16
+
17
+ ## 暗黑模式样式说明
18
+
19
+ 暗黑模式样式被拆分为首屏暗黑模式样式和异步暗黑模式样式,其中在 source/css/ 文件夹下:
20
+
21
+ _first/dark_first.styl : 包含 首屏暗黑模式样式 的 暗黑模式 CSS 变量 和 强制覆盖样式
22
+
23
+ _style/_plugins/_dark : 异步暗黑模式样式文件夹
24
+
25
+ _style/_plugins/_dark/dark_async.styl : 包含 异步暗黑模式样式 的 暗黑模式 CSS 变量
26
+
27
+ _style/_plugins/_dark/dark_plugins.styl : 包含 异步暗黑模式样式 的 强制覆盖样式
28
+