hexo-theme-stellar 1.30.0 → 1.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/_config.yml +36 -31
  2. package/_data/icons.yml +3 -1
  3. package/layout/_partial/main/article/article_footer.ejs +1 -1
  4. package/layout/_partial/main/post_list/post_card.ejs +19 -14
  5. package/layout/_partial/scripts/utils.ejs +1 -1
  6. package/layout/layout.ejs +1 -1
  7. package/layout/page.ejs +1 -1
  8. package/package.json +1 -1
  9. package/scripts/tags/inline-labels.js +3 -0
  10. package/scripts/tags/lib/friends.js +4 -4
  11. package/scripts/tags/lib/okr.js +6 -6
  12. package/scripts/tags/lib/quot.js +16 -15
  13. package/scripts/tags/lib/sites.js +1 -1
  14. package/source/css/_common/base.styl +1 -1
  15. package/source/css/_common/blockquote.styl +16 -5
  16. package/source/css/_common/pre.styl +1 -0
  17. package/source/css/_components/list.styl +44 -12
  18. package/source/css/_components/md.styl +3 -46
  19. package/source/css/_components/pages/article-indent.styl +6 -0
  20. package/source/css/_components/pages/article-story.styl +120 -0
  21. package/source/css/_components/pages/article-tech.styl +35 -0
  22. package/source/css/_components/partial/article-banner.styl +32 -13
  23. package/source/css/_components/partial/article-footer.styl +24 -14
  24. package/source/css/_components/partial/related.styl +1 -1
  25. package/source/css/_components/sidebar/sidebar.styl +1 -0
  26. package/source/css/_components/tag-plugins/button.styl +11 -11
  27. package/source/css/_components/tag-plugins/common.styl +7 -4
  28. package/source/css/_components/tag-plugins/friends.styl +1 -2
  29. package/source/css/_components/tag-plugins/friends_posts.styl +160 -0
  30. package/source/css/_components/tag-plugins/inline-labels.styl +5 -0
  31. package/source/css/_components/tag-plugins/link.styl +2 -1
  32. package/source/css/_components/tag-plugins/mark.styl +1 -1
  33. package/source/css/_components/tag-plugins/mdrender.styl +15 -0
  34. package/source/css/_components/tag-plugins/note.styl +4 -1
  35. package/source/css/_components/tag-plugins/poetry.styl +2 -0
  36. package/source/css/_components/tag-plugins/quot.styl +51 -25
  37. package/source/css/_components/tag-plugins/sites.styl +22 -8
  38. package/source/css/_components/tag-plugins/tabs.styl +8 -10
  39. package/source/css/_components/tag-plugins/timeline.styl +12 -20
  40. package/source/css/_components/widgets/ghuser.styl +1 -1
  41. package/source/css/_components/widgets/markdown.styl +4 -3
  42. package/source/css/_components/widgets/related.styl +1 -1
  43. package/source/css/_components/widgets/tagcloud.styl +1 -1
  44. package/source/css/_components/widgets/timeline.styl +1 -1
  45. package/source/css/_custom.styl +6 -2
  46. package/source/css/_defines/const.styl +3 -0
  47. package/source/css/_defines/func.styl +10 -0
  48. package/source/css/_defines/theme.styl +9 -0
  49. package/source/js/services/artalk_latest_comment.js +2 -1
  50. package/source/js/services/fcircle.js +2 -1
  51. package/source/js/services/friends.js +2 -1
  52. package/source/js/services/friends_and_posts.js +58 -0
  53. package/source/js/services/ghinfo.js +2 -1
  54. package/source/js/services/giscus_latest_comment.js +2 -1
  55. package/source/js/services/mdrender.js +5 -2
  56. package/source/js/services/memos.js +2 -1
  57. package/source/js/services/sites.js +13 -5
  58. package/source/js/services/timeline.js +2 -1
  59. package/source/js/services/waline_latest_comment.js +2 -1
  60. package/source/js/services/weibo.js +2 -1
