hexo-theme-solitude 1.6.0 → 1.7.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 (83) hide show
  1. package/README.md +1 -1
  2. package/README_zh-cn.md +1 -1
  3. package/README_zh-tw.md +1 -1
  4. package/SECURITY.md +5 -5
  5. package/_config.yml +50 -51
  6. package/languages/en.yml +59 -63
  7. package/languages/zh-CN.yml +52 -55
  8. package/languages/zh-TW.yml +52 -55
  9. package/layout/404.pug +1 -1
  10. package/layout/category.pug +1 -1
  11. package/layout/includes/console.pug +13 -12
  12. package/layout/includes/footer.pug +6 -6
  13. package/layout/includes/head/config.pug +70 -38
  14. package/layout/includes/head/opengraph.pug +2 -2
  15. package/layout/includes/head/pwa.pug +6 -6
  16. package/layout/includes/head.pug +1 -1
  17. package/layout/includes/inject/body.pug +7 -7
  18. package/layout/includes/inject/head.pug +35 -1
  19. package/layout/includes/keyboard.pug +1 -1
  20. package/layout/includes/nav.pug +1 -1
  21. package/layout/includes/sidebar.pug +19 -3
  22. package/layout/includes/widgets/home/categoryBar.pug +2 -2
  23. package/layout/includes/widgets/home/postList.pug +4 -4
  24. package/layout/includes/widgets/home/topGroup.pug +2 -2
  25. package/layout/includes/widgets/nav/group.pug +2 -2
  26. package/layout/includes/widgets/nav/right.pug +1 -1
  27. package/layout/includes/widgets/page/about/award.pug +8 -9
  28. package/layout/includes/widgets/page/about/hobbies.pug +1 -1
  29. package/layout/includes/widgets/page/about/other.pug +1 -1
  30. package/layout/includes/widgets/page/banner.pug +1 -1
  31. package/layout/includes/widgets/page/links/banner.pug +5 -4
  32. package/layout/includes/widgets/page/moments/angle.pug +1 -1
  33. package/layout/includes/widgets/post/award.pug +10 -15
  34. package/layout/includes/widgets/post/copyright.pug +2 -2
  35. package/layout/includes/widgets/post/postMeta.pug +17 -10
  36. package/layout/includes/widgets/randomlink.pug +3 -2
  37. package/layout/includes/widgets/third-party/comments/comment.pug +5 -7
  38. package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -0
  39. package/layout/includes/widgets/third-party/comments/valine.pug +44 -0
  40. package/layout/includes/widgets/third-party/comments/waline.pug +40 -11
  41. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +5 -3
  42. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +12 -10
  43. package/layout/includes/widgets/third-party/news-comment/valine.pug +79 -0
  44. package/layout/includes/widgets/third-party/news-comment/waline.pug +25 -20
  45. package/layout/page.pug +3 -0
  46. package/layout/tag.pug +1 -1
  47. package/package.json +1 -1
  48. package/plugins.yml +15 -3
  49. package/scripts/event/cdn.js +9 -9
  50. package/scripts/event/init.js +4 -2
  51. package/scripts/event/merge_config.js +15 -6
  52. package/scripts/helper/related_post.js +2 -2
  53. package/scripts/tags/tabs.js +1 -1
  54. package/source/css/_comments/{index.styl → comment.styl} +15 -22
  55. package/source/css/_comments/twikoo.styl +3 -0
  56. package/source/css/_comments/valine.styl +245 -0
  57. package/source/css/_global/index.styl +3 -0
  58. package/source/css/_highlight/highlight/index.styl +1 -1
  59. package/source/css/_highlight/prismjs/line-number.styl +1 -1
  60. package/source/css/_layout/article-sort.styl +1 -1
  61. package/source/css/_layout/aside.styl +3 -3
  62. package/source/css/_layout/console.styl +7 -6
  63. package/source/css/_layout/footer.styl +1 -0
  64. package/source/css/_layout/header.styl +2 -0
  65. package/source/css/_layout/sidebar.styl +30 -20
  66. package/source/css/_page/_home/home-top.styl +1 -1
  67. package/source/css/_page/_home/recent-post.styl +2 -2
  68. package/source/css/_page/index.styl +1 -4
  69. package/source/css/_page/links.styl +5 -5
  70. package/source/css/_post/content.styl +26 -7
  71. package/source/css/_post/tools.styl +3 -9
  72. package/source/css/index.styl +1 -3
  73. package/source/img/flower.gif +0 -0
  74. package/source/js/{comment/twikoo_commentBarrage.js → commentBarrage/twikoo.js} +4 -10
  75. package/source/js/commentBarrage/valine.js +156 -0
  76. package/source/js/{comment/waline_commentBarrage.js → commentBarrage/waline.js} +3 -5
  77. package/source/js/main.js +92 -96
  78. package/source/js/third_party/efu_ai.min.js +6 -0
  79. package/source/js/utils.js +15 -2
  80. package/layout/includes/widgets/rightside/index.pug +0 -87
  81. package/source/css/_comments/waline.styl +0 -455
  82. package/source/js/rightside.js +0 -221
  83. package/source/js/third_party/sco-ai.min.js +0 -8
