hexo-theme-stellar 1.11.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/_config.yml +22 -37
- package/_data/links.yml +7 -0
- package/_data/widgets.yml +30 -6
- package/languages/zh-CN.yml +4 -4
- package/languages/zh-TW.yml +4 -4
- package/layout/_partial/head.ejs +2 -0
- package/layout/_partial/main/article/read_next.ejs +16 -17
- package/layout/_partial/main/navbar/breadcrumb.ejs +1 -1
- package/layout/_partial/main/navbar/list_post.ejs +57 -34
- package/layout/_partial/main/post_list/post_card.ejs +25 -15
- package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
- package/layout/_partial/scripts/index.ejs +1 -0
- package/layout/_partial/sidebar/header.ejs +2 -26
- package/layout/_partial/sidebar/logo.ejs +2 -2
- package/layout/_partial/sidebar/menu.ejs +27 -0
- package/layout/_partial/sidebar/widgets/ghissues.ejs +45 -0
- package/layout/_partial/sidebar/widgets/ghrepo.ejs +3 -3
- package/layout/_partial/sidebar/widgets/ghuser.ejs +4 -0
- package/layout/_partial/sidebar/widgets/markdown.ejs +1 -1
- package/layout/_partial/sidebar/widgets/recent.ejs +8 -11
- package/layout/_partial/sidebar/widgets/{wiki_more.ejs → related.ejs} +7 -7
- package/layout/_partial/sidebar/widgets/tagcloud.ejs +24 -0
- package/layout/_partial/sidebar/widgets/timeline.ejs +27 -0
- package/layout/_partial/sidebar/widgets/toc.ejs +1 -5
- package/layout/index.ejs +1 -1
- package/layout/page.ejs +19 -10
- package/package.json +1 -1
- package/scripts/events/lib/config.js +1 -1
- package/scripts/events/lib/doc_tree.js +3 -0
- package/scripts/helpers/related_posts.js +11 -39
- package/scripts/tags/about.js +10 -7
- package/scripts/tags/{grid.js → border.js} +4 -4
- package/scripts/tags/friends.js +36 -75
- package/scripts/tags/link.js +11 -9
- package/scripts/tags/navbar.js +1 -1
- package/scripts/tags/sites.js +40 -79
- package/scripts/tags/split.js +51 -0
- package/scripts/tags/timeline.js +6 -4
- package/source/css/_common/base.styl +2 -2
- package/source/css/_common/blur.styl +3 -0
- package/source/css/_common/device.styl +2 -0
- package/source/css/_common/highlight.styl +1 -1
- package/source/css/_common/loading.styl +16 -3
- package/source/css/_common/title.styl +0 -13
- package/source/css/_custom.styl +4 -4
- package/source/css/_layout/list.styl +40 -12
- package/source/css/_layout/main.styl +1 -1
- package/source/css/_layout/md.styl +1 -4
- package/source/css/_layout/partial/navbar.styl +1 -1
- package/source/css/_layout/partial/related.styl +62 -93
- package/source/css/_layout/sidebar/footer.styl +4 -2
- package/source/css/_layout/sidebar/ghrepo.styl +11 -5
- package/source/css/_layout/sidebar/ghuser.styl +19 -1
- package/source/css/_layout/sidebar/sidebar.styl +11 -96
- package/source/css/_layout/sidebar/toc_common.styl +5 -3
- package/source/css/_layout/sidebar/widgets.styl +103 -0
- package/source/css/_layout/tag-plugins/about.styl +21 -18
- package/source/css/_layout/tag-plugins/common.styl +36 -31
- package/source/css/_layout/tag-plugins/link.styl +41 -27
- package/source/css/_layout/tag-plugins/navbar.styl +10 -4
- package/source/css/_layout/tag-plugins/quot.styl +1 -1
- package/source/css/_layout/tag-plugins/split.styl +32 -0
- package/source/css/_layout/tag-plugins/timeline.styl +40 -14
- package/source/css/_plugins/comments/twikoo.styl +11 -5
- package/source/css/_plugins/comments/waline.styl +5 -1
- package/source/css/_plugins/index.styl +0 -2
- package/source/js/main.js +15 -9
- package/source/js/plugins/fcircle.js +92 -0
- package/source/js/plugins/friends.js +3 -2
- package/source/js/plugins/ghinfo.js +14 -2
- package/source/js/plugins/linkcard.js +124 -0
- package/source/js/plugins/sites.js +4 -3
- package/source/js/plugins/timeline.js +58 -40
- package/layout/_partial/plugins/comments/valine/layout.ejs +0 -19
- package/layout/_partial/plugins/comments/valine/script.ejs +0 -48
- package/scripts/tags/issues.js +0 -30
- package/source/css/_plugins/comments/valine.styl +0 -218
|
@@ -26,7 +26,7 @@ function layoutDiv() {
|
|
|
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>';
|
|
29
|
-
el +=
|
|
29
|
+
el += repo;
|
|
30
30
|
el += '</div>';
|
|
31
31
|
el += '<div class="repo-desc"><span type="text" id="description"> </span></div>';
|
|
32
32
|
el += '<div class="grid">';
|
|
@@ -38,9 +38,9 @@ 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" api="https://api.github.xaoxuu.com/repos/' + repo + '/
|
|
41
|
+
el += '<div class="flex-row stellar-ghinfo-api" index="0" api="https://api.github.xaoxuu.com/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
|
-
el += '<span type="text" id="
|
|
43
|
+
el += '<span type="text" id="latest-tag-name">0</span>';
|
|
44
44
|
el += '</div>';
|
|
45
45
|
el += '</div>';
|
|
46
46
|
el += '</a>';
|
|
@@ -45,6 +45,10 @@ function layoutDiv() {
|
|
|
45
45
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
|
|
46
46
|
el += 'Follow';
|
|
47
47
|
el += '</a>';
|
|
48
|
+
// menu
|
|
49
|
+
if (item.menu) {
|
|
50
|
+
el += partial('../menu', {where: 'sidebar'});
|
|
51
|
+
}
|
|
48
52
|
el += '</div>';
|
|
49
53
|
el += '</div>';
|
|
50
54
|
return el;
|
|
@@ -5,7 +5,7 @@ function layoutDiv() {
|
|
|
5
5
|
return el;
|
|
6
6
|
}
|
|
7
7
|
el += '<div class="widget-wrap" id="markdown">';
|
|
8
|
-
el += '<div class="widget-header cap dis-select">';
|
|
8
|
+
el += '<div class="widget-header cap theme dis-select">';
|
|
9
9
|
el += '<span class="name">' + item.title + '</span>';
|
|
10
10
|
el += '</div>';
|
|
11
11
|
el += '<div class="widget-body fs14">';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function layoutDiv() {
|
|
3
3
|
var el = '<div class="widget-wrap" id="recent">';
|
|
4
4
|
// header
|
|
5
|
-
el += '<div class="widget-header cap dis-select">';
|
|
5
|
+
el += '<div class="widget-header cap theme dis-select">';
|
|
6
6
|
el += '<span class="name">' + __("meta.recent_update") + '</span>';
|
|
7
7
|
if (item.rss) {
|
|
8
8
|
el += '<a class="cap-action" id="rss" title="Subscribe" href="' + item.rss + '">';
|
|
@@ -25,23 +25,20 @@ function layoutDiv() {
|
|
|
25
25
|
return p.title && p.title.length > 0;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
el += '<div class="widget-body fs14">';
|
|
28
|
+
el += '<div class="widget-body related-posts fs14">';
|
|
29
29
|
arr.sort("updated", -1).limit(item.limit).each(function(post) {
|
|
30
|
-
el += '<
|
|
31
|
-
el += '<
|
|
30
|
+
el += '<a class="item title" href="' + url_for(post.link || post.path) + '">';
|
|
31
|
+
el += '<span class="title">'
|
|
32
32
|
if (post.layout == 'wiki') {
|
|
33
|
-
el += '<span>';
|
|
34
33
|
let proj = theme.wiki.projects[post.wiki];
|
|
35
|
-
if (proj && proj.
|
|
36
|
-
el += proj.
|
|
34
|
+
if (proj && proj.name) {
|
|
35
|
+
el += proj.name + ' / ';
|
|
37
36
|
} else if (post.wiki) {
|
|
38
|
-
el += post.wiki +
|
|
37
|
+
el += post.wiki + ' / ';
|
|
39
38
|
}
|
|
40
|
-
el += '</span>';
|
|
41
39
|
}
|
|
42
|
-
el += post.title || post.seo_title || post.wiki;
|
|
40
|
+
el += (post.title || post.seo_title || post.wiki) + '</span>';
|
|
43
41
|
el += '</a>';
|
|
44
|
-
el += '</div>';
|
|
45
42
|
el += '';
|
|
46
43
|
});
|
|
47
44
|
el += '</div>';
|
|
@@ -16,21 +16,21 @@ function layoutDiv() {
|
|
|
16
16
|
var el = '';
|
|
17
17
|
if (related.length > 0) {
|
|
18
18
|
el += '<div class="widget-wrap" id="related">';
|
|
19
|
-
el += '<div class="widget-header cap dis-select">';
|
|
19
|
+
el += '<div class="widget-header cap theme dis-select">';
|
|
20
20
|
var title = __('btn.wiki');
|
|
21
21
|
if (proj.tags && proj.tags[0]) {
|
|
22
22
|
title = proj.tags[0];
|
|
23
23
|
}
|
|
24
24
|
el += '<span class="name">' + __('meta.more', title) + '</span>';
|
|
25
25
|
el += '</div>';
|
|
26
|
-
el += '<div class="widget-body
|
|
26
|
+
el += '<div class="widget-body related-posts">';
|
|
27
27
|
related.forEach((p, i) => {
|
|
28
28
|
// 同一个分组中的其它项目
|
|
29
|
-
el += '<a class="
|
|
30
|
-
el += p.title;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
el += '<a class="item wiki" href="' + url_for(p.homepage.path) + '">';
|
|
30
|
+
el += '<span class="title">' + p.title + '</span>';
|
|
31
|
+
if (p.description && p.description.length > 0) {
|
|
32
|
+
el += '<span class="excerpt">' + p.description + '</span>';
|
|
33
|
+
}
|
|
34
34
|
el += '</a>';
|
|
35
35
|
});
|
|
36
36
|
el += '</div>';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
var el = '';
|
|
4
|
+
if (site.tags == undefined || site.tags.length == 0) {
|
|
5
|
+
return el;
|
|
6
|
+
}
|
|
7
|
+
var opts = Object.assign({}, item);
|
|
8
|
+
delete opts['title'];
|
|
9
|
+
delete opts['layout'];
|
|
10
|
+
opts.class = 'tag ';
|
|
11
|
+
el += '<div class="widget-wrap" id="tagcloud">';
|
|
12
|
+
if (item.title) {
|
|
13
|
+
el += '<div class="widget-header cap theme dis-select">';
|
|
14
|
+
el += '<span class="name">' + item.title + '</span>';
|
|
15
|
+
el += '</div>';
|
|
16
|
+
}
|
|
17
|
+
el += '<div class="widget-body fs14">';
|
|
18
|
+
el += tagcloud(site.tags, opts);
|
|
19
|
+
el += '</div>';
|
|
20
|
+
el += '</div>';
|
|
21
|
+
return el;
|
|
22
|
+
}
|
|
23
|
+
%>
|
|
24
|
+
<%- layoutDiv() %>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
var el = '';
|
|
4
|
+
if (item.api == undefined) {
|
|
5
|
+
return el;
|
|
6
|
+
}
|
|
7
|
+
el += '<div class="widget-wrap" id="timeline">';
|
|
8
|
+
if (item.title) {
|
|
9
|
+
el += '<div class="widget-header cap theme dis-select">';
|
|
10
|
+
el += '<span class="name">' + item.title + '</span>';
|
|
11
|
+
el += '</div>';
|
|
12
|
+
}
|
|
13
|
+
el += '<div class="widget-body fs14">';
|
|
14
|
+
el += '<div class="tag-plugin timeline stellar-timeline-api"';
|
|
15
|
+
['api', 'user', 'hide'].forEach(key => {
|
|
16
|
+
if (item[key]) {
|
|
17
|
+
el += ' ' + key + '="' + item[key] + '"';
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
el += '>';
|
|
21
|
+
el += '</div>';
|
|
22
|
+
el += '</div>';
|
|
23
|
+
el += '</div>';
|
|
24
|
+
return el;
|
|
25
|
+
}
|
|
26
|
+
%>
|
|
27
|
+
<%- layoutDiv() %>
|
|
@@ -15,11 +15,7 @@ function layoutToc() {
|
|
|
15
15
|
function layoutTocHeader(title) {
|
|
16
16
|
var el = '';
|
|
17
17
|
el += '<div class="widget-header cap dis-select">';
|
|
18
|
-
|
|
19
|
-
el += '<span class="name">' + title + '</span>';
|
|
20
|
-
} else {
|
|
21
|
-
el += '<span class="name">' + __("meta.toc") + '</span>';
|
|
22
|
-
}
|
|
18
|
+
el += '<span class="name">' + (title || page.title || __("meta.toc")) + '</span>';
|
|
23
19
|
el += '</div>';
|
|
24
20
|
return el;
|
|
25
21
|
}
|
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['cover-title'] != undefined) {
|
|
17
17
|
layout += ' photo';
|
|
18
18
|
}
|
|
19
19
|
el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
|
package/layout/page.ejs
CHANGED
|
@@ -7,14 +7,23 @@ function layoutTitle() {
|
|
|
7
7
|
return '';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
function layoutDiv() {
|
|
11
|
+
var el = '';
|
|
12
|
+
if (page.post_list) {
|
|
13
|
+
el += partial('_partial/main/navbar/list_post');
|
|
14
|
+
}
|
|
15
|
+
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
|
16
|
+
el += partial('_partial/main/navbar/breadcrumb');
|
|
17
|
+
}
|
|
18
|
+
el += '<article class="content md ' + page.layout + (page.indent ? ' indent' : '') + scrollreveal() + '">';
|
|
19
|
+
el += layoutTitle();
|
|
20
|
+
if (page.content && page.content.length > 0) {
|
|
21
|
+
el += page.content;
|
|
22
|
+
}
|
|
23
|
+
el += '</article>';
|
|
24
|
+
el += partial('_partial/plugins/comments/layout');
|
|
25
|
+
return el;
|
|
26
|
+
}
|
|
10
27
|
%>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<article class='content md <%- page.layout %><%- page.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
|
14
|
-
<%- layoutTitle() %>
|
|
15
|
-
<% if (page.content && page.content.length > 0) { %>
|
|
16
|
-
<%- page.content %>
|
|
17
|
-
<% } %>
|
|
18
|
-
</article>
|
|
19
|
-
<% } %>
|
|
20
|
-
<%- partial('_partial/plugins/comments/layout') %>
|
|
28
|
+
|
|
29
|
+
<%- layoutDiv() %>
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = hexo => {
|
|
|
25
25
|
warning('caching', '`relative_link` option in Hexo `_config.yml`');
|
|
26
26
|
hexo.config.relative_link = false;
|
|
27
27
|
}
|
|
28
|
-
hexo.config.meta_generator = false;
|
|
28
|
+
// hexo.config.meta_generator = false;
|
|
29
29
|
|
|
30
30
|
// merge data
|
|
31
31
|
const data = hexo.locals.get('data');
|
|
@@ -25,58 +25,30 @@ hexo.extend.helper.register('popular_posts_wrapper', function(args){
|
|
|
25
25
|
|
|
26
26
|
const posts = this.site.posts;
|
|
27
27
|
const root = this.config.root;
|
|
28
|
-
function generateHTML(list){
|
|
29
28
|
|
|
29
|
+
function listItem(obj){
|
|
30
30
|
var el = '';
|
|
31
|
-
el += '<a class="item" href="' +
|
|
31
|
+
el += '<a class="item" href="' + obj.path + '" title="' + obj.title + '">';
|
|
32
32
|
var p = posts.filter(function(p) {
|
|
33
|
-
return root + p.path ==
|
|
33
|
+
return root + p.path == obj.path;
|
|
34
34
|
});
|
|
35
35
|
if (p && p.length > 0) {
|
|
36
36
|
p = p.data[0];
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
list.img = p.cover;
|
|
42
|
-
} else {
|
|
43
|
-
list.img = 'https://source.unsplash.com/1280x640/?' + p.cover;
|
|
44
|
-
}
|
|
45
|
-
} else if (cfg.auto_cover && p.tags && p.tags.length > 0) {
|
|
46
|
-
var params = '';
|
|
47
|
-
p.tags.reverse().forEach((tag, i) => {
|
|
48
|
-
if (i > 0) {
|
|
49
|
-
params += ',';
|
|
50
|
-
}
|
|
51
|
-
params += tag.name;
|
|
52
|
-
});
|
|
53
|
-
list.img = 'https://source.unsplash.com/1280x640/?' + params;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (hexo.theme.config.default.cover) {
|
|
57
|
-
el += '<div class="img">'
|
|
58
|
-
if (list.img && list.img != "") {
|
|
59
|
-
el += '<img src="' + list.img + '" />';
|
|
60
|
-
} else {
|
|
61
|
-
el += '<img src="' + hexo.theme.config.default.cover + '" />';
|
|
62
|
-
}
|
|
63
|
-
el += '</div>';
|
|
38
|
+
el += '<span class="title">' + obj.title + '</span>';
|
|
39
|
+
if (obj.excerpt && obj.excerpt.length > 0) {
|
|
40
|
+
el += '<span class="excerpt">' + util.truncate(util.stripHTML(obj.excerpt), {length: 120}) + '</span>';
|
|
64
41
|
}
|
|
65
|
-
|
|
66
|
-
el += '<span class="title">' + list.title + '</span>';
|
|
67
|
-
|
|
68
|
-
if (list.excerpt && list.excerpt.length > 0) {
|
|
69
|
-
el += '<span class="excerpt">' + util.truncate(util.stripHTML(list.excerpt), {length: 120}) + '</span>';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
42
|
el += '</a>';
|
|
73
43
|
return el;
|
|
74
44
|
}
|
|
75
45
|
|
|
76
|
-
|
|
77
|
-
|
|
46
|
+
if (json.length > 0) {
|
|
47
|
+
for(var i = 0; i < json.length; i++) {
|
|
48
|
+
returnHTML += listItem(json[i]);
|
|
49
|
+
}
|
|
78
50
|
}
|
|
79
|
-
|
|
51
|
+
|
|
80
52
|
if (returnHTML != "") returnHTML = "<div class=\"" + cls + "\">" + returnHTML + "</div>";
|
|
81
53
|
div += returnHTML;
|
|
82
54
|
div += '</section>';
|
package/scripts/tags/about.js
CHANGED
|
@@ -8,21 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
11
|
+
const url_for = require('hexo-util').url_for.bind(hexo);
|
|
11
12
|
|
|
12
13
|
hexo.extend.tag.register('about', function(args, content) {
|
|
13
|
-
args = hexo.args.map(args, ['avatar', 'height', 'border']);
|
|
14
|
+
args = hexo.args.map(args, ['avatar', 'height', 'border', 'back']);
|
|
14
15
|
var rows = hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n');
|
|
15
16
|
var el = '';
|
|
16
17
|
// wrapper
|
|
17
18
|
el += '<div class="tag-plugin about">';
|
|
18
|
-
|
|
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
|
+
}
|
|
19
24
|
// avatar
|
|
20
25
|
var avatar_url = args.avatar;
|
|
21
|
-
if (args.avatar === undefined) {
|
|
22
|
-
avatar_url = hexo.config.avatar;
|
|
23
|
-
}
|
|
24
26
|
if (avatar_url) {
|
|
25
|
-
el += '<div class="
|
|
27
|
+
el += '<div class="about-header">';
|
|
28
|
+
el += '<div class="avatar">';
|
|
26
29
|
el += '<img src="' + avatar_url + '"';
|
|
27
30
|
if (args.border && args.border.length > 0) {
|
|
28
31
|
el += ' style="border-radius:' + args.border + '"';
|
|
@@ -32,8 +35,8 @@ hexo.extend.tag.register('about', function(args, content) {
|
|
|
32
35
|
}
|
|
33
36
|
el += '/>';
|
|
34
37
|
el += '</div>';
|
|
38
|
+
el += '</div>';
|
|
35
39
|
}
|
|
36
|
-
el += '</div>';
|
|
37
40
|
|
|
38
41
|
// content
|
|
39
42
|
el += '<div class="about-body fs14">';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* border.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
3
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
4
|
*
|
|
5
|
-
* {%
|
|
5
|
+
* {% border [color:color] [child:codeblock/tabs] title %}
|
|
6
6
|
* body
|
|
7
|
-
* {%
|
|
7
|
+
* {% endborder %}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
hexo.extend.tag.register('
|
|
12
|
+
hexo.extend.tag.register('border', function(args, content) {
|
|
13
13
|
args = hexo.args.map(args, ['color', 'child'], ['title']);
|
|
14
14
|
const color = args.color;
|
|
15
15
|
const title = args.title;
|
package/scripts/tags/friends.js
CHANGED
|
@@ -1,92 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* friends.js
|
|
2
|
+
* friends.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
3
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
4
|
*
|
|
5
|
-
* {% friends [
|
|
5
|
+
* {% friends [group] [repo:owner/repo] [api:http] %}
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
hexo.extend.tag.register('friends', function(args) {
|
|
11
|
-
args = hexo.args.map(args, ['
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
args = hexo.args.map(args, ['repo', 'api'], ['group']);
|
|
12
|
+
var links = hexo.locals.get('data').links;
|
|
13
|
+
if (links == undefined) {
|
|
14
|
+
links = {};
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
friends = {};
|
|
21
|
-
}
|
|
22
|
-
if (args.repo) {
|
|
23
|
-
friends = {
|
|
24
|
-
group: {
|
|
25
|
-
api: args.api,
|
|
26
|
-
repo: args.repo
|
|
27
|
-
}
|
|
28
|
-
}
|
|
16
|
+
var api;
|
|
17
|
+
if (args.api) {
|
|
18
|
+
api = args.api;
|
|
19
|
+
} else if (args.repo) {
|
|
20
|
+
api = 'https://raw.github.xaoxuu.com/' + args.repo + '/output/v2/data.json';
|
|
29
21
|
}
|
|
22
|
+
|
|
30
23
|
var el = '<div class="tag-plugin users-wrap">';
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
cell += '</a></div>'
|
|
49
|
-
return cell;
|
|
50
|
-
} else {
|
|
51
|
-
return '';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (let groupId of Object.keys(friends)) {
|
|
55
|
-
function f() {
|
|
56
|
-
if (args.not && args.not.includes(groupId)) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (groupId in friends) {
|
|
60
|
-
let group = friends[groupId];
|
|
61
|
-
if ((typeof group == 'object') && group.constructor == Array) {
|
|
62
|
-
group = {items: group};
|
|
63
|
-
}
|
|
64
|
-
if (group.title || group.description) {
|
|
65
|
-
el += groupHeader(group);
|
|
66
|
-
}
|
|
67
|
-
if (group.repo) {
|
|
68
|
-
el += '<div class="stellar-friends-api"';
|
|
69
|
-
el += ' api="' + (group.api || 'https://issues-api.xaoxuu.com') + '/v1/' + group.repo + '"';
|
|
70
|
-
el += '>';
|
|
71
|
-
el += '<div class="group-body"></div>';
|
|
72
|
-
el += '</div>';
|
|
73
|
-
} else if (group.items) {
|
|
74
|
-
el += '<div class="group-body">';
|
|
75
|
-
group.items.forEach((friend, i) => {
|
|
76
|
-
el += cell(friend);
|
|
77
|
-
});
|
|
78
|
-
el += '</div>';
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (args.only) {
|
|
83
|
-
if (args.only.includes(groupId)) {
|
|
84
|
-
f();
|
|
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 '';
|
|
85
41
|
}
|
|
86
|
-
} else {
|
|
87
|
-
f();
|
|
88
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>';
|
|
89
49
|
}
|
|
50
|
+
|
|
90
51
|
el += '</div>';
|
|
91
52
|
return el;
|
|
92
53
|
});
|
package/scripts/tags/link.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* link.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
3
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
|
4
4
|
*
|
|
5
|
-
* {% link url title [
|
|
5
|
+
* {% link url [title] [desc:true/false] [icon:src] %}
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
@@ -11,11 +11,11 @@ var util = require('hexo-util');
|
|
|
11
11
|
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
|
|
12
12
|
|
|
13
13
|
hexo.extend.tag.register('link', function(args) {
|
|
14
|
-
args = hexo.args.map(args, ['icon'], ['url', 'title'
|
|
14
|
+
args = hexo.args.map(args, ['icon', 'desc'], ['url', 'title']);
|
|
15
15
|
|
|
16
16
|
var el = '';
|
|
17
17
|
el += '<div class="tag-plugin link dis-select">';
|
|
18
|
-
el += '<a class="link-card' + (args.
|
|
18
|
+
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + args.title + '" href="' + args.url + '"';
|
|
19
19
|
if (args.url.includes('://')) {
|
|
20
20
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
21
21
|
}
|
|
@@ -31,17 +31,19 @@ hexo.extend.tag.register('link', function(args) {
|
|
|
31
31
|
return el;
|
|
32
32
|
}
|
|
33
33
|
function loadTitle() {
|
|
34
|
-
return '<span class="title">' + args.title + '</span>';
|
|
34
|
+
return '<span class="title">' + (args.title || args.url) + '</span>';
|
|
35
35
|
}
|
|
36
36
|
function loadDesc() {
|
|
37
|
-
return '<span class="desc fs12"
|
|
37
|
+
return '<span class="cap desc fs12"></span>';
|
|
38
|
+
}
|
|
39
|
+
function loadLink() {
|
|
40
|
+
return '<span class="cap link fs12">' + full_url_for(args.url) + '</span>';
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
if (args.
|
|
43
|
+
if (args.desc) {
|
|
41
44
|
// top
|
|
42
45
|
el += '<div class="top">';
|
|
43
|
-
el += loadIcon();
|
|
44
|
-
el += '<span class="desc fs12">' + full_url_for(args.url) + '</span>';
|
|
46
|
+
el += loadIcon() + loadLink();
|
|
45
47
|
el += '</div>';
|
|
46
48
|
// bottom
|
|
47
49
|
el += '<div class="bottom">';
|
|
@@ -50,7 +52,7 @@ hexo.extend.tag.register('link', function(args) {
|
|
|
50
52
|
} else {
|
|
51
53
|
// left
|
|
52
54
|
el += '<div class="left">';
|
|
53
|
-
el += loadTitle() +
|
|
55
|
+
el += loadTitle() + loadLink();
|
|
54
56
|
el += '</div>';
|
|
55
57
|
// right
|
|
56
58
|
el += '<div class="right">';
|
package/scripts/tags/navbar.js
CHANGED