@@ -0,0 +1,15 @@
1
+ .ds-mdrender
2
+ p strong
3
+ font-size: $fs-body
4
+ font-weight: 500
5
+ color: var(--text)
6
+
7
+ .l_body[text-indent] article.content .ds-mdrender
8
+ p:not([class])
9
+ text-indent: 0
10
+
11
+
12
+ .l_body[type=story] .md-text.content
13
+ .ds-mdrender
14
+ ol,ul
15
+ margin-left: .5rem
@@ -29,7 +29,7 @@
29
29
  code
30
30
  background: none
31
31
  .md-text .tag-plugin.note:not([color])
32
- .highlight
32
+ .highlight, pre
33
33
  background: var(--block-hover)
34
34
  .md-text .tag-plugin.note[child=codeblock]
35
35
  padding: 0
@@ -66,3 +66,6 @@
66
66
 
67
67
  .md-text .tag-plugin .tag-plugin.note
68
68
  --gap-p: 1rem
69
+
70
+ .l_body[type=story] .tag-plugin.note .title p:not([class])
71
+ text-indent: 0
@@ -2,6 +2,8 @@
2
2
  display: flex
3
3
  flex-direction: column
4
4
  align-items: center
5
+ text-align: left
6
+ --fsp: $fs-body
5
7
  .content
6
8
  >.title
7
9
  font-weight: 500
@@ -31,32 +31,32 @@
31
31
  font-size: calc(var(--fsp) + 2px)
32
32
  color: var(--text)
33
33
 
34
- // type=text
35
- .md-text .tag-plugin.quot
36
- .content[type=text]
37
- &:before,&:after
38
- content: ""
39
- position: absolute
40
- width: 8px
41
- height: 14px
42
- &:before
43
- top: -8px
44
- left: 0
45
- border-top: 6px solid $color-accent
46
- border-left: 6px solid $color-accent
47
- &:after
48
- right: 0
49
- bottom: -8px
50
- border-right: 6px solid $color-accent
51
- border-bottom: 6px solid $color-accent
52
- h1.content[type=text]
53
- &:before,&:after
54
- width: 12px
55
- height: 20px
56
- border-width: 8px
34
+ // // type=text
35
+ // .md-text .tag-plugin.quot
36
+ // .content[type=text]
37
+ // &:before,&:after
38
+ // content: ""
39
+ // position: absolute
40
+ // width: 8px
41
+ // height: 14px
42
+ // &:before
43
+ // top: -8px
44
+ // left: 0
45
+ // border-top: 6px solid $color-accent
46
+ // border-left: 6px solid $color-accent
47
+ // &:after
48
+ // right: 0
49
+ // bottom: -8px
50
+ // border-right: 6px solid $color-accent
51
+ // border-bottom: 6px solid $color-accent
52
+ // h1.content[type=text]
53
+ // &:before,&:after
54
+ // width: 12px
55
+ // height: 20px
56
+ // border-width: 8px
57
57
 
58
58
  // type=icon
59
- .md-text .tag-plugin.quot .content[type=icon]
59
+ .md-text .tag-plugin.quot
60
60
  img,svg
61
61
  height: 1.5em
62
62
  display: inline-block
@@ -68,4 +68,30 @@
68
68
  padding-top: 1px
69
69
  span.empty
70
70
  padding: 0 8px
71
-
71
+
72
+ .md-text .tag-plugin.quot.p
73
+ .content
74
+ trans1 all
75
+ .content .text
76
+ position: relative
77
+ .content .text:after
78
+ content: ""
79
+ position: absolute
80
+ --width: 90%
81
+ width: var(--width)
82
+ height: 4px
83
+ left: calc(50% - var(--width) / 2)
84
+ bottom: -8px
85
+ border-radius: 100%
86
+ background: var(--text)
87
+ opacity: 0.2
88
+ filter: blur(2px)
89
+ trans1 all
90
+ &:hover
91
+ .content
92
+ transform: translateY(-4px) scale(1.05)
93
+ .text:after
94
+ opacity: 0.3
95
+ filter: blur(8px)
96
+ transform: translateY(4px) scale(1.2, 1.5)
97
+
@@ -15,6 +15,7 @@
15
15
  aspect-ratio: 1.5
16
16
  width: 100%
17
17
  height: 100%