@@ -1,6 +1,6 @@
1
1
  .post-copyright
2
2
  .post-copyright__author_group
3
- a.post-copyright__author_img(href="/about/")
3
+ a.post-copyright__author_img(href=url_for("/about/"))
4
4
  img.post-copyright__author_img_front(src=theme.site.icon)
5
5
  .post-copyright__author_name= config.title
6
6
  .post-copyright__author_desc= config.subtitle
@@ -24,4 +24,4 @@
24
24
  a(href=url_for(theme.post.default.copyright.licenurl))
25
25
  | #{theme.post.default.copyright.license}
26
26
  | 协议,完整转载请注明来自
27
- a(href="/") #{config.title}
27
+ a(href=url_for("/")) #{config.title}
@@ -3,11 +3,11 @@
3
3
  #post-info
4
4
  #post-firstinfo
5
5
  .meta-firstline
6
- - var cc = page.reprint ? _p('post.meta_reprint') : _p('post.meta_original')
7
- a.post-meta-original(title=_p('post.meta_cc').replace(/\$\{cc}/, cc))= cc
6
+ - var cc = page.reprint ? _p('post.reprint') : _p('post.original')
7
+ a.post-meta-original(title=_p('post.copyright').replace(/\$\{cc}/, cc))= cc
8
8
  if page.categories.data.length > 0
9
9
  span.post-meta-categories
10
- a.post-meta-categories(href='/' + page.categories.data[0].path)= page.categories.data[0].name
10
+ a.post-meta-categories(href=url_for('/' + page.categories.data[0].path))= page.categories.data[0].name
11
11
  .tag_share
12
12
  .post-meta__tag-list
13
13
  each tag in page.tags.data
@@ -17,28 +17,28 @@
17
17
  #post-meta
18
18
  .meta-secondline
19
19
  if theme.post.meta.date
20
- span.post-meta-date(title=_p('meta_posted') + ' ' + full_date(page.date))
20
+ span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date))
21
21
  i.post-meta-icon.solitude.st-calendar-todo-fill
22
22
  time(datetime=date_xml(page.date))= date_xml(page.date)
23
23
  if theme.post.meta.updated
24
- span.post-meta-date(title=_p('meta_updated') + ' ' + full_date(page.updated))
24
+ span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated))
25
25
  i.post-meta-icon.solitude.st-refresh-line
26
26
  time(datetime=date_xml(page.updated))= date_xml(page.updated)
27
27
  if theme.wordcount
28
28
  span.post-meta-wordcount
29
29
  if theme.post.meta.wordcount
30
- i.post-meta-icon.solitude.st-word-fill(title=_p('post.meta_wordcount'))
30
+ i.post-meta-icon.solitude.st-word-fill(title=_p('post.wordcount'))
31
31
  span.word-count= wordcount(page.content)
