hexo-theme-solitude 1.3.1 → 1.4.0

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 (261) hide show
  1. package/.github/FUNDING.yml +13 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.yml +107 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +13 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.yml +14 -0
  5. package/.github/workflows/npm-publish.yml +21 -0
  6. package/CONTRIBUTING.md +0 -0
  7. package/LICENSE +0 -0
  8. package/README.md +60 -43
  9. package/README_EN.md +60 -42
  10. package/_config.yml +606 -451
  11. package/languages/en-US.yml +3 -23
  12. package/languages/zh-CN.yml +3 -23
  13. package/layout/404.pug +0 -0
  14. package/layout/archive.pug +0 -0
  15. package/layout/category.pug +0 -0
  16. package/layout/includes/body/mode.pug +1 -6
  17. package/layout/includes/console.pug +3 -3
  18. package/layout/includes/footer.pug +16 -15
  19. package/layout/includes/head/config.pug +38 -30
  20. package/layout/includes/head/opengraph.pug +0 -0
  21. package/layout/includes/head/pwa.pug +5 -44
  22. package/layout/includes/head.pug +3 -1
  23. package/layout/includes/header.pug +0 -0
  24. package/layout/includes/inject/body.pug +114 -65
  25. package/layout/includes/inject/head.pug +11 -46
  26. package/layout/includes/layout.pug +1 -2
  27. package/layout/includes/loading.pug +0 -0
  28. package/layout/includes/mixins/articleSort.pug +0 -0
  29. package/layout/includes/mixins/pagination.pug +0 -0
  30. package/layout/includes/nav.pug +1 -1
  31. package/layout/includes/page/about.pug +1 -1
  32. package/layout/includes/page/categories.pug +0 -0
  33. package/layout/includes/page/default.pug +0 -0
  34. package/layout/includes/page/equipment.pug +0 -0
  35. package/layout/includes/page/links.pug +2 -2
  36. package/layout/includes/page/music.pug +0 -0
  37. package/layout/includes/page/not_configured.pug +0 -0
  38. package/layout/includes/page/rss.pug +3 -3
  39. package/layout/includes/page/says.pug +15 -15
  40. package/layout/includes/page/tags.pug +0 -0
  41. package/layout/includes/page/tlink.pug +1 -0
  42. package/layout/includes/recent-posts.pug +0 -0
  43. package/layout/includes/sidebar.pug +0 -0
  44. package/layout/includes/widgets/aside/aside.pug +6 -6
  45. package/layout/includes/widgets/aside/asideAllInfo.pug +0 -0
  46. package/layout/includes/widgets/aside/asideArchive.pug +0 -0
  47. package/layout/includes/widgets/aside/asideCustom.pug +1 -1
  48. package/layout/includes/widgets/aside/asideFlipCard.pug +0 -0
  49. package/layout/includes/widgets/aside/asideInfoCard.pug +3 -3
  50. package/layout/includes/widgets/aside/asideNewestPost.pug +0 -0
  51. package/layout/includes/widgets/aside/asideSwitch.pug +0 -4
  52. package/layout/includes/widgets/aside/asideTag.pug +1 -1
  53. package/layout/includes/widgets/aside/asideToc.pug +0 -0
  54. package/layout/includes/widgets/aside/asideWebInfo.pug +2 -2
  55. package/layout/includes/widgets/home/banner.pug +0 -0
  56. package/layout/includes/widgets/home/bb/json.pug +22 -0
  57. package/layout/includes/widgets/home/bb/local.pug +17 -0
  58. package/layout/includes/widgets/home/bb/memos.pug +25 -0
  59. package/layout/includes/widgets/home/bbTimeList.pug +11 -7
  60. package/layout/includes/widgets/home/categoryBar.pug +0 -0
  61. package/layout/includes/widgets/home/categoryGroup.pug +1 -1
  62. package/layout/includes/widgets/home/hometop.pug +0 -0
  63. package/layout/includes/widgets/home/postList.pug +0 -0
  64. package/layout/includes/widgets/home/topGroup.pug +0 -0
  65. package/layout/includes/widgets/nav/left.pug +0 -0
  66. package/layout/includes/widgets/nav/menu.pug +1 -1
  67. package/layout/includes/widgets/nav/right.pug +6 -5
  68. package/layout/includes/widgets/page/about/authorinfo.pug +10 -9
  69. package/layout/includes/widgets/page/about/award.pug +0 -0
  70. package/layout/includes/widgets/page/about/contentinfo.pug +35 -34
  71. package/layout/includes/widgets/page/about/hobbies.pug +21 -17
  72. package/layout/includes/widgets/page/about/motto.pug +17 -16
  73. package/layout/includes/widgets/page/about/other.pug +16 -16
  74. package/layout/includes/widgets/page/about/personalities.pug +15 -14
  75. package/layout/includes/widgets/page/about/skillsinfo.pug +37 -36
  76. package/layout/includes/widgets/page/about/tenyear.pug +0 -0
  77. package/layout/includes/widgets/page/banner.pug +9 -3
  78. package/layout/includes/widgets/page/equipment/content.pug +0 -0
  79. package/layout/includes/widgets/page/links/banner.pug +14 -12
  80. package/layout/includes/widgets/page/links/linksCard.pug +4 -6
  81. package/layout/includes/widgets/page/links/linksDiscn.pug +8 -0
  82. package/layout/includes/widgets/page/links/linksItem.pug +4 -6
  83. package/layout/includes/widgets/page/says/json.pug +80 -0
  84. package/layout/includes/widgets/page/says/local.pug +48 -0
  85. package/layout/includes/widgets/page/says/memos.pug +109 -0
  86. package/layout/includes/widgets/post/award.pug +0 -0
  87. package/layout/includes/widgets/post/copyright.pug +2 -2
  88. package/layout/includes/widgets/post/post-ai.pug +12 -0
  89. package/layout/includes/widgets/post/postMeta.pug +2 -2
  90. package/layout/includes/widgets/post/postNav.pug +0 -0
  91. package/layout/includes/widgets/post/wave.pug +0 -0
  92. package/layout/includes/widgets/randomlink.pug +1 -1
  93. package/layout/includes/widgets/rightside/index.pug +6 -5
  94. package/layout/includes/widgets/third-party/comments/comment.pug +1 -5
  95. package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -1
  96. package/layout/includes/widgets/third-party/comments/waline.pug +9 -11
  97. package/layout/includes/widgets/third-party/music.pug +1 -1
  98. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -0
  99. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +70 -0
  100. package/layout/includes/widgets/third-party/news-comment/waline.pug +64 -0
  101. package/layout/includes/widgets/third-party/pjax.pug +0 -0
  102. package/layout/includes/widgets/third-party/search/algolia-search.pug +0 -0
  103. package/layout/includes/widgets/third-party/search/index.pug +8 -7
  104. package/layout/includes/widgets/third-party/search/local-search.pug +0 -0
  105. package/layout/index.pug +3 -3
  106. package/layout/page.pug +0 -4
  107. package/layout/post.pug +2 -2
  108. package/layout/tag.pug +0 -0
  109. package/package.json +18 -9
  110. package/plugins.yml +109 -0
  111. package/scripts/event/cdn.js +129 -0
  112. package/scripts/event/init.js +0 -0
  113. package/scripts/event/page.js +1 -21
  114. package/scripts/event/welcome.js +1 -1
  115. package/scripts/filter/checkThemeConfig.js +0 -0
  116. package/scripts/filter/default.js +0 -0
  117. package/scripts/filter/lazyload.js +1 -1
  118. package/scripts/filter/randomPosts.js +0 -0
  119. package/scripts/helper/cdn.js +0 -0
  120. package/scripts/helper/getArchiveLength.js +0 -0
  121. package/scripts/helper/page.js +0 -0
  122. package/scripts/helper/related_post.js +0 -0
  123. package/scripts/helper/stylus.js +0 -0
  124. package/scripts/tags/button.js +0 -0
  125. package/scripts/tags/bvideo.js +0 -0
  126. package/scripts/tags/card.js +0 -0
  127. package/scripts/tags/checkbox.js +0 -0
  128. package/scripts/tags/fold.js +0 -0
  129. package/scripts/tags/image.js +0 -0
  130. package/scripts/tags/inline-image.js +0 -0
  131. package/scripts/tags/label.js +0 -0
  132. package/scripts/tags/link.js +0 -0
  133. package/scripts/tags/media.js +0 -0
  134. package/scripts/tags/note.js +0 -0
  135. package/scripts/tags/span.js +0 -0
  136. package/scripts/tags/tabs.js +0 -0
  137. package/scripts/tags/timeline.js +0 -0
  138. package/scripts/tags/u.js +0 -0
  139. package/source/css/_global/animation.css +0 -0
  140. package/source/css/_global/function.styl +42 -42
  141. package/source/css/_global/index.styl +1 -1
  142. package/source/css/_global/var.styl +0 -0
  143. package/source/css/_layout/basic.styl +10 -12
  144. package/source/css/_layout/header.styl +7 -2
  145. package/source/css/_layout/index.styl +59 -5
  146. package/source/css/_mode/index.styl +1 -17
  147. package/source/css/_page/_home/category-bar.styl +0 -0
  148. package/source/css/_page/_home/home-top.styl +10 -31
  149. package/source/css/_page/_home/index.styl +0 -0
  150. package/source/css/_page/_home/pagination.styl +3 -0
  151. package/source/css/_page/_home/recent-post.styl +10 -3
  152. package/source/css/_page/about/index.styl +0 -0
  153. package/source/css/_page/about/tenyear.styl +0 -0
  154. package/source/css/_page/about.styl +9 -0
  155. package/source/css/_page/category.styl +0 -0
  156. package/source/css/_page/douban.styl +0 -1
  157. package/source/css/_page/equipment.styl +0 -0
  158. package/source/css/_page/error.styl +0 -0
  159. package/source/css/_page/home.styl +0 -0
  160. package/source/css/_page/index.styl +2 -3
  161. package/source/css/_page/links.styl +84 -49
  162. package/source/css/_page/moment.styl +0 -0
  163. package/source/css/_page/music.styl +0 -0
  164. package/source/css/_page/rss.styl +0 -0
  165. package/source/css/_page/says.styl +10 -0
  166. package/source/css/_page/tag.styl +0 -0
  167. package/source/css/_widgets/_aside/allinfo.styl +34 -0
  168. package/source/css/_widgets/_aside/flip.styl +0 -0
  169. package/source/css/_widgets/_aside/index.styl +1 -7
  170. package/source/css/_widgets/_aside/info.styl +0 -0
  171. package/source/css/_widgets/_aside/newPost.styl +0 -0
  172. package/source/css/_widgets/_aside/toc.styl +0 -0
  173. package/source/css/_widgets/_aside/welcome.styl +0 -0
  174. package/source/css/_widgets/_comment/index.styl +0 -0
  175. package/source/css/_widgets/_comment/twikoo.styl +0 -2
  176. package/source/css/_widgets/_comment/waline.styl +0 -0
  177. package/source/css/_widgets/_extra/console.styl +0 -0
  178. package/source/css/_widgets/_extra/fullpage.styl +0 -0
  179. package/source/css/_widgets/_extra/music.styl +1 -1
  180. package/source/css/_widgets/_extra/pace.styl +0 -0
  181. package/source/css/_widgets/_extra/rightmenu.styl +0 -0
  182. package/source/css/_widgets/_mixins/article-sort.styl +0 -0
  183. package/source/css/_widgets/_mixins/footer.styl +1 -2
  184. package/source/css/_widgets/_mixins/other.styl +0 -4
  185. package/source/css/_widgets/_mixins/sidebar.styl +0 -0
  186. package/source/css/_widgets/_post/_highlight/diff.styl +0 -0
  187. package/source/css/_widgets/_post/_highlight/index.styl +0 -1
  188. package/source/css/_widgets/_post/_highlight/theme/default.styl +0 -0
  189. package/source/css/_widgets/_post/_highlight/theme/mac.styl +0 -0
  190. package/source/css/_widgets/_post/_highlight/theme.styl +0 -0
  191. package/source/css/_widgets/_post/commentBarrage.styl +0 -0
  192. package/source/css/_widgets/_post/content.styl +42 -11
  193. package/source/css/_widgets/_post/copyright.styl +0 -0
  194. package/source/css/_widgets/_post/index.styl +1 -1
  195. package/source/css/_widgets/_post/meta.styl +0 -3
  196. package/source/css/_widgets/_post/pagination.styl +1 -1
  197. package/source/css/_widgets/_post/postAI.styl +0 -0
  198. package/source/css/_widgets/_post/relatedPost.styl +0 -0
  199. package/source/css/_widgets/_post/tools.styl +0 -0
  200. package/source/css/_widgets/_search/algolia-search.styl +0 -0
  201. package/source/css/_widgets/_search/local-search.styl +0 -0
  202. package/source/css/_widgets/_tags/button.styl +0 -0
  203. package/source/css/_widgets/_tags/bvideo.styl +0 -0
  204. package/source/css/_widgets/_tags/card.styl +0 -0
  205. package/source/css/_widgets/_tags/checkbox.styl +0 -0
  206. package/source/css/_widgets/_tags/fold.styl +0 -0
  207. package/source/css/_widgets/_tags/image.styl +0 -0
  208. package/source/css/_widgets/_tags/index.styl +0 -0
  209. package/source/css/_widgets/_tags/inline-image.styl +0 -0
  210. package/source/css/_widgets/_tags/label.styl +0 -0
  211. package/source/css/_widgets/_tags/link.styl +4 -2
  212. package/source/css/_widgets/_tags/note.styl +0 -0
  213. package/source/css/_widgets/_tags/span.styl +0 -0
  214. package/source/css/_widgets/_tags/tabs.styl +0 -0
  215. package/source/css/_widgets/_tags/timeline.styl +0 -1
  216. package/source/css/_widgets/index.styl +4 -4
  217. package/source/css/index.styl +0 -0
  218. package/source/img/avatar.png +0 -0
  219. package/source/img/default.png +0 -0
  220. package/source/img/error_load.png +0 -0
  221. package/source/js/{extend/comment/twikoo/commentBarrage.js → comment/twikoo_commentBarrage.js} +0 -0
  222. package/source/js/{extend/comment/waline/commentBarrage.js → comment/waline_commentBarrage.js} +0 -0
  223. package/source/js/covercolor/api.js +95 -0
  224. package/source/js/covercolor/local.js +154 -0
  225. package/source/js/main.js +28 -235
  226. package/source/js/music.js +0 -0
  227. package/source/js/rightside.js +404 -0
  228. package/source/js/{extend/search/algolia-search.js → search/algolia.js} +10 -0
  229. package/source/js/{extend/search/local-search.js → search/local.js} +24 -2
  230. package/source/js/utils.js +75 -1
  231. package/layout/includes/head/fest.pug +0 -22
  232. package/layout/includes/page/echarts.pug +0 -7
  233. package/layout/includes/page/moments.pug +0 -4
  234. package/layout/includes/widgets/aside/asideHistory.pug +0 -8
  235. package/layout/includes/widgets/aside/asideWelcome.pug +0 -12
  236. package/layout/includes/widgets/page/moments/angle.pug +0 -19
  237. package/layout/includes/widgets/page/moments/index.pug +0 -23
  238. package/layout/includes/widgets/page/says/saysBottom.pug +0 -11
  239. package/layout/includes/widgets/page/says/saysContent.pug +0 -6
  240. package/layout/includes/widgets/page/says/saysFunction.pug +0 -10
  241. package/layout/includes/widgets/page/says/saysMeta.pug +0 -7
  242. package/layout/includes/widgets/third-party/ai/index.pug +0 -12
  243. package/layout/includes/widgets/third-party/comments/gitalk.pug +0 -0
  244. package/layout/includes/widgets/third-party/comments/valine.pug +0 -0
  245. package/scripts/helper/echarts.js +0 -407
  246. package/source/css/_widgets/_aside/history.styl +0 -42
  247. package/source/js/extend/comment/twikoo/twikoo.js +0 -67
  248. package/source/js/extend/comment/waline/waline.js +0 -60
  249. package/source/lib/bundle.min.js +0 -27
  250. package/source/lib/circle.min.js +0 -1
  251. package/source/lib/cover-color.min.js +0 -7
  252. package/source/lib/friends_post.js +0 -4
  253. package/source/lib/lazyload.min.js +0 -1
  254. package/source/lib/rightside.min.js +0 -1
  255. package/source/lib/snackbar.min.css +0 -1
  256. package/source/lib/snackbar.min.js +0 -9
  257. package/source/lib/txmap.min.js +0 -1
  258. package/source/lib/universe.min.js +0 -1
  259. package/source/lib/view-image.min.js +0 -6
  260. package/source/lib/waterfall.min.js +0 -1
  261. /package/source/{lib → js}/sco-ai.min.js +0 -0