18
+ border-radius: $border-card-s
18
19
  box-shadow: 0 1px 2px 0px rgba(0, 0, 0, 0.2)
19
20
  .info
20
21
  margin-top: 0.5rem
@@ -48,20 +49,33 @@
48
49
  overflow: hidden
49
50
  -webkit-line-clamp: 1
50
51
 
51
- .label
52
+ .labels
52
53
  position: absolute
53
- color: initial
54
- font-weight: 600
55
- top: 1px
56
- right: 0
57
- font-size: 10px
58
- padding: 2px 4px
59
- border-radius: 16px
54
+ top: 2px
55
+ right: 2px
56
+ display: flex
57
+ flex-wrap: wrap
58
+ justify-content: flex-end
59
+ pointer-events: none
60
+ user-select: none
61
+ opacity 1
62
+ trans1 all
63
+ .label
64
+ font-weight: 500
65
+ color: white
66
+ font-size: 12px
67
+ padding: 3px 6px 2px 6px
68
+ margin: 2px
69
+ line-height: 1
70
+ border-radius: 16px
60
71
 
61
72
  // transform
62
73
  .sites-wrap .site-card .card-link
63
74
  >img
64
75
  floatable-trans()
65
76
  &:hover
77
+ .labels
78
+ opacity 0
79
+ transform: translateY(-4px)
66
80
  >img
67
81
  floatable-float()
@@ -6,13 +6,15 @@
6
6
  flex-direction: column
7
7
  &[align=left]
8
8
  align-items: flex-start
9
- .nav-tabs
9
+ .nav-tabs,.tab-content
10
10
  align-self: flex-start
11
11
  &[align=center]
12
12
  align-items: center
13
+ .nav-tabs,.tab-content
14
+ align-items: center
13
15
  &[align=right]
14
16
  align-items: flex-end
15
- .nav-tabs
17
+ .nav-tabs,.tab-content
16
18
  align-self: flex-end
17
19
 
18
20
  .tag-plugin.tabs
@@ -75,18 +77,14 @@
75
77
  max-width: 100%
76
78
  text-align: justify
77
79
  margin-top: .5rem
80
+ display: flex
81
+ flex-direction: column
78
82
  .tab-pane
79
83
  display: block
84
+ overflow: hidden
80
85
  &:not(.active)
81
- visibility: hidden
82
86
  height: 0
83
87
  &.active
84
- visibility: visible
85
88
  height: auto
86
- .tab-content:has(.grid-box)
89
+ .tab-content:has(.grid-box),.tab-pane:has(.grid-box)
87
90
  width: 100%
88
-
89
- .l_body[text-indent] .md-text .tag-plugin.tabs .tab-content .tab-pane>p:not([class])
90
- text-indent: 'calc(%s * 2)' % var(--fsp)
91
- a
92
- text-indent: 0
@@ -15,6 +15,10 @@
15
15
  padding-left: 0
16
16
  &:before
17
17
  display: none
18
+ .l_body[type=story] .md-text.content
19
+ .tag-plugin.timeline
20
+ ol,ul
21
+ margin-left: 0
18
22
 
19
23
  .tag-plugin.timeline .timenode
20
24
  position: relative
@@ -82,7 +86,7 @@
82
86
 
83
87
  .tag-plugin.timeline .body
84
88
  background: var(--card)
85
- border-radius: $border-card
89
+ border-radius: 16px
86
90
  border-top-left-radius: 2px
87
91
  padding: 0.5rem 1rem
88
92
  margin-top: 4px
@@ -113,32 +117,21 @@
113
117
  font-weight: 700
114
118
  margin: 0.5rem 0 0.75rem
115
119
  line-height: 1.25
120
+ border-bottom: 1px solid var(--block-border)
116
121
  &:only-child
117
122
  margin-bottom: 0.5rem
118
123
  font-weight: 500
119
124
  a
120
125
  color: inherit
121
126
  text-decoration: none
122
- border-bottom: 2px solid $color-theme
127
+ padding-bottom: 0.75rem
128
+ display: inline-block
123
129
  trans1 all
124
- background: none
125
130
  &:hover
