hexo-theme-stellar 1.22.1 → 1.24.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 (80) hide show
  1. package/_config.yml +21 -9
  2. package/_data/widgets.yml +3 -0
  3. package/languages/en.yml +1 -0
  4. package/languages/zh-CN.yml +1 -0
  5. package/languages/zh-TW.yml +1 -0
  6. package/layout/_partial/head.ejs +29 -19
  7. package/layout/_partial/main/article/article_footer.ejs +16 -5
  8. package/layout/_partial/main/footer.ejs +18 -24
  9. package/layout/_partial/main/navbar/author_banner.ejs +31 -0
  10. package/layout/_partial/main/navbar/breadcrumb.ejs +20 -4
  11. package/layout/_partial/main/post_list/post_card.ejs +13 -1
  12. package/layout/_partial/plugins/comments/giscus/script.ejs +0 -1
  13. package/layout/_partial/plugins/parser/head.ejs +3 -0
  14. package/layout/_partial/plugins/parser/katex/head.ejs +3 -0
  15. package/layout/_partial/plugins/parser/katex/script.ejs +4 -0
  16. package/layout/_partial/plugins/parser/mathjax/script.ejs +20 -0
  17. package/layout/_partial/plugins/parser/mermaid/script.ejs +29 -0
  18. package/layout/_partial/plugins/parser/script.ejs +9 -0
  19. package/layout/_partial/scripts/index.ejs +19 -5
  20. package/layout/_partial/sidebar/index.ejs +1 -1
  21. package/layout/_partial/widgets/markdown.ejs +7 -2
  22. package/layout/_partial/widgets/toc.ejs +1 -1
  23. package/layout/archive.ejs +54 -37
  24. package/layout/page.ejs +1 -4
  25. package/layout/post.ejs +1 -7
  26. package/layout/wiki.ejs +1 -4
  27. package/package.json +1 -1
  28. package/scripts/events/index.js +2 -0
  29. package/scripts/events/lib/authors.js +21 -0
  30. package/scripts/events/lib/doc_tree.js +1 -2
  31. package/scripts/events/lib/links.js +17 -0
  32. package/scripts/generators/author.js +22 -0
  33. package/scripts/tags/index.js +5 -0
  34. package/scripts/tags/lib/albums.js +47 -0
  35. package/scripts/tags/lib/audio.js +23 -0
  36. package/scripts/tags/lib/copy.js +11 -13
  37. package/scripts/tags/lib/friends.js +13 -24
  38. package/scripts/tags/lib/gallery.js +6 -5
  39. package/scripts/tags/lib/grid.js +30 -30
  40. package/scripts/tags/lib/md.js +20 -0
  41. package/scripts/tags/lib/posters.js +47 -0
  42. package/scripts/tags/lib/sites.js +15 -24
  43. package/scripts/tags/lib/swiper.js +1 -1
  44. package/scripts/tags/lib/video.js +23 -0
  45. package/source/css/_common/media.styl +9 -0
  46. package/source/css/_common/toast.styl +25 -5
  47. package/source/css/_custom.styl +2 -1
  48. package/source/css/_defines/func.styl +11 -0
  49. package/source/css/_defines/theme.styl +2 -2
  50. package/source/css/_layout/list.styl +10 -12
  51. package/source/css/_layout/main.styl +4 -0
  52. package/source/css/_layout/md.styl +3 -0
  53. package/source/css/_layout/pages/archives.styl +10 -10
  54. package/source/css/_layout/partial/bread-nav.styl +3 -5
  55. package/source/css/_layout/partial/cover.styl +1 -0
  56. package/source/css/_layout/partial/navbar.styl +5 -5
  57. package/source/css/_layout/tag-plugins/banner.styl +24 -10
  58. package/source/css/_layout/tag-plugins/copy.styl +16 -13
  59. package/source/css/_layout/tag-plugins/folding.styl +6 -0
  60. package/source/css/_layout/tag-plugins/friends.styl +10 -37
  61. package/source/css/_layout/tag-plugins/gallery.styl +32 -15
  62. package/source/css/_layout/tag-plugins/grid.styl +3 -10
  63. package/source/css/_layout/tag-plugins/link.styl +2 -5
  64. package/source/css/_layout/tag-plugins/note.styl +7 -0
  65. package/source/css/_layout/tag-plugins/sites.styl +11 -39
  66. package/source/css/_layout/tag-plugins/tabs.styl +2 -0
  67. package/source/css/_layout/widgets/ghrepo.styl +1 -4
  68. package/source/css/_layout/widgets/toc_common.styl +22 -8
  69. package/source/css/_plugins/copycode.styl +18 -16
  70. package/source/css/_plugins/fancybox.styl +1 -4
  71. package/source/css/_plugins/index.styl +1 -1
  72. package/source/css/_plugins/lazyload.styl +4 -4
  73. package/source/js/main.js +7 -9
  74. package/source/js/plugins/copycode.js +1 -1
  75. package/source/js/plugins/friends.js +11 -11
  76. package/source/js/plugins/marked.js +50 -0
  77. package/source/js/plugins/sites.js +13 -14
  78. package/_data/links.yml +0 -7
  79. package/layout/mathjax.ejs +0 -29
  80. package/layout/mermaid.ejs +0 -32
