hexo-theme-solitude 1.7.14 → 1.8.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 (33) hide show
  1. package/README.md +25 -25
  2. package/{README_zh-cn.md → README_en.md} +25 -25
  3. package/README_zh-tw.md +3 -3
  4. package/_config.yml +41 -34
  5. package/layout/includes/body/mode.pug +6 -3
  6. package/layout/includes/head/config.pug +0 -33
  7. package/layout/includes/head/page_config.pug +9 -0
  8. package/layout/includes/head.pug +4 -1
  9. package/layout/includes/inject/body.pug +1 -26
  10. package/layout/includes/inject/head.pug +11 -60
  11. package/layout/includes/widgets/post/postMeta.pug +24 -24
  12. package/layout/includes/widgets/third-party/comments/artalk.pug +29 -18
  13. package/layout/includes/widgets/third-party/comments/comment.pug +48 -12
  14. package/layout/includes/widgets/third-party/comments/twikoo.pug +61 -39
  15. package/layout/includes/widgets/third-party/comments/valine.pug +36 -38
  16. package/layout/includes/widgets/third-party/comments/waline.pug +39 -44
  17. package/layout/includes/widgets/third-party/news-comment/artalk.pug +57 -67
  18. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -6
  19. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +41 -48
  20. package/layout/includes/widgets/third-party/news-comment/valine.pug +5 -5
  21. package/layout/includes/widgets/third-party/news-comment/waline.pug +3 -3
  22. package/layout/includes/widgets/third-party/pjax.pug +1 -0
  23. package/package.json +1 -1
  24. package/plugins.yml +2 -2
  25. package/scripts/event/merge_config.js +280 -255
  26. package/scripts/filter/comment.js +13 -0
  27. package/source/css/_comments/comment.styl +73 -12
  28. package/source/css/_comments/valine.styl +1 -1
  29. package/source/css/_highlight/index.styl +1 -0
  30. package/source/css/_tags/link.styl +7 -2
  31. package/source/js/main.js +42 -18
  32. package/source/js/tw_cn.js +3 -3
  33. package/source/js/utils.js +62 -0
