hexo-theme-stellar 1.20.0 → 1.22.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 (56) hide show
  1. package/README.md +3 -3
  2. package/_config.yml +26 -17
  3. package/languages/zh-CN.yml +1 -1
  4. package/languages/zh-TW.yml +1 -1
  5. package/layout/404.ejs +1 -1
  6. package/layout/_partial/cover/wiki_cover.ejs +9 -15
  7. package/layout/_partial/head.ejs +1 -1
  8. package/layout/_partial/main/article/article_footer.ejs +11 -16
  9. package/layout/_partial/main/navbar/breadcrumb.ejs +4 -4
  10. package/layout/_partial/main/post_list/post_card.ejs +1 -1
  11. package/layout/_partial/main/post_list/wiki_card.ejs +6 -11
  12. package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
  13. package/layout/_partial/sidebar/index.ejs +1 -1
  14. package/layout/_partial/widgets/ghuser.ejs +1 -1
  15. package/layout/_partial/widgets/related.ejs +12 -21
  16. package/layout/_partial/widgets/toc.ejs +5 -2
  17. package/layout/index.ejs +6 -7
  18. package/layout/post.ejs +1 -1
  19. package/layout/wiki.ejs +1 -1
  20. package/package.json +1 -1
  21. package/scripts/events/lib/doc_tree.js +24 -10
  22. package/scripts/helpers/category_color.js +18 -5
  23. package/scripts/tags/index.js +3 -1
  24. package/scripts/tags/lib/banner.js +67 -0
  25. package/scripts/tags/lib/{ablock.js → box.js} +3 -3
  26. package/scripts/tags/lib/gallery.js +58 -0
  27. package/scripts/tags/lib/navbar.js +15 -34
  28. package/scripts/tags/lib/swiper.js +1 -1
  29. package/scripts/tags/lib/timeline.js +3 -3
  30. package/source/css/_common/highlight.styl +1 -0
  31. package/source/css/_layout/list.styl +12 -4
  32. package/source/css/_layout/md.styl +1 -1
  33. package/source/css/_layout/partial/cover.styl +2 -0
  34. package/source/css/_layout/partial/paginator.styl +2 -2
  35. package/source/css/_layout/tag-plugins/banner.styl +107 -0
  36. package/source/css/_layout/tag-plugins/common.styl +5 -2
  37. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  38. package/source/css/_layout/tag-plugins/gallery.styl +95 -0
  39. package/source/css/_layout/tag-plugins/grid.styl +0 -9
  40. package/source/css/_layout/tag-plugins/note.styl +1 -0
  41. package/source/css/_layout/tag-plugins/timeline.styl +14 -1
  42. package/source/css/_layout/widgets/ghuser.styl +5 -6
  43. package/source/css/_layout/widgets/toc_common.styl +12 -1
  44. package/source/css/_plugins/copycode.styl +17 -6
  45. package/source/css/_plugins/fancybox.styl +4 -0
  46. package/source/css/_plugins/index.styl +2 -0
  47. package/source/css/{_layout/partial/ai_abstract.styl → _plugins/tianli_gpt.styl} +2 -2
  48. package/source/js/main.js +29 -4
  49. package/source/js/plugins/copycode.js +0 -4
  50. package/source/js/plugins/fcircle.js +3 -3
  51. package/source/js/plugins/friends.js +3 -3
  52. package/source/js/plugins/memos.js +133 -0
  53. package/source/js/plugins/sites.js +4 -4
  54. package/source/js/plugins/timeline.js +3 -3
  55. package/source/js/plugins/weibo.js +3 -3
  56. /package/layout/_partial/{main/article/ai_abstract.ejs → plugins/ai/tianli_gpt.ejs} +0 -0
@@ -8,15 +8,22 @@
8
8
  padding: 4px 0.5rem
9
9
  opacity: 0
10
10
  font-weight: 700
11
- color: var(--theme)
11
+ color: var(--text-p2)
12
+ border-bottom-left-radius: $border-bar
13
+ border-bottom-right-radius: $border-bar
14
+ background: var(--block-hover)
15
+ display: block
12
16
  cursor: pointer
17
+ margin-right: 0.5rem
13
18
 
14
- .highlight:hover .copy-btn
15
- opacity 0.25
19
+ .highlight:hover
20
+ .code:before
21
+ opacity: 0
22
+ .copy-btn
23
+ opacity: 0.75
16
24
 
17
25
  .highlight .code .copy-btn:hover
18
- color: var(--theme)
19
- opacity: 0.75
26
+ opacity: 1
20
27
 
21
28
  .highlight .code .copy-btn.success
22
29
  color: $c-green
@@ -24,4 +31,8 @@
24
31
 
25
32
  .highlight .code .copy-btn.warning
26
33
  color: $c-orange
