hexo-theme-stellar 1.11.0 → 1.12.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 (62) hide show
  1. package/_config.yml +15 -12
  2. package/_data/widgets.yml +30 -6
  3. package/languages/zh-CN.yml +4 -4
  4. package/languages/zh-TW.yml +4 -4
  5. package/layout/_partial/main/article/read_next.ejs +16 -17
  6. package/layout/_partial/main/navbar/breadcrumb.ejs +1 -1
  7. package/layout/_partial/main/post_list/post_card.ejs +21 -15
  8. package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
  9. package/layout/_partial/sidebar/header.ejs +2 -26
  10. package/layout/_partial/sidebar/logo.ejs +2 -2
  11. package/layout/_partial/sidebar/menu.ejs +27 -0
  12. package/layout/_partial/sidebar/widgets/ghissues.ejs +46 -0
  13. package/layout/_partial/sidebar/widgets/ghrepo.ejs +3 -3
  14. package/layout/_partial/sidebar/widgets/ghuser.ejs +4 -0
  15. package/layout/_partial/sidebar/widgets/markdown.ejs +1 -1
  16. package/layout/_partial/sidebar/widgets/recent.ejs +8 -11
  17. package/layout/_partial/sidebar/widgets/{wiki_more.ejs → related.ejs} +7 -7
  18. package/layout/_partial/sidebar/widgets/tagcloud.ejs +24 -0
  19. package/layout/_partial/sidebar/widgets/timeline.ejs +27 -0
  20. package/layout/_partial/sidebar/widgets/toc.ejs +1 -5
  21. package/layout/index.ejs +1 -1
  22. package/package.json +1 -1
  23. package/scripts/events/lib/doc_tree.js +3 -0
  24. package/scripts/helpers/related_posts.js +11 -39
  25. package/scripts/tags/about.js +10 -7
  26. package/scripts/tags/{grid.js → border.js} +4 -4
  27. package/scripts/tags/link.js +11 -9
  28. package/scripts/tags/navbar.js +1 -1
  29. package/scripts/tags/sites.js +1 -1
  30. package/scripts/tags/split.js +51 -0
  31. package/source/css/_common/base.styl +2 -2
  32. package/source/css/_common/blur.styl +3 -0
  33. package/source/css/_common/device.styl +2 -0
  34. package/source/css/_common/highlight.styl +1 -1
  35. package/source/css/_common/loading.styl +16 -3
  36. package/source/css/_common/title.styl +0 -13
  37. package/source/css/_custom.styl +4 -4
  38. package/source/css/_layout/list.styl +40 -9
  39. package/source/css/_layout/md.styl +1 -1
  40. package/source/css/_layout/partial/related.styl +62 -93
  41. package/source/css/_layout/sidebar/footer.styl +4 -2
  42. package/source/css/_layout/sidebar/ghrepo.styl +11 -5
  43. package/source/css/_layout/sidebar/ghuser.styl +19 -1
  44. package/source/css/_layout/sidebar/sidebar.styl +4 -90
  45. package/source/css/_layout/sidebar/toc_common.styl +5 -3
  46. package/source/css/_layout/sidebar/widgets.styl +104 -0
  47. package/source/css/_layout/tag-plugins/about.styl +21 -18
  48. package/source/css/_layout/tag-plugins/common.styl +36 -31
  49. package/source/css/_layout/tag-plugins/link.styl +41 -27
  50. package/source/css/_layout/tag-plugins/navbar.styl +10 -4
  51. package/source/css/_layout/tag-plugins/quot.styl +1 -1
  52. package/source/css/_layout/tag-plugins/split.styl +28 -0
  53. package/source/css/_layout/tag-plugins/timeline.styl +18 -9
  54. package/source/css/_plugins/comments/twikoo.styl +11 -5
  55. package/source/css/_plugins/comments/valine.styl +4 -0
  56. package/source/css/_plugins/comments/waline.styl +1 -1
  57. package/source/js/main.js +14 -8
  58. package/source/js/plugins/friends.js +3 -2
  59. package/source/js/plugins/ghinfo.js +14 -2
  60. package/source/js/plugins/linkcard.js +124 -0
  61. package/source/js/plugins/sites.js +4 -3
  62. package/source/js/plugins/timeline.js +11 -6
@@ -14,8 +14,8 @@
14
14
  cursor: pointer
15
15
  min-width 280px
16
16
  max-width: 100%
