hexo-theme-solitude 1.4.5 → 1.4.7

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 (42) hide show
  1. package/.github/FUNDING.yml +1 -1
  2. package/.github/ISSUE_TEMPLATE/bug_report.yml +2 -2
  3. package/_config.yml +211 -215
  4. package/languages/en-US.yml +5 -2
  5. package/languages/zh-CN.yml +5 -2
  6. package/languages/zh-TW.yml +5 -2
  7. package/layout/404.pug +2 -2
  8. package/layout/includes/head/config.pug +7 -7
  9. package/layout/includes/head/opengraph.pug +5 -4
  10. package/layout/includes/head/pwa.pug +2 -3
  11. package/layout/includes/inject/body.pug +15 -18
  12. package/layout/includes/inject/head.pug +3 -2
  13. package/layout/includes/mixins/pagination.pug +1 -1
  14. package/layout/includes/page/says.pug +44 -7
  15. package/layout/includes/widgets/home/bbTimeList.pug +13 -7
  16. package/layout/includes/widgets/page/banner.pug +8 -13
  17. package/layout/page.pug +0 -2
  18. package/package.json +4 -4
  19. package/scripts/event/init.js +18 -17
  20. package/scripts/event/welcome.js +1 -1
  21. package/scripts/generator/gallery.js +29 -27
  22. package/scripts/helper/getArchiveLength.js +5 -9
  23. package/scripts/helper/related_post.js +28 -39
  24. package/scripts/helper/stylus.js +5 -9
  25. package/source/css/_global/animation.styl +307 -0
  26. package/source/css/_page/index.styl +0 -2
  27. package/source/css/index.styl +0 -1
  28. package/source/js/comment/twikoo_commentBarrage.js +76 -75
  29. package/source/js/covercolor/local.js +11 -10
  30. package/source/js/music.js +89 -49
  31. package/.github/ISSUE_TEMPLATE/config.yml +0 -13
  32. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -14
  33. package/layout/includes/page/rss.pug +0 -20
  34. package/layout/includes/widgets/home/bb/json.pug +0 -23
  35. package/layout/includes/widgets/home/bb/local.pug +0 -13
  36. package/layout/includes/widgets/home/bb/memos.pug +0 -27
  37. package/layout/includes/widgets/page/says/json.pug +0 -82
  38. package/layout/includes/widgets/page/says/local.pug +0 -44
  39. package/layout/includes/widgets/page/says/memos.pug +0 -111
  40. package/source/css/_global/animation.css +0 -813
  41. package/source/css/_page/rss.styl +0 -82
  42. /package/.github/workflows/{npm-publish.yml → npm-publish-github-packages.yml} +0 -0
