hexo-theme-solitude 1.6.1 → 1.7.1

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 (47) 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 +30 -15
  6. package/languages/en.yml +20 -2
  7. package/languages/zh-CN.yml +25 -1
  8. package/languages/zh-TW.yml +25 -1
  9. package/layout/category.pug +1 -1
  10. package/layout/includes/console.pug +8 -7
  11. package/layout/includes/head/config.pug +66 -40
  12. package/layout/includes/inject/body.pug +7 -3
  13. package/layout/includes/inject/head.pug +35 -1
  14. package/layout/includes/widgets/post/copyright.pug +5 -5
  15. package/layout/includes/widgets/post/postMeta.pug +8 -1
  16. package/layout/includes/widgets/third-party/comments/comment.pug +5 -7
  17. package/layout/includes/widgets/third-party/comments/valine.pug +44 -0
  18. package/layout/includes/widgets/third-party/comments/waline.pug +40 -12
  19. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +5 -3
  20. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +12 -10
  21. package/layout/includes/widgets/third-party/news-comment/valine.pug +79 -0
  22. package/layout/includes/widgets/third-party/news-comment/waline.pug +25 -20
  23. package/layout/page.pug +3 -0
  24. package/layout/tag.pug +1 -1
  25. package/package.json +1 -1
  26. package/plugins.yml +15 -3
  27. package/scripts/event/cdn.js +7 -2
  28. package/scripts/event/init.js +4 -2
  29. package/scripts/event/merge_config.js +6 -5
  30. package/scripts/helper/related_post.js +2 -2
  31. package/scripts/tags/tabs.js +1 -1
  32. package/source/css/_comments/{index.styl → comment.styl} +4 -24
  33. package/source/css/_comments/valine.styl +245 -0
  34. package/source/css/_global/index.styl +3 -0
  35. package/source/css/_highlight/highlight/index.styl +1 -1
  36. package/source/css/_page/index.styl +1 -4
  37. package/source/css/_post/content.styl +13 -7
  38. package/source/css/_post/copyright.styl +4 -1
  39. package/source/css/index.styl +1 -3
  40. package/source/js/commentBarrage/twikoo.js +4 -4
  41. package/source/js/commentBarrage/valine.js +156 -0
  42. package/source/js/commentBarrage/waline.js +3 -3
  43. package/source/js/main.js +28 -33
  44. package/source/js/third_party/efu_ai.min.js +6 -0
  45. package/source/js/utils.js +14 -1
  46. package/source/css/_comments/waline.styl +0 -455
  47. package/source/js/third_party/sco-ai.min.js +0 -8
package/README.md CHANGED
@@ -35,7 +35,7 @@
35
35
  [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude)
36
36
  [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude)
37
37
 
