hexo-theme-solitude 2.1.7 → 2.1.9

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 (46) hide show
  1. package/.github/screenshot.avif +0 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/LICENSE +1 -1
  4. package/README.md +19 -30
  5. package/README_en-US.md +26 -37
  6. package/README_zh-Hant.md +27 -36
  7. package/SECURITY.md +1 -1
  8. package/_config.yml +2 -2
  9. package/layout/includes/inject/body.pug +1 -1
  10. package/layout/includes/page/default.pug +1 -1
  11. package/layout/includes/page/links.pug +1 -1
  12. package/layout/includes/page/tlink.pug +1 -1
  13. package/layout/includes/widgets/page/about/hobbies.pug +18 -17
  14. package/layout/includes/widgets/page/about/tenyear.pug +24 -25
  15. package/layout/includes/widgets/page/links/linksCard.pug +5 -2
  16. package/layout/includes/widgets/page/message/content.pug +1 -1
  17. package/layout/post.pug +1 -1
  18. package/package.json +1 -1
  19. package/plugins.yml +10 -10
  20. package/scripts/event/welcome.js +11 -7
  21. package/scripts/filter/randomPosts.js +14 -3
  22. package/scripts/tags/article.js +53 -15
  23. package/scripts/tags/tabs.js +26 -17
  24. package/source/css/_comments/comment.styl +4 -3
  25. package/source/css/_comments/twikoo.styl +4 -5
  26. package/source/css/_global/animation.styl +0 -15
  27. package/source/css/_global/index.styl +19 -19
  28. package/source/css/_highlight/prismjs/index.styl +1 -1
  29. package/source/css/_highlight/prismjs/line-number.styl +1 -1
  30. package/source/css/_layout/article-container.styl +3 -3
  31. package/source/css/_layout/console.styl +1 -0
  32. package/source/css/_page/_about/about.styl +1 -1
  33. package/source/css/_page/_about/game.styl +2 -17
  34. package/source/css/_page/error.styl +2 -3
  35. package/source/css/_page/links.styl +2 -2
  36. package/source/css/_page/music.styl +1 -0
  37. package/source/css/_page/other.styl +1 -0
  38. package/source/css/_page/says.styl +4 -3
  39. package/source/css/_tags/gallery.styl +1 -1
  40. package/source/css/_tags/tabs.styl +2 -2
  41. package/source/js/covercolor/local.js +9 -1
  42. package/source/js/main.js +30 -17
  43. package/source/js/music.js +8 -3
  44. package/source/js/right_menu.js +11 -7
  45. package/source/js/third_party/post_ai.min.js +1 -1
  46. package/source/js/tw_cn.js +2 -2
@@ -1,5 +1,16 @@
1
1
  hexo.extend.filter.register('after_render:html', function (data) {
2
- const posts = hexo.locals.get('posts').filter(post => post.random !== false).map(post => post.path);
3
- data += `<script>const posts=${JSON.stringify(posts)};function toRandomPost(){ pjax.loadUrl(GLOBAL_CONFIG.root+posts[Math.floor(Math.random()*posts.length)]); }</script>`;
4
- return data;
2
+ const posts = hexo.locals.get('posts')
3
+ .filter(post => post.random !== false)
4
+ .map(post => post.path);
5
+
6
+ const scriptContent = `
7
+ <script>
8
+ const posts = ${JSON.stringify(posts)};
9
+ function toRandomPost() {
10
+ const randomPost = posts[Math.floor(Math.random() * posts.length)];
11
+ pjax.loadUrl(GLOBAL_CONFIG.root + randomPost);
12
+ }
13
+ </script>`;
14
+
15
+ return data + scriptContent;
5
16
  });