@@ -0,0 +1,307 @@
1
+ @keyframes barrageIn
2
+ 0%
3
+ transform translateY(20px)
4
+ opacity 0
5
+ 100%
6
+ transform translateY(0)
7
+ opacity 1
8
+
9
+ @keyframes barrageOut
10
+ 0%
11
+ transform translateY(0)
12
+ opacity 1
13
+ 100%
14
+ transform translateY(20px)
15
+ opacity 0
16
+
17
+ @keyframes scroll-down-effect
18
+ 0%
19
+ top 0
20
+ opacity .4
21
+ 50%
22
+ top -16px
23
+ opacity 1
24
+ filter none
25
+ 100%
26
+ top 0
27
+ opacity .4
28
+
29
+ @keyframes header-effect
30
+ 0%
31
+ opacity 0
32
+ transform translateY(-50px)
33
+ 100%
34
+ opacity 1
35
+ filter none
36
+ transform translateY(0)
37
+
38
+ @keyframes headerNoOpacity
39
+ 0%
40
+ transform translateY(-50px)
41
+ 100%
42
+ transform translateY(0)
43
+
44
+ @keyframes bottom-top
45
+ 0%
46
+ opacity 0
47
+ margin-top 50px
48
+ 100%
49
+ opacity 1
50
+ filter none
51
+ margin-top 0
52
+
53
+ @keyframes titlescale
54
+ 0%
55
+ opacity 0
56
+ transform scale(.7)
57
+ 100%
58
+ opacity 1
59
+ filter none
60
+ transform scale(1)
61
+
62
+ @keyframes search_close
63
+ 0%
64
+ transform translateY(0)
65
+ opacity 1
66
+ 100%
67
+ transform translateY(20px)
68
+ opacity 0
69
+
70
+ @keyframes to_show
71
+ 0%
72
+ opacity 0
73
+ 100%
74
+ opacity 1
75
+ filter none
76
+
77
+ @keyframes to_hide
78
+ 0%
79
+ opacity 1
80
+ filter none
81
+ 100%
82
+ opacity 0
83
+
84
+ @keyframes ribbon_to_show
85
+ 0%
86
+ opacity 0
87
+ 100%
88
+ opacity .6
89
+
90
+ @keyframes avatar_turn_around
91
+ 0%
92
+ transform rotate(0)
93
+ 100%
94
+ transform rotate(360deg)
95
+
96
+ @keyframes sub_menus
97
+ 0%
98
+ opacity 0
99
+ transform translateY(10px)
100
+ 100%
101
+ opacity 1
102
+ filter none
103
+ transform translateY(0)
104
+
105
+ @keyframes donate_effcet
106
+ 0%
107
+ opacity 0
108
+ transform translateY(-20px)
109
+ 100%
110
+ opacity 1
111
+ filter none
112
+ transform translateY(0)
113
+
114
+ @keyframes announ_animation
115
+ 0%, 100%
116
+ transform scale(1)
117
+ filter blur(0)
118
+ 50%
119
+ transform scale(1.2)
120
+ filter blur(20px)
121
+
122
+ @keyframes sidebarItem
123
+ 0%
124
+ transform translateX(200px)
125
+ 100%
126
+ transform translateX(0)
127
+
128
+ @keyframes sco-spin
129
+ 0%
130
+ transform rotate(0)
131
+ 100%
132
+ transform rotate(360deg)
133
+
134
+ @keyframes code-expand-key
135
+ 0%
136
+ opacity .6
137
+ 50%
138
+ opacity .1
139
+ 100%
140
+ opacity .6
141
+
142
+ @keyframes slide-in
143
+ from
144
+ transform translateY(20px)
145
+ opacity 0
146
+ to
147
+ transform translateY(0)
148
+ opacity 1
149
+
150
+ @keyframes slide-in-op
151
+ from
152
+ opacity 0
153
+ to
154
+ opacity 1
155
+
156
+ @keyframes more-btn-move
157
+ 0%, 100%
158
+ transform translateX(0)
159
+ 50%
160
+ transform translateX(3px)
161
+
162
+ @keyframes toc-open
163
+ 0%
164
+ transform scale(.7)
165
+ 100%
166
+ transform scale(1)
167
+
168
+ @keyframes toc-close
169
+ 0%
170
+ transform scale(1)
171
+ 100%
172
+ transform scale(.7)
173
+
174
+ @keyframes configure-clockwise
175
+ 0%
176
+ transform rotate(0)
177
+ 25%
178
+ transform rotate(90deg)
179
+ 50%
180
+ transform rotate(180deg)
181
+ 75%
182
+ transform rotate(270deg)
183
+ 100%
184
+ transform rotate(360deg)
185
+
186
+ @keyframes configure-xclockwise
187
+ 0%
188
+ transform rotate(45deg)
189
+ 25%
190
+ transform rotate(-45deg)
191
+ 50%
192
+ transform rotate(-135deg)
193
+ 75%
194
+ transform rotate(-225deg)
195
+ 100%
196
+ transform rotate(-315deg)
197
+
198
+ @keyframes tabshow
199
+ 0%
200
+ transform translateY(15px)
201
+ 100%
202
+ transform translateY(0)
203
+
204
+ @keyframes snackbar-progress
205
+ from
206
+ width 0
207
+ to
208
+ width 100%
209
+
210
+ @keyframes move-forever
211
+ 0%
212
+ transform translate3d(-90px, 0, 0)
213
+ 100%
214
+ transform translate3d(85px, 0, 0)
215
+
216
+ @keyframes rowup
217
+ from
218
+ transform translateX(0)
219
+ to
220
+ transform translateX(-50%)
221
+
222
+ @keyframes gradient
223
+ 0%
224
+ background-position 0 50%
225
+ 50%
226
+ background-position 100% 50%
227
+ 100%
228
+ background-position 0 50%
229
+
230
+ @keyframes commonTipsIn
231
+ 0%
232
+ top -50px
233
+ opacity 0
234
+ 100%
235
+ top -60px
236
+ opacity 1
237
+
238
+ @keyframes commonTriangleIn
239
+ 0%
240
+ transform translate(-50%, -36px)
241
+ opacity 0
242
+ 100%
243
+ transform translate(-50%, -46px)
244
+ opacity 1
245
+
246
+ @keyframes owoIn
247
+ 0%
248
+ transform translate(0, -95%)
249
+ opacity 0
250
+ 100%
251
+ transform translate(0, -105%)
252
+ opacity 1
253
+
254
+ @keyframes light_tag
255
+ 0%
256
+ transform skewx(0)
257
+ -o-transform skewx(0)
258
+ -moz-transform skewx(0)
259
+ -webkit-transform skewx(0)
260
+ left -150px
261
+ 99%
262
+ transform skewx(-25deg)
263
+ -o-transform skewx(-25deg)
264
+ -moz-transform skewx(-25deg)
265
+ -webkit-transform skewx(-25deg)
266
+ left 50px
267
+
268
+ @keyframes floating
269
+ 0%
270
+ transform translate(0, -4px)
271
+ 50%
272
+ transform translate(0, 4px)
273
+ 100%
274
+ transform translate(0, -4px)
275
+
276
+ @media screen and (min-width: 768px)
277
+ @keyframes showCover
278
+ from
279
+ opacity 0
280
+ transform rotate(10deg) translateY(-8%) scale(1.8)
281
+ to
282
+ opacity 0.5
283
+ transform rotate(10deg) translateY(-10%) scale(2)
284
+
285
+ @keyframes blinking-cursor
286
+ 0%
287
+ transform scale(.6)
288
+ 25%
289
+ transform scale(1)
290
+ 50%
291
+ transform scale(.6)
292
+ 75%
293
+ transform scale(1)
294
+ 100%
295
+ transform scale(.6)
296
+
297
+ @keyframes AILoading
298
+ 0%
299
+ opacity 1
300
+ 25%
301
+ opacity .3
302
+ 50%
303
+ opacity 1
304
+ 75%
305
+ opacity .3
306
+ 100%
307
+ opacity 1
@@ -8,8 +8,6 @@
8
8
 