@@ -1,11 +1,7 @@
1
1
  .tag-plugin.grid
2
2
  display: grid
3
3
  grid-gap: 16px
4
- grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 16px)
5
- >.cell
6
- p:first-child>strong:only-child
7
- font-size: 1rem
8
- >.cell>
4
+ &[bg]>.cell>
9
5
  p
10
6
  line-height: 1.5
11
7
  :first-child
@@ -21,12 +17,9 @@
21
17
  &[bg]>.cell
22
18
  padding: 1rem
23
19
  border-radius: $border-card
24
- &[bg='block']>.cell
20
+ &[bg='box']>.cell
25
21
  background: var(--block)
26
22
  &[bg='card']>.cell
27
23
  background: var(--card)
28
24
  box-shadow: $boxshadow-card
29
- trans2 box-shadow transform
30
- &:hover
31
- transform: translateY(-1px)
32
- box-shadow: $boxshadow-card-float
25
+ hover-float()
@@ -9,14 +9,11 @@
9
9
  justify-content: space-between
10
10
  align-items: center
11
11
  cursor: pointer
12
- width: 320px
12
+ width: 340px
13
13
  max-width: 100%
14
14
  box-shadow: $boxshadow-card
15
15
  border-radius: $border-bar
16
- trans2: box-shadow transform
17
- &:hover
18
- box-shadow: $boxshadow-card-float
19
- transform: translateY(-1px)
16
+ hover-float()
20
17
 
21
18
  .md-text .link-card.plain
22
19
  flex-direction: row
@@ -40,6 +40,13 @@
40
40
  margin: 0
41
41
  border: none
42
42
  background: none
43
+ figcaption
44
+ span
45
+ background: var(--theme-block)
46
+ .highlight+.highlight
47
+ border-top: 1px dashed var(--theme-border)
48
+ border-top-left-radius: 0
49
+ border-top-right-radius: 0
43
50
 
44
51
  .md-text .tag-plugin.note[child=tabs]
45
52
  >.body
@@ -1,46 +1,19 @@
1
- .sites-wrap
2
- .group-header
3
- margin: 1rem 0
4
- p
5
- margin: 0
6
- font-size: $fs-14
7
- &:first-child
8
- font-size: 1.25rem
9
- font-weight: 500
10
- .group-body
11
- width: 100%
12
- &+.group-header
13
- margin-top: 2rem
14
- .stellar-sites-api
15
- display: block
16
-
17
- .sites-wrap .group-body
1
+ .sites-wrap .grid-box
18
2
  display: grid
3
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr))
19
4
  grid-gap: 1rem 1rem
20
- grid-template-columns: repeat(auto-fill, "calc((100% - 3 * %s) / 4)" % 1rem)
21
- @media screen and (max-width: $device-laptop)
22
- grid-template-columns: repeat(auto-fill, "calc((100% - 2 * %s) / 3)" % 1rem)
23
- @media screen and (max-width: 900px)
24
- grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 1rem)
25
- @media screen and (max-width: $device-mobile-max)
26
- grid-template-columns: repeat(auto-fill, "calc((100% - 2 * %s) / 3)" % 1rem)
27
- @media screen and (max-width: $device-mobile)
28
- grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 1rem)
5
+ .grid-cell
6
+ aspect-ratio: 1.5
29
7
 