17
- width: 320px
18
- @media screen and (max-width: $device-mobile-375)
17
+ width: 350px
18
+ @media screen and (max-width: $device-mobile-425)
19
19
  width: 100%
20
20
  box-shadow: $boxshadow-card
21
21
  border-radius: $border-block
@@ -35,54 +35,68 @@
35
35
  text-align: justify
36
36
 
37
37
  .md .link-card
38
- line-height: 1.2
39
- > div
40
- pointer-events: none
38
+ >.left
39
+ overflow: hidden
40
+ margin: 0.75rem 0 0.75rem 0.75rem
41
+ .title
42
+ font-size: $fs-14
43
+ span+span
44
+ margin-top: 0.25rem
45
+ >.right
46
+ width: 2.75rem
47
+ height: 2.75rem
48
+ margin: 0.75rem
49
+ overflow: hidden
50
+ flex-shrink: 0
41
51
  >.top
42
52
  display: flex
43
- margin: .75rem 1rem .25rem
53
+ margin: .75rem 0.75rem .25rem
44
54
  overflow: hidden
45
55
  max-width: 'calc(100% - %s * 2)' % 1rem
46
56
  align-items: center
47
57
  .img
48
58
  line-height: 0
49
59
  height: 16px
50
- width: 20px
51
- margin-right: 4px
60
+ width: 16px
61
+ border-radius: 16px
62
+ margin-right: 8px
52
63
  background-repeat: no-repeat
53
64
  background-size: contain
54
65
  background-position: left center
55
- .desc
56
- opacity: .75
57
- line-height: 1.5
58
66
  span
59
67
  txt-ellipsis()
60
68
  max-width: 100%
61
69
  >.bottom
62
- margin: 0 1rem .75rem 1rem
70
+ margin: 0 0.75rem 0.75rem 0.75rem
63
71
  .title
64
72
  font-size: $fs-15
65
73
  margin: 4px 0 8px 0
66
- >.right
67
- width: 2.5rem
68
- height: 2.5rem
69
- margin: .75rem
74
+
75
+ .md .link-card
76
+ line-height: 1.2
77
+ .title
78
+ display: -webkit-box
79
+ -webkit-box-orient: vertical
70
80
  overflow: hidden
81
+ -webkit-line-clamp: 2
82
+ .cap
71
83
  flex-shrink: 0
72
- >.left
84
+ color: var(--text-p3)
85
+ .link
86
+ line-height: 1.5
87
+ opacity: .75
88
+ txt-ellipsis()
89
+ .desc
90
+ display: -webkit-box
91
+ -webkit-box-orient: vertical
73
92
  overflow: hidden
74
- margin: .5rem 0 .5rem 1rem
75
- .title
76
- font-size: $fs-14
77
- margin: 1px 0 5px 0
78
- .desc
79
- flex-shrink: 0
80
- txt-ellipsis()
93
+ -webkit-line-clamp: 3
94
+ .img
95
+ border-radius: 4px
96
+
81
97
  span
82
98
  margin: 0
83
99
  display: block
84
- span.title
100
+ .title
85
101
  font-weight: 500
86
102
  color: var(--text-p1)
87
- span.desc
88
- color: var(--text-p3)
@@ -1,16 +1,22 @@
1
1
  .md .tag-plugin.navbar
2
+ text-align: center
2
3
  nav.cap
3
4
  margin: 0
4
5
  padding: 1px
5
- background: var(--block)
6
+ background: var(--card)
7
+ box-shadow: $boxshadow-button
6
8
  border-radius: 6px
7
9
  display: inline-flex
8
10
  max-width: 100%
9
11
  a
10
12
  margin: 1px
11
13
  padding: 0.25em 0.75rem
14
+ color: var(--text-p2)
12
15
  &:after
13
16
  display: none
14
- &:hover,&.active
15
- background: var(--card)
16
- color: var(--text-p1)
17
+ &:hover
18
+ background: var(--block)
19
+ &.active
20
+ background: var(--block)
21
+ box-shadow: none
22
+ color: var(--text-p1)
@@ -3,7 +3,7 @@
3
3
  position: relative
4
4
  align-items: center
5
5
  .md .tag-plugin.quot:not(span)
6
- display: flex
6
+ display: inline-flex
7
7
  align-self: center
8
8
  border-bottom: none
9
9
  font-weight: 700