126
- background: none
127
- border-radius: 0
128
- border-bottom: 2px solid $color-hover
129
- >p:first-child:not([class]) a:not([class])
130
- padding: 0
131
- margin: 0
132
- color: inherit
133
- text-decoration: none
134
- border-bottom: 2px solid $color-theme
135
- trans1 all
136
- background: none
137
- &:hover
138
- background: none
139
- border-radius: 0
140
- border-bottom: 2px solid $color-hover
141
-
131
+ color: $color-hover
132
+ >p:first-child:not([class])
133
+ font-size: 1rem
134
+ margin: .25rem 0 .5rem
142
135
 
143
136
  a
144
137
  &:has(img):after
@@ -159,7 +152,6 @@
159
152
  flex-wrap: wrap
160
153
  justify-content: space-between
161
154
  align-items: stretch
162
- background: var(--card)
163
155
  span
164
156
  line-height: 1.8
165
157
  &:empty
@@ -4,7 +4,7 @@
4
4
  .widget-wrapper.user-card .widget-body
5
5
  text-align: center
6
6
  background: var(--card)
7
- border-radius: $border-card
7
+ border-radius: $border-card-s
8
8
  padding: 1rem
9
9
  box-shadow: $boxshadow-card
10
10
 
@@ -1,9 +1,10 @@
1
1
  .widget-wrapper.markdown
2
2
  .widget-body
3
- border-radius: $border-card
4
- padding: 4px 16px
3
+ border-radius: $border-card-s
4
+ padding: .25rem 1rem
5
5
  background: var(--alpha50)
6
-
6
+ >*:first-child
7
+ margin-top: .75rem
7
8
  a:not([class])
8
9
  trans1 all
9
10
  border-bottom: 1px solid var(--text)
@@ -7,7 +7,7 @@
7
7
  line-height: 1.2
8
8
  background: var(--alpha20)
9
9
  padding: 10px 16px
10
- border-radius: $border-card
10
+ border-radius: $border-card-s
11
11
  display: block
12
12
  border-left: 0
13
13
  box-sizing: border-box
@@ -1,5 +1,5 @@
1
1
  .widget-wrapper.tagcloud .widget-body
2
- border-radius: $border-card
2
+ border-radius: $border-card-s
3
3
  padding: 12px 16px
4
4
  background: var(--alpha50)
5
5
  a
@@ -24,7 +24,7 @@
24
24
  .header:before
25
25
  left: calc(6px - var(--gap-padding))
26
26
  .body
27
- border-radius: $border-card
27
+ border-radius: $border-card-s
28
28
  padding: 0.5rem 1rem
29
29
  p,li
30
30
  --fsp: $fsp3
@@ -18,6 +18,9 @@ $ff-codeblock = Menlo, Monaco, Consolas, system-ui, "Courier New", monospace, sa
18
18
  $ff-code = $ff-codeblock
19
19
  $ff-logo = $ff-body
20
20
 
21
+ $iQuoteLeft = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'%3E%3C!-- Icon from BoxIcons Solid by Atisa - https://creativecommons.org/licenses/by/4.0/ --%3E%3Cpath fill='currentColor' d='M3.691 6.292C5.094 4.771 7.217 4 10 4h1v2.819l-.804.161c-1.37.274-2.323.813-2.833 1.604A2.9 2.9 0 0 0 6.925 10H10a1 1 0 0 1 1 1v7c0 1.103-.897 2-2 2H3a1 1 0 0 1-1-1v-5l.003-2.919c-.009-.111-.199-2.741 1.688-4.789M20 20h-6a1 1 0 0 1-1-1v-5l.003-2.919c-.009-.111-.199-2.741 1.688-4.789C16.094 4.771 18.217 4 21 4h1v2.819l-.804.161c-1.37.274-2.323.813-2.833 1.604A2.9 2.9 0 0 0 17.925 10H21a1 1 0 0 1 1 1v7c0 1.103-.897 2-2 2'/%3E%3C/svg%3E"
22
+ $iQuoteRight = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'%3E%3C!-- Icon from BoxIcons Solid by Atisa - https://creativecommons.org/licenses/by/4.0/ --%3E%3Cpath fill='currentColor' d='M20.309 17.708C22.196 15.66 22.006 13.03 22 13V5a1 1 0 0 0-1-1h-6c-1.103 0-2 .897-2 2v7a1 1 0 0 0 1 1h3.078a2.9 2.9 0 0 1-.429 1.396c-.508.801-1.465 1.348-2.846 1.624l-.803.16V20h1c2.783 0 4.906-.771 6.309-2.292m-11.007 0C11.19 15.66 10.999 13.03 10.993 13V5a1 1 0 0 0-1-1h-6c-1.103 0-2 .897-2 2v7a1 1 0 0 0 1 1h3.078a2.9 2.9 0 0 1-.429 1.396c-.508.801-1.465 1.348-2.846 1.624l-.803.16V20h1c2.783 0 4.906-.771 6.309-2.292'/%3E%3C/svg%3E"
23
+
21
24
  if hexo-config('style.font-family.body')
