hexo-theme-solitude 3.0.10 → 3.0.12

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 (39) hide show
  1. package/_config.yml +45 -57
  2. package/languages/default.yml +14 -15
  3. package/languages/en.yml +22 -24
  4. package/languages/zh-CN.yml +14 -15
  5. package/languages/zh-TW.yml +14 -15
  6. package/layout/includes/head/config.pug +0 -11
  7. package/layout/includes/head/page_config.pug +1 -1
  8. package/layout/includes/inject/body.pug +1 -1
  9. package/layout/includes/layout.pug +0 -4
  10. package/layout/includes/page/brevity.pug +2 -2
  11. package/layout/includes/widgets/page/about/award.pug +1 -1
  12. package/layout/includes/widgets/page/about/skillsinfo.pug +12 -11
  13. package/layout/includes/widgets/page/kit/content.pug +3 -2
  14. package/layout/includes/widgets/page/links/banner.pug +7 -6
  15. package/layout/includes/widgets/post/ai.pug +7 -0
  16. package/layout/includes/widgets/sidebar/artalk.pug +1 -1
  17. package/layout/post.pug +2 -2
  18. package/package.json +6 -6
  19. package/plugins.yml +8 -8
  20. package/scripts/event/cdn.js +83 -60
  21. package/scripts/event/merge_config.js +385 -385
  22. package/scripts/filter/default.js +22 -24
  23. package/scripts/tags/tabs.js +29 -18
  24. package/source/css/_global/index.styl +2 -2
  25. package/source/css/_layout/article-container.styl +1 -1
  26. package/source/css/_layout/other.styl +2 -2
  27. package/source/css/_page/_about/reward.styl +13 -12
  28. package/source/css/_post/index.styl +103 -4
  29. package/source/css/_tags/gallery.styl +1 -0
  30. package/source/css/_tags/tabs.styl +36 -96
  31. package/source/css/index.styl +0 -4
  32. package/source/js/main.js +447 -257
  33. package/source/js/post_ai.js +118 -0
  34. package/source/js/utils.js +0 -6
  35. package/layout/includes/widgets/post/post-ai.pug +0 -12
  36. package/layout/includes/widgets/third-party/tianli-talk.pug +0 -26
  37. package/source/css/_post/postAI.styl +0 -132
  38. package/source/css/third_party/tianli_talk.styl +0 -77
  39. package/source/js/third_party/post_ai.min.js +0 -184