@@ -0,0 +1,28 @@
1
+ .md .tag-plugin.split
2
+ margin: 0.5rem 0
3
+ .tag-plugin.split
4
+ display: grid
5
+ grid-gap: 16px
6
+ grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 16px)
7
+ >div>
8
+ p
9
+ line-height: 1.5
10
+ :first-child
11
+ margin-top: 0
12
+ :last-child
13
+ margin-bottom: 0
14
+ p:first-child
15
+ margin-top: -0.25em
16
+ p:last-child
17
+ margin-bottom: -0.25em
18
+
19
+
20
+ .tag-plugin.split
21
+ &[bg]>div
22
+ padding: 1rem
23
+ border-radius: $border-card
24
+ &[bg='block']>div
25
+ background: var(--block)
26
+ &[bg='card']>div
27
+ background: var(--card)
28
+ box-shadow: $boxshadow-card
@@ -20,13 +20,15 @@
20
20
  &:before
21
21
  display: none
22
22
 
23
- .tag-plugin.timeline .timenode
23
+ .md .tag-plugin.timeline .timenode
24
24
  position: relative
25
25
  display: flex
26
26
  flex-direction: column
27
27
  align-items: flex-start
28
- max-width: 'calc(100% - %s)' % 1rem
28
+ box-sizing: border-box
29
+ max-width: 100%
29
30
  >.header, >.body
31
+ box-sizing: border-box
30
32
  max-width: @max-width
31
33
  &[highlight] .header:before
32
34
  background: $color-theme
@@ -50,6 +52,7 @@
50
52
  align-items: center
51
53
  position: relative
52
54
  margin: 0.25rem 0
55
+ font-size: $fs-12
53
56
  .user-info
54
57
  display: flex
55
58
  align-items: center
@@ -70,13 +73,14 @@
70
73
  object-fit: contain
71
74
  &:hover
72
75
  background: $color-hover
73
- p
74
- margin: 0
75
- font-size: $fs-12
76
+ &,p
76
77
  font-weight: 500
77
78
  color: var(--text-p3)
78
79
  trans1 color
79
80
  line-height: 1
81
+ p
82
+ margin: 0 !important
83
+ font-size: $fs-12 !important
80
84
  a
81
85
  color: inherit
82
86
  font-weight: inherit
@@ -116,20 +120,25 @@
116
120
  p.title
117
121
  font-size: 1rem
118
122
  font-weight: 700
119
- margin: 0
120
- padding: 0.5rem 0 0.75rem
123
+ margin: 0.5rem 0 0.75rem
121
124
  line-height: 1.25
122
- border-bottom: 1px dashed var(--block-border)
123
125
  a
124
126
  color: inherit
125
127
  &:hover
126
128
  color: $color-hover
129
+ a
130
+ &:has(img):after
131
+ display: none
132
+ img
133
+ margin: 0 auto
134
+ img
135
+ margin: 0.5rem auto
127
136
  pre code
128
137
  font-size: $fs-12
129
138
 
130
139
  .tag-plugin.timeline.stellar-timeline-api .body .footer
140
+ margin: 0 0 -0.5rem
131
141
  padding: 0.5rem 0 1rem
132
- margin-bottom: -0.5rem
133
142
  user-select: none
134
143
  font-weight: 500
135
144
  display: flex
@@ -106,10 +106,16 @@
106
106
  .tk-comments-no
107
107
  color: var(--text-p1);
108
108
 
109
+ set_darkmode_comments()
110
+ .cmt-body.twikoo
111
+ --twikoo-lighttext: #f2b94b;
112
+ --twikoo-secondtext: #a1a2b8;
113
+ --twikoo-emoji-background: darken($dark-block, 1);
114
+ --twikoo-theme: #409eff;
115
+
109
116
  if hexo-config('style.darkmode') == 'auto'
110
117
  @media (prefers-color-scheme: dark)
111
- .cmt-body.twikoo
112
- --twikoo-lighttext: #f2b94b;
113
- --twikoo-secondtext: #a1a2b8;
114
- --twikoo-emoji-background: darken($dark-block, 1);
115
- --twikoo-theme: #409eff;
118
+ set_darkmode_comments()
119
+
120
+ if hexo-config('style.darkmode') == 'always'
121
+ set_darkmode_comments()
@@ -49,12 +49,16 @@
49
49
  if hexo-config('style.darkmode') == 'auto'
50
50
  @media (prefers-color-scheme: dark)
51
51
  box-shadow: none
52
+ if hexo-config('style.darkmode') == 'always'
53
+ box-shadow: none
52
54
  &:active