32
32
  span.post-meta-separator
33
33
  if theme.post.meta.readtime
34
- i.post-meta-icon.solitude.st-clock-fill(title=_p('post.meta_minread'))
34
+ i.post-meta-icon.solitude.st-clock-fill(title=_p('post.minread'))
35
35
  span= min2read(page.content) + " min"
36
36
  if theme.post.meta.locate
37
- span.post-meta-position(title=_p('post.meta_ip') + page.locate)
37
+ span.post-meta-position(title=_p('post.ip') + page.locate)
38
38
  i.post-meta-icon.solitude.st-map-pin-fill
39
39
  span= page.locate
40
40
  if theme.post.meta.pv
41
- a.post-meta-pv(href=url_for(page.path), title=_p('post.meta_pv'))
41
+ a.post-meta-pv(href=url_for(page.path), title=_p('post.pv'))
42
42
  i.post-meta-icon.solitude.st-fire-fill
43
43
  if theme.comment.enable
44
44
  case theme.comment.type
@@ -48,11 +48,15 @@
48
48
  when "waline"
49
49
  span.waline-pageview-count
50
50
  i.solitude.st-loading-line
51
+ when "valine"
52
+ span.leancloud_visitors(id=url_for(page.path))
53
+ span.leancloud-visitors-count
54
+ i.solitude.st-loading-line
51
55
  else if theme.busuanzi
52
56
  span#busuanzi_value_page_pv
53
57
  i.solitude.st-loading-line
54
58
  if theme.post.meta.comment && page.comment
55
- span.post-meta-commentcount(title=_p('post.meta_comment'), onclick="sco.scrollTo('post-comment')")
59
+ span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')")
56
60
  i.solitude.st-chat-fill
57
61
  a(href=url_for(page.path) + "#post-comment")
58
62
  case theme.comment.type
@@ -62,5 +66,8 @@
62
66
  when "waline"
63
67
  span.waline-comment-count
64
68
  i.solitude.st-loading-line
69
+ when "valine"
70
+ span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount")
71
+ i.solitude.st-loading-line
65
72
 
66
73
  include ./wave
@@ -8,9 +8,10 @@ if(data)
8
8
 
9
9
  script.
10
10
  const links = !{JSON.stringify(datalinks)}
11
+ const randomText = '!{_p('link.random')}'
11
12
  function travelling() {
12
13
  const link = links[utils.randomNum(links.length)];
13
- utils.snackbarShow('您即将前往 ⌈ ' + link.name + ' ⌋ , 安全性未知', false, 3000);
14
+ utils.snackbarShow(randomText.replace(/\$\{name}/, link.name), false, 3000);
14
15
  setTimeout(() => {
15
16
  window.open(link.link, "_blank")
16
17
  }, 3000)
@@ -33,5 +34,5 @@ if theme.footer.randomlink
33
34
  linksCopy.splice(index, 1);
34
35
  }
35
36
 
36
- linkcard.innerHTML = data + '<a class="footer-item" href="/links/">更多</a>';
37
+ linkcard.innerHTML = data + '<a class="footer-item" href="#{url_for(/links/)}">#{_p('more')}</a>';
37
38
  }
@@ -2,16 +2,14 @@
2
2
  .comment-head
3
3
  .comment-headline
4
4
  i.solitude.st-chat-fill
5
- span 评论
5
+ span=_p('comment.title')
6
6
  span
7
- .comment-randomInfo
8
- a(onclick="sco.addRandomCommentInfo()", href="javascript:void(0)") 匿名评论
9
- .comment-tips#comment-tips
10
- span ✅ 你无需删除空行,直接评论以获取最佳展示效果
11
7
  .comment-wrap
12
8
  #comment
13
9
  case theme.comment.type
14
10
  when 'twikoo'