27
- opacity: 0.75
34
+ opacity: 0.75
35
+
36
+ .md-text .tag-plugin[child=codeblock]
37
+ .highlight .code .copy-btn
38
+ border-radius: $border-bar
@@ -3,3 +3,7 @@ img[fancybox='true']
3
3
 
4
4
  .swiper-slide
5
5
  cursor: zoom-in
6
+
7
+ .tag-plugin.gallery
8
+ img
9
+ cursor: zoom-in
@@ -13,6 +13,8 @@ if hexo-config('plugins.mermaid.enable')
13
13
  @import 'mermaid'
14
14
  if hexo-config('plugins.copycode.enable')
15
15
  @import 'copycode'
16
+ if hexo-config('plugins.tianli_gpt.enable')
17
+ @import 'tianli_gpt'
16
18
 
17
19
 
18
20
  // 评论
@@ -1,4 +1,4 @@
1
- :root
1
+ .post-TianliGPT
2
2
  --heo-none: #00000000
3
3
  --heo-theme = var(--theme-link)
4
4
  --heo-main: var(--theme-link)
@@ -7,7 +7,7 @@
7
7
  --heo-background: var(--site-bg)
8
8
  --heo-hovertext: var(--text-code)
9
9
  --heo-secondtext: var(--text-p0)
10
- --heo-scrollbar: rgba(60, 60, 67, 0.4)
10
+ --heo-scrollbar: var(--block-border)
11
11
  --heo-secondbg: var(--block)
12
12
  --heo-card-bg: var(--block)
13
13
  --heo-card-bg-none: rgba(255, 255, 255, 0)
package/source/js/main.js CHANGED
@@ -244,9 +244,12 @@ if (stellar.plugins.stellar) {
244
244
  const els = document.getElementsByClassName('stellar-' + key + '-api');
245
245
  if (els != undefined && els.length > 0) {
246
246
  stellar.jQuery(() => {
247
- stellar.loadScript(js, { defer: true });
248
- if (key == 'timeline') {
249
- stellar.loadScript(stellar.plugins.marked);
247
+ if (key == 'timeline' || 'memos') {
248
+ stellar.loadScript(stellar.plugins.marked).then(function () {
249
+ stellar.loadScript(js, { defer: true });
250
+ });
251
+ } else {
252
+ stellar.loadScript(js, { defer: true });
250
253
  }
251
254
  })
252
255
  }
@@ -299,13 +302,35 @@ if (stellar.plugins.preload) {
299
302
  }
300
303
  }
301
304
 
305
+ function loadFancybox() {
306
+ stellar.loadCSS(stellar.plugins.fancybox.css);
307
+ stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
308
+ Fancybox.bind(selector, {
309
+ groupAll: true,
310
+ hideScrollbar: false,
311
+ Thumbs: {
312
+ autoStart: false,
313
+ },
314
+ caption: function (fancybox, carousel, slide) {
315
+ return slide.$trigger.alt || null
316
+ }
317
+ });
318
+ })
319
+ }
302
320
  // fancybox