@@ -1,18 +1,56 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  const article = ([path]) => {
4
4
  const post = hexo.locals.get("posts").data.find(post => post.path === path);
5
- if (!post) {
6
- return '';
7
- }
8
- const tags = post.tags.map(tag => `<a class="article-meta__tags fancybox" href="${tag.path}" onclick="event.stopPropagation();"><span class="tags-punctuation"><i class="solitude fa-solid fa-hashtag"></i>${tag.name}</span></a>`).join('');
9
- const category = post.categories.data.length > 0 ? `<span class="article-meta sticky-warp"><span class="original">${post.categories.data[0].name}</span></span>` : '';
10
- const postCover = `<div class="post_cover"><a href="${'/' + post.path}" class="fancybox" title="${post.title}"><img class="post_bg" src="${post.cover}" alt="${post.title}"></a></div>`;
11
- const recentPostInfoTop = `<div class="recent-post-info-top"><div class="recent-post-info-top-tips">${category}</div><a class="article-title fancybox" href="${'/' + post.path}" title="${post.title}">${post.title}</a></div>`;
12
- const content = `<div class="content">${post.description ? post.description : ''}</div>`;
13
- const articleMetaWrap = `<div class="article-meta-wrap"><span class="article-meta tags">${tags}</span><span class="post-meta-date"><time datetime="${post.date}" style="display: inline;"></time></span></div>`;
14
- const recentPostInfo = `<div class="recent-post-info">${recentPostInfoTop + content + articleMetaWrap}</div>`
15
- return `<div class="recent-post-item" onclick="pjax.loadUrl('${'/' + post.path}')">${postCover + recentPostInfo}</div>`;
16
- }
17
-
18
- hexo.extend.tag.register('article', article)
5
+ if (!post) return '';
6
+
7
+ const createTagLinks = tags => tags.map(tag =>
8
+ `<a class="article-meta__tags fancybox" href="${tag.path}" onclick="event.stopPropagation();">
9
+ <span class="tags-punctuation">
10
+ <i class="solitude fa-solid fa-hashtag"></i>${tag.name}
11
+ </span>
12
+ </a>`
13
+ ).join('');
14
+
15
+ const createCategory = categories => categories.length > 0
16
+ ? `<span class="article-meta sticky-warp">
17
+ <span class="original">${categories[0].name}</span>
18
+ </span>`
19
+ : '';
20
+
21
+ const createPostCover = post =>
22
+ `<div class="post_cover">
23
+ <a href="/${post.path}" class="fancybox" title="${post.title}">
24
+ <img class="post_bg" src="${post.cover}" alt="${post.title}">
25
+ </a>
26
+ </div>`;
27
+
28
+ const createRecentPostInfoTop = (category, post) =>
29
+ `<div class="recent-post-info-top">
30
+ <div class="recent-post-info-top-tips">${category}</div>
31
+ <a class="article-title fancybox" href="/${post.path}" title="${post.title}">${post.title}</a>
32
+ </div>`;
33
+
34
+ const createContent = description =>
35
+ `<div class="content">${description || ''}</div>`;
36
+
37
+ const createArticleMetaWrap = (tags, date) =>
38
+ `<div class="article-meta-wrap">
39
+ <span class="article-meta tags">${tags}</span>
40
+ <span class="post-meta-date">
41
+ <time datetime="${date}" style="display: inline;"></time>
42
+ </span>
43
+ </div>`;
44
+
45
+ const tags = createTagLinks(post.tags);
46
+ const category = createCategory(post.categories.data);
47
+ const postCover = createPostCover(post);
48
+ const recentPostInfoTop = createRecentPostInfoTop(category, post);
49
+ const content = createContent(post.description);
50
+ const articleMetaWrap = createArticleMetaWrap(tags, post.date);
51
+ const recentPostInfo = `<div class="recent-post-info">${recentPostInfoTop + content + articleMetaWrap}</div>`;
52
+
53
+ return `<div class="recent-post-item" onclick="pjax.loadUrl('/${post.path}')">${postCover + recentPostInfo}</div>`;
54
+ };
55
+
56
+ hexo.extend.tag.register('article', article);
@@ -11,23 +11,32 @@ function postTabs([name, active], content) {
11
11
 
12
12
  active = Number(active) || 0;
13
13
 
14
- const tabItems = matches.map((match, tabId) => {
15
- const [tabCaption = '', tabIcon = ''] = match[1].split('@');
16
- const postContent = hexo.render.renderSync({ text: match[2], engine: 'markdown' }).trim();
17
- const tabHref = `${name.toLowerCase().replace(/\s+/g, '-')}-${tabId}`;
18
-
19
- const iconHtml = tabIcon ? `<i class="${tabIcon.trim()} tab solitude"></i>` : '';
20
- const isActive = active === tabId ? ' active' : '';
21
- const toTopButton = '<button type="button" class="tab-to-top" aria-label="scroll to top"><i class="solitude fas fa-arrow-up"></i></button>';
22
-
23
- return {
24
- nav: `<li class="tab${isActive}"><button type="button" data-href="#${tabHref}">${iconHtml}${tabCaption.trim() || `${name} ${tabId}`}</button></li>`,
25
- content: `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent}${toTopButton}</div>`
26
- };
27
- });
28
-
29
- const tabNav = `<ul class="nav-tabs">${tabItems.map(item => item.nav).join('')}</ul>`;
30
- const tabContent = `<div class="tab-contents">${tabItems.map(item => item.content).join('')}</div>`;
14
+ const generateTabItems = (matches, name, active) => {
15
+ return matches.map((match, tabId) => {
16
+ const [tabCaption = '', tabIcon = ''] = match[1].split('@');
17
+ const postContent = hexo.render.renderSync({ text: match[2], engine: 'markdown' }).trim();
18
+ const tabHref = `${name.toLowerCase().replace(/\s+/g, '-')}-${tabId}`;
19
+
20
+ const iconHtml = tabIcon ? `<i class="${tabIcon.trim()} tab solitude"></i>` : '';
21
+ const isActive = active === tabId ? ' active' : '';
22
+ const toTopButton = '<button type="button" class="tab-to-top" aria-label="scroll to top"><i class="solitude fas fa-arrow-up"></i></button>';
23
+
24
+ return {
25
+ nav: `<li class="tab${isActive}"><button type="button" data-href="#${tabHref}">${iconHtml}${tabCaption.trim() || `${name} ${tabId}`}</button></li>`,
26
+ content: `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent}${toTopButton}</div>`
27
+ };
28
+ });
29
+ };
30
+
31
+ const tabItems = generateTabItems(matches, name, active);
32
+
33
+ const createTabStructure = (tabItems) => {
34
+ const tabNav = `<ul class="nav-tabs">${tabItems.map(item => item.nav).join('')}</ul>`;
35
+ const tabContent = `<div class="tab-contents">${tabItems.map(item => item.content).join('')}</div>`;
36
+ return { tabNav, tabContent };
37
+ };
38
+
39
+ const { tabNav, tabContent } = createTabStructure(tabItems);
31
40
 
32
41
  return `<div class="tabs" id="${name.toLowerCase().replace(/\s+/g, '-')}">${tabNav}${tabContent}</div>`;
33
42
  }