15
- include ./twikoo.pug
11
+ !=partial('includes/widgets/third-party/comments/twikoo',{}, {cache: true})
16
12
  when 'waline'
17
- include ./waline.pug
13
+ !=partial('includes/widgets/third-party/comments/waline',{}, {cache: true})
14
+ when 'valine'
15
+ !=partial('includes/widgets/third-party/comments/valine',{}, {cache: true})
@@ -6,6 +6,7 @@ script.
6
6
  el: '#comment',
7
7
  onCommentLoaded: function () {
8
8
  GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
9
+ sco.owoBig()
9
10
  },
10
11
  lang: '#{theme.comment.twikoo.lang}',
11
12
  }
@@ -0,0 +1,44 @@
1
+ - const { lazyload, count } = theme.comment
2
+ - const { appId, appKey, avatar, serverURLs, visitor, option } = theme.comment.valine
3
+ - let emojiMaps = '""'
4
+
5
+ if site.data.valine
6
+ - emojiMaps = JSON.stringify(site.data.valine)
7
+
8
+ script.
9
+ async function initComment() {
10
+ const initValine = () => {
11
+ const valine = new Valine(Object.assign({
12
+ el: '#comment',
13
+ appId: '#{appId}',
14
+ appKey: '#{appKey}',
15
+ avatar: '#{avatar}',
16
+ serverURLs: '#{serverURLs}',
17
+ emojiMaps: !{emojiMaps},
18
+ path: window.location.pathname,
19
+ visitor: #{visitor},
20
+ ...!{JSON.stringify(option)}
21
+ }))
22
+
23
+ if (GLOBAL_CONFIG.lightbox) {
24
+ utils.lightbox(document.querySelectorAll('#comment .vcontent img:not(.vemoji)'));
25
+ }
26
+
27
+ sco.owoBig();
28
+ }
29
+
30
+ const loadValine = async () => {
31
+ if (typeof Valine === 'function') initValine()
32
+ else {
33
+ await getScript('!{url_for(theme.cdn.valine)}')
34
+ initValine()
35
+ }
36
+ }
37
+
38
+ if (!!{lazyload}) {
39
+ if (!{lazyload}) utils.loadComment(document.getElementById('comment'), loadValine)
40
+ else setTimeout(loadValine, 0)
41
+ } else {
42
+ await loadValine()
43
+ }
44
+ }
@@ -1,16 +1,45 @@
1
- - const { envId, option } = theme.comment.waline
1
+ - const { envId, option ,pageview } = theme.comment.waline
2
+ - const { lazyload, count } = theme.comment
2
3
 
3
4
  script.
4
5
  async function initComment() {
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)}))
6
+ const isLazyLoad = !!{lazyload};
7
+ let walineInitFunction = window.walineFn || null;
14
8
 
15
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#comment .wl-content img:not(.wl-emoji)'))
9
+ async function initWaline(Fn) {
10
+ const walineOptions = {
11
+ el: '#comment',
12
+ serverURL: '!{envId}',
13
+ pageview: !isLazyLoad,
14
+ dark: 'html[data-theme="dark"]',
15
+ path: window.location.pathname,
16
+ comment: !isLazyLoad,
17
+ ...!{JSON.stringify(option)}
18
+ };
19
+ const walineInstance = Fn(walineOptions);
20
+
21
+ utils.addGlobalFn('pjax', () => walineInstance.destroy(), 'destroyWaline');
22
+ }
23
+
24
+ async function loadWalineCSSAndJS() {
25
+ if (!walineInitFunction) {
26
+ await getCSS('!{url_for(theme.cdn.waline_css)}');
27
+ const {init} = await import('!{url_for(theme.cdn.waline_js)}');
28
+ walineInitFunction = init || Waline.init;
29
+ window.walineFn = walineInitFunction;
30
+ }
31
+ initWaline(walineInitFunction);
32
+ }
33
+
34
+ if (isLazyLoad) {
35
+ utils.loadComment(document.getElementById('comment'),loadWalineCSSAndJS);
36
+ } else {
37
+ await loadWalineCSSAndJS();
38
+ }
39
+
40
+ if (GLOBAL_CONFIG.lightbox) {
41
+ utils.lightbox(document.querySelectorAll('#comment .wl-content img:not(.wl-emoji)'));
42
+ }
43
+
44
+ sco.owoBig();
16
45
  }
