hexo-theme-stellar 1.18.5 → 1.20.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.
- package/_config.yml +93 -17
- package/layout/_partial/cover/wiki_cover.ejs +1 -1
- package/layout/_partial/head.ejs +15 -2
- package/layout/_partial/main/article/ai_abstract.ejs +8 -0
- package/layout/_partial/main/article/article_footer.ejs +87 -50
- package/layout/_partial/main/article/read_next.ejs +17 -12
- package/layout/_partial/main/navbar/breadcrumb.ejs +53 -15
- package/layout/_partial/main/navbar/list_post.ejs +6 -4
- package/layout/_partial/main/navbar/list_wiki.ejs +4 -3
- package/layout/_partial/main/post_list/paginator.ejs +1 -1
- package/layout/_partial/plugins/comments/beaudar/script.ejs +1 -1
- package/layout/_partial/plugins/comments/giscus/script.ejs +1 -1
- package/layout/_partial/plugins/comments/layout.ejs +2 -2
- package/layout/_partial/plugins/comments/utterances/script.ejs +1 -1
- package/layout/_partial/plugins/comments/waline/script.ejs +17 -0
- package/layout/_partial/scripts/index.ejs +7 -0
- package/layout/_partial/sidebar/header.ejs +1 -1
- package/layout/_partial/sidebar/index.ejs +3 -3
- package/layout/_partial/widgets/ghissues.ejs +1 -1
- package/layout/_partial/widgets/ghrepo.ejs +1 -1
- package/layout/_partial/widgets/recent.ejs +3 -3
- package/layout/_partial/widgets/related.ejs +9 -8
- package/layout/_partial/widgets/toc.ejs +15 -10
- package/layout/index.ejs +7 -4
- package/layout/mermaid.ejs +32 -0
- package/layout/page.ejs +3 -0
- package/layout/post.ejs +6 -0
- package/layout/wiki.ejs +6 -0
- package/package.json +1 -1
- package/scripts/events/lib/doc_tree.js +123 -92
- package/scripts/filters/index.js +13 -0
- package/scripts/tags/index.js +2 -2
- package/scripts/tags/inline-labels.js +2 -2
- package/scripts/tags/lib/ablock.js +1 -1
- package/scripts/tags/lib/checkbox.js +1 -1
- package/scripts/tags/lib/folders.js +1 -1
- package/scripts/tags/lib/folding.js +2 -2
- package/scripts/tags/lib/hashtag.js +36 -0
- package/scripts/tags/lib/image.js +5 -1
- package/scripts/tags/lib/mark.js +1 -1
- package/scripts/tags/lib/note.js +1 -1
- package/scripts/tags/lib/okr.js +140 -0
- package/scripts/tags/lib/sites.js +1 -1
- package/scripts/tags/lib/toc.js +1 -1
- package/source/css/_common/button.styl +1 -0
- package/source/css/_common/highlight.styl +2 -0
- package/source/css/_custom.styl +2 -2
- package/source/css/_defines/theme.styl +0 -1
- package/source/css/_layout/md.styl +10 -2
- package/source/css/_layout/partial/ai_abstract.styl +155 -0
- package/source/css/_layout/partial/bread-nav.styl +32 -0
- package/source/css/_layout/partial/paginator.styl +7 -3
- package/source/css/_layout/tag-plugins/common.styl +30 -39
- package/source/css/_layout/tag-plugins/folding.styl +1 -1
- package/source/css/_layout/tag-plugins/hashtag.styl +17 -0
- package/source/css/_layout/tag-plugins/link.styl +1 -7
- package/source/css/_layout/tag-plugins/mark.styl +2 -5
- package/source/css/_layout/tag-plugins/note.styl +1 -1
- package/source/css/_layout/tag-plugins/okr.styl +106 -0
- package/source/css/_plugins/copycode.styl +27 -0
- package/source/css/_plugins/index.styl +4 -0
- package/source/css/_plugins/mermaid.styl +125 -0
- package/source/js/main.js +8 -3
- package/source/js/plugins/copycode.js +49 -0
- package/source/js/plugins/linkcard.js +1 -1
- package/source/js/plugins/sites.js +1 -1
- package/scripts/tags/lib/tag.js +0 -35
- package/source/css/_layout/tag-plugins/tag.styl +0 -13
|
@@ -13,8 +13,7 @@ set_text_black()
|
|
|
13
13
|
|
|
14
14
|
set_dynamic_color($theme)
|
|
15
15
|
--theme: $theme
|
|
16
|
-
--theme-
|
|
17
|
-
--theme-bg2: hsl(hue($theme), 80, 95)
|
|
16
|
+
--theme-block: hsl(hue($theme), 90, 92)
|
|
18
17
|
--theme-border: hsl(hue($theme), 50, 80)
|
|
19
18
|
--text-p0: hsl(hue($theme), 55, 16)
|
|
20
19
|
--text-p1: hsl(hue($theme), 55, 20)
|
|
@@ -23,87 +22,79 @@ set_dynamic_color($theme)
|
|
|
23
22
|
.tag-plugin
|
|
24
23
|
--theme: var(--text-p1)
|
|
25
24
|
--theme-border: var(--block-border)
|
|
26
|
-
--theme-
|
|
27
|
-
--theme-bg2: var(--block)
|
|
28
|
-
&.tag
|
|
29
|
-
--text-p2: hsl(hue($color-theme), 90, 24)
|
|
25
|
+
--theme-block: var(--block)
|
|
30
26
|
|
|
31
|
-
.
|
|
27
|
+
.colorful[color='red']
|
|
32
28
|
set_dynamic_color($c-red)
|
|
33
|
-
.
|
|
29
|
+
.colorful[color='orange']
|
|
34
30
|
set_dynamic_color($c-orange)
|
|
35
|
-
.
|
|
31
|
+
.colorful[color='yellow']
|
|
36
32
|
set_dynamic_color($c-yellow)
|
|
37
|
-
.
|
|
33
|
+
.colorful[color='green']
|
|
38
34
|
set_dynamic_color($c-green)
|
|
39
|
-
.
|
|
35
|
+
.colorful[color='cyan']
|
|
40
36
|
set_dynamic_color($c-cyan)
|
|
41
|
-
.
|
|
37
|
+
.colorful[color='blue']
|
|
42
38
|
set_dynamic_color($c-blue)
|
|
43
|
-
.
|
|
39
|
+
.colorful[color='purple']
|
|
44
40
|
set_dynamic_color($c-purple)
|
|
45
41
|
|
|
46
|
-
.
|
|
47
|
-
--theme-
|
|
48
|
-
--theme-bg2: white
|
|
42
|
+
.colorful[color='light']
|
|
43
|
+
--theme-block: white
|
|
49
44
|
set_text_black()
|
|
50
45
|
|
|
51
|
-
.
|
|
52
|
-
--theme-
|
|
53
|
-
--theme-bg2: #333
|
|
46
|
+
.colorful[color='dark']
|
|
47
|
+
--theme-block: #333
|
|
54
48
|
set_text_white()
|
|
55
49
|
|
|
56
|
-
.
|
|
50
|
+
.colorful[color='warning']
|
|
57
51
|
--theme: $c-yellow
|
|
58
52
|
--theme-border: #ffe659
|
|
59
|
-
--theme-
|
|
53
|
+
--theme-block: #ffe659
|
|
60
54
|
--theme-link: #ff453a
|
|
61
55
|
|
|
62
|
-
.
|
|
56
|
+
.colorful[color='error']
|
|
63
57
|
--theme: $c-yellow
|
|
64
58
|
--theme-border: #ff453a
|
|
65
|
-
--theme-
|
|
59
|
+
--theme-block: #ff453a
|
|
66
60
|
--theme-link: #ffe659
|
|
67
61
|
set_text_white()
|
|
68
62
|
|
|
69
63
|
set_darkmode_tags()
|
|
70
64
|
set_dynamic_color($theme)
|
|
71
65
|
--theme: $theme
|
|
72
|
-
--theme-
|
|
73
|
-
--theme-bg2: hsl(hue($theme), 16, 16)
|
|
66
|
+
--theme-block: hsl(hue($theme), 16, 16)
|
|
74
67
|
--theme-border: hsl(hue($theme), 50, 24)
|
|
75
68
|
--text-p0: hsl(hue($theme), 100, 85)
|
|
76
69
|
--text-p1: hsl(hue($theme), 50, 75)
|
|
77
70
|
--text-p2: hsl(hue($theme), 80, 72)
|
|
78
71
|
.tag-plugin.tag
|
|
79
72
|
set_dynamic_color($color-theme)
|
|
80
|
-
.
|
|
73
|
+
.colorful[color='red']
|
|
81
74
|
set_dynamic_color($c-red)
|
|
82
|
-
.
|
|
75
|
+
.colorful[color='orange']
|
|
83
76
|
set_dynamic_color($c-orange)
|
|
84
|
-
.
|
|
77
|
+
.colorful[color='yellow']
|
|
85
78
|
set_dynamic_color($c-yellow)
|
|
86
|
-
.
|
|
79
|
+
.colorful[color='green']
|
|
87
80
|
set_dynamic_color($c-green)
|
|
88
|
-
.
|
|
81
|
+
.colorful[color='cyan']
|
|
89
82
|
set_dynamic_color($c-cyan)
|
|
90
|
-
.
|
|
83
|
+
.colorful[color='blue']
|
|
91
84
|
set_dynamic_color($c-blue)
|
|
92
|
-
.
|
|
85
|
+
.colorful[color='purple']
|
|
93
86
|
set_dynamic_color($c-purple)
|
|
94
|
-
.
|
|
87
|
+
.colorful[color='light']
|
|
95
88
|
--theme-border: white
|
|
96
|
-
--theme-
|
|
97
|
-
--theme-bg2: #fff
|
|
89
|
+
--theme-block: #fff
|
|
98
90
|
set_text_black()
|
|
99
91
|
|
|
100
|
-
.
|
|
92
|
+
.colorful[color='dark']
|
|
101
93
|
--theme-border: black
|
|
102
|
-
--theme-
|
|
103
|
-
--theme-bg2: #111
|
|
94
|
+
--theme-block: #111
|
|
104
95
|
set_text_white()
|
|
105
96
|
|
|
106
|
-
.
|
|
97
|
+
.colorful[color='warning'],.colorful[color='light']
|
|
107
98
|
set_text_black()
|
|
108
99
|
|
|
109
100
|
if hexo-config('style.darkmode') == 'auto'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.md-text .tag-plugin.hashtag
|
|
2
|
+
padding: 0px 8px
|
|
3
|
+
border-radius: 100px
|
|
4
|
+
background: var(--theme-block)
|
|
5
|
+
color: var(--text-p2)
|
|
6
|
+
margin: 2px 0
|
|
7
|
+
display: inline-flex
|
|
8
|
+
align-items: center
|
|
9
|
+
font-size: $fs-13
|
|
10
|
+
font-weight: 500
|
|
11
|
+
trans2 background color
|
|
12
|
+
span
|
|
13
|
+
margin: 0 2px
|
|
14
|
+
&:hover
|
|
15
|
+
background: var(--text-p2)
|
|
16
|
+
color: var(--theme-block)
|
|
17
|
+
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
.md-text .tag-plugin.link
|
|
2
|
-
max-width: 100%
|
|
3
2
|
margin: 1em auto
|
|
4
3
|
display: flex
|
|
5
4
|
justify-content: center
|
|
6
|
-
@media screen and (max-width: $device-mobile-375)
|
|
7
|
-
width: 100%
|
|
8
5
|
|
|
9
6
|
.md-text .link-card
|
|
10
7
|
background: var(--card)
|
|
@@ -12,11 +9,8 @@
|
|
|
12
9
|
justify-content: space-between
|
|
13
10
|
align-items: center
|
|
14
11
|
cursor: pointer
|
|
15
|
-
// min-width 280px
|
|
16
|
-
// max-width: 100%
|
|
17
12
|
width: 320px
|
|
18
|
-
|
|
19
|
-
width: 100%
|
|
13
|
+
max-width: 100%
|
|
20
14
|
box-shadow: $boxshadow-card
|
|
21
15
|
border-radius: $border-bar
|
|
22
16
|
trans2: box-shadow transform
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.md-text .tag-plugin.okr
|
|
2
|
+
position: relative
|
|
3
|
+
border-radius: $border-block
|
|
4
|
+
background: var(--theme-block)
|
|
5
|
+
border: 1px solid var(--theme-border)
|
|
6
|
+
if hexo-config('tag_plugins.okr.border') == true
|
|
7
|
+
border: 1px solid var(--theme-border)
|
|
8
|
+
overflow: hidden
|
|
9
|
+
color: var(--text-p1)
|
|
10
|
+
line-height: 1.5
|
|
11
|
+
.o
|
|
12
|
+
.title
|
|
13
|
+
font-size: $fs-15
|
|
14
|
+
.note
|
|
15
|
+
font-size: $fs-14
|
|
16
|
+
p
|
|
17
|
+
font-size: $fs-14
|
|
18
|
+
.kr
|
|
19
|
+
.title
|
|
20
|
+
font-size: $fs-14
|
|
21
|
+
.note
|
|
22
|
+
font-size: $fs-14
|
|
23
|
+
p,li,.tag-plugin
|
|
24
|
+
font-size: $fs-14
|
|
25
|
+
|
|
26
|
+
.title
|
|
27
|
+
font-weight: 600
|
|
28
|
+
display: block
|
|
29
|
+
.note
|
|
30
|
+
font-weight: 400
|
|
31
|
+
display: block
|
|
32
|
+
margin-top: 0.5rem
|
|
33
|
+
>p,>ul
|
|
34
|
+
margin-top: 0.25rem
|
|
35
|
+
margin-bottom: 0.25rem
|
|
36
|
+
>.tag-plugin
|
|
37
|
+
margin-top: 0.25rem
|
|
38
|
+
margin-bottom: 0.25rem
|
|
39
|
+
>*:last-child
|
|
40
|
+
margin-bottom: 0
|
|
41
|
+
.status
|
|
42
|
+
font-size: $fs-12
|
|
43
|
+
padding: 2px 4px
|
|
44
|
+
border-radius: 2px
|
|
45
|
+
.okr-item.o
|
|
46
|
+
border-bottom: 4px solid var(--theme-border)
|
|
47
|
+
.okr-item.kr+.okr-item.kr
|
|
48
|
+
border-top: 1px dashed var(--theme-border)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
.tag-plugin.okr .okr-item
|
|
52
|
+
display: grid
|
|
53
|
+
grid-template-columns: 3.2rem auto 100px
|
|
54
|
+
grid-column-gap: 0.75rem
|
|
55
|
+
padding: 1rem
|
|
56
|
+
.okr-left .title
|
|
57
|
+
background: var(--card)
|
|
58
|
+
border-radius: 1rem
|
|
59
|
+
text-align: center
|
|
60
|
+
padding: 0 0.5rem
|
|
61
|
+
.labels
|
|
62
|
+
display: flex
|
|
63
|
+
justify-content: space-between
|
|
64
|
+
align-items: flex-start
|
|
65
|
+
position relative
|
|
66
|
+
.label
|
|
67
|
+
background: var(--theme-block)
|
|
68
|
+
color: var(--text-p1)
|
|
69
|
+
|
|
70
|
+
.progress
|
|
71
|
+
margin-top: 4px
|
|
72
|
+
height: 4px
|
|
73
|
+
border-radius: 2px
|
|
74
|
+
position: relative
|
|
75
|
+
background: var(--card)
|
|
76
|
+
.fill
|
|
77
|
+
position: absolute
|
|
78
|
+
background: var(--theme)
|
|
79
|
+
border-radius: 2px
|
|
80
|
+
top: 0
|
|
81
|
+
left: 0
|
|
82
|
+
bottom: 0
|
|
83
|
+
&:before
|
|
84
|
+
content: ''
|
|
85
|
+
position absolute
|
|
86
|
+
top: -4px
|
|
87
|
+
bottom: -4px
|
|
88
|
+
right: -4px
|
|
89
|
+
width: 8px
|
|
90
|
+
height: 12px
|
|
91
|
+
border-radius: 8px
|
|
92
|
+
background: white
|
|
93
|
+
box-shadow: $boxshadow-button
|
|
94
|
+
&:after
|
|
95
|
+
content: ''
|
|
96
|
+
position absolute
|
|
97
|
+
top: -2px
|
|
98
|
+
bottom: -2px
|
|
99
|
+
right: -2px
|
|
100
|
+
width: 4px
|
|
101
|
+
height: 8px
|
|
102
|
+
border-radius: 4px
|
|
103
|
+
background: var(--theme)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.highlight
|
|
2
|
+
position: relative
|
|
3
|
+
|
|
4
|
+
.highlight .code .copy-btn
|
|
5
|
+
position: absolute
|
|
6
|
+
top: 0
|
|
7
|
+
right: 0
|
|
8
|
+
padding: 4px 0.5rem
|
|
9
|
+
opacity: 0
|
|
10
|
+
font-weight: 700
|
|
11
|
+
color: var(--theme)
|
|
12
|
+
cursor: pointer
|
|
13
|
+
|
|
14
|
+
.highlight:hover .copy-btn
|
|
15
|
+
opacity 0.25
|
|
16
|
+
|
|
17
|
+
.highlight .code .copy-btn:hover
|
|
18
|
+
color: var(--theme)
|
|
19
|
+
opacity: 0.75
|
|
20
|
+
|
|
21
|
+
.highlight .code .copy-btn.success
|
|
22
|
+
color: $c-green
|
|
23
|
+
opacity: 0.75
|
|
24
|
+
|
|
25
|
+
.highlight .code .copy-btn.warning
|
|
26
|
+
color: $c-orange
|
|
27
|
+
opacity: 0.75
|
|
@@ -9,6 +9,10 @@ if hexo-config('plugins.scrollreveal.enable')
|
|
|
9
9
|
@import 'scrollreveal'
|
|
10
10
|
if hexo-config('plugins.fancybox.enable')
|
|
11
11
|
@import 'fancybox'
|
|
12
|
+
if hexo-config('plugins.mermaid.enable')
|
|
13
|
+
@import 'mermaid'
|
|
14
|
+
if hexo-config('plugins.copycode.enable')
|
|
15
|
+
@import 'copycode'
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
// 评论
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
pre.mermaid
|
|
2
|
+
display: inline-block
|
|
3
|
+
width: 100%
|
|
4
|
+
text-align: center
|
|
5
|
+
font-family: $ff-body
|
|
6
|
+
|
|
7
|
+
.mermaid svg
|
|
8
|
+
width: 100%
|
|
9
|
+
display: inline-block
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.mermaid svg
|
|
13
|
+
width: 100%
|
|
14
|
+
display: inline-block
|
|
15
|
+
|
|
16
|
+
.mermaid span,text
|
|
17
|
+
font-family: $ff-body
|
|
18
|
+
|
|
19
|
+
.mermaid .edgeLabel
|
|
20
|
+
padding: 4px
|
|
21
|
+
background-color: var(--site-bg) !important
|
|
22
|
+
|
|
23
|
+
.mermaid rect.basic.label-container
|
|
24
|
+
stroke: var(--block-border) !important
|
|
25
|
+
fill: var(--block) !important
|
|
26
|
+
|
|
27
|
+
set_mermaid_darkmode()
|
|
28
|
+
.mermaid
|
|
29
|
+
fill: #ccc !important
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.mermaid .error-icon
|
|
33
|
+
fill: #a44141 !important
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
.mermaid .error-text
|
|
37
|
+
fill: #ddd !important
|
|
38
|
+
stroke: #ddd !important
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
.mermaid .marker
|
|
42
|
+
fill: lightgrey !important
|
|
43
|
+
stroke: lightgrey !important
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
.mermaid .marker.cross
|
|
47
|
+
stroke: lightgrey !important
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
.mermaid .label
|
|
51
|
+
color: #ccc !important
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
.mermaid .cluster-label text
|
|
55
|
+
fill: #F9FFFE !important
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
.mermaid .cluster-label span
|
|
59
|
+
color: #F9FFFE !important
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
.mermaid .label text,
|
|
63
|
+
.mermaid span
|
|
64
|
+
fill: #ccc !important
|
|
65
|
+
color: #ccc !important
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
.mermaid .node rect,
|
|
69
|
+
.mermaid .node circle,
|
|
70
|
+
.mermaid .node ellipse,
|
|
71
|
+
.mermaid .node polygon,
|
|
72
|
+
.mermaid .node path
|
|
73
|
+
fill: #1f2020 !important
|
|
74
|
+
stroke: #81B1DB !important
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
.mermaid .arrowheadPath
|
|
78
|
+
fill: lightgrey !important
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
.mermaid .edgePath .path
|
|
82
|
+
stroke: lightgrey !important
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
.mermaid .flowchart-link
|
|
86
|
+
stroke: lightgrey !important
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
.mermaid .edgeLabel
|
|
90
|
+
background-color: hsl(0, 0%, 34.4117647059%) !important
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
.mermaid .edgeLabel rect
|
|
94
|
+
background-color: hsl(0, 0%, 34.4117647059%) !important
|
|
95
|
+
fill: hsl(0, 0%, 34.4117647059%) !important
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
.mermaid .cluster rect
|
|
99
|
+
fill: hsl(180, 1.5873015873%, 28.3529411765%) !important
|
|
100
|
+
stroke: rgba(255, 255, 255, 0.25) !important
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
.mermaid .cluster text
|
|
104
|
+
fill: #F9FFFE !important
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
.mermaid .cluster span
|
|
108
|
+
color: #F9FFFE !important
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
.mermaid div.mermaidTooltip
|
|
112
|
+
background: hsl(20, 1.5873015873%, 12.3529411765%) !important
|
|
113
|
+
border: 1px solid rgba(255, 255, 255, 0.25) !important
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
.mermaid .flowchartTitleText
|
|
117
|
+
fill: #ccc
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
if hexo-config('style.darkmode') == 'auto'
|
|
121
|
+
@media (prefers-color-scheme: dark)
|
|
122
|
+
set_mermaid_darkmode()
|
|
123
|
+
|
|
124
|
+
if hexo-config('style.darkmode') == 'always'
|
|
125
|
+
set_mermaid_darkmode()
|
package/source/js/main.js
CHANGED
|
@@ -126,7 +126,7 @@ const init = {
|
|
|
126
126
|
highlightItem.addClass("active")
|
|
127
127
|
const e0 = document.querySelector('.widgets')
|
|
128
128
|
const e1 = document.querySelector('#data-toc a.toc-link[href="' + encodeURI(link) + '"]')
|
|
129
|
-
const offsetBottom = e1.getBoundingClientRect().bottom - e0.getBoundingClientRect().bottom +
|
|
129
|
+
const offsetBottom = e1.getBoundingClientRect().bottom - e0.getBoundingClientRect().bottom + 200
|
|
130
130
|
const offsetTop = e1.getBoundingClientRect().top - e0.getBoundingClientRect().top - 64
|
|
131
131
|
if (offsetTop < 0) {
|
|
132
132
|
e0.scrollBy(0, offsetTop)
|
|
@@ -334,9 +334,10 @@ if (stellar.search.service) {
|
|
|
334
334
|
var $resultArea = document.querySelector("div#search-result");
|
|
335
335
|
$inputArea.focus(function() {
|
|
336
336
|
var path = stellar.search[stellar.search.service]?.path || '/search.json';
|
|
337
|
-
if (
|
|
338
|
-
path =
|
|
337
|
+
if (path.startsWith('/')) {
|
|
338
|
+
path = path.substring(1);
|
|
339
339
|
}
|
|
340
|
+
path = stellar.config.root + path;
|
|
340
341
|
const filter = $inputArea.attr('data-filter') || '';
|
|
341
342
|
searchFunc(path, filter, 'search-input', 'search-result');
|
|
342
343
|
});
|
|
@@ -384,3 +385,7 @@ if (stellar.plugins.heti) {
|
|
|
384
385
|
stellar.plugins.heti.enable = false;
|
|
385
386
|
});
|
|
386
387
|
}
|
|
388
|
+
|
|
389
|
+
if (stellar.plugins.copycode) {
|
|
390
|
+
stellar.loadScript(stellar.plugins.copycode.js, { defer: true })
|
|
391
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const codeElementArr = document.querySelectorAll('.code')
|
|
2
|
+
codeElementArr.forEach(code => {
|
|
3
|
+
const codeBeforeWidth = window.getComputedStyle(code, '::before').width.split('px')[0]
|
|
4
|
+
const codeBeforePadding = window.getComputedStyle(code, '::before').padding.split(' ').pop().split('px')[0]
|
|
5
|
+
|
|
6
|
+
// copy btn
|
|
7
|
+
const codeCopyBtn = document.createElement('div')
|
|
8
|
+
codeCopyBtn.classList.add('copy-btn')
|
|
9
|
+
codeCopyBtn.style.right = Number(codeBeforeWidth) + Number(codeBeforePadding) * 2 + 'px'
|
|
10
|
+
codeCopyBtn.innerText = stellar.plugins.copycode.default_text
|
|
11
|
+
|
|
12
|
+
code.appendChild(codeCopyBtn)
|
|
13
|
+
|
|
14
|
+
codeCopyBtn.addEventListener('click', async () => {
|
|
15
|
+
const currentCodeElement = code.children[0]?.innerText
|
|
16
|
+
await copyCode(currentCodeElement)
|
|
17
|
+
|
|
18
|
+
codeCopyBtn.innerText = stellar.plugins.copycode.success_text
|
|
19
|
+
codeCopyBtn.classList.add('success')
|
|
20
|
+
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
codeCopyBtn.innerText = stellar.plugins.copycode.default_text
|
|
23
|
+
codeCopyBtn.classList.remove('success')
|
|
24
|
+
},3000)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
async function copyCode(currentCode) {
|
|
29
|
+
if (navigator.clipboard) {
|
|
30
|
+
try {
|
|
31
|
+
await navigator.clipboard.writeText(currentCode)
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// 未获得用户许可
|
|
34
|
+
codeCopyBtn.innerText = '未获得用户许可'
|
|
35
|
+
codeCopyBtn.classList.add('warning')
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
codeCopyBtn.innerText = stellar.plugins.copycode.default_text
|
|
38
|
+
codeCopyBtn.classList.remove('warning')
|
|
39
|
+
},3000)
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
codeCopyBtn.innerText = '当前浏览器不支持此api'
|
|
43
|
+
codeCopyBtn.classList.add('warning')
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
codeCopyBtn.innerText = stellar.plugins.copycode.default_text
|
|
46
|
+
codeCopyBtn.classList.remove('warning')
|
|
47
|
+
},3000)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -51,7 +51,7 @@ const sitesjs = {
|
|
|
51
51
|
arr.forEach((item, i) => {
|
|
52
52
|
var cell = '<div class="site-card">';
|
|
53
53
|
cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">';
|
|
54
|
-
cell += '<img src="' + (item.screenshot || ('https://
|
|
54
|
+
cell += '<img src="' + (item.screenshot || ('https://api.vlts.cc/screenshot?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.src=\'' + cfg.screenshot + '\';"/>';
|
|
55
55
|
cell += '<div class="info">';
|
|
56
56
|
cell += '<img src="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';"/>';
|
|
57
57
|
cell += '<span class="title">' + item.title + '</span>';
|
package/scripts/tags/lib/tag.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tag.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% tag text href [color:color] %}
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict'
|
|
10
|
-
|
|
11
|
-
const tag_colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
|
|
12
|
-
var tag_index = 0
|
|
13
|
-
|
|
14
|
-
module.exports = ctx => function(args) {
|
|
15
|
-
args = ctx.args.map(args, ['color'], ['text', 'href'])
|
|
16
|
-
if (args.color == null) {
|
|
17
|
-
const default_color = ctx.theme.config.tag_plugins.tag?.default_color
|
|
18
|
-
if (default_color) {
|
|
19
|
-
args.color = default_color
|
|
20
|
-
} else {
|
|
21
|
-
args.color = tag_colors[tag_index]
|
|
22
|
-
tag_index += 1
|
|
23
|
-
if (tag_index >= tag_colors.length) {
|
|
24
|
-
tag_index = 0
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
var el = ''
|
|
29
|
-
el += '<a class="tag-plugin tag"'
|
|
30
|
-
el += ' ' + ctx.args.joinTags(args, ['color', 'href']).join(' ')
|
|
31
|
-
el += '>'
|
|
32
|
-
el += args.text
|
|
33
|
-
el += '</a>'
|
|
34
|
-
return el
|
|
35
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.md-text .tag-plugin.tag
|
|
2
|
-
padding: 0px 4px
|
|
3
|
-
border-radius: 2px
|
|
4
|
-
background: var(--theme-bg1)
|
|
5
|
-
color: var(--text-p2)
|
|
6
|
-
margin: 2px 0
|
|
7
|
-
display: inline-block
|
|
8
|
-
font-size: $fs-14
|
|
9
|
-
trans2 background color
|
|
10
|
-
&:hover
|
|
11
|
-
background: var(--text-p2)
|
|
12
|
-
color: var(--theme-bg1)
|
|
13
|
-
|