22
25
  $ff-body = convert(hexo-config('style.font-family.body'))
23
26
 
@@ -55,9 +58,10 @@ $fsp3 = 'calc(%s - 3px)' % $fs-body
55
58
 
56
59
  $border-card-l = convert(hexo-config('style.border-radius.card-l'))
57
60
  $border-card = convert(hexo-config('style.border-radius.card'))
61
+ $border-card-s = convert(hexo-config('style.border-radius.card-s'))
58
62
  $border-bar = convert(hexo-config('style.border-radius.bar'))
59
63
  $border-image = convert(hexo-config('style.border-radius.image'))
60
- $border-button = 4px
64
+ $border-button = 8px
61
65
 
62
66
  // 可以动态变化的属性
63
67
  :root
@@ -94,7 +98,7 @@ $border-button = 4px
94
98
  --gap-max: calc(var(--gap-margin) + var(--gap-padding))
95
99
 
96
100
  // 文章布局风格
97
- .l_body.story
101
+ .l_body[type=story]
98
102
  --gap-p: 2rem
99
103
  div.tag-plugin,p>img
100
104
  margin-top: 2.4rem
@@ -48,3 +48,6 @@ $c-green = #3DC550
48
48
  $c-cyan = #1BCDFC
49
49
  $c-blue = #2196f3
50
50
  $c-purple = #9c27b0
51
+
52
+ $hue-yellow = 50
53
+ $cDeepOrange = hsl(14 100% 57%)
@@ -1,3 +1,13 @@
1
+ svg-mask-icon($svg)
2
+ -webkit-mask-image: url($svg)
3
+ -webkit-mask-repeat: no-repeat
4
+ -webkit-mask-position: center
5
+ -webkit-mask-size: contain
6
+ mask-image: url($svg)
7
+ mask-repeat: no-repeat
8
+ mask-position: center
9
+ mask-size: contain
10
+
1
11
 
2
12
  // // 可替代 transition 使用
3
13
  // transition($op = all, $time = 0.28s, $ease = ease-out)
@@ -1,3 +1,7 @@
1
+ // 通用 hsla 函数
2
+ hsla-var(h = var(--hue), s = var(--sat), l = var(--light), a = 1)
3
+ return unquote('hsla(%s, %s, %s, %s)' % (h s l a))
4
+
1
5
  // Deprecated function. Keep for compatibility.
2
6
  theme($t)
3
7
  convert(hexo-config('style.prefers_theme')) == $t
@@ -43,6 +47,11 @@ _common_root()
43
47
  --theme-link: $color-link
44
48
  --theme-color: $color-theme
45
49
  --theme-color-opa: $color-theme-opa
50
+ // new
51
+ --hue: 50
52
+ --sat: 90%
53
+ --light: 80%
54
+ --dynamic-color: hsla-var()
46
55
 
47
56
  _light_root()
48
57
  --site-bg: hsl($color-background-h, $color-background-s, $color-background-l)
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  if (api == null) {
10
10
  continue;
11
11
  }
