hexo-theme-stellar 1.10.0 → 1.11.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 (31) hide show
  1. package/_config.yml +28 -48
  2. package/_data/widgets.yml +46 -0
  3. package/languages/en.yml +0 -1
  4. package/languages/zh-CN.yml +0 -1
  5. package/languages/zh-TW.yml +0 -1
  6. package/layout/_partial/main/navbar/list_post.ejs +2 -2
  7. package/layout/_partial/sidebar/index.ejs +6 -6
  8. package/layout/_partial/sidebar/logo.ejs +1 -1
  9. package/layout/_partial/sidebar/widgets/ghrepo.ejs +53 -0
  10. package/layout/_partial/sidebar/widgets/ghuser.ejs +5 -11
  11. package/layout/_partial/sidebar/widgets/toc.ejs +1 -1
  12. package/package.json +1 -1
  13. package/scripts/events/lib/config.js +26 -10
  14. package/scripts/tags/folders.js +55 -0
  15. package/scripts/tags/timeline.js +4 -2
  16. package/source/css/_common/base.styl +3 -0
  17. package/source/css/_custom.styl +19 -22
  18. package/source/css/_defines/theme.styl +12 -12
  19. package/source/css/_layout/md.styl +1 -1
  20. package/source/css/_layout/sidebar/ghrepo.styl +30 -0
  21. package/source/css/_layout/sidebar/sidebar.styl +0 -1
  22. package/source/css/_layout/tag-plugins/about.styl +1 -0
  23. package/source/css/_layout/tag-plugins/folders.styl +62 -0
  24. package/source/css/_layout/tag-plugins/poetry.styl +1 -1
  25. package/source/css/_layout/tag-plugins/quot.styl +7 -6
  26. package/source/css/_layout/tag-plugins/timeline.styl +53 -34
  27. package/source/css/_plugins/comments/twikoo.styl +2 -2
  28. package/source/css/_plugins/comments/waline.styl +1 -1
  29. package/source/js/plugins/timeline.js +53 -31
  30. package/layout/_partial/sidebar/widgets/repo_info.ejs +0 -91
  31. package/source/css/_layout/sidebar/repo_info.styl +0 -31
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.10.0'
3
+ version: '1.11.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
@@ -24,51 +24,11 @@ sidebar:
24
24
  # friends: '[友链](/friends/)'
25
25
  # about: '[关于](/about/)'
26
26
  # Sidebar widgets
27
- widget_layout:
28
- index: [welcome, recent, ghuser_mini] # for home/wiki/categories/tags/archives/404 pages
29
- page: [welcome, toc] # for pages using 'layout:page'
30
- post: [toc, repo_info] # for pages using 'layout:post'
31
- wiki: [toc, repo_info, wiki_more] # for pages using 'layout:wiki'
32
27
  widgets:
33
- # Recent update
34
- recent:
35
- layout: recent
36
- rss: # /atom.xml # npm i hexo-generator-feed
37
- limit: 5 # Count of posts
38
- # TOC (valid only in layout:post/wiki)
39
- toc:
40
- layout: toc
41
- list_number: false
42
- min_depth: 2
43
- max_depth: 5
44
- fallback: recent # Use a backup widget when toc does not exist.
45
- # github user info
46
- ghuser:
47
- layout: ghuser
48
- api: https://api.github.com
49
- username: github # your github login username
50
- avatar: true
51
- ghuser_mini:
52
- layout: ghuser
53
- header: # GitHub Info
54
- api: https://api.github.com
55
- username: github # your github login username
56
- avatar: false
57
- # welcome
58
- welcome:
59
- layout: markdown
60
- title: Stellar 入门指南
61
- content: | # support markdown
62
- 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
63
- <br>
64
- **第一步**
65
- 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
66
- <br>
67
- **第二步**
68
- 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
69
- <br>
70
- 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
71
-
28
+ index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
29
+ page: [welcome, toc] # for pages using 'layout:page'
30
+ post: [toc, ghrepo] # for pages using 'layout:post'
31
+ wiki: [ghrepo, toc, wiki_more] # for pages using 'layout:wiki'
72
32
 
73
33
 
74
34
  ######## Main ########
@@ -365,13 +325,33 @@ plugins:
365
325
  style:
366
326
  darkmode: auto # auto / always / false
367
327
  smooth_scroll: true # true / false
328
+ font-size: 16px
368
329
  font-family:
369
330
  logo: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
370
331
  body: system-ui, "Microsoft Yahei", "Segoe UI", -apple-system, Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", sans-serif
371
332
  code: Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sans-serif
372
- theme:
373
- light: '#f8f8f8'
374
- dark: '#313438'
333
+ color:
334
+ common:
335
+ theme: '#1BCDFC' # 主题色
336
+ accent: '#ff5722' # 强调色
337
+ link: '#2196f3' # 超链接颜色
338
+ button: '#1BCDFC' # 按钮颜色
339
+ hover: '#ff5722' # 按钮高亮颜色
340
+ light:
341
+ background: '#f8f8f8' # 浅色背景颜色
342
+ block: '#f2f2f2' # 块背景颜色
343
+ card: white # 卡片背景颜色
344
+ title: '#000' # 标题文本颜色
345
+ text: '#333' # 正文文本颜色
346
+ code: '#111' # 行内代码颜色
347
+ dark:
348
+ background: '#313438' # 深色背景颜色
349
+ background-mobile: black # 移动端深色背景(OLED调成纯黑可以省电)
350
+ block: '#2B2F33' # 块背景颜色
351
+ card: '#464D57' # 卡片背景颜色
352
+ title: '#fff' # 标题文本颜色
353
+ text: '#eee' # 正文文本颜色
354
+ code: '#ff7043' # 行内代码颜色
375
355
  animated_avatar:
376
356
  animate: auto # auto, always
377
357
  background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp
@@ -0,0 +1,46 @@
1
+ # 您可以在这里创建属于自己的侧边栏组件库,在需要的位置放置自己的组件
2
+ # layout即组件布局,支持自定义的有:
3
+ # - markdown: 渲染 md 文本
4
+ #
5
+
6
+ # ---- 内置组件,暂时不支持覆盖 ----
7
+ ghrepo:
8
+ layout: ghrepo
9
+ wiki_more:
10
+ layout: wiki_more
11
+
12
+ # ---- 默认组件,可以覆盖自定义配置 ----
13
+ # 将其覆盖设置为空,可删除一个默认组件,例如 welcome:
14
+ # Recent update
15
+ recent:
16
+ layout: recent
17
+ rss: # /atom.xml # npm i hexo-generator-feed
18
+ limit: 5 # Count of posts
19
+ # TOC (valid only in layout:post/wiki)
20
+ toc:
21
+ layout: toc
22
+ list_number: false
23
+ min_depth: 2
24
+ max_depth: 5
25
+ fallback: recent # Use a backup widget when toc does not exist.
26
+ # github user info
27
+ ghuser:
28
+ layout: ghuser
29
+ api: https://api.github.com
30
+ username: github # your github login username
31
+ avatar: true # true / false
32
+
33
+
34
+ welcome:
35
+ layout: markdown
36
+ title: Stellar 入门指南
37
+ content: | # support markdown
38
+ 欢迎使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar/) 主题,下面是您的入门指南,祝您使用愉快!
39
+ <br>
40
+ **第一步**
41
+ 创建 `blog/_config.stellar.yml` 文件,在此文件中填写需要自定义的主题配置。
42
+ <br>
43
+ **第二步**
44
+ 创建 `blog/source/_data/widgets.yml` 文件,此文件中填写需要自定义的侧边栏组件,例如 `welcome` 组件。
45
+ <br>
46
+ 如果有任何疑问,请先查阅[文档](https://xaoxuu.com/wiki/stellar/),如果文档中没有提供,请提 [issue](https://github.com/xaoxuu/hexo-theme-stellar/issues/) 向开发中询问。
package/languages/en.yml CHANGED
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 'Updated on'
29
29
  license: License
30
30
  share: Share
31
- repo_info: Repo Info
32
31
  date_suffix:
33
32
  just: Just
34
33
  min: minutes ago
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 更新于
29
29
  license: 许可协议
30
30
  share: 分享文章
31
- repo_info: 项目仓库
32
31
  date_suffix:
33
32
  just: 刚刚
34
33
  min: 分钟前
@@ -28,7 +28,6 @@ meta:
28
28
  updated: 更新於
29
29
  license: 授權條款
30
30
  share: 分享文章
31
- repo_info: 專案儲存庫
32
31
  date_suffix:
33
32
  just: 剛剛
34
33
  min: 分鐘前
@@ -1,9 +1,9 @@
1
1
  <div class='nav-wrap'>
2
2
  <nav class='sub post cap'>
3
3
  <% if (is_home()) { %>
4
- <a class='active' href='/'><%- __('btn.recent_publish') %></a>
4
+ <a class='active' href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
5
5
  <% } else { %>
6
- <a href='/'><%- __('btn.recent_publish') %></a>
6
+ <a href='<%- url_for("/") %>'><%- __('btn.recent_publish') %></a>
7
7
  <% } %>
8
8
  <% if (site.categories && site.categories.length > 0) { %>
9
9
  <% if (page.category) { %>
@@ -2,18 +2,18 @@
2
2
  // 默认组件
3
3
  if (page.sidebar == undefined) {
4
4
  if (page.layout == 'post' && page.content) {
5
- page.sidebar = theme.sidebar.widget_layout.post;
5
+ page.sidebar = theme.sidebar.widgets.post;
6
6
  } else if (page.layout == 'wiki' && page.content && page.wiki) {
7
7
  let proj = theme.wiki.projects[page.wiki];
8
8
  if (proj.sidebar) {
9
9
  page.sidebar = proj.sidebar;
10
10
  } else {
11
- page.sidebar = theme.sidebar.widget_layout.wiki;
11
+ page.sidebar = theme.sidebar.widgets.wiki;
12
12
  }
13
13
  } else if (is_home() || ['categories', 'tags', 'archives', 'index', '404', undefined].includes(page.layout)) {
14
- page.sidebar = theme.sidebar.widget_layout.index;
14
+ page.sidebar = theme.sidebar.widgets.index;
15
15
  } else if (page.layout == 'page') {
16
- page.sidebar = theme.sidebar.widget_layout.page;
16
+ page.sidebar = theme.sidebar.widgets.page;
17
17
  } else {
18
18
  page.sidebar = [];
19
19
  }
@@ -23,8 +23,8 @@ function layoutWidgets() {
23
23
  el += '<div class="widgets">';
24
24
  if (page.sidebar) {
25
25
  page.sidebar.forEach((w, i) => {
26
- if (w in theme.sidebar.widgets) {
27
- let widget = theme.sidebar.widgets[w];
26
+ if (w in theme.data.widgets) {
27
+ let widget = theme.data.widgets[w];
28
28
  if (widget && widget.layout) {
29
29
  el += partial('widgets/' + widget.layout, {item: widget});
30
30
  }
@@ -6,7 +6,7 @@ if (page.layout === 'wiki' && page.wiki) {
6
6
  function layoutTitle(main, url, sub) {
7
7
  var el = '';
8
8
  el += '<a class="title" href="' + url_for(url || "/") + '">';
9
- el += '<div class="main">' + main + '</div>';
9
+ el += '<div class="main" ff="title">' + main + '</div>';
10
10
  if (sub) {
11
11
  let arr = sub.split('|');
12
12
  if (arr.length > 1) {
@@ -0,0 +1,53 @@
1
+ <%
2
+ function layoutDiv() {
3
+ var el = '';
4
+ var repo;
5
+ var branch = 'main';
6
+ if (page.layout === 'wiki' && page.wiki) {
7
+ let proj = theme.wiki.projects[page.wiki];
8
+ if (proj && proj.repo) {
9
+ repo = proj.repo;
10
+ if (proj.branch != undefined) {
11
+ branch = proj.branch;
12
+ }
13
+ }
14
+ } else {
15
+ // 其它的如果有设置 repo 也可以
16
+ repo = page.repo;
17
+ }
18
+ if (repo == undefined) {
19
+ return el;
20
+ }
21
+ // 布局
22
+ el += '<div class="widget-wrap" id="repo-info">';
23
+ // body
24
+ el += '<div class="widget-body">';
25
+ el += '<div class="items stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '">';
26
+ el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
27
+ el += '<div class="repo-name flex-row">';
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 += '<span>' + repo + '</span>';
30
+ el += '</div>';
31
+ el += '<div class="repo-desc"><span type="text" id="description">&nbsp;</span></div>';
32
+ el += '<div class="grid">';
33
+ el += '<div class="flex-row">';
34
+ 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="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>';
35
+ el += '<span type="text" id="stargazers_count"></span>';
36
+ el += '</div>';
37
+ el += '<div class="flex-row">';
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
+ el += '<span type="text" id="forks_count"></span>';
40
+ el += '</div>';
41
+ el += '<div class="flex-row stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '/releases/latest">';
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="tag_name"></span>';
44
+ el += '</div>';
45
+ el += '</div>';
46
+ el += '</a>';
47
+ el += '</div>';
48
+ el += '</div>';
49
+ el += '</div>';
50
+ return el;
51
+ }
52
+ %>
53
+ <%- layoutDiv() %>
@@ -3,17 +3,17 @@ var btns = [];
3
3
  btns.push({
4
4
  key: 'followers',
5
5
  desc: 'followers',
6
- href: '?tab=followers'
6
+ tab: 'followers'
7
7
  });
8
8
  btns.push({
9
9
  key: 'following',
10
10
  desc: 'following',
11
- href: '?tab=following'
11
+ tab: 'following'
12
12
  });
13
13
  btns.push({
14
14
  key: 'public_repos',
15
15
  desc: 'repos',
16
- href: '?tab=repositories'
16
+ tab: 'repositories'
17
17
  });
18
18
 
19
19
  function layoutDiv() {
@@ -23,24 +23,18 @@ function layoutDiv() {
23
23
  }
24
24
 
25
25
  el += '<div class="widget-wrap" id="github-user">';
26
- // header
27
- if (item.header && item.header.length > 0) {
28
- el += '<div class="widget-header cap dis-select">';
29
- el += '<span class="name">' + item.header + '</span>';
30
- el += '</div>';
31
- }
32
26
  // body
33
27
  el += '<div class="widget-body stellar-ghinfo-api" api="' + item.api + '/users/' + item.username + '">';
34
28
  if (item.avatar) {
35
29
  el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
36
30
  }
37
31
  // username
38
- el += '<p class="username" type="text" id="name" href="https://github.com/' + item.username + '">&nbsp;</p>';
32
+ el += '<p class="username" ff="title" type="text" id="name">&nbsp;</p>';
39
33
  el += '<p class="bio" type="text" id="bio">&nbsp;</p>';
40
34
 
41
35
  el += '<div class="buttons">';
42
36
  btns.forEach((btn, i) => {
43
- el += '<a class="btn" href="https://github.com/' + item.username + '' + btn.href + '">';
37
+ el += '<a class="btn" href="https://github.com/' + item.username + '?tab=' + btn.tab + '">';
44
38
  el += '<span class="title" type="text" id="' + btn.key + '">0</span>';
45
39
  el += '<span class="desc">' + btn.desc + '</span>';
46
40
  el += '</a>';
@@ -92,7 +92,7 @@ function layoutDiv(fallback) {
92
92
  }
93
93
  el += '</div>';
94
94
  } else if (item.fallback) {
95
- el += partial(item.fallback, {item: theme.sidebar.widgets[item.fallback]});
95
+ el += partial(item.fallback, {item: theme.data.widgets[item.fallback]});
96
96
  }
97
97
  return el;
98
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * 部分代码借鉴自 NexT:
3
3
  * https://github.com/next-theme/hexo-theme-next/blob/master/scripts/events/lib/config.js
4
+ * Volantis:
5
+ * https://github.com/volantis-x/hexo-theme-volantis/blob/master/scripts/events/lib/cdn.js
4
6
  */
5
7
 
6
8
  'use strict';
7
9
 
10
+ const path = require('path');
11
+
8
12
  module.exports = hexo => {
9
13
 
10
14
  const { cache, language_switcher } = hexo.theme.config;
@@ -25,23 +29,35 @@ module.exports = hexo => {
25
29
 
26
30
  // merge data
27
31
  const data = hexo.locals.get('data');
32
+ // merge widgets
33
+ var widgets = hexo.render.renderSync({ path: path.join(hexo.theme_dir, '_data/widgets.yml'), engine: 'yaml' });
28
34
  if (data.widgets) {
29
- for (let id of Object.keys(data.widgets)) {
30
- hexo.theme.config.sidebar.widgets[id] = data.widgets[id];
35
+ for (let i of Object.keys(data.widgets)) {
36
+ let widget = data.widgets[i];
37
+ if (widget == null || widget.length == 0) {
38
+ // delete
39
+ delete widgets[i];
40
+ } else {
41
+ // create
42
+ if (widgets[i] == null) {
43
+ widgets[i] = widget;
44
+ } else {
45
+ // merge
46
+ for (let j of Object.keys(widget)) {
47
+ widgets[i][j] = widget[j];
48
+ }
49
+ }
50
+ }
31
51
  }
32
52
  }
53
+ if (hexo.theme.config.data == undefined) {
54
+ hexo.theme.config.data = {};
55
+ }
56
+ hexo.theme.config.data['widgets'] = widgets;
33
57
 
34
58
  // default menu
35
59
  if (hexo.theme.config.sidebar.menu == undefined) {
36
60
  hexo.theme.config.sidebar.menu = [];
37
61
  }
38
- // default widgets
39
- if (hexo.theme.config.sidebar.widgets.repo_info == undefined) {
40
- hexo.theme.config.sidebar.widgets.repo_info = {layout: 'repo_info'};
41
- }
42
- if (hexo.theme.config.sidebar.widgets.wiki_more == undefined) {
43
- hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'};
44
- }
45
-
46
62
 
47
63
  };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * folders.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * {% folders [color:white] %}
6
+ * <!-- folder title 1 -->
7
+ * body 1
8
+ * <!-- folder title 2 -->
9
+ * body 2
10
+ * {% endtable %}
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ hexo.extend.tag.register('folders', function(args, content) {
16
+ args = hexo.args.map(args, ['color']);
17
+ var el = '';
18
+ el += '<div class="tag-plugin folders"';
19
+ el += ' ' + hexo.args.joinTags(args, ['color']).join(' ');
20
+ el += '>';
21
+
22
+ var arr = content.split(/<!--\s*(.*?)\s*-->/g).filter((item, i) => {
23
+ return item.trim().length > 0;
24
+ });
25
+ if (arr.length > 0) {
26
+ var nodes = [];
27
+ arr.forEach((item, i) => {
28
+ if (item.startsWith('folder ')) {
29
+ nodes.push({
30
+ header: item.substring(7)
31
+ });
32
+ } else if (nodes.length > 0) {
33
+ var node = nodes[nodes.length-1];
34
+ if (node.body == undefined) {
35
+ node.body = item;
36
+ } else {
37
+ node.body += '\n' + item;
38
+ }
39
+ }
40
+ });
41
+ nodes.forEach((node, i) => {
42
+ el += '<details class="folder" index="' + (i) + '">';
43
+ // summary
44
+ el += '<summary><span>' + (node.header || '') + '</span></summary>';
45
+ // content
46
+ el += '<div class="body">';
47
+ el += hexo.render.renderSync({text: node.body, engine: 'markdown'}).split('\n').join('');
48
+ el += '</div></details>';
49
+ });
50
+ }
51
+
52
+ el += '</div>';
53
+
54
+ return el;
55
+ }, {ends: true});
@@ -36,11 +36,13 @@ function layoutNodeContent(content) {
36
36
 
37
37
 
38
38
  function postTimeline(args, content) {
39
- args = hexo.args.map(args, ['api']);
39
+ args = hexo.args.map(args, ['api', 'user']);
40
40
  var el = '';
41
41
 
42
42
  if (args.api && args.api.length > 0) {
43
- el += '<div class="tag-plugin timeline stellar-timeline-api" api="' + args.api + '">';
43
+ el += '<div class="tag-plugin timeline stellar-timeline-api"';
44
+ el += ' ' + hexo.args.joinTags(args, ['api', 'user']).join(' ');
45
+ el += '>';
44
46
  } else {
45
47
  el += '<div class="tag-plugin timeline">';
46
48
  }
@@ -53,3 +53,6 @@ table:not([class])
53
53
  trans()
54
54
  &:hover
55
55
  background: var(--block)
56
+
57
+ *[ff=title]
58
+ font-family: $ff-logo
@@ -1,33 +1,30 @@
1
1
  @require('_defines/const')
2
2
 
3
3
  // 通用主题色
4
- $color-theme = #1BCDFC
5
- $color-link = #2196f3
6
- $color-button = #1BCDFC
7
- $color-hover = #ff5722
8
- $color-highlight = #ff5722
9
- $color-inner = #fff
10
- $color-cat = #FF7844
11
- $color-cat-hover = darken($color-cat, 20)
4
+ $color-theme = convert(hexo-config('style.color.common.theme'))
5
+ $color-accent = convert(hexo-config('style.color.common.accent'))
6
+ $color-link = convert(hexo-config('style.color.common.link'))
7
+ $color-button = convert(hexo-config('style.color.common.button'))
8
+ $color-hover = convert(hexo-config('style.color.common.hover'))
12
9
 
13
10
  // 浅色
14
- $light-site-bg = convert(hexo-config('style.theme.light'))
15
- $light-block = #f2f2f2
16
- $light-title = #000
17
- $light-text = #333
18
- $light-code = #111
19
- $light-card = white
11
+ $light-background = convert(hexo-config('style.color.light.background'))
12
+ $light-block = convert(hexo-config('style.color.light.block'))
13
+ $light-card = convert(hexo-config('style.color.light.card'))
14
+ $light-title = convert(hexo-config('style.color.light.title'))
15
+ $light-text = convert(hexo-config('style.color.light.text'))
16
+ $light-code = convert(hexo-config('style.color.light.code'))
20
17
 
21
18
  // 深色
22
- $dark-site-bg = convert(hexo-config('style.theme.dark'))
23
- $dark-block = darken(saturate($dark-site-bg, 40%), 2)
24
- $dark-title = #fff
25
- $dark-text = #eee
26
- $dark-code = #ff7043
27
- $dark-card = lighten(saturate($dark-site-bg, 50%), 10)
19
+ $dark-background = convert(hexo-config('style.color.dark.background'))
20
+ $dark-block = convert(hexo-config('style.color.dark.block'))
21
+ $dark-card = convert(hexo-config('style.color.dark.card'))
22
+ $dark-title = convert(hexo-config('style.color.dark.title'))
23
+ $dark-text = convert(hexo-config('style.color.dark.text'))
24
+ $dark-code = convert(hexo-config('style.color.dark.code'))
28
25
 
29
26
  // 移动端深色背景(OLED调成纯黑可以省电)
30
- $dark-site-bg-mobile = black
27
+ $dark-background-mobile = convert(hexo-config('style.color.dark.background-mobile'))
31
28
 
32
29
 
33
30
  // @font-face
@@ -51,7 +48,7 @@ if hexo-config('style.font-family.logo')
51
48
 
52
49
 
53
50
  // font size
54
- $fs-root = 16px
51
+ $fs-root = convert(hexo-config('style.font-size'))
55
52
  $fs-15 = .9375rem
56
53
  $fs-14 = .875rem
57
54
  $fs-13 = .8125rem
@@ -1,14 +1,14 @@
1
1
  :root
2
- --site-bg: $light-site-bg
2
+ --site-bg: $light-background
3
3
  --block: $light-block
4
4
  --block-border: darken($light-block, 5)
5
5
  --block-hover: darken($light-block, 2)
6
6
  --text-p0: $light-title
7
7
  --text-p1: $light-text
8
- --text-p2: mix($light-text, $light-site-bg, 80)
9
- --text-p3: mix($light-text, $light-site-bg, 60)
10
- --text-p4: mix($light-text, $light-site-bg, 35)
11
- --text-meta: mix($light-text, $light-site-bg, 20)
8
+ --text-p2: mix($light-text, $light-background, 80)
9
+ --text-p3: mix($light-text, $light-background, 60)
10
+ --text-p4: mix($light-text, $light-background, 35)
11
+ --text-meta: mix($light-text, $light-background, 20)
12
12
  --text-code: $light-code
13
13
  --card: $light-card
14
14
  --theme-highlight: darken($color-theme, 5)
@@ -16,22 +16,22 @@
16
16
 
17
17
  set_darkmode()
18
18
  :root
19
- --site-bg: $dark-site-bg
19
+ --site-bg: $dark-background
20
20
  --block: $dark-block
21
21
  --block-border: lighten($dark-block, 6)
22
22
  --block-hover: darken($dark-block, 4)
23
23
  --text-p0: $dark-title
24
- --text-p1: mix($dark-text, $dark-site-bg, 85)
25
- --text-p2: mix($dark-text, $dark-site-bg, 70)
26
- --text-p3: mix($dark-text, $dark-site-bg, 45)
27
- --text-p4: mix($dark-text, $dark-site-bg, 35)
28
- --text-meta: mix($dark-text, $dark-site-bg, 30)
24
+ --text-p1: mix($dark-text, $dark-background, 85)
25
+ --text-p2: mix($dark-text, $dark-background, 70)
26
+ --text-p3: mix($dark-text, $dark-background, 45)
27
+ --text-p4: mix($dark-text, $dark-background, 35)
28
+ --text-meta: mix($dark-text, $dark-background, 30)
29
29
  --text-code: $dark-code
30
30
  --card: $dark-card
31
31
  --theme-highlight: $color-theme
32
32
  --theme-bg: mix($color-theme, $dark-card, 10)
33
33
  @media screen and (max-width: $device-mobile-max)
34
- --site-bg: $dark-site-bg-mobile
34
+ --site-bg: $dark-background-mobile
35
35
  --card: darken($dark-card, 6)
36
36
  --block: darken($dark-block, 4)
37
37
  --block-border: lighten($dark-block, 2)
@@ -32,7 +32,7 @@ article.md.content
32
32
  >h2:not([class])
33
33
  align-self: center
34
34
  border-bottom-style: dashed
35
- border-bottom-color: $color-highlight
35
+ border-bottom-color: $color-accent
36
36
  >:first-child
37
37
  margin-top: 0
38
38
  h1:not(:first-child)
@@ -0,0 +1,30 @@
1
+ .widget-wrap#repo-info
2
+ .widget-body
3
+ a.repo
4
+ display: block
5
+ border: 1px solid var(--block-border)
6
+ color: var(--text-p2)
7
+ background: var(--block)
8
+ border-radius: $border-block
9
+ >div
10
+ margin: 0.75rem 0.5rem
11
+ span
12
+ color: var(--text-p2)
13
+ &:hover
14
+ background: var(--block-hover)
15
+ a.repo
16
+ svg
17
+ margin-right: 4px
18
+ .flex-row
19
+ display: flex
20
+ align-items: center
21
+ .repo-name
22
+ font-size: $fs-14
23
+ font-weight: 700
24
+ .repo-desc
25
+ font-size: $fs-13
26
+ .grid
27
+ font-size: $fs-13
28
+ display: grid
29
+ grid-gap: 2px
30
+ grid-template-columns: repeat(auto-fill, "calc((100% - 2 * %s) / 3)" % 2px)
@@ -75,7 +75,6 @@
75
75
  font-weight: 900
76
76
  color: inherit
77
77
  line-height: 1.2
78
- font-family: $ff-logo
79
78
  display: block
80
79
  position: relative
81
80
  .main
@@ -40,6 +40,7 @@
40
40
  &.active
41
41
  background: var(--block)
42
42
  box-shadow: none
43
+ color: var(--text-p1)
43
44
  .about-header+.about-body
44
45
  margin-top: 1.5rem
45
46
 
@@ -0,0 +1,62 @@
1
+ .tag-plugin.folders
2
+ display: block
3
+ margin: 1rem 0
4
+ border-radius: $border-block
5
+ font-size: $fs-14
6
+ border: 1px solid var(--theme-border)
7
+ overflow: hidden
8
+ .folder
9
+ display: block
10
+ font-size: $fs-14
11
+ background: var(--block)
12
+ &:last-child summary
13
+ border-bottom: none
14
+ summary
15
+ display: block
16
+ cursor: pointer
17
+ color: var(--text-p2)
18
+ font-weight: 500
19
+ position: relative
20
+ line-height: 1.2
21
+ outline: none
22
+ padding: 0.75rem 1rem
23
+ border-bottom: 1px solid var(--theme-border)
24
+ &:last-child
25
+ border-bottom: none
26
+ >
27
+ p,h1,h2,h3,h4,h5,h6
28
+ display: inline
29
+ border-bottom: none !important
30
+ &:hover
31
+ color: var(--text-p0)
32
+ background: var(--block-hover)
33
+ &:after
34
+ position: absolute
35
+ content: '+'
36
+ text-align: center
37
+ top: 50%
38
+ transform: translateY(-50%)
39
+ right: 1rem
40
+
41
+
42
+ .tag-plugin.folders details[open]
43
+ background: none
44
+ &:last-child
45
+ summary
46
+ border-bottom: 1px solid var(--theme-border)
47
+ .body
48
+ border-bottom: none
49
+ >summary
50
+ color: var(--text-p1)
51
+ background: var(--block-hover)
52
+ &:hover:after
53
+ content: '-'
54
+
55
+ >div.body
56
+ padding: 1rem
57
+ border-bottom: 1px solid var(--theme-border)
58
+ font-size: $fs-15
59
+ >:first-child
60
+ margin-top: 0
61
+ >:last-child
62
+ margin-bottom: 0
@@ -47,4 +47,4 @@
47
47
  top: 6px
48
48
  bottom: 6px
49
49
  border-radius: 4px
50
- background: $color-highlight
50
+ background: $color-accent
@@ -41,13 +41,13 @@ article.md.content
41
41
  &:before
42
42
  top: 8px
43
43
  left: 0
44
- border-top: 6px solid $color-highlight
45
- border-left: 6px solid $color-highlight
44
+ border-top: 6px solid $color-accent
45
+ border-left: 6px solid $color-accent
46
46
  &:after
47
47
  right: 0
48
48
  bottom: 0
49
- border-right: 6px solid $color-highlight
50
- border-bottom: 6px solid $color-highlight
49
+ border-right: 6px solid $color-accent
50
+ border-bottom: 6px solid $color-accent
51
51
  article.md.content h1.quot[type=text]
52
52
  &:before,&:after
53
53
  width: 12px
@@ -59,9 +59,10 @@ article.md.content h1.quot[type=text]
59
59
  .icon
60
60
  height: 1.5em
61
61
  display: inline-block
62
- color: $color-highlight
62
+ color: $color-accent
63
63
  border-radius: 0
64
64
  &.prefix
65
+ margin-left: -0.5rem
65
66
  margin-right: .5rem
66
67
  &.suffix
67
68
  margin-left: .5rem
@@ -70,7 +71,7 @@ article.md.content h1.quot[type=text]
70
71
  .md span.tag-plugin.quot
71
72
  font-weight: 500
72
73
  &:before,&:after
73
- color: $color-highlight
74
+ color: $color-accent
74
75
  font-weight: 900
75
76
  &:before
76
77
  content: "「"
@@ -35,24 +35,48 @@
35
35
  &:hover .header
36
36
  p
37
37
  color: var(--text-p1)
38
+ .user-info
39
+ background: $color-theme
40
+ span
41
+ color: var(--card)
38
42
  &:before
39
43
  background: $color-theme
40
44
  height: 16px
41
45
  top: 'calc(50% - 0.5 * %s)' % @height
42
46
  transform: scale(1)
43
47
 
44
- .tag-plugin.timeline .header
48
+ .tag-plugin.timeline .timenode .header
45
49
  display: flex
46
50
  align-items: center
47
51
  position: relative
52
+ margin: 0.25rem 0
53
+ .user-info
54
+ display: flex
55
+ align-items: center
56
+ font-size: $fs-12
57
+ font-weight: 500
58
+ color: var(--text-p1)
59
+ margin-right: 4px
60
+ line-height: 1
61
+ border-radius: 16px
62
+ padding-right: 6px
63
+ trans2 color background
64
+ img
65
+ background: white
66
+ height: 16px
67
+ border-radius: 16px
68
+ display: inline
69
+ margin: 0 4px 0 0
70
+ object-fit: contain
71
+ &:hover
72
+ background: $color-hover
48
73
  p
49
- margin: .25rem 0
74
+ margin: 0
50
75
  font-size: $fs-12
51
- font-weight: 700
76
+ font-weight: 500
52
77
  color: var(--text-p3)
53
- font-family: $ff-code
54
78
  trans1 color
55
- opacity: 0.75
79
+ line-height: 1
56
80
  a
57
81
  color: inherit
58
82
  font-weight: inherit
@@ -76,6 +100,8 @@
76
100
  padding: 0.5rem 1rem
77
101
  margin-top: 4px
78
102
  box-shadow: $boxshadow-block
103
+ p
104
+ font-size: $fs-14
79
105
  &:empty
80
106
  display: none
81
107
  p,.highlight,ol,ul,.tag-plugin
@@ -87,15 +113,17 @@
87
113
  .tag-plugin.timeline.stellar-timeline-api .body
88
114
  max-height: convert(hexo-config('tag_plugins.timeline.max-height'))
89
115
  overflow: scroll
90
- p
91
- font-size: $fs-14
92
116
  p.title
93
117
  font-size: 1rem
94
- font-weight: 500
118
+ font-weight: 700
95
119
  margin: 0
96
120
  padding: 0.5rem 0 0.75rem
97
121
  line-height: 1.25
98
122
  border-bottom: 1px dashed var(--block-border)
123
+ a
124
+ color: inherit
125
+ &:hover
126
+ color: $color-hover
99
127
  pre code
100
128
  font-size: $fs-12
101
129
 
@@ -116,18 +144,13 @@
116
144
  line-height: 1.8
117
145
  &:empty
118
146
  display: none
119
- a.comments
120
- margin-right: 0
121
-
147
+ .flex
148
+ display: flex
149
+ flex-wrap: wrap
150
+ font-size: $fs-12
151
+ align-items: stretch
122
152
 
123
- .tag-plugin.timeline.stellar-timeline-api .body .footer .flex
124
- display: flex
125
- flex-wrap: wrap
126
- font-size: $fs-12
127
- align-items: stretch
128
- .reaction
129
- border-color: var(--block)
130
- border-style: dashed
153
+ .tag-plugin.timeline.stellar-timeline-api .body .footer
131
154
  .item
132
155
  border-width: 1px
133
156
  border-style: solid
@@ -136,24 +159,20 @@
136
159
  padding: 0 0.5rem
137
160
  display: flex
138
161
  align-items: center
139
- &.comments
140
- border-width: 0
141
162
  &:first-child
142
163
  margin-left: 0
143
164
  &:last-child
144
165
  margin-right: 0
145
- .key
146
- margin-right: 4px
166
+ .reaction
167
+ border-color: var(--block)
147
168
 
148
- .tag-plugin.timeline.stellar-timeline-api .body .footer a.comments
149
- border-radius: 4px
169
+ .tag-plugin.timeline .body blockquote
150
170
  padding: 0 0.5rem
151
- color: white
152
- trans1: all
153
- margin-left: 2px
154
- background: $color-theme
155
- .key
156
- margin-right: 4px
157
- &:hover
158
- background: $color-hover
159
-
171
+ box-shadow: none
172
+ border-left: 4px solid var(--block-border)
173
+ border-radius: 0
174
+ display: block
175
+ margin: 0.75rem 0
176
+ p
177
+ font-size: $fs-13
178
+ margin: 0.25rem
@@ -2,7 +2,7 @@
2
2
  --twikoo-lighttext: #ef794f;
3
3
  --twikoo-secondtext: #909094;
4
4
  --twikoo-emoji-background: #f8f8f8;
5
- --twikoo-theme: #409eff;
5
+ --twikoo-theme: $color-theme;
6
6
  margin-top: 1.5rem
7
7
 
8
8
  .tk-content
@@ -112,4 +112,4 @@ if hexo-config('style.darkmode') == 'auto'
112
112
  --twikoo-lighttext: #f2b94b;
113
113
  --twikoo-secondtext: #a1a2b8;
114
114
  --twikoo-emoji-background: darken($dark-block, 1);
115
- --twikoo-theme: #409eff;
115
+ --twikoo-theme: #409eff;
@@ -5,7 +5,7 @@
5
5
  --waline-light-grey: #999;
6
6
  --waline-dark-grey: #666;
7
7
  /* 主题色 */
8
- --waline-theme-color: #3498db;
8
+ --waline-theme-color: $color-theme;
9
9
  --waline-active-color: #2ecc71;
10
10
  /* 布局颜色 */
11
11
  --waline-color: #444;
@@ -57,47 +57,69 @@ const StellarTimeline = {
57
57
  $(el).append('<div class="loading-wrap"><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg><p></p></div>');
58
58
  StellarTimeline.requestAPI(cfg.api, function(data) {
59
59
  $(el).find('.loading-wrap').remove();
60
+ const user = el.getAttribute('user');
60
61
  const arr = data.content || data;
61
62
  arr.forEach((item, i) => {
62
- if (item.labels.length > 0) {
63
- var cell = '<div class="timenode" index="' + i + '">';
64
- cell += '<div class="header">';
65
- let date = new Date(item.created_at);
66
- cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>';
67
- cell += '</div>';
68
- cell += '<div class="body">';
69
- cell += '<p class="title">' + item.title + '</p>';
70
- cell += marked.parse(item.body);
71
- cell += '<div class="footer">';
72
- cell += '<div class="flex labels">';
63
+ if (item.user && item.user.login && user && user.length > 0) {
64
+ if (!user.includes(item.user.login)) {
65
+ return;
66
+ }
67
+ }
68
+ var cell = '<div class="timenode" index="' + i + '">';
69
+ cell += '<div class="header">';
70
+ if (!user && item.user) {
71
+ cell += '<a class="user-info" href="' + item.user.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
72
+ cell += '<img src="' + item.user.avatar_url + '">';
73
+ cell += '<span>' + item.user.login + '</span>';
74
+ cell += '</a>';
75
+ }
76
+ let date = new Date(item.created_at);
77
+ cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>';
78
+ cell += '</div>';
79
+ cell += '<div class="body">';
80
+ cell += '<p class="title">';
81
+ cell += '<a href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
82
+ cell += item.title || item.name || item.tag_name;
83
+ cell += '</a>';
84
+ cell += '</p>';
85
+
86
+ cell += marked.parse(item.body);
87
+ cell += '<div class="footer">';
88
+ cell += '<div class="flex left">';
89
+ if (item.labels) {
73
90
  item.labels.forEach((label, i) => {
74
- cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '12;border-color:#' + label.color + '22">';
91
+ cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">';
75
92
  cell += '<span>' + label.name + '</span>';
76
93
  cell += '</div>';
77
94
  });
78
- cell += '</div>';
79
- cell += '<div class="flex reactions">';
80
- if (item.reactions.total_count > 0) {
81
- for (let key of Object.keys(StellarTimeline.reactions)) {
82
- let num = item.reactions[key];
83
- if (num > 0) {
84
- cell += '<div class="item reaction ' + key + '">';
85
- cell += '<span class="key ' + key + '">' + StellarTimeline.reactions[key] + '</span>';
86
- cell += '<span class="value ' + key + '">' + item.reactions[key] + '</span>';
87
- cell += '</div>';
88
- }
95
+ } else if (item.zipball_url) {
96
+ cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
97
+ cell += '<span>📦 ' + item.tag_name + '.zip</span>';
98
+ cell += '</a>';
99
+ }
100
+ cell += '</div>';
101
+ cell += '<div class="flex right">';
102
+ if (item.reactions && item.reactions.total_count > 0) {
103
+ for (let key of Object.keys(StellarTimeline.reactions)) {
104
+ let num = item.reactions[key];
105
+ if (num > 0) {
106
+ cell += '<div class="item reaction ' + key + '">';
107
+ cell += '<span>' + StellarTimeline.reactions[key] + ' ' + item.reactions[key] + '</span>';
108
+ cell += '</div>';
89
109
  }
90
110
  }
91
- cell += '<a class="item comments" href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
92
- cell += '<span class="key comments">💬</span>';
93
- cell += '<span class="value comments">' + item.comments + '</span>';
111
+ }
112
+ if (item.comments != null) {
113
+ cell += '<a class="item comments last" href="' + item.html_url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
114
+ cell += '<span><svg t="1666270368054" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2528" width="200" height="200"><path d="M952 64H72C32.3 64 0 96.3 0 136v508c0 39.7 32.3 72 72 72h261l128 128c14 14 32.5 21.1 50.9 21.1s36.9-7 50.9-21.1l128-128h261c39.7 0 72-32.3 72-72V136c0.2-39.7-32.1-72-71.8-72zM222 462c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72-32.2 72-72 72z m290-7.7c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z m290 8c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z" p-id="2529"></path></svg> ' + (item.comments || 0) + '</span>';
94
115
  cell += '</a>';
95
- cell += '</div>';
96
- cell += '</div>';
97
- cell += '</div>';
98
- cell += '</div>';
99
- $(el).append(cell);
100
116
  }
117
+
118
+ cell += '</div>';
119
+ cell += '</div>';
120
+ cell += '</div>';
121
+ cell += '</div>';
122
+ $(el).append(cell);
101
123
  });
102
124
  }, function() {
103
125
  $(el).find('.loading-wrap svg').remove();
@@ -1,91 +0,0 @@
1
- <%
2
- function layoutDiv() {
3
- var el = '';
4
- var repo;
5
- var branch = 'main';
6
- if (page.layout === 'wiki' && page.wiki) {
7
- let proj = theme.wiki.projects[page.wiki];
8
- if (proj && proj.repo) {
9
- repo = proj.repo;
10
- if (proj.branch != undefined) {
11
- branch = proj.branch;
12
- }
13
- }
14
- } else {
15
- // 其它的如果有设置 repo 也可以
16
- repo = page.repo;
17
- }
18
- if (repo == undefined) {
19
- return el;
20
- }
21
- // 布局
22
- el += '<div class="widget-wrap" id="repo-info">';
23
- // header
24
- el += '<div class="widget-header cap dis-select">';
25
- el += '<span class="name">' + __("meta.repo_info") + '</span>';
26
- el += '</div>';
27
- // body
28
- el += '<div class="widget-body fs14">';
29
- el += '<div class="items stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '">';
30
- var items = [];
31
- // GitHub
32
- items.push({
33
- icon: '<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>',
34
- text: 'GitHub',
35
- href: 'https://github.com/' + repo
36
- });
37
- // Stars
38
- items.push({
39
- icon: '<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 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>',
40
- text: 'Stars',
41
- apiKey: 'stargazers_count',
42
- href: 'https://github.com/' + repo + '/stargazers'
43
- });
44
- // Forks
45
- items.push({
46
- icon: '<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="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>',
47
- text: 'Forks',
48
- apiKey: 'forks_count',
49
- href: 'https://github.com/' + repo + '/network/members'
50
- });
51
- // Releases
52
- items.push({
53
- icon: '<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="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>',
54
- text: 'Releases',
55
- href: 'https://github.com/' + repo + '/releases'
56
- });
57
- // Download
58
- items.push({
59
- icon: '<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="M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"></path></svg>',
60
- text: 'Download Zip',
61
- href: 'https://github.com/' + repo + '/archive/refs/heads/' + branch + '.zip'
62
- });
63
- items.forEach((item, i) => {
64
- el += '<div class="line"></div>';
65
- el += '<a class="item-link"';
66
- el += ' title="' + item.href + '"';
67
- el += ' href="' + url_for(item.href) + '"';
68
- el += ' target="_blank" rel="external nofollow noopener noreferrer"';
69
- el += '>';
70
- // left
71
- el += '<div class="left">';
72
- el += '<span>' + item.text + '</span>';
73
- el += '</div>';
74
- // right
75
- el += '<div class="right">';
76
- if (item.apiKey) {
77
- el += '<span type="text" id="' + item.apiKey + '"></span>';
78
- }
79
- if (item.icon) {
80
- el += item.icon;
81
- }
82
- el += '</div>';
83
- el += '</a>';
84
- });
85
- el += '</div>';
86
- el += '</div>';
87
- el += '</div>';
88
- return el;
89
- }
90
- %>
91
- <%- layoutDiv() %>
@@ -1,31 +0,0 @@
1
- .widget-wrap#repo-info
2
- .widget-body
3
- >.items
4
- margin: 4px 0
5
- border: 1px solid var(--block-border)
6
- border-radius: $border-block
7
- background: var(--block)
8
- overflow: hidden
9
- .line
10
- margin: 0
11
- height: 1px
12
- background: var(--block-border)
13
- &+.line,&:first-child,&:last-child
14
- display: none
15
- a.item-link
16
- color: var(--text-p2)
17
- font-weight: 500
18
- display: flex
19
- align-items: center
20
- padding: 0.5rem .5rem
21
- font-size: $fs-13
22
- justify-content: space-between
23
- svg
24
- width: 1em
25
- height: 1em
26
- margin-left: 4px
27
- div
28
- display: flex
29
- align-items: center
30
- a:hover
31
- background: var(--block-hover)