hexo-theme-stellar 1.26.7 → 1.27.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 (150) hide show
  1. package/_config.yml +134 -94
  2. package/_data/icons.yml +8 -1
  3. package/_data/widgets.yml +19 -7
  4. package/languages/en.yml +4 -2
  5. package/languages/zh-CN.yml +3 -1
  6. package/languages/zh-TW.yml +4 -2
  7. package/layout/404.ejs +1 -1
  8. package/layout/_partial/{plugins/comments → comments}/artalk/script.ejs +2 -2
  9. package/layout/_partial/{plugins/comments/utterances → comments/giscus}/layout.ejs +5 -2
  10. package/layout/_partial/{plugins/comments → comments}/giscus/script.ejs +1 -4
  11. package/layout/_partial/{plugins/comments → comments}/layout.ejs +1 -1
  12. package/layout/_partial/{plugins/comments → comments}/twikoo/script.ejs +1 -1
  13. package/layout/_partial/comments/waline/script.ejs +43 -0
  14. package/layout/_partial/head.ejs +0 -1
  15. package/layout/_partial/main/article/article_footer.ejs +1 -1
  16. package/layout/_partial/main/footer.ejs +1 -1
  17. package/layout/_partial/main/navbar/article_banner.ejs +81 -17
  18. package/layout/_partial/main/navbar/ghinfo.ejs +1 -1
  19. package/layout/_partial/main/post_list/post_card.ejs +1 -1
  20. package/layout/_partial/menubtn.ejs +6 -3
  21. package/layout/_partial/scripts/defines.ejs +31 -0
  22. package/layout/_partial/scripts/services.ejs +29 -0
  23. package/layout/_partial/scripts/sidebar.ejs +25 -0
  24. package/layout/_partial/scripts/utils.ejs +158 -0
  25. package/layout/_partial/scripts.ejs +32 -0
  26. package/layout/_partial/sidebar/{index.ejs → index_leftbar.ejs} +22 -20
  27. package/layout/_partial/sidebar/index_rightbar.ejs +84 -0
  28. package/layout/_partial/sidebar/logo.ejs +1 -1
  29. package/layout/_partial/widgets/author.ejs +37 -0
  30. package/layout/_partial/widgets/components/edit.ejs +24 -0
  31. package/layout/_partial/widgets/ghissues.ejs +1 -1
  32. package/layout/_partial/widgets/ghrepo.ejs +2 -2
  33. package/layout/_partial/widgets/ghuser.ejs +2 -2
  34. package/layout/_partial/widgets/markdown.ejs +1 -1
  35. package/layout/_partial/widgets/recent.ejs +1 -5
  36. package/layout/_partial/widgets/related.ejs +1 -1
  37. package/layout/_partial/widgets/timeline.ejs +1 -1
  38. package/layout/_partial/widgets/toc.ejs +32 -85
  39. package/layout/_partial/widgets/tree.ejs +71 -0
  40. package/layout/_plugins/copycode.ejs +13 -0
  41. package/layout/_plugins/fancybox.ejs +32 -0
  42. package/layout/_plugins/heti.ejs +21 -0
  43. package/layout/_plugins/index.ejs +24 -0
  44. package/layout/_plugins/lazyload.ejs +21 -0
  45. package/layout/{_partial/plugins/parser/mathjax/script.ejs → _plugins/mathjax.ejs} +1 -1
  46. package/layout/_plugins/mermaid.ejs +29 -0
  47. package/layout/_plugins/preload.ejs +9 -0
  48. package/layout/_plugins/scrollreveal.ejs +15 -0
  49. package/layout/_plugins/search/local_search.ejs +8 -0
  50. package/layout/_plugins/swiper.ejs +26 -0
  51. package/layout/_plugins/tianli_gpt.ejs +11 -0
  52. package/layout/archive.ejs +9 -2
  53. package/layout/layout.ejs +9 -6
  54. package/layout/page.ejs +2 -10
  55. package/package.json +1 -1
  56. package/scripts/events/lib/doc_tree.js +8 -8
  57. package/scripts/events/lib/topic_tree.js +3 -0
  58. package/scripts/generators/author.js +1 -1
  59. package/scripts/helpers/parse_config.js +6 -5
  60. package/scripts/tags/lib/albums.js +2 -2
  61. package/scripts/tags/lib/button.js +1 -1
  62. package/scripts/tags/lib/emoji.js +1 -1
  63. package/scripts/tags/lib/friends.js +1 -1
  64. package/scripts/tags/lib/icon.js +10 -5
  65. package/scripts/tags/lib/link.js +2 -2
  66. package/scripts/tags/lib/md.js +1 -1
  67. package/scripts/tags/lib/posters.js +2 -2
  68. package/scripts/tags/lib/sites.js +1 -1
  69. package/scripts/tags/lib/timeline.js +2 -2
  70. package/source/css/_common/button.styl +8 -2
  71. package/source/css/_common/device.styl +39 -12
  72. package/source/css/_custom.styl +15 -16
  73. package/source/css/_defines/const.styl +1 -1
  74. package/source/css/_defines/func.styl +14 -4
  75. package/source/css/_defines/theme.styl +38 -27
  76. package/source/css/_layout/layout.styl +61 -26
  77. package/source/css/_layout/list.styl +1 -1
  78. package/source/css/_layout/main.styl +1 -4
  79. package/source/css/_layout/md.styl +16 -2
  80. package/source/css/_layout/pages/archives.styl +4 -0
  81. package/source/css/_layout/partial/article-banner.styl +14 -15
  82. package/source/css/_layout/partial/article-footer.styl +0 -5
  83. package/source/css/_layout/partial/footer.styl +8 -6
  84. package/source/css/_layout/partial/related.styl +4 -0
  85. package/source/css/_layout/sidebar/footer.styl +3 -1
  86. package/source/css/_layout/sidebar/logo.styl +3 -1
  87. package/source/css/_layout/sidebar/nav-area.styl +1 -1
  88. package/source/css/_layout/sidebar/sidebar.styl +23 -16
  89. package/source/css/_layout/tag-plugins/banner.styl +1 -8
  90. package/source/css/_layout/tag-plugins/common.styl +10 -5
  91. package/source/css/_layout/tag-plugins/icon.styl +6 -0
  92. package/source/css/_layout/tag-plugins/image.styl +1 -1
  93. package/source/css/_layout/tag-plugins/quot.styl +1 -1
  94. package/source/css/_layout/tag-plugins/timeline.styl +26 -27
  95. package/source/css/_layout/widgets/ghrepo.styl +1 -1
  96. package/source/css/_layout/widgets/ghuser.styl +9 -5
  97. package/source/css/_layout/widgets/list.styl +4 -2
  98. package/source/css/_layout/widgets/related.styl +0 -1
  99. package/source/css/_layout/widgets/timeline.styl +27 -21
  100. package/source/css/_layout/widgets/toc.styl +182 -0
  101. package/source/css/_layout/widgets/tree.styl +0 -0
  102. package/source/css/_layout/widgets/widgets.styl +26 -7
  103. package/source/css/_plugins/comments/twikoo.styl +6 -6
  104. package/source/css/_plugins/comments/waline.styl +13 -10
  105. package/source/css/_plugins/index.styl +2 -0
  106. package/source/css/_plugins/katex.styl +5 -0
  107. package/source/css/_plugins/mermaid.styl +49 -59
  108. package/source/css/_plugins/tianli_gpt.styl +208 -151
  109. package/source/js/main.js +48 -251
  110. package/source/js/plugins/copycode.js +24 -28
  111. package/source/js/search/local-search.js +32 -0
  112. package/source/js/services/fcircle.js +36 -0
  113. package/source/js/services/friends.js +27 -0
  114. package/source/js/services/ghinfo.js +33 -0
  115. package/source/js/services/mdrender.js +10 -0
  116. package/source/js/services/memos.js +73 -0
  117. package/source/js/services/siteinfo.js +38 -0
  118. package/source/js/services/sites.js +30 -0
  119. package/source/js/services/timeline.js +106 -0
  120. package/source/js/services/weibo.js +60 -0
  121. package/layout/_partial/main/navbar/article_top_area.ejs +0 -35
  122. package/layout/_partial/main/navbar/author_banner.ejs +0 -29
  123. package/layout/_partial/plugins/ai/tianli_gpt.ejs +0 -9
  124. package/layout/_partial/plugins/comments/waline/script.ejs +0 -39
  125. package/layout/_partial/plugins/parser/head.ejs +0 -3
  126. package/layout/_partial/plugins/parser/katex/head.ejs +0 -3
  127. package/layout/_partial/plugins/parser/katex/script.ejs +0 -4
  128. package/layout/_partial/plugins/parser/mermaid/script.ejs +0 -29
  129. package/layout/_partial/plugins/parser/script.ejs +0 -9
  130. package/layout/_partial/scripts/index.ejs +0 -176
  131. package/source/css/_layout/widgets/toc_blog.styl +0 -3
  132. package/source/css/_layout/widgets/toc_common.styl +0 -92
  133. package/source/css/_layout/widgets/toc_wiki.styl +0 -62
  134. package/source/js/plugins/fcircle.js +0 -92
  135. package/source/js/plugins/friends.js +0 -84
  136. package/source/js/plugins/ghinfo.js +0 -85
  137. package/source/js/plugins/linkcard.js +0 -48
  138. package/source/js/plugins/marked.js +0 -50
  139. package/source/js/plugins/memos.js +0 -132
  140. package/source/js/plugins/sites.js +0 -87
  141. package/source/js/plugins/timeline.js +0 -162
  142. package/source/js/plugins/weibo.js +0 -116
  143. /package/layout/_partial/{plugins/comments → comments}/artalk/layout.ejs +0 -0
  144. /package/layout/_partial/{plugins/comments → comments}/beaudar/layout.ejs +0 -0
  145. /package/layout/_partial/{plugins/comments → comments}/beaudar/script.ejs +0 -0
  146. /package/layout/_partial/{plugins/comments → comments}/script.ejs +0 -0
  147. /package/layout/_partial/{plugins/comments → comments}/twikoo/layout.ejs +0 -0
  148. /package/layout/_partial/{plugins/comments/giscus → comments/utterances}/layout.ejs +0 -0
  149. /package/layout/_partial/{plugins/comments → comments}/utterances/script.ejs +0 -0
  150. /package/layout/_partial/{plugins/comments → comments}/waline/layout.ejs +0 -0