12
- utils.request(el, api, function (data) {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  data = data.data || [];
14
15
  data.forEach((item, i) => {
15
16
  var cell = '<div class="timenode" index="' + i + '">';
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  }
10
10
  const default_avatar = def.avatar;
11
11
  // layout
12
- utils.request(el, api, function(data) {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  const arr = data.article_data || [];
14
15
  const limit = el.getAttribute('limit');
15
16
  arr.forEach((item, i) => {
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  }
10
10
  const default_avatar = def.avatar;
11
11
  // layout
12
- utils.request(el, api, function(data) {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  for (let item of (data.content || data)) {
14
15
  var cell = `<div class="grid-cell user-card">`;
15
16
  cell += `<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="${item.html_url || item.url}">`;;
@@ -0,0 +1,58 @@
1
+ utils.jq(() => {
2
+ $(function () {
3
+ const els = document.getElementsByClassName('ds-friends_and_posts');
4
+ for (var i = 0; i < els.length; i++) {
5
+ const el = els[i];
6
+ const api = el.getAttribute('api');
7
+ if (api == null) {
8
+ continue;
9
+ }
10
+ const default_avatar = def.avatar;
11
+ // layout
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
14
+ for (let item of (data.content || data)) {
15
+ var cell = `<div class="grid-cell user-post-card">`;
16
+ cell += `<div class="avatar-box">`;
17
+ cell += `<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="${item.html_url || item.url}">`;;
18
+ cell += `<img src="${item.avatar_url || item.avatar || item.icon || default_avatar}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${default_avatar}\';"/>`;
19
+ cell += `<span class="title">${item.title || item.login}</span>`;
20
+ cell += `</a>`;
21
+ cell += `<div class="labels">`;
22
+ for (let label of item.labels) {
23
+ if (label.lightness > 75) {
24
+ cell += `<div class="label" style="background:#${label.color};color:hsla(${label.hue}, ${label.saturation}%, 20%, 1);">${label.name}</div>`;
25
+ } else if (label.saturation > 90 && label.lightness > 40) {
26
+ cell += `<div class="label" style="background:#${label.color};color:hsla(${label.hue}, 50%, 20%, 1);">${label.name}</div>`;
27
+ } else {
28
+ cell += `<div class="label" style="background:#${label.color};color:white">${label.name}</div>`;
29
+ }
30
+ }
31
+ cell += `</div>`;
32
+ cell += `</div>`;
33
+ cell += `<div class="previews">`;
34
+ if (item.description) {
35
+ cell += `<div class="desc">${item.description || item.issue_number || ''}</div>`;
36
+ } else {
37
+ cell += `<div class="desc">#${item.issue_number}</div>`;
38
+ }
39
+ cell += `<div class="posts">`;
40
+ if (item.posts?.length > 0) {
41
+ for (let post of item.posts) {
42
+ cell += `<a class="post-link" target="_blank" rel="external nofollow noopener noreferrer" href="${post.link}">`;
43
+ cell += `<span class="title">${post.title}</span>`;
44
+ cell += `<span class="date">${post.published}</span>`;
45
+ cell += `</a>`;
46
+ }
47
+ } else {
48
+ cell += `<span class="no-post">${item.feed?.length > 0 ? 'RSS 解析失败' : '未设置 RSS 链接'}</span>`;
49
+ }
50
+ cell += `</div>`;
51
+ cell += `</div>`;
52
+ cell += `</div>`;
53
+ $(el).find('.grid-box').append(cell);
54
+ }
55
+ });
56
+ }
57
+ });
58
+ });
@@ -8,7 +8,8 @@ utils.jq(() => {
8
8
  continue;
9
9
  }
10
10
  // layout
11
- utils.request(null, api, function(data) {
11
+ utils.request(null, api, async resp => {
12
+ const data = await resp.json();
12
13
  function fill(data) {
13
14
  for (let key of Object.keys(data)) {
14
15
  $(el).find("[type=text]#" + key).text(data[key]);
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  }
10
10
  const default_avatar = def.avatar;
11
11
  // layout
12
- utils.request(el, api, function(data) {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  const limit = el.getAttribute('limit');
14
15
  data.forEach((item, i) => {
15
16
  if (limit && i >= limit) {
@@ -3,8 +3,11 @@ utils.jq(() => {
3
3
  for (var i = 0; i < els.length; i++) {
4
4
  const el = els[i];
5
5
  const src = `${el.getAttribute('src')}?t=${new Date().getTime()}`;
6
- utils.request(el, src, function(data) {
7
- el.innerHTML = marked.parse(resp.data);
6
+ console.log('src', src);
7
+
8
+ utils.request(el, src, async resp => {
9
+ const data = await resp.text();
10
+ el.innerHTML = marked.parse(data);
8
11
  });
9
12
  }
10
13
  });
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  const limit = el.getAttribute('limit');
10
10
  const host = api.match(/https:\/\/(.*?)\/(.*)/i)[1];
11
11
 
12
- utils.request(el, api, async data => {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  let memos = versionHandlers.identify(data);
14
15
  if (memos.version === "feature" )return;
15
16
 
@@ -10,18 +10,26 @@ utils.jq(() => {
10
10
  const default_avatar = def.avatar;
11
11
  const default_cover = def.cover;
12
12
  // layout
13
- utils.request(el, api, function(data) {
13
+ utils.request(el, api, async resp => {
14
+ const data = await resp.json();
14
15
  for (let item of data.content) {
15
16
  var cell = `<div class="grid-cell site-card">`;
16
17
  cell += `<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="${item.url}">`;
17
- cell += `<img src="${item.cover || item.screenshot}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${default_cover}\';"/>`;
18
+ cell += `<img src="${item.cover || item.snapshot || item.screenshot}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${default_cover}\';"/>`;
18
19
  cell += `<div class="info">`;
19
20
  cell += `<img src="${item.icon || item.avatar || default_avatar}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${default_avatar}\';"/>`;
20
21
  cell += `<span class="title">${item.title}</span>`;
21
22
  cell += `<span class="desc">${item.description || item.url}</span>`;
22
- if (item.labels && item.labels.length > 0) {
23
- let label = item.labels[0];
24
- cell += `<span class="label" style="background:#${label.color};">${label.name}</span>`;
23
+ cell += `</div>`;
24
+ cell += `<div class="labels">`;
25
+ for (let label of item.labels) {
26
+ if (label.lightness > 75) {
27
+ cell += `<div class="label" style="background:#${label.color};color:hsla(${label.hue}, ${label.saturation}%, 20%, 1);">${label.name}</div>`;
28
+ } else if (label.saturation > 90 && label.lightness > 40) {
29
+ cell += `<div class="label" style="background:#${label.color};color:hsla(${label.hue}, 50%, 20%, 1);">${label.name}</div>`;
30
+ } else {
31
+ cell += `<div class="label" style="background:#${label.color};color:white">${label.name}</div>`;
32
+ }
25
33
  }
26
34
  cell += `</div>`;
27
35
  cell += `</a>`;
@@ -18,7 +18,8 @@ utils.jq(() => {
18
18
  continue;
19
19
  }
20
20
  // layout
21
- utils.request(el, api, function(data) {
21
+ utils.request(el, api, async resp => {
22
+ const data = await resp.json();
22
23
  const query = new URL(api).search;
23
24
  const arr = data.content || data;
24
25
  var users = [];
@@ -10,7 +10,8 @@ utils.jq(() => {
10
10
  }
11
11
  const api = apiBase + '/comment?type=recent&count=' + limit;
12
12
  const default_avatar = def.avatar;
13
- utils.request(el, api, function(data) {
13
+ utils.request(el, api, async resp => {
14
+ const data = await resp.json();
14
15
  data.forEach((item, i) => {
15
16
  var cell = '<div class="timenode" index="' + i + '">';
16
17
  cell += '<div class="header">';
@@ -9,7 +9,8 @@ utils.jq(() => {
9
9
  }
10
10
  const default_avatar = el.getAttribute('avatar') || def.avatar;
11
11
  // layout
12
- utils.request(el, api, function(data) {
12
+ utils.request(el, api, async resp => {
13
+ const data = await resp.json();
13
14
  const arr = data.tweets || [];
14
15
  const limit = el.getAttribute('limit');
15
16
  arr.forEach((item, i) => {