hexo-theme-stellar 1.12.0 → 1.14.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.
Files changed (47) hide show
  1. package/README.md +7 -7
  2. package/_config.yml +10 -27
  3. package/_data/links.yml +7 -0
  4. package/_data/widgets.yml +5 -3
  5. package/layout/_partial/head.ejs +2 -0
  6. package/layout/_partial/main/navbar/list_post.ejs +57 -34
  7. package/layout/_partial/main/post_list/post_card.ejs +21 -14
  8. package/layout/_partial/scripts/index.ejs +1 -0
  9. package/layout/_partial/sidebar/widgets/ghissues.ejs +0 -1
  10. package/layout/_partial/sidebar/widgets/timeline.ejs +2 -2
  11. package/layout/index.ejs +1 -1
  12. package/layout/page.ejs +19 -10
  13. package/package.json +1 -1
  14. package/scripts/events/lib/config.js +1 -1
  15. package/scripts/tags/friends.js +36 -75
  16. package/scripts/tags/link.js +15 -3
  17. package/scripts/tags/sites.js +40 -79
  18. package/scripts/tags/timeline.js +6 -4
  19. package/source/css/_common/base.styl +1 -1
  20. package/source/css/_common/highlight.styl +1 -1
  21. package/source/css/_common/pre.styl +1 -1
  22. package/source/css/_custom.styl +1 -1
  23. package/source/css/_defines/theme.styl +18 -13
  24. package/source/css/_layout/list.styl +12 -12
  25. package/source/css/_layout/main.styl +1 -1
  26. package/source/css/_layout/md.styl +10 -16
  27. package/source/css/_layout/partial/bread-nav.styl +1 -1
  28. package/source/css/_layout/partial/navbar.styl +1 -1
  29. package/source/css/_layout/sidebar/sidebar.styl +10 -9
  30. package/source/css/_layout/sidebar/widgets.styl +1 -2
  31. package/source/css/_layout/tag-plugins/common.styl +70 -36
  32. package/source/css/_layout/tag-plugins/folding.styl +2 -2
  33. package/source/css/_layout/tag-plugins/link.styl +3 -3
  34. package/source/css/_layout/tag-plugins/quot.styl +1 -0
  35. package/source/css/_layout/tag-plugins/split.styl +10 -6
  36. package/source/css/_layout/tag-plugins/timeline.styl +41 -10
  37. package/source/css/_plugins/comments/waline.styl +4 -0
  38. package/source/css/_plugins/index.styl +0 -2
  39. package/source/css/_plugins/lazyload.styl +1 -1
  40. package/source/js/main.js +2 -2
  41. package/source/js/plugins/fcircle.js +92 -0
  42. package/source/js/plugins/linkcard.js +23 -99
  43. package/source/js/plugins/timeline.js +48 -35
  44. package/layout/_partial/plugins/comments/valine/layout.ejs +0 -19
  45. package/layout/_partial/plugins/comments/valine/script.ejs +0 -48
  46. package/scripts/tags/issues.js +0 -30
  47. package/source/css/_plugins/comments/valine.styl +0 -222
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # hexo-theme-stellar
1
+ # Stellar - 每个人的独立博客
2
2
 