9
9
  @import "error.styl"
10
10
 
11
- @import "rss.styl"
12
-
13
11
  if hexo-config('moments.enable')
14
12
  @import "moment.styl"
15
13
 
@@ -4,7 +4,6 @@ if hexo-config('css_prefix')
4
4
  @import 'nib'
5
5
 
6
6
  // project
7
- @import '_global/animation.css'
8
7
  @import '_global/*'
9
8
  @import '_layout/*'
10
9
  @import '_page/index.styl'
@@ -1,117 +1,116 @@
1
1
  function initializeCommentBarrage() {
2
2
  window.commentBarrageInitialized = !0;
3
- let e = {
3
+ const e = {
4
4
  maxBarrage: 1,
5
5
  barrageTime: 8e3,
6
6
  twikooUrl: GLOBAL_CONFIG.comment.twikoo.url,
7
7
  pageUrl: window.location.pathname,
8
8
  accessToken: GLOBAL_CONFIG.comment.twikoo.accessToken,
9
9
  };
10
- new class {
11
- commentInterval = null
12
10
 
13
- constructor(e) {
11
+ class CommentBarrage {
12
+ constructor(config) {
14
13
  this.config = {
15
- ...e,
14
+ ...config,
16
15
  barrageTimer: [],
17
16
  barrageList: [],
18
17
  barrageIndex: 0,
19
18
  dom: document.querySelector(".comment-barrage")
20
- },
21
- this.commentInterval = null,
22
- this.hoverOnCommentBarrage = !1,
23
- this.init()
19
+ };
20
+ this.commentInterval = null;
21
+ this.hoverOnCommentBarrage = false;
22
+ this.init();
24
23
  }
25
24
 
26
25
  async fetchComments() {
27
- return fetch(this.config.twikooUrl, {
28
- method: "POST",
29
- headers: {
30
- "Content-Type": "application/json"
31
- },
32
- body: JSON.stringify({
33
- event: "COMMENT_GET",
34
- accessToken: this.config.accessToken,
35
- url: this.config.pageUrl
36
- })
37
- }).then((e => {
38
- if (!e.ok)
39
- throw Error("HTTP error! status: " + e.status);
40
- return e.json()
26
+ try {
27
+ const response = await fetch(this.config.twikooUrl, {
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/json"
31
+ },
32
+ body: JSON.stringify({
33
+ event: "COMMENT_GET",
34
+ accessToken: this.config.accessToken,
35
+ url: this.config.pageUrl
36
+ })
37
+ });
38
+ if (!response.ok) {
39
+ throw new Error("HTTP error! status: " + response.status);
41
40
  }
42
- )).then((e => e.data)).catch((e => console.error("An error occurred while fetching comments: ", e)))
41
+ const data = await response.json();
42
+ return data.data;
43
+ } catch (error) {
44
+ console.error("An error occurred while fetching comments: ", error);
45
+ }
43
46
  }
44
47
 
45
- commentLinkFilter(e) {
46
- e.sort(((e, t) => e.created - t.created));
47
- let t = [];
48
- return e.forEach((e => {
49
- t.push(...this.getCommentReplies(e))
50
- }
51
- )),
52
- t
48
+ commentLinkFilter(comments) {
49
+ comments.sort((a, b) => a.created - b.created);
50
+ let filteredComments = [];
51
+ comments.forEach(comment => {
52
+ filteredComments.push(...this.getCommentReplies(comment));
53
+ });
54
+ return filteredComments;
53
55
  }
54
56
 
55
- getCommentReplies(e) {
56
- if (e.replies) {
57
- let comments = [e];
58
- e.replies.forEach((reply) => {
57
+ getCommentReplies(comment) {
58
+ let comments = [comment];
59
+ if (comment.replies) {
60
+ comment.replies.forEach(reply => {
59
61
  comments.push(...this.getCommentReplies(reply));
60
62
  });
61
- return comments;
62
63
  }
63
- return [];
64
+ return comments;
64
65
  }
65
66
 
66
-
67
- processCommentContent(e) {
68
- const t = e.replace(/<blockquote\b[^>]*>[\s\S]*?<\/blockquote>/gi, "")
69
- , r = t.replace(/<[^>]*>/g, "").replace(/\n/g, " ");
70
- return "" === t.trim() ? "" : `<p>${r}</p>`
67
+ processCommentContent(comment) {
68
+ const strippedContent = comment.replace(/<blockquote\b[^>]*>[\s\S]*?<\/blockquote>/gi, "");
69
+ const plainText = strippedContent.replace(/<[^>]*>/g, "").replace(/\n/g, " ");
70
+ return plainText.trim() !== "" ? `<p>${plainText}</p>` : "";
71
71
  }
72
72
 
73
- popCommentBarrage(e) {
74
- var commentContent = this.processCommentContent(e.comment);
75
-
73
+ popCommentBarrage(comment) {
74
+ const commentContent = this.processCommentContent(comment.comment);
76
75
  if (!commentContent.trim()) {
77
76
  return false;
78
77
  }
79
-
80
- let commentBarrageItem = document.createElement("div");
78
+ const commentBarrageItem = document.createElement("div");
81
79
  commentBarrageItem.className = "comment-barrage-item";
82
-
83
80
  commentBarrageItem.innerHTML = `
84
- <div class="barrageHead">
85
- <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>
86
- <div class="barrageNick">${e.nick}</div>
87
- <img class="barrageAvatar" src="https://cravatar.cn/avatar/${e.mailMd5}"/>
88
- <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scoicon sco-close-fill"></i></a>
89
- </div>
90
- <a class="barrageContent" href="javascript:sco.scrollTo('${e.id}');">${commentContent}</a>
91
- `;
92
-
81
+ <div class="barrageHead">
82
+ <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>
83
+ <div class="barrageNick">${comment.nick}</div>
84
+ <img class="barrageAvatar" src="https://cravatar.cn/avatar/${comment.mailMd5}"/>
85
+ <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scoicon sco-close-fill"></i></a>
86
+ </div>
87
+ <a class="barrageContent" href="javascript:sco.scrollTo('${comment.id}');">${commentContent}</a>
88
+ `;
93
89
  this.config.barrageTimer.push(commentBarrageItem);
94
-
95
90
  this.config.dom.appendChild(commentBarrageItem);
96
91
  return true;
97
92
  }
98
93
 
99
- removeCommentBarrage(e) {
100
- e.className = "comment-barrage-item out",
101
- setTimeout((() => {
102
- this.config.dom.removeChild(e)
103
- }
104
- ), 1e3)
94
+ removeCommentBarrage(commentBarrageItem) {
95
+ commentBarrageItem.className = "comment-barrage-item out";
96
+ setTimeout(() => {
97
+ this.config.dom.removeChild(commentBarrageItem);
98
+ }, 1000);
105
99
  }
106
100
 
107
101
  async initCommentBarrage() {
108
- if (localStorage.getItem("commentBarrageSwitch") != null) {
102
+ const commentBarrageSwitch = localStorage.getItem("commentBarrageSwitch");
103
+ if (commentBarrageSwitch != null) {
109
104
  document.querySelector(".comment-barrage").style.display = "flex";
110
- GLOBAL_CONFIG.rightside.enable && (document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评");
105
+ if (GLOBAL_CONFIG.rightside.enable) {
106
+ document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评";
107
+ }
111
108
  document.querySelector("#consoleCommentBarrage").classList.add("on");
112
109
  } else {
113
110
  document.querySelector(".comment-barrage").style.display = "none";
114
- GLOBAL_CONFIG.rightside.enable && (document.querySelector(".menu-commentBarrage-text").textContent = "显示热评");
111
+ if (GLOBAL_CONFIG.rightside.enable) {
112
+ document.querySelector(".menu-commentBarrage-text").textContent = "显示热评";
113
+ }
115
114
  document.querySelector("#consoleCommentBarrage").classList.remove("on");
116
115
  }
117
116
  const comments = await this.fetchComments();
@@ -121,12 +120,13 @@ function initializeCommentBarrage() {
121
120
  this.commentInterval = null;
122
121
  const t = () => {
123
122
  if (this.config.barrageList.length && !this.hoverOnCommentBarrage) {
124
- if (!this.popCommentBarrage(this.config.barrageList[this.config.barrageIndex]))
125
- return this.config.barrageIndex += 1,
126
- this.config.barrageIndex %= this.config.barrageList.length,
127
- void t();
128
- this.config.barrageIndex += 1,
129
- this.config.barrageIndex %= this.config.barrageList.length
123
+ if (!this.popCommentBarrage(this.config.barrageList[this.config.barrageIndex])) {
124
+ this.config.barrageIndex += 1;
125
+ this.config.barrageIndex %= this.config.barrageList.length;
126
+ return t();
127
+ }
128
+ this.config.barrageIndex += 1;
129
+ this.config.barrageIndex %= this.config.barrageList.length;
130
130
  }
131
131
  if (this.config.barrageTimer.length > (this.config.barrageList.length > this.config.maxBarrage ? this.config.maxBarrage : this.config.barrageList.length) && !this.hoverOnCommentBarrage) {
132
132
  this.removeCommentBarrage(this.config.barrageTimer.shift());
@@ -152,5 +152,6 @@ function initializeCommentBarrage() {
152
152
  });
153
153
  }
154
154
  }
155
- (e)
155
+
156
+ new CommentBarrage(e);
156
157
  }
@@ -107,9 +107,6 @@ function colorRgb(str) {
107
107
  }
108
108
 
109
109
  function setThemeColors(value, r = null, g = null, b = null) {
110
- const cardContents = document.getElementsByClassName('card-content');
111
- const authorInfo = document.getElementsByClassName('author-info__sayhi');
112
-
113
110
  if (value) {
114
111
  document.documentElement.style.setProperty('--sco-main', value);
115
112
  document.documentElement.style.setProperty('--sco-main-op', value + '23');
@@ -118,13 +115,17 @@ function setThemeColors(value, r = null, g = null, b = null) {
118
115
 
119
116
  if (r && g && b) {
120
117
  let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
121
- for (let i = 0; i < cardContents.length; i++) {
122
- cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
123
- }
124
-
125
- for (let i = 0; i < authorInfo.length; i++) {
126
- authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
127
- authorInfo[i].style.setProperty('color', 'var(--sco-white)');
118
+ if (brightness < 125) {
119
+ let cardContents = document.getElementsByClassName('card-content');
120
+ for (let i = 0; i < cardContents.length; i++) {
121
+ cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
122
+ }
123
+
124
+ let authorInfo = document.getElementsByClassName('author-info__sayhi');
125
+ for (let i = 0; i < authorInfo.length; i++) {
126
+ authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
127
+ authorInfo[i].style.setProperty('color', 'var(--sco-white)');
128
+ }
128
129
  }
129
130
  }
130
131