@@ -15,9 +15,10 @@ div#rightMenu
15
15
  div.rightMenu-item#menu-pastetext
16
16
  i.scoicon.sco-clipboard-fill
17
17
  span 粘贴文本
18
- a.rightMenu-item#menu-commenttext
19
- i.scoicon.sco-chat-new-fill
20
- span 引用到评论
18
+ if theme.comment.enable
19
+ a.rightMenu-item#menu-commenttext
20
+ i.scoicon.sco-chat-new-fill
21
+ span 引用到评论
21
22
  div.rightMenu-item#menu-newwindow
22
23
  i.scoicon.sco-window-fill
23
24
  span 新窗口打开
@@ -45,7 +46,7 @@ div#rightMenu
45
46
  div.rightMenu-item#menu-music-forward
46
47
  i.scoicon.sco-skip-forward-fill
47
48
  span 切换到下一首
48
- div.rightMenu-item#menu-music-playlist(onclick=`window.open('${theme.thirdparty.aplayer.server === 'tencent' ? `https://y.qq.com/n/ryqq/playlist/${theme.thirdparty.aplayer.id}` : `https://music.163.com/#/playlist?id=${theme.thirdparty.aplayer.id}`}', '_blank');`)
49
+ div.rightMenu-item#menu-music-playlist(onclick=`window.open('${theme.capsule.server === 'tencent' ? `https://y.qq.com/n/ryqq/playlist/${theme.capsule.id}` : `https://music.163.com/#/playlist?id=${theme.capsule.id}`}', '_blank');`)
49
50
  i.scoicon.sco-play-list-2-line