@@ -3,7 +3,7 @@
3
3
  .comment-headline
4
4
  display inline-block
5
5
  vertical-align middle
6
- font-weight 700
6
+ font-weight bold
7
7
  font-size 20px
8
8
 
9
9
  #comment-switch
@@ -31,7 +31,7 @@
31
31
  background-color #307af6
32
32
  vertical-align middle
33
33
  cursor pointer
34
- transition all .4s ease 0s
34
+ transition all .4s ease
35
35
 
36
36
  &::before
37
37
  position absolute
@@ -42,7 +42,7 @@
42
42
  border-radius 50%
43
43
  background-color #fff
44
44
  content ""
45
- transition all .4s ease 0s
45
+ transition all .4s ease
46
46
 
47
47
  &.move
48
48
  background-color #ff7242
@@ -77,6 +77,7 @@
77
77
  font-size .6rem
78
78
  color var(--efu-secondtext)
79
79
  border-radius 8px
80
+
80
81
  if hexo-config('comment.use')[1] || ',' in hexo-config('comment.use')
81
82
  &.move
82
83
  if hexo-config('comment.count')
@@ -36,7 +36,7 @@
36
36
  color var(--efu-lighttext) !important
37
37
  cursor pointer
38
38
  user-select none
39
- padding 0 12px 0 12px
39
+ padding 0 12px
40
40
  transition all .3s