38
- [Preview](https://solitude-demo.efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
38
+ [Preview](https://efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
39
39
 
40
40
  </div>
41
41
 
package/README_zh-cn.md CHANGED
@@ -35,7 +35,7 @@
35
35
  [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude)
36
36
  [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude)
37
37
 
38
- [预览](https://solitude-demo.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
38
+ [预览](https://efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
39
39
 
40
40
  </div>
41
41
 
package/README_zh-tw.md CHANGED
@@ -35,7 +35,7 @@
35
35
  [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude)
36
36
  [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude)
37
37
 
38
- [預覽](https://solitude-demo.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
38
+ [預覽](https://efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
39
39
 
40
40
  </div>
41
41
 
package/SECURITY.md CHANGED
@@ -1,9 +1,9 @@
1
- # 安全策略
1
+ # Security Policy
2
2
 
3
- ## 报告漏洞
3
+ ## Report a vulnerability
4
4
 
5
- 要报告漏洞,请在正确的 GitHub 存储库上 [通过安全选项卡私下报告](https://github.com/valor-x/hexo-theme-solitude/security/advisories/new)(请参阅 [文档](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability))。如果无法报告,请随时发送电子邮件至 **o@efu.me**。
5
+ To report a vulnerability, please [report privately via security tab](https://github.com/valor-x/hexo-theme-solitude/security/advisories/new) on the correct GitHub repository (see [Document](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability)). If you are unable to report, please feel free to email us at o@efu.me.
6
6
 
7
- 所有安全漏洞都将得到及时验证和解决。
7
+ All security vulnerabilities will be verified and resolved in a timely manner.
8
8
 
9
- 虽然发现新漏洞的情况很少见,但建议始终使用最新版本的主题和其他依赖项,通过维护锁定文件(`yarn.lock`、`package-lock.json`),以保证尽可能安全。
9
+ While it is rare for new vulnerabilities to be discovered, it is recommended to always use the latest version of the theme and other dependencies by maintaining locked files (`yarn.lock`, `package-lock.json`) to ensure that they are as secure as possible.
package/_config.yml CHANGED
@@ -295,7 +295,7 @@ aside:
295
295
  # Configure information on the home page
296
296
  index_post_list:
297
297
  direction: column # row / column
298
- content: 3 # 1: post.description / 2: 自动获取description或截取内容(Automatically get descriptions or screenshots) / 3: 只使用截取内容(Use only screenshots) / false: 不显示内容(No content is displayed)
298
+ content: false # 1: post.description / 2: 自动获取description或截取内容(Automatically get descriptions or screenshots) / 3: 只使用截取内容(Use only screenshots) / false: 不显示内容(No content is displayed)
299
299
  length: 500 # 截取内容的长度 : The length of the screenshot content
300
300
  cover: both # left: 在左侧 : left / right: 在右侧 : right / both: 两侧 : both
301
301
 
@@ -568,6 +568,14 @@ keyboard:
568
568
  # key: L
569
569
  # url: "/links/"
570
570
 
571
+ # 复制
572
+ # Copy
573
+ copy:
574
+ enable: true
575
+ copyright: # Turn on Link copyright information after copying.(开启后将在默认增加版权信息)
576
+ enable: false
577
+ limit: 50 # word count. (字数)
578
+
571
579
  # 懒加载
572
580
  # lazyload
573
581
  lazyload:
@@ -701,17 +709,11 @@ comment:
701
709
  enable: false
702
710
  type: # waline, twikoo
703
711
  commentBarrage: false # 热评开关 / Hot comment switch
704
- newComment: false # 最新评论开关 / Latest comment switch
705
- # 匿名评论前部分随机信息 / Anonymous comment front random information
706
- randomInfoStart:
707
- - "聪敏的"
708
- - "可爱的"
709
- - "美丽的"
710
- # 匿名评论后部分随机信息 / Anonymous comment after random information
711
- randomInfoEnd:
712
- - "白菜"
713
- - "小可爱"
714
- - "小仙女"
712
+ lazyload: true # 懒加载
713
+ count: true # 评论数展示
714
+ newest_comment:
715
+ enable: false
716
+ storage: 421000 # 缓存时间
715
717
  # twikoo 配置信息
716
718
  # twikoo settings
717
719
  twikoo: # https://twikoo.js.org/
@@ -722,8 +724,21 @@ comment:
722
724
  # waline settings
723
725
  waline: # https://waline.js.org/
724
726
  envId: # url: https://waline.wzsco.top
725
- pageview: true # 是否开启页面访问量统计 / Whether to enable page access statistics
727
+ pageview: false # 是否开启页面访问量统计 / Whether to enable page access statistics
726
728
  option: # waline配置项 / waline configuration item
729
+ # valine 配置信息
730
+ # valine settings
731
+ valine:
732
+ appId: # leancloud application app id
733
+ appKey: # leancloud application app key
734
+ serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
735
+ avatar:
736
+ visitor: false
737
+ option: # options list
738
+
739
+
740
+ # 中控台扩展 : 最新评论 + 标签 + 文章
741
+ console_plus: false
727
742
 
728
743
  # 站点验证
729
744
  # Site verification
@@ -748,8 +763,8 @@ css_prefix: false
748
763
  font:
749
764
  font-size: 16px
750
765
  code-font-size: 16px
751
- font-family: '"PingFang SC","Hiragino Sans GB","Microsoft YaHei"'
752
- code-font-family: '"monospace", "monospace"'
766
+ font-family: 'PingFang SC,Hiragino Sans GB,Microsoft YaHei'
767
+ code-font-family: 'monospace, monospace'
753
768
 
754
769
  # 插入代码到头部 </head> 之前 和 底部 </body> 之前
755
770
  # Insert code before </head> and before </body>
package/languages/en.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  more: More
2
+ star: Behold, those who found delight in this piece also perused
3
+ random: Around
2
4
 
3
5
  theme:
4
6
  dark: dark
@@ -46,7 +48,7 @@ home:
46
48
  post:
47
49
  reprint: Reprint
48
50
  original: Original
49
- copyright: This article is a ${cc} article, pay attention to the copyright.
51
+ cc: This article is a ${cc} article, pay attention to the copyright.
50
52
  posted: Posted on
51
53
  updated: Last updated on
52
54
  wordcount: Word count
@@ -54,6 +56,10 @@ post:
54
56
  ip: The author's IP belongs to
55
57
  pv: PV
56
58
  comment: Comments
59
+ copyright:
60
+ reprint: This article is a reproduction or translation, and the copyright belongs to the original author. Please contact the original author for permission to republish this article.
61
+ original: This piece of writing is an original article, utilizing the
62
+ original_end: Agreement. For complete reproduction, please acknowledge the source as Courtesy of
57
63
 
58
64
  nav:
59
65
  site_name_title: Back to home
@@ -130,4 +136,16 @@ link:
130
136
  random: You are about to ⌈ ${name} ⌋ , security unknown.
131
137
 
132
138
  keyboard:
133
- title: Blog shortcuts
139
+ title: Blog shortcuts
140
+
141
+ newest_comment:
142
+ error: Unable to get a comment, please confirm that the relevant configuration is correct.
143
+ zero: No comments.
144
+
145
+ comment:
146
+ title: ' Comment'
147
+
148
+ commentBarrage:
149
+ title: Hot
150
+
151
+ f12: Developer mode is turned on, please follow the GPL.
@@ -1,4 +1,6 @@
1
1
  more: 更多
2
+ star: 喜欢这篇的人也看了
3
+ random: 随便逛逛
2
4
 
3
5
  # Language: 简体中文
4
6
  theme:
@@ -9,6 +11,12 @@ copy:
9
11
  success: 复制成功
10
12
  error: 复制失败
11
13
 
14
+ copy_copyright:
15
+ author: 作者
16
+ link: 链接
17
+ source: 来源
18
+ info: 著作权归作者所有。 商业转载请联系作者获得授权,非商业转载请注明出处。
19
+
12
20
  lately:
13
21
  second: 秒
14
22
  minute: 分钟
@@ -58,6 +66,10 @@ post:
58
66
  ip: 作者IP归属地为
59
67
  pv: 文章热度
60
68
  comment: 评论数
69
+ copyright:
70
+ reprint: 本文是转载或翻译文章,版权归原作者所有。转载本文请联系原作者。
71
+ original: 本文是原创文章,采用
72
+ original_end: 协议,完整转载请注明来自
61
73
 
62
74
  award:
63
75
  thanks: 致谢
@@ -125,4 +137,16 @@ link:
125
137
  random: 您即将前往 ⌈ ${name} ⌋ , 安全性未知
126
138
 
127
139
  keyboard:
128
- title: 博客快捷键
140
+ title: 博客快捷键
141
+
142
+ newest_comment:
143
+ error: 无法获取评论,请确认相关配置是否正确。
144
+ zero: 没有评论
145
+
146
+ comment:
147
+ title: 评论
148
+
149
+ commentBarrage:
150
+ title: 热评
151
+
152
+ f12: 开发者模式已打开,请遵循GPL协议。
@@ -1,4 +1,6 @@
1
1
  more: 更多
2
+ star: 喜歡這篇的人也看了
3
+ random: 随便逛逛
2
4
 
3
5
  # Language: 繁體中文 (台灣)
4
6
  theme:
@@ -9,6 +11,12 @@ copy:
9
11
  success: 複製成功
10
12
  error: 複製失敗
11
13
 
14
+ copy_copyright:
15
+ author: 作者
16
+ link: 連結
17
+ source: 來源
18
+ info: 著作權歸作者所有。 商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
19
+
12
20
  lately:
13
21
  second: 秒
14
22
  minute: 分鐘
@@ -58,6 +66,10 @@ post:
58
66
  ip: 作者IP歸屬地為
59
67
  pv: 文章熱度
60
68
  comment: 評論數
69
+ copyright:
70
+ reprint: 本文是转载或翻译文章,版权归原作者所有。转载本文请联系原作者。
71
+ original: 本文是原创文章,采用
72
+ original_end: 协议,完整转载请注明来自
61
73
 
62
74
  award:
63
75
  thanks: 致謝
@@ -125,4 +137,16 @@ link:
125
137
  random: 您即將前往 ⌈ ${name} ⌋ , 安全性未知
126
138
 
127
139
  keyboard:
128
- title: 博客快捷鍵
140
+ title: 博客快捷鍵
141
+
142
+ newest_comment:
143
+ error: 無法獲取評論,請確認相關配置是否正確。
144
+ zero: 沒有評論
145
+
146
+ comment:
147
+ title: 評論
148
+
149
+ commentBarrage:
150
+ title: 熱評
151
+
152
+ f12: 開發者模式已打開,請遵循GPL協定。
@@ -6,7 +6,7 @@ block content
6
6
  #category-bar
7
7
  include includes/widgets/home/categoryBar
8
8
  .recent-posts#recent-posts
9
- each post in page.posts.find({ parent: { $exists: false } }).data
9
+ each post,index in page.posts.find({ parent: { $exists: false } }).data
10
10
  include includes/widgets/home/postList
11
11
  include includes/mixins/pagination
12
12
  include includes/widgets/aside/aside
@@ -1,14 +1,15 @@
1
1
  div#console
2
2
  div.close-btn(onclick="sco.hideConsole()")
3
3
  i.solitude.st-close-fill
4
- if theme.comment.newComment
4
+ if theme.console_plus
5
5
  div.console-card-group
6
- div.console-card-group-left
7
- div.console-card#card-newest-comments(onclick="sco.hideConsole()")
8
- div.card-content
9
- div.author-content-item-tips= _p('console.comment_tip')
10
- div.author-content-item-title= _p('console.comment_title')
11
- div.aside-list
6
+ if theme.console_plus && theme.comment.newest_comment.enable
7
+ div.console-card-group-left
8
+ div.console-card#card-newest-comments(onclick="sco.hideConsole()")
9
+ div.card-content
10
+ div.author-content-item-tips= _p('console.comment_tip')
11
+ div.author-content-item-title= _p('console.comment_title')
12
+ div.aside-list
12
13
 
13
14
  div.console-card-group-right
14
15
  div.console-card.tags(onclick="sco.hideConsole()")
@@ -22,30 +22,69 @@
22
22
  }
23
23
  }
24
24
 
25
- let translate = 'undefined';
26
- if (theme.translate && theme.translate.enable) {
27
- translate = JSON.stringify({
28
- defaultEncoding: theme.translate.defaultEncoding,
29
- translateDelay: theme.translate.translateDelay,
30
- });
25
+ const sayhello2 = theme.aside?.card?.sayhello2?.map(item => `"${item}"`) || [];
26
+
27
+ let comment = false
28
+
29
+ if (theme.comment.type === 'twikoo') {
30
+ comment = JSON.stringify({
31
+ avatar: theme.comment.avatar,
32
+ url: theme.comment.twikoo.envId,
33
+ commentBarrage: theme.comment.enable,
34
+ accessToken: theme.comment.twikoo.accessToken,
35
+ owo: {
36
+ body: '.OwO-body',
37
+ item: '.OwO-items li'
38
+ }
39
+ })
31
40
  }
32
41
 
33
- let copyright = 'undefined';
34
- if (theme.copy.enable && theme.copy.copyright.enable) {
35
- copyright = JSON.stringify({
36
- limitCount: theme.copy.copyright.limit_count,
37
- languages: {
38
- author: _p("copy_copyright.author") + ': ' + config.author,
39
- link: _p("copy_copyright.link") + ': ',
40
- source: _p("copy_copyright.source") + ': ' + config.title,
41
- info: _p("copy_copyright.info")
42
+ if (theme.comment.type === 'waline') {
43
+ comment = JSON.stringify({
44
+ avatar: theme.comment.avatar,
45
+ url: theme.comment.waline.envId,
46
+ commentBarrage: theme.comment.enable,
47
+ owo: {
48
+ body: '.wl-emoji-popup',
49
+ item: '.wl-tab-wrapper button'
42
50
  }
43
51
  })
44
52
  }
45
53
 
46
- const commentInfoStart = theme.comment.randomInfoStart.map(item => `"${item}"`) || [];
47
- const commentInfoEnd = theme.comment.randomInfoEnd.map(item => `"${item}"`) || [];
48
- const sayhello2 = theme.aside.card.sayhello2.map(item => `"${item}"`) || [];
54
+ if (theme.comment.type === 'valine') {
55
+ comment = JSON.stringify({
56
+ avatar: theme.comment.avatar,
57
+ url: theme.comment.valine.serverURLs,
58
+ commentBarrage: theme.comment.enable,
59
+ appId: theme.comment.valine.appId,
60
+ appKey: theme.comment.valine.appKey,
61
+ owo: {
62
+ body: '.vwrap',
63
+ item: '.vemojis i'
64
+ }
65
+ })
66
+ }
67
+
68
+ let post_ai = false
69
+
70
+ if (theme.post_ai.enable) {
71
+ post_ai = JSON.stringify({
72
+ key: theme.post_ai.key,
73
+ talk: theme.post_ai.talk,
74
+ randomPost: theme.post_ai.randomPost,
75
+ })
76
+ }
77
+
78
+ let copyright = false;
79
+ if (theme.copy.enable && theme.copy.copyright.enable) {
80
+ copyright = JSON.stringify({
81
+ limit: theme.copy.copyright.limit,
82
+ author: _p("copy_copyright.author") + ': ' + config.author,
83
+ link: _p("copy_copyright.link") + ': ',
84
+ source: _p("copy_copyright.source") + ': ' + config.title,
85
+ info: _p("copy_copyright.info")
86
+ })
87
+ }
49
88
 
50
89
  script.
51
90
  const GLOBAL_CONFIG = {
@@ -57,6 +96,7 @@ script.
57
96
  enable: !{theme.lazyload.enable},
58
97
  error: '!{theme.lazyload.errorimg}'
59
98
  },
99
+ copyright: !{copyright},
60
100
  highlight: {
61
101
  enable: !{theme.highlight.enable},
62
102
  limit: !{theme.highlight.limit},
@@ -64,7 +104,7 @@ script.
64
104
  copy: !{theme.highlight.copy},
65
105
  syntax: '!{config.syntax_highlighter}'
66
106
  },
67
- randomlinks: !{theme.footer.randomlink},
107
+ randomlink: !{theme.footer.randomlink},
68
108
  lang: {
69
109
  theme: {
70
110
  dark: '!{_p('theme.dark')}',
@@ -93,7 +133,11 @@ script.
93
133
  chs: {
94
134
  chs_to_cht: '!{_p('chs.chs_tw')}',
95
135
  cht_to_chs: '!{_p('chs.chs_cn')}',
96
- }
136
+ },
137
+ barrage: {
138
+ title: '!{_p('commentBarrage.title')}',
139
+ },
140
+ f12: '!{_p('f12')}',
97
141
  },
98
142
  aside: {
99
143
  sayhello: {
@@ -108,25 +152,7 @@ script.
108
152
  covercolor: {
109
153
  enable: !{theme.post.covercolor.enable}
110
154
  },
111
- comment: {
112
- enable: !{theme.comment.enable},
113
- type: '!{theme.comment.type}',
114
- commentBarrage: !{theme.comment.commentBarrage && theme.comment.enable},
115
- randomInfoStart: [!{commentInfoStart}],
116
- randomInfoEnd: [!{commentInfoEnd}],
117
- twikoo: {
118
- url: '!{theme.comment.twikoo.envId}',
119
- accessToken: '!{theme.comment.twikoo.accessToken}'
120
- },
121
- waline: {
122
- url: '!{theme.comment.waline.envId}',
123
- }
124
- },
155
+ comment: !{comment},
125
156
  lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}',
126
- ai: {
127
- enable: !{theme.post_ai.enable},
128
- key: '!{theme.post_ai.key}',
129
- talk: "!{theme.post_ai.talk}",
130
- randomPost: !{theme.post_ai.randomPost},
131
- }
157
+ post_ai: !{post_ai}
132
158
  };
@@ -14,6 +14,10 @@ div
14
14
  script(src=url_for(theme.cdn.main))
15
15
  script(src=url_for(theme.cdn.utils))
16
16
 
17
+ if theme.comment.enable && theme.comment.type === 'valine'
18
+ // md5
19
+ script(src=url_for(theme.cdn.blueimp_md5))
20
+
17
21
  // lately
18
22
  script(src=url_for(theme.cdn.lately_js))
19
23
 
@@ -47,7 +51,7 @@ div
47
51
  script(src=url_for(theme.cdn.swiper_js))
48
52
 
49
53
  if theme.post_ai.enable
50
- script(src=url_for(theme.cdn.sco_ai_js))
54
+ script(src=url_for(theme.cdn.efu_ai))
51
55
 
52
56
  if theme.capsule.enable || theme.music.enable
53
57
  script(src=url_for(theme.cdn.aplayer_js))
@@ -74,14 +78,14 @@ div
74
78
  case theme.comment.type
75
79
  when 'twikoo'
76
80
  script(src=url_for(theme.cdn.twikoo))
77
- when 'waline'
78
- script(src=url_for(theme.cdn.waline_js))
79
81
  if theme.comment.commentBarrage
80
82
  case theme.comment.type
81
83
  when 'twikoo'
82
84
  script(src=url_for(theme.cdn.twikoo_commentBarrage))
83
85
  when 'waline'
84
86
  script(src=url_for(theme.cdn.waline_commentBarrage))
87
+ when 'valine'
88
+ script(src=url_for(theme.cdn.valine_commentBarrage))
85
89
 
86
90
  if theme.music.enable
87
91
  script(src=url_for(theme.cdn.music_js))
@@ -73,11 +73,45 @@ script.
73
73
  document.documentElement.classList.remove('hide-aside')
74
74
  }
75
75
  }
76
+
77
+ win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
78
+ const link = document.createElement('link')
79
+ link.rel = 'stylesheet'
80
+ link.href = url
81
+ if (id) link.id = id
82
+ link.onerror = reject
83
+ link.onload = link.onreadystatechange = function () {
84
+ const loadState = this.readyState
85
+ if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
86
+ link.onload = link.onreadystatechange = null
87
+ resolve()
88
+ }
89
+ document.head.appendChild(link)
90
+ })
91
+
92
+ win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
93
+ const script = document.createElement('script')
94
+ script.src = url
95
+ script.async = true
96
+ script.onerror = reject
97
+ script.onload = script.onreadystatechange = function () {
98
+ const loadState = this.readyState
99
+ if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
100
+ script.onload = script.onreadystatechange = null
101
+ resolve()
102
+ }
103
+
104
+ Object.keys(attr).forEach(key => {
105
+ script.setAttribute(key, attr[key])
106
+ })
107
+
108
+ document.head.appendChild(script)
109
+ })
76
110
  }
77
111
  )(window)
78
112
 
79
113
  console.log(
80
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.6.1",
114
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.7.1",
81
115
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
82
116
  "padding: 5px 10px;color:white;background:#3e9f50;",
83
117
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -11,17 +11,17 @@
11
11
  include ./award
12
12
  if theme.post.rss
13
13
  .reward-link.mode
14
- a.reward-link-button(href=url_for(theme.post.rss), title="订阅")
14
+ a.reward-link-button(href=url_for(theme.post.rss))
15
15
  i.solitude.st-plant-fill
16
- | 订阅
16
+ = _p('footer.rss')
17
17
  if theme.post.default.copyright.enable || page.copyright
18
18
  .post-copyright__notice
19
19
  span.post-copyright-info
20
20
  if page.reprint
21
- | 本文是转载或翻译文章,版权归原作者所有。转载本文请联系原作者。
21
+ = _p('post.copyright.reprint')
22
22
  else
23
- | 本文是原创文章,采用
23
+ = _p('post.copyright.original')
24
24
  a(href=url_for(theme.post.default.copyright.licenurl))
25
25
  | #{theme.post.default.copyright.license}
26
- | 协议,完整转载请注明来自
26
+ = _p('post.copyright.original_end')
27
27
  a(href=url_for("/")) #{config.title}
@@ -4,7 +4,7 @@
4
4
  #post-firstinfo
5
5
  .meta-firstline
6
6
  - var cc = page.reprint ? _p('post.reprint') : _p('post.original')
7
- a.post-meta-original(title=_p('post.copyright').replace(/\$\{cc}/, cc))= cc
7
+ a.post-meta-original(title=_p('post.cc').replace(/\$\{cc}/, cc))= cc
8
8
  if page.categories.data.length > 0
9
9
  span.post-meta-categories
10
10
  a.post-meta-categories(href=url_for('/' + page.categories.data[0].path))= page.categories.data[0].name
@@ -48,6 +48,10 @@
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
@@ -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
@@ -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})
@@ -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
+ }