@@ -1,6 +1,8 @@
1
- if theme.comment.enable && theme.comment.newComment
1
+ if theme.comment.enable && theme.console_plus && theme.comment.newest_comment.enable
2
2
  case theme.comment.type
3
3
  when 'twikoo'
4
- include twikoo
4
+ !=partial('includes/widgets/third-party/news-comment/twikoo',{}, {cache: true})
5
5
  when 'waline'
6
- include waline
6
+ !=partial('includes/widgets/third-party/news-comment/waline',{}, {cache: true})
7
+ when 'valine'
8
+ !=partial('includes/widgets/third-party/news-comment/valine',{}, {cache: true})
@@ -15,12 +15,12 @@ script.
15
15
  return content.length > 150 ? content.substring(0, 150) + '...' : content;
16
16
  }
17
17
 
18
- const getComment = () => {
19
- const $dom = document.querySelector('#card-newest-comments .aside-list')
18
+ const $asideList = document.querySelector('#card-newest-comments .aside-list')
20
19
 
20
+ const getComment = () => {
21
21
  const runTwikoo = () => {
22
22
  twikoo.getRecentComments({
23
- envId: GLOBAL_CONFIG.comment.twikoo.url,
23
+ envId: GLOBAL_CONFIG.comment.url,
24
24
  region: '',
25
25
  pageSize: 6,
26
26
  includeReply: true
@@ -32,18 +32,18 @@ script.
32
32
  'url': `${e.url}#${e.id}`,
33
33
  'date': new Date(e.created).toISOString()
34
34
  }))
35
+ saveToLocal.set('twikoo-newest-comment', JSON.stringify(twikooArray), !{theme.comment.newest_comment.storage}/(60*24))
35
36
  generateHtml(twikooArray)
36
37
  }).catch(function (err) {
37
38
  console.error(err)
38
- $dom.innerHTML = "无法获取评论,请确认相关配置是否正确"
39
+ $asideList.textContent = "!{_p('newest_comment.error')}"
39
40
  })
40
41
  }
41
42
  runTwikoo()
42
43
  }
43
44
 
44
45
  const generateHtml = array => {
45
- const $dom = document.querySelector('#card-newest-comments .aside-list')
46
- $dom.innerHTML = array.length ? array.map(item => `
46
+ $asideList.innerHTML = array.length ? array.map(item => `
47
47
  <div class='aside-list-item'>
48
48
  <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
49
49
  <img src='${item.avatar}' alt='${item.nick}'>
@@ -54,15 +54,17 @@ script.
54
54
  <time class="datetime" datetime="${item.date}"></time>
55
55
  </div>
56
56
  </div>
57
- `).join('') : '没有评论'
57
+ `).join('') : "!{_p('newest_comment.zero')}"
58
58
  window.lazyLoadInstance && window.lazyLoadInstance.update()
59
- window.pjax && window.pjax.refresh($dom)
59
+ window.pjax && window.pjax.refresh()
60
60
  utils && utils.changeTimeFormat()
61
61
  }
62
62
 