3
- Elegant and powerful theme for Hexo.
3
+ Stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富的标签和动态数据组件,请配合 [文档](https://xaoxuu.com/wiki/stellar/) 使用。
4
4
 
5
5
  ## Getting Started
6
6
 
7
7
  Check your environment:
8
8
 
9
9
  ```yaml
10
- Hexo: 5.4.0
11
- hexo-cli: 4.3.0
12
- node.js: 14.17.3 LTS
13
- npm: 6.14.13 LTS
10
+ Hexo: 5.4.0 ~ 6.3.0
11
+ hexo-cli: 4.3.0 ~ latest
12
+ node.js: 14.17.3 ~ 18.12.0
13
+ npm: 6.14.13 ~ 8.19.2
14
14
  ```
15
15
 
16
16
  Edit your `_config.yml`:
@@ -31,7 +31,7 @@ See docs: https://xaoxuu.com/wiki/stellar/
31
31
 
32
32
  ## Examples
33
33
 
34
- https://xaoxuu.com
34
+ https://xaoxuu.com/wiki/stellar/examples/
35
35
 
36
36
  ## Feedback
37
37
 
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.12.0'
3
+ version: '1.14.0'
4
4
  homepage: 'https://xaoxuu.com/wiki/stellar/'
5
5
  repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
6
6
  cdn_css: # Use cdn links instead of /css/main.css
@@ -30,6 +30,10 @@ sidebar:
30
30
  post: [toc, ghrepo, ghissues] # for pages using 'layout:post'
31
31
  wiki: [toc, ghrepo, ghissues, related] # for pages using 'layout:wiki'
32
32
 
33
+ ######## Index ########
34
+ post-index: # 近期发布 分类 标签 归档 and ...
35
+ # '朋友文章': /friends/rss/
36
+
33
37
 
34
38
  ######## Main ########
35
39
  breadcrumb:
@@ -59,7 +63,7 @@ article:
59
63
 
60
64
  ######## Comments ########
61
65
  comments:
62
- service: # beaudar, utterances, valine, twikoo, waline
66
+ service: # beaudar, utterances, twikoo, waline
63
67
  # beaudar
64
68
  # https://beaudar.lipk.org/
65
69
  beaudar:
@@ -98,28 +102,6 @@ comments:
98
102
  data-loading: lazy
99
103
  crossorigin: anonymous
100
104
 
101
- valine:
102
- js: https://fastly.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
103
- appId: # your appId
104
- appKey: # your appKey
105
- placeholder:
106
- requiredFields: [nick, mail]
107
- enableQQ: true # Unstable avatar link
108
- recordIP: false # Record commenter IP
109
- avatar: robohash # gravatar style https://valine.js.org/avatar
110
- pageSize: 10 # comment list page size
111
- lang: zh-cn
112
- highlight: true
113
- mathJax: false
114
- tagMeta: [博主, 小伙伴, 访客] # 标签要显示的文字,默认'博主,小伙伴,访客'
115
- metaPlaceholder:
116
- nick: "昵称/QQ号(必填)"
117
- mail: "邮箱(必填,完全保密)"
118
- link: "网址(https://)"
119
- master: #md5加密后的博主邮箱
120
- - 6783037F2DF30EAB99F9FC256157D875
121
- friends: #md5加密后的小伙伴邮箱
122
- - 6783037F2DF30EAB99F9FC256157D875
123
105
  # Twikoo
124
106
  # https://twikoo.js.org/
125
107
  twikoo:
@@ -230,6 +212,7 @@ tag_plugins:
230
212
  qq: https://fastly.jsdelivr.net/gh/cdn-x/emoji/qq/%s.gif
231
213
  aru: https://fastly.jsdelivr.net/gh/cdn-x/emoji/aru-l/%s.gif
232
214
  tieba: https://fastly.jsdelivr.net/gh/cdn-x/emoji/tieba/%s.png
215
+ blobcat: https://gcore.jsdelivr.net/gh/norevi/waline-blobcatemojis@1.0/blobs/%s.png
233
216
  # {% image %}
234
217
  image:
235
218
  fancybox: # true, false
@@ -251,9 +234,10 @@ plugins:
251
234
  ghinfo: /js/plugins/ghinfo.js
252
235
  timeline: /js/plugins/timeline.js
253
236
  linkcard: /js/plugins/linkcard.js
237
+ fcircle: /js/plugins/fcircle.js
254
238
 
255
239
  marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js
256
-
240
+
257
241
  ## optional plugins ##
258
242
  # preload
259
243
  preload:
@@ -285,7 +269,6 @@ plugins:
285
269
  js: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js
286
270
  css: https://fastly.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css
287
271
  # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
288
- # 使用valine评论可以写: .vcontent img:not(.vemoji)
289
272
  # 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
290
273
  # 使用waline评论可以写: #waline_container .vcontent img
291
274
  selector: .swiper-slide img # 多个选择器用英文逗号隔开
@@ -343,7 +326,7 @@ style:
343
326
  card: white # 卡片背景颜色
344
327
  title: '#000' # 标题文本颜色
345
328
  text: '#333' # 正文文本颜色
346
- code: '#111' # 行内代码颜色
329
+ code: '#f33a00' # 行内代码颜色
347
330
  dark:
348
331
  background: '#313438' # 深色背景颜色
349
332
  background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
@@ -0,0 +1,7 @@
1
+ # 不要直接在这里写,要复制到 blog/source/_data/links.yml 位置
2
+ '示例':
3
+ - title: XAOXUU
4
+ avatar: https://bu.dusays.com/2021/09/24/2f74810ceb3d3.png
5
+ url: https://xaoxuu.com
6
+ screenshot: https://bu.dusays.com/2022/10/23/63542895cfd29.png
7
+ description:
package/_data/widgets.yml CHANGED
@@ -61,10 +61,12 @@ welcome:
61
61
  **第二步**
62
62
  创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
63
63
  <br>
64
- 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
64
+ 如果有任何疑问,请先查阅 [文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
65
65
 
66
66
  timeline:
67
67
  layout: timeline
68
68
  title: 近期动态
69
- api: https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues
70
- user:
69
+ api: # https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues
70
+ user: # 默认显示所有人的数据,设置名称可过滤为仅显示某人的数据,多个名称用英文逗号隔开,不要加空格
71
+ type: # 默认不用写,如果是友链朋友圈数据请写 fcircle
72
+ limit: # 默认通过 api 上增加 per_page 来设置,如果是友链朋友圈,可通过这个设置数量
@@ -45,6 +45,7 @@ function og_args() {
45
45
  %>
46
46
  <head>
47
47
  <%- meta_generator() %>
48
+ <meta name="hexo-theme" content="<%- stellar_info('tree') %>">
48
49
  <meta charset="utf-8">
49
50
  <%- generate_robots() %>
50
51
 
@@ -60,6 +61,7 @@ function og_args() {
60
61
  <meta name="apple-mobile-web-app-capable" content="yes">
61
62
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
62
63
  <meta name="theme-color" content="#f8f8f8">
64
+
63
65
  <title><%- generate_title() %></title>
64
66
 
65
67
  <% if (theme.open_graph && theme.open_graph.enable) { %>
@@ -1,34 +1,57 @@
1
- <div class='nav-wrap'>
2
- <nav class='sub post cap'>
3
- <% if (is_home()) { %>
4
- <a class='active' href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
5
- <% } else { %>
6
- <a href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
7
- <% } %>
8
- <% if (site.categories && site.categories.length > 0) { %>
9
- <% if (page.category) { %>
10
- <a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.category') + __('symbol.colon') + page.category %></a>
11
- <% } else if (page.layout == 'categories') { %>
12
- <a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
13
- <% } else { %>
14
- <a href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
15
- <% } %>
16
- <% } %>
17
- <% if (site.tags && site.tags.length > 0) { %>
18
- <% if (page.tag) { %>
19
- <a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tag') + __('symbol.colon') + page.tag %></a>
20
- <% } else if (page.layout == 'tags') { %>
21
- <a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
22
- <% } else { %>
23
- <a href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
24
- <% } %>
25
- <% } %>
26
- <% if (site.posts && site.posts.length > 0) { %>
27
- <% if (is_archive()) { %>
28
- <a class='active' href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
29
- <% } else { %>
30
- <a href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
31
- <% } %>
32
- <% } %>
33
- </nav>
34
- </div>
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ el += '<div class="nav-wrap">';
5
+ el += '<nav class="sub post cap">';
6
+ if (is_home()) {
7
+ el += '<a class="active" href="' + url_for("/") + '">' + __("btn.recent_publish") + '</a>';
8
+ } else {
9
+ el += '<a href="' + url_for("/") + '">' + __("btn.recent_publish") + '</a>';
10
+ }
11
+
12
+ if (site.categories && site.categories.length > 0) {
13
+ if (page.category) {
14
+ el += '<a class="active" href="' + url_for(config.category_dir) + '">' + __("btn.category") + __("symbol.colon") + page.category + '</a>';
15
+ } else if (page.layout == "categories") {
16
+ el += '<a class="active" href="' + url_for(config.category_dir) + '">' + __("btn.categories") + '</a>';
17
+ } else {
18
+ el += '<a href="' + url_for(config.category_dir) + '">' + __("btn.categories") + '</a>';
19
+ }
20
+ }
21
+
22
+ if (site.tags && site.tags.length > 0) {
23
+ if (page.tag) {
24
+ el += '<a class="active" href="' + url_for(config.tag_dir) + '">' + __("btn.tag") + __("symbol.colon") + page.tag + '</a>';
25
+ } else if (page.layout == "tags") {
26
+ el += '<a class="active" href="' + url_for(config.tag_dir) + '">' + __("btn.tags") + '</a>';
27
+ } else {
28
+ el += '<a href="' + url_for(config.tag_dir) + '">' + __("btn.tags") + '</a>';
29
+ }
30
+ }
31
+
32
+ if (site.posts && site.posts.length > 0) {
33
+ if (is_archive()) {
34
+ el += '<a class="active" href="' + url_for(config.archive_dir) + '">' + __("btn.archives") + '</a>';
35
+ } else {
36
+ el += '<a href="' + url_for(config.archive_dir) + '">' + __("btn.archives") + '</a>';
37
+ }
38
+ }
39
+
40
+ if (theme['post-index']) {
41
+ const obj = theme['post-index'];
42
+ for (let key of Object.keys(obj)) {
43
+ if (full_url_for(page.path) == full_url_for(obj[key])) {
44
+ el += '<a class="active" href="' + url_for(obj[key]) + '">' + key + '</a>';
45
+ } else {
46
+ el += '<a href="' + url_for(obj[key]) + '">' + key + '</a>';
47
+ }
48
+ }
49
+ }
50
+
51
+ el += '</nav>';
52
+ el += '</div>';
53
+ return el;
54
+ }
55
+ %>
56
+
57
+ <%- layoutDiv() %>
@@ -1,10 +1,14 @@
1
1
  <%
2
- const obj = {
3
- image: post['cover'],
4
- title: post['cover-title'],
5
- cat: post['cover-cat'],
6
- subtitle: post['cover-subtitle']
2
+ const poster = post.poster;
3
+ var obj = {
4
+ image: post.cover
7
5
  };
6
+ if (poster) {
7
+ obj.headline = poster.headline;
8
+ obj.topic = poster.topic;
9
+ obj.caption = poster.caption;
10
+ obj.color = poster.color;
11
+ }
8
12
  function div_default() {
9
13
  var el = '';
10
14
  el += '<article class="md">';
@@ -96,21 +100,24 @@ function div_photo() {
96
100
  var el = '';
97
101
  el += '<div class="cover">';
98
102
  el += '<img src="' + obj.image + '"/>';
99
- if (obj.title || obj.cat || obj.subtitle) {
103
+ if (obj.headline || obj.topic || obj.caption) {
100
104
  el += '<div class="cover-info"';
101
- if (obj.cat) {
105
+ if (obj.color) {
106
+ el += 'style="color:' + obj.color + '"';
107
+ }
108
+ if (obj.topic) {
102
109
  el += 'position="top">';
103
110
  } else {
104
111
  el += 'position="bottom">';
105
112
  }
106
- if (obj.cat) {
107
- el += '<div class="cap">' + obj.cat + '</div>';
113
+ if (obj.topic) {
114
+ el += '<div class="cap">' + obj.topic + '</div>';
108
115
  }
109
- if (obj.title) {
110
- el += '<div class="title">' + obj.title + '</div>';
116
+ if (obj.headline) {
117
+ el += '<div class="title">' + obj.headline + '</div>';
111
118
  }
112
- if (obj.subtitle) {
113
- el += '<div class="cap">' + obj.subtitle + '</div>';
119
+ if (obj.caption) {
120
+ el += '<div class="cap">' + obj.caption + '</div>';
114
121
  }
115
122
  el += '</div>';
116
123
 
@@ -119,7 +126,7 @@ function div_photo() {
119
126
  return el;
120
127
  }
121
128
  function div() {
122
- if (obj.image && obj.image.length > 0 && obj.title != undefined) {
129
+ if (obj.image && obj.image.length > 0 && obj.headline != undefined) {
123
130
  return div_photo();
124
131
  }
125
132
  return div_default();
@@ -90,6 +90,7 @@
90
90
  }
91
91
  }
92
92
  };
93
+ stellar.version = '<%- theme.stellar.version %>';
93
94
  stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
94
95
  stellar.config = {
95
96
  date_suffix: {
@@ -22,7 +22,6 @@ function layoutDiv() {
22
22
  if (item.labels) {
23
23
  item.api += '&labels=' + item.labels;
24
24
  }
25
- console.log(item.api);
26
25
  el += '<div class="widget-wrap" id="timeline">';
27
26
  if (item.title) {
28
27
  el += '<div class="widget-header cap theme dis-select">';
@@ -11,8 +11,8 @@ function layoutDiv() {
11
11
  el += '</div>';
12
12
  }
13
13
  el += '<div class="widget-body fs14">';
14
- el += '<div class="tag-plugin timeline stellar-timeline-api"';
15
- ['api', 'user'].forEach(key => {
14
+ el += '<div class="tag-plugin timeline stellar-' + (item.type || "timeline") + '-api"';
15
+ ['api', 'user', 'hide', 'limit'].forEach(key => {
16
16
  if (item[key]) {
17
17
  el += ' ' + key + '="' + item[key] + '"';
18
18
  }
package/layout/index.ejs CHANGED
@@ -13,7 +13,7 @@ if (page.title && page.wiki) {
13
13
  function layout_post_card(layout, post, content) {
14
14
  var el = '';
15
15
  var layout = layout;
16
- if (layout == 'post' && post['cover'] != undefined && post['cover-title'] != undefined) {
16
+ if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
17
17
  layout += ' photo';
18
18
  }
19
19
  el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
package/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
- <% if (page.h1 || page.title || (page.content && page.content.length > 0)) { %>
12
- <%- partial('_partial/main/navbar/breadcrumb') %>
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -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');
@@ -1,92 +1,53 @@
1
1
  /**
2
- * friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
2
+ * friends.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
3
3
  * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
4
  *
5
- * {% friends [only:group1] [not:group2] %}
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, ['only', 'not', 'repo', 'api']);
12
- if (args.only) {
13
- args.only = args.only.split(',');
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
- if (args.not) {
16
- args.not = args.not.split(',');
17
- }
18
- var friends = hexo.locals.get('data').friends;
19
- if (friends == undefined) {
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://data.json.vlts.cc/v2/' + args.repo;
29
21
  }
22
+
30
23
  var el = '<div class="tag-plugin users-wrap">';
31
- function groupHeader(group) {
32
- var header = '<div class="group-header">';
33
- if (group.title) {
34
- header += hexo.render.renderSync({text: group.title, engine: 'markdown'}).split('\n').join('');
35
- }
36
- if (group.description) {
37
- header += hexo.render.renderSync({text: group.description, engine: 'markdown'}).split('\n').join('');
38
- }
39
- header += '</div>';
40
- return header;
41
- }
42
- function cell(friend) {
43
- if (friend.url && friend.title) {
44
- var cell = '<div class="user-card">';
45
- cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + friend.url + '">';
46
- cell += '<img src="' + (friend.avatar || hexo.theme.config.default.avatar) + '" onerror="javascript:this.removeAttribute(&quot;data-src&quot;);this.src=&quot;' + hexo.theme.config.default.avatar + '&quot;;"/>';
47
- cell += '<div class="name"><span>' + friend.title + '</span></div>';
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(&quot;data-src&quot;);this.src=&quot;' + hexo.theme.config.default.avatar + '&quot;;"/>';
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
  });
@@ -7,18 +7,30 @@
7
7
 
8
8
  'use strict';
9
9
 
10
- var util = require('hexo-util');
11
10
  const full_url_for = require('hexo-util').full_url_for.bind(hexo);
12
11
 
13
12
  hexo.extend.tag.register('link', function(args) {
14
13
  args = hexo.args.map(args, ['icon', 'desc'], ['url', 'title']);
15
-
14
+ var autofill = [];
15
+ if (!args.title) {
16
+ autofill.push('title');
17
+ }
18
+ if (!args.icon) {
19
+ autofill.push('icon');
20
+ }
21
+ if (args.desc) {
22
+ autofill.push('desc');
23
+ }
16
24
  var el = '';
17
25
  el += '<div class="tag-plugin link dis-select">';
18
- el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + args.title + '" href="' + args.url + '"';
26
+ el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + (args.title || '') + '" href="' + args.url + '"';
19
27
  if (args.url.includes('://')) {
20
28
  el += ' target="_blank" rel="external nofollow noopener noreferrer"';
21
29
  }
30
+ el += ' cardlink';
31
+ el += ' autofill="';
32
+ el += autofill.join(',');
33
+ el += '"';
22
34
  el += '>';
23
35
 
24
36
  function loadIcon() {