50
51
  span 查看所有歌曲
51
52
  div.rightMenu-item#menu-music-copyMusicName
@@ -71,5 +72,5 @@ div#rightMenu
71
72
  span.menu-commentBarrage-text 关闭热评
72
73
  div.rightMenu-item#menu-darkmode
73
74
  i.scoicon.sco-moon-clear-fill
74
- span.menu-darkmode-text 浅色模式
75
+ span.menu-darkmode-text 深色模式
75
76
  div#rightmenu-mask
@@ -1,4 +1,4 @@
1
- #post-comment(view-image)
1
+ #post-comment
2
2
  .comment-head
3
3
  .comment-headline
4
4
  i.scoicon.sco-chat-fill
@@ -13,9 +13,5 @@
13
13
  case theme.comment.type
14
14
  when 'twikoo'
15
15
  include ./twikoo.pug
16
- when 'gitalk'
17
- include ./gitalk.pug
18
- when 'valine'
19
- include ./valine.pug
20
16
  when 'waline'
21
17
  include ./waline.pug
@@ -5,7 +5,7 @@ script.
5
5
  {
6
6
  el: '#comment',
7
7
  onCommentLoaded: function () {
8
- GLOBAL_CONFIG.lightbox && sco.lightbox('#article-container img, #twikoo .tk-content img:not(.tk-owo-emotion)')
8
+ GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
9
9
  },
10
10
  lang: '#{theme.comment.twikoo.lang}',
11
11
  }