63
63
  const newestCommentInit = () => {
64
- const $asideList = document.querySelector('#card-newest-comments .aside-list')
65
- if ($asideList) {
64
+ const data = saveToLocal.get('twikoo-newest-comment')
65
+ if (data) {
66
+ generateHtml(JSON.parse(data))
67
+ } else {
66
68
  getComment()
67
69
  }
68
70
  }
@@ -0,0 +1,79 @@
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: '[Image]'},
8
+ {regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, replacement: '[URL]'},
9
+ {regex: /```[\s\S]*?```/g, replacement: '[Code]'},
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
+ const data = saveToLocal.get('valine-newest-comment')
21
+ if (data) {
22
+ generateHtml(JSON.parse(data))
23
+ } else {
24
+ getComment()
25
+ }
26
+ }
27
+
28
+ const getComment = async () => {
29
+ try {
30
+ const settings = {
31
+ "method": "GET",
32
+ "headers": {
33
+ "X-LC-Id": '!{theme.comment.valine.appId}',
34
+ "X-LC-Key": '!{theme.comment.valine.appKey}',
35
+ "Content-Type": "application/json"
36
+ },
37
+ }
38
+
39
+ const res = await fetch('!{theme.comment.valine.serverURLs}/1.1/classes/Comment?limit=8&order=-createdAt', settings)
40
+ const result = await res.json()
41
+ window.res = result
42
+ const valineArray = result.results.map(e => {
43
+ return {
44
+ 'content': changeContent(e.comment),
45
+ 'avatar': '!{theme.comment.avatar}' + '/avatar/' + md5(e.mail.toLowerCase()),
46
+ 'nick': e.nick,
47
+ 'url': e.url + '#' + e.objectId,
48
+ 'date': e.updatedAt || e.createdAt
49
+ }
50
+ })
51
+ saveToLocal.set('valine-newest-comment', JSON.stringify(valineArray), !{theme.comment.newest_comment.storage} / (60 * 24))
52
+ generateHtml(valineArray)
53
+ } catch (err) {
54
+ console.error(err)
55
+ $asideList.textContent = "!{_p('newest_comment.error')}"
56
+ }
57
+ }
58
+
59
+ const generateHtml = array => {
60
+ const $dom = document.querySelector('#card-newest-comments .aside-list')
61
+ $dom.innerHTML = array.length ? array.map(item => `
62
+ <div class='aside-list-item'>
63
+ <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
64
+ <img src='${item.avatar}' alt='${item.nick}'>
65
+ <div class='name'><span>${item.nick}</span></div>
66
+ </a>
67
+ <div class='content'>
68
+ <a class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</a>
69
+ <time class="datetime" datetime="${item.date}"></time>
70
+ </div>
71
+ </div>
72
+ `).join('') : "!{_p('newest_comment.zero')}"
73
+ window.lazyLoadInstance && window.lazyLoadInstance.update()
74
+ window.pjax && window.pjax.refresh()
75
+ utils && utils.changeTimeFormat()
76
+ }
77
+
78
+ newestCommentInit()
79
+ })
@@ -17,28 +17,33 @@ script.
17
17
 
18
18
  const $asideList = document.querySelector('#card-newest-comments .aside-list')
19
19
  const newestCommentInit = () => {
20
- if ($asideList) {
20
+ const data = saveToLocal.get('waline-newest-comment')
21
+ if (data) {
22
+ generateHtml(JSON.parse(data))
23
+ } else {
21
24
  getComment()
22
25
  }
23
26
  }
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
- }))
27
+
28
+ const getComment = async () => {
29
+ try {
30
+ const res = await fetch('!{theme.comment.waline.envId}/api/comment?type=recent&count=8', {method: 'GET'})
31
+ const result = await res.json()
32
+ const walineArray = result.data.map(e => {
33
+ return {
34
+ 'content': changeContent(e.comment),
35
+ 'avatar': e.avatar,
36
+ 'nick': e.nick,
37
+ 'url': e.url + '#' + e.objectId,
38
+ 'date': e.time || e.insertedAt
39
+ }
40
+ })
41
+ saveToLocal.set('waline-newest-comment', JSON.stringify(walineArray), !{theme.comment.newest_comment.storage} / (60 * 24))
38
42
  generateHtml(walineArray)
39
- }).catch(
40
- $asideList.innerHTML = "无法获取评论,请确认相关配置是否正确"
41
- )
43
+ } catch (err) {
44
+ console.error(err)
45
+ $asideList.textContent = "!{_p('newest_comment.error')}"
46
+ }
42
47
  }
