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,49 +1,59 @@
1
1
  'use strict';
2
2
 
3
3
  function postCheckbox(args) {
4
- args = args.join(' ').split(',')
5
- var cls = ''
6
- var text = ''
7
- var checked = false
4
+ if(/::/g.test(args)){
5
+ args = args.join(' ').split('::');
6
+ }
7
+ else{
8
+ args = args.join(' ').split(',');
9
+ }
10
+ var cls = '';
11
+ var text = '';
12
+ var checked = false;
8
13
  if (args.length > 1) {
9
- cls = (args[0] || '').trim()
14
+ cls = (args[0] || '').trim();
10
15
  if (cls.length > 0) {
11
- cls = ' ' + cls
16
+ cls = ' ' + cls;
12
17
  }
13
18
  if (cls.indexOf('checked') > -1) {
14
- checked = true
19
+ checked = true;
15
20
  }
16
- text = (args[1] || '').trim()
21
+ text = (args[1] || '').trim();
17
22
  } else if (args.length > 0) {
18
- text = (args[0] || '').trim()
23
+ text = (args[0] || '').trim();
19
24
  }
20
25
  if (text.length > 0) {
21
- return `<div class='checkbox${cls}'><input type="checkbox" ${ checked ? 'checked="checked"' : '' }/>
26
+ return `<div class='checkbox${cls}'><input type="checkbox" ${checked ? 'checked="checked"' : ''}/>
22
27
  ${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}
23
- </div>`
28
+ </div>`;
24
29
  }
25
30
  }
26
31
  function postRadio(args) {
27
- args = args.join(' ').split(',')
28
- var cls = ''
29
- var text = ''
30
- var checked = false
32
+ if(/::/g.test(args)){
33
+ args = args.join(' ').split('::');
34
+ }
35
+ else{
36
+ args = args.join(' ').split(',');
37
+ }
38
+ var cls = '';
39
+ var text = '';
40
+ var checked = false;
31
41
  if (args.length > 1) {
32
- cls = (args[0] || '').trim()
42
+ cls = (args[0] || '').trim();
33
43
  if (cls.length > 0) {
34
- cls = ' ' + cls
44
+ cls = ' ' + cls;
35
45
  }
36
46
  if (cls.indexOf('checked') > -1) {
37
- checked = true
47
+ checked = true;
38
48
  }
39
- text = (args[1] || '').trim()
49
+ text = (args[1] || '').trim();
40
50
  } else if (args.length > 0) {
41
- text = (args[0] || '').trim()
51
+ text = (args[0] || '').trim();
42
52
  }
43
53
  if (text.length > 0) {
44
- return `<div class='checkbox${cls}'><input type="radio" ${ checked ? 'checked="checked"' : '' }/>
54
+ return `<div class='checkbox${cls}'><input type="radio" ${checked ? 'checked="checked"' : ''}/>
45
55
  ${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}
46
- </div>`
56
+ </div>`;
47
57
  }
48
58
  }