@@ -2,15 +2,13 @@
2
2
 
3
3
  script.
4
4
  async function initComment() {
5
- (() => {
6
- Waline.init(Object.assign({
7
- el: '#comment',
8
- serverURL: '!{envId}',
9
- pageview: !{theme.post.meta.pv},
10
- dark: 'html[data-theme="dark"]',
11
- path: window.location.pathname,
12
- search: false,
13
- comment: #{theme.post.meta.comment && is_post()},
14
- }, !{JSON.stringify(option)}))
15
- })()
5
+ Waline.init(Object.assign({
6
+ el: '#comment',
7
+ serverURL: '!{envId}',
8
+ pageview: !{theme.post.meta.pv},
9
+ dark: 'html[data-theme="dark"]',
10
+ path: window.location.pathname,
11
+ search: false,
12
+ comment: #{theme.post.meta.comment && is_post()},
13
+ }, !{JSON.stringify(option)}))
16
14
  }
@@ -1,3 +1,3 @@
1
1
  div.needEndHide#nav-music(onclick="sco.musicToggle()")
2
2
  div#nav-music-hoverTips=__('music.hit')
3
- meting-js(id=theme.thirdparty.aplayer.id, server=theme.thirdparty.aplayer.server, type="playlist", mutex="true", preload="none", data-lrctype="0", order="random", theme="var(--sco-main)")
3
+ meting-js(id=theme.capsule.id, server=theme.capsule.server, type="playlist", mutex="true", preload="none", data-lrctype="0", order="random", theme="var(--sco-main)")
@@ -0,0 +1,6 @@
1
+ if theme.comment.enable && theme.comment.newComment
2
+ case theme.comment.type
3
+ when 'twikoo'
4
+ include twikoo
5
+ when 'waline'
6
+ include waline
@@ -0,0 +1,70 @@
1
+ script.
2
+ window.addEventListener('load', () => {
3
+ const changeContent = (content) => {
4
+ if (content === '') return content;
5
+
6
+ const replacements = [
7
+ {regex: /<img.*?src="(.*?)"?[^\>]+>/ig, replacement: '[图片]'},
8
+ {regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, replacement: '[链接]'},
9
+ {regex: /<pre><code>.*?<\/pre>/gi, replacement: '[代码]'},
10
+ {regex: /<[^>]+>/g, replacement: ""}
11
+ ];
12
+
13
+ content = replacements.reduce((str, {regex, replacement}) => str.replace(regex, replacement), content);
14
+
15
+ return content.length > 150 ? content.substring(0, 150) + '...' : content;
16
+ }
17
+
18
+ const getComment = () => {
19
+ const $dom = document.querySelector('#card-newest-comments .aside-list')
20
+
21
+ const runTwikoo = () => {
22
+ twikoo.getRecentComments({
23
+ envId: GLOBAL_CONFIG.comment.twikoo.url,
24
+ region: '',
25
+ pageSize: 6,
26
+ includeReply: true
27
+ }).then(function (res) {
28
+ const twikooArray = res.map(e => ({
29
+ 'content': changeContent(e.comment),
30
+ 'avatar': e.avatar,
31
+ 'nick': e.nick,
32
+ 'url': `${e.url}#${e.id}`,
33
+ 'date': new Date(e.created).toISOString()
34
+ }))
35
+ generateHtml(twikooArray)
36
+ }).catch(function (err) {
37
+ $dom.innerHTML = "无法获取评论,请确认相关配置是否正确"
38
+ })
39
+ }
40
+ runTwikoo()
41
+ }
42
+
43
+ const generateHtml = array => {
44
+ const $dom = document.querySelector('#card-newest-comments .aside-list')
45
+ $dom.innerHTML = array.length ? array.map(item => `
46
+ <div class='aside-list-item'>
47
+ <a href='${item.url}' class='thumbnail'>
48
+ <img src='${item.avatar}' alt='${item.nick}'>
49
+ <div class='name'><span>${item.nick}</span></div>
50
+ </a>
51
+ <div class='content'>
52
+ <a class='comment' href='${item.url}'>${item.content}</a>
53
+ <time class="datetime" datetime="${item.date}"></time>
54
+ </div>
55
+ </div>
56
+ `).join('') : '没有评论'
57
+ window.lazyLoadInstance && window.lazyLoadInstance.update()
58
+ window.pjax && window.pjax.refresh($dom)
59
+ changeTimeFormat()
60
+ }
61
+
62
+ const newestCommentInit = () => {
63
+ const $asideList = document.querySelector('#card-newest-comments .aside-list')
64
+ if ($asideList) {
65
+ getComment()
66
+ }
67
+ }
68
+
69
+ newestCommentInit()
70
+ })
@@ -0,0 +1,64 @@
1
+ script.
2
+ window.addEventListener('load', () => {
3
+ const changeContent = (content) => {
4
+ if (content === '') return content;
5
+
6
+ const replacements = [
7
+ {regex: /<img.*?src="(.*?)"?[^\>]+>/ig, replacement: '[图片]'},
8
+ {regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, replacement: '[链接]'},
9
+ {regex: /<pre><code>.*?<\/pre>/gi, replacement: '[代码]'},
10
+ {regex: /<[^>]+>/g, replacement: ""}
11
+ ];
12
+
13
+ content = replacements.reduce((str, {regex, replacement}) => str.replace(regex, replacement), content);
14
+
15
+ return content.length > 150 ? content.substring(0, 150) + '...' : content;
16
+ }
17
+
18
+ const $asideList = document.querySelector('#card-newest-comments .aside-list')
19
+ const newestCommentInit = () => {
20
+ if ($asideList) {
21
+ getComment()
22
+ }
23
+ }
24
+ const getComment = () => {
25
+ Waline.RecentComments(
26
+ options = {
27
+ serverURL: GLOBAL_CONFIG.comment.waline.url,
28
+ count: 6,
29
+ }
30
+ ).then(function (res) {
31
+ const walineArray = res.comments.map(item => ({
32
+ 'content': changeContent(item.comment),
33
+ 'avatar': item.avatar,
34
+ 'nick': item.nick,
35
+ 'url': `${item.url}#${item.objectId}`,
36
+ 'date': new Date(item.insertedAt).toISOString()
37
+ }))
38
+ generateHtml(walineArray)
39
+ }).catch(
40
+ $asideList.innerHTML = "无法获取评论,请确认相关配置是否正确"
41
+ )
42
+ }
43
+
44
+ const generateHtml = array => {
45
+ const $dom = document.querySelector('#card-newest-comments .aside-list')
46
+ $dom.innerHTML = array.length ? array.map(item => `
47
+ <div class='aside-list-item'>
48
+ <a href='${item.url}' class='thumbnail'>
49
+ <img src='${item.avatar}' alt='${item.nick}'>
50
+ <div class='name'><span>${item.nick}</span></div>
51
+ </a>
52
+ <div class='content'>
53
+ <a class='comment' href='${item.url}'>${item.content}</a>
54
+ <time class="datetime" datetime="${item.date}"></time>
55
+ </div>
56
+ </div>
57
+ `).join('') : '没有评论'
58
+ window.lazyLoadInstance && window.lazyLoadInstance.update()
59
+ window.pjax && window.pjax.refresh($dom)
60
+ changeTimeFormat()
61
+ }
62
+
63
+ newestCommentInit()
64
+ })
File without changes
@@ -1,7 +1,8 @@
1
- if theme.thirdparty.search.enable
2
- if theme.thirdparty.search.type==="algolia"
3
- include ./algolia-search.pug
4
- script(src=cdn_url_for("/js/extend/search/algolia-search.js"))
5
- else if theme.thirdparty.search.type === "local"
6
- include ./local-search.pug
7
- script(src=cdn_url_for("/js/extend/search/local-search.js"))
1
+ if theme.search.enable
2
+ case theme.search.type
3
+ when 'algolia'
4
+ include algolia-search
5
+ script(src=url_for(theme.cdn.algolia_js))
6
+ when 'local'
7
+ include local-search
8
+ script(src=url_for(theme.cdn.local_search))
package/layout/index.pug CHANGED
@@ -2,9 +2,9 @@ extends includes/layout.pug
2
2
 