43
48
 
44
49
  const generateHtml = array => {
@@ -54,9 +59,9 @@ script.
54
59
  <time class="datetime" datetime="${item.date}"></time>
55
60
  </div>
56
61
  </div>
57
- `).join('') : '没有评论'
62
+ `).join('') : "!{_p('newest_comment.zero')}"
58
63
  window.lazyLoadInstance && window.lazyLoadInstance.update()
59
- window.pjax && window.pjax.refresh($dom)
64
+ window.pjax && window.pjax.refresh()
60
65
  utils && utils.changeTimeFormat()
61
66
  }
62
67
 
package/layout/page.pug CHANGED
@@ -25,6 +25,9 @@ block content
25
25
  != page.content
26
26
  when 'music'
27
27
  include includes/page/music
28
+ when 'banner'
29
+ include includes/widgets/page/banner
30
+ include includes/page/default
28
31
  default
29
32
  include includes/page/default
30
33
  if page.comment
package/layout/tag.pug CHANGED
@@ -10,7 +10,7 @@ block content
10
10
  | #{tag.name}
11
11
  span.tagsPageCount #{tag.length}
12
12
  .recent-posts#recent-posts
13
- each post in page.posts.find({ parent: { $exists: false } }).data
13
+ each post,index in page.posts.find({ parent: { $exists: false } }).data
14
14
  include includes/widgets/home/postList
15
15
  include includes/mixins/pagination
16
16
  include includes/widgets/aside/aside
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the wleelw",
5
5
  "main": "package.json",