@@ -1,32 +1,30 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- hexo.extend.filter.register('after_post_render', function (data) {
4
- data.title = data.title || 'Untitled';
5
- const { config } = hexo.theme;
3
+ hexo.extend.filter.register("after_post_render", function (data) {
4
+ data.title = data.title || "Untitled";
5
+ const { config } = hexo.theme;
6
6
 
7
- const setCoverAndExcerpt = (layout) => {
8
- const { copyright, locate, cover } = hexo.theme.config[layout].default;
9
- data.locate = data.locate || locate;
10
- data.cc = data.cc || copyright;
11
- data.cover = data.cover || (cover?.length && cover[getRandomInt(0, cover.length)]);
12
- data.not_cover = data.cover ? false : true;
13
- data.excerpt = layout === 'post' ? data.description || data.excerpt : data.title;
14
- data.toc = !!(config.aside.toc[layout] && data.toc !== false);
15
- data.aside = layout === 'post' ? (data.aside || true) : (data.aside || false);
16
- };
7
+ const setCoverAndExcerpt = (layout) => {
8
+ const { copyright, locate, cover } = hexo.theme.config[layout].default;
9
+ data.locate = data.locate || locate;
10
+ data.cc = data.cc || copyright;
11
+ data.cover =
12
+ data.cover || (cover?.length && cover[getRandomInt(0, cover.length)]);
13
+ data.not_cover = data.cover ? false : true;
14
+ data.excerpt =
15
+ layout === "post" ? data.description || data.excerpt : data.title;
16
+ data.toc = !!(config.aside.toc[layout] && data.toc !== false);
17
+ data.aside = layout === "post" ? data.aside || true : data.aside || false;
18
+ };
17
19
 
18
- if (data.layout === 'post' || data.layout === 'page') {
19
- setCoverAndExcerpt(data.layout);
20
- }
20
+ if (data.layout === "post" || data.layout === "page") {
21
+ setCoverAndExcerpt(data.layout);
22
+ }
21
23
 
22
- if (data.layout === 'post') {
23
- data.ai = data.ai || true;
24
- }
25
-
26
- data.comment = !!(config.comment.use && data.comment !== false);
27
- return data;
24
+ data.comment = !!(config.comment.use && data.comment !== false);
25
+ return data;
28
26
  });
29
27
 
30
28
  function getRandomInt(min, max) {
31
- return Math.floor(Math.random() * (max - min)) + Math.ceil(min);
29
+ return Math.floor(Math.random() * (max - min)) + Math.ceil(min);
32
30
  }
@@ -3,27 +3,32 @@
3
3
  * from solitude
4
4
  */
5
5
 
6
- 'use strict'
6
+ "use strict";
7
7
 
8
8
  function postTabs([name, active], content) {
9
9
  const tabBlock = /<!--\s*tab (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtab\s*-->/g;
10
10
  const matches = [...content.matchAll(tabBlock)];
11
-
11
+
12
12
  active = Number(active) || 0;
13
13
 
14
14
  const generateTabItems = (matches, name, active) => {
15
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
-
16
+ const [tabCaption = "", tabIcon = ""] = match[1].split("@");
17
+ const postContent = hexo.render
18
+ .renderSync({ text: match[2], engine: "markdown" })
19
+ .trim();
20
+ const tabHref = `${name.toLowerCase().replace(/\s+/g, "-")}-${tabId}`;
21
+
22
+ const iconHtml = tabIcon
23
+ ? `<i class="${tabIcon.trim()} tab solitude"></i>`
24
+ : "";
25
+ const isActive = active === tabId ? " active" : "";
26
+
24
27
  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>`
28
+ nav: `<li class="tab${isActive}"><button type="button" data-href="#${tabHref}">${iconHtml}${
29
+ tabCaption.trim() || `${name} ${tabId}`
30
+ }</button></li>`,
31
+ content: `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent}</div>`,
27
32
  };
28
33
  });
29
34
  };
@@ -31,16 +36,22 @@ function postTabs([name, active], content) {
31
36
  const tabItems = generateTabItems(matches, name, active);
32
37
 
33
38
  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>`;
39
+ const tabNav = `<ul class="nav-tabs">${tabItems
40
+ .map((item) => item.nav)
41
+ .join("")}</ul>`;
42
+ const tabContent = `<div class="tab-contents">${tabItems
43
+ .map((item) => item.content)
44
+ .join("")}</div>`;
36
45
  return { tabNav, tabContent };
37
46
  };
38
47
 
39
48
  const { tabNav, tabContent } = createTabStructure(tabItems);
40
49
 
41
- return `<div class="tabs" id="${name.toLowerCase().replace(/\s+/g, '-')}">${tabNav}${tabContent}</div>`;
50
+ return `<div class="tabs" id="${name
51
+ .toLowerCase()
52
+ .replace(/\s+/g, "-")}">${tabNav}${tabContent}</div>`;
42
53
  }
43
54
 
44
- hexo.extend.tag.register('tabs', postTabs, { ends: true });
45
- hexo.extend.tag.register('subtabs', postTabs, { ends: true });
46
- hexo.extend.tag.register('subsubtabs', postTabs, { ends: true });
55
+ hexo.extend.tag.register("tabs", postTabs, { ends: true });
56
+ hexo.extend.tag.register("subtabs", postTabs, { ends: true });
57
+ hexo.extend.tag.register("subsubtabs", postTabs, { ends: true });
@@ -56,7 +56,7 @@
56
56
  --offset 0px
57
57
  --hlscrollbar-bg #121212
58
58
  --gap .5rem
59
- --radius 8px
59
+ --radius 12px
60
60
 
61
61
  body
62
62
  position relative
@@ -330,7 +330,7 @@ blockquote
330
330
  background-color var(--efu-secondbg)
331
331
  color var(--efu-secondtext)
332
332
  border-radius 8px
333
- margin 1rem 0
333
+ margin .5rem 0
334
334
  padding .5rem .8rem
335
335
 
336
336
  li, ul
@@ -57,7 +57,7 @@
57
57
  line-height 1.7
58
58
  font-weight 400
59
59
  margin .5rem 0
60
- text-align left
60
+ text-align justify
61
61
  letter-spacing .6px
62
62
 
63
63
  a
@@ -22,7 +22,7 @@ span.tags-punctuation
22
22
  a
23
23
  color var(--efu-gray)
24
24
  border none
25
- margin-left 4px
25
+ margin 0 4px
26
26
 
27
27
  &:hover
28
- color var(--efu-main)
28
+ color var(--efu-main)
@@ -18,12 +18,12 @@
18
18
  display flex
19
19
  flex-wrap wrap
20
20
  flex-direction row
21
- margin 1rem -.25rem .5rem
21
+ margin 1rem -.125rem .5rem
22
22
 
23
23
  .post-reward
24
24
  position absolute
25
- right 2rem
26
- top 2rem
25
+ right 1rem
26
+ top 1rem
27
27
 
28
28
  .reward-main
29
29
  top 60px
@@ -57,26 +57,27 @@
57
57
  padding 1rem
58
58
  border-radius 12px
59
59
  border var(--style-border-always)
60
- width calc((100% / 6) - .5rem)
61
- margin 0 .25rem .5rem .25rem
60
+ width calc((100% / 6) - .25rem)
61
+ margin 0 .125rem .5rem .125rem
62
62
  box-shadow var(--efu-shadow-border)
63
+ display flex
63
64
  flex-direction column
64
65
  justify-content space-between
65
66
 
66
67
  +maxWidth1200()
67
- width calc((100% / 4) - .5rem)
68
+ width calc((100% / 4) - .25rem)
68
69
 
69
70
  +maxWidth900()
70
- width calc((100% / 2) - .5rem)
71
+ width calc((100% / 2) - .25rem)
71
72
 
72
73
  +maxWidth768()
73
- width 100%
74
+ width calc((100% / 2) - .25rem)
74
75
 
75
76
  .reward-list-item-name
76
77
  font-size 1rem
77
78
  font-weight 700
78
79
  line-height 1
79
- margin-bottom .5rem
80
+ margin-bottom .25rem
80
81
  white-space nowrap
81
82
  overflow hidden
82
83
  text-overflow ellipsis
@@ -96,12 +97,12 @@
96
97
  align-items center
97
98
  justify-content center
98
99
  border-radius 4px
99
- margin-right 4px
100
+ margin-right 2px
100
101
  white-space nowrap
101
102
 
102
103
  .solitude
103
104
  font-size 14px
104
- margin-right 4px
105
+ margin-right 2px
105
106
  color var(--efu-card-bg)
106
107
 
107
108
  .reward-list-item-time
@@ -112,4 +113,4 @@
112
113
  .reward-list-tips
113
114
  p
114
115
  font-size 12px
115
- color var(--efu-secondtext)
116
+ color var (--efu-secondtext)
@@ -11,8 +11,107 @@ if hexo-config('comment.commentBarrage')
11
11
 
12
12
  @import "pagination"
13
13
 
14
- if hexo-config('post_ai.enable')
15
- @import "postAI"
16
-
17
14
  if hexo-config('google_adsense.enable')
18
- @import "ads.styl"
15
+ @import "ads.styl"
16
+
17
+ if hexo-config('post.ai.enable')
18
+ .post-ai
19
+ background var(--efu-secondbg)
20
+ border-radius 12px
21
+ padding 12px
22
+ line-height 1.3
23
+ border var(--style-border-always)
24
+ margin-top 16px
25
+ min-height 101.22px
26
+ box-shadow var(--efu-shadow-border)
27
+
28
+ +maxWidth768()
29
+ margin-top 0
30
+
31
+ .ai-title
32
+ display flex
33
+ color var(--efu-lighttext)
34
+ border-radius 8px
35
+ align-items center
36
+ user-select none
37
+
38
+ .ai-title-left
39
+ display flex
40
+ align-items center
41
+ color var(--efu-lighttext)
42
+
43
+ i.ai-title-icon
44
+ width 24px
45
+ height 24px
46
+ display flex
47
+ background var(--efu-lighttext)
48
+ color var(--efu-card-bg)
49
+ font-size 14px
50
+ border-radius 20px
51
+ justify-content center
52
+ align-items center
53
+
54
+ .ai-title-text
55
+ font-weight 700
56
+ margin-left 8px
57
+ line-height 1
58
+ font-size 14px
59
+
60
+ .ai-tag
61
+ font-size 12px
62
+ background-color var(--efu-lighttext)
63
+ box-shadow var(--efu-shadow-main)
64
+ color var(--efu-card-bg)
65
+ font-weight 700
66
+ border-radius 12px
67
+ margin-left auto
68
+ line-height 12px
69
+ padding 6px 8px
70
+ display flex
71
+ align-items center
72
+ justify-content center
73
+ transition .3s
74
+
75
+ &.loadingAI
76
+ animation-duration 2s
77
+ animation-name AILoading
78
+ animation-iteration-count infinite
79
+ animation-direction alternate
80
+
81
+ .ai-explanation
82
+ margin-top 12px
83
+ overflow hidden
84
+ padding 8px 12px
85
+ background var(--efu-card-bg)
86
+ border-radius 8px
87
+ border var(--style-border-always)
88
+ font-size 15px
89
+ line-height 1.4
90
+ display none
91
+ text-align left
92
+
93
+ .blinking-cursor
94
+ background-color var(--efu-lighttext)
95
+ width 14px
96
+ height 14px
97
+ border-radius 16px
98
+ display inline-block
99
+ vertical-align middle
100
+ animation blinking-cursor 2s infinite
101
+ margin-left 4px
102
+ margin-bottom 3px
103
+ transform scale(.6)
104
+
105
+ .char
106
+ display inline-block
107
+ opacity 0
108
+ animation chat-float .5s ease forwards;
109
+
110
+ @keyframes chat-float
111
+ 0%
112
+ opacity 0
113
+ transform translateY(20px)
114
+ 100%
115
+ opacity 1
116
+ transform translateY(0)
117
+
@@ -95,6 +95,7 @@
95
95
  display flex
96
96
  gap .5rem
97
97
  margin-top .5rem
98
+ flex-wrap wrap
98
99
 
99
100
  .gallery-item
100
101
  min-height 5rem
@@ -1,107 +1,47 @@
1
-
2
- .article-container .tabs
1
+ .tabs
3
2
  position relative
4
- border 1px solid var(--tab-border-color)
5
-
6
- > .nav-tabs
7
- > .tab
8
- margin 4px
9
- padding 0
10
- list-style none
11
-
12
- +maxWidth768()
13
- -webkit-box-flex 1
14
- flex-grow 1
15
-
16
- button i
17
- width 1.5em
18
- font-size inherit
19
-
20
- &.active button
21
- cursor default
22
- border var(--style-border-hover-always)
23
- background var(--efu-background)
24
- border-radius 8px;
25
-
26
- &:not(.active) button:hover
27
- border-top 2px solid var(--tab-button-hover-bg)
28
- background var(--tab-button-hover-bg)
29
-
30
- > .tab-contents .tab-item-content
31
- position relative
32
- display none
33
- padding 1.8rem 1.2rem
34
- background var(--efu-background)
35
- border var(--style-border-always)
36
-
37
- +maxWidth768()
38
- padding 1.2rem .7rem
39
-
40
- &.active
41
- display block
42
- animation .5s ease 0s 1 normal none running tabshow
43
-
44
- .tab-to-top
45
- position relative
46
- display block
47
- margin 16px 0 0 auto
48
- color #99a9bf
49
-
50
- margin 1rem 0
51
- border-radius 12px
52
- overflow hidden
53
- box-shadow var(--efu-shadow-border)
54
- padding 8px
55
- background var(--efu-card-bg)
56
- border var(--style-border)
57
3
 
58
4
  .nav-tabs
59
- background var(--efu-card-bg)
60
- padding 16px
5
+ margin-top 0
61
6
  display flex
62
- justify-content center
63
- flex-wrap wrap
64
- flex-direction row
65
-
66
- +maxWidth768()
67
- padding 0
68
- margin-bottom 8px
69
-
70
- > .nav-tabs > .tab button
71
- -webkit-transition all 0s
72
- background var(--efu-secondbg)
73
- transition .3s
7
+ background var(--efu-card-bg)
74
8
  border var(--style-border-always)
75
- border-radius 8px
76
- font-size 14px
77
- line-height 1
78
- padding 8px 16px
79
- display flex
80
- width 100%
81
- justify-content center
82
- align-items center
83
- color var(--efu-fontcolor)
9
+ border-radius var(--radius)
10
+ margin-bottom .5rem
11
+ padding .3rem .5rem
12
+ gap .5rem
13
+ flex-wrap wrap
84
14
 
85
- > .nav-tabs > .tab:not(.active) button:hover
86
- background var(--efu-main)
87
- color var(--efu-white)
88
- transition .3s
89
- border var(--style-border-hover-always)
15
+ .tab
16
+ border-radius 6px
17
+ transition all 0.3s ease
90
18
 
91
- .tab-item-content
92
- background var(--efu-card-bg)
19
+ button
20
+ width 100%
21
+ padding 0 .3rem
22
+ height 100%
23
+ font-size 14px
93
24
 
94
- .article-container .tabs
25
+ &.active
26
+ background var(--light-grey)
27
+ i,button
28
+ color var(--efu-card-bg)
95
29
 
96
- > .tab-contents .tab-item-content.active
97
- animation tabshow 0s
98
- -webkit-animation tabshow 0s
99
- padding 1.2rem
100
- border-radius 8px
30
+ i
31
+ font-size 14px
32
+ margin-right .3rem
101
33
 
102
- +maxWidth768()
103
- padding .5rem .5rem
34
+ .tab-contents
35
+ padding .5rem
36
+ border var(--style-border-always)
37
+ border-radius var(--radius)
38
+ transition all 0.3s ease
104
39
 
105
- .tab-contents
106
- border-radius 8px
107
- overflow hidden
40
+ .tab-item-content.active
41
+ display block
42
+ opacity 1
43
+ transform translateY(0)
44
+ .tab-item-content
45
+ display none
46
+ opacity 0
47
+ transform translateY(-10px)
@@ -29,9 +29,5 @@ if hexo-config('search.enable')
29
29
  if hexo-config('comment.use')
30
30
  @import '_comments/comment.styl'
31
31
 
32
- // third party
33
- if hexo-config('tianli_talk.enable')
34
- @import 'third_party/tianli_talk.styl'
35
-
36
32
  // components
37
33
  @import '_components/index'