3
3
  block content
4
4
  #home_top
5
- if(theme.says.home_mini)
6
- include ./includes/widgets/home/bbTimeList.pug
7
- if(theme.hometop.banner.enable)
5
+ if theme.says.home_mini
6
+ include ./includes/widgets/home/bbTimeList
7
+ if theme.hometop.banner.enable && is_home_first_page()
8
8
  include ./includes/widgets/home/hometop.pug
9
9
  main.layout#content-inner
10
10
  .recent-posts#recent-posts
package/layout/page.pug CHANGED
@@ -18,10 +18,6 @@ block content
18
18
  include includes/page/says
19
19
  when 'equipment'
20
20
  include includes/page/equipment
21
- when 'moments'
22
- include includes/page/moments
23
- when 'echarts'
24
- include includes/page/echarts
25
21
  when 'rss'
26
22
  include includes/page/rss
27
23
  when 'douban'
package/layout/post.pug CHANGED
@@ -3,8 +3,8 @@ extends includes/layout.pug
3
3
  block content
4
4
  main.layout#content-inner
5
5
  #post
6
- if theme.thirdparty.ai.enable
7
- include includes/widgets/third-party/ai/index
6
+ if theme.post_ai.enable
7
+ include includes/widgets/post/post-ai
8
8
  article.post-content#article-container!= page.content