6
6
  "scripts": {
package/plugins.yml CHANGED
@@ -15,10 +15,18 @@ twikoo:
15
15
  file: dist/twikoo.all.min.js
16
16
  version: 1.6.31
17
17
  waline_js:
18
- name: '@waline/client'
18
+ name: 'waline'
19
19
  file: dist/waline.js
20
20
  other_name: waline
21
- version: 2.15.8
21
+ version: 3.1.3
22
+ waline_css:
23
+ name: 'waline'
24
+ file: dist/waline.css
25
+ version: 3.1.3
26
+ valine:
27
+ name: valine
28
+ file: dist/Valine.min.js
29
+ version: 1.5.1
22
30
  sharejs:
23
31
  name: butterfly-extsrc
24
32
  file: sharejs/dist/js/social-share.min.js
@@ -97,4 +105,8 @@ fancyapps_css:
97
105
  mermaid_js:
98
106
  name: mermaid
99
107
  file: dist/mermaid.min.js
100
- version: 10.8.0
108
+ version: 10.8.0
109
+ blueimp_md5:
110
+ name: blueimp-md5
111
+ file: js/md5.min.js
112
+ version: 2.19.0
@@ -44,11 +44,6 @@ hexo.extend.filter.register('before_generate', () => {
44
44
  file: 'js/covercolor/api.js',
45
45
  version
46
46
  },
47
- rightside_js: {
48
- name: 'hexo-theme-solitude',
49
- file: 'js/rightside.js',
50
- version
51
- },
52
47
  music_js: {
53
48
  name: 'hexo-theme-solitude',
54
49
  file: 'js/music.js',
@@ -59,19 +54,24 @@ hexo.extend.filter.register('before_generate', () => {
59
54
  file: 'js/tw_cn.js',
60
55
  version
61
56
  },
62
- sco_ai_js: {
57
+ efu_ai: {
63
58
  name: 'hexo-theme-solitude',
64
- file: 'js/third_party/sco-ai.min.js',
59
+ file: 'js/third_party/efu_ai.min.js',
65
60
  version
66
61
  },
67
62
  twikoo_commentBarrage: {
68
63
  name: 'hexo-theme-solitude',
69
- file: 'js/comment/twikoo_commentBarrage.js',
64
+ file: 'js/commentBarrage/twikoo.js',
70
65
  version
71
66
  },
72
67
  waline_commentBarrage: {
73
68
  name: 'hexo-theme-solitude',
74
- file: 'js/comment/waline_commentBarrage.js',
69
+ file: 'js/commentBarrage/waline.js',
70
+ version
71
+ },
72
+ valine_commentBarrage: {
73
+ name: 'hexo-theme-solitude',
74
+ file: 'js/commentBarrage/valine.js',
75
75
  version
76
76
  },
77
77
  waterfall: {
@@ -5,13 +5,15 @@ hexo.extend.filter.register('before_generate', () => {
5
5
  const logger = hexo.log;
6
6
  const config = hexo.config;
7
7
 
8
- if (hexoVer < 6.3) {
9
- logger.error('请把 Hexo 升级到 V6.3.0 或更高的版本!');
8
+ if (hexoVer < 7.0) {
9
+ logger.error('请把 Hexo 升级到 V7.0.0 或更高的版本!');
10
+ logger.error('Please upgrade your Hexo to V7.0.0 or higher!');
10
11
  process.exit(-1);
11
12
  }
12
13
 
13
14
  if (Number(majorVer) < 14) {
14
15
  logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!');
16
+ logger.error('Please upgrade Node.js to v14.0.0 or later!');
15
17
  process.exit(-1);
16
18
  }
17
19
  });
@@ -129,7 +129,8 @@ hexo.extend.filter.register('before_generate', () => {
129
129
  randompostjs: 'https://cdn.cbd.int/st-source/js/moment/random_post.min.js'
130
130
  }, keyboard: {
131
131
  enable: false, list: []
132
- }, lazyload: {
132
+ }
133
+ ,lazyload: {
133
134
  enable: false, field: 'site', placeholder: '/img/loading.gif', errorimg: '/img/error_load.png'
134
135
  }, loading: {
135
136
  fullpage: false, pace: true,
@@ -137,7 +138,7 @@ hexo.extend.filter.register('before_generate', () => {
137
138
  enable: true, limit: 200, copy: true, expand: true, theme: 'default', color: 'default',
138
139
  }, lightbox: false, fancybox: false, mediumZoom: false, mermaid: false, translate: {
139
140
  enable: false, defaultEncoding: 2, translateDelay: 0,
140
- }, opengraph: {
141
+ }, OpenGraph: {
141
142
  enable: false, options: null
142
143
  }, wordcount: false, busuanzi: false, search: {
143
144
  enable: false, type: 'local', tags: [], algolia: null, local: {
@@ -145,7 +146,15 @@ hexo.extend.filter.register('before_generate', () => {
145
146
  }
146
147
  }, rightside: {
147
148
  enable: false
148
- }, post_ai: {
149
+ },
150
+ copy: {
151
+ enable: true,
152
+ copyright: {
153
+ enable: false,
154
+ limit: 50
155
+ }
156
+ }
157
+ , post_ai: {
149
158
  enable: false,
150
159
  modelName: 'GPT 3',
151
160
  key: 'your key',
@@ -156,7 +165,7 @@ hexo.extend.filter.register('before_generate', () => {
156
165
  enable: false, per_page: false, copytex: false,
157
166
  }, comment: {
158
167
  enable: false,
159
- type: 'twikoo',
168
+ type: '',
160
169
  commentBarrage: false,
161
170
  newComment: false,
162
171
  randomInfoStart: [`baby's`, `little`, `my`,],
@@ -172,8 +181,8 @@ hexo.extend.filter.register('before_generate', () => {
172
181
  font: {
173
182
  'font-size': '16px',
174
183
  'code-font-size': '16px',
175
- 'font-family': '"PingFang SC","Hiragino Sans GB","Microsoft YaHei"',
176
- 'code-font-family': '"monospace", "monospace"',
184
+ 'font-family': 'PingFang SC, Hiragino Sans GB,Microsoft YaHei',
185
+ 'code-font-family': 'monospace, monospace',
177
186
  },
178
187
  extends: {
179
188
  head: [], body: [],