41
41
  border-radius 8px
42
42
  background-color var(--efu-secondbg)
@@ -49,7 +49,6 @@
49
49
  .tk-action-icon svg
50
50
  fill var(--efu-card-bg) !important
51
51
 
52
-
53
52
  .tk-action-icon
54
53
  svg
55
54
  transition all .3s
@@ -187,7 +186,7 @@
187
186
  .tk-content
188
187
  .tk-owo-emotion
189
188
  width 3em
190
- margin 0 2px 0 2px
189
+ margin 0 2px
191
190
 
192
191
  .tk-owo-emotion,
193
192
  .twikoo
@@ -302,7 +301,7 @@
302
301
  color var(--efu-secondtext)
303
302
 
304
303
  .tk-content
305
- margin-top 0!important
304
+ margin-top 0 !important
306
305
 
307
306
  .tk-meta-input
308
307
  .el-input
@@ -356,7 +355,7 @@ img.tk-avatar-img
356
355
  font-weight 700
357
356
 
358
357
  .el-input__inner
359
- background-color: var(--efu-secondbg) !important
358
+ background-color var(--efu-secondbg) !important
360
359
  border 0 !important
361
360
  color var(--efu-fontcolor) !important
362
361
  padding-left 8px
@@ -21,7 +21,6 @@
21
21
  50%
22
22
  top -16px
23
23
  opacity 1
24
- filter none
25
24
  100%
26
25
  top 0
27
26
  opacity .4
@@ -32,7 +31,6 @@
32
31
  transform translateY(-50px)
33
32
  100%
34
33
  opacity 1
35
- filter none
36
34
  transform translateY(0)
37
35
 
38
36
  @keyframes headerNoOpacity
@@ -47,7 +45,6 @@
47
45
  margin-top 50px
48
46
  100%
49
47
  opacity 1
50
- filter none
51
48
  margin-top 0
52
49
 
53
50
  @keyframes titlescale
@@ -56,7 +53,6 @@
56
53
  transform scale(.7)
57
54
  100%
58
55
  opacity 1
59
- filter none
60
56
  transform scale(1)
61
57
 
62
58
  @keyframes search_close
@@ -72,12 +68,10 @@
72
68
  opacity 0
73
69
  100%
74
70
  opacity 1
75
- filter none
76
71
 
77
72
  @keyframes to_hide
78
73
  0%
79
74
  opacity 1
80
- filter none
81
75
  100%
82
76
  opacity 0
83
77
 
@@ -99,7 +93,6 @@
99
93
  transform translateY(10px)
100
94
  100%
101
95
  opacity 1
102
- filter none
103
96
  transform translateY(0)
104
97
 
105
98
  @keyframes donate_effcet
@@ -108,13 +101,11 @@
108
101
  transform translateY(-20px)
109
102
  100%
110
103
  opacity 1
111
- filter none
112
104
  transform translateY(0)
113
105
 
114
106
  @keyframes announ_animation
115
107
  0%, 100%
116
108
  transform scale(1)
117
- filter blur(0)
118
109
  50%
119
110
  transform scale(1.2)
120
111
  filter blur(20px)
@@ -260,15 +251,9 @@
260
251
  @keyframes light_tag
261
252
  0%
262
253
  transform skewx(0)
263
- -o-transform skewx(0)
264
- -moz-transform skewx(0)
265
- -webkit-transform skewx(0)
266
254
  left -150px
267
255
  99%
268
256
  transform skewx(-25deg)
269
- -o-transform skewx(-25deg)
270
- -moz-transform skewx(-25deg)
271
- -webkit-transform skewx(-25deg)
272
257
  left 50px
273
258
 
274
259
  @keyframes floating
@@ -77,9 +77,9 @@ html
77
77
  line-height 1.15
78
78
  -webkit-text-size-adjust 100%
79
79
  text-size-adjust 100%
80
- height: 100%;
81
- font-size: 20px
82
- overflow-y: overlay
80
+ height: 100%
81
+ font-size 20px
82
+ overflow-y overlay
83
83
 