9
9
  include includes/widgets/post/copyright
10
10
  .post-tools-right
package/layout/tag.pug CHANGED
File without changes
package/package.json CHANGED
@@ -1,23 +1,32 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the DuoSco team",
5
+ "main": "package.json",
5
6
  "scripts": {
6
7
  "test": "echo \"Error: no test specified\" && exit 1"
7
8
  },
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/DuoSco/hexo-theme-solitude.git"
11
- },
12
9
  "keywords": [
13
10
  "hexo",
14
11
  "theme",
12
+ "solitude",
13
+ "Card UI Design",
14
+ "Wleelw",
15
15
  "hexo-theme-solitude"
16
16
  ],
17
- "author": "Hexo-Theme-Solitude<wzsco@qq.com>",
18
- "license": "GNU",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/wleelw/hexo-theme-solitude.git"
20
+ },
21
+ "dependencies": {
22
+ "hexo-renderer-stylus": "^3.0.0",
23
+ "hexo-renderer-pug": "^3.0.0"
24
+ },
19
25
  "bugs": {
20
- "url": "https://github.com/DuoSco/Hexo-theme-solitude/issues"
26
+ "url": "https://github.com/wleelw/hexo-theme-solitude/issues",
27
+ "email": "me@wzsco.top"
21
28
  },
22
- "homepage": "https://github.com/DuoSco/hexo-theme-solitude#readme"
29
+ "homepage": "https://blog.wzsco.top/",
30
+ "author": "Hexo-Theme-Solitude<me@wzsco.top>",
31
+ "license": "GNU"
23
32
  }