@@ -0,0 +1,38 @@
1
+ // 本插件由CardLink定制而成,原项目源码: https://github.com/Lete114/CardLink
2
+ function setCardLink(nodes) {
3
+ // If the `nodes` do not contain a `forEach` method, then the default `a[cardlink]` is used
4
+ nodes = 'forEach' in (nodes || {}) ? nodes : document.querySelectorAll('a[cardlink]')
5
+ nodes.forEach((el) => {
6
+ // If it is not a tag element then it is not processed
7
+ if (el.nodeType !== 1) return;
8
+ el.removeAttribute('cardlink');
9
+ const api = el.getAttribute('api');
10
+ if (api == null) return;
11
+ fetch(api).then(function(response) {
12
+ if (response.ok) {
13
+ return response.json();
14
+ }
15
+ throw new Error('Network response was not ok.');
16
+ }).then(function(data) {
17
+ var autofill = [];
18
+ const autofillStr = el.getAttribute('autofill');
19
+ if (autofillStr) {
20
+ autofill = autofillStr.split(',');
21
+ }
22
+ if (data.title && data.title.length > 0 && autofill.includes('title')) {
23
+ el.querySelector('.title').innerHTML = data.title;
24
+ el.title = data.title;
25
+ }
26
+ if (data.icon && data.icon.length > 0 && autofill.includes('icon')) {
27
+ el.querySelector('.img').style = 'background-image: url("' + data.icon + '");';
28
+ el.querySelector('.img').setAttribute('data-bg', data.icon);
29
+ }
30
+ let desc = el.querySelector('.desc');
31
+ if (desc && data.desc && data.desc.length > 0 && autofill.includes('desc')) {
32
+ desc.innerHTML = data.desc;
33
+ }
34
+ }).catch(function(error) {
35
+ console.error(error);
36
+ });
37
+ })
38
+ }
@@ -0,0 +1,30 @@
1
+ utils.jq(() => {
2
+ $(function () {
3
+ const els = document.getElementsByClassName('ds-sites');
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
+ const default_cover = def.cover;
12
+ // layout
13
+ utils.request(el, api, function(data) {
14
+ for (let item of data.content) {
15
+ var cell = `<div class="grid-cell site-card">`;
16
+ 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 += `<div class="info">`;
19
+ cell += `<img src="${item.icon || item.avatar || default_avatar}" onerror="javascript:this.removeAttribute(\'data-src\');this.src=\'${default_avatar}\';"/>`;
20
+ cell += `<span class="title">${item.title}</span>`;
21
+ cell += `<span class="desc">${item.description || item.url}</span>`;
22
+ cell += `</div>`;
23
+ cell += `</a>`;
24
+ cell += `</div>`;
25
+ $(el).find('.grid-box').append(cell);
26
+ }
27
+ });
28
+ }
29
+ });
30
+ });
@@ -0,0 +1,106 @@
1
+ utils.jq(() => {
2
+ $(function () {
3
+ const reactions = {
4
+ '+1': '👍',
5
+ '-1': '👎',
6
+ 'laugh': '😀',
7
+ 'hooray': '🎉',
8
+ 'confused': '😕',
9
+ 'heart': '❤️',
10
+ 'rocket': '🚀',
11
+ 'eyes': '👀'
12
+ }
13
+ const timelines = document.getElementsByClassName('ds-timeline');
14
+ for (var i = 0; i < timelines.length; i++) {
15
+ const el = timelines[i];
16
+ const api = el.getAttribute('api');
17
+ if (api == null) {
18
+ continue;
19
+ }
20
+ // layout
21
+ utils.request(el, api, function(data) {
22
+ const query = new URL(api).search;
23
+ const arr = data.content || data;
24
+ var users = [];
25
+ const filter = el.getAttribute('user');
26
+ if (filter && filter.length > 0) {
27
+ users = filter.split(",");
28
+ }
29
+ var hide = [];
30
+ const hideStr = el.getAttribute('hide');
31
+ if (hideStr && hideStr.length > 0) {
32
+ hide = hideStr.split(",");
33
+ }
34
+ arr.forEach((item, i) => {
35
+ if (item.user && item.user.login && users.length > 0) {
36
+ if (!users.includes(item.user.login)) {
37
+ return;
38
+ }
39
+ }
40
+ var cell = '<div class="timenode" index="' + i + '">';
41
+ cell += '<div class="header">';
42
+ if (!users.length && item.user && !hide.includes('user')) {
43
+ cell += '<a class="user-info" href="' + item.user.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
44
+ cell += '<img src="' + item.user.avatar_url + '">';
45
+ cell += '<span>' + item.user.login + '</span>';
46
+ cell += '</a>';
47
+ }
48
+ let date = new Date(item.created_at);
49
+ cell += '<span>' + date.toLocaleString() + '</span>';
50
+ cell += '</div>';
51
+ cell += '<div class="body">';
52
+ if (!hide.includes('title')) {
53
+ cell += '<p class="title">';
54
+ cell += '<a href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
55
+ cell += item.title || item.name || item.tag_name;
56
+ cell += '</a>';
57
+ cell += '</p>';
58
+ }
59
+
60
+ cell += marked.parse(item.body || '');
61
+ if (!hide.includes('footer')) {
62
+ cell += '<div class="footer">';
63
+ cell += '<div class="flex left">';
64
+ if (item.labels) {
65
+ item.labels.forEach((label, i) => {
66
+ if (!query || !query.includes(encodeURI(label.name))) {
67
+ cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">';
68
+ cell += '<span>' + label.name + '</span>';
69
+ cell += '</div>';
70
+ }
71
+ });
72
+ } else if (item.zipball_url) {
73
+ cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
74
+ cell += '<span>📦 ' + item.tag_name + '.zip</span>';
75
+ cell += '</a>';
76
+ }
77
+ cell += '</div>';
78
+ cell += '<div class="flex right">';
79
+ if (item.reactions?.total_count > 0) {
80
+ for (let key of Object.keys(reactions)) {
81
+ let num = item.reactions[key];
82
+ if (num > 0) {
83
+ cell += '<div class="item reaction ' + key + '">';
84
+ cell += '<span>' + reactions[key] + ' ' + item.reactions[key] + '</span>';
85
+ cell += '</div>';
86
+ }
87
+ }
88
+ }
89
+ if (item.comments != null) {
90
+ cell += '<a class="item comments last" href="' + item.html_url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
91
+ cell += '<span><svg t="1666270368054" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2528" width="200" height="200"><path d="M952 64H72C32.3 64 0 96.3 0 136v508c0 39.7 32.3 72 72 72h261l128 128c14 14 32.5 21.1 50.9 21.1s36.9-7 50.9-21.1l128-128h261c39.7 0 72-32.3 72-72V136c0.2-39.7-32.1-72-71.8-72zM222 462c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72-32.2 72-72 72z m290-7.7c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z m290 8c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z" p-id="2529"></path></svg> ' + (item.comments || 0) + '</span>';
92
+ cell += '</a>';
93
+ }
94
+
95
+ cell += '</div>';
96
+ cell += '</div>';
97
+ }
98
+
99
+ cell += '</div>';
100
+ cell += '</div>';
101
+ $(el).append(cell);
102
+ });
103
+ });
104
+ }
105
+ });
106
+ });
@@ -0,0 +1,60 @@
1
+ utils.jq(() => {
2
+ $(function () {
3
+ const els = document.getElementsByClassName('ds-weibo');
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 = el.getAttribute('avatar') || def.avatar;
11
+ // layout
12
+ utils.request(el, api, function(data) {
13
+ const arr = data.tweets || [];
14
+ const limit = el.getAttribute('limit');
15
+ arr.forEach((item, i) => {
16
+ if (limit && i >= limit) {
17
+ return;
18
+ }
19
+ var cell = '<div class="timenode" index="' + i + '">';
20
+ cell += '<div class="header">';
21
+ cell += '<div class="user-info">';
22
+ cell += '<img src="' + (data.user.avatar_hd || default_avatar) + '" onerror="javascript:this.src=\'' + default_avatar + '\';">';
23
+ cell += '<span>' + data.user.nick_name + '</span>';
24
+ cell += '</div>';
25
+ cell += '<span>' + item.created_at + '</span>';
26
+ cell += '</div>';
27
+ cell += '<div class="body">';
28
+ cell += '<a class="body" href="' + item.url + '" target="_blank" rel="external nofollow noopener noreferrer">';
29
+ cell += item.content;
30
+ cell += '</a>';
31
+ // cell += '</div>';
32
+ // 每条微博的右下角 转发 评论 点赞
33
+ cell += '<div class="footer">';
34
+ cell += '<div class="flex left">';
35
+ cell += '</div>';
36
+ cell += '<div class="flex right">';
37
+ cell += '<div class="item reaction repost">';
38
+ cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
39
+ cell += '<span>' + '🔗' + ' ' + item.reposts_count + '</span>';
40
+ cell += '</a>';
41
+ cell += '</div>';
42
+ cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
43
+ cell += '<span><svg t="1666270368054" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2528" width="200" height="200"><path d="M952 64H72C32.3 64 0 96.3 0 136v508c0 39.7 32.3 72 72 72h261l128 128c14 14 32.5 21.1 50.9 21.1s36.9-7 50.9-21.1l128-128h261c39.7 0 72-32.3 72-72V136c0.2-39.7-32.1-72-71.8-72zM222 462c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72-32.2 72-72 72z m290-7.7c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z m290 8c-39.8 0-72-32.2-72-72s32.2-72 72-72 72 32.2 72 72c0 39.7-32.2 72-72 72z" p-id="2529"></path></svg> '
44
+ + (item.comments_count || 0) + '</span>';
45
+ cell += '</a>';
46
+ cell += '<div class="item reaction attitudes">';
47
+ cell += '<a class="item comments last" href="' + item.url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
48
+ cell += '<span>' + '👍' + ' ' + item.attitudes_count + '</span>';
49
+ cell += '</a>';
50
+ cell += '</div>';
51
+
52
+ cell += '</div>';
53
+ cell += '</div>';
54
+ // 右下角结束
55
+ $(el).append(cell);
56
+ });
57
+ });
58
+ }
59
+ });
60
+ });
@@ -1,35 +0,0 @@
1
- <%
2
- function layoutDiv() {
3
- if (page.breadcrumb === false) {
4
- return ''
5
- }
6
- var el = ''
7
- // 1.main
8
- el += `<div class="top bread-nav footnote">`
9
- // 2.left
10
- el += `<div class="left">`
11
- // 3.left.top: 面包屑导航
12
- el += `<div class="flex-row" id="breadcrumb">`
13
- // 首页
14
- el += `<a class="cap breadcrumb" href="${url_for(config.root)}">${__("btn.home")}</a>`
15
- if (theme.wiki.tree[page.wiki]) {
16
- el += partial('breadcrumb/wiki')
17
- } else if (page.layout == 'post') {
18
- el += partial('breadcrumb/blog')
19
- } else {
20
- el += partial('breadcrumb/page')
21
- }
22
- // end 3.left.top
23
- el += `</div>`
24
- // 3.left.bottom
25
- el += partial('dateinfo')
26
- // end 2.left
27
- el += `</div>`
28
- // 2.right
29
- el += partial('ghinfo')
30
- // end 1.main
31
- el += `</div>`
32
- return el
33
- }
34
- %>
35
- <%- layoutDiv() %>
@@ -1,29 +0,0 @@
1
- <%
2
- function layoutDiv() {
3
- const author = page.author
4
- var el = ``
5
- el += `<div class="banner author top">`
6
- if (author.banner) {
7
- el += `<img class="bg" src="${author.banner}">`
8
- }
9
- el += `
10
- <div class="content">
11
- <div class="top">
12
- <button class="back cap" onclick="window.history.back()">
13
- ${icon('default:goback')}
14
- </button>
15
- </div>
16
- <div class="bottom">
17
- <img class="avatar" src="${author.avatar}">
18
- <div class="text-area">
19
- <p class="text title">${author.name}</p>
20
- <div class="text subtitle">${author.description || ""}</div>
21
- </div>
22
- </div>
23
- </div>
24
- `
25
- el += `</div>`
26
- return el
27
- }
28
- %>
29
- <%- layoutDiv() %>
@@ -1,9 +0,0 @@
1
- <% if (page.layout === 'post' || (page.wiki?.length > 0)) { %>
2
- <script>
3
- let tianliGPT_postSelector = 'article.content';
4
- let tianliGPT_key = '<%= theme.plugins.tianli_gpt.api %>';
5
- let tianliGPT_typingAnimate = '<%= theme.plugins.tianli_gpt.typingAnimate %>';
6
- let tianliGPT_wordLimit = <%= theme.plugins.tianli_gpt.limit %>;
7
- </script>
8
- <script defer src="https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.15.2/tianli_gpt.min.js"></script>
9
- <% } %>
@@ -1,39 +0,0 @@
1
- <script>
2
- function load_comment(){
3
- if(!document.getElementById("waline_container"))return;
4
- stellar.loadCSS('<%- theme.comments.waline.css %>');
5
- stellar.loadScript('<%- theme.comments.waline.js %>', {defer:true}).then(function () {
6
- const el = document.getElementById("waline_container");
7
- var path = el.getAttribute('comment_id');
8
- if (!path) {
9
- path = decodeURI(window.location.pathname);
10
- }
11
- Waline.init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
12
- el: '#waline_container',
13
- path: path,
14
- <% if(!!theme.comments.waline.imageUploader?.api){ %>
15
- imageUploader: function(file) {
16
- let headers = new Headers();
17
- headers.set('Accept', 'application/json');
18
- <% if(!!theme.comments.waline.imageUploader?.token) { %>
19
- headers.set('<%= theme.comments.waline.imageUploader?.tokenName %>', '<%= theme.comments.waline.imageUploader?.token %>')
20
- <% } %>
21
- let formData = new FormData();
22
- formData.append('<%= theme.comments.waline.imageUploader?.fileName %>', file);
23
- return fetch('<%= theme.comments.waline.imageUploader?.api %>',{
24
- method: 'POST',
25
- body: formData,
26
- headers: headers
27
- }).then((resp) => resp.json())
28
- .then((resp) => resp.<%= theme.comments.waline.imageUploader?.resp %>)
29
- },
30
- <% } %>
31
- }));
32
- });
33
- }
34
- window.addEventListener('DOMContentLoaded', (event) => {
35
- console.log('DOM fully loaded and parsed');
36
- load_comment();
37
- });
38
-
39
- </script>
@@ -1,3 +0,0 @@
1
- <% if (page.katex == true || theme.plugins.katex.enable == true) { %>
2
- <%- partial('katex/head') %>
3
- <% } %>
@@ -1,3 +0,0 @@
1
- <% if (theme.plugins.katex) { %>
2
- <%- theme.plugins.katex.min_css %>
3
- <% } %>
@@ -1,4 +0,0 @@
1
- <% if (theme.plugins.katex) { %>
2
- <%- theme.plugins.katex.min_js %>
3
- <%- theme.plugins.katex.auto_render_min_js %>
4
- <% } %>
@@ -1,29 +0,0 @@
1
- <script type="text/javascript" src="<%- theme.plugins.mermaid.js %>"></script>
2
- <script>
3
- var mermaid_config = {
4
- startOnLoad: true,
5
- theme:
6
- "<%- theme.style.darkmode %>" == "auto" &&
7
- window.matchMedia("(prefers-color-scheme: dark)").matches
8
- ? "dark"
9
- : "<%- theme.plugins.mermaid.theme %>",
10
- logLevel: 3,
11
- themeVariables: {
12
- darkMode: true
13
- },
14
- flowchart: {
15
- useMaxWidth: false,
16
- htmlLabels: true,
17
- curve: "linear"
18
- },
19
- gantt: {
20
- axisFormat: "%Y/%m/%d"
21
- },
22
- sequence: {
23
- actorMargin: 50
24
- }
25
- }
26
- if (window.mermaid) {
27
- mermaid.initialize(mermaid_config);
28
- }
29
- </script>
@@ -1,9 +0,0 @@
1
- <% if (page.katex == true || theme.plugins.katex.enable) { %>
2
- <%- partial('katex/script') %>
3
- <% } %>
4
- <% if (page.mathjax == true || theme.plugins.mathjax.enable) { %>
5
- <%- partial('mathjax/script') %>
6
- <% } %>
7
- <% if (page.mermaid == true || theme.plugins.mermaid.enable) { %>
8
- <%- partial('mermaid/script') %>
9
- <% } %>
@@ -1,176 +0,0 @@
1
- <%
2
-
3
- function custom_inject() {
4
- var el = '';
5
- for (let item of (config.inject?.script || [])) {
6
- el += item;
7
- }
8
- for (let item of (theme.inject?.script || [])) {
9
- el += item;
10
- }
11
- for (let item of (page.inject?.script || [])) {
12
- el += item;
13
- }
14
- return el;
15
- }
16
-
17
- %>
18
- <script type="text/javascript">
19
- const stellar = {
20
- // 懒加载 css https://github.com/filamentgroup/loadCSS
21
- loadCSS: (href, before, media, attributes) => {
22
- var doc = window.document;
23
- var ss = doc.createElement("link");
24
- var ref;
25
- if (before) {
26
- ref = before;
27
- } else {
28
- var refs = (doc.body || doc.getElementsByTagName("head")[0]).childNodes;
29
- ref = refs[refs.length - 1];
30
- }
31
- var sheets = doc.styleSheets;
32
- if (attributes) {
33
- for (var attributeName in attributes) {
34
- if (attributes.hasOwnProperty(attributeName)) {
35
- ss.setAttribute(attributeName, attributes[attributeName]);
36
- }
37
- }
38
- }
39
- ss.rel = "stylesheet";
40
- ss.href = href;
41
- ss.media = "only x";
42
- function ready(cb) {
43
- if (doc.body) {
44
- return cb();
45
- }
46
- setTimeout(function () {
47
- ready(cb);
48
- });
49
- }
50
- ready(function () {
51
- ref.parentNode.insertBefore(ss, before ? ref : ref.nextSibling);
52
- });
53
- var onloadcssdefined = function (cb) {
54
- var resolvedHref = ss.href;
55
- var i = sheets.length;
56
- while (i--) {
57
- if (sheets[i].href === resolvedHref) {
58
- return cb();
59
- }
60
- }
61
- setTimeout(function () {
62
- onloadcssdefined(cb);
63
- });
64
- };
65
- function loadCB() {
66
- if (ss.addEventListener) {
67
- ss.removeEventListener("load", loadCB);
68
- }
69
- ss.media = media || "all";
70
- }
71
- if (ss.addEventListener) {
72
- ss.addEventListener("load", loadCB);
73
- }
74
- ss.onloadcssdefined = onloadcssdefined;
75
- onloadcssdefined(loadCB);
76
- return ss;
77
- },
78
-
79
- // 从 butterfly 和 volantis 获得灵感
80
- loadScript: (src, opt) => new Promise((resolve, reject) => {
81
- var script = document.createElement('script');
82
- if (src.startsWith('/')){
83
- src = stellar.config.root + src.substring(1);
84
- }
85
- script.src = src;
86
- if (opt) {
87
- for (let key of Object.keys(opt)) {
88
- script[key] = opt[key]
89
- }
90
- } else {
91
- // 默认异步,如果需要同步,第二个参数传入 {} 即可
92
- script.async = true
93
- }
94
- script.onerror = reject
95
- script.onload = script.onreadystatechange = function() {
96
- const loadState = this.readyState
97
- if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
98
- script.onload = script.onreadystatechange = null
99
- resolve()
100
- }
101
- document.head.appendChild(script)
102
- }),
103
-
104
- // https://github.com/jerryc127/hexo-theme-butterfly
105
- jQuery: (fn) => {
106
- if (typeof jQuery === 'undefined') {
107
- stellar.loadScript(stellar.plugins.jQuery).then(fn)
108
- } else {
109
- fn()
110
- }
111
- }
112
- };
113
- stellar.version = '<%- theme.stellar.version %>';
114
- stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
115
- stellar.config = {
116
- date_suffix: {
117
- just: '<%- __('meta.date_suffix.just') %>',
118
- min: '<%- __('meta.date_suffix.min') %>',
119
- hour: '<%- __('meta.date_suffix.hour') %>',
120
- day: '<%- __('meta.date_suffix.day') %>',
121
- month: '<%- __('meta.date_suffix.month') %>',
122
- },
123
- root : '<%- config.root %>',
124
- };
125
-
126
- // required plugins (only load if needs)
127
- stellar.plugins = {
128
- jQuery: '<%- url_for(theme.plugins.jquery || "https://gcore.jsdelivr.net/npm/jquery@3.6.2/dist/jquery.min.js") %>'
129
- };
130
-
131
- if ('<%- theme.search.service %>') {
132
- stellar.search = {};
133
- stellar.search.service = '<%- theme.search.service %>';
134
- if (stellar.search.service == 'local_search') {
135
- let service_obj = Object.assign({}, <%- JSON.stringify(theme.search.local_search) %>);
136
- stellar.search[stellar.search.service] = service_obj;
137
- }
138
- }
139
-
140
- // stellar js
141
- stellar.plugins.stellar = Object.assign(<%- JSON.stringify(theme.plugins.stellar) %>);
142
-
143
- stellar.plugins.marked = Object.assign(<%- JSON.stringify(theme.plugins.marked) %>);
144
- // optional plugins
145
- if ('<%- theme.plugins.lazyload.enable %>' == 'true') {
146
- stellar.plugins.lazyload = Object.assign(<%- JSON.stringify(theme.plugins.lazyload) %>);
147
- }
148
- if ('<%- theme.plugins.swiper.enable %>' == 'true') {
149
- stellar.plugins.swiper = Object.assign(<%- JSON.stringify(theme.plugins.swiper) %>);
150
- }
151
- if ('<%- theme.plugins.scrollreveal.enable %>' == 'true') {
152
- stellar.plugins.scrollreveal = Object.assign(<%- JSON.stringify(theme.plugins.scrollreveal) %>);
153
- }
154
- if ('<%- theme.plugins.preload.enable %>' == 'true') {
155
- stellar.plugins.preload = Object.assign(<%- JSON.stringify(theme.plugins.preload) %>);
156
- }
157
- if ('<%- theme.plugins.fancybox.enable %>' == 'true') {
158
- stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>);
159
- }
160
- if ('<%- theme.plugins.heti.enable %>' == 'true') {
161
- stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>);
162
- }
163
- if ('<%- theme.plugins.copycode.enable %>' == 'true') {
164
- stellar.plugins.copycode = Object.assign(<%- JSON.stringify(theme.plugins.copycode) %>);
165
- }
166
- </script>
167
-
168
- <!-- required -->
169
- <script src="<%- `${theme.stellar.main_js}?v=${stellar_info('version')}` %>" async></script>
170
-
171
- <!-- optional -->
172
- <%- partial('../plugins/comments/script') %>
173
- <%- partial('../plugins/parser/script') %>
174
-
175
- <!-- inject -->
176
- <%- custom_inject() %>
@@ -1,3 +0,0 @@
1
- .widget-wrapper.toc.single .doc-tree
2
- &.active>.toc
3
- border-left: 2px solid var(--alpha50)