hexo-theme-stellar 1.17.2 → 1.18.1
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/README.md +2 -2
- package/_config.yml +35 -57
- package/_data/widgets.yml +0 -15
- package/layout/_partial/plugins/comments/artalk/layout.ejs +19 -0
- package/layout/_partial/plugins/comments/artalk/script.ejs +25 -0
- package/layout/_partial/plugins/comments/layout.ejs +4 -4
- package/layout/_partial/scripts/index.ejs +1 -1
- package/layout/_partial/sidebar/header.ejs +4 -4
- package/layout/_partial/sidebar/index.ejs +4 -4
- package/layout/_partial/widgets/search.ejs +1 -0
- package/layout/_partial/widgets/toc.ejs +1 -1
- package/package.json +1 -1
- package/scripts/generators/search.js +2 -0
- package/scripts/tags/index.js +32 -6
- package/scripts/tags/inline-labels.js +27 -27
- package/scripts/tags/lib/ablock.js +33 -0
- package/scripts/tags/lib/about.js +48 -0
- package/scripts/tags/lib/checkbox.js +30 -0
- package/scripts/tags/{copy.js → lib/copy.js} +23 -23
- package/scripts/tags/lib/emoji.js +40 -0
- package/scripts/tags/{folders.js → lib/folders.js} +22 -22
- package/scripts/tags/lib/folding.js +30 -0
- package/scripts/tags/lib/frame.js +66 -0
- package/scripts/tags/lib/friends.js +53 -0
- package/scripts/tags/{ghcard.js → lib/ghcard.js} +18 -18
- package/scripts/tags/lib/grid.js +49 -0
- package/scripts/tags/{image.js → lib/image.js} +38 -38
- package/scripts/tags/lib/link.js +78 -0
- package/scripts/tags/lib/mark.js +23 -0
- package/scripts/tags/lib/navbar.js +57 -0
- package/scripts/tags/lib/note.js +35 -0
- package/scripts/tags/lib/poetry.js +47 -0
- package/scripts/tags/lib/quot.js +55 -0
- package/scripts/tags/lib/sites.js +57 -0
- package/scripts/tags/lib/swiper.js +36 -0
- package/scripts/tags/lib/tabs.js +33 -33
- package/scripts/tags/lib/tag.js +35 -0
- package/scripts/tags/lib/timeline.js +78 -0
- package/scripts/tags/lib/toc.js +73 -0
- package/source/css/_common/highlight.styl +0 -3
- package/source/css/_custom.styl +13 -27
- package/source/css/_defines/theme.styl +47 -34
- package/source/css/_layout/md.styl +14 -12
- package/source/css/_layout/partial/paginator.styl +2 -1
- package/source/css/_layout/partial/related.styl +8 -6
- package/source/css/_layout/sidebar/header.styl +2 -2
- package/source/css/_layout/tag-plugins/common.styl +51 -65
- package/source/css/_layout/tag-plugins/folders.styl +8 -8
- package/source/css/_layout/tag-plugins/folding.styl +10 -11
- package/source/css/_layout/tag-plugins/{split.styl → grid.styl} +4 -4
- package/source/css/_layout/tag-plugins/link.styl +1 -1
- package/source/css/_layout/tag-plugins/mark.styl +2 -2
- package/source/css/_layout/tag-plugins/navbar.styl +1 -1
- package/source/css/_layout/tag-plugins/note.styl +3 -1
- package/source/css/_layout/tag-plugins/poetry.styl +26 -25
- package/source/css/_layout/tag-plugins/quot.styl +45 -58
- package/source/css/_layout/tag-plugins/tag.styl +13 -0
- package/source/css/_layout/widgets/ghuser.styl +19 -15
- package/source/css/_layout/widgets/search.styl +102 -1
- package/source/css/_layout/widgets/toc_common.styl +1 -1
- package/source/css/_plugins/aplayer.styl +3 -0
- package/source/css/_plugins/comments/artalk.styl +4 -0
- package/source/css/_plugins/comments/twikoo.styl +0 -1
- package/source/css/_plugins/comments/utterances.styl +1 -1
- package/source/css/_plugins/index.styl +4 -3
- package/source/css/_plugins/swiper.styl +7 -4
- package/source/js/main.js +7 -5
- package/source/js/plugins/weibo.js +116 -0
- package/scripts/tags/about.js +0 -48
- package/scripts/tags/border.js +0 -35
- package/scripts/tags/checkbox.js +0 -38
- package/scripts/tags/emoji.js +0 -40
- package/scripts/tags/folding.js +0 -30
- package/scripts/tags/frame.js +0 -66
- package/scripts/tags/friends.js +0 -53
- package/scripts/tags/lib/users.js +0 -22
- package/scripts/tags/link.js +0 -79
- package/scripts/tags/mark.js +0 -23
- package/scripts/tags/navbar.js +0 -57
- package/scripts/tags/note.js +0 -37
- package/scripts/tags/poetry.js +0 -48
- package/scripts/tags/quot.js +0 -51
- package/scripts/tags/sites.js +0 -57
- package/scripts/tags/split.js +0 -49
- package/scripts/tags/swiper.js +0 -38
- package/scripts/tags/timeline.js +0 -81
- package/scripts/tags/toc.js +0 -72
- package/source/css/_plugins/search/local-search.styl +0 -87
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
.md-text .tag-plugin.quot
|
|
2
2
|
text-align: center
|
|
3
|
-
position: relative
|
|
4
3
|
align-items: center
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
display: flex
|
|
5
|
+
flex-direction: column
|
|
6
|
+
|
|
7
|
+
.content
|
|
8
|
+
display: flex
|
|
9
|
+
align-items: center
|
|
10
|
+
border-bottom: none
|
|
11
|
+
font-weight: 700
|
|
12
|
+
padding: 16px 24px
|
|
13
|
+
a.headerlink:before
|
|
14
|
+
content: ''
|
|
15
|
+
@media screen and (max-width: $device-mobile)
|
|
16
|
+
padding: 12px 20px
|
|
17
|
+
line-height: 1.2
|
|
19
18
|
|
|
19
|
+
.md-text .tag-plugin.quot .content
|
|
20
|
+
max-width 400px
|
|
21
|
+
position: relative
|
|
20
22
|
// override
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
color: var(--text-p0)
|
|
24
|
-
h1.quot
|
|
23
|
+
.tag-plugin.quot
|
|
24
|
+
h1
|
|
25
25
|
font-size: $fs-h1
|
|
26
26
|
font-weight: 900
|
|
27
27
|
padding: 20px 32px 12px 32px
|
|
28
28
|
@media screen and (max-width: $device-mobile)
|
|
29
29
|
padding: 20px 24px 12px
|
|
30
|
-
h2
|
|
30
|
+
h2,h3,h4,h5,h6
|
|
31
31
|
font-size: $fs-h3
|
|
32
|
-
p
|
|
32
|
+
p
|
|
33
33
|
font-size: $fs-h4
|
|
34
|
+
color: var(--text-p0)
|
|
34
35
|
|
|
35
36
|
// type=text
|
|
36
|
-
.md-text .tag-plugin.quot
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
.md-text .tag-plugin.quot
|
|
38
|
+
.content[type=text]
|
|
39
|
+
&:before,&:after
|
|
40
|
+
content: ""
|
|
41
|
+
position: absolute
|
|
42
|
+
width: 8px
|
|
43
|
+
height: 14px
|
|
44
|
+
&:before
|
|
45
|
+
top: 8px
|
|
46
|
+
left: 0
|
|
47
|
+
border-top: 6px solid $color-accent
|
|
48
|
+
border-left: 6px solid $color-accent
|
|
49
|
+
&:after
|
|
50
|
+
right: 0
|
|
51
|
+
bottom: 8px
|
|
52
|
+
border-right: 6px solid $color-accent
|
|
53
|
+
border-bottom: 6px solid $color-accent
|
|
54
|
+
h1.content[type=text]
|
|
55
|
+
&:before,&:after
|
|
56
|
+
width: 12px
|
|
57
|
+
height: 20px
|
|
58
|
+
border-width: 8px
|
|
57
59
|
|
|
58
60
|
// type=icon
|
|
59
|
-
.md-text .tag-plugin.quot[type=icon]
|
|
61
|
+
.md-text .tag-plugin.quot .content[type=icon]
|
|
60
62
|
.icon
|
|
61
63
|
height: 1.5em
|
|
62
64
|
display: inline-block
|
|
@@ -67,18 +69,3 @@
|
|
|
67
69
|
margin-right: .5rem
|
|
68
70
|
&.suffix
|
|
69
71
|
margin-left: .5rem
|
|
70
|
-
|
|
71
|
-
// inline quot
|
|
72
|
-
.md-text span.tag-plugin.quot
|
|
73
|
-
font-weight: 500
|
|
74
|
-
&:before,&:after
|
|
75
|
-
color: $color-accent
|
|
76
|
-
font-weight: 900
|
|
77
|
-
&:before
|
|
78
|
-
content: "「"
|
|
79
|
-
margin-left: -0.125em
|
|
80
|
-
margin-right: 0.125em
|
|
81
|
-
&:after
|
|
82
|
-
content: "」"
|
|
83
|
-
margin-left: 0.125em
|
|
84
|
-
margin-right: -0.125em
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
|
|
@@ -52,21 +52,25 @@
|
|
|
52
52
|
.menu
|
|
53
53
|
margin-bottom: 0
|
|
54
54
|
background: none
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
border: 0
|
|
56
|
+
a
|
|
57
|
+
margin: 0
|
|
58
|
+
&.active
|
|
59
|
+
box-shadow: none
|
|
60
|
+
position: relative
|
|
61
|
+
background: none
|
|
62
|
+
&:after
|
|
63
|
+
content: ''
|
|
64
|
+
position: absolute
|
|
65
|
+
height: 3px
|
|
66
|
+
bottom: 0
|
|
67
|
+
width: 32px
|
|
68
|
+
left: 'calc(50% - 0.5 * %s)' % @width
|
|
69
|
+
border-radius: 4px
|
|
70
|
+
background: $color-theme
|
|
71
|
+
&:hover
|
|
72
|
+
box-shadow: none
|
|
73
|
+
background: var(--block)
|
|
70
74
|
|
|
71
75
|
.buttons
|
|
72
76
|
margin: 1rem 0
|
|
@@ -1,3 +1,104 @@
|
|
|
1
1
|
.widgets .widget-wrapper.search
|
|
2
|
-
margin-top:
|
|
2
|
+
margin-top: 1rem
|
|
3
3
|
margin-bottom: 0
|
|
4
|
+
|
|
5
|
+
.search-wrapper
|
|
6
|
+
width: 100%
|
|
7
|
+
>.search-form
|
|
8
|
+
position: sticky
|
|
9
|
+
top: 1rem
|
|
10
|
+
display: flex
|
|
11
|
+
flex-direction: row
|
|
12
|
+
align-items: center
|
|
13
|
+
.search-input
|
|
14
|
+
width: 100%
|
|
15
|
+
padding: 0.5rem
|
|
16
|
+
line-height: 1
|
|
17
|
+
box-sizing: border-box
|
|
18
|
+
font-family: $ff-body
|
|
19
|
+
border-radius: $border-block
|
|
20
|
+
background-color: var(--card)
|
|
21
|
+
color: var(--text-p0)
|
|
22
|
+
border: 1px solid var(--block-border)
|
|
23
|
+
&:focus
|
|
24
|
+
trans1 border-color
|
|
25
|
+
|
|
26
|
+
&.noresult
|
|
27
|
+
.search-input
|
|
28
|
+
&:focus
|
|
29
|
+
border: 1px solid $c-red
|
|
30
|
+
.search-icon
|
|
31
|
+
color: $c-red
|
|
32
|
+
|
|
33
|
+
.search-no-result
|
|
34
|
+
display: none
|
|
35
|
+
margin: 1em auto
|
|
36
|
+
color: var(--text-p1)
|
|
37
|
+
text-align: center
|
|
38
|
+
font-size: $fs-14
|
|
39
|
+
padding: 2rem
|
|
40
|
+
background: var(--block)
|
|
41
|
+
border-radius: $border-block
|
|
42
|
+
|
|
43
|
+
#search-result
|
|
44
|
+
ul.search-result-list
|
|
45
|
+
padding: 0
|
|
46
|
+
margin: 0
|
|
47
|
+
list-style-type: none
|
|
48
|
+
li
|
|
49
|
+
margin: 1em auto
|
|
50
|
+
&:hover
|
|
51
|
+
.search-result-title
|
|
52
|
+
color: $color-hover
|
|
53
|
+
.search-result-title
|
|
54
|
+
color: var(--text-p1)
|
|
55
|
+
font-weight: 700
|
|
56
|
+
line-height: 1.2
|
|
57
|
+
|
|
58
|
+
.search-result-content
|
|
59
|
+
overflow: hidden
|
|
60
|
+
color: var(--text-p3)
|
|
61
|
+
margin: .4em auto
|
|
62
|
+
max-height: 13em
|
|
63
|
+
text-align: justify
|
|
64
|
+
font-size: $fs-12
|
|
65
|
+
line-height: 1.2
|
|
66
|
+
display: -webkit-box
|
|
67
|
+
-webkit-box-orient: vertical
|
|
68
|
+
overflow: hidden
|
|
69
|
+
-webkit-line-clamp: 3
|
|
70
|
+
|
|
71
|
+
.search-keyword
|
|
72
|
+
border-bottom: 1px dashed $color-hover
|
|
73
|
+
color: $color-hover
|
|
74
|
+
font-weight: bold
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
.search-wrapper.noresult
|
|
79
|
+
.search-no-result
|
|
80
|
+
display: block
|
|
81
|
+
|
|
82
|
+
.widget-wrapper
|
|
83
|
+
.search-form
|
|
84
|
+
top: 0
|
|
85
|
+
background: var(--site-bg)
|
|
86
|
+
.search-input
|
|
87
|
+
margin-top: 1rem
|
|
88
|
+
margin-bottom: -1rem
|
|
89
|
+
padding-left: 1.75rem
|
|
90
|
+
.search-icon
|
|
91
|
+
margin-top: 1rem
|
|
92
|
+
margin-bottom: -1rem
|
|
93
|
+
position: absolute
|
|
94
|
+
margin-left: 0.5rem
|
|
95
|
+
left: 0
|
|
96
|
+
pointer-events: none
|
|
97
|
+
color: var(--text-p2)
|
|
98
|
+
|
|
99
|
+
#search-result,.search-no-result
|
|
100
|
+
margin-top: 2rem
|
|
101
|
+
|
|
102
|
+
.widget-wrapper:not(:first-child)
|
|
103
|
+
.search-wrapper
|
|
104
|
+
margin-top: -1rem
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import 'aplayer'
|
|
2
|
+
|
|
1
3
|
// 根据主题配置加载
|
|
2
4
|
if hexo-config('plugins.lazyload.enable')
|
|
3
5
|
@import 'lazyload'
|
|
@@ -8,9 +10,6 @@ if hexo-config('plugins.scrollreveal.enable')
|
|
|
8
10
|
if hexo-config('plugins.fancybox.enable')
|
|
9
11
|
@import 'fancybox'
|
|
10
12
|
|
|
11
|
-
// 搜索
|
|
12
|
-
if hexo-config('search.service') == 'local_search'
|
|
13
|
-
@import 'search/local-search'
|
|
14
13
|
|
|
15
14
|
// 评论
|
|
16
15
|
if hexo-config('comments.service') == 'beaudar'
|
|
@@ -21,3 +20,5 @@ if hexo-config('comments.service') == 'utterances'
|
|
|
21
20
|
@import 'comments/utterances'
|
|
22
21
|
if hexo-config('comments.service') == 'waline'
|
|
23
22
|
@import 'comments/waline'
|
|
23
|
+
if hexo-config('comments.service') == 'artalk'
|
|
24
|
+
@import 'comments/artalk'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
:root
|
|
2
2
|
--swiper-theme-color: $color-theme !important
|
|
3
|
-
.swiper
|
|
3
|
+
.swiper
|
|
4
4
|
width: 100%
|
|
5
5
|
border-radius: 4px
|
|
6
6
|
--gap-p: 2rem
|
|
7
|
-
.swiper
|
|
7
|
+
.swiper:not(.swiper-initialized)
|
|
8
8
|
display: none
|
|
9
9
|
div.swiper-slide
|
|
10
10
|
text-align: center
|
|
@@ -25,12 +25,15 @@ div.swiper-slide
|
|
|
25
25
|
img
|
|
26
26
|
border-radius: 4px
|
|
27
27
|
|
|
28
|
-
.swiper
|
|
28
|
+
.swiper[width='max'] .swiper-slide
|
|
29
29
|
width: 100%
|
|
30
30
|
|
|
31
|
-
.swiper
|
|
31
|
+
.swiper[width='min'] .swiper-slide
|
|
32
32
|
width: 25%
|
|
33
33
|
|
|
34
|
+
.swiper[effect='cards'] .swiper-slide
|
|
35
|
+
max-width: 75%
|
|
36
|
+
|
|
34
37
|
.swiper-button-prev,.swiper-button-next
|
|
35
38
|
padding: 1rem 0.5rem
|
|
36
39
|
margin-top: -2rem !important
|
package/source/js/main.js
CHANGED
|
@@ -111,12 +111,12 @@ const init = {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
if (topSeg) {
|
|
114
|
-
$("
|
|
114
|
+
$("#data-toc a.toc-link").removeClass("active")
|
|
115
115
|
var link = "#" + topSeg.attr("id")
|
|
116
116
|
if (link != '#undefined') {
|
|
117
|
-
$('
|
|
117
|
+
$('#data-toc a.toc-link[href="' + encodeURI(link) + '"]').addClass("active")
|
|
118
118
|
} else {
|
|
119
|
-
$('
|
|
119
|
+
$('#data-toc a.toc-link:first').addClass("active")
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
})
|
|
@@ -124,7 +124,7 @@ const init = {
|
|
|
124
124
|
},
|
|
125
125
|
sidebar: () => {
|
|
126
126
|
stellar.jQuery(() => {
|
|
127
|
-
$("
|
|
127
|
+
$("#data-toc a.toc-link").click(function (e) {
|
|
128
128
|
l_body.classList.remove("sidebar");
|
|
129
129
|
});
|
|
130
130
|
})
|
|
@@ -241,10 +241,12 @@ if (stellar.plugins.swiper) {
|
|
|
241
241
|
if (swiper_api != undefined) {
|
|
242
242
|
stellar.loadCSS(stellar.plugins.swiper.css);
|
|
243
243
|
stellar.loadScript(stellar.plugins.swiper.js, { defer: true }).then(function () {
|
|
244
|
-
|
|
244
|
+
const effect = swiper_api.getAttribute('effect') || '';
|
|
245
|
+
var swiper = new Swiper('.swiper#swiper-api', {
|
|
245
246
|
slidesPerView: 'auto',
|
|
246
247
|
spaceBetween: 8,
|
|
247
248
|
centeredSlides: true,
|
|
249
|
+
effect: effect,
|
|
248
250
|
loop: true,
|
|
249
251
|
pagination: {
|
|
250
252
|
el: '.swiper-pagination',
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const weibojs = {
|
|
2
|
+
requestAPI: (url, callback, timeout) => {
|
|
3
|
+
let retryTimes = 5;
|
|
4
|
+
function request() {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
let status = 0; // 0 等待 1 完成 2 超时
|
|
7
|
+
let timer = setTimeout(() => {
|
|
8
|
+
if (status === 0) {
|
|
9
|
+
status = 2;
|
|
10
|
+
timer = null;
|
|
11
|
+
reject('请求超时');
|
|
12
|
+
if (retryTimes == 0) {
|
|
13
|
+
timeout();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}, 5000);
|
|
17
|
+
fetch(url).then(function(response) {
|
|
18
|
+
if (status !== 2) {
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
resolve(response);
|
|
21
|
+
timer = null;
|
|
22
|
+
status = 1;
|
|
23
|
+
}
|
|
24
|
+
if (response.ok) {
|
|
25
|
+
return response.json();
|
|
26
|
+
}
|
|
27
|
+
throw new Error('Network response was not ok.');
|
|
28
|
+
}).then(function(data) {
|
|
29
|
+
retryTimes = 0;
|
|
30
|
+
callback(data);
|
|
31
|
+
}).catch(function(error) {
|
|
32
|
+
if (retryTimes > 0) {
|
|
33
|
+
retryTimes -= 1;
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
request();
|
|
36
|
+
}, 5000);
|
|
37
|
+
} else {
|
|
38
|
+
timeout();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
request();
|
|
44
|
+
},
|
|
45
|
+
layoutDiv: (cfg) => {
|
|
46
|
+
const el = $(cfg.el)[0];
|
|
47
|
+
$(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>');
|
|
48
|
+
weibojs.requestAPI(cfg.api, function(data) {
|
|
49
|
+
$(el).find('.loading-wrap').remove();
|
|
50
|
+
const arr = data.tweets || [];
|
|
51
|
+
const limit = el.getAttribute('limit');
|
|
52
|
+
arr.forEach((item, i) => {
|
|
53
|
+
if (limit && i >= limit) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var cell = '<div class="timenode" index="' + i + '">';
|
|
57
|
+
cell += '<div class="header">';
|
|
58
|
+
cell += '<div class="user-info">';
|
|
59
|
+
cell += '<img src="' + (data.user.avatar_hd || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
|
|
60
|
+
cell += '<span>' + data.user.nick_name + '</span>';
|
|
61
|
+
cell += '</div>';
|
|
62
|
+
cell += '<p>' + item.created_at + '</p>';
|
|
63
|
+
cell += '</div>';
|
|
64
|
+
cell += '<div class="body">';
|
|
65
|
+
cell += '<a class="body" href="' + item.url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
66
|
+
cell += item.content;
|
|
67
|
+
cell += '</a>';
|
|
68
|
+
// cell += '</div>';
|
|
69
|
+
// 每条微博的右下角 转发 评论 点赞
|
|
70
|
+
cell += '<div class="footer">';
|
|
71
|
+
cell += '<div class="flex left">';
|
|
72
|
+
cell += '</div>';
|
|
73
|
+
cell += '<div class="flex right">';
|
|
74
|
+
cell += '<div class="item reaction repost">';
|
|
75
|
+
cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
76
|
+
cell += '<span>' + '🔗' + ' ' + item.reposts_count + '</span>';
|
|
77
|
+
cell += '</a>';
|
|
78
|
+
cell += '</div>';
|
|
79
|
+
cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
80
|
+
cell += '<span><svg t="1666270368054" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2528" width="200" height="200"><path d="M952 64H72C32.3 64 0 96.3 0 136v508c0 39.7 32.3 72 72 72h261l128 128c14 14 32.5 21.1 50.9 21.1s36.9-7 50.9-21.1l128-128h261c39.7 0 72-32.3 72-72V136c0.2-39.7-32.1-72-71.8-72zM222 462c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72-32.2 72-72 72z m290-7.7c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z m290 8c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z" p-id="2529"></path></svg> '
|
|
81
|
+
+ (item.comments_count || 0) + '</span>';
|
|
82
|
+
cell += '</a>';
|
|
83
|
+
cell += '<div class="item reaction attitudes">';
|
|
84
|
+
cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
85
|
+
cell += '<span>' + '👍' + ' ' + item.attitudes_count + '</span>';
|
|
86
|
+
cell += '</a>';
|
|
87
|
+
cell += '</div>';
|
|
88
|
+
|
|
89
|
+
cell += '</div>';
|
|
90
|
+
cell += '</div>';
|
|
91
|
+
// 右下角结束
|
|
92
|
+
$(el).append(cell);
|
|
93
|
+
});
|
|
94
|
+
}, function() {
|
|
95
|
+
$(el).find('.loading-wrap svg').remove();
|
|
96
|
+
$(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" d="M12 3L21 20H3L12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.5s" values="60;0"/></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 10V14"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="6;0"/></path></g><circle cx="12" cy="17" r="1" fill="currentColor" fill-opacity="0"><animate fill="freeze" attributeName="fill-opacity" begin="0.8s" dur="0.4s" values="0;1"/></circle></svg>');
|
|
97
|
+
$(el).find('.loading-wrap').addClass('error');
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
$(function () {
|
|
103
|
+
const els = document.getElementsByClassName('stellar-weibo-api');
|
|
104
|
+
for (var i = 0; i < els.length; i++) {
|
|
105
|
+
const el = els[i];
|
|
106
|
+
const api = el.getAttribute('api'); // 这个API可以返回微博的json文件
|
|
107
|
+
if (api == null) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
var cfg = new Object();
|
|
111
|
+
cfg.el = el;
|
|
112
|
+
cfg.api = api;
|
|
113
|
+
cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg';
|
|
114
|
+
weibojs.layoutDiv(cfg);
|
|
115
|
+
}
|
|
116
|
+
});
|
package/scripts/tags/about.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* about.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% about [avatar:xxx] [height:80px] %}
|
|
6
|
-
* title / body
|
|
7
|
-
* {% endabout %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
const url_for = require('hexo-util').url_for.bind(hexo);
|
|
12
|
-
|
|
13
|
-
hexo.extend.tag.register('about', function(args, content) {
|
|
14
|
-
args = hexo.args.map(args, ['avatar', 'height', 'border', 'back']);
|
|
15
|
-
var rows = hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n');
|
|
16
|
-
var el = '';
|
|
17
|
-
// wrapper
|
|
18
|
-
el += '<div class="tag-plugin about">';
|
|
19
|
-
if (args.back) {
|
|
20
|
-
el += '<a class="nav-back cap" href="' + url_for(hexo.config.root) + '">';
|
|
21
|
-
el += '<svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
|
|
22
|
-
el += '</a>';
|
|
23
|
-
}
|
|
24
|
-
// avatar
|
|
25
|
-
var avatar_url = args.avatar;
|
|
26
|
-
if (avatar_url) {
|
|
27
|
-
el += '<div class="about-header">';
|
|
28
|
-
el += '<div class="avatar">';
|
|
29
|
-
el += '<img src="' + avatar_url + '"';
|
|
30
|
-
if (args.border && args.border.length > 0) {
|
|
31
|
-
el += ' style="border-radius:' + args.border + '"';
|
|
32
|
-
}
|
|
33
|
-
if (args.height && args.height.length > 0) {
|
|
34
|
-
el += ' height="' + args.height + '"';
|
|
35
|
-
}
|
|
36
|
-
el += '/>';
|
|
37
|
-
el += '</div>';
|
|
38
|
-
el += '</div>';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// content
|
|
42
|
-
el += '<div class="about-body fs14">';
|
|
43
|
-
el += rows.join('');
|
|
44
|
-
el += '</div>';
|
|
45
|
-
|
|
46
|
-
el += '</div>';
|
|
47
|
-
return el;
|
|
48
|
-
}, {ends: true});
|
package/scripts/tags/border.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* border.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% border [color:color] [child:codeblock/tabs] title %}
|
|
6
|
-
* body
|
|
7
|
-
* {% endborder %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('border', function(args, content) {
|
|
13
|
-
args = hexo.args.map(args, ['color', 'child'], ['title']);
|
|
14
|
-
const color = args.color;
|
|
15
|
-
const title = args.title;
|
|
16
|
-
var el = '';
|
|
17
|
-
const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
|
|
18
|
-
if (!color && defaultColor) {
|
|
19
|
-
color = defaultColor;
|
|
20
|
-
}
|
|
21
|
-
// header
|
|
22
|
-
el += '<div class="tag-plugin note"';
|
|
23
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
|
24
|
-
el += '>';
|
|
25
|
-
// title
|
|
26
|
-
if (title && title.length > 0) {
|
|
27
|
-
el += '<div class="title"><strong>' + title + '</strong></div>';
|
|
28
|
-
}
|
|
29
|
-
// content
|
|
30
|
-
el += '<div class="body">';
|
|
31
|
-
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
|
32
|
-
el += '</div></div>';
|
|
33
|
-
|
|
34
|
-
return el;
|
|
35
|
-
}, {ends: true});
|
package/scripts/tags/checkbox.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* checkbox.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* radio.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
4
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
5
|
-
*
|
|
6
|
-
* {% checkbox [checked:false] [color:cyan] [symbol:plus/minus/times] text %}
|
|
7
|
-
* {% radio [checked:false] [color:cyan] text %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
function layoutDiv(args, type) {
|
|
13
|
-
args = hexo.args.map(args, ['color', 'checked', 'symbol'], ['text']);
|
|
14
|
-
var el = '';
|
|
15
|
-
// div
|
|
16
|
-
el += '<div class="tag-plugin checkbox"';
|
|
17
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'symbol']).join(' ');
|
|
18
|
-
el += '>';
|
|
19
|
-
// input
|
|
20
|
-
el += '<input type="' + type + '"';
|
|
21
|
-
if (args.checked == 'true') {
|
|
22
|
-
el += ' checked="true"';
|
|
23
|
-
}
|
|
24
|
-
el += '/>';
|
|
25
|
-
// text
|
|
26
|
-
el += '<span>' + args.text + '</span>';
|
|
27
|
-
// div
|
|
28
|
-
el += '</div>';
|
|
29
|
-
return el;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
hexo.extend.tag.register('checkbox', function(args) {
|
|
33
|
-
return layoutDiv(args, 'checkbox');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
hexo.extend.tag.register('radio', function(args) {
|
|
37
|
-
return layoutDiv(args, 'radio');
|
|
38
|
-
});
|