package/plugins.yml ADDED
@@ -0,0 +1,109 @@
1
+ algolia_search:
2
+ name: algoliasearch
3
+ file: dist/algoliasearch-lite.umd.js
4
+ version: 4.22.0
5
+ instantsearch:
6
+ name: instantsearch.js
7
+ file: dist/instantsearch.production.min.js
8
+ version: 4.63.0
9
+ pjax:
10
+ name: pjax
11
+ file: pjax.min.js
12
+ version: 0.2.8
13
+ twikoo:
14
+ name: twikoo
15
+ file: dist/twikoo.all.min.js
16
+ version: 1.6.29
17
+ waline_js:
18
+ name: '@waline/client'
19
+ file: dist/waline.js
20
+ other_name: waline
21
+ version: 2.15.8
22
+ waline_css:
23
+ name: '@waline/client'
24
+ file: dist/waline.css
25
+ other_name: waline
26
+ version: 2.15.8
27
+ sharejs:
28
+ name: butterfly-extsrc
29
+ file: sharejs/dist/js/social-share.min.js
30
+ version: 1.1.3
31
+ sharejs_css:
32
+ name: butterfly-extsrc
33
+ file: sharejs/dist/css/share.min.css
34
+ version: 1.1.3
35
+ katex:
36
+ name: katex
37
+ file: dist/katex.min.css
38
+ other_name: KaTeX
39
+ version: 0.16.9
40
+ katex_copytex:
41
+ name: katex
42
+ file: dist/contrib/copy-tex.min.js
43
+ other_name: KaTeX
44
+ version: 0.16.9
45
+ lazyload:
46
+ name: vanilla-lazyload
47
+ file: dist/lazyload.iife.min.js
48
+ version: 17.8.5
49
+ aplayer_css:
50
+ name: aplayer
51
+ file: dist/APlayer.min.css
52
+ version: 1.10.1
53
+ aplayer_js:
54
+ name: aplayer
55
+ file: dist/APlayer.min.js
56
+ version: 1.10.1
57
+ meting_js:
58
+ name: meting
59
+ file: Meting.min.js
60
+ version: 2.0.1
61
+ pace_js:
62
+ name: pace-js
63
+ other_name: pace
64
+ file: pace.min.js
65
+ version: 1.2.4
66
+ lunr_js:
67
+ name: lunr
68
+ file: lunr.min.js
69
+ version: 2.3.9
70
+ swiper_css:
71
+ name: Swiper
72
+ file: swiper-bundle.min.css
73
+ version: 11.0.5
74
+ swiper_js:
75
+ name: Swiper
76
+ file: swiper-bundle.min.js
77
+ version: 11.0.5
78
+ busuanzi_js:
79
+ name: busuanzi
80
+ file: bsz.pure.mini.js
81
+ version: 2.3.0
82
+ snackbar_css:
83
+ name: node-snackbar
84
+ file: dist/snackbar.min.css
85
+ version: 0.1.16
86
+ snackbar:
87
+ name: node-snackbar
88
+ file: dist/snackbar.min.js
89
+ version: 0.1.16
90
+ scoicon_css:
91
+ name: solitude-source
92
+ file: icon/scoicon.min.css
93
+ version: 1.0.3
94
+ waterfall:
95
+ name: solitude-source
96
+ file: js/waterfall.min.js
97
+ version: 1.0.3
98
+ medium_zoom:
99
+ name: medium-zoom
100
+ file: dist/medium-zoom.min.js
101
+ version: 1.1.0
102
+ fancyapps_ui:
103
+ name: fancyapps-ui
104
+ file: dist/fancybox/fancybox.umd.js
105
+ version: 5.0.33
106
+ fancyapps_css:
107
+ name: fancyapps-ui
108
+ file: dist/fancybox/fancybox.min.css
109
+ version: 5.0.33
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Solitude
3
+ * Merge CDN
4
+ */
5
+
6
+ 'use strict'
7
+
8
+ const { version } = require('../../package.json')
9
+ const path = require('path')
10
+
11
+ hexo.extend.filter.register('before_generate', () => {
12
+ const themeConfig = hexo.theme.config
13
+ const { CDN } = themeConfig
14
+
15
+ const thirdPartySrc = hexo.render.renderSync({ path: path.join(hexo.theme_dir, '/plugins.yml'), engine: 'yaml' })
16
+ const internalSrc = {
17
+ main: {
18
+ name: 'hexo-theme-solitude',
19
+ file: 'js/main.js',
20
+ version
21
+ },
22
+ utils: {
23
+ name: 'hexo-theme-solitude',
24
+ file: 'js/utils.js',
25
+ version
26
+ },
27
+ local_search: {
28
+ name: 'hexo-theme-solitude',
29
+ file: 'js/search/local.js',
30
+ version
31
+ },
32
+ algolia_js: {
33
+ name: 'hexo-theme-solitude',
34
+ file: 'js/search/algolia.js',
35
+ version
36
+ },
37
+ cover_local: {
38
+ name: 'hexo-theme-solitude',
39
+ file: 'js/covercolor/local.js',
40
+ version
41
+ },
42
+ cover_api: {
43
+ name: 'hexo-theme-solitude',
44
+ file: 'js/covercolor/api.js',
45
+ version
46
+ },
47
+ rightside_js: {
48
+ name: 'hexo-theme-solitude',
49
+ file: 'js/rightside.js',
50
+ version
51
+ },
52
+ music_js: {
53
+ name: 'hexo-theme-solitude',
54
+ file: 'js/music.js',
55
+ version
56
+ },
57
+ sco_ai_js: {
58
+ name: 'hexo-theme-solitude',
59
+ file: 'js/sco-ai.min.js',
60
+ version
61
+ },
62
+ twikoo_commentBarrage: {
63
+ name: 'hexo-theme-solitude',
64
+ file: 'js/comment/twikoo_commentBarrage.js',
65
+ version
66
+ },
67
+ waline_commentBarrage: {
68
+ name: 'hexo-theme-solitude',
69
+ file: 'js/comment/waline_commentBarrage.js',
70
+ version
71
+ },
72
+ }
73
+
74
+ const minFile = file => {
75
+ return file.replace(/(?<!\.min)\.(js|css)$/g, ext => '.min' + ext)
76
+ }
77
+
78
+ const createCDNLink = (data, type, cond = '') => {
79
+ Object.keys(data).forEach(key => {
80
+ let { name, version, file, other_name } = data[key]
81
+ const cdnjs_name = other_name || name
82
+ const cdnjs_file = file.replace(/^[lib|dist]*\/|browser\//g, '')
83
+ const min_cdnjs_file = minFile(cdnjs_file)
84
+ if (cond === 'internal') file = `source/${file}`
85
+ const min_file = minFile(file)
86
+ const verType = CDN.version ? (type === 'local' ? `?v=${version}` : `@${version}`) : ''
87
+
88
+ const value = {
89
+ version,
90
+ name,
91
+ file,
92
+ cdnjs_file,
93
+ min_file,
94
+ min_cdnjs_file,
95
+ cdnjs_name
96
+ }
97
+
98
+ const cdnSource = {
99
+ local: cond === 'internal' ? `${cdnjs_file + verType}` : `/pluginsSrc/${name}/${file + verType}`,
100
+ jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`,
101
+ unpkg: `https://unpkg.com/${name}${verType}/${file}`,
102
+ cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`,
103
+ custom: (CDN.custom_format || '').replace(/\$\{(.+?)\}/g, (match, $1) => value[$1]),
104
+ custom_cdn: `${CDN.custom_cdn + cdnjs_file}`,
105
+ cdncbd: `https://cdn.cbd.int/${name}${verType}/${file}`,
106
+ }
107
+
108
+ data[key] = cdnSource[type]
109
+ })
110
+
111
+ if (cond === 'internal') data.main_css = 'css/index.css' + (CDN.version ? `?v=${version}` : '')
112
+ return data
113
+ }
114
+
115
+ // delete null value
116
+ const deleteNullValue = obj => {
117
+ if (!obj) return
118
+ for (const i in obj) {
119
+ obj[i] === null && delete obj[i]
120
+ }
121
+ return obj
122
+ }
123
+
124
+ themeConfig.cdn = Object.assign(
125
+ createCDNLink(internalSrc, CDN.internal, 'internal'),
126
+ createCDNLink(thirdPartySrc, CDN.third_party),
127
+ deleteNullValue(CDN.option)
128
+ )
129
+ })
File without changes
@@ -1,11 +1,10 @@
1
-
1
+ // generate 404 Page
2
2
  hexo.extend.generator.register('404', function (locals) {
3
3
  if(!this.theme.config.page.error)return
4
4
  return {
5
5
  path: '404.html',
6
6
  layout: ['404'],
7
7
  data: {
8
- title: '404',
9
8
  type: '404',
10
9
  comment: false
11
10
  }
@@ -15,12 +14,10 @@ hexo.extend.generator.register('404', function (locals) {
15
14
  // generate tags Page
16
15
  hexo.extend.generator.register('tags', function(locals) {
17
16
  if(!this.theme.config.page.tags)return
18
- const lang = hexo.theme.i18n.get(this.config.language || 'zh-CN')
19
17
  return {
20
18
  path: 'tags/index.html',
21
19
  layout: ['page'],
22
20
  data: {
23
- title: lang["page.tag"],
24
21
  type: 'tags',
25
22
  comment: false
26
23
  }
@@ -30,29 +27,12 @@ hexo.extend.generator.register('tags', function(locals) {
30
27
  // generate categories Page
31
28
  hexo.extend.generator.register('categories', function(locals) {
32
29
  if(!this.theme.config.page.categories)return
33
- const lang = hexo.theme.i18n.get(this.config.language || 'zh-CN')
34
30
  return {
35
31
  path: 'categories/index.html',
36
32
  layout: ['page'],
37
33
  data: {
38
- title: lang["page.category"],
39
34
  type: 'categories',
40
35
  comment: false
41
36
  }
42
37
  };
43
- });
44
-
45
- // generate echarts Page
46
- hexo.extend.generator.register('echarts', function(locals) {
47
- if(!this.theme.config.about.echarts && !this.theme.config.about.enable)return
48
- const lang = hexo.theme.i18n.get(this.config.language || 'zh-CN')
49
- return {
50
- path: 'echart/index.html',
51
- layout: ['page'],
52
- data: {
53
- title: lang["page.echarts"],
54
- type: 'echarts',
55
- comment: false
56
- }
57
- };
58
38
  });
@@ -9,6 +9,6 @@ hexo.on('ready', () => {
9
9
  ###### #### ##### ##### # ### ###### ######
10
10
  ${version}
11
11
  ===================================================================
12
- 主题链接:https://github.com/DuoSco/Hexo-theme-solitude
12
+ 主题链接:https://github.com/wleelw/Hexo-theme-solitude
13
13
  `)
14
14
  })
File without changes
File without changes
@@ -8,4 +8,4 @@ hexo.extend.filter.register('after_render:html', function (data) {
8
8
  /(<img(?!.*?class[\t]*=[\t]*['"].*?nolazyload.*?['"]).*? src=)/gi,
9
9
  `$1 "${bg}" data-lazy-src=`
10
10
  )
11
- })
11
+ })
File without changes
File without changes
File without changes
File without changes