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
package/scripts/tags/emoji.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* emoji.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% emoji [source] name [height:1.75em] %}
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
hexo.extend.tag.register('emoji', function(args) {
|
|
12
|
-
const config = hexo.theme.config.tag_plugins.emoji;
|
|
13
|
-
args = hexo.args.map(args, ['height'], ['source', 'name']);
|
|
14
|
-
var el = '';
|
|
15
|
-
if (args.source == undefined) {
|
|
16
|
-
return el;
|
|
17
|
-
}
|
|
18
|
-
el += '<span class="tag-plugin emoji">';
|
|
19
|
-
if (args.name == undefined) {
|
|
20
|
-
// 省略了 source
|
|
21
|
-
for (let id in config) {
|
|
22
|
-
if (config[id]) {
|
|
23
|
-
args.name = args.source;
|
|
24
|
-
args.source = id;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (config[args.source] && args.name) {
|
|
30
|
-
let url = config[args.source].replace('%s', args.name);
|
|
31
|
-
el += '<img no-lazy="" class="inline"';
|
|
32
|
-
el += ' src="' + url + '"';
|
|
33
|
-
if (args.height) {
|
|
34
|
-
el += ' style="height:' + args.height + '"';
|
|
35
|
-
}
|
|
36
|
-
el += '/>';
|
|
37
|
-
}
|
|
38
|
-
el += '</span>';
|
|
39
|
-
return el;
|
|
40
|
-
});
|
package/scripts/tags/folding.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* folding.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% folding [color:yellow] [child:codeblock] [open:false] title %}
|
|
6
|
-
* body
|
|
7
|
-
* {% endtable %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('folding', function(args, content) {
|
|
13
|
-
args = hexo.args.map(args, ['color', 'child', 'open'], ['title']);
|
|
14
|
-
var el = '';
|
|
15
|
-
// header
|
|
16
|
-
el += '<details class="tag-plugin folding"';
|
|
17
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
|
18
|
-
if (args.open && args.open == 'true') {
|
|
19
|
-
el += ' open';
|
|
20
|
-
}
|
|
21
|
-
el += '>';
|
|
22
|
-
// summary
|
|
23
|
-
el += '<summary><span>' + (args.title || '') + '</span></summary>';
|
|
24
|
-
// content
|
|
25
|
-
el += '<div class="body">';
|
|
26
|
-
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
|
27
|
-
el += '</div></details>';
|
|
28
|
-
|
|
29
|
-
return el;
|
|
30
|
-
}, {ends: true});
|
package/scripts/tags/frame.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* frame.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% frame iphone11 [img:src] [video:url] [focus:top/bottom] [alt] %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
hexo.extend.tag.register('frame', function(args) {
|
|
11
|
-
args = hexo.args.map(args, ['focus', 'img', 'video'], ['device', 'alt']);
|
|
12
|
-
const img = args.img || '';
|
|
13
|
-
const video = args.video || '';
|
|
14
|
-
const device = args.device || '';
|
|
15
|
-
const focus = args.focus || '';
|
|
16
|
-
const alt = args.alt || '';
|
|
17
|
-
if ((img.length == 0 && video.length == 0) || device.length == 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
var el = '';
|
|
21
|
-
function imgTag(url, alt) {
|
|
22
|
-
let i = '';
|
|
23
|
-
i += '<img class="img" src="' + url + '"';
|
|
24
|
-
if (alt.length > 0) {
|
|
25
|
-
i += ' alt="' + alt + '"';
|
|
26
|
-
}
|
|
27
|
-
i += '/>';
|
|
28
|
-
return i;
|
|
29
|
-
}
|
|
30
|
-
if (video.length > 0) {
|
|
31
|
-
el += '<div class="tag-plugin video-wrap">';
|
|
32
|
-
el += '<div class="frame-wrap" id="' + device + '"';
|
|
33
|
-
if (focus.length > 0) {
|
|
34
|
-
el += 'focus="' + focus + '">';
|
|
35
|
-
} else {
|
|
36
|
-
el += '>';
|
|
37
|
-
}
|
|
38
|
-
el += '<video';
|
|
39
|
-
if (img.length > 0) {
|
|
40
|
-
el += ' poster="' + img + '"';
|
|
41
|
-
}
|
|
42
|
-
el += ' playsinline="" muted="" loop="" autoplay="" preload="metadata">';
|
|
43
|
-
el += '<source src="' + video + '" type="video/mp4">';
|
|
44
|
-
el += '</video>';
|
|
45
|
-
|
|
46
|
-
el += '<div class="frame"></div>';
|
|
47
|
-
el += '</div>';
|
|
48
|
-
el += '</div>';
|
|
49
|
-
} else if (img.length > 0) {
|
|
50
|
-
el += '<div class="tag-plugin img-wrap">';
|
|
51
|
-
el += '<div class="frame-wrap" id="' + device + '"';
|
|
52
|
-
if (focus.length > 0) {
|
|
53
|
-
el += 'focus="' + focus + '">';
|
|
54
|
-
} else {
|
|
55
|
-
el += '>';
|
|
56
|
-
}
|
|
57
|
-
el += imgTag(img, alt);
|
|
58
|
-
el += '<div class="frame"></div>';
|
|
59
|
-
el += '</div>';
|
|
60
|
-
if (alt.length > 0) {
|
|
61
|
-
el += '<span class="image-caption">' + alt + '</span>';
|
|
62
|
-
}
|
|
63
|
-
el += '</div>';
|
|
64
|
-
}
|
|
65
|
-
return el;
|
|
66
|
-
});
|
package/scripts/tags/friends.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* friends.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% friends [group] [repo:owner/repo] [api:http] %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
hexo.extend.tag.register('friends', function(args) {
|
|
11
|
-
args = hexo.args.map(args, ['repo', 'api'], ['group']);
|
|
12
|
-
var links = hexo.locals.get('data').links;
|
|
13
|
-
if (links == undefined) {
|
|
14
|
-
links = {};
|
|
15
|
-
}
|
|
16
|
-
var api;
|
|
17
|
-
if (args.api) {
|
|
18
|
-
api = args.api;
|
|
19
|
-
} else if (args.repo) {
|
|
20
|
-
api = 'https://api.vlts.cc/output_data/v2/' + args.repo;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var el = '<div class="tag-plugin users-wrap">';
|
|
24
|
-
if (api) {
|
|
25
|
-
el += '<div class="stellar-friends-api"';
|
|
26
|
-
el += ' api="' + api + '"';
|
|
27
|
-
el += '>';
|
|
28
|
-
el += '<div class="group-body"></div>';
|
|
29
|
-
el += '</div>';
|
|
30
|
-
} else if (args.group) {
|
|
31
|
-
function cell(item) {
|
|
32
|
-
if (item.url && item.title) {
|
|
33
|
-
var cell = '<div class="user-card">';
|
|
34
|
-
cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">';
|
|
35
|
-
cell += '<img src="' + (item.avatar || hexo.theme.config.default.avatar) + '" onerror="javascript:this.removeAttribute("data-src");this.src="' + hexo.theme.config.default.avatar + '";"/>';
|
|
36
|
-
cell += '<div class="name"><span>' + item.title + '</span></div>';
|
|
37
|
-
cell += '</a></div>'
|
|
38
|
-
return cell;
|
|
39
|
-
} else {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
el += '<div class="group-body">';
|
|
44
|
-
const items = links[args.group] || [];
|
|
45
|
-
items.forEach((item, i) => {
|
|
46
|
-
el += cell(item);
|
|
47
|
-
});
|
|
48
|
-
el += '</div>';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
el += '</div>';
|
|
52
|
-
return el;
|
|
53
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* users.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% users api:https://api.github.com/repos/xaoxuu/hexo-theme-stellar/contributors %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
module.exports = ctx => function(args) {
|
|
11
|
-
args = ctx.args.map(args, ['api']);
|
|
12
|
-
var el = '<div class="tag-plugin users-wrap">';
|
|
13
|
-
|
|
14
|
-
el += '<div class="stellar-friends-api"';
|
|
15
|
-
el += ' api="' + args.api + '"';
|
|
16
|
-
el += '>';
|
|
17
|
-
el += '<div class="group-body"></div>';
|
|
18
|
-
el += '</div>';
|
|
19
|
-
|
|
20
|
-
el += '</div>';
|
|
21
|
-
return el;
|
|
22
|
-
};
|
package/scripts/tags/link.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* link.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% link url [title] [desc:true/false] [icon:src] %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('link', function(args) {
|
|
13
|
-
args = hexo.args.map(args, ['icon', 'desc'], ['url', 'title']);
|
|
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
|
-
}
|
|
24
|
-
var el = '';
|
|
25
|
-
el += '<div class="tag-plugin link dis-select">';
|
|
26
|
-
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + (args.title || '') + '" href="' + args.url + '"';
|
|
27
|
-
if (args.url.includes('://')) {
|
|
28
|
-
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
29
|
-
}
|
|
30
|
-
el += ' cardlink';
|
|
31
|
-
el += ' autofill="';
|
|
32
|
-
el += autofill.join(',');
|
|
33
|
-
el += '"';
|
|
34
|
-
el += '>';
|
|
35
|
-
|
|
36
|
-
function loadIcon() {
|
|
37
|
-
var el = '';
|
|
38
|
-
if (hexo.theme.config.plugins.lazyload && hexo.theme.config.plugins.lazyload.enable) {
|
|
39
|
-
el += '<div class="lazy img" data-bg="' + (args.icon || hexo.theme.config.default.link) + '"></div>';
|
|
40
|
-
} else {
|
|
41
|
-
el += '<div class="lazy img" style="background-image:url("' + (args.icon || hexo.theme.config.default.link) + '")"></div>';
|
|
42
|
-
}
|
|
43
|
-
return el;
|
|
44
|
-
}
|
|
45
|
-
function loadTitle() {
|
|
46
|
-
return '<span class="title">' + (args.title || args.url) + '</span>';
|
|
47
|
-
}
|
|
48
|
-
function loadDesc() {
|
|
49
|
-
return '<span class="cap desc fs12"></span>';
|
|
50
|
-
}
|
|
51
|
-
function loadLink() {
|
|
52
|
-
return '<span class="cap link fs12">' + full_url_for(args.url) + '</span>';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (args.desc) {
|
|
56
|
-
// top
|
|
57
|
-
el += '<div class="top">';
|
|
58
|
-
el += loadIcon() + loadLink();
|
|
59
|
-
el += '</div>';
|
|
60
|
-
// bottom
|
|
61
|
-
el += '<div class="bottom">';
|
|
62
|
-
el += loadTitle() + loadDesc();
|
|
63
|
-
el += '</div>';
|
|
64
|
-
} else {
|
|
65
|
-
// left
|
|
66
|
-
el += '<div class="left">';
|
|
67
|
-
el += loadTitle() + loadLink();
|
|
68
|
-
el += '</div>';
|
|
69
|
-
// right
|
|
70
|
-
el += '<div class="right">';
|
|
71
|
-
el += loadIcon();
|
|
72
|
-
el += '</div>';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// end
|
|
76
|
-
el += '</a></div>';
|
|
77
|
-
|
|
78
|
-
return el;
|
|
79
|
-
});
|
package/scripts/tags/mark.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mark.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% mark text [color:color] %}
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
hexo.extend.tag.register('mark', function(args) {
|
|
12
|
-
args = hexo.args.map(args, ['color'], ['text']);
|
|
13
|
-
if (args.color == null) {
|
|
14
|
-
args.color = hexo.theme.config.tag_plugins.mark.default_color
|
|
15
|
-
}
|
|
16
|
-
var el = '';
|
|
17
|
-
el += '<mark class="tag-plugin mark"';
|
|
18
|
-
el += ' ' + hexo.args.joinTags(args, ['color']).join(' ');
|
|
19
|
-
el += '>';
|
|
20
|
-
el += args.text;
|
|
21
|
-
el += '</mark>';
|
|
22
|
-
return el;
|
|
23
|
-
});
|
package/scripts/tags/navbar.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* navbar.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% navbar [markdown link] ... %}
|
|
6
|
-
*
|
|
7
|
-
* example:
|
|
8
|
-
* {% navbar active:1 [Home](/) [About](/about/) [Comments](#comments) %}
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
hexo.extend.tag.register('navbar', function(args) {
|
|
14
|
-
if (args.length == 0) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
args = hexo.args.map(args, ['active'], ['links']);
|
|
18
|
-
if (args.links) {
|
|
19
|
-
args.links = args.links.split(' ');
|
|
20
|
-
}
|
|
21
|
-
var el = '<div class="tag-plugin navbar"><nav class="cap">';
|
|
22
|
-
function layoutItem(a, i) {
|
|
23
|
-
var text = '';
|
|
24
|
-
var href = '';
|
|
25
|
-
var el = '<a';
|
|
26
|
-
if ((i+1).toString() === args.active) {
|
|
27
|
-
el += ' class="active"';
|
|
28
|
-
}
|
|
29
|
-
if (a.includes('](')) {
|
|
30
|
-
// markdown
|
|
31
|
-
let tmp = a.split('](');
|
|
32
|
-
if (tmp.length > 1) {
|
|
33
|
-
text = tmp[0];
|
|
34
|
-
if (text.length > 1) {
|
|
35
|
-
text = text.substring(1, text.length);
|
|
36
|
-
}
|
|
37
|
-
href = tmp[1];
|
|
38
|
-
if (href.length > 1) {
|
|
39
|
-
href = href.substring(0, href.length-1);
|
|
40
|
-
}
|
|
41
|
-
el += ' href="' + href + '"';
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
el += ' href="#' + a + '"';
|
|
45
|
-
text = a;
|
|
46
|
-
}
|
|
47
|
-
el += '>';
|
|
48
|
-
el += text;
|
|
49
|
-
el += '</a>';
|
|
50
|
-
return el;
|
|
51
|
-
}
|
|
52
|
-
(args.links || []).forEach((item, i) => {
|
|
53
|
-
el += layoutItem(item, i);
|
|
54
|
-
});
|
|
55
|
-
el += '</nav></div>';
|
|
56
|
-
return el;
|
|
57
|
-
});
|
package/scripts/tags/note.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* note.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% note [color:color] [title] content %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
hexo.extend.tag.register('note', function(args) {
|
|
11
|
-
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
|
12
|
-
if (args.content == undefined || args.content.length <= 0) {
|
|
13
|
-
args.content = args.title;
|
|
14
|
-
args.title = '';
|
|
15
|
-
}
|
|
16
|
-
const color = args.color;
|
|
17
|
-
const title = args.title;
|
|
18
|
-
var el = '';
|
|
19
|
-
const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
|
|
20
|
-
if (!color && defaultColor) {
|
|
21
|
-
color = defaultColor;
|
|
22
|
-
}
|
|
23
|
-
// header
|
|
24
|
-
el += '<div class="tag-plugin note"';
|
|
25
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
|
26
|
-
el += '>';
|
|
27
|
-
// title
|
|
28
|
-
if (title && title.length > 0) {
|
|
29
|
-
el += '<div class="title"><strong>' + title + '</strong></div>';
|
|
30
|
-
}
|
|
31
|
-
// content
|
|
32
|
-
el += '<div class="body">';
|
|
33
|
-
el += hexo.render.renderSync({text: args.content, engine: 'markdown'}).split('\n').join('');
|
|
34
|
-
el += '</div></div>';
|
|
35
|
-
|
|
36
|
-
return el;
|
|
37
|
-
});
|
package/scripts/tags/poetry.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* poetry.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* poetry:
|
|
6
|
-
* {% poetry [align:center] [title] [author:作者] [date:日期] [footer:footer] %}
|
|
7
|
-
* body
|
|
8
|
-
* {% endpoetry %}
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
hexo.extend.tag.register('poetry', function(args, content) {
|
|
15
|
-
var el = '';
|
|
16
|
-
args = hexo.args.map(args, ['author', 'date', 'align', 'footer'], ['title']);
|
|
17
|
-
|
|
18
|
-
el += '<div class="tag-plugin poetry"';
|
|
19
|
-
if (args.align) {
|
|
20
|
-
el += ' align="' + args.align + '"';
|
|
21
|
-
}
|
|
22
|
-
el += '>';
|
|
23
|
-
if (args.title) {
|
|
24
|
-
el += '<div class="title">';
|
|
25
|
-
el += args.title;
|
|
26
|
-
el += '</div>';
|
|
27
|
-
}
|
|
28
|
-
if (args.author || args.date) {
|
|
29
|
-
el += '<div class="meta">';
|
|
30
|
-
if (args.author) {
|
|
31
|
-
el += '<span>' + args.author + '</span>';
|
|
32
|
-
}
|
|
33
|
-
if (args.date) {
|
|
34
|
-
el += '<span>' + args.date + '</span>';
|
|
35
|
-
}
|
|
36
|
-
el += '</div>';
|
|
37
|
-
}
|
|
38
|
-
el += '<div class="body">';
|
|
39
|
-
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
|
40
|
-
el += '</div>';
|
|
41
|
-
if (args.footer) {
|
|
42
|
-
el += '<div class="footer">';
|
|
43
|
-
el += args.footer;
|
|
44
|
-
el += '</div>';
|
|
45
|
-
}
|
|
46
|
-
el += '</div>';
|
|
47
|
-
return el;
|
|
48
|
-
}, {ends: true});
|
package/scripts/tags/quot.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quot.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* quot:
|
|
6
|
-
* {% quot [el:h1] [icon:default] text %}
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('quot', function(args) {
|
|
13
|
-
var el = '';
|
|
14
|
-
args = hexo.args.map(args, ['el', 'icon'], ['text']);
|
|
15
|
-
if (!args.el) {
|
|
16
|
-
args.el = 'p';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
var type = '';
|
|
20
|
-
if (args.icon && args.icon != 'square' && args.icon != 'quotes') {
|
|
21
|
-
type = ' type="icon"';
|
|
22
|
-
} else {
|
|
23
|
-
type = ' type="text"';
|
|
24
|
-
}
|
|
25
|
-
function content() {
|
|
26
|
-
if (!args.icon) {
|
|
27
|
-
return args.text;
|
|
28
|
-
}
|
|
29
|
-
var el = '';
|
|
30
|
-
const cfg = hexo.theme.config.tag_plugins.quot[args.icon];
|
|
31
|
-
if (cfg && cfg.prefix) {
|
|
32
|
-
el += '<img class="icon prefix" src="' + cfg.prefix + '" />';
|
|
33
|
-
}
|
|
34
|
-
el += args.text;
|
|
35
|
-
if (cfg && cfg.suffix) {
|
|
36
|
-
el += '<img class="icon suffix" src="' + cfg.suffix + '" />';
|
|
37
|
-
}
|
|
38
|
-
return el;
|
|
39
|
-
}
|
|
40
|
-
if (args.el.includes('h')) {
|
|
41
|
-
el += '<' + args.el + ' class="tag-plugin quot"' + type + ' id="' + args.text + '">';
|
|
42
|
-
el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>';
|
|
43
|
-
el += content();
|
|
44
|
-
el += '</' + args.el + '>';
|
|
45
|
-
} else {
|
|
46
|
-
el += '<' + args.el + ' class="tag-plugin quot"' + type + '>';
|
|
47
|
-
el += content();
|
|
48
|
-
el += '</' + args.el + '>';
|
|
49
|
-
}
|
|
50
|
-
return el;
|
|
51
|
-
});
|
package/scripts/tags/sites.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sites.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% sites [group] [repo:owner/repo] [api:http] %}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
hexo.extend.tag.register('sites', function(args) {
|
|
11
|
-
args = hexo.args.map(args, ['repo', 'api'], ['group']);
|
|
12
|
-
var links = hexo.locals.get('data').links;
|
|
13
|
-
if (links == undefined) {
|
|
14
|
-
links = {};
|
|
15
|
-
}
|
|
16
|
-
var api;
|
|
17
|
-
if (args.api) {
|
|
18
|
-
api = args.api;
|
|
19
|
-
} else if (args.repo) {
|
|
20
|
-
api = 'https://api.vlts.cc/output_data/v2/' + args.repo;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var el = '<div class="tag-plugin sites-wrap">';
|
|
24
|
-
if (api) {
|
|
25
|
-
el += '<div class="stellar-sites-api"';
|
|
26
|
-
el += ' api="' + api + '"';
|
|
27
|
-
el += '>';
|
|
28
|
-
el += '<div class="group-body"></div>';
|
|
29
|
-
el += '</div>';
|
|
30
|
-
} else if (args.group) {
|
|
31
|
-
function cell(item) {
|
|
32
|
-
if (item.url && item.title) {
|
|
33
|
-
var cell = '<div class="site-card">';
|
|
34
|
-
cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">';
|
|
35
|
-
cell += '<img src="' + (item.screenshot || ('https://screenshot-api.xaoxuu.com/api?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.removeAttribute("data-src");this.src="' + hexo.theme.config.default.cover + '";"/>';
|
|
36
|
-
cell += '<div class="info">';
|
|
37
|
-
cell += '<img src="' + (item.avatar || hexo.theme.config.default.link) + '" onerror="javascript:this.removeAttribute("data-src");this.src="' + hexo.theme.config.default.link + '";"/>';
|
|
38
|
-
cell += '<span class="title">' + item.title + '</span>';
|
|
39
|
-
cell += '<span class="desc">' + (item.description || item.url) + '</span>';
|
|
40
|
-
cell += '</div>';
|
|
41
|
-
cell += '</a></div>'
|
|
42
|
-
return cell;
|
|
43
|
-
} else {
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
el += '<div class="group-body">';
|
|
48
|
-
const items = links[args.group] || [];
|
|
49
|
-
items.forEach((item, i) => {
|
|
50
|
-
el += cell(item);
|
|
51
|
-
});
|
|
52
|
-
el += '</div>';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
el += '</div>';
|
|
56
|
-
return el;
|
|
57
|
-
});
|
package/scripts/tags/split.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* split.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% split [style:block/card] %}
|
|
6
|
-
* <!-- cell left -->
|
|
7
|
-
* left body
|
|
8
|
-
* <!-- cell right -->
|
|
9
|
-
* right body
|
|
10
|
-
* {% endsplit %}
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
hexo.extend.tag.register('split', function(args, content) {
|
|
16
|
-
args = hexo.args.map(args, ['bg']);
|
|
17
|
-
var el = '';
|
|
18
|
-
el += '<div class="tag-plugin split"';
|
|
19
|
-
el += ' ' + hexo.args.joinTags(args, ['bg']).join(' ');
|
|
20
|
-
el += '>';
|
|
21
|
-
|
|
22
|
-
var arr = content.split(/<!--\s*cell (.*?)\s*-->/g).filter(item => item.trim().length > 0)
|
|
23
|
-
if (arr.length > 0) {
|
|
24
|
-
var nodes = [];
|
|
25
|
-
arr.forEach((item, i) => {
|
|
26
|
-
if (i % 2 == 0) {
|
|
27
|
-
nodes.push({
|
|
28
|
-
header: item
|
|
29
|
-
});
|
|
30
|
-
} else if (nodes.length > 0) {
|
|
31
|
-
var node = nodes[nodes.length-1];
|
|
32
|
-
if (node.body == undefined) {
|
|
33
|
-
node.body = item;
|
|
34
|
-
} else {
|
|
35
|
-
node.body += '\n' + item;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
nodes.forEach((node, i) => {
|
|
40
|
-
el += '<div class="cell" index="' + (i) + '">';
|
|
41
|
-
el += hexo.render.renderSync({text: (node.body || ''), engine: 'markdown'}).split('\n').join('');
|
|
42
|
-
el += '</div>';
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
el += '</div>';
|
|
47
|
-
|
|
48
|
-
return el;
|
|
49
|
-
}, {ends: true});
|
package/scripts/tags/swiper.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* swiper.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% swiper %}
|
|
6
|
-
* 
|
|
7
|
-
* {% endswiper %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('swiper', function(args, content) {
|
|
13
|
-
args = hexo.args.map(args, ['width']);
|
|
14
|
-
var el = '';
|
|
15
|
-
function slide() {
|
|
16
|
-
let imgs = hexo.render.renderSync({text: content, engine: 'markdown'});
|
|
17
|
-
imgs = imgs.match(/<img(.*?)src="(.*?)"(.*?)>/gi);
|
|
18
|
-
if (imgs && imgs.length > 0) {
|
|
19
|
-
imgs.forEach((img, i) => {
|
|
20
|
-
img = img.replace('<img src', '<img no-lazy src');
|
|
21
|
-
el += '<div class="swiper-slide">' + img + '</div>';
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
el += '<div class="tag-plugin swiper-container" id="swiper-api"';
|
|
26
|
-
if (args.width && args.width.length > 0) {
|
|
27
|
-
el += ' ' + hexo.args.joinTags(args, 'width').join(' ');
|
|
28
|
-
}
|
|
29
|
-
el += '>';
|
|
30
|
-
el += '<div class="swiper-wrapper">';
|
|
31
|
-
slide();
|
|
32
|
-
el += '</div>';
|
|
33
|
-
el += '<div class="swiper-pagination"></div>';
|
|
34
|
-
el += '<div class="swiper-button-prev blur"></div>';
|
|
35
|
-
el += '<div class="swiper-button-next blur"></div>';
|
|
36
|
-
el += '</div>';
|
|
37
|
-
return el;
|
|
38
|
-
}, {ends: true});
|