53
55
  background: linear-gradient(145deg, #eee, #fff)
54
56
  box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.1), -0px -0px 0px rgba(255, 255, 255, 0.8), inset 2px 2px 4px rgba(0, 0, 0, 0.1), inset -2px -2px 4px rgba(255, 255, 255, 1), inset -8px -8px 16px rgba(255, 255, 255, 0.4)
55
57
  if hexo-config('style.darkmode') == 'auto'
56
58
  @media (prefers-color-scheme: dark)
57
59
  box-shadow: none
60
+ if hexo-config('style.darkmode') == 'always'
61
+ box-shadow: none
58
62
  .vedit
59
63
  .vctrl span
60
64
  padding: 0
@@ -6,7 +6,7 @@
6
6
  --waline-dark-grey: #666;
7
7
  /* 主题色 */
8
8
  --waline-theme-color: $color-theme;
9
- --waline-active-color: #2ecc71;
9
+ --waline-active-color: $color-hover;
10
10
  /* 布局颜色 */
11
11
  --waline-color: #444;
12
12
  --waline-bgcolor: #fff;
package/source/js/main.js CHANGED
@@ -217,14 +217,20 @@ if (stellar.plugins.lazyload) {
217
217
  if (stellar.plugins.stellar) {
218
218
  for (let key of Object.keys(stellar.plugins.stellar)) {
219
219
  let js = stellar.plugins.stellar[key];
220
- const els = document.getElementsByClassName('stellar-' + key + '-api');
221
- if (els != undefined && els.length > 0) {
222
- stellar.jQuery(() => {
223
- stellar.loadScript(js, { defer: true });
224
- if (key == 'timeline') {
225
- stellar.loadScript(stellar.plugins.marked);
226
- }
227
- })
220
+ if (key == 'linkcard') {
221
+ stellar.loadScript(js, { defer: true }).then(function () {
222
+ setCardLink(document.querySelectorAll('a.link-card'));
223
+ });
224
+ } else {
225
+ const els = document.getElementsByClassName('stellar-' + key + '-api');
226
+ if (els != undefined && els.length > 0) {
227
+ stellar.jQuery(() => {
228
+ stellar.loadScript(js, { defer: true });
229
+ if (key == 'timeline') {
230
+ stellar.loadScript(stellar.plugins.marked);
231
+ }
232
+ })
233
+ }
228
234
  }
229
235
  }
230
236
  }
@@ -44,7 +44,7 @@ const friendsjs = {
44
44
  },
45
45
  layout: (cfg) => {
46
46
  const el = $(cfg.el)[0];
47
- $(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>');
47
+ $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>');
48
48
  friendsjs.requestAPI(cfg.api, function(data) {
49
49
  $(el).find('.loading-wrap').remove();
50
50
  const arr = data.content || data;
@@ -60,7 +60,8 @@ const friendsjs = {
60
60
  });
61
61
  }, function() {
62
62
  $(el).find('.loading-wrap svg').remove();
63
- $(el).find('.loading-wrap p').text('加载失败,请稍后重试。');
63
+ $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" d="M12 3L21 20H3L12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.5s" values="60;0"/></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 10V14"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="6;0"/></path></g><circle cx="12" cy="17" r="1" fill="currentColor" fill-opacity="0"><animate fill="freeze" attributeName="fill-opacity" begin="0.8s" dur="0.4s" values="0;1"/></circle></svg>');
64
+ $(el).find('.loading-wrap').addClass('error');
64
65
  });
65
66
  },
66
67
  }
@@ -44,13 +44,25 @@ const GitHubInfo = {
44
44
  },
45
45
  layout: (cfg) => {
46
46
  const el = $(cfg.el)[0];
47
- GitHubInfo.requestAPI(cfg.api, function(data) {
48
- const arr = data.content || data;
47
+ function fill(data) {
49
48
  for (let key of Object.keys(data)) {
50
49
  $(el).find("[type=text]#" + key).text(data[key]);
51
50
  $(el).find("[type=link]#" + key).attr("href", data[key]);
52
51
  $(el).find("[type=img]#" + key).attr("src", data[key]);
53
52
  }
53
+ }
54
+ GitHubInfo.requestAPI(cfg.api, function(data) {
55
+ const idx = el.getAttribute('index');
56
+ if (idx != undefined) {
57
+ const arr = data.content || data;
58
+ if (arr && arr.length > idx) {
59
+ let obj = arr[idx];
60
+ obj['latest-tag-name'] = obj['name'];
61
+ fill(arr[idx]);
62
+ }
63
+ } else {
64
+ fill(data);
65
+ }
54
66
  }, function() {
55
67
  });
56
68
  },
@@ -0,0 +1,124 @@
1
+ // 本插件由CardLink定制而成,原项目源码: https://github.com/Lete114/CardLink
2
+
3
+ var cardLink = {};
4
+ cardLink.caches = {};
5
+ cardLink.server = 'https://api.allorigins.win/raw?url=';
6
+
7
+ /**
8
+ * Remove '/' and '/index.html'
9
+ * @param {String} params
10
+ * @returns { String }
11
+ */
12
+ function indexHandler(params) {
13
+ let path = params.replace(/(\/index\.html|\/)*$/gi, '')
14
+ if (path.length === 0) path += '/'
15
+ return path
16
+ }
17
+
18
+ /**
19
+ * Determine if it is a ['https://', 'http://', '//'] protocol
20
+ * @param {String} url Website url
21
+ * @returns {Boolean}
22
+ */
23
+ function isHttp(url) {
24
+ return /^(https?:)?\/\//g.test(url)
25
+ }
26
+
27
+ function renderer(el, obj) {
28
+ if (obj.title && obj.title.length > 0) {
29
+ el.querySelector('.title').innerHTML = obj.title;
30
+ }
31
+ if (obj.icon && obj.icon.length > 0) {
32
+ el.querySelector('.img').style = 'background-image: url("' + obj.icon + '");';
33
+ }
34
+ let desc = el.querySelector('.desc');
35
+ if (desc && obj.desc && obj.desc.length > 0) {
36
+ desc.innerHTML = obj.desc;
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Get info
42
+ * @param {Element} el Element
43
+ * @param {String} html String type html
44
+ * @param {String} link Website address
45
+ */
46
+ // eslint-disable-next-line max-statements
47
+ function getInfo(el, html, link) {
48
+ try {
49
+ let title, icon, desc
50
+ const doc = new DOMParser().parseFromString(html, 'text/html')
51
+ // If there is no title, no card link is generated
52
+ title = doc.querySelector('title')
53
+ if (title) {
54
+ title = title.textContent
55
+
56
+ // Get the src of the first img tag in the body tag
57
+ let tmp = doc.querySelector('head link[rel="apple-touch-icon"]')
58
+ if (!tmp) {
59
+ tmp = doc.querySelector('head link[rel="icon"]')
60
+ }
61
+ icon = tmp && tmp.getAttribute('href')
62
+
63
+ if (/^data:image/.test(icon)) icon = ''
64
+
65
+ // If there is no src then get the site icon
66
+ if (!icon) {
67
+ const links = [].slice.call(doc.querySelectorAll('link[rel][href]'))
68
+ icon = links.find((_el) => _el.rel.includes('icon'))
69
+ icon = icon && icon.getAttribute('href')
70
+ }
71
+
72
+ desc = doc.querySelector('head meta[name="description"]')
73
+
74
+ if (desc) {
75
+ desc = desc.content;
76
+ }
77
+ // If `icon` is not the ['https://', 'http://', '//'] protocol, splice on the `origin` of the a tag
78
+ if (icon && !isHttp(icon)) icon = new URL(link).origin + icon
79
+ cardLink.caches[link] = { title, link, icon, desc }
80
+
81
+ renderer(el, cardLink.caches[link])
82
+ }
83
+ } catch (error) {
84
+ // eslint-disable-next-line no-console
85
+ console.warn('CardLink Error: Failed to parse', error)
86
+ }
87
+ }
88
+
89
+ function fetchPage(link, callback) {
90
+ fetch(link)
91
+ .then((result) => result.text())
92
+ .then(callback)
93
+ .catch((error) => {
94
+ const server = cardLink.server
95
+ // eslint-disable-next-line no-console
96
+ if (link.includes(server) || !server) return console.error('CardLink Error:', error)
97
+ fetchPage(server + link, callback)
98
+ })
99
+ }
100
+
101
+ /**
102
+ * Create card links
103
+ * @param {NodeList} nodes A collection of nodes or a collection of arrays,
104
+ * if it is an array then the array must always contain node element
105
+ */
106
+ function setCardLink(nodes) {
107
+ // If the `nodes` do not contain a `forEach` method, then the default `a[cardlink]` is used
108
+ nodes = 'forEach' in (nodes || {}) ? nodes : document.querySelectorAll('a[cardlink]')
109
+ nodes.forEach((el) => {
110
+ // If it is not a tag element then it is not processed
111
+ if (el.nodeType !== 1) return
112
+ el.removeAttribute('cardlink')
113
+ const link = el.href
114
+
115
+ const cache = cardLink.caches[link]
116
+ if (cache) return renderer(el, cache)
117
+
118
+ if (isHttp(link)) {
119
+ fetchPage(link, (html) => {
120
+ getInfo(el, html, link)
121
+ })
122
+ }
123
+ })
124
+ }
@@ -44,14 +44,14 @@ const sitesjs = {
44
44
  },
45
45
  layout: (cfg) => {
46
46
  const el = $(cfg.el)[0];
47
- $(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>');
47
+ $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>');
48
48
  sitesjs.requestAPI(cfg.api, function(data) {
49
49
  $(el).find('.loading-wrap').remove();
50
50
  const arr = data.content;
51
51
  arr.forEach((item, i) => {
52
52
  var cell = '<div class="site-card">';
53
53
  cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">';
54
- cell += '<img src="' + (item.screenshot || ('https://image.thum.io/get/width/1024/crop/768/' + item.url)) + '" onerror="javascript:this.src=\'' + cfg.screenshot + '\';"/>';
54
+ cell += '<img src="' + (item.screenshot || ('https://screenshot-api.xaoxuu.com/api?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.src=\'' + cfg.screenshot + '\';"/>';
55
55
  cell += '<div class="info">';
56
56
  cell += '<img src="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';"/>';
57
57
  cell += '<span class="title">' + item.title + '</span>';
@@ -63,7 +63,8 @@ const sitesjs = {
63
63
  });
64
64
  }, function() {
65
65
  $(el).find('.loading-wrap svg').remove();
66
- $(el).find('.loading-wrap p').text('加载失败,请稍后重试。');
66
+ $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" d="M12 3L21 20H3L12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.5s" values="60;0"/></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 10V14"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="6;0"/></path></g><circle cx="12" cy="17" r="1" fill="currentColor" fill-opacity="0"><animate fill="freeze" attributeName="fill-opacity" begin="0.8s" dur="0.4s" values="0;1"/></circle></svg>');
67
+ $(el).find('.loading-wrap').addClass('error');
67
68
  });
68
69
  },
69
70
  }
@@ -54,20 +54,24 @@ const StellarTimeline = {
54
54
  },
55
55
  layoutDiv: (cfg) => {
56
56
  const el = $(cfg.el)[0];
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>');
57
+ $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>');
58
58
  StellarTimeline.requestAPI(cfg.api, function(data) {
59
59
  $(el).find('.loading-wrap').remove();
60
- const user = el.getAttribute('user');
61
60
  const arr = data.content || data;
61
+ var users = [];
62
+ const filter = el.getAttribute('user');
63
+ if (filter && filter.length > 0) {
64
+ users = filter.split(",");
65
+ }
62
66
  arr.forEach((item, i) => {
63
- if (item.user && item.user.login && user && user.length > 0) {
64
- if (!user.includes(item.user.login)) {
67
+ if (item.user && item.user.login && users.length > 0) {
68
+ if (!users.includes(item.user.login)) {
65
69
  return;
66
70
  }
67
71
  }
68
72
  var cell = '<div class="timenode" index="' + i + '">';
69
73
  cell += '<div class="header">';
70
- if (!user && item.user) {
74
+ if (!users.length && item.user) {
71
75
  cell += '<a class="user-info" href="' + item.user.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
72
76
  cell += '<img src="' + item.user.avatar_url + '">';
73
77
  cell += '<span>' + item.user.login + '</span>';
@@ -123,7 +127,8 @@ const StellarTimeline = {
123
127
  });
124
128
  }, function() {
125
129
  $(el).find('.loading-wrap svg').remove();
126
- $(el).find('.loading-wrap p').text('加载失败,请稍后重试。');
130
+ $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" d="M12 3L21 20H3L12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.5s" values="60;0"/></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 10V14"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="6;0"/></path></g><circle cx="12" cy="17" r="1" fill="currentColor" fill-opacity="0"><animate fill="freeze" attributeName="fill-opacity" begin="0.8s" dur="0.4s" values="0;1"/></circle></svg>');
131
+ $(el).find('.loading-wrap').addClass('error');
127
132
  });
128
133
  },
129
134
  }