303
321
  if (stellar.plugins.fancybox) {
304
322
  let selector = 'img[fancybox]:not(.error)';
305
323
  if (stellar.plugins.fancybox.selector) {
306
324
  selector += `, ${stellar.plugins.fancybox.selector}`
307
325
  }
308
- if (document.querySelectorAll(selector).length !== 0) {
326
+ var needFancybox = document.querySelectorAll(selector).length !== 0;
327
+ if (!needFancybox) {
328
+ const els = document.getElementsByClassName('stellar-memos-api');
329
+ if (els != undefined && els.length > 0) {
330
+ needFancybox = true;
331
+ }
332
+ }
333
+ if (needFancybox) {
309
334
  stellar.loadCSS(stellar.plugins.fancybox.css);
310
335
  stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
311
336
  Fancybox.bind(selector, {
@@ -1,12 +1,8 @@
1
1
  const codeElementArr = document.querySelectorAll('.code')
2
2
  codeElementArr.forEach(code => {
3
- const codeBeforeWidth = window.getComputedStyle(code, '::before').width.split('px')[0]
4
- const codeBeforePadding = window.getComputedStyle(code, '::before').padding.split(' ').pop().split('px')[0]
5
-
6
3
  // copy btn
7
4
  const codeCopyBtn = document.createElement('div')
8
5
  codeCopyBtn.classList.add('copy-btn')
9
- codeCopyBtn.style.right = Number(codeBeforeWidth) + Number(codeBeforePadding) * 2 + 'px'
10
6
  codeCopyBtn.innerText = stellar.plugins.copycode.default_text
11
7
 
12
8
  code.appendChild(codeCopyBtn)
@@ -44,7 +44,7 @@ const FCircle = {
44
44
  },
45
45
  layoutDiv: (cfg) => {
46
46
  const el = $(cfg.el)[0];
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>');
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
  FCircle.requestAPI(cfg.api, function(data) {
49
49
  $(el).find('.loading-wrap').remove();
50
50
  const arr = data.article_data || [];
@@ -69,7 +69,7 @@ const FCircle = {
69
69
  });
70
70
  }, function() {
71
71
  $(el).find('.loading-wrap svg').remove();
72
- $(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>');
72
+ $(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>');
73
73
  $(el).find('.loading-wrap').addClass('error');
74
74
  });
75
75
  },
@@ -86,7 +86,7 @@ $(function () {
86
86
  var cfg = new Object();
87
87
  cfg.el = el;
88
88
  cfg.api = api;
89
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/avatar/round/3442075.svg';
89
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
90
90
  FCircle.layoutDiv(cfg);
91
91
  }
92
92
  });
@@ -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 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>');
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
50
  const arr = data.content || data;
@@ -60,7 +60,7 @@ const friendsjs = {
60
60
  });
61
61
  }, function() {
62
62
  $(el).find('.loading-wrap svg').remove();
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>');
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>');
64
64
  $(el).find('.loading-wrap').addClass('error');
65
65
  });
66
66
  },
@@ -78,7 +78,7 @@ $(function () {
78
78
  cfg.el = el;
79
79
  cfg.api = api;
80
80
  cfg.class = el.getAttribute('class');
81
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/avatar/round/3442075.svg';
81
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
82
82
  friendsjs.layout(cfg);
83
83
  }
84
84
  });
@@ -0,0 +1,133 @@
1
+ const MemosJS = {
2
+ requestAPI: (url, callback, timeout) => {
3
+ let retryTimes = 5;
4
+ function request() {
5
+ return new Promise((resolve, reject) => {
6
+ let status = 0; // 0 等待 1 完成 2 超时
7
+ let timer = setTimeout(() => {
8
+ if (status === 0) {
9
+ status = 2;
10
+ timer = null;
11
+ reject('请求超时');
12
+ if (retryTimes == 0) {
13
+ timeout();
14
+ }
15
+ }
16
+ }, 5000);
17
+ fetch(url).then(function(response) {
18
+ if (status !== 2) {
19
+ clearTimeout(timer);
20
+ resolve(response);
21
+ timer = null;
22
+ status = 1;
23
+ }
24
+ if (response.ok) {
25
+ return response.json();
26
+ }
27
+ throw new Error('Network response was not ok.');
28
+ }).then(function(data) {
29
+ retryTimes = 0;
30
+ callback(data);
31
+ }).catch(function(error) {
32
+ if (retryTimes > 0) {
33
+ retryTimes -= 1;
34
+ setTimeout(() => {
35
+ request();
36
+ }, 5000);
37
+ } else {
38
+ timeout();
39
+ }
40
+ });
41
+ });
42
+ }
43
+ request();
44
+ },
45
+ layoutDiv: (cfg) => {
46
+ const el = $(cfg.el)[0];
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
+ MemosJS.requestAPI(cfg.api, function(data) {
49
+ $(el).find('.loading-wrap').remove();
50
+ var users = [];
51
+ const filter = el.getAttribute('user');
52
+ if (filter && filter.length > 0) {
53
+ users = filter.split(",");
54
+ }
55
+ var hide = [];
56
+ const hideStr = el.getAttribute('hide');
57
+ if (hideStr && hideStr.length > 0) {
58
+ hide = hideStr.split(",");
59
+ }
60
+ data.forEach((item, i) => {
61
+ if (cfg.limit && i >= cfg.limit) {
62
+ return;
63
+ }
64
+ if (item.user && item.user.login && users.length > 0) {
65
+ if (!users.includes(item.user.login)) {
66
+ return;
67
+ }
68
+ }
69
+ let date = new Date(item.createdTs * 1000)
70
+ var cell = '<div class="timenode" index="' + i + '">';
71
+ cell += '<div class="header">';
72
+ if (!users.length && !hide.includes('user')) {
73
+ cell += '<div class="user-info">';
74
+ if (cfg.avatar?.length > 0) {
75
+ cell += `<img src="${cfg.avatar}">`;
76
+ }
77
+ cell += '<span>' + item.creatorName + '</span>';
78
+ cell += '</div>';
79
+ }
80
+ cell += '<p>' + date.toLocaleString() + '</p>';
81
+ cell += '</div>';
82
+ cell += '<div class="body">';
83
+ cell += marked.parse(item.content || '');
84
+ var imgs = [];
85
+ for (let res of item.resourceList) {
86
+ if (res.type?.includes('image/')) {
87
+ imgs.push(res);
88
+ }
89
+ }
90
+ if (imgs.length > 0) {
91
+ cell += '<div class="tag-plugin image">';
92
+ for (let img of imgs) {
93
+ if (img.externalLink?.length > 0) {
94
+ cell += `<div class="image-bg"><img src="${img.externalLink}" fancybox="true"></div>`;
95
+ } else {
96
+ cell += `<div class="image-bg"><img src="https://${cfg.host}/o/r/${img.id}" fancybox="true"></div>`;
97
+ }
98
+
99
+ }
100
+ cell += '</div>';
101
+ }
102
+ cell += '</div>';
103
+ cell += '</div>';
104
+ $(el).append(cell);
105
+ });
106
+ }, function() {
107
+ $(el).find('.loading-wrap svg').remove();
108
+ $(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>');
109
+ $(el).find('.loading-wrap').addClass('error');
110
+ });
111
+ },
112
+ }
113
+
114
+ $(function () {
115
+ const els = document.getElementsByClassName('stellar-memos-api');
116
+ for (var i = 0; i < els.length; i++) {
117
+ const el = els[i];
118
+ const api = el.getAttribute('api');
119
+ if (api == null) {
120
+ continue;
121
+ }
122
+ var cfg = new Object();
123
+ cfg.el = el;
124
+ cfg.api = api;
125
+ cfg.limit = el.getAttribute('limit');
126
+ cfg.host = api.replace(/https:\/\/(.*?)\/(.*)/i, '$1');
127
+ cfg.avatar = el.getAttribute('avatar');
128
+ if (!cfg.avatar) {
129
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
130
+ }
131
+ MemosJS.layoutDiv(cfg);
132
+ }
133
+ });
@@ -44,7 +44,7 @@ const sitesjs = {
44
44
  },
45
45
  layout: (cfg) => {
46
46
  const el = $(cfg.el)[0];
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>');
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
50
  const arr = data.content;
@@ -63,7 +63,7 @@ const sitesjs = {
63
63
  });
64
64
  }, function() {
65
65
  $(el).find('.loading-wrap svg').remove();
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>');
66
+ $(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>');
67
67
  $(el).find('.loading-wrap').addClass('error');
68
68
  });
69
69
  },
@@ -81,8 +81,8 @@ $(function () {
81
81
  cfg.class = el.getAttribute('class');
82
82
  cfg.el = el;
83
83
  cfg.api = api;
84
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/link/8f277b4ee0ecd.svg';
85
- cfg.screenshot = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/cover/76b86c0226ffd.svg';
84
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/link/8f277b4ee0ecd.svg';
85
+ cfg.screenshot = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/cover/76b86c0226ffd.svg';
86
86
  sitesjs.layout(cfg);
87
87
  }
88
88
  });
