hexo-theme-solitude 3.0.9 → 3.0.11

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 (38) hide show
  1. package/_config.yml +15 -27
  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/skillsinfo.pug +12 -11
  12. package/layout/includes/widgets/page/kit/content.pug +3 -2
  13. package/layout/includes/widgets/page/links/banner.pug +7 -6
  14. package/layout/includes/widgets/post/ai.pug +7 -0
  15. package/layout/post.pug +2 -2
  16. package/package.json +1 -1
  17. package/plugins.yml +4 -4
  18. package/scripts/event/cdn.js +83 -60
  19. package/scripts/event/merge_config.js +385 -385
  20. package/scripts/filter/default.js +22 -24
  21. package/scripts/tags/tabs.js +29 -18
  22. package/source/css/_global/index.styl +2 -2
  23. package/source/css/_layout/article-container.styl +1 -1
  24. package/source/css/_layout/other.styl +2 -2
  25. package/source/css/_layout/recent-post.styl +6 -0
  26. package/source/css/_page/brevity.styl +0 -2
  27. package/source/css/_page/tag.styl +2 -4
  28. package/source/css/_post/index.styl +103 -4
  29. package/source/css/_tags/tabs.styl +40 -101
  30. package/source/css/index.styl +0 -4
  31. package/source/js/main.js +447 -257
  32. package/source/js/post_ai.js +60 -0
  33. package/source/js/utils.js +0 -6
  34. package/layout/includes/widgets/post/post-ai.pug +0 -12
  35. package/layout/includes/widgets/third-party/tianli-talk.pug +0 -26
  36. package/source/css/_post/postAI.styl +0 -132
  37. package/source/css/third_party/tianli_talk.styl +0 -77
  38. 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)
@@ -7,6 +7,12 @@
7
7
  +maxWidth768()
8
8
  padding 0
9
9
 
10
+ #tag-page-tags+#recent-posts
11
+ margin-top: calc(64px - 0.5rem)
12
+
13
+ +maxWidth768()
14
+ margin-top: calc(74px - 0.5rem)
15
+
10
16
  if hexo-config('index_post_list.direction') == "column"
11
17
  .recent-post-item
12
18
  box-shadow var(--efu-shadow-light2black)
@@ -348,8 +348,6 @@ if hexo-config('brevity.enable')
348
348
  overflow hidden
349
349
  text-overflow ellipsis
350
350
  transition .3s
351
- display flex
352
- justify-content center
353
351
  align-items center
354
352
  font-weight 700
355
353
  margin auto
@@ -13,7 +13,7 @@
13
13
  margin 0
14
14
  margin-bottom 0.5rem
15
15
  position absolute
16
- z-index 1
16
+ z-index 2
17
17
  width 100%
18
18
  padding 1rem 2rem
19
19
  left 0
@@ -54,6 +54,4 @@
54
54
 
55
55
  &.select .tagsPageCount
56
56
  background var(--efu-card-bg)
57
- color var(--efu-lighttext)
58
- +maxWidth768()
59
- display none
57
+ color var(--efu-lighttext)
@@ -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 0ai-explanation
108
+ animation chat-float .3s 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
+
@@ -1,107 +1,46 @@
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)
84
-
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)
90
-
91
- .tab-item-content
92
- background var(--efu-card-bg)
93
-
94
- .article-container .tabs
95
-
96
- > .tab-contents .tab-item-content.active
97
- animation tabshow 0s
98
- -webkit-animation tabshow 0s
99
- padding 1.2rem
100
- border-radius 8px
101
-
102
- +maxWidth768()
103
- padding .5rem .5rem
9
+ border-radius var(--radius)
10
+ margin-bottom .5rem
11
+ padding .3rem .5rem
12
+ gap .5rem
13
+
14
+ .tab
15
+ border-radius 6px
16
+ transition all 0.3s ease
17
+
18
+ button
19
+ width 100%
20
+ padding 0 .3rem
21
+ height 100%
22
+ font-size 14px
23
+
24
+ &.active
25
+ background var(--light-grey)
26
+ i,button
27
+ color var(--efu-card-bg)
28
+
29
+ i
30
+ font-size 14px
31
+ margin-right .3rem
32
+
33
+ .tab-contents
34
+ padding .5rem
35
+ border var(--style-border-always)
36
+ border-radius var(--radius)
37
+ transition all 0.3s ease
104
38
 
105
- .tab-contents
106
- border-radius 8px
107
- overflow hidden
39
+ .tab-item-content.active
40
+ display block
41
+ opacity 1
42
+ transform translateY(0)
43
+ .tab-item-content
44
+ display none
45
+ opacity 0
46
+ 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'