30
- .sites-wrap .group-body .site-card .card-link
8
+ .sites-wrap .site-card .card-link
31
9
  width: 100%
32
10
  display: flex
33
11
  flex-direction: column
34
12
  >img
35
- width: 100%
36
- height 100px
37
- @media screen and (max-width: $device-laptop)
38
- height: 120px
39
- @media screen and (max-width: 900px)
40
- height: 150px
41
- @media screen and (max-width: $device-tablet)
42
- height: 120px
43
13
  object-fit: cover
14
+ aspect-ratio: 1.5
15
+ width: 100%
16
+ height: 100%
44
17
  box-shadow: 0 1px 2px 0px rgba(0, 0, 0, 0.2)
45
18
  .info
46
19
  margin-top: 0.5rem
@@ -71,13 +44,12 @@
71
44
  display: -webkit-box
72
45
  -webkit-box-orient: vertical
73
46
  overflow: hidden
74
- -webkit-line-clamp: 2
47
+ -webkit-line-clamp: 1
75
48
 
76
49
  // transform
77
50
  .sites-wrap .site-card .card-link
78
51
  >img
79
- trans2: box-shadow transform
52
+ floatable-trans()
80
53
  &:hover
81
54
  >img
82
- box-shadow: $boxshadow-float, $boxshadow-card-float
83
- transform: translateY(-2px)
55
+ floatable-float()
@@ -79,6 +79,8 @@
79
79
  display: none
80
80
  &.active
81
81
  display: block
82
+ .tab-content:has(.grid-box)
83
+ width: 100%
82
84
 
83
85
  .md-text.indent .tag-plugin.tabs .tab-content p:not([class])
84
86
  text-indent: 'calc(%s * 2)' % $fs-p
@@ -6,14 +6,11 @@
6
6
  background: var(--card)
7
7
  border-radius: $border-block
8
8
  box-shadow: $boxshadow-card
9
- trans2 box-shadow transform
9
+ hover-float()
10
10
  >div+div
11
11
  margin-top: 0.5rem
12
12
  span
13
13
  color: var(--text-p2)
14
- &:hover
15
- box-shadow: $boxshadow-card-float
16
- transform: translateY(-1px)
17
14
  svg
18
15
  margin-right: 4px
19
16
  .flex-row
@@ -69,14 +69,28 @@
69
69
  color: $color-theme !important
70
70
  &:before
71
71
  visibility: visible
72
+
73
+ // 始终折叠
74
+ .widget-wrapper.toc[collapse='true']
75
+ .toc-item a.toc-link+ol
76
+ display: none
77
+ // 激活上级目录时显示子目录
78
+ .toc a.toc-link.active+ol
79
+ display: block
72
80
 
81
+ // 自动折叠
82
+ .widget-wrapper.toc[collapse='auto']
83
+ .toc-item a.toc-link+ol
84
+ display: none
85
+ // 激活上级目录时显示子目录
86
+ .toc a.toc-link.active+ol
87
+ display: block
88
+ // 鼠标放上去时显示子目录
89
+ &:hover a.toc-link+ol
90
+ display: block
73
91
 
74
- // 激活上级目录时显示子目录
75
- .toc-item a.toc-link+ol
76
- display: none
77
- .toc a.toc-link.active+ol
78
- display: block
79
- ol:has(> .toc-item a.active)
80
- display: block
81
- .doc-tree:hover a.toc-link+ol
92
+ // 子目录激活时显示
93
+ .widget-wrapper.toc[collapse='true'] ol:has(> .toc-item a.active)
82
94
  display: block
95
+ .widget-wrapper.toc[collapse='auto'] ol:has(> .toc-item a.active)
96
+ display: block
@@ -5,34 +5,36 @@
5
5
  position: absolute
6
6
  top: 0
7
7
  right: 0
8
- padding: 4px 0.5rem
9
- opacity: 0
8
+ padding: 0px 0.5rem
10
9
  font-weight: 700
11
- color: var(--text-p2)
10
+ visibility: hidden
12
11
  border-bottom-left-radius: $border-bar
13
12
  border-bottom-right-radius: $border-bar