@@ -1,282 +1,307 @@
1
1
  hexo.extend.filter.register('before_generate', () => {
2
- const defaultConfig = {
3
- site: {
4
- name: {
5
- class: 'text', custom: 'Solitude'
6
- }, siteIcon: '/img/pwa/favicon.ico', icon: 'icon'
7
- },
8
- nav: {
9
- group: null, menu: null, right: {
10
- random: false, console: false, custom: [],
11
- }
12
- },
13
- hometop: {
14
- enable: false, banner: {
15
- title: 'Solitude', url: 'A simple theme for Hexo', icon: null,
16
- }, group: null, recommendList: {
17
- sup: 'Recommend',
18
- title: 'Solitude Docs',
19
- url: 'https://solitude-docs.efu.me/',
20
- img: '/img/default.png',
21
- color: 'none',
22
- }
23
- },
24
- aside: {
25
- home: {
26
- noSticky: 'about', Sticky: 'allInfo'
2
+ const defaultConfig = {
3
+ site: {
4
+ name: {
5
+ class: 'text', custom: 'Solitude'
6
+ }, siteIcon: '/img/pwa/favicon.ico', icon: 'icon'
27
7
  },
28
- post: {
29
- noSticky: 'about', Sticky: 'allInfo'
8
+ nav: {
9
+ group: null, menu: null, right: {
10
+ random: false, console: false, custom: [],
11
+ }
12
+ },
13
+ hometop: {
14
+ enable: false,
15
+ banner: {
16
+ title: 'Solitude',
17
+ url: 'A simple theme for Hexo',
18
+ icon: null,
19
+ },
20
+ group: null,
21
+ recommendList: {
22
+ sup: 'Recommend',
23
+ title: 'Solitude Docs',
24
+ url: 'https://solitude-docs.efu.me/',
25
+ img: '/img/default.png',
26
+ color: 'none',
27
+ }
28
+ },
29
+ aside: {
30
+ home: {
31
+ noSticky: 'about', Sticky: 'allInfo'
32
+ },
33
+ post: {
34
+ noSticky: 'about', Sticky: 'allInfo'
35
+ },
36
+ page: {
37
+ noSticky: 'about', Sticky: 'allInfo'
38
+ },
39
+ card: {
40
+ author: {
41
+ img: '/img/logo.png', sticker: '/img/happy-sticker.png',
42
+ },
43
+ url: '/about/',
44
+ content1: 'Solitude',
45
+ content2: 'A simple theme for Hexo',
46
+ sayhello: {
47
+ morning: 'Good Morning',
48
+ noon: 'Good Noon',
49
+ afternoon: 'Good Afternoon',
50
+ night: 'Good Night',
51
+ goodnight: 'Good Night',
52
+ },
53
+ sayhello2: ['Welcome to Solitude', 'A simple theme for Hexo', 'Enjoy your time', 'Have a nice day', 'Good luck'],
54
+ information: null,
55
+ },
56
+ flip: {
57
+ favicon: '',
58
+ face: '',
59
+ backface: '',
60
+ backcolor: 'var(--efu-blue)'
61
+ },
62
+ toc: {
63
+ post: true,
64
+ page: false,
65
+ vague: true,
66
+ },
67
+ tags: {
68
+ enable: true,
69
+ limit: 20,
70
+ highlight: false,
71
+ list: [],
72
+ }, archive: {
73
+ enable: true,
74
+ type: 'month'
75
+ }, siteinfo: {
76
+ postcount: true,
77
+ wordcount: false,
78
+ pv: true,
79
+ uv: true,
80
+ updatetime: true,
81
+ runtimeenable: true,
82
+ runtime: "2023-04-20 00:00:00",
83
+ },
84
+ },
85
+ index_post_list: {
86
+ direction: 'column',
87
+ content: false,
88
+ length: 500,
89
+ cover: 'both'
30
90
  },
31
91
  page: {
32
- noSticky: 'about', Sticky: 'allInfo'
92
+ error: true,
93
+ tags: true,
94
+ categories: true,
95
+ default: {
96
+ cover: ['/img/default.png'],
97
+ }
33
98
  },
34
- card: {
35
- author: {
36
- img: '/img/logo.png', sticker: '/img/happy-sticker.png',
99
+ post: {
100
+ default: {
101
+ cover: ['/img/default.png'],
102
+ locate: 'China, Changsha',
103
+ copyright: {
104
+ enable: true,
105
+ license: 'CC BY-NC-SA 4.0',
106
+ licenurl: 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
107
+ }
37
108
  },
38
- url: '/about/',
39
- content1: 'Solitude',
40
- content2: 'A simple theme for Hexo',
41
- sayhello: {
42
- morning: 'Good Morning',
43
- noon: 'Good Noon',
44
- afternoon: 'Good Afternoon',
45
- night: 'Good Night',
46
- goodnight: 'Good Night',
109
+ meta: {
110
+ date: false,
111
+ updated: false,
112
+ locate: false,
113
+ wordcount: false,
114
+ readtime: false,
115
+ pv: false,
116
+ uv: false,
117
+ comment: false,
118
+ },
119
+ award: {
120
+ enable: false,
121
+ appreciators: '/',
122
+ title: '感谢您的赞赏。',
123
+ desc: '因为有你们的支持,我才体会到写文章的价值。',
124
+ list: [],
125
+ },
126
+ rss: null,
127
+ covercolor: {
128
+ enable: false,
129
+ mode: 'local',
130
+ api: 'https://api.qjqq.cn/api/Imgcolor?img=',
131
+ time: 43200000,
132
+ }
133
+ },
134
+ theme_color: {
135
+ dark: "#ffc848",
136
+ dark_op: "#f2b94b23",
137
+ dark_op_deep: "#f2b94bdd",
138
+ dark_none: "#f2b94b00",
139
+ light: "#425AEF",
140
+ light_op: "#4259ef23",
141
+ light_op_deep: "#4259efdd",
142
+ light_none: "#4259ef01"
143
+ },
144
+ display_mode: {
145
+ type: 'auto',
146
+ universe: false
147
+ },
148
+ related_post: {
149
+ enable: false,
150
+ limit: 2,
151
+ date_type: 'created'
152
+ },
153
+ footer: {
154
+ information: {
155
+ left: null,
156
+ right: null,
47
157
  },
48
- sayhello2: ['Welcome to Solitude', 'A simple theme for Hexo', 'Enjoy your time', 'Have a nice day', 'Good luck'],
49
- information: null,
158
+ group: null,
159
+ randomlink: false,
160
+ privacy: null,
161
+ license: null,
162
+ links: [{
163
+ name: 'Solitude',
164
+ url: 'https://github.com/valor-x/hexo-theme-solitude',
165
+ }]
166
+ }, errorpage: {
167
+ img: 'https://7.isyangs.cn/34/65f2e65eae32a-34.png',
168
+ text: '404 Not Found',
169
+ recommendList: true
170
+ }, says: {
171
+ enable: false,
172
+ home_mini: false,
173
+ style: 1,
174
+ strip: 30
175
+ },
176
+ meting_api: "https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r",
177
+ music: {
178
+ enable: false,
179
+ id: '8407304077',
180
+ server: 'netease',
181
+ type: 'playlist',
182
+ volume: 0.8,
183
+ mutex: true,
50
184
  },
51
- flip: {
52
- favicon: '',
53
- face: '',
54
- backface: '',
55
- backcolor: 'var(--efu-blue)'
185
+ capsule: {
186
+ enable: false,
187
+ id: '8407304077',
188
+ server: 'netease',
189
+ type: 'playlist',
56
190
  },
57
- toc: {
58
- post: true,
59
- page: false,
60
- vague: true,
191
+ moments: {
192
+ enable: false,
193
+ api: '',
194
+ error_img: '/img/logo.png',
195
+ sort_rule: 'created',
196
+ expire_days: 1,
197
+ page_init_number: 10,
198
+ page_turning_number: 5,
199
+ angle: false,
200
+ appjs: 'https://cdn.cbd.int/st-source@1.0.3/js/fcircle.min.js',
201
+ bundlejs: 'https://cdn.cbd.int/st-source/js/moment/bundle.min.js',
202
+ randompostjs: 'https://cdn.cbd.int/st-source/js/moment/random_post.min.js'
61
203
  },
62
- tags: {
204
+ keyboard: {
205
+ enable: false,
206
+ list: []
207
+ }
208
+ , lazyload: {
209
+ enable: false,
210
+ field: 'site',
211
+ placeholder: '/img/loading.gif',
212
+ errorimg: '/img/error_load.png'
213
+ },
214
+ loading: {
215
+ fullpage: false,
216
+ pace: true,
217
+ },
218
+ highlight: {
63
219
  enable: true,
64
- limit: 20,
65
- highlight: false,
66
- list: [],
67
- }, archive: {
220
+ limit: 200,
221
+ copy: true,
222
+ expand: true,
223
+ theme: 'default',
224
+ color: 'default',
225
+ },
226
+ lightbox: false,
227
+ fancybox: false,
228
+ mediumZoom: false,
229
+ mermaid: false,
230
+ OpenGraph: {
231
+ enable: false,
232
+ options: null
233
+ },
234
+ wordcount: false,
235
+ busuanzi: false,
236
+ search: {
237
+ enable: false,
238
+ type: 'local',
239
+ tags: [],
240
+ algolia: null,
241
+ local: {
242
+ preload: false, CDN: null,
243
+ }
244
+ },
245
+ rightside: {
246
+ enable: false
247
+ },
248
+ copy: {
68
249
  enable: true,
69
- type: 'month'
70
- }, siteinfo: {
71
- postcount: true,
72
- wordcount: false,
73
- pv: true,
74
- uv: true,
75
- updatetime: true,
76
- runtimeenable: true,
77
- runtime: "2023-04-20 00:00:00",
78
- },
79
- },
80
- index_post_list: {
81
- direction: 'column',
82
- content: false,
83
- length: 500,
84
- cover: 'both'
85
- },
86
- page: {
87
- error: true,
88
- tags: true,
89
- categories: true,
90
- default: {
91
- cover: ['/img/default.png'],
92
- }
93
- },
94
- post: {
95
- default: {
96
- cover: ['/img/default.png'],
97
- locate: 'China, Changsha',
98
250
  copyright: {
99
- enable: true,
100
- license: 'CC BY-NC-SA 4.0',
101
- licenurl: 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
251
+ enable: false,
252
+ limit: 50
102
253
  }
103
254
  },
104
- meta: {
105
- date: false,
106
- updated: false,
107
- locate: false,
108
- wordcount: false,
109
- readtime: false,
110
- pv: false,
111
- uv: false,
112
- comment: false,
113
- },
114
- award: {
255
+ post_ai: {
115
256
  enable: false,
116
- appreciators: '/',
117
- title: '感谢您的赞赏。',
118
- desc: '因为有你们的支持,我才体会到写文章的价值。',
119
- list: [],
257
+ modelName: 'GPT 3',
258
+ key: 'your key',
259
+ talk: 'I am a AI.',
260
+ randomPost: false,
261
+ tips: 'AI is not perfect, please use it with caution.'
120
262
  },
121
- rss: null,
122
- covercolor: {
123
- enable: false,
124
- mode: 'local',
125
- api: 'https://api.qjqq.cn/api/Imgcolor?img=',
126
- time: 43200000,
127
- }
128
- },
129
- theme_color: {
130
- dark: "#ffc848",
131
- dark_op: "#f2b94b23",
132
- dark_op_deep: "#f2b94bdd",
133
- dark_none: "#f2b94b00",
134
- light: "#425AEF",
135
- light_op: "#4259ef23",
136
- light_op_deep: "#4259efdd",
137
- light_none: "#4259ef01"
138
- },
139
- display_mode: {
140
- type: 'auto',
141
- universe: false
142
- },
143
- related_post: {
144
- enable: false,
145
- limit: 2,
146
- date_type: 'created'
147
- },
148
- footer: {
149
- information: {
150
- left: null,
151
- right: null,
152
- },
153
- group: null,
154
- randomlink: false,
155
- privacy: null,
156
- license: null,
157
- links: [{
158
- name: 'Solitude',
159
- url: 'https://github.com/valor-x/hexo-theme-solitude',
160
- }]
161
- }, errorpage: {
162
- img: 'https://7.isyangs.cn/34/65f2e65eae32a-34.png',
163
- text: '404 Not Found',
164
- recommendList: true
165
- }, says: {
166
- enable: false,
167
- home_mini: false,
168
- style: 1,
169
- strip: 30
170
- },
171
- meting_api: "https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r",
172
- music: {
173
- enable: false,
174
- id: '8407304077',
175
- server: 'netease',
176
- type: 'playlist',
177
- volume: 0.8,
178
- mutex: true,
179
- },
180
- capsule: {
181
- enable: false,
182
- id: '8407304077',
183
- server: 'netease',
184
- type: 'playlist',
185
- },
186
- moments: {
187
- enable: false,
188
- api: '',
189
- error_img: '/img/logo.png',
190
- sort_rule: 'created',
191
- expire_days: 1,
192
- page_init_number: 10,
193
- page_turning_number: 5,
194
- angle: false,
195
- appjs: 'https://cdn.cbd.int/st-source@1.0.3/js/fcircle.min.js',
196
- bundlejs: 'https://cdn.cbd.int/st-source/js/moment/bundle.min.js',
197
- randompostjs: 'https://cdn.cbd.int/st-source/js/moment/random_post.min.js'
198
- },
199
- keyboard: {
200
- enable: false,
201
- list: []
202
- }
203
- , lazyload: {
204
- enable: false,
205
- field: 'site',
206
- placeholder: '/img/loading.gif',
207
- errorimg: '/img/error_load.png'
208
- },
209
- loading: {
210
- fullpage: false,
211
- pace: true,
212
- },
213
- highlight: {
214
- enable: true,
215
- limit: 200,
216
- copy: true,
217
- expand: true,
218
- theme: 'default',
219
- color: 'default',
220
- },
221
- lightbox: false,
222
- fancybox: false,
223
- mediumZoom: false,
224
- mermaid: false,
225
- OpenGraph: {
226
- enable: false,
227
- options: null
228
- },
229
- wordcount: false,
230
- busuanzi: false,
231
- search: {
232
- enable: false,
233
- type: 'local',
234
- tags: [],
235
- algolia: null,
236
- local: {
237
- preload: false, CDN: null,
238
- }
239
- },
240
- rightside: {
241
- enable: false
242
- },
243
- copy: {
244
- enable: true,
245
- copyright: {
263
+ katex: {
246
264
  enable: false,
247
- limit: 50
248
- }
249
- },
250
- post_ai: {
251
- enable: false,
252
- modelName: 'GPT 3',
253
- key: 'your key',
254
- talk: 'I am a AI.',
255
- randomPost: false,
256
- tips: 'AI is not perfect, please use it with caution.'
257
- },
258
- katex: {
259
- enable: false,
260
- per_page: false,
261
- copytex: false,
262
- },
263
- comment: {
264
- enable: false,
265
- type: '',
266
- commentBarrage: false,
267
- newComment: false,
268
- randomInfoStart: [`baby's`, `little`, `my`,],
269
- randomInfoEnd: [`home`, `world`, `heart`,],
265
+ per_page: false,
266
+ copytex: false,
267
+ },
268
+ comment: {
269
+ use: null,
270
+ commentBarrage: false,
271
+ lazyload: false,
272
+ count: false,
273
+ avatar: 'https://cravatar.cn',
274
+ newest_comment: {
275
+ enable: false,
276
+ storage: .2
277
+ }
278
+ },
270
279
  twikoo: {
271
280
  envId: 'your envId',
272
- lang: 'zh-CN',
281
+ region: null,
282
+ style: true,
273
283
  accessToken: null,
284
+ option: null,
274
285
  },
275
286
  waline: {
276
287
  envId: 'your envId',
277
288
  pageview: true,
278
289
  option: null,
279
290
  },
291
+ valine: {
292
+ appId: 'your appId',
293
+ appKey: 'your appKey',
294
+ serverURLs: 'your serverURLs',
295
+ avatar: 'monsterid',
296
+ visitor: false,
297
+ style: true,
298
+ option: null,
299
+ },
300
+ artalk: {
301
+ server: 'your server',
302
+ site: 'your site-name',
303
+ option: null,
304
+ },
280
305
  verify_site: [],
281
306
  css_prefix: false,
282
307
  font: {
@@ -327,6 +352,6 @@ hexo.extend.filter.register('before_generate', () => {
327
352
  }
328
353
  }
329
354
  }
330
- }
331
- hexo.theme.config = Object.assign(defaultConfig, hexo.theme.config)
332
- }, 1)
355
+ hexo.theme.config = Object.assign(defaultConfig, hexo.theme.config)
356
+ }, 1
357
+ )
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 将 use 分拆并将首字大写
3
+ */
4
+
5
+ hexo.extend.filter.register('before_generate', () => {
6
+ const themeConfig = hexo.theme.config
7
+ let { use } = themeConfig.comment
8
+ if (!use) return
9
+ if (typeof use === 'string') {
10
+ use = use.split(',').slice(0,2)
11
+ }
12
+ themeConfig.comment.use = use.map(item => item.toLowerCase().replace(/\b[a-z]/g, s => s.toUpperCase()))
13
+ })
@@ -50,10 +50,6 @@
50
50
  &::before
51
51
  transform translateX(20px)
52
52
 
53
- .comment-wrap
54
- > div:nth-child(2)
55
- display none
56
-
57
53
  .post-comment
58
54
  background var(--efu-card-bg)
59
55
 
@@ -81,26 +77,91 @@ div#post-comment
81
77
  color var(--efu-secondtext)
82
78
  border-radius 8px
83
79
 
80
+ if hexo-config('comment.use')[1]
81
+ &.move
82
+ if hexo-config('comment.count')
83
+ .comment-head
84
+ .count span:first-child
85
+ display none
86
+
87
+ .count span:last-child
88
+ display inline-block
89
+
90
+ #switch-btn::before
91
+ transform translateX(20px)
92
+
93
+ .comment-wrap
94
+ > div:first-child
95
+ display none
96
+
97
+ > div:last-child
98
+ display block
99
+ animation 0.5s ease 0s 1 normal none running tabshow
100
+
84
101
  .comment-head
85
- font-size .8em !important
102
+ font-size .8em
86
103
  margin-bottom .5rem
87
- display flex
88
- align-items center
89
- flex-wrap wrap
90
104
  position relative
91
105
 
106
+ if hexo-config('comment.use')[1]
107
+ .count span:last-child
108
+ display none
109
+
110
+ .comment-switch
111
+ display inline-block
112
+ float right
113
+ margin 2px auto 0
114
+ padding 4px 16px
115
+ width max-content
116
+ user-select none
117
+
118
+ #switch-btn
119
+ position relative
120
+ display inline-block
121
+ margin 0 8px 0
122
+ width 42px
123
+ height 22px
124
+ border-radius 34px
125
+ background-color var(--efu-main)
126
+ vertical-align middle
127
+ cursor pointer
128
+ transition .4s
129
+ border var(--style-border-always)
130
+
131
+ &::before
132
+ position absolute
133
+ bottom 3px
134
+ left 4px
135
+ width 14px
136
+ height 14px
137
+ border-radius 50%
138
+ background-color #fff
139
+ content ''
140
+ transition .4s
141
+
142
+ if hexo-config('comment.use')[1]
143
+ .comment-wrap
144
+ > div:last-child
145
+ display none
146
+
147
+ > div:first-child
148
+ animation 0.5s ease 0s 1 normal none running tabshow
149
+
92
150
  #owo-big
93
151
  position fixed
94
152
  align-items center
95
- background-color var(--heo-card-bg)
153
+ background-color var(--efu-card-bg)
96
154
  border var(--style-border-always)
97
155
  border-radius 10px
98
156
  z-index 9999
99
157
  display none
100
158
  transform translate(0, -105%)
101
159
  overflow hidden
102
- animation owoIn .3s cubic-bezier(.42,0,.3,1.11)
160
+ animation owoIn .3s cubic-bezier(.42, 0, .3, 1.11)
103
161
  padding 1rem
104
162
 
105
- @import 'twikoo.styl' when hexo-config('comment.type') == 'twikoo'
106
- @import 'valine.styl' when hexo-config('comment.type') == 'valine'
163
+ if hexo-config('twikoo.style') && 'Twikoo' in hexo-config('comment.use')
164
+ @import 'twikoo.styl'
165
+
166
+ if hexo-config('valine.style') && 'Valine' in hexo-config('comment.use')
167
+ @import 'valine.styl'
@@ -1,4 +1,4 @@
1
- #comment
1
+ #vcomment
2
2
  .vcount
3
3
  display none !important
4
4