84
84
  main
85
85
  display block
@@ -146,7 +146,7 @@ hr
146
146
  box-sizing content-box
147
147
  height 0
148
148
  overflow visible
149
- display: none
149
+ display none
150
150
 
151
151
  a
152
152
  color var(--efu-fontcolor)
@@ -363,29 +363,29 @@ i.solitude
363
363
  font-synthesis style
364
364
 
365
365
  #body-wrap
366
- display: flex
367
- flex-direction: column
368
- min-height: 100vh
369
- justify-content: space-between
366
+ display flex
367
+ flex-direction column
368
+ min-height 100vh
369
+ justify-content space-between
370
370
 
371
371
  .layout
372
- display: flex
373
- margin: 0 auto
374
- padding: 0 1.5rem
372
+ display flex
373
+ margin 0 auto
374
+ padding 0 1.5rem
375
375
  width 100%
376
- max-width: 1200px
376
+ max-width 1200px
377
377
  +maxWidth768()
378
378
  padding 0
379
379
 
380
380
  &#content-inner
381
- max-width: 1400px
382
- flex-grow: 1
381
+ max-width 1400px
382
+ flex-grow 1
383
383
 
384
384
  /.hide-aside.layout
385
- max-width: 1400px
385
+ max-width 1400px
386
386
 
387
387
  > div
388
- width: 100% !important
388
+ width 100% !important
389
389
 
390
390
  > div:first-child
391
391
  width calc(100% - 300px)
@@ -419,10 +419,10 @@ i.solitude
419
419
  span.tags-punctuation
420
420
  i
421
421
  font-weight bold
422
- font-size: 12px
422
+ font-size 12px
423
423
  transition none
424
- margin-right: 2px
425
- opacity: .4
424
+ margin-right 2px
425
+ opacity .4
426
426
 
427
427
  .hide-aside #page &
428
428
  font-size 16px
@@ -3,7 +3,7 @@
3
3
  if hexo-config('highlight.enable')
4
4
  @require diff
5
5
 
6
- #article-container
6
+ .article-container
7
7
  pre[class*='language-']
8
8
  margin 0
9
9
  overflow-x auto
@@ -1,4 +1,4 @@
1
- #article-container
1
+ .article-container
2
2
  pre[class*='language-']
3
3
  &.line-numbers
4
4
  position relative
@@ -1,4 +1,4 @@
1
- .post-content
1
+ .article-container
2
2
  overflow-wrap break-word
3
3
  +maxWidth768()
4
4
  overflow hidden
@@ -7,7 +7,7 @@
7
7
  .post &
8
8
  padding 1rem 2rem
9
9
  +maxWidth768()
10
- padding .5rem
10
+ padding .5rem .5rem 1rem .5rem
11
11
 
12
12
  iframe
13
13
  border-radius 12px
@@ -66,7 +66,7 @@
66
66
  font-size .9rem
67
67
  line-height 1.7
68
68
  font-weight 400
69
- margin 1rem 0
69
+ margin .5rem 0
70
70
  text-align left
71
71
  letter-spacing .6px
72
72
 
@@ -118,6 +118,7 @@
118
118
  line-height 1
119
119
  display flex
120
120
  align-items center
121
+ justify-content space-between
121
122
 
122
123
  .aside-list
123
124
  display flex
@@ -30,7 +30,7 @@ if "motto" in $about
30
30
  @import "buff"
31
31
  @import "maxim"
32
32
 
33
- if "game1" in $about
33
+ if "game" in $about
34
34
  @import "game"
35
35
 
36
36
  if "personalities" in $about
@@ -1,11 +1,10 @@
1
1
  #about-page
2
- .author-content-item.game-apex
2
+ .author-content-item.game
3
3
  min-height 300px
4
4
  overflow hidden
5
5
  color var(--efu-white)
6
6
 
7
7
  &::after
8
- box-shadow 0 -69px 203px 11px #04120f inset
9
8
  position absolute
10
9
  content ''
11
10
  width 100%