14
- background: var(--block-hover)
13
+ background: var(--card)
15
14
  display: block
16
15
  cursor: pointer
17
- margin-right: 0.5rem
16
+ margin-right: 4px
17
+ margin-top: 4px
18
+ border-radius: 'calc(%s - 4px)' % $border-block
18
19
 
19
20
  .highlight:hover
20
21
  .code:before
21
- opacity: 0
22
+ visibility: hidden
22
23
  .copy-btn
23
- opacity: 0.75
24
-
25
- .highlight .code .copy-btn:hover
26
- opacity: 1
24
+ visibility: visible
27
25
 
28
26
  .highlight .code .copy-btn.success
29
- color: $c-green
30
- opacity: 0.75
27
+ background: $c-green
28
+ color: white
29
+ visibility: visible
31
30
 
32
31
  .highlight .code .copy-btn.warning
33
- color: $c-orange
34
- opacity: 0.75
32
+ background: $c-orange
33
+ color: white
34
+ visibility: visible
35
35
 
36
- .md-text .tag-plugin[child=codeblock]
37
- .highlight .code .copy-btn
36
+ .md-text .folding[child=codeblock]
37
+ .code .copy-btn
38
+ z-index 1
39
+ margin-right: 1rem
38
40
  border-radius: $border-bar
@@ -1,9 +1,6 @@
1
1
  img[fancybox='true']
2
2
  cursor: zoom-in
3
3
 
4
- .swiper-slide
5
- cursor: zoom-in
6
-
7
- .tag-plugin.gallery
4
+ .fancybox
8
5
  img
9
6
  cursor: zoom-in
@@ -9,7 +9,7 @@ if hexo-config('plugins.scrollreveal.enable')
9
9
  @import 'scrollreveal'
10
10
  if hexo-config('plugins.fancybox.enable')
11
11
  @import 'fancybox'
12
- if hexo-config('plugins.mermaid.enable')
12
+ if hexo-config('plugins.mermaid.style_optimization')
13
13
  @import 'mermaid'
14
14
  if hexo-config('plugins.copycode.enable')
15
15
  @import 'copycode'
@@ -14,9 +14,9 @@ if hexo-config('plugins.lazyload.transition') == 'blur'
14
14
  &.loaded,&.error
15
15
  filter none
16
16
  -webkit-filter none
17
- .group-body .site-card .card-link>img
17
+ .site-card .card-link>img
18
18
  trans-site filter
19
- .group-body .user-card .card-link>img
19
+ .user-card .card-link>img
20
20
  trans-user filter
21
21
  else
22
22
  img.lazy
@@ -25,7 +25,7 @@ else
25
25
  opacity: 0
26
26
  &.loaded,&.error
27
27
  opacity: 1
28
- .group-body .site-card .card-link>img
28
+ .site-card .card-link>img
29
29
  trans-site opacity
30
- .group-body .user-card .card-link>img
30
+ .user-card .card-link>img
31
31
  trans-user opacity
package/source/js/main.js CHANGED
@@ -44,7 +44,7 @@ const util = {
44
44
  el.select();
45
45
  document.execCommand("Copy");
46
46
  if (msg && msg.length > 0) {
47
- hud.toast(msg);
47
+ hud.toast(msg, 2500);
48
48
  }
49
49
  }
50
50
  },
