hexo-theme-stellar 1.12.0 → 1.14.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 +10 -27
- package/_data/links.yml +7 -0
- package/_data/widgets.yml +5 -3
- 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 +21 -14
- package/layout/_partial/scripts/index.ejs +1 -0
- package/layout/_partial/sidebar/widgets/ghissues.ejs +0 -1
- package/layout/_partial/sidebar/widgets/timeline.ejs +2 -2
- package/layout/index.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/link.js +15 -3
- package/scripts/tags/sites.js +40 -79
- package/scripts/tags/timeline.js +6 -4
- package/source/css/_common/base.styl +1 -1
- package/source/css/_common/highlight.styl +1 -1
- package/source/css/_common/pre.styl +1 -1
- package/source/css/_custom.styl +1 -1
- package/source/css/_defines/theme.styl +18 -13
- package/source/css/_layout/list.styl +12 -12
- package/source/css/_layout/main.styl +1 -1
- package/source/css/_layout/md.styl +10 -16
- package/source/css/_layout/partial/bread-nav.styl +1 -1
- 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/common.styl +70 -36
- package/source/css/_layout/tag-plugins/folding.styl +2 -2
- package/source/css/_layout/tag-plugins/link.styl +3 -3
- package/source/css/_layout/tag-plugins/quot.styl +1 -0
- package/source/css/_layout/tag-plugins/split.styl +10 -6
- package/source/css/_layout/tag-plugins/timeline.styl +41 -10
- package/source/css/_plugins/comments/waline.styl +4 -0
- package/source/css/_plugins/index.styl +0 -2
- package/source/css/_plugins/lazyload.styl +1 -1
- package/source/js/main.js +2 -2
- package/source/js/plugins/fcircle.js +92 -0
- package/source/js/plugins/linkcard.js +23 -99
- package/source/js/plugins/timeline.js +48 -35
- 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
|
@@ -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
|
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
box-shadow: $boxshadow-block
|
|
107
107
|
p
|
|
108
108
|
font-size: $fs-14
|
|
109
|
+
img
|
|
110
|
+
display: block
|
|
109
111
|
&:empty
|
|
110
112
|
display: none
|
|
111
113
|
p,.highlight,ol,ul,.tag-plugin
|
|
@@ -113,15 +115,32 @@
|
|
|
113
115
|
.tag-plugin.copy
|
|
114
116
|
width: 240px
|
|
115
117
|
|
|
118
|
+
.tag-plugin.timeline[api]
|
|
119
|
+
&.stellar-fcircle-api .timenode:hover .header
|
|
120
|
+
.user-info
|
|
121
|
+
background: inherit
|
|
122
|
+
span
|
|
123
|
+
color: inherit
|
|
124
|
+
a.body
|
|
125
|
+
display: block
|
|
126
|
+
color: var(--text-p1)
|
|
127
|
+
trans2: transform box-shadow
|
|
128
|
+
line-height: 1.25
|
|
129
|
+
padding: 0.75rem 1rem
|
|
130
|
+
&:hover
|
|
131
|
+
transform: translateY(-1px)
|
|
132
|
+
box-shadow: $boxshadow-card-float
|
|
133
|
+
|
|
116
134
|
|
|
117
|
-
.tag-plugin.timeline
|
|
118
|
-
|
|
119
|
-
overflow: scroll
|
|
120
|
-
p.title
|
|
135
|
+
.tag-plugin.timeline[api] .body
|
|
136
|
+
p.title
|
|
121
137
|
font-size: 1rem
|
|
122
138
|
font-weight: 700
|
|
123
139
|
margin: 0.5rem 0 0.75rem
|
|
124
140
|
line-height: 1.25
|
|
141
|
+
&:only-child
|
|
142
|
+
margin-bottom: 0.5rem
|
|
143
|
+
font-weight: 500
|
|
125
144
|
a
|
|
126
145
|
color: inherit
|
|
127
146
|
&:hover
|
|
@@ -136,7 +155,7 @@
|
|
|
136
155
|
pre code
|
|
137
156
|
font-size: $fs-12
|
|
138
157
|
|
|
139
|
-
.tag-plugin.timeline
|
|
158
|
+
.tag-plugin.timeline[api] .body .footer
|
|
140
159
|
margin: 0 0 -0.5rem
|
|
141
160
|
padding: 0.5rem 0 1rem
|
|
142
161
|
user-select: none
|
|
@@ -145,9 +164,6 @@
|
|
|
145
164
|
flex-wrap: wrap
|
|
146
165
|
justify-content: space-between
|
|
147
166
|
align-items: stretch
|
|
148
|
-
position: sticky
|
|
149
|
-
position: -webkit-sticky
|
|
150
|
-
bottom: -0.5rem
|
|
151
167
|
background: var(--card)
|
|
152
168
|
span
|
|
153
169
|
line-height: 1.8
|
|
@@ -159,7 +175,7 @@
|
|
|
159
175
|
font-size: $fs-12
|
|
160
176
|
align-items: stretch
|
|
161
177
|
|
|
162
|
-
.tag-plugin.timeline
|
|
178
|
+
.tag-plugin.timeline[api] .body .footer
|
|
163
179
|
.item
|
|
164
180
|
border-width: 1px
|
|
165
181
|
border-style: solid
|
|
@@ -184,4 +200,19 @@
|
|
|
184
200
|
margin: 0.75rem 0
|
|
185
201
|
p
|
|
186
202
|
font-size: $fs-13
|
|
187
|
-
margin: 0.25rem
|
|
203
|
+
margin: 0.25rem
|
|
204
|
+
|
|
205
|
+
.tag-plugin.timeline .body
|
|
206
|
+
line-height: 1.5
|
|
207
|
+
h1,h2
|
|
208
|
+
font-size: 1.25rem
|
|
209
|
+
margin: 1rem 0
|
|
210
|
+
line-height: 1.2
|
|
211
|
+
h3,h4
|
|
212
|
+
font-size: 1rem
|
|
213
|
+
margin: 0.75rem 0
|
|
214
|
+
line-height: 1.2
|
|
215
|
+
h5,h6
|
|
216
|
+
font-size: $fs-15
|
|
217
|
+
margin: 0.5rem 0
|
|
218
|
+
line-height: 1.2
|
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
console.log('
|
|
1
|
+
console.log('\n' + '%c Stellar v' + stellar.version + ' %c\n' + stellar.github + '\n', 'color:#e8fafe;background:#03c7fa;padding:8px;border-radius:4px', 'margin-top:8px');
|
|
2
2
|
// utils
|
|
3
3
|
const util = {
|
|
4
4
|
|
|
@@ -219,7 +219,7 @@ if (stellar.plugins.stellar) {
|
|
|
219
219
|
let js = stellar.plugins.stellar[key];
|
|
220
220
|
if (key == 'linkcard') {
|
|
221
221
|
stellar.loadScript(js, { defer: true }).then(function () {
|
|
222
|
-
setCardLink(document.querySelectorAll('a.link-card'));
|
|
222
|
+
setCardLink(document.querySelectorAll('a.link-card[cardlink]'));
|
|
223
223
|
});
|
|
224
224
|
} else {
|
|
225
225
|
const els = document.getElementsByClassName('stellar-' + key + '-api');
|
|
@@ -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.created + '</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
|
+
});
|
|
@@ -1,103 +1,25 @@
|
|
|
1
1
|
// 本插件由CardLink定制而成,原项目源码: https://github.com/Lete114/CardLink
|
|
2
2
|
|
|
3
|
-
var cardLink = {};
|
|
4
|
-
cardLink.caches = {};
|
|
5
|
-
cardLink.server = 'https://api.allorigins.win/raw?url=';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Remove '/' and '/index.html'
|
|
9
|
-
* @param {String} params
|
|
10
|
-
* @returns { String }
|
|
11
|
-
*/
|
|
12
|
-
function indexHandler(params) {
|
|
13
|
-
let path = params.replace(/(\/index\.html|\/)*$/gi, '')
|
|
14
|
-
if (path.length === 0) path += '/'
|
|
15
|
-
return path
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Determine if it is a ['https://', 'http://', '//'] protocol
|
|
20
|
-
* @param {String} url Website url
|
|
21
|
-
* @returns {Boolean}
|
|
22
|
-
*/
|
|
23
|
-
function isHttp(url) {
|
|
24
|
-
return /^(https?:)?\/\//g.test(url)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
3
|
function renderer(el, obj) {
|
|
28
|
-
|
|
4
|
+
var autofill = [];
|
|
5
|
+
const autofillStr = el.getAttribute('autofill');
|
|
6
|
+
if (autofillStr) {
|
|
7
|
+
autofill = autofillStr.split(',');
|
|
8
|
+
}
|
|
9
|
+
if (obj.title && obj.title.length > 0 && autofill.includes('title')) {
|
|
29
10
|
el.querySelector('.title').innerHTML = obj.title;
|
|
11
|
+
el.title = obj.title;
|
|
30
12
|
}
|
|
31
|
-
if (obj.icon && obj.icon.length > 0) {
|
|
13
|
+
if (obj.icon && obj.icon.length > 0 && autofill.includes('icon')) {
|
|
32
14
|
el.querySelector('.img').style = 'background-image: url("' + obj.icon + '");';
|
|
15
|
+
el.querySelector('.img').setAttribute('data-bg', obj.icon);
|
|
33
16
|
}
|
|
34
17
|
let desc = el.querySelector('.desc');
|
|
35
|
-
if (desc && obj.desc && obj.desc.length > 0) {
|
|
18
|
+
if (desc && obj.desc && obj.desc.length > 0 && autofill.includes('desc')) {
|
|
36
19
|
desc.innerHTML = obj.desc;
|
|
37
20
|
}
|
|
38
21
|
}
|
|
39
22
|
|
|
40
|
-
/**
|
|
41
|
-
* Get info
|
|
42
|
-
* @param {Element} el Element
|
|
43
|
-
* @param {String} html String type html
|
|
44
|
-
* @param {String} link Website address
|
|
45
|
-
*/
|
|
46
|
-
// eslint-disable-next-line max-statements
|
|
47
|
-
function getInfo(el, html, link) {
|
|
48
|
-
try {
|
|
49
|
-
let title, icon, desc
|
|
50
|
-
const doc = new DOMParser().parseFromString(html, 'text/html')
|
|
51
|
-
// If there is no title, no card link is generated
|
|
52
|
-
title = doc.querySelector('title')
|
|
53
|
-
if (title) {
|
|
54
|
-
title = title.textContent
|
|
55
|
-
|
|
56
|
-
// Get the src of the first img tag in the body tag
|
|
57
|
-
let tmp = doc.querySelector('head link[rel="apple-touch-icon"]')
|
|
58
|
-
if (!tmp) {
|
|
59
|
-
tmp = doc.querySelector('head link[rel="icon"]')
|
|
60
|
-
}
|
|
61
|
-
icon = tmp && tmp.getAttribute('href')
|
|
62
|
-
|
|
63
|
-
if (/^data:image/.test(icon)) icon = ''
|
|
64
|
-
|
|
65
|
-
// If there is no src then get the site icon
|
|
66
|
-
if (!icon) {
|
|
67
|
-
const links = [].slice.call(doc.querySelectorAll('link[rel][href]'))
|
|
68
|
-
icon = links.find((_el) => _el.rel.includes('icon'))
|
|
69
|
-
icon = icon && icon.getAttribute('href')
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
desc = doc.querySelector('head meta[name="description"]')
|
|
73
|
-
|
|
74
|
-
if (desc) {
|
|
75
|
-
desc = desc.content;
|
|
76
|
-
}
|
|
77
|
-
// If `icon` is not the ['https://', 'http://', '//'] protocol, splice on the `origin` of the a tag
|
|
78
|
-
if (icon && !isHttp(icon)) icon = new URL(link).origin + icon
|
|
79
|
-
cardLink.caches[link] = { title, link, icon, desc }
|
|
80
|
-
|
|
81
|
-
renderer(el, cardLink.caches[link])
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
// eslint-disable-next-line no-console
|
|
85
|
-
console.warn('CardLink Error: Failed to parse', error)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function fetchPage(link, callback) {
|
|
90
|
-
fetch(link)
|
|
91
|
-
.then((result) => result.text())
|
|
92
|
-
.then(callback)
|
|
93
|
-
.catch((error) => {
|
|
94
|
-
const server = cardLink.server
|
|
95
|
-
// eslint-disable-next-line no-console
|
|
96
|
-
if (link.includes(server) || !server) return console.error('CardLink Error:', error)
|
|
97
|
-
fetchPage(server + link, callback)
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
|
|
101
23
|
/**
|
|
102
24
|
* Create card links
|
|
103
25
|
* @param {NodeList} nodes A collection of nodes or a collection of arrays,
|
|
@@ -109,16 +31,18 @@ function setCardLink(nodes) {
|
|
|
109
31
|
nodes.forEach((el) => {
|
|
110
32
|
// If it is not a tag element then it is not processed
|
|
111
33
|
if (el.nodeType !== 1) return
|
|
112
|
-
el.removeAttribute('cardlink')
|
|
113
|
-
const link = el.href
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
34
|
+
el.removeAttribute('cardlink');
|
|
35
|
+
const link = el.href;
|
|
36
|
+
const api = 'https://site-info.vlts.cc/api?url=';
|
|
37
|
+
fetch(api + link).then(function(response) {
|
|
38
|
+
if (response.ok) {
|
|
39
|
+
return response.json();
|
|
40
|
+
}
|
|
41
|
+
throw new Error('Network response was not ok.');
|
|
42
|
+
}).then(function(data) {
|
|
43
|
+
renderer(el, data);
|
|
44
|
+
}).catch(function(error) {
|
|
45
|
+
console.log(error);
|
|
46
|
+
});
|
|
123
47
|
})
|
|
124
48
|
}
|
|
@@ -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)) {
|
|
@@ -71,7 +77,7 @@ const StellarTimeline = {
|
|
|
71
77
|
}
|
|
72
78
|
var cell = '<div class="timenode" index="' + i + '">';
|
|
73
79
|
cell += '<div class="header">';
|
|
74
|
-
if (!users.length && item.user) {
|
|
80
|
+
if (!users.length && item.user && !hide.includes('user')) {
|
|
75
81
|
cell += '<a class="user-info" href="' + item.user.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
76
82
|
cell += '<img src="' + item.user.avatar_url + '">';
|
|
77
83
|
cell += '<span>' + item.user.login + '</span>';
|
|
@@ -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
|
-
});
|