hexo-theme-stellar 1.18.0 → 1.18.2
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 +32 -34
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +1 -1
- 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/_common/base.styl +2 -2
- package/source/css/_common/blockquote.styl +2 -2
- package/source/css/_common/button.styl +38 -2
- package/source/css/_common/highlight.styl +11 -10
- package/source/css/_custom.styl +17 -8
- package/source/css/_defines/func.styl +1 -1
- package/source/css/_defines/theme.styl +5 -7
- package/source/css/_layout/list.styl +0 -1
- package/source/css/_layout/md.styl +15 -13
- package/source/css/_layout/pages/archives.styl +1 -1
- package/source/css/_layout/pages/error.styl +0 -1
- package/source/css/_layout/partial/related.styl +8 -6
- package/source/css/_layout/sidebar/header.styl +1 -1
- package/source/css/_layout/sidebar/sidebar.styl +2 -1
- package/source/css/_layout/tag-plugins/checkbox.styl +3 -4
- package/source/css/_layout/tag-plugins/common.styl +6 -6
- package/source/css/_layout/tag-plugins/copy.styl +1 -1
- package/source/css/_layout/tag-plugins/folders.styl +9 -9
- package/source/css/_layout/tag-plugins/folding.styl +5 -4
- package/source/css/_layout/tag-plugins/grid.styl +4 -1
- package/source/css/_layout/tag-plugins/link.styl +1 -1
- package/source/css/_layout/tag-plugins/note.styl +9 -10
- package/source/css/_layout/tag-plugins/quot.styl +6 -6
- package/source/css/_layout/tag-plugins/tabs.styl +2 -2
- package/source/css/_layout/tag-plugins/timeline.styl +1 -5
- package/source/css/_layout/tag-plugins/toc.styl +1 -1
- package/source/css/_layout/widgets/search.styl +28 -18
- package/source/css/_layout/widgets/toc_wiki.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/utterances.styl +1 -1
- package/source/css/_plugins/index.styl +4 -0
- package/source/css/_plugins/swiper.styl +17 -7
- package/source/js/main.js +30 -6
- 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
|
@@ -10,44 +10,44 @@
|
|
|
10
10
|
* {% endtable %}
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
'use strict'
|
|
13
|
+
'use strict'
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
args =
|
|
17
|
-
var el = ''
|
|
18
|
-
el += '<div class="tag-plugin folders"'
|
|
19
|
-
el += ' ' +
|
|
20
|
-
el += '>'
|
|
15
|
+
module.exports = ctx => function(args, content) {
|
|
16
|
+
args = ctx.args.map(args, ['color'])
|
|
17
|
+
var el = ''
|
|
18
|
+
el += '<div class="tag-plugin folders"'
|
|
19
|
+
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
|
|
20
|
+
el += '>'
|
|
21
21
|
|
|
22
22
|
var arr = content.split(/<!--\s*folder (.*?)\s*-->/g).filter(item => item.trim().length > 0)
|
|
23
23
|
if (arr.length > 0) {
|
|
24
|
-
var nodes = []
|
|
24
|
+
var nodes = []
|
|
25
25
|
arr.forEach((item, i) => {
|
|
26
26
|
if (i % 2 == 0) {
|
|
27
27
|
nodes.push({
|
|
28
28
|
header: item
|
|
29
|
-
})
|
|
29
|
+
})
|
|
30
30
|
} else if (nodes.length > 0) {
|
|
31
|
-
var node = nodes[nodes.length-1]
|
|
31
|
+
var node = nodes[nodes.length-1]
|
|
32
32
|
if (node.body == undefined) {
|
|
33
|
-
node.body = item
|
|
33
|
+
node.body = item
|
|
34
34
|
} else {
|
|
35
|
-
node.body += '\n' + item
|
|
35
|
+
node.body += '\n' + item
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
})
|
|
38
|
+
})
|
|
39
39
|
nodes.forEach((node, i) => {
|
|
40
|
-
el += '<details class="folder" index="' + (i) + '">'
|
|
40
|
+
el += '<details class="folder" index="' + (i) + '">'
|
|
41
41
|
// summary
|
|
42
|
-
el += '<summary><span>' + (node.header || '') + '</span></summary>'
|
|
42
|
+
el += '<summary><span>' + (node.header || '') + '</span></summary>'
|
|
43
43
|
// content
|
|
44
|
-
el += '<div class="body">'
|
|
45
|
-
el +=
|
|
46
|
-
el += '</div></details>'
|
|
47
|
-
})
|
|
44
|
+
el += '<div class="body">'
|
|
45
|
+
el += ctx.render.renderSync({text: (node.body || ''), engine: 'markdown'}).split('\n').join('')
|
|
46
|
+
el += '</div></details>'
|
|
47
|
+
})
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
el += '</div>'
|
|
50
|
+
el += '</div>'
|
|
51
51
|
|
|
52
|
-
return el
|
|
53
|
-
}
|
|
52
|
+
return el
|
|
53
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
module.exports = ctx => function(args, content) {
|
|
13
|
+
args = ctx.args.map(args, ['color', 'child', 'open'], ['title'])
|
|
14
|
+
var el = ''
|
|
15
|
+
// header
|
|
16
|
+
el += '<details class="tag-plugin folding"'
|
|
17
|
+
el += ' ' + ctx.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 += ctx.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')
|
|
27
|
+
el += '</div></details>'
|
|
28
|
+
|
|
29
|
+
return el
|
|
30
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
args = ctx.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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
args = ctx.args.map(args, ['repo', 'api'], ['group'])
|
|
12
|
+
var links = ctx.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 || ctx.theme.config.default.avatar) + '" onerror="javascript:this.removeAttribute("data-src")this.src="' + ctx.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
|
+
}
|
|
@@ -11,29 +11,29 @@
|
|
|
11
11
|
* API: https://github.com/anuraghazra/github-readme-stats
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
'use strict'
|
|
14
|
+
'use strict'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
var params = ['show_owner', 'theme', 'title_color', 'text_color', 'icon_color', 'bg_color', 'hide_border', 'cache_seconds', 'locale']
|
|
18
|
-
args =
|
|
19
|
-
const path = args.repo
|
|
20
|
-
var el = ''
|
|
21
|
-
el += '<div class="tag-plugin ghcard">'
|
|
22
|
-
el += '<a class="ghcard" rel="external nofollow noopener noreferrer" href="https://github.com/' + path + '">'
|
|
23
|
-
let url = ''
|
|
16
|
+
module.exports = ctx => function(args) {
|
|
17
|
+
var params = ['show_owner', 'theme', 'title_color', 'text_color', 'icon_color', 'bg_color', 'hide_border', 'cache_seconds', 'locale']
|
|
18
|
+
args = ctx.args.map(args, params, ['repo'])
|
|
19
|
+
const path = args.repo
|
|
20
|
+
var el = ''
|
|
21
|
+
el += '<div class="tag-plugin ghcard">'
|
|
22
|
+
el += '<a class="ghcard" rel="external nofollow noopener noreferrer" href="https://github.com/' + path + '">'
|
|
23
|
+
let url = ''
|
|
24
24
|
if (path.includes('/')) {
|
|
25
25
|
// is repo
|
|
26
|
-
const ps = path.split('/')
|
|
27
|
-
url += 'https://github-readme-stats.xaoxuu.com/api/pin/?username=' + ps[0] + '&repo=' + ps[1]
|
|
26
|
+
const ps = path.split('/')
|
|
27
|
+
url += 'https://github-readme-stats.xaoxuu.com/api/pin/?username=' + ps[0] + '&repo=' + ps[1]
|
|
28
28
|
} else {
|
|
29
29
|
// is user
|
|
30
|
-
url += 'https://github-readme-stats.xaoxuu.com/api/?username=' + path
|
|
30
|
+
url += 'https://github-readme-stats.xaoxuu.com/api/?username=' + path
|
|
31
31
|
}
|
|
32
|
-
url += '&' +
|
|
32
|
+
url += '&' + ctx.args.joinURLParams(args, params)
|
|
33
33
|
if (!url.includes('&show_owner=')) {
|
|
34
|
-
url += '&show_owner=true'
|
|
34
|
+
url += '&show_owner=true'
|
|
35
35
|
}
|
|
36
|
-
el += '<img src="' + url + '"/>'
|
|
37
|
-
el += '</a></div>'
|
|
38
|
-
return el
|
|
39
|
-
}
|
|
36
|
+
el += '<img src="' + url + '"/>'
|
|
37
|
+
el += '</a></div>'
|
|
38
|
+
return el
|
|
39
|
+
}
|
|
@@ -10,40 +10,40 @@
|
|
|
10
10
|
* {% endgrid %}
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
'use strict'
|
|
13
|
+
'use strict'
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
args =
|
|
17
|
-
var el = ''
|
|
18
|
-
el += '<div class="tag-plugin grid"'
|
|
19
|
-
el += ' ' +
|
|
20
|
-
el += '>'
|
|
15
|
+
module.exports = ctx => function(args, content) {
|
|
16
|
+
args = ctx.args.map(args, ['bg'])
|
|
17
|
+
var el = ''
|
|
18
|
+
el += '<div class="tag-plugin grid"'
|
|
19
|
+
el += ' ' + ctx.args.joinTags(args, ['bg']).join(' ')
|
|
20
|
+
el += '>'
|
|
21
21
|
|
|
22
22
|
var arr = content.split(/<!--\s*cell (.*?)\s*-->/g).filter(item => item.trim().length > 0)
|
|
23
23
|
if (arr.length > 0) {
|
|
24
|
-
var nodes = []
|
|
24
|
+
var nodes = []
|
|
25
25
|
arr.forEach((item, i) => {
|
|
26
26
|
if (i % 2 == 0) {
|
|
27
27
|
nodes.push({
|
|
28
28
|
header: item
|
|
29
|
-
})
|
|
29
|
+
})
|
|
30
30
|
} else if (nodes.length > 0) {
|
|
31
|
-
var node = nodes[nodes.length-1]
|
|
31
|
+
var node = nodes[nodes.length-1]
|
|
32
32
|
if (node.body == undefined) {
|
|
33
|
-
node.body = item
|
|
33
|
+
node.body = item
|
|
34
34
|
} else {
|
|
35
|
-
node.body += '\n' + item
|
|
35
|
+
node.body += '\n' + item
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
})
|
|
38
|
+
})
|
|
39
39
|
nodes.forEach((node, i) => {
|
|
40
|
-
el += '<div class="cell" index="' + (i) + '">'
|
|
41
|
-
el +=
|
|
42
|
-
el += '</div>'
|
|
43
|
-
})
|
|
40
|
+
el += '<div class="cell" index="' + (i) + '">'
|
|
41
|
+
el += ctx.render.renderSync({text: (node.body || ''), engine: 'markdown'}).split('\n').join('')
|
|
42
|
+
el += '</div>'
|
|
43
|
+
})
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
el += '</div>'
|
|
46
|
+
el += '</div>'
|
|
47
47
|
|
|
48
|
-
return el
|
|
49
|
-
}
|
|
48
|
+
return el
|
|
49
|
+
}
|
|
@@ -5,82 +5,82 @@
|
|
|
5
5
|
* {% image src [alt] [width:400px] [bg:#eee] [download:true/false/url] %}
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
'use strict'
|
|
8
|
+
'use strict'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
args =
|
|
12
|
-
var style = ''
|
|
10
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
args = ctx.args.map(args, ['width', 'height', 'bg', 'download', 'padding', 'fancybox'], ['src', 'alt'])
|
|
12
|
+
var style = ''
|
|
13
13
|
if (args.width) {
|
|
14
|
-
style += 'width:' + args.width + ';'
|
|
14
|
+
style += 'width:' + args.width + ';'
|
|
15
15
|
}
|
|
16
16
|
if (args.height) {
|
|
17
|
-
style += 'height:' + args.height + ';'
|
|
17
|
+
style += 'height:' + args.height + ';'
|
|
18
18
|
}
|
|
19
19
|
// fancybox
|
|
20
|
-
var fancybox = false
|
|
21
|
-
if (
|
|
20
|
+
var fancybox = false
|
|
21
|
+
if (ctx.theme.config.plugins.fancybox && ctx.theme.config.plugins.fancybox.enable) {
|
|
22
22
|
// 主题配置
|
|
23
|
-
if (
|
|
24
|
-
fancybox =
|
|
23
|
+
if (ctx.theme.config.tag_plugins.image && ctx.theme.config.tag_plugins.image.fancybox) {
|
|
24
|
+
fancybox = ctx.theme.config.tag_plugins.image.fancybox
|
|
25
25
|
}
|
|
26
26
|
// 覆盖配置
|
|
27
27
|
if (args.fancybox && args.fancybox.length > 0) {
|
|
28
28
|
if (args.fancybox == 'true') {
|
|
29
|
-
fancybox = true
|
|
29
|
+
fancybox = true
|
|
30
30
|
} else if (args.fancybox == 'false') {
|
|
31
|
-
fancybox = false
|
|
31
|
+
fancybox = false
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function img(src, alt, style) {
|
|
37
|
-
let img = ''
|
|
38
|
-
img += '<img src="' + src + '"'
|
|
37
|
+
let img = ''
|
|
38
|
+
img += '<img src="' + src + '"'
|
|
39
39
|
if (alt) {
|
|
40
|
-
img += ' alt="' + alt + '"'
|
|
40
|
+
img += ' alt="' + alt + '"'
|
|
41
41
|
}
|
|
42
42
|
if (fancybox) {
|
|
43
|
-
img += ' fancybox="true"'
|
|
43
|
+
img += ' fancybox="true"'
|
|
44
44
|
}
|
|
45
45
|
if (style.length > 0) {
|
|
46
|
-
img += ' style="' + style + '"'
|
|
46
|
+
img += ' style="' + style + '"'
|
|
47
47
|
}
|
|
48
|
-
img += '/>'
|
|
49
|
-
return img
|
|
48
|
+
img += '/>'
|
|
49
|
+
return img
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
var el = ''
|
|
52
|
+
var el = ''
|
|
53
53
|
// wrap
|
|
54
|
-
el += '<div class="tag-plugin image">'
|
|
54
|
+
el += '<div class="tag-plugin image">'
|
|
55
55
|
// bg
|
|
56
|
-
el += '<div class="image-bg"'
|
|
56
|
+
el += '<div class="image-bg"'
|
|
57
57
|
if (args.bg || args.padding) {
|
|
58
|
-
el += ' style="'
|
|
58
|
+
el += ' style="'
|
|
59
59
|
if (args.bg && args.bg.length > 0) {
|
|
60
|
-
el += 'background:' + args.bg + ';'
|
|
60
|
+
el += 'background:' + args.bg + ';'
|
|
61
61
|
}
|
|
62
62
|
if (args.padding) {
|
|
63
|
-
el += 'padding:' + args.padding + ';'
|
|
63
|
+
el += 'padding:' + args.padding + ';'
|
|
64
64
|
}
|
|
65
|
-
el += '"'
|
|
65
|
+
el += '"'
|
|
66
66
|
}
|
|
67
|
-
el += '>'
|
|
68
|
-
el += img(args.src, args.alt, style)
|
|
67
|
+
el += '>'
|
|
68
|
+
el += img(args.src, args.alt, style)
|
|
69
69
|
if (args.download && args.download.length > 0) {
|
|
70
|
-
let href = args.download
|
|
70
|
+
let href = args.download
|
|
71
71
|
if (args.download == 'true') {
|
|
72
|
-
href = args.src
|
|
72
|
+
href = args.src
|
|
73
73
|
}
|
|
74
|
-
el += '<a class="image-download blur" style="opacity:0" href="' + href + '"><svg class="icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3734"><path d="M561.00682908 685.55838913a111.03077546 111.03077546 0 0 1-106.8895062 0L256.23182837 487.72885783a55.96309219 55.96309219 0 0 1 79.13181253-79.18777574L450.70357448 523.88101491V181.55477937a55.96309219 55.96309219 0 0 1 111.92618438 0v344.06109173l117.07478902-117.07478901a55.96309219 55.96309219 0 0 1 79.13181252 79.18777574zM282.81429711 797.1487951h447.70473912a55.96309219 55.96309219 0 0 1 0 111.92618438H282.81429711a55.96309219 55.96309219 0 0 1 0-111.92618438z" p-id="3735"></path></svg></a>'
|
|
74
|
+
el += '<a class="image-download blur" style="opacity:0" href="' + href + '"><svg class="icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3734"><path d="M561.00682908 685.55838913a111.03077546 111.03077546 0 0 1-106.8895062 0L256.23182837 487.72885783a55.96309219 55.96309219 0 0 1 79.13181253-79.18777574L450.70357448 523.88101491V181.55477937a55.96309219 55.96309219 0 0 1 111.92618438 0v344.06109173l117.07478902-117.07478901a55.96309219 55.96309219 0 0 1 79.13181252 79.18777574zM282.81429711 797.1487951h447.70473912a55.96309219 55.96309219 0 0 1 0 111.92618438H282.81429711a55.96309219 55.96309219 0 0 1 0-111.92618438z" p-id="3735"></path></svg></a>'
|
|
75
75
|
}
|
|
76
|
-
el += '</div>'
|
|
76
|
+
el += '</div>'
|
|
77
77
|
|
|
78
78
|
if (args.alt && args.alt.length > 0) {
|
|
79
|
-
el += '<div class="image-meta">'
|
|
80
|
-
el += '<span class="image-caption center">' + args.alt + '</span>'
|
|
81
|
-
el += '</div>'
|
|
79
|
+
el += '<div class="image-meta">'
|
|
80
|
+
el += '<span class="image-caption center">' + args.alt + '</span>'
|
|
81
|
+
el += '</div>'
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
el += '</div>'
|
|
85
|
-
return el
|
|
86
|
-
}
|
|
84
|
+
el += '</div>'
|
|
85
|
+
return el
|
|
86
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
const full_url_for = require('hexo-util').full_url_for.bind(ctx)
|
|
12
|
+
args = ctx.args.map(args, ['icon', 'desc'], ['url', 'title'])
|
|
13
|
+
var autofill = []
|
|
14
|
+
if (!args.title) {
|
|
15
|
+
autofill.push('title')
|
|
16
|
+
}
|
|
17
|
+
if (!args.icon) {
|
|
18
|
+
autofill.push('icon')
|
|
19
|
+
}
|
|
20
|
+
if (args.desc) {
|
|
21
|
+
autofill.push('desc')
|
|
22
|
+
}
|
|
23
|
+
var el = ''
|
|
24
|
+
el += '<div class="tag-plugin link dis-select">'
|
|
25
|
+
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + (args.title || '') + '" href="' + args.url + '"'
|
|
26
|
+
if (args.url.includes('://')) {
|
|
27
|
+
el += ' target="_blank" rel="external nofollow noopener noreferrer"'
|
|
28
|
+
}
|
|
29
|
+
el += ' cardlink'
|
|
30
|
+
el += ' autofill="'
|
|
31
|
+
el += autofill.join(',')
|
|
32
|
+
el += '"'
|
|
33
|
+
el += '>'
|
|
34
|
+
|
|
35
|
+
function loadIcon() {
|
|
36
|
+
var el = ''
|
|
37
|
+
if (ctx.theme.config.plugins.lazyload && ctx.theme.config.plugins.lazyload.enable) {
|
|
38
|
+
el += '<div class="lazy img" data-bg="' + (args.icon || ctx.theme.config.default.link) + '"></div>'
|
|
39
|
+
} else {
|
|
40
|
+
el += '<div class="lazy img" style="background-image:url("' + (args.icon || ctx.theme.config.default.link) + '")"></div>'
|
|
41
|
+
}
|
|
42
|
+
return el
|
|
43
|
+
}
|
|
44
|
+
function loadTitle() {
|
|
45
|
+
return '<span class="title">' + (args.title || args.url) + '</span>'
|
|
46
|
+
}
|
|
47
|
+
function loadDesc() {
|
|
48
|
+
return '<span class="cap desc fs12"></span>'
|
|
49
|
+
}
|
|
50
|
+
function loadLink() {
|
|
51
|
+
return '<span class="cap link fs12">' + full_url_for(args.url) + '</span>'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (args.desc) {
|
|
55
|
+
// top
|
|
56
|
+
el += '<div class="top">'
|
|
57
|
+
el += loadIcon() + loadLink()
|
|
58
|
+
el += '</div>'
|
|
59
|
+
// bottom
|
|
60
|
+
el += '<div class="bottom">'
|
|
61
|
+
el += loadTitle() + loadDesc()
|
|
62
|
+
el += '</div>'
|
|
63
|
+
} else {
|
|
64
|
+
// left
|
|
65
|
+
el += '<div class="left">'
|
|
66
|
+
el += loadTitle() + loadLink()
|
|
67
|
+
el += '</div>'
|
|
68
|
+
// right
|
|
69
|
+
el += '<div class="right">'
|
|
70
|
+
el += loadIcon()
|
|
71
|
+
el += '</div>'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// end
|
|
75
|
+
el += '</a></div>'
|
|
76
|
+
|
|
77
|
+
return el
|
|
78
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
12
|
+
args = ctx.args.map(args, ['color'], ['text'])
|
|
13
|
+
if (args.color == null) {
|
|
14
|
+
args.color = ctx.theme.config.tag_plugins.mark.default_color
|
|
15
|
+
}
|
|
16
|
+
var el = ''
|
|
17
|
+
el += '<mark class="tag-plugin mark"'
|
|
18
|
+
el += ' ' + ctx.args.joinTags(args, ['color']).join(' ')
|
|
19
|
+
el += '>'
|
|
20
|
+
el += args.text
|
|
21
|
+
el += '</mark>'
|
|
22
|
+
return el
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
14
|
+
if (args.length == 0) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
args = ctx.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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
module.exports = ctx => function(args) {
|
|
11
|
+
args = ctx.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 = ctx.theme.config.tag_plugins.note.default_color
|
|
19
|
+
}
|
|
20
|
+
var el = ''
|
|
21
|
+
// header
|
|
22
|
+
el += '<div class="tag-plugin note"'
|
|
23
|
+
el += ' ' + ctx.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 += ctx.render.renderSync({text: args.content, engine: 'markdown'}).split('\n').join('')
|
|
32
|
+
el += '</div></div>'
|
|
33
|
+
|
|
34
|
+
return el
|
|
35
|
+
}
|