hexo-theme-stellar 1.18.0 → 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 +16 -32
- 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/widgets/toc.ejs +1 -1
- package/package.json +1 -1
- 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/{grid.js → lib/grid.js} +20 -20
- 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/{quot.js → lib/quot.js} +24 -24
- 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/{tag.js → lib/tag.js} +13 -13
- package/scripts/tags/lib/timeline.js +78 -0
- package/scripts/tags/lib/toc.js +73 -0
- package/source/css/_defines/theme.styl +6 -6
- package/source/css/_layout/md.styl +10 -10
- package/source/css/_layout/partial/related.styl +7 -5
- package/source/css/_layout/tag-plugins/folders.styl +8 -8
- package/source/css/_layout/tag-plugins/quot.styl +3 -5
- package/source/css/_layout/widgets/search.styl +1 -0
- package/source/css/_plugins/aplayer.styl +3 -0
- package/source/css/_plugins/comments/artalk.styl +4 -0
- package/source/css/_plugins/comments/utterances.styl +1 -1
- package/source/css/_plugins/index.styl +4 -0
- package/source/css/_plugins/swiper.styl +7 -4
- package/source/js/main.js +7 -5
- package/scripts/tags/ablock.js +0 -33
- package/scripts/tags/about.js +0 -48
- 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 -35
- package/scripts/tags/poetry.js +0 -47
- package/scripts/tags/sites.js +0 -57
- package/scripts/tags/swiper.js +0 -38
- package/scripts/tags/timeline.js +0 -81
- package/scripts/tags/toc.js +0 -72
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
:root
|
|
2
2
|
--swiper-theme-color: $color-theme !important
|
|
3
|
-
.swiper
|
|
3
|
+
.swiper
|
|
4
4
|
width: 100%
|
|
5
5
|
border-radius: 4px
|
|
6
6
|
--gap-p: 2rem
|
|
7
|
-
.swiper
|
|
7
|
+
.swiper:not(.swiper-initialized)
|
|
8
8
|
display: none
|
|
9
9
|
div.swiper-slide
|
|
10
10
|
text-align: center
|
|
@@ -25,12 +25,15 @@ div.swiper-slide
|
|
|
25
25
|
img
|
|
26
26
|
border-radius: 4px
|
|
27
27
|
|
|
28
|
-
.swiper
|
|
28
|
+
.swiper[width='max'] .swiper-slide
|
|
29
29
|
width: 100%
|
|
30
30
|
|
|
31
|
-
.swiper
|
|
31
|
+
.swiper[width='min'] .swiper-slide
|
|
32
32
|
width: 25%
|
|
33
33
|
|
|
34
|
+
.swiper[effect='cards'] .swiper-slide
|
|
35
|
+
max-width: 75%
|
|
36
|
+
|
|
34
37
|
.swiper-button-prev,.swiper-button-next
|
|
35
38
|
padding: 1rem 0.5rem
|
|
36
39
|
margin-top: -2rem !important
|
package/source/js/main.js
CHANGED
|
@@ -111,12 +111,12 @@ const init = {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
if (topSeg) {
|
|
114
|
-
$("
|
|
114
|
+
$("#data-toc a.toc-link").removeClass("active")
|
|
115
115
|
var link = "#" + topSeg.attr("id")
|
|
116
116
|
if (link != '#undefined') {
|
|
117
|
-
$('
|
|
117
|
+
$('#data-toc a.toc-link[href="' + encodeURI(link) + '"]').addClass("active")
|
|
118
118
|
} else {
|
|
119
|
-
$('
|
|
119
|
+
$('#data-toc a.toc-link:first').addClass("active")
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
})
|
|
@@ -124,7 +124,7 @@ const init = {
|
|
|
124
124
|
},
|
|
125
125
|
sidebar: () => {
|
|
126
126
|
stellar.jQuery(() => {
|
|
127
|
-
$("
|
|
127
|
+
$("#data-toc a.toc-link").click(function (e) {
|
|
128
128
|
l_body.classList.remove("sidebar");
|
|
129
129
|
});
|
|
130
130
|
})
|
|
@@ -241,10 +241,12 @@ if (stellar.plugins.swiper) {
|
|
|
241
241
|
if (swiper_api != undefined) {
|
|
242
242
|
stellar.loadCSS(stellar.plugins.swiper.css);
|
|
243
243
|
stellar.loadScript(stellar.plugins.swiper.js, { defer: true }).then(function () {
|
|
244
|
-
|
|
244
|
+
const effect = swiper_api.getAttribute('effect') || '';
|
|
245
|
+
var swiper = new Swiper('.swiper#swiper-api', {
|
|
245
246
|
slidesPerView: 'auto',
|
|
246
247
|
spaceBetween: 8,
|
|
247
248
|
centeredSlides: true,
|
|
249
|
+
effect: effect,
|
|
248
250
|
loop: true,
|
|
249
251
|
pagination: {
|
|
250
252
|
el: '.swiper-pagination',
|
package/scripts/tags/ablock.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ablock.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% ablock [color:color] [child:codeblock/tabs] title %}
|
|
6
|
-
* body
|
|
7
|
-
* {% endablock %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
hexo.extend.tag.register('ablock', function(args, content) {
|
|
13
|
-
args = hexo.args.map(args, ['color', 'child'], ['title']);
|
|
14
|
-
const { title } = args;
|
|
15
|
-
if (args.color == null) {
|
|
16
|
-
args.color = hexo.theme.config.tag_plugins.note.default_color
|
|
17
|
-
}
|
|
18
|
-
var el = '';
|
|
19
|
-
// header
|
|
20
|
-
el += '<div class="tag-plugin note"';
|
|
21
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
|
22
|
-
el += '>';
|
|
23
|
-
// title
|
|
24
|
-
if (title && title.length > 0) {
|
|
25
|
-
el += '<div class="title"><strong>' + title + '</strong></div>';
|
|
26
|
-
}
|
|
27
|
-
// content
|
|
28
|
-
el += '<div class="body">';
|
|
29
|
-
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
|
30
|
-
el += '</div></div>';
|
|
31
|
-
|
|
32
|
-
return el;
|
|
33
|
-
}, {ends: true});
|
package/scripts/tags/about.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* about.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* {% about [avatar:xxx] [height:80px] %}
|
|
6
|
-
* title / body
|
|
7
|
-
* {% endabout %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
const url_for = require('hexo-util').url_for.bind(hexo);
|
|
12
|
-
|
|
13
|
-
hexo.extend.tag.register('about', function(args, content) {
|
|
14
|
-
args = hexo.args.map(args, ['avatar', 'height', 'border', 'back']);
|
|
15
|
-
var rows = hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n');
|
|
16
|
-
var el = '';
|
|
17
|
-
// wrapper
|
|
18
|
-
el += '<div class="tag-plugin about">';
|
|
19
|
-
if (args.back) {
|
|
20
|
-
el += '<a class="nav-back cap" href="' + url_for(hexo.config.root) + '">';
|
|
21
|
-
el += '<svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
|
|
22
|
-
el += '</a>';
|
|
23
|
-
}
|
|
24
|
-
// avatar
|
|
25
|
-
var avatar_url = args.avatar;
|
|
26
|
-
if (avatar_url) {
|
|
27
|
-
el += '<div class="about-header">';
|
|
28
|
-
el += '<div class="avatar">';
|
|
29
|
-
el += '<img src="' + avatar_url + '"';
|
|
30
|
-
if (args.border && args.border.length > 0) {
|
|
31
|
-
el += ' style="border-radius:' + args.border + '"';
|
|
32
|
-
}
|
|
33
|
-
if (args.height && args.height.length > 0) {
|
|
34
|
-
el += ' height="' + args.height + '"';
|
|
35
|
-
}
|
|
36
|
-
el += '/>';
|
|
37
|
-
el += '</div>';
|
|
38
|
-
el += '</div>';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// content
|
|
42
|
-
el += '<div class="about-body fs14">';
|
|
43
|
-
el += rows.join('');
|
|
44
|
-
el += '</div>';
|
|
45
|
-
|
|
46
|
-
el += '</div>';
|
|
47
|
-
return el;
|
|
48
|
-
}, {ends: true});
|
package/scripts/tags/checkbox.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* checkbox.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* radio.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
4
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
5
|
-
*
|
|
6
|
-
* {% checkbox [checked:false] [color:cyan] [symbol:plus/minus/times] text %}
|
|
7
|
-
* {% radio [checked:false] [color:cyan] text %}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
function layoutDiv(args, type) {
|
|
13
|
-
args = hexo.args.map(args, ['color', 'checked', 'symbol'], ['text']);
|
|
14
|
-
var el = '';
|
|
15
|
-
// div
|
|
16
|
-
el += '<div class="tag-plugin checkbox"';
|
|
17
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'symbol']).join(' ');
|
|
18
|
-
el += '>';
|
|
19
|
-
// input
|
|
20
|
-
el += '<input type="' + type + '"';
|
|
21
|
-
if (args.checked == 'true') {
|
|
22
|
-
el += ' checked="true"';
|
|
23
|
-
}
|
|
24
|
-
el += '/>';
|
|
25
|
-
// text
|
|
26
|
-
el += '<span>' + args.text + '</span>';
|
|
27
|
-
// div
|
|
28
|
-
el += '</div>';
|
|
29
|
-
return el;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
hexo.extend.tag.register('checkbox', function(args) {
|
|
33
|
-
return layoutDiv(args, 'checkbox');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
hexo.extend.tag.register('radio', function(args) {
|
|
37
|
-
return layoutDiv(args, 'radio');
|
|
38
|
-
});
|
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,35 +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 { title } = args;
|
|
17
|
-
if (args.color == null) {
|
|
18
|
-
args.color = hexo.theme.config.tag_plugins.note.default_color
|
|
19
|
-
}
|
|
20
|
-
var el = '';
|
|
21
|
-
// header
|
|
22
|
-
el += '<div class="tag-plugin note"';
|
|
23
|
-
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
|
24
|
-
el += '>';
|
|
25
|
-
// title
|
|
26
|
-
if (title && title.length > 0) {
|
|
27
|
-
el += '<div class="title">' + title + '</div>';
|
|
28
|
-
}
|
|
29
|
-
// content
|
|
30
|
-
el += '<div class="body">';
|
|
31
|
-
el += hexo.render.renderSync({text: args.content, engine: 'markdown'}).split('\n').join('');
|
|
32
|
-
el += '</div></div>';
|
|
33
|
-
|
|
34
|
-
return el;
|
|
35
|
-
});
|
package/scripts/tags/poetry.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* poetry.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
-
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
|
-
*
|
|
5
|
-
* poetry:
|
|
6
|
-
* {% poetry [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', 'footer'], ['title']);
|
|
17
|
-
|
|
18
|
-
el += '<div class="tag-plugin poetry"';
|
|
19
|
-
el += '>';
|
|
20
|
-
el += '<div class="content">'
|
|
21
|
-
if (args.title) {
|
|
22
|
-
el += '<div class="title">';
|
|
23
|
-
el += args.title;
|
|
24
|
-
el += '</div>';
|
|
25
|
-
}
|
|
26
|
-
if (args.author || args.date) {
|
|
27
|
-
el += '<div class="meta">';
|
|
28
|
-
if (args.author) {
|
|
29
|
-
el += '<span>' + args.author + '</span>';
|
|
30
|
-
}
|
|
31
|
-
if (args.date) {
|
|
32
|
-
el += '<span>' + args.date + '</span>';
|
|
33
|
-
}
|
|
34
|
-
el += '</div>';
|
|
35
|
-
}
|
|
36
|
-
el += '<div class="body">';
|
|
37
|
-
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
|
38
|
-
el += '</div>';
|
|
39
|
-
if (args.footer) {
|
|
40
|
-
el += '<div class="footer">';
|
|
41
|
-
el += args.footer;
|
|
42
|
-
el += '</div>';
|
|
43
|
-
}
|
|
44
|
-
el += '</div>'
|
|
45
|
-
el += '</div>';
|
|
46
|
-
return el;
|
|
47
|
-
}, {ends: true});
|