@@ -59,17 +59,15 @@ const util = {
59
59
 
60
60
  const hud = {
61
61
  toast: (msg, duration) => {
62
- duration = isNaN(duration) ? 2000 : duration;
62
+ const d = Number(isNaN(duration) ? 2000 : duration);
63
63
  var el = document.createElement('div');
64
64
  el.classList.add('toast');
65
+ el.classList.add('show');
65
66
  el.innerHTML = msg;
66
67
  document.body.appendChild(el);
67
- setTimeout(function () {
68
- var d = 0.5;
69
- el.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
70
- el.style.opacity = '0';
71
- setTimeout(function () { document.body.removeChild(el) }, d * 1000);
72
- }, duration);
68
+
69
+ setTimeout(function(){ document.body.removeChild(el) }, d);
70
+
73
71
  },
74
72
 
75
73
  }
@@ -244,7 +242,7 @@ if (stellar.plugins.stellar) {
244
242
  const els = document.getElementsByClassName('stellar-' + key + '-api');
245
243
  if (els != undefined && els.length > 0) {
246
244
  stellar.jQuery(() => {
247
- if (key == 'timeline' || 'memos') {
245
+ if (key == 'timeline' || 'memos' || 'marked') {
248
246
  stellar.loadScript(stellar.plugins.marked).then(function () {
249
247
  stellar.loadScript(js, { defer: true });
250
248
  });
@@ -13,7 +13,7 @@ codeElementArr.forEach(code => {
13
13
 
14
14
  codeCopyBtn.innerText = stellar.plugins.copycode.success_text
15
15
  codeCopyBtn.classList.add('success')
16
-
16
+ hud.toast(stellar.plugins.copycode.toast, 2500)
17
17
  setTimeout(() => {
18
18
  codeCopyBtn.innerText = stellar.plugins.copycode.default_text
19
19
  codeCopyBtn.classList.remove('success')
@@ -47,17 +47,17 @@ const friendsjs = {
47
47
  $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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
- const arr = data.content || data;
51
- arr.forEach((item, i) => {
52
- var user = '<div class="user-card">';
53
- user += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer"';
54
- user += ' href="' + (item.html_url || item.url) + '">';
55
- user += '<img src="' + (item.avatar_url || item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
56
- user += '<div class="name"><span>' + (item.title || item.login) + '</span></div>';
57
- user += '</a>';
58
- user += '</div>';
59
- $(el).find('.group-body').append(user);
60
- });
50
+ for (let item of (data.content || data)) {
51
+ var cell = `<div class="grid-cell user-card">`;
52
+ cell += `<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="${item.html_url || item.url}">`;;
53
+ cell += `<img src="${item.avatar_url || item.avatar || item.icon || cfg.avatar}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${cfg.avatar}\';"/>`;
54
+ cell += `<div class="name image-meta">`;
55
+ cell += `<span class="image-caption">${item.title || item.login}</span>`;
56
+ cell += `</div>`;
57
+ cell += `</a>`;
58
+ cell += `</div>`;
59
+ $(el).find('.grid-box').append(cell);
60
+ }
61
61
  }, function() {
62
62
  $(el).find('.loading-wrap svg').remove();
63
63
  $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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>');
@@ -0,0 +1,50 @@
1
+ const loadMarkdown = (cfg) => {
2
+ if (!window.fetch) {
3
+ cfg.el.innerHTML =
4
+ '<div style="font-size: 24px"><p>Your browser outdated. Please use the latest version of Chrome or Firefox!</p><p>您的浏览器版本过低,请使用最新版的 Chrome 或 Firefox 浏览器!</p></div>';
5
+ } else {
6
+ cfg.el.innerHTML =
7
+ '<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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>';
8
+ fetch(cfg.src, { method: "GET" })
9
+ .then((resp) => {
10
+ return Promise.all([
11
+ resp.ok,
12
+ resp.status,
13
+ resp.text(),
14
+ resp.headers,
15
+ ]);
16
+ })
17
+ .then(([ok, status, data, headers]) => {
18
+ if (ok) {
19
+ return {
20
+ ok,
21
+ status,
22
+ data,
23
+ headers,
24
+ };
25
+ } else {
26
+ throw new Error(JSON.stringify(json.error));
27
+ }
28
+ })
29
+ .then((resp) => {
30
+ let data = marked.parse(resp.data);
31
+ cfg.el.innerHTML = data;
32
+ })
33
+ .catch((error) => {
34
+ console.error(error);
35
+ cfg.el.innerHTML =
36
+ '<div class="loading-wrap error"><svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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></div>';
37
+ });
38
+ };
39
+ };
40
+
41
+ $(function () {
42
+ const els = document.getElementsByClassName('stellar-marked-api');
43
+ for (var i = 0; i < els.length; i++) {
44
+ var cfg = new Object();
45
+ const el = els[i];
46
+ cfg.src = `${el.getAttribute('src')}?t=${new Date().getTime()}`;
47
+ cfg.el = el;
48
+ loadMarkdown(cfg);
49
+ }
50
+ });
@@ -47,20 +47,19 @@ const sitesjs = {
47
47
  $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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
- const arr = data.content;
51
- arr.forEach((item, i) => {
52
- var cell = '<div class="site-card">';
53
- cell += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="' + item.url + '">';
54
- cell += '<img src="' + (item.screenshot || ('https://api.vlts.cc/screenshot?url=' + item.url + '&width=1280&height=720')) + '" onerror="javascript:this.src=\'' + cfg.screenshot + '\';"/>';
55
- cell += '<div class="info">';
56
- cell += '<img src="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';"/>';
57
- cell += '<span class="title">' + item.title + '</span>';
58
- cell += '<span class="desc">' + (item.description || item.url) + '</span>';
59
- cell += '</div>';
60
- cell += '</a>';
61
- cell += '</div>';
62
- $(el).find('.group-body').append(cell);
63
- });
50
+ for (let item of data.content) {
51
+ var cell = `<div class="grid-cell site-card">`;
52
+ cell += `<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer" href="${item.url}">`;
53
+ cell += `<img src="${item.cover || item.screenshot}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${cfg.screenshot}\';"/>`;
54
+ cell += `<div class="info">`;
55
+ cell += `<img src="${item.icon || item.avatar || cfg.avatar}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${cfg.avatar}\';"/>`;
56
+ cell += `<span class="title">${item.title}</span>`;
57
+ cell += `<span class="desc">${item.description || item.url}</span>`;
58
+ cell += `</div>`;
59
+ cell += `</a>`;
60
+ cell += `</div>`;
61
+ $(el).find('.grid-box').append(cell);
62
+ }
64
63
  }, function() {
65
64
  $(el).find('.loading-wrap svg').remove();
66
65
  $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" 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>');
package/_data/links.yml DELETED
@@ -1,7 +0,0 @@
1
- # 不要直接在这里写,要复制到 blog/source/_data/links.yml 位置
2
- '示例':
3
- - title: XAOXUU
4
- avatar: https://bu.dusays.com/2021/09/24/2f74810ceb3d3.png
5
- url: https://xaoxuu.com
6
- screenshot: https://bu.dusays.com/2022/10/23/63542895cfd29.png
7
- description:
@@ -1,29 +0,0 @@
1
- <% if (theme.plugins.mathjax.enable){ %>
2
- <script type="text/x-mathjax-config">
3
- MathJax.Hub.Config({
4
- tex2jax: {
5
- inlineMath: [ ['$','$'], ["\\(","\\)"] ],
6
- processEscapes: true
7
- }
8
- });
9
- </script>
10
-
11
- <script type="text/x-mathjax-config">
12
- MathJax.Hub.Config({
13
- tex2jax: {
14
- skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
15
- }
16
- });
17
- </script>
18
-
19
- <script type="text/x-mathjax-config">
20
- MathJax.Hub.Queue(function() {
21
- var all = MathJax.Hub.getAllJax(), i;
22
- for(i=0; i < all.length; i += 1) {
23
- all[i].SourceElement().parentNode.className += ' has-jax';
24
- }
25
- });
26
- </script>
27
-
28
- <script type="text/javascript" src="<%- theme.plugins.mathjax.cdn %>"></script>
29
- <% } %>
@@ -1,32 +0,0 @@
1
- <% if (theme.plugins.mermaid.enable) { %>
2
- <script type="text/javascript" src="<%- theme.plugins.mermaid.js %>"></script>
3
-
4
- <script>
5
- var mermaid_config = {
6
- startOnLoad: true,
7
- theme:
8
- "<%- theme.style.darkmode %>" == "auto" &&
9
- window.matchMedia("(prefers-color-scheme: dark)").matches
10
- ? "dark"
11
- : "<%- theme.plugins.mermaid.theme %>",
12
- logLevel: 3,
13
- themeVariables: {
14
- darkMode: true
15
- },
16
- flowchart: {
17
- useMaxWidth: false,
18
- htmlLabels: true,
19
- curve: "linear"
20
- },
21
- gantt: {
22
- axisFormat: "%Y/%m/%d"
23
- },
24
- sequence: {
25
- actorMargin: 50
26
- }
27
- }
28
- if (window.mermaid) {
29
- mermaid.initialize(mermaid_config);
30
- }
31
- </script>
32
- <% } %>