hexo-theme-stellar 1.13.0 → 1.15.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 +3 -0
- package/_config.yml +8 -2
- package/_data/links.yml +1 -1
- package/_data/widgets.yml +4 -2
- package/layout/_partial/head.ejs +23 -12
- package/layout/_partial/main/article/article_footer.ejs +2 -2
- package/layout/_partial/main/article/read_next.ejs +2 -2
- package/layout/_partial/main/post_list/post_card.ejs +18 -15
- package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
- package/layout/_partial/sidebar/logo.ejs +2 -2
- package/layout/_partial/sidebar/widgets/ghissues.ejs +1 -1
- package/layout/_partial/sidebar/widgets/ghrepo.ejs +2 -2
- package/layout/_partial/sidebar/widgets/timeline.ejs +2 -2
- package/layout/index.ejs +1 -1
- package/package.json +3 -3
- package/scripts/tags/friends.js +1 -1
- package/scripts/tags/link.js +15 -3
- package/scripts/tags/sites.js +1 -1
- package/source/css/_common/base.styl +1 -1
- package/source/css/_common/highlight.styl +18 -2
- 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 +10 -7
- package/source/css/_layout/md.styl +10 -13
- package/source/css/_layout/partial/bread-nav.styl +1 -1
- 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/timeline.styl +23 -9
- package/source/css/_plugins/lazyload.styl +1 -1
- package/source/js/main.js +1 -1
- package/source/js/plugins/fcircle.js +1 -1
- package/source/js/plugins/linkcard.js +23 -99
- package/source/js/plugins/timeline.js +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富的标签和动态数据组件,请配合 [文档](https://xaoxuu.com/wiki/stellar/) 使用。
|
|
4
4
|
|
|
5
|
+
[](https://star-history.com/#xaoxuu/hexo-theme-stellar&Date)
|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
## Getting Started
|
|
6
9
|
|
|
7
10
|
Check your environment:
|
package/_config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
######## Stellar info ########
|
|
2
2
|
stellar:
|
|
3
|
-
version: '1.
|
|
3
|
+
version: '1.15.0'
|
|
4
4
|
homepage: 'https://xaoxuu.com/wiki/stellar/'
|
|
5
5
|
repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
|
|
6
6
|
cdn_css: # Use cdn links instead of /css/main.css
|
|
@@ -212,6 +212,7 @@ tag_plugins:
|
|
|
212
212
|
qq: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
|
|
213
213
|
aru: https://fastly.jsdelivr.net/gh/cdn-x/emoji/aru-l/%s.gif
|
|
214
214
|
tieba: https://fastly.jsdelivr.net/gh/cdn-x/emoji/tieba/%s.png
|
|
215
|
+
blobcat: https://gcore.jsdelivr.net/gh/norevi/waline-blobcatemojis@1.0/blobs/%s.png
|
|
215
216
|
# {% image %}
|
|
216
217
|
image:
|
|
217
218
|
fancybox: # true, false
|
|
@@ -325,7 +326,7 @@ style:
|
|
|
325
326
|
card: white # 卡片背景颜色
|
|
326
327
|
title: '#000' # 标题文本颜色
|
|
327
328
|
text: '#333' # 正文文本颜色
|
|
328
|
-
code: '#
|
|
329
|
+
code: '#f33a00' # 行内代码颜色
|
|
329
330
|
dark:
|
|
330
331
|
background: '#313438' # 深色背景颜色
|
|
331
332
|
background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
|
|
@@ -349,3 +350,8 @@ default:
|
|
|
349
350
|
link: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg
|
|
350
351
|
cover: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg
|
|
351
352
|
image: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/image/2659360.svg
|
|
353
|
+
|
|
354
|
+
api_host:
|
|
355
|
+
ghapi: https://api.github.com
|
|
356
|
+
ghraw: https://raw.githubusercontent.com
|
|
357
|
+
gist: https://gist.github.com
|
package/_data/links.yml
CHANGED
package/_data/widgets.yml
CHANGED
|
@@ -61,10 +61,12 @@ welcome:
|
|
|
61
61
|
**第二步**
|
|
62
62
|
创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
|
|
63
63
|
<br>
|
|
64
|
-
如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
|
|
64
|
+
如果有任何疑问,请先查阅 [文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
|
|
65
65
|
|
|
66
66
|
timeline:
|
|
67
67
|
layout: timeline
|
|
68
68
|
title: 近期动态
|
|
69
69
|
api: # https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues
|
|
70
|
-
user:
|
|
70
|
+
user: # 默认显示所有人的数据,设置名称可过滤为仅显示某人的数据,多个名称用英文逗号隔开,不要加空格
|
|
71
|
+
type: # 默认不用写,如果是友链朋友圈数据请写 fcircle
|
|
72
|
+
limit: # 默认通过 api 上增加 per_page 来设置,如果是友链朋友圈,可通过这个设置数量
|
package/layout/_partial/head.ejs
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function generate_title() {
|
|
3
|
-
if (page.
|
|
4
|
-
return page.
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
if (page.seo_title) {
|
|
4
|
+
return page.seo_title;
|
|
5
|
+
}
|
|
6
|
+
if (page.wiki) {
|
|
7
|
+
let proj = theme.wiki.projects[page.wiki];
|
|
8
|
+
let wiki = (proj && proj.name) || page.wiki;
|
|
9
|
+
if (page.title) {
|
|
10
|
+
return wiki + __('symbol.colon') + page.title + ' - ' + config.title;
|
|
11
|
+
} else {
|
|
12
|
+
return wiki + ' - ' + config.title;
|
|
13
|
+
}
|
|
11
14
|
} else {
|
|
12
|
-
|
|
15
|
+
if (page.category) {
|
|
16
|
+
return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title;
|
|
17
|
+
} else if (page.tag) {
|
|
18
|
+
return __('btn.tag') + __('symbol.colon') + page.tag + ' - ' + config.title;
|
|
19
|
+
} else {
|
|
20
|
+
return config.title;
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
return '';
|
|
15
24
|
}
|
|
16
25
|
function generate_description() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
if (page.layout == 'wiki' && page.wiki) {
|
|
27
|
+
let proj = theme.wiki.projects[page.wiki];
|
|
28
|
+
if (proj && proj.description) {
|
|
29
|
+
return '<meta name="description" content="' + proj.description + '">';
|
|
30
|
+
}
|
|
20
31
|
}
|
|
21
32
|
if (page.description || page.excerpt || page.content) {
|
|
22
33
|
return '<meta name="description" content="' + truncate(strip_html(page.description || page.excerpt || page.content), {length: 150}) + '">';
|
|
@@ -69,7 +69,7 @@ function layoutDiv() {
|
|
|
69
69
|
el += ' onclick="util.toggle("qrcode-wechat")"';
|
|
70
70
|
} else if (item == 'weibo') {
|
|
71
71
|
el += ' href="https://service.weibo.com/share/share.php?url=' + page.permalink;
|
|
72
|
-
el += '&title=' + (page.seo_title || page.title
|
|
72
|
+
el += '&title=' + (page.seo_title || (page.title + ' - ' + config.title));
|
|
73
73
|
if (page.latyout == 'post' && page.cover) {
|
|
74
74
|
el += '&pics=' + page.cover;
|
|
75
75
|
} else if (page.latyout == 'wiki' && page.logo && page.logo.src) {
|
|
@@ -78,7 +78,7 @@ function layoutDiv() {
|
|
|
78
78
|
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
|
|
79
79
|
el += '"';
|
|
80
80
|
} else if (item == 'email') {
|
|
81
|
-
el += ' href="mailto:?subject=' + (page.title
|
|
81
|
+
el += ' href="mailto:?subject=' + ((page.title + ' - ' + config.title) || page.seo_title) + '&'
|
|
82
82
|
el += 'body=' + page.permalink + '"';
|
|
83
83
|
} else if (item == 'link') {
|
|
84
84
|
el += ' onclick="util.copy("copy-link", "' + __('message.copied') + '")"';
|
|
@@ -35,7 +35,7 @@ function layoutDiv() {
|
|
|
35
35
|
if (prev) {
|
|
36
36
|
el += '<div class="note">' + title_prev + '</div>';
|
|
37
37
|
el += '<a href="' + url_for(prev.path) + '">';
|
|
38
|
-
el += prev.title || prev.seo_title || prev.wiki;
|
|
38
|
+
el += prev.title || prev.seo_title || prev.wiki || date(prev.date, config.date_format);
|
|
39
39
|
el += '</a>';
|
|
40
40
|
}
|
|
41
41
|
el += '</div>';
|
|
@@ -44,7 +44,7 @@ function layoutDiv() {
|
|
|
44
44
|
if (next) {
|
|
45
45
|
el += '<div class="note">' + title_next + '</div>';
|
|
46
46
|
el += '<a href="' + url_for(next.path) + '">';
|
|
47
|
-
el += next.title || next.seo_title || next.wiki;
|
|
47
|
+
el += next.title || next.seo_title || next.wiki || date(next.date, config.date_format);
|
|
48
48
|
el += '</a>';
|
|
49
49
|
}
|
|
50
50
|
el += '</div>';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
cat: post['cover-cat'],
|
|
6
|
-
subtitle: post['cover-subtitle'],
|
|
7
|
-
color: post['cover-text-color']
|
|
2
|
+
const poster = post.poster;
|
|
3
|
+
var obj = {
|
|
4
|
+
image: post.cover
|
|
8
5
|
};
|
|
6
|
+
if (poster) {
|
|
7
|
+
obj.headline = poster.headline;
|
|
8
|
+
obj.topic = poster.topic;
|
|
9
|
+
obj.caption = poster.caption;
|
|
10
|
+
obj.color = poster.color;
|
|
11
|
+
}
|
|
9
12
|
function div_default() {
|
|
10
13
|
var el = '';
|
|
11
14
|
el += '<article class="md">';
|
|
@@ -97,24 +100,24 @@ function div_photo() {
|
|
|
97
100
|
var el = '';
|
|
98
101
|
el += '<div class="cover">';
|
|
99
102
|
el += '<img src="' + obj.image + '"/>';
|
|
100
|
-
if (obj.
|
|
103
|
+
if (obj.headline || obj.topic || obj.caption) {
|
|
101
104
|
el += '<div class="cover-info"';
|
|
102
105
|
if (obj.color) {
|
|
103
106
|
el += 'style="color:' + obj.color + '"';
|
|
104
107
|
}
|
|
105
|
-
if (obj.
|
|
108
|
+
if (obj.topic) {
|
|
106
109
|
el += 'position="top">';
|
|
107
110
|
} else {
|
|
108
111
|
el += 'position="bottom">';
|
|
109
112
|
}
|
|
110
|
-
if (obj.
|
|
111
|
-
el += '<div class="cap">' + obj.
|
|
113
|
+
if (obj.topic) {
|
|
114
|
+
el += '<div class="cap">' + obj.topic + '</div>';
|
|
112
115
|
}
|
|
113
|
-
if (obj.
|
|
114
|
-
el += '<div class="title">' + obj.
|
|
116
|
+
if (obj.headline) {
|
|
117
|
+
el += '<div class="title">' + obj.headline + '</div>';
|
|
115
118
|
}
|
|
116
|
-
if (obj.
|
|
117
|
-
el += '<div class="cap">' + obj.
|
|
119
|
+
if (obj.caption) {
|
|
120
|
+
el += '<div class="cap">' + obj.caption + '</div>';
|
|
118
121
|
}
|
|
119
122
|
el += '</div>';
|
|
120
123
|
|
|
@@ -123,7 +126,7 @@ function div_photo() {
|
|
|
123
126
|
return el;
|
|
124
127
|
}
|
|
125
128
|
function div() {
|
|
126
|
-
if (obj.image && obj.image.length > 0 && obj.
|
|
129
|
+
if (obj.image && obj.image.length > 0 && obj.headline != undefined) {
|
|
127
130
|
return div_photo();
|
|
128
131
|
}
|
|
129
132
|
return div_default();
|
|
@@ -16,7 +16,7 @@ function layoutDiv() {
|
|
|
16
16
|
let tag = proj.tags[0];
|
|
17
17
|
el += '<div class="cap breadcrumb"' + category_color(tag) + '>' + tag + '</div>';
|
|
18
18
|
}
|
|
19
|
-
el += '<h2 class="post-title">' + (proj.title || proj.name
|
|
19
|
+
el += '<h2 class="post-title">' + (proj.title || proj.name) + '</h2>';
|
|
20
20
|
if (proj.description) {
|
|
21
21
|
el += '<p>' + proj.description + '</p>';
|
|
22
22
|
}
|
|
@@ -21,7 +21,7 @@ function layoutTitle(main, url, sub) {
|
|
|
21
21
|
}
|
|
22
22
|
function layoutDiv() {
|
|
23
23
|
var el = '';
|
|
24
|
-
if (page.layout == 'wiki') {
|
|
24
|
+
if (page.layout == 'wiki' && proj && proj.index != false) {
|
|
25
25
|
el += '<div class="logo-wrap wiki">';
|
|
26
26
|
// all products
|
|
27
27
|
el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(config.wiki_dir) + '">';
|
|
@@ -39,7 +39,7 @@ function layoutDiv() {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (proj != undefined) {
|
|
42
|
-
let main = proj.name || proj.title ||
|
|
42
|
+
let main = proj.name || proj.title || page.wiki || page.title;
|
|
43
43
|
let url = proj.homepage.path;
|
|
44
44
|
let sub = proj.subtitle;
|
|
45
45
|
el += layoutTitle(main, url, sub);
|
|
@@ -18,7 +18,7 @@ function layoutDiv() {
|
|
|
18
18
|
if (repo == undefined) {
|
|
19
19
|
return el;
|
|
20
20
|
}
|
|
21
|
-
item.api =
|
|
21
|
+
item.api = theme.api_host.ghapi + '/repos/' + repo + '/issues?per_page=' + item.limit;
|
|
22
22
|
if (item.labels) {
|
|
23
23
|
item.api += '&labels=' + item.labels;
|
|
24
24
|
}
|
|
@@ -22,7 +22,7 @@ function layoutDiv() {
|
|
|
22
22
|
el += '<div class="widget-wrap" id="repo-info">';
|
|
23
23
|
// body
|
|
24
24
|
el += '<div class="widget-body">';
|
|
25
|
-
el += '<div class="items stellar-ghinfo-api" api="
|
|
25
|
+
el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
|
|
26
26
|
el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
27
27
|
el += '<div class="repo-name flex-row">';
|
|
28
28
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>';
|
|
@@ -38,7 +38,7 @@ function layoutDiv() {
|
|
|
38
38
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>';
|
|
39
39
|
el += '<span type="text" id="forks_count"></span>';
|
|
40
40
|
el += '</div>';
|
|
41
|
-
el += '<div class="flex-row stellar-ghinfo-api" index="0" api="
|
|
41
|
+
el += '<div class="flex-row stellar-ghinfo-api" index="0" api="' + theme.api_host.ghapi + '/repos/' + repo + '/tags">';
|
|
42
42
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>';
|
|
43
43
|
el += '<span type="text" id="latest-tag-name">0</span>';
|
|
44
44
|
el += '</div>';
|
|
@@ -11,8 +11,8 @@ function layoutDiv() {
|
|
|
11
11
|
el += '</div>';
|
|
12
12
|
}
|
|
13
13
|
el += '<div class="widget-body fs14">';
|
|
14
|
-
el += '<div class="tag-plugin timeline stellar-timeline-api"';
|
|
15
|
-
['api', 'user', 'hide'].forEach(key => {
|
|
14
|
+
el += '<div class="tag-plugin timeline stellar-' + (item.type || "timeline") + '-api"';
|
|
15
|
+
['api', 'user', 'hide', 'limit'].forEach(key => {
|
|
16
16
|
if (item[key]) {
|
|
17
17
|
el += ' ' + key + '="' + item[key] + '"';
|
|
18
18
|
}
|
package/layout/index.ejs
CHANGED
|
@@ -13,7 +13,7 @@ if (page.title && page.wiki) {
|
|
|
13
13
|
function layout_post_card(layout, post, content) {
|
|
14
14
|
var el = '';
|
|
15
15
|
var layout = layout;
|
|
16
|
-
if (layout == 'post' && post
|
|
16
|
+
if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
|
|
17
17
|
layout += ' photo';
|
|
18
18
|
}
|
|
19
19
|
el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-theme-stellar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Elegant and powerful theme for Hexo.",
|
|
5
5
|
"main": "package.json",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "https://github.com/xaoxuu/hexo-theme-stellar/issues/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"hexo-renderer-ejs": "^
|
|
25
|
-
"hexo-renderer-stylus": "^2.0
|
|
24
|
+
"hexo-renderer-ejs": "^2.0.0",
|
|
25
|
+
"hexo-renderer-stylus": "^2.1.0"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://xaoxuu.com/wiki/stellar/",
|
|
28
28
|
"devDependencies": {
|
package/scripts/tags/friends.js
CHANGED
|
@@ -17,7 +17,7 @@ hexo.extend.tag.register('friends', function(args) {
|
|
|
17
17
|
if (args.api) {
|
|
18
18
|
api = args.api;
|
|
19
19
|
} else if (args.repo) {
|
|
20
|
-
api = 'https://
|
|
20
|
+
api = 'https://api.vlts.cc/output_data/v2/' + args.repo;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var el = '<div class="tag-plugin users-wrap">';
|
package/scripts/tags/link.js
CHANGED
|
@@ -7,18 +7,30 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
var util = require('hexo-util');
|
|
11
10
|
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
|
|
12
11
|
|
|
13
12
|
hexo.extend.tag.register('link', function(args) {
|
|
14
13
|
args = hexo.args.map(args, ['icon', 'desc'], ['url', 'title']);
|
|
15
|
-
|
|
14
|
+
var autofill = [];
|
|
15
|
+
if (!args.title) {
|
|
16
|
+
autofill.push('title');
|
|
17
|
+
}
|
|
18
|
+
if (!args.icon) {
|
|
19
|
+
autofill.push('icon');
|
|
20
|
+
}
|
|
21
|
+
if (args.desc) {
|
|
22
|
+
autofill.push('desc');
|
|
23
|
+
}
|
|
16
24
|
var el = '';
|
|
17
25
|
el += '<div class="tag-plugin link dis-select">';
|
|
18
|
-
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + args.title + '" href="' + args.url + '"';
|
|
26
|
+
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + (args.title || '') + '" href="' + args.url + '"';
|
|
19
27
|
if (args.url.includes('://')) {
|
|
20
28
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
21
29
|
}
|
|
30
|
+
el += ' cardlink';
|
|
31
|
+
el += ' autofill="';
|
|
32
|
+
el += autofill.join(',');
|
|
33
|
+
el += '"';
|
|
22
34
|
el += '>';
|
|
23
35
|
|
|
24
36
|
function loadIcon() {
|
package/scripts/tags/sites.js
CHANGED
|
@@ -17,7 +17,7 @@ hexo.extend.tag.register('sites', function(args) {
|
|
|
17
17
|
if (args.api) {
|
|
18
18
|
api = args.api;
|
|
19
19
|
} else if (args.repo) {
|
|
20
|
-
api = 'https://
|
|
20
|
+
api = 'https://api.vlts.cc/output_data/v2/' + args.repo;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var el = '<div class="tag-plugin sites-wrap">';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
code
|
|
2
2
|
-webkit-font-smoothing: auto
|
|
3
3
|
-moz-osx-font-smoothing: auto
|
|
4
|
-
color: var(--text-code)
|
|
5
4
|
font-family: $ff-code
|
|
6
5
|
|
|
7
6
|
p>code:not([class]),li>code:not([class])
|
|
8
7
|
font-size: 85%
|
|
9
8
|
background: var(--block)
|
|
10
|
-
padding: .2em
|
|
9
|
+
padding: .2em
|
|
11
10
|
border-radius: 4px
|
|
11
|
+
color: var(--text-code)
|
|
12
12
|
|
|
13
13
|
article.md .highlight, pre:not([class]):has(>code)
|
|
14
14
|
margin: var(--gap-p) 0
|
|
@@ -75,6 +75,22 @@ article.md .highlight
|
|
|
75
75
|
.gutter+.code pre
|
|
76
76
|
padding-left: 0.25em
|
|
77
77
|
|
|
78
|
+
article.md .gist
|
|
79
|
+
.gist-file
|
|
80
|
+
border: 1px solid var(--block-border)
|
|
81
|
+
border-radius: $border-block
|
|
82
|
+
.gist-data
|
|
83
|
+
border-bottom: 1px solid var(--block-border)
|
|
84
|
+
.highlight
|
|
85
|
+
display: inherit
|
|
86
|
+
border: none
|
|
87
|
+
border-radius: 0
|
|
88
|
+
background: none
|
|
89
|
+
margin: 0
|
|
90
|
+
padding: 1em 0
|
|
91
|
+
.gist-meta
|
|
92
|
+
background: var(--block-border)
|
|
93
|
+
|
|
78
94
|
|
|
79
95
|
table:not([class])
|
|
80
96
|
border-collapse: collapse
|
package/source/css/_custom.styl
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
1
|
+
set_text_light()
|
|
2
|
+
--text-p0: $dark-title
|
|
3
|
+
--text-p1: mix($dark-text, $dark-background, 85)
|
|
4
|
+
--text-p2: mix($dark-text, $dark-background, 70)
|
|
5
|
+
--text-p3: mix($dark-text, $dark-background, 45)
|
|
6
|
+
--text-p4: mix($dark-text, $dark-background, 35)
|
|
7
|
+
--text-meta: mix($dark-text, $dark-background, 30)
|
|
8
|
+
--text-code: $dark-code
|
|
9
|
+
set_text_dark()
|
|
6
10
|
--text-p0: $light-title
|
|
7
11
|
--text-p1: $light-text
|
|
8
12
|
--text-p2: mix($light-text, $light-background, 80)
|
|
@@ -10,24 +14,25 @@
|
|
|
10
14
|
--text-p4: mix($light-text, $light-background, 35)
|
|
11
15
|
--text-meta: mix($light-text, $light-background, 20)
|
|
12
16
|
--text-code: $light-code
|
|
17
|
+
:root
|
|
18
|
+
--site-bg: $light-background
|
|
13
19
|
--card: $light-card
|
|
20
|
+
--block: $light-block
|
|
21
|
+
--block-border: darken($light-block, 5)
|
|
22
|
+
--block-hover: darken($light-block, 2)
|
|
23
|
+
set_text_dark()
|
|
14
24
|
--theme-highlight: darken($color-theme, 5)
|
|
15
25
|
--theme-bg: mix($color-theme, $light-card, 10)
|
|
26
|
+
--theme-link: $color-link
|
|
16
27
|
|
|
17
28
|
set_darkmode()
|
|
18
29
|
:root
|
|
19
30
|
--site-bg: $dark-background
|
|
31
|
+
--card: $dark-card
|
|
20
32
|
--block: $dark-block
|
|
21
33
|
--block-border: lighten($dark-block, 6)
|
|
22
34
|
--block-hover: darken($dark-block, 4)
|
|
23
|
-
|
|
24
|
-
--text-p1: mix($dark-text, $dark-background, 85)
|
|
25
|
-
--text-p2: mix($dark-text, $dark-background, 70)
|
|
26
|
-
--text-p3: mix($dark-text, $dark-background, 45)
|
|
27
|
-
--text-p4: mix($dark-text, $dark-background, 35)
|
|
28
|
-
--text-meta: mix($dark-text, $dark-background, 30)
|
|
29
|
-
--text-code: $dark-code
|
|
30
|
-
--card: $dark-card
|
|
35
|
+
set_text_light()
|
|
31
36
|
--theme-highlight: $color-theme
|
|
32
37
|
--theme-bg: mix($color-theme, $dark-card, 10)
|
|
33
38
|
@media screen and (max-width: $device-mobile-max)
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// list
|
|
2
2
|
.post-list
|
|
3
3
|
margin: 1rem
|
|
4
|
-
.post-title
|
|
5
|
-
margin-top: 1.5rem
|
|
6
4
|
.post-title:first-child
|
|
7
5
|
margin-top: .5rem
|
|
8
6
|
|
|
9
7
|
.post-list
|
|
10
8
|
.post-title
|
|
11
9
|
font-weight: 500
|
|
12
|
-
margin: .75rem 0
|
|
10
|
+
margin: 1.25rem 0 .75rem 0
|
|
13
11
|
line-height: 1.2
|
|
14
12
|
font-size: $fs-h3
|
|
15
13
|
border-bottom: none
|
|
@@ -29,6 +27,7 @@
|
|
|
29
27
|
box-shadow: 0 2px 8px 0px rgba(0, 0, 0, 0.02)
|
|
30
28
|
trans1 box-shadow
|
|
31
29
|
overflow: hidden
|
|
30
|
+
z-index: 0
|
|
32
31
|
background: var(--card)
|
|
33
32
|
position: relative
|
|
34
33
|
.excerpt
|
|
@@ -53,8 +52,12 @@
|
|
|
53
52
|
img
|
|
54
53
|
object-fit: contain
|
|
55
54
|
height: 1.5em
|
|
55
|
+
|
|
56
56
|
.post-list .post-card:hover
|
|
57
57
|
box-shadow: 0 1px 4px 0px rgba(0, 0, 0, 0.1), 0 4px 16px 0px rgba(0, 0, 0, 0.1)
|
|
58
|
+
img
|
|
59
|
+
transform: scale(1.02)
|
|
60
|
+
filter: brightness(80%)
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
// common article
|
|
@@ -86,11 +89,9 @@
|
|
|
86
89
|
@media screen and (max-width: 900px)
|
|
87
90
|
height: 240px
|
|
88
91
|
@media screen and (max-width: $device-tablet)
|
|
89
|
-
height: 280px
|
|
90
|
-
@media screen and (max-width: $device-mobile)
|
|
91
|
-
height: 240px
|
|
92
|
-
@media screen and (max-width: $device-mobile-425)
|
|
93
92
|
height: 220px
|
|
93
|
+
@media screen and (max-width: $device-mobile-425)
|
|
94
|
+
height: 200px
|
|
94
95
|
@media screen and (max-width: $device-mobile-375)
|
|
95
96
|
height: 180px
|
|
96
97
|
|
|
@@ -108,8 +109,10 @@
|
|
|
108
109
|
color: var(--text-p0)
|
|
109
110
|
&[position=top]
|
|
110
111
|
top: 0
|
|
112
|
+
background-image: linear-gradient(rgba(0,0,0,0.2),rgba(0,0,0,0))
|
|
111
113
|
&[position=bottom]
|
|
112
114
|
bottom: 0
|
|
115
|
+
background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2))
|
|
113
116
|
div+div
|
|
114
117
|
margin-top: 4px
|
|
115
118
|
.cap
|
|
@@ -133,30 +133,27 @@ article.md
|
|
|
133
133
|
p:not([class]), li:not([class])
|
|
134
134
|
a:not([class])
|
|
135
135
|
position: relative
|
|
136
|
-
padding: 2px
|
|
136
|
+
padding: 2px 0
|
|
137
137
|
text-decoration: none
|
|
138
|
-
display: inline-block
|
|
139
138
|
line-height: 1.2
|
|
139
|
+
word-break: keep-all
|
|
140
140
|
&:after
|
|
141
141
|
content: ''
|
|
142
142
|
position: absolute
|
|
143
143
|
border-radius: 2px
|
|
144
|
-
bottom:
|
|
145
|
-
left:
|
|
146
|
-
right:
|
|
144
|
+
bottom: 0
|
|
145
|
+
left: 0
|
|
146
|
+
right: 0
|
|
147
147
|
height: 1px
|
|
148
|
-
opacity: 0.
|
|
149
|
-
background:
|
|
148
|
+
opacity: 0.8
|
|
149
|
+
background: var(--theme-link)
|
|
150
150
|
trans1: all
|
|
151
151
|
&:hover
|
|
152
152
|
border-bottom: none
|
|
153
|
-
color:
|
|
154
|
-
// color: darken($color-hover, 10)
|
|
155
|
-
// background: alpha($color-hover, 0.08)
|
|
153
|
+
color: var(--theme-link)
|
|
156
154
|
&:after
|
|
157
155
|
height: 100%
|
|
158
156
|
opacity: 0.2
|
|
159
157
|
bottom: 0
|
|
160
|
-
left:
|
|
161
|
-
right:
|
|
162
|
-
// background-color: alpha($color-hover, 0.08)
|
|
158
|
+
left: -2px
|
|
159
|
+
right: -2px
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
set_text_white()
|
|
2
|
+
--text-p0: white
|
|
3
|
+
--text-p1: white
|
|
4
|
+
--text-p2: #eee
|
|
5
|
+
--text-p3: #ddd
|
|
6
|
+
--text-code: white
|
|
7
|
+
--card: $dark-card
|
|
8
|
+
--block: $dark-block
|
|
9
|
+
--block-border: lighten($dark-block, 6)
|
|
10
|
+
--block-hover: darken($dark-block, 4)
|
|
11
|
+
set_text_black()
|
|
12
|
+
--text-p0: black
|
|
13
|
+
--text-p1: #111
|
|
14
|
+
--text-p2: #333
|
|
15
|
+
--text-p3: #555
|
|
16
|
+
--text-code: white
|
|
17
|
+
--card: $light-card
|
|
18
|
+
--block: $light-block
|
|
19
|
+
--block-border: darken($light-block, 5)
|
|
20
|
+
--block-hover: darken($light-block, 2)
|
|
21
|
+
|
|
1
22
|
.tag-plugin
|
|
2
23
|
--theme: var(--text-p1)
|
|
3
24
|
--theme-border: var(--block-border)
|
|
@@ -5,86 +26,99 @@
|
|
|
5
26
|
|
|
6
27
|
.tag-plugin[color='red']
|
|
7
28
|
--theme: $c-red
|
|
8
|
-
--theme-border: mix($c-red,
|
|
9
|
-
--theme-bg: mix($c-red,
|
|
29
|
+
--theme-border: mix($c-red, white, 60)
|
|
30
|
+
--theme-bg: mix($c-red, white, 15)
|
|
10
31
|
|
|
11
32
|
.tag-plugin[color='orange']
|
|
12
33
|
--theme: $c-orange
|
|
13
|
-
--theme-border: mix($c-orange,
|
|
14
|
-
--theme-bg: mix($c-orange,
|
|
34
|
+
--theme-border: mix($c-orange, white, 60)
|
|
35
|
+
--theme-bg: mix($c-orange, white, 15)
|
|
15
36
|
|
|
16
37
|
.tag-plugin[color='yellow']
|
|
17
38
|
--theme: $c-yellow
|
|
18
|
-
--theme-border: mix($c-yellow,
|
|
19
|
-
--theme-bg: mix($c-yellow,
|
|
39
|
+
--theme-border: mix($c-yellow, white, 60)
|
|
40
|
+
--theme-bg: mix($c-yellow, white, 20)
|
|
20
41
|
|
|
21
42
|
.tag-plugin[color='green']
|
|
22
43
|
--theme: $c-green
|
|
23
|
-
--theme-border: mix($c-green,
|
|
24
|
-
--theme-bg: mix($c-green,
|
|
44
|
+
--theme-border: mix($c-green, white, 60)
|
|
45
|
+
--theme-bg: mix($c-green, white, 15)
|
|
25
46
|
|
|
26
47
|
.tag-plugin[color='cyan']
|
|
27
48
|
--theme: $c-cyan
|
|
28
|
-
--theme-border: mix($c-cyan,
|
|
29
|
-
--theme-bg: mix($c-cyan,
|
|
49
|
+
--theme-border: mix($c-cyan, white, 60)
|
|
50
|
+
--theme-bg: mix($c-cyan, white, 15)
|
|
30
51
|
|
|
31
52
|
.tag-plugin[color='blue']
|
|
32
53
|
--theme: $c-blue
|
|
33
|
-
--theme-border: mix($c-blue,
|
|
34
|
-
--theme-bg: mix($c-blue,
|
|
54
|
+
--theme-border: mix($c-blue, white, 60)
|
|
55
|
+
--theme-bg: mix($c-blue, white, 15)
|
|
35
56
|
|
|
36
57
|
.tag-plugin[color='purple']
|
|
37
58
|
--theme: $c-purple
|
|
38
|
-
--theme-border: mix($c-purple,
|
|
39
|
-
--theme-bg: mix($c-purple,
|
|
40
|
-
|
|
59
|
+
--theme-border: mix($c-purple, white, 60)
|
|
60
|
+
--theme-bg: mix($c-purple, white, 15)
|
|
41
61
|
|
|
42
62
|
.tag-plugin[color='light']
|
|
43
63
|
--theme-bg: white
|
|
44
64
|
|
|
45
|
-
|
|
46
65
|
.tag-plugin[color='dark']
|
|
47
|
-
--theme-bg: #
|
|
48
|
-
|
|
66
|
+
--theme-bg: #333
|
|
67
|
+
set_text_white()
|
|
68
|
+
|
|
69
|
+
.tag-plugin.note[color='warning']
|
|
70
|
+
--theme: $c-yellow
|
|
71
|
+
--theme-border: #ffe659
|
|
72
|
+
--theme-bg: #ffe659
|
|
73
|
+
--theme-link: #ff453a
|
|
74
|
+
|
|
75
|
+
.tag-plugin.note[color='error']
|
|
76
|
+
--theme: $c-yellow
|
|
77
|
+
--theme-border: #ff453a
|
|
78
|
+
--theme-bg: #ff453a
|
|
79
|
+
--theme-link: #ffe659
|
|
80
|
+
set_text_white()
|
|
49
81
|
|
|
50
82
|
set_darkmode_tags()
|
|
51
83
|
.tag-plugin[color='red']
|
|
52
|
-
--theme-border: mix($c-red,
|
|
53
|
-
--theme-bg: mix($c-red,
|
|
84
|
+
--theme-border: mix($c-red, black, 70)
|
|
85
|
+
--theme-bg: mix($c-red, black, 20)
|
|
54
86
|
|
|
55
87
|
.tag-plugin[color='orange']
|
|
56
|
-
--theme-border: mix($c-orange,
|
|
57
|
-
--theme-bg: mix($c-orange,
|
|
88
|
+
--theme-border: mix($c-orange, black, 70)
|
|
89
|
+
--theme-bg: mix($c-orange, black, 20)
|
|
58
90
|
|
|
59
91
|
.tag-plugin[color='yellow']
|
|
60
|
-
--theme-border: mix($c-yellow,
|
|
61
|
-
--theme-bg: mix($c-yellow,
|
|
92
|
+
--theme-border: mix($c-yellow, black, 70)
|
|
93
|
+
--theme-bg: mix($c-yellow, black, 20)
|
|
62
94
|
|
|
63
95
|
.tag-plugin[color='green']
|
|
64
|
-
--theme-border: mix($c-green,
|
|
65
|
-
--theme-bg: mix($c-green,
|
|
96
|
+
--theme-border: mix($c-green, black, 70)
|
|
97
|
+
--theme-bg: mix($c-green, black, 20)
|
|
66
98
|
|
|
67
99
|
.tag-plugin[color='cyan']
|
|
68
|
-
--theme-border: mix($c-cyan,
|
|
69
|
-
--theme-bg: mix($c-cyan,
|
|
100
|
+
--theme-border: mix($c-cyan, black, 70)
|
|
101
|
+
--theme-bg: mix($c-cyan, black, 20)
|
|
70
102
|
|
|
71
103
|
.tag-plugin[color='blue']
|
|
72
|
-
--theme-border: mix($c-blue,
|
|
73
|
-
--theme-bg: mix($c-blue,
|
|
104
|
+
--theme-border: mix($c-blue, black, 70)
|
|
105
|
+
--theme-bg: mix($c-blue, black, 20)
|
|
74
106
|
|
|
75
107
|
.tag-plugin[color='purple']
|
|
76
|
-
--theme-border: mix($c-purple,
|
|
77
|
-
--theme-bg: mix($c-purple,
|
|
108
|
+
--theme-border: mix($c-purple, black, 70)
|
|
109
|
+
--theme-bg: mix($c-purple, black, 20)
|
|
78
110
|
|
|
79
111
|
.tag-plugin[color='light']
|
|
80
112
|
--theme-border: white
|
|
81
|
-
--theme-bg: #
|
|
82
|
-
color: var(--card) !important
|
|
113
|
+
--theme-bg: #fff
|
|
83
114
|
|
|
84
115
|
.tag-plugin[color='dark']
|
|
85
116
|
--theme-border: black
|
|
86
|
-
--theme-bg: #
|
|
87
|
-
|
|
117
|
+
--theme-bg: #111
|
|
118
|
+
set_text_white()
|
|
119
|
+
|
|
120
|
+
.tag-plugin[color='warning'],.tag-plugin[color='light']
|
|
121
|
+
set_text_black()
|
|
88
122
|
|
|
89
123
|
if hexo-config('style.darkmode') == 'auto'
|
|
90
124
|
@media (prefers-color-scheme: dark)
|
|
@@ -48,8 +48,8 @@ details.folding[open]
|
|
|
48
48
|
margin: 0 - 1rem
|
|
49
49
|
margin-top: 0
|
|
50
50
|
background: var(--card)
|
|
51
|
-
border-bottom-left-radius: $border-block
|
|
52
|
-
border-bottom-right-radius: $border-block
|
|
51
|
+
border-bottom-left-radius: 'calc(%s - 1px)' % $border-block
|
|
52
|
+
border-bottom-right-radius: 'calc(%s - 1px)' % $border-block
|
|
53
53
|
font-size: $fs-15
|
|
54
54
|
>:first-child
|
|
55
55
|
margin-top: 0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
margin: 1em auto
|
|
4
4
|
display: flex
|
|
5
5
|
justify-content: center
|
|
6
|
-
@media screen and (max-width: $device-mobile-
|
|
6
|
+
@media screen and (max-width: $device-mobile-375)
|
|
7
7
|
width: 100%
|
|
8
8
|
|
|
9
9
|
.md .link-card
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
cursor: pointer
|
|
15
15
|
min-width 280px
|
|
16
16
|
max-width: 100%
|
|
17
|
-
width:
|
|
18
|
-
@media screen and (max-width: $device-mobile-
|
|
17
|
+
width: 320px
|
|
18
|
+
@media screen and (max-width: $device-mobile-375)
|
|
19
19
|
width: 100%
|
|
20
20
|
box-shadow: $boxshadow-card
|
|
21
21
|
border-radius: $border-block
|
|
@@ -104,8 +104,14 @@
|
|
|
104
104
|
padding: 0.5rem 1rem
|
|
105
105
|
margin-top: 4px
|
|
106
106
|
box-shadow: $boxshadow-block
|
|
107
|
+
trans2: transform box-shadow
|
|
108
|
+
&:hover
|
|
109
|
+
transform: translateY(-1px)
|
|
110
|
+
box-shadow: $boxshadow-card-float
|
|
107
111
|
p
|
|
108
112
|
font-size: $fs-14
|
|
113
|
+
img
|
|
114
|
+
display: block
|
|
109
115
|
&:empty
|
|
110
116
|
display: none
|
|
111
117
|
p,.highlight,ol,ul,.tag-plugin
|
|
@@ -120,17 +126,13 @@
|
|
|
120
126
|
span
|
|
121
127
|
color: inherit
|
|
122
128
|
a.body
|
|
129
|
+
display: block
|
|
123
130
|
color: var(--text-p1)
|
|
124
|
-
trans2: transform box-shadow
|
|
125
131
|
line-height: 1.25
|
|
126
132
|
padding: 0.75rem 1rem
|
|
127
|
-
&:hover
|
|
128
|
-
transform: translateY(-1px)
|
|
129
|
-
box-shadow: $boxshadow-card-float
|
|
130
133
|
|
|
131
134
|
|
|
132
135
|
.tag-plugin.timeline[api] .body
|
|
133
|
-
overflow: scroll
|
|
134
136
|
p.title
|
|
135
137
|
font-size: 1rem
|
|
136
138
|
font-weight: 700
|
|
@@ -162,9 +164,6 @@
|
|
|
162
164
|
flex-wrap: wrap
|
|
163
165
|
justify-content: space-between
|
|
164
166
|
align-items: stretch
|
|
165
|
-
position: sticky
|
|
166
|
-
position: -webkit-sticky
|
|
167
|
-
bottom: -0.5rem
|
|
168
167
|
background: var(--card)
|
|
169
168
|
span
|
|
170
169
|
line-height: 1.8
|
|
@@ -201,4 +200,19 @@
|
|
|
201
200
|
margin: 0.75rem 0
|
|
202
201
|
p
|
|
203
202
|
font-size: $fs-13
|
|
204
|
-
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
|
package/source/js/main.js
CHANGED
|
@@ -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');
|
|
@@ -59,7 +59,7 @@ const FCircle = {
|
|
|
59
59
|
cell += '<img src="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
|
|
60
60
|
cell += '<span>' + item.author + '</span>';
|
|
61
61
|
cell += '</div>';
|
|
62
|
-
cell += '<p>' + item.
|
|
62
|
+
cell += '<p>' + item.created + '</p>';
|
|
63
63
|
cell += '</div>';
|
|
64
64
|
cell += '<a class="body" href="' + item.link + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
65
65
|
cell += item.title;
|
|
@@ -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://api.vlts.cc/site_info/v1?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
|
}
|
|
@@ -77,7 +77,7 @@ const StellarTimeline = {
|
|
|
77
77
|
}
|
|
78
78
|
var cell = '<div class="timenode" index="' + i + '">';
|
|
79
79
|
cell += '<div class="header">';
|
|
80
|
-
if (!users.length && item.user) {
|
|
80
|
+
if (!users.length && item.user && !hide.includes('user')) {
|
|
81
81
|
cell += '<a class="user-info" href="' + item.user.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
82
82
|
cell += '<img src="' + item.user.avatar_url + '">';
|
|
83
83
|
cell += '<span>' + item.user.login + '</span>';
|