hexo-theme-stellar 1.12.0 → 1.13.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/README.md +7 -7
- package/_config.yml +8 -26
- package/_data/links.yml +7 -0
- package/_data/widgets.yml +1 -1
- package/layout/_partial/head.ejs +2 -0
- package/layout/_partial/main/navbar/list_post.ejs +57 -34
- package/layout/_partial/main/post_list/post_card.ejs +5 -1
- package/layout/_partial/scripts/index.ejs +1 -0
- package/layout/_partial/sidebar/widgets/ghissues.ejs +0 -1
- package/layout/_partial/sidebar/widgets/timeline.ejs +1 -1
- package/layout/page.ejs +19 -10
- package/package.json +1 -1
- package/scripts/events/lib/config.js +1 -1
- package/scripts/tags/friends.js +36 -75
- package/scripts/tags/sites.js +40 -79
- package/scripts/tags/timeline.js +6 -4
- package/source/css/_layout/list.styl +2 -5
- package/source/css/_layout/main.styl +1 -1
- package/source/css/_layout/md.styl +0 -3
- package/source/css/_layout/partial/navbar.styl +1 -1
- package/source/css/_layout/sidebar/sidebar.styl +10 -9
- package/source/css/_layout/sidebar/widgets.styl +1 -2
- package/source/css/_layout/tag-plugins/split.styl +10 -6
- package/source/css/_layout/tag-plugins/timeline.styl +22 -5
- package/source/css/_plugins/comments/waline.styl +4 -0
- package/source/css/_plugins/index.styl +0 -2
- package/source/js/main.js +1 -1
- package/source/js/plugins/fcircle.js +92 -0
- package/source/js/plugins/timeline.js +47 -34
- package/layout/_partial/plugins/comments/valine/layout.ejs +0 -19
- package/layout/_partial/plugins/comments/valine/script.ejs +0 -48
- package/scripts/tags/issues.js +0 -30
- package/source/css/_plugins/comments/valine.styl +0 -222
|
@@ -105,19 +105,16 @@
|
|
|
105
105
|
position: absolute
|
|
106
106
|
line-height: 1.2
|
|
107
107
|
width: 'calc(100% - %s * 2)' % 1rem
|
|
108
|
-
|
|
109
|
-
color: white
|
|
108
|
+
color: var(--text-p0)
|
|
110
109
|
&[position=top]
|
|
111
110
|
top: 0
|
|
112
|
-
background-image: linear-gradient(rgba(0,0,0,0.3),rgba(0,0,0,0.2),rgba(0,0,0,0))
|
|
113
111
|
&[position=bottom]
|
|
114
112
|
bottom: 0
|
|
115
|
-
background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2),rgba(0,0,0,0.3))
|
|
116
113
|
div+div
|
|
117
114
|
margin-top: 4px
|
|
118
115
|
.cap
|
|
119
|
-
color: white
|
|
120
116
|
font-size: $fs-13
|
|
117
|
+
color: unset
|
|
121
118
|
.title
|
|
122
119
|
font-weight: 500
|
|
123
120
|
font-size: $fs-h3
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
margin-left: "calc(2 * %s)" % var(--gap-l)
|
|
6
6
|
margin-right: "calc(2 * %s + %s / 2)" % (var(--gap-l) var(--width-left))
|
|
7
7
|
@media screen and (min-width: $device-mobile-max)
|
|
8
|
-
padding-top: "calc(
|
|
8
|
+
padding-top: "calc(1 * %s)" % var(--gap-l)
|
|
9
9
|
header
|
|
10
10
|
margin: 4rem 1rem 2rem
|
|
11
11
|
.logo-wrap
|
|
@@ -3,20 +3,21 @@
|
|
|
3
3
|
flex-direction: column
|
|
4
4
|
word-break: break-all
|
|
5
5
|
text-align: justify
|
|
6
|
-
|
|
7
|
-
padding-top: "calc(2 * %s)" % var(--gap-l)
|
|
8
|
-
height: "calc(100vh - 3 * %s)" % var(--gap-l)
|
|
9
|
-
@media screen and (max-width: $device-mobile-max)
|
|
10
|
-
padding-top: "calc(1 * %s)" % var(--gap-l)
|
|
11
|
-
height: "calc(100% - 2 * %s)" % var(--gap-l)
|
|
6
|
+
height: "calc(100vh - 1 * %s)" % var(--gap-l)
|
|
12
7
|
.header
|
|
13
|
-
margin:
|
|
8
|
+
margin: var(--gap-l) var(--gap-l) 0
|
|
9
|
+
@media screen and (min-width: $device-mobile-max)
|
|
10
|
+
>.widgets:first-child>.widget-wrap:first-child
|
|
11
|
+
margin-top: "calc(2 * %s)" % var(--gap-l)
|
|
12
|
+
@media screen and (max-width: $device-mobile-max)
|
|
13
|
+
height: 100vh
|
|
14
|
+
|
|
14
15
|
|
|
15
16
|
.l_left[layout=wiki]
|
|
16
17
|
padding-bottom: 0
|
|
17
|
-
height:
|
|
18
|
+
height: 100vh
|
|
18
19
|
@media screen and (max-width: $device-mobile-max)
|
|
19
|
-
height:
|
|
20
|
+
height: 100vh
|
|
20
21
|
.widgets >:last-child
|
|
21
22
|
margin-bottom: 6rem
|
|
22
23
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.md .tag-plugin.split
|
|
2
|
-
margin: 0.5rem 0
|
|
3
1
|
.tag-plugin.split
|
|
4
2
|
display: grid
|
|
5
3
|
grid-gap: 16px
|
|
6
4
|
grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 16px)
|
|
7
|
-
|
|
5
|
+
>.cell
|
|
6
|
+
margin: 1rem 0
|
|
7
|
+
>.cell>
|
|
8
8
|
p
|
|
9
9
|
line-height: 1.5
|
|
10
10
|
:first-child
|
|
@@ -18,11 +18,15 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
.tag-plugin.split
|
|
21
|
-
|
|
21
|
+
@media screen and (max-width: $device-tablet)
|
|
22
|
+
display: block
|
|
23
|
+
|
|
24
|
+
.tag-plugin.split
|
|
25
|
+
&[bg]>.cell
|
|
22
26
|
padding: 1rem
|
|
23
27
|
border-radius: $border-card
|
|
24
|
-
&[bg='block']
|
|
28
|
+
&[bg='block']>.cell
|
|
25
29
|
background: var(--block)
|
|
26
|
-
&[bg='card']
|
|
30
|
+
&[bg='card']>.cell
|
|
27
31
|
background: var(--card)
|
|
28
32
|
box-shadow: $boxshadow-card
|
|
@@ -113,15 +113,32 @@
|
|
|
113
113
|
.tag-plugin.copy
|
|
114
114
|
width: 240px
|
|
115
115
|
|
|
116
|
+
.tag-plugin.timeline[api]
|
|
117
|
+
&.stellar-fcircle-api .timenode:hover .header
|
|
118
|
+
.user-info
|
|
119
|
+
background: inherit
|
|
120
|
+
span
|
|
121
|
+
color: inherit
|
|
122
|
+
a.body
|
|
123
|
+
color: var(--text-p1)
|
|
124
|
+
trans2: transform box-shadow
|
|
125
|
+
line-height: 1.25
|
|
126
|
+
padding: 0.75rem 1rem
|
|
127
|
+
&:hover
|
|
128
|
+
transform: translateY(-1px)
|
|
129
|
+
box-shadow: $boxshadow-card-float
|
|
130
|
+
|
|
116
131
|
|
|
117
|
-
.tag-plugin.timeline
|
|
118
|
-
max-height: convert(hexo-config('tag_plugins.timeline.max-height'))
|
|
132
|
+
.tag-plugin.timeline[api] .body
|
|
119
133
|
overflow: scroll
|
|
120
|
-
p.title
|
|
134
|
+
p.title
|
|
121
135
|
font-size: 1rem
|
|
122
136
|
font-weight: 700
|
|
123
137
|
margin: 0.5rem 0 0.75rem
|
|
124
138
|
line-height: 1.25
|
|
139
|
+
&:only-child
|
|
140
|
+
margin-bottom: 0.5rem
|
|
141
|
+
font-weight: 500
|
|
125
142
|
a
|
|
126
143
|
color: inherit
|
|
127
144
|
&:hover
|
|
@@ -136,7 +153,7 @@
|
|
|
136
153
|
pre code
|
|
137
154
|
font-size: $fs-12
|
|
138
155
|
|
|
139
|
-
.tag-plugin.timeline
|
|
156
|
+
.tag-plugin.timeline[api] .body .footer
|
|
140
157
|
margin: 0 0 -0.5rem
|
|
141
158
|
padding: 0.5rem 0 1rem
|
|
142
159
|
user-select: none
|
|
@@ -159,7 +176,7 @@
|
|
|
159
176
|
font-size: $fs-12
|
|
160
177
|
align-items: stretch
|
|
161
178
|
|
|
162
|
-
.tag-plugin.timeline
|
|
179
|
+
.tag-plugin.timeline[api] .body .footer
|
|
163
180
|
.item
|
|
164
181
|
border-width: 1px
|
|
165
182
|
border-style: solid
|
|
@@ -15,7 +15,5 @@ if hexo-config('comments.service') == 'twikoo'
|
|
|
15
15
|
@import 'comments/twikoo'
|
|
16
16
|
if hexo-config('comments.service') == 'utterances'
|
|
17
17
|
@import 'comments/utterances'
|
|
18
|
-
if hexo-config('comments.service') == 'valine'
|
|
19
|
-
@import 'comments/valine'
|
|
20
18
|
if hexo-config('comments.service') == 'waline'
|
|
21
19
|
@import 'comments/waline'
|
package/source/js/main.js
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const FCircle = {
|
|
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
|
+
FCircle.requestAPI(cfg.api, function(data) {
|
|
49
|
+
$(el).find('.loading-wrap').remove();
|
|
50
|
+
const arr = data.article_data || [];
|
|
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="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
|
|
60
|
+
cell += '<span>' + item.author + '</span>';
|
|
61
|
+
cell += '</div>';
|
|
62
|
+
cell += '<p>' + item.updated + '</p>';
|
|
63
|
+
cell += '</div>';
|
|
64
|
+
cell += '<a class="body" href="' + item.link + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
65
|
+
cell += item.title;
|
|
66
|
+
cell += '</a>';
|
|
67
|
+
cell += '</div>';
|
|
68
|
+
$(el).append(cell);
|
|
69
|
+
});
|
|
70
|
+
}, function() {
|
|
71
|
+
$(el).find('.loading-wrap svg').remove();
|
|
72
|
+
$(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>');
|
|
73
|
+
$(el).find('.loading-wrap').addClass('error');
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$(function () {
|
|
79
|
+
const els = document.getElementsByClassName('stellar-fcircle-api');
|
|
80
|
+
for (var i = 0; i < els.length; i++) {
|
|
81
|
+
const el = els[i];
|
|
82
|
+
const api = el.getAttribute('api');
|
|
83
|
+
if (api == null) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
var cfg = new Object();
|
|
87
|
+
cfg.el = el;
|
|
88
|
+
cfg.api = api;
|
|
89
|
+
cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg';
|
|
90
|
+
FCircle.layoutDiv(cfg);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
@@ -57,12 +57,18 @@ const StellarTimeline = {
|
|
|
57
57
|
$(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>');
|
|
58
58
|
StellarTimeline.requestAPI(cfg.api, function(data) {
|
|
59
59
|
$(el).find('.loading-wrap').remove();
|
|
60
|
+
const query = new URL(cfg.api).search;
|
|
60
61
|
const arr = data.content || data;
|
|
61
62
|
var users = [];
|
|
62
63
|
const filter = el.getAttribute('user');
|
|
63
64
|
if (filter && filter.length > 0) {
|
|
64
65
|
users = filter.split(",");
|
|
65
66
|
}
|
|
67
|
+
var hide = [];
|
|
68
|
+
const hideStr = el.getAttribute('hide');
|
|
69
|
+
if (hideStr && hideStr.length > 0) {
|
|
70
|
+
hide = hideStr.split(",");
|
|
71
|
+
}
|
|
66
72
|
arr.forEach((item, i) => {
|
|
67
73
|
if (item.user && item.user.login && users.length > 0) {
|
|
68
74
|
if (!users.includes(item.user.login)) {
|
|
@@ -81,46 +87,53 @@ const StellarTimeline = {
|
|
|
81
87
|
cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>';
|
|
82
88
|
cell += '</div>';
|
|
83
89
|
cell += '<div class="body">';
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
cell += '</p>';
|
|
89
|
-
|
|
90
|
-
cell += marked.parse(item.body);
|
|
91
|
-
cell += '<div class="footer">';
|
|
92
|
-
cell += '<div class="flex left">';
|
|
93
|
-
if (item.labels) {
|
|
94
|
-
item.labels.forEach((label, i) => {
|
|
95
|
-
cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">';
|
|
96
|
-
cell += '<span>' + label.name + '</span>';
|
|
97
|
-
cell += '</div>';
|
|
98
|
-
});
|
|
99
|
-
} else if (item.zipball_url) {
|
|
100
|
-
cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
101
|
-
cell += '<span>📦 ' + item.tag_name + '.zip</span>';
|
|
90
|
+
if (!hide.includes('title')) {
|
|
91
|
+
cell += '<p class="title">';
|
|
92
|
+
cell += '<a href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
93
|
+
cell += item.title || item.name || item.tag_name;
|
|
102
94
|
cell += '</a>';
|
|
95
|
+
cell += '</p>';
|
|
103
96
|
}
|
|
104
|
-
|
|
105
|
-
cell +=
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
|
|
98
|
+
cell += marked.parse(item.body);
|
|
99
|
+
if (!hide.includes('footer')) {
|
|
100
|
+
cell += '<div class="footer">';
|
|
101
|
+
cell += '<div class="flex left">';
|
|
102
|
+
if (item.labels) {
|
|
103
|
+
item.labels.forEach((label, i) => {
|
|
104
|
+
if (!query || !query.includes(encodeURI(label.name))) {
|
|
105
|
+
cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">';
|
|
106
|
+
cell += '<span>' + label.name + '</span>';
|
|
107
|
+
cell += '</div>';
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
} else if (item.zipball_url) {
|
|
111
|
+
cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
112
|
+
cell += '<span>📦 ' + item.tag_name + '.zip</span>';
|
|
113
|
+
cell += '</a>';
|
|
114
|
+
}
|
|
115
|
+
cell += '</div>';
|
|
116
|
+
cell += '<div class="flex right">';
|
|
117
|
+
if (item.reactions && item.reactions.total_count > 0) {
|
|
118
|
+
for (let key of Object.keys(StellarTimeline.reactions)) {
|
|
119
|
+
let num = item.reactions[key];
|
|
120
|
+
if (num > 0) {
|
|
121
|
+
cell += '<div class="item reaction ' + key + '">';
|
|
122
|
+
cell += '<span>' + StellarTimeline.reactions[key] + ' ' + item.reactions[key] + '</span>';
|
|
123
|
+
cell += '</div>';
|
|
124
|
+
}
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
127
|
+
if (item.comments != null) {
|
|
128
|
+
cell += '<a class="item comments last" href="' + item.html_url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
129
|
+
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> ' + (item.comments || 0) + '</span>';
|
|
130
|
+
cell += '</a>';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
cell += '</div>';
|
|
134
|
+
cell += '</div>';
|
|
120
135
|
}
|
|
121
136
|
|
|
122
|
-
cell += '</div>';
|
|
123
|
-
cell += '</div>';
|
|
124
137
|
cell += '</div>';
|
|
125
138
|
cell += '</div>';
|
|
126
139
|
$(el).append(cell);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
function layoutDiv() {
|
|
3
|
-
var el = '';
|
|
4
|
-
el += '<div id="valine_container" class="valine_thread"';
|
|
5
|
-
let cfg = {};
|
|
6
|
-
if (page.comment_id) {
|
|
7
|
-
cfg['comment_id'] = page.comment_id;
|
|
8
|
-
}
|
|
9
|
-
for (let key of Object.keys(cfg)) {
|
|
10
|
-
if (cfg[key]) {
|
|
11
|
-
el += ' ' + key + '="' + cfg[key] + '"';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
el += '><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg></div>';
|
|
15
|
-
return el;
|
|
16
|
-
}
|
|
17
|
-
%>
|
|
18
|
-
|
|
19
|
-
<%- layoutDiv() %>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
function getEmojiMaps() {
|
|
3
|
-
function emoji(path, idx, ext) {
|
|
4
|
-
return path + "/" + path + "-" + idx + "." + ext;
|
|
5
|
-
}
|
|
6
|
-
var emojiMaps = {};
|
|
7
|
-
for (var i = 1; i <= 54; i++) {
|
|
8
|
-
emojiMaps['tieba-' + i] = emoji('tieba', i, 'png');
|
|
9
|
-
}
|
|
10
|
-
for (var i = 1; i <= 101; i++) {
|
|
11
|
-
emojiMaps['qq-' + i] = emoji('qq', i, 'gif');
|
|
12
|
-
}
|
|
13
|
-
for (var i = 1; i <= 116; i++) {
|
|
14
|
-
emojiMaps['aru-' + i] = emoji('aru', i, 'gif');
|
|
15
|
-
}
|
|
16
|
-
for (var i = 1; i <= 125; i++) {
|
|
17
|
-
emojiMaps['twemoji-' + i] = emoji('twemoji', i, 'png');
|
|
18
|
-
}
|
|
19
|
-
for (var i = 1; i <= 4; i++) {
|
|
20
|
-
emojiMaps['weibo-' + i] = emoji('weibo', i, 'png');
|
|
21
|
-
}
|
|
22
|
-
return emojiMaps;
|
|
23
|
-
}
|
|
24
|
-
function load_comment(){
|
|
25
|
-
if(!document.getElementById("valine_container"))return;
|
|
26
|
-
stellar.loadScript('<%- theme.comments.valine.js %>', {defer:true}).then(function () {
|
|
27
|
-
const el = document.getElementById("valine_container");
|
|
28
|
-
var path = el.getAttribute('comment_id');
|
|
29
|
-
const placeholder = "<%= theme.comments.valine.placeholder %>";
|
|
30
|
-
if (!path) {
|
|
31
|
-
path = decodeURI(window.location.pathname);
|
|
32
|
-
}
|
|
33
|
-
var valine = new Valine();
|
|
34
|
-
valine.init(Object.assign(<%- JSON.stringify(theme.comments.valine) %>, {
|
|
35
|
-
el: '#valine_container',
|
|
36
|
-
path: path,
|
|
37
|
-
placeholder: placeholder,
|
|
38
|
-
emojiCDN: 'https://fastly.jsdelivr.net/gh/cdn-x/emoji/valine/',
|
|
39
|
-
emojiMaps: getEmojiMaps(),
|
|
40
|
-
}));
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
window.addEventListener('DOMContentLoaded', (event) => {
|
|
44
|
-
console.log('DOM fully loaded and parsed');
|
|
45
|
-
load_comment();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
</script>
|
package/scripts/tags/issues.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* issues.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% issues [sites/timeline/friends] api:xxx [group:key=value1,value2,value3] %}
|
|
6
|
-
*
|
|
7
|
-
* example:
|
|
8
|
-
* {% issues sites api:https://api.github.com/repos/volantis-x/examples/issues?sort=updated&state=open&page=1&per_page=100 group:version=版本:^4.0,版本:^3.0,版本:^2.0 %}
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
hexo.extend.tag.register('issues', function(args) {
|
|
14
|
-
args = hexo.args.map(args, ['api', 'group'], ['type']);
|
|
15
|
-
// 所有支持的参数
|
|
16
|
-
let type = args.type || '';
|
|
17
|
-
let api = args.api || '';
|
|
18
|
-
let group = args.group || '';
|
|
19
|
-
if (type.length == 0 || api.length == 0) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
// 布局
|
|
23
|
-
var el = '<div class="tag-plugin issues-wrap ' + type + '" id="issues-api"';
|
|
24
|
-
el += 'api="' + api + '"';
|
|
25
|
-
if (group.length > 0) {
|
|
26
|
-
el += 'group="' + group + '"';
|
|
27
|
-
}
|
|
28
|
-
el += '></div>';
|
|
29
|
-
return el;
|
|
30
|
-
});
|