49
59
  // {% checkbox text %}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% friends [only:group1] [not:group2] %}
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ hexo.extend.tag.register('contributors', function(args) {
11
+ args = hexo.args.map(args, ['only', 'not', 'api', 'source', 'repo']);
12
+ if (args.only) {
13
+ if(/::/g.test(args.only)){
14
+ args.only = args.only.split('::');
15
+ }else{
16
+ args.only = args.only.split(',');
17
+ }
18
+ }
19
+ if (args.not) {
20
+ if(/::/g.test(args.not)){
21
+ args.not = args.not.split('::');
22
+ }else{
23
+ args.not = args.not.split(',');
24
+ }
25
+ }
26
+ var friends = hexo.locals.get('data').contributors;
27
+ if (friends == undefined) {
28
+ friends = {};
29
+ }
30
+ if (args.repo) {
31
+ friends = {
32
+ group: {
33
+ api: args.api || 'https://gh-api.xaoxuu.com',
34
+ source: args.source || 'volantis-x/github-api',
35
+ repo: args.repo
36
+ }
37
+ }
38
+ }
39
+ var el = '<div class="tag-plugin users-wrap">';
40
+ function groupHeader(group) {
41
+ var header = '<div class="group-header">';
42
+ if (group.title) {
43
+ header += hexo.render.renderSync({text: group.title, engine: 'markdown'}).split('\n').join('');
44
+ }
45
+ if (group.description) {
46
+ header += hexo.render.renderSync({text: group.description, engine: 'markdown'}).split('\n').join('');
47
+ }
48
+ header += '</div>';
49
+ return header;
50
+ }
51
+ function cell(friend) {
52
+ if (friend.url && friend.title) {
53
+ var cell = '<div class="user-card">';
54
+ cell += '<a class="card-link" target="_blank" rel="external noopener noreferrer" href="' + friend.url + '">';
55
+ cell += '<img src="' + (friend.avatar || hexo.theme.config.default.avatar) + '" onerror="errorImgAvatar(this)"/>';
56
+ cell += '<div class="name"><span>' + friend.title + '</span></div>';
57
+ cell += '</a></div>'
58
+ return cell;
59
+ } else {
60
+ return '';
61
+ }
62
+ }
63
+ for (let groupId of Object.keys(friends)) {
64
+ function f() {
65
+ if (args.not && args.not.includes(groupId)) {
66
+ return;
67
+ }
68
+ if (groupId in friends) {
69
+ let group = friends[groupId];
70
+ if (group.title || group.description) {
71
+ el += groupHeader(group);
72
+ }
73
+ if (group.repo) {
74
+ el += '<div class="contributorsjs-wrap"';
75
+ el += ' id="contributors-api"';
76
+ el += ' api="' + group.api + '/v1/contributors?source=' + group.source + '&target=' + group.repo + '"';
77
+ el += '>';
78
+ 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>';
79
+ el += '<div class="group-body"></div>';
80
+ el += '</div>';
81
+ } else if (group.items) {
82
+ el += '<div class="group-body">';
83
+ group.items.forEach((friend, i) => {
84
+ el += cell(friend);
85
+ });
86
+ el += '</div>';
87
+ }
88
+ }
89
+ }
90
+ if (args.only) {
91
+ if (args.only.includes(groupId)) {
92
+ f();
93
+ }
94
+ } else {
95
+ f();
96
+ }
97
+ }
98
+ el += '</div>';
99
+ return el;
100
+ });
@@ -1,9 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  function postMenu(args, content) {
4
- args = args.join(' ').split(',')
4
+ if(/::/g.test(args)){
5
+ args = args.join(' ').split('::');
6
+ }
7
+ else{
8
+ args = args.join(' ').split(',');
9
+ }
5
10
  if (args.length == 1) {
6
- let title = args[0].trim()
11
+ const title = args[0].trim();
7
12
  return `<div class='dropmenu-wrapper'>
8
13
  <div class='dropmenu'>
9
14
  <a>${title}</a>
@@ -11,10 +16,10 @@ function postMenu(args, content) {
11
16
  ${content}
12
17
  </ul>
13
18
  </div>
14
- </div>`
19
+ </div>`;
15
20
  } else if (args.length == 2) {
16
- let prefix = args[0].trim()
17
- let title = args[1].trim()
21
+ const prefix = args[0].trim();
22
+ const title = args[1].trim();
18
23
  return `<div class='dropmenu-wrapper'>
19
24
  <span>${prefix}</span>
20
25
  <div class='dropmenu'>
@@ -23,11 +28,11 @@ function postMenu(args, content) {
23
28
  ${content}
24
29
  </ul>
25
30
  </div>
26
- </div>`
31
+ </div>`;
27
32
  } else if (args.length == 3) {
28
- let prefix = args[0].trim()
29
- let title = args[1].trim()
30
- let suffix = args[2].trim()
33
+ const prefix = args[0].trim();
34
+ const title = args[1].trim();
35
+ const suffix = args[2].trim();
31
36
  return `<div class='dropmenu-wrapper'>
32
37
  <span>${prefix}</span>
33
38
  <div class='dropmenu'>
@@ -37,13 +42,18 @@ function postMenu(args, content) {
37
42
  </ul>
38
43
  </div>
39
44
  <span>${suffix}</span>
40
- </div>`
45
+ </div>`;
41
46
  }
42
47
  }
43
48
  function postSubmenu(args, content) {
44
- args = args.join(' ').split(',')
45
- let text = args[0] || ''
46
- let icon = args[1] || ''
49
+ if(/::/g.test(args)){
50
+ args = args.join(' ').split('::');
51
+ }
52
+ else{
53
+ args = args.join(' ').split(',');
54
+ }
55
+ const text = args[0] || '';
56
+ const icon = args[1] || '';
47
57
  if (icon.length > 0) {
48
58
  return `<li>
49
59
  <a class='menuitem'>
@@ -53,29 +63,34 @@ function postSubmenu(args, content) {
53
63
  <ul class='list-v'>
54
64
  ${content}
55
65
  </ul>
56
- </li>`
57
- } else {
58
- return `<li>
66
+ </li>`;
67
+ }
68
+ return `<li>
59
69
  <a class='menuitem'>${text}</a>
60
70
  <ul class='list-v'>
61
71
  ${content}
62
72
  </ul>
63
- </li>`
64
- }
73
+ </li>`;
74
+
65
75
  }
66
76
 
67
77
  function postMenuItem(args) {
68
- args = args.join(' ').split(',')
69
- let text = args[0] || ''
70
- let url = args[1] || ''
71
- text = text.trim()
72
- url = url.trim()
78
+ if(/::/g.test(args)){
79
+ args = args.join(' ').split('::');
80
+ }
81
+ else{
82
+ args = args.join(' ').split(',');
83
+ }
84
+ let text = args[0] || '';
85
+ let url = args[1] || '';
86
+ text = text.trim();
87
+ url = url.trim();
73
88
  if (url.length > 0) {
74
- url = "href='" + url + "'"
89
+ url = 'href=\'' + url + '\'';
75
90
  }
76
- let icon = ''
91
+ let icon = '';
77
92
  if (args.length > 2) {
78
- icon = args[2].trim()
93
+ icon = args[2].trim();
79
94
  }
80
95
  if (url.length > 0) {
81
96
  if (icon.length > 0) {
@@ -84,19 +99,19 @@ function postMenuItem(args) {
84
99
  <i class='${icon} fa-fw'></i>
85
100
  ${text}
86
101
  </a>
87
- </li>`
88
- } else {
89
- return `<li>
102
+ </li>`;
103
+ }
104
+ return `<li>
90
105
  <a class='menuitem' ${url} title='${text}'>
91
106
  ${text}
92
107
  </a>
93
- </li>`
94
- }
95
- } else {
96
- if (text == 'hr') {
97
- return `<hr>`
98
- }
108
+ </li>`;
109
+
99
110
  }
111
+ if (text == 'hr') {
112
+ return '<hr>';
113
+ }
114
+
100
115
 
101
116
  }
102
117
 
@@ -1,18 +1,52 @@
1
1
  'use strict';
2
2
 
3
+ function renderImg(content) {
4
+ return `${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}`;
5
+ }
6
+
7
+ function buidAlt(alt) {
8
+ if (!!alt && alt !== 'image') {
9
+ return `<span class='image-caption'>${alt}</span>`
10
+ } else {
11
+ return '<span></span>';
12
+ }
13
+ }
14
+
15
+ function buidImgFancybox(content, group) {
16
+ let html = renderImg(content).trim();
17
+ if(html.startsWith('<p>') && html.endsWith('</p>')) { // 去除无用的 p 标签包裹
18
+ html=html.substring(0, html.length-4).substring(3);
19
+ }
20
+
21
+ let imageTags = html.includes('image-caption') ? 'image' : undefined;
22
+ let imgList = html.match(/<img.*?>/g) || [];
23
+ imgList.forEach(item => {
24
+ const url = (item.match(/\ssrc=['"](.*?)['"]/) || [])[1];
25
+ const alt = (item.match(/\salt=['"](.*?)['"]/) || [])[1];
26
+ const newItem = item.replace('img', 'img fancybox itemprop="contentUrl"'); // 避免出现重复替换,打个标
27
+ const result = `<div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='${url}' data-fancybox='${group}' data-caption='${alt}'>${newItem}</a>${buidAlt(imageTags || alt)}</div>`;
28
+ html = html.replace(item, result.trim());
29
+ })
30
+ return html;
31
+ }
32
+
3
33
  function postFancybox(args, content) {
4
- args = args.join(' ').split(',');
5
- var cls = args[0];
6
- var col = Number(args[1]) || 0;
34
+ if(/::/g.test(args)){
35
+ args = args.join(' ').split('::');
36
+ }
37
+ else{
38
+ args = args.join(' ').split(',');
39
+ }
40
+ const cls = args[0];
41
+ const col = Number(args[1]) || 0;
42
+ const group = (args[2] || 'default').trim();
43
+
7
44
  if (col > 0) {
8
- return `<div class="gallery ${cls}" col='${col}'>
9
- ${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
10
- </div>`;
11
- } else {
12
- return `<div class="gallery ${cls}">
13
- ${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
14
- </div>`;
45
+ return `<div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery ${cls}" col='${col}' data-group='${group}'>${buidImgFancybox(content, group)}</div>`;
15
46
  }
47
+ return `<div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery ${cls}" data-group='${group}'>${buidImgFancybox(content, group)}</div>`;
16
48
  }
17
49
 
50
+
51
+
18
52
  hexo.extend.tag.register('gallery', postFancybox, {ends: true});
@@ -1,14 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  function postFolding(args, content) {
4
- args = args.join(' ').split(',');
5
- let style = ''
6
- let title = ''
4
+ if(/::/g.test(args)){
5
+ args = args.join(' ').split('::');
6
+ }
7
+ else{
8
+ args = args.join(' ').split(',');
9
+ }
10
+ let style = '';
11
+ let title = '';
7
12
  if (args.length > 1) {
8
- style = args[0].trim()
9
- title = args[1].trim()
13
+ style = args[0].trim();
14
+ title = args[1].trim();
10
15
  } else if (args.length > 0) {
11
- title = args[0].trim()
16
+ title = args[0].trim();
12
17
  }
13
18
  if (style != undefined) {
14
19
  return `<details ${style}><summary> ${title} </summary>
@@ -16,13 +21,13 @@ function postFolding(args, content) {
16
21
  ${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
17
22
  </div>
18
23
  </details>`;
19
- } else {
20
- return `<details><summary> ${title} </summary>
24
+ }
25
+ return `<details><summary> ${title} </summary>
21
26
  <div class='content'>
22
27
  ${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
23
28
  </div>
24
29
  </details>`;
25
- }
30
+
26
31
 
27
32
  }
28
33
 
@@ -13,9 +13,14 @@
13
13
  // {% frame device | video=xxx | part=bottom %}
14
14
  // device: iphone11,
15
15
  hexo.extend.tag.register('frame', function(args) {
16
- args = args.join(' ').split(' | ');
16
+ if(/::/g.test(args)){
17
+ args = args.join(' ').split('::');
18
+ }
19
+ else{
20
+ args = args.join(' ').split(' | ');
21
+ }
17
22
  // 所有支持的参数
18
- let device = args[0].trim();
23
+ const device = args[0].trim();
19
24
  let img = '';
20
25
  let video = '';
21
26
  let part = '';
@@ -23,7 +28,7 @@ hexo.extend.tag.register('frame', function(args) {
23
28
  // 解析
24
29
  if (args.length > 0) {
25
30
  for (let i = 0; i < args.length; i++) {
26
- let tmp = args[i].trim();
31
+ const tmp = args[i].trim();
27
32
  if (tmp.includes('img=')) {
28
33
  img = tmp.substring(4, tmp.length);
29
34
  } else if (tmp.includes('video=')) {
@@ -0,0 +1,99 @@
1
+ /**
2
+ * friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% friends [only:group1] [not:group2] %}
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ hexo.extend.tag.register('friends', function(args) {
11
+ args = hexo.args.map(args, ['only', 'not', 'repo', 'api']);
12
+ if (args.only) {
13
+ if(/::/g.test(args.only)){
14
+ args.only = args.only.split('::');
15
+ }else{
16
+ args.only = args.only.split(',');
17
+ }
18
+ }
19
+ if (args.not) {
20
+ if(/::/g.test(args.not)){
21
+ args.not = args.not.split('::');
22
+ }else{
23
+ args.not = args.not.split(',');
24
+ }
25
+ }
26
+ var friends = hexo.locals.get('data').friends;
27
+ if (friends == undefined) {
28
+ friends = {};
29
+ }
30
+ if (args.repo) {
31
+ friends = {
32
+ group: {
33
+ api: args.api,
34
+ repo: args.repo
35
+ }
36
+ }
37
+ }
38
+ var el = '<div class="tag-plugin users-wrap">';
39
+ function groupHeader(group) {
40
+ var header = '<div class="group-header">';
41
+ if (group.title) {
42
+ header += hexo.render.renderSync({text: group.title, engine: 'markdown'}).split('\n').join('');
43
+ }
44
+ if (group.description) {
45
+ header += hexo.render.renderSync({text: group.description, engine: 'markdown'}).split('\n').join('');
46
+ }
47
+ header += '</div>';
48
+ return header;
49
+ }
50
+ function cell(friend) {
51
+ if (friend.url && friend.title) {
52
+ var cell = '<div class="user-card">';
53
+ cell += '<a class="card-link" target="_blank" rel="external noopener noreferrer" href="' + friend.url + '">';
54
+ cell += '<img src="' + (friend.avatar || hexo.theme.config.default.avatar) + '" onerror="errorImgAvatar(this)"/>';
55
+ cell += '<div class="name"><span>' + friend.title + '</span></div>';
56
+ cell += '</a></div>'
57
+ return cell;
58
+ } else {
59
+ return '';
60
+ }
61
+ }
62
+ for (let groupId of Object.keys(friends)) {
63
+ function f() {
64
+ if (args.not && args.not.includes(groupId)) {
65
+ return;
66
+ }
67
+ if (groupId in friends) {
68
+ let group = friends[groupId];
69
+ if (group.title || group.description) {
70
+ el += groupHeader(group);
71
+ }
72
+ if (group.repo) {
73
+ el += '<div class="friendsjs-wrap"';
74
+ el += ' id="friends-api"';
75
+ el += ' api="' + (group.api || 'https://issues-api.vercel.app') + '/v1/' + group.repo + '"';
76
+ el += '>';
77
+ 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>';
78
+ el += '<div class="group-body"></div>';
79
+ el += '</div>';
80
+ } else if (group.items) {
81
+ el += '<div class="group-body">';
82
+ group.items.forEach((friend, i) => {
83
+ el += cell(friend);
84
+ });
85
+ el += '</div>';
86
+ }
87
+ }
88
+ }
89
+ if (args.only) {
90
+ if (args.only.includes(groupId)) {
91
+ f();
92
+ }
93
+ } else {
94
+ f();
95
+ }
96
+ }
97
+ el += '</div>';
98
+ return el;
99
+ });
@@ -7,23 +7,28 @@
7
7
  // {% ghcard volantis-x %}
8
8
  // {% ghcard volantis-x/hexo-theme-volantis %}
9
9
  hexo.extend.tag.register('ghcard', function(args) {
10
- args = args.join(' ').split(', ');
11
- let path = args[0].trim();
10
+ if(/::/g.test(args)){
11
+ args = args.join(' ').split('::');
12
+ }
13
+ else{
14
+ args = args.join(' ').split(',');
15
+ }
16
+ const path = args[0].trim();
12
17
  let card = '';
13
18
  card += '<a class="ghcard" rel="external nofollow noopener noreferrer" href="https://github.com/' + path + '">';
14
19
  let url = '';
15
20
  if (path.includes('/')) {
16
21
  // is repo
17
- let ps = path.split('/');
18
- url += 'https://github-readme-stats.vercel.app/api/pin/?username=' + ps[0] + "&repo=" + ps[1];
22
+ const ps = path.split('/');
23
+ url += 'https://github-readme-stats.vercel.app/api/pin/?username=' + ps[0] + '&repo=' + ps[1];
19
24
  } else {
20
25
  // is user
21
26
  url += 'https://github-readme-stats.vercel.app/api/?username=' + path;
22
27
  }
23
28
  if (args.length > 1) {
24
29
  for (let i = 1; i < args.length; i++) {
25
- let tmp = args[i].trim();
26
- url += "&" + tmp;
30
+ const tmp = args[i].trim();
31
+ url += '&' + tmp;
27
32
  }
28
33
  }
29
34
  if (!url.includes('&show_owner=')) {
@@ -12,14 +12,19 @@
12
12
  // {% image url, alt=haha, width=400px %}
13
13
  // {% image url, alt=haha, width=400px, bg=#eee %}
14
14
  hexo.extend.tag.register('image', function(args) {
15
- args = args.join(' ').split(', ');
16
- let url = args[0].trim();
15
+ if(/::/g.test(args)){
16
+ args = args.join(' ').split('::');
17
+ }
18
+ else{
19
+ args = args.join(' ').split(',');
20
+ }
21
+ const url = args[0].trim();
17
22
  let alt = '';
18
23
  let bg = '';
19
24
  let style = '';
20
25
  if (args.length > 1) {
21
26
  for (let i = 1; i < args.length; i++) {
22
- let tmp = args[i].trim();
27
+ const tmp = args[i].trim();
23
28
  if (tmp.includes('alt=')) {
24
29
  alt = tmp.substring(4, tmp.length);
25
30
  } else if (tmp.includes('width=')) {
@@ -36,6 +41,8 @@ hexo.extend.tag.register('image', function(args) {
36
41
  img += '<img class="img" src="' + url + '"';
37
42
  if (alt.length > 0) {
38
43
  img += ' alt="' + alt + '"';
44
+ } else {
45
+ img += ' alt="image"';
39
46
  }
40
47
  if (style.length > 0) {
41
48
  img += ' style="' + style + '"';
@@ -68,14 +75,19 @@ hexo.extend.tag.register('image', function(args) {
68
75
  // {% inlineimage url %}
69
76
  // {% inlineimage url, height=22px %}
70
77
  hexo.extend.tag.register('inlineimage', function(args) {
71
- args = args.join(' ').split(', ');
72
- let url = args[0].trim();
78
+ if(/::/g.test(args)){
79
+ args = args.join(' ').split('::');
80
+ }
81
+ else{
82
+ args = args.join(' ').split(',');
83
+ }
84
+ const url = args[0].trim();
73
85
  let ret = '';
74
86
  ret += '<img no-lazy class="inline" src="' + url + '"';
75
87
  let style = '';
76
88
  if (args.length > 1) {
77
89
  for (let i = 1; i < args.length; i++) {
78
- let tmp = args[i].trim();
90
+ const tmp = args[i].trim();
79
91
  if (tmp.includes('height=')) {
80
92
  style += 'height:' + tmp.substring(7, tmp.length) + ';';
81
93
  }