@@ -22,18 +21,4 @@
22
21
  z-index 2
23
22
  display flex
24
23
  flex-direction column
25
- padding 1rem 2rem
26
-
27
- .author-content-item.game-jl
28
- min-height 300px
29
- overflow hidden
30
- color var(--efu-white)
31
-
32
- &::after
33
- box-shadow 0 -69px 203px 11px #415dc9 inset
34
- position absolute
35
- content ''
36
- width 100%
37
- height 100%
38
- top 0
39
- left 0
24
+ padding 1rem 2rem
@@ -42,10 +42,9 @@
42
42
  flex 1 1 0
43
43
  height 100%
44
44
  width 600px
45
- border-top-left-radius 8px
46
- border-bottom-left-radius 8px
45
+ border-radius 8px 0 0 8px
47
46
  background-color var(--efu-main)
48
- background-position center center
47
+ background-position center
49
48
  background-size cover
50
49
 
51
50
  +maxWidth768()
@@ -19,10 +19,10 @@
19
19
  opacity 1
20
20
  backdrop-filter saturate(180%) blur(20px)
21
21
 
22
- .flink#article-container
22
+ .flink.article-container
23
23
  margin-top 1rem
24
24
 
25
- #article-container
25
+ .article-container
26
26
 
27
27
  .flink-desc
28
28
  margin 0
@@ -101,6 +101,7 @@ body[data-type=music]
101
101
  &.aplayer-list-light
102
102
  background var(--efu-black-op)
103
103
  border-radius 6px
104
+ margin 0 .5rem
104
105
  height 60px
105
106
  display flex
106
107
  flex-direction column
@@ -214,6 +214,7 @@ div#banners
214
214
  .card-content
215
215
  position absolute
216
216
  width 100%
217
+ z-index 2
217
218
  height 100%
218
219
  top 0
219
220
  left 0
@@ -29,6 +29,7 @@ if hexo-config('says.home_mini')
29
29
  background var(--efu-background)
30
30
  border none
31
31
  padding 0 .2rem
32
+
32
33
  i.bber-logo,
33
34
  i.bber-gotobb
34
35
  transition .3s
@@ -80,9 +81,9 @@ if hexo-config('says.enable')
80
81
  opacity .6
81
82
 
82
83
  .goComment
83
- position: absolute
84
- top: 0
85
- right: 0
84
+ position absolute
85
+ top 0
86
+ right 0
86
87
 
87
88
  div
88
89
  &.bber-content
@@ -1,4 +1,4 @@
1
- #article-container
1
+ .article-container
2
2
  figure.gallery-group
3
3
  position: relative
4
4
  overflow: hidden
@@ -1,5 +1,5 @@
1
1
 
2
- #article-container .tabs
2
+ .article-container .tabs
3
3
  position relative
4
4
  border 1px solid var(--tab-border-color)
5
5
 
@@ -91,7 +91,7 @@
91
91
  .tab-item-content
92
92
  background var(--efu-card-bg)
93
93
 
94
- #article-container .tabs
94
+ .article-container .tabs
95
95
 
96
96
  > .tab-contents .tab-item-content.active
97
97
  animation tabshow 0s
@@ -23,7 +23,7 @@ const localColor = path => {
23
23
  const colorThief = new ColorThief();
24
24
  const img = new Image();
25
25
  img.crossOrigin = "Anonymous";
26
- img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)));
26
+ img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)), ...colorThief.getColor(img));
27
27
  img.onerror = () => console.error('Image Error');
28
28
  img.src = path;
29
29
  }
@@ -61,6 +61,14 @@ const setThemeColors = (value, r = null, g = null, b = null) => {
61
61
  initThemeColor();
62
62
  }
63
63
 
64
+ function LightenDarkenColor(col, amt) {
65
+ var usePound = false;
66
+ if (col[0] === "#") {
67
+ col = col.slice(1);
68
+ usePound = true;
69
+ }
70
+ }
71
+
64
72
  const adjustCardStyles = () => {
65
73
  const cardContents = document.getElementsByClassName('card-content');
66
74
  Array.from(cardContents).forEach(item => {