@@ -54,7 +54,7 @@ const StellarTimeline = {
54
54
  },
55
55
  layoutDiv: (cfg) => {
56
56
  const el = $(cfg.el)[0];
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>');
57
+ $(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>');
58
58
  StellarTimeline.requestAPI(cfg.api, function(data) {
59
59
  $(el).find('.loading-wrap').remove();
60
60
  const query = new URL(cfg.api).search;
@@ -84,7 +84,7 @@ const StellarTimeline = {
84
84
  cell += '</a>';
85
85
  }
86
86
  let date = new Date(item.created_at);
87
- cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>';
87
+ cell += '<p>' + date.toLocaleString() + '</p>';
88
88
  cell += '</div>';
89
89
  cell += '<div class="body">';
90
90
  if (!hide.includes('title')) {
@@ -140,7 +140,7 @@ const StellarTimeline = {
140
140
  });
141
141
  }, function() {
142
142
  $(el).find('.loading-wrap svg').remove();
143
- $(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>');
143
+ $(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>');
144
144
  $(el).find('.loading-wrap').addClass('error');
145
145
  });
146
146
  },
@@ -44,7 +44,7 @@ const weibojs = {
44
44
  },
45
45
  layoutDiv: (cfg) => {
46
46
  const el = $(cfg.el)[0];
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>');
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
  weibojs.requestAPI(cfg.api, function(data) {
49
49
  $(el).find('.loading-wrap').remove();
50
50
  const arr = data.tweets || [];
@@ -93,7 +93,7 @@ const weibojs = {
93
93
  });
94
94
  }, function() {
95
95
  $(el).find('.loading-wrap svg').remove();
96
- $(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>');
96
+ $(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>');
97
97
  $(el).find('.loading-wrap').addClass('error');
98
98
  });
99
99
  },
@@ -110,7 +110,7 @@ $(function () {
110
110
  var cfg = new Object();
111
111
  cfg.el = el;
112
112
  cfg.api = api;
113
- cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/avatar/round/3442075.svg';
113
+ cfg.avatar = 'https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.9/avatar/round/3442075.svg';
114
114
  weibojs.layoutDiv(cfg);
115
115
  }
116
116
  });