hexo-theme-solitude 3.0.21 → 4.0.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 (142) hide show
  1. package/.github/FUNDING.yml +3 -3
  2. package/README.md +11 -1
  3. package/README_en-US.md +11 -1
  4. package/_config.yml +16 -7
  5. package/languages/default.yml +56 -36
  6. package/languages/en.yml +90 -69
  7. package/languages/es.yml +94 -73
  8. package/languages/zh-CN.yml +56 -34
  9. package/languages/zh-TW.yml +80 -57
  10. package/layout/archive.pug +60 -14
  11. package/layout/category.pug +13 -11
  12. package/layout/includes/body/gadsense.pug +2 -2
  13. package/layout/includes/console.pug +71 -72
  14. package/layout/includes/footer.pug +24 -9
  15. package/layout/includes/head/config.pug +83 -39
  16. package/layout/includes/head/mode.pug +7 -7
  17. package/layout/includes/head/page_config.pug +20 -11
  18. package/layout/includes/inject/body.pug +14 -36
  19. package/layout/includes/keyboard.pug +3 -3
  20. package/layout/includes/loading.pug +1 -37
  21. package/layout/includes/mixins/articleSort.pug +3 -3
  22. package/layout/includes/mixins/common.pug +8 -4
  23. package/layout/includes/mixins/pace.pug +1 -1
  24. package/layout/includes/mixins/pagination.pug +3 -3
  25. package/layout/includes/nav.pug +4 -3
  26. package/layout/includes/page/about.pug +9 -8
  27. package/layout/includes/page/brevity.pug +2 -2
  28. package/layout/includes/page/links.pug +23 -11
  29. package/layout/includes/page/music.pug +0 -5
  30. package/layout/includes/rightmenu.pug +20 -20
  31. package/layout/includes/sidebar.pug +2 -2
  32. package/layout/includes/widgets/aside/asideInfoCard.pug +2 -2
  33. package/layout/includes/widgets/aside/asideTag.pug +2 -2
  34. package/layout/includes/widgets/home/bbTimeList.pug +3 -3
  35. package/layout/includes/widgets/home/categoryBar.pug +30 -15
  36. package/layout/includes/widgets/home/hometop.pug +113 -8
  37. package/layout/includes/widgets/home/postList.pug +1 -2
  38. package/layout/includes/widgets/home/topGroup.pug +3 -7
  39. package/layout/includes/widgets/nav/group.pug +4 -2
  40. package/layout/includes/widgets/nav/menu.pug +6 -4
  41. package/layout/includes/widgets/nav/right.pug +7 -6
  42. package/layout/includes/widgets/page/about/award.pug +67 -38
  43. package/layout/includes/widgets/page/about/hobbies.pug +12 -3
  44. package/layout/includes/widgets/page/banner.pug +1 -1
  45. package/layout/includes/widgets/page/kit/content.pug +2 -2
  46. package/layout/includes/widgets/page/links/banner.pug +30 -19
  47. package/layout/includes/widgets/page/message/artalk.pug +3 -3
  48. package/layout/includes/widgets/page/message/content.pug +3 -3
  49. package/layout/includes/widgets/page/message/twikoo.pug +3 -3
  50. package/layout/includes/widgets/page/message/valine.pug +4 -4
  51. package/layout/includes/widgets/page/message/waline.pug +3 -3
  52. package/layout/includes/widgets/page/recentcomment/artalk.pug +5 -9
  53. package/layout/includes/widgets/page/recentcomment/twikoo.pug +5 -9
  54. package/layout/includes/widgets/page/recentcomment/valine.pug +6 -10
  55. package/layout/includes/widgets/page/recentcomment/waline.pug +5 -9
  56. package/layout/includes/widgets/post/award.pug +1 -28
  57. package/layout/includes/widgets/post/copyright.pug +10 -10
  58. package/layout/includes/widgets/post/postInfo.pug +10 -11
  59. package/layout/includes/widgets/post/postMeta.pug +3 -2
  60. package/layout/includes/widgets/rightside/hide.pug +5 -5
  61. package/layout/includes/widgets/rightside/show.pug +7 -7
  62. package/layout/includes/widgets/third-party/comments/artalk.pug +9 -9
  63. package/layout/includes/widgets/third-party/comments/giscus.pug +2 -2
  64. package/layout/includes/widgets/third-party/comments/twikoo.pug +5 -5
  65. package/layout/includes/widgets/third-party/comments/valine.pug +6 -6
  66. package/layout/includes/widgets/third-party/comments/waline.pug +6 -6
  67. package/layout/includes/widgets/third-party/hot/twikoo.pug +1 -1
  68. package/layout/includes/widgets/third-party/music.pug +9 -5
  69. package/layout/includes/widgets/third-party/news-comment/artalk.pug +6 -6
  70. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +7 -7
  71. package/layout/includes/widgets/third-party/news-comment/valine.pug +8 -8
  72. package/layout/includes/widgets/third-party/news-comment/waline.pug +7 -7
  73. package/layout/includes/widgets/third-party/pjax.pug +16 -10
  74. package/layout/includes/widgets/third-party/search/algolia-search.pug +2 -2
  75. package/layout/includes/widgets/third-party/search/docsearch.pug +3 -3
  76. package/layout/includes/widgets/third-party/search/index.pug +1 -3
  77. package/layout/includes/widgets/third-party/search/local-search.pug +9 -9
  78. package/layout/index.pug +8 -6
  79. package/package.json +8 -7
  80. package/plugins.yml +22 -21
  81. package/scripts/event/cdn.js +11 -6
  82. package/scripts/event/friend_links.js +30 -0
  83. package/scripts/event/merge_config.js +15 -7
  84. package/scripts/filter/comment.js +2 -2
  85. package/scripts/filter/default.js +1 -1
  86. package/scripts/helper/inject_head_js.js +79 -33
  87. package/scripts/helper/related_post.js +16 -21
  88. package/scripts/tags/chart.js +1 -1
  89. package/scripts/tags/typeit.js +1 -1
  90. package/source/css/_components/capsule.styl +259 -168
  91. package/source/css/_components/rightside.styl +98 -242
  92. package/source/css/_global/animation.styl +1 -10
  93. package/source/css/_global/index.styl +27 -1
  94. package/source/css/_layout/aside.styl +7 -1
  95. package/source/css/_layout/console.styl +145 -165
  96. package/source/css/_layout/header.styl +238 -47
  97. package/source/css/_layout/pagination.styl +176 -132
  98. package/source/css/_layout/rightmenu.styl +11 -2
  99. package/source/css/_layout/sidebar.styl +39 -17
  100. package/source/css/_mode/index.styl +7 -1
  101. package/source/css/_page/_about/about.styl +18 -2
  102. package/source/css/_page/_about/buff.styl +1 -1
  103. package/source/css/_page/_about/contentinfo.styl +2 -1
  104. package/source/css/_page/_about/game.styl +57 -1
  105. package/source/css/_page/_about/like.styl +7 -2
  106. package/source/css/_page/_about/maxim.styl +1 -1
  107. package/source/css/_page/_about/reward.styl +226 -108
  108. package/source/css/_page/_about/skills.styl +5 -3
  109. package/source/css/_page/_home/category-bar.styl +162 -88
  110. package/source/css/_page/_home/home-top.styl +309 -263
  111. package/source/css/_page/_home/home.styl +34 -7
  112. package/source/css/_page/archive.styl +412 -0
  113. package/source/css/_page/category.styl +27 -1
  114. package/source/css/_page/index.styl +2 -0
  115. package/source/css/_page/links.styl +190 -0
  116. package/source/css/_page/other.styl +37 -0
  117. package/source/css/_post/index.styl +2 -1
  118. package/source/css/_post/meta.styl +245 -217
  119. package/source/css/_search/local-search.styl +158 -82
  120. package/source/css/var.styl +2 -2
  121. package/source/js/archive-page.js +191 -0
  122. package/source/js/core/actions.js +48 -0
  123. package/source/js/core/api.js +32 -0
  124. package/source/js/core/config.js +13 -0
  125. package/source/js/core/lifecycle.js +52 -0
  126. package/source/js/core/preloader.js +34 -0
  127. package/source/js/core/resources.js +65 -0
  128. package/source/js/covercolor/api.js +13 -103
  129. package/source/js/covercolor/ave.js +14 -77
  130. package/source/js/covercolor/local.js +22 -116
  131. package/source/js/covercolor/shared.js +102 -0
  132. package/source/js/friend_links.js +502 -0
  133. package/source/js/main.js +793 -177
  134. package/source/js/music.js +24 -14
  135. package/source/js/post_ai.js +13 -2
  136. package/source/js/right_menu.js +44 -24
  137. package/source/js/search/algolia.js +29 -21
  138. package/source/js/search/local.js +231 -266
  139. package/source/js/tw_cn.js +37 -12
  140. package/source/js/utils.js +37 -25
  141. package/layout/includes/widgets/randomlink.pug +0 -43
  142. package/scripts/filter/randomPosts.js +0 -16
@@ -1,28 +1,28 @@
1
1
  -
2
2
  if (theme.search.enable) {
3
- var localSearch = 'undefined';
4
- var algolia = 'undefined';
3
+ var localSearch = null;
4
+ var algolia = null;
5
5
  switch (theme.search.type) {
6
6
  case 'local':
7
- localSearch = JSON.stringify({
7
+ localSearch = {
8
8
  preload: theme.search.local.preload,
9
9
  path: theme?.search?.local?.CDN || '/search.xml'
10
- });
10
+ };
11
11
  break;
12
12
  case 'algolia':
13
- algolia = JSON.stringify({
13
+ algolia = {
14
14
  appId: config.algolia.appId || config.algolia.applicationID,
15
15
  apiKey: config.algolia.apiKey,
16
16
  indexName: config.algolia.indexName,
17
17
  hits: {
18
18
  per_page: theme?.search?.algolia?.hits?.per_page || 10
19
19
  }
20
- });
20
+ };
21
21
  break;
22
22
  }
23
23
  }
24
24
 
25
- const witty_words = theme.aside?.my_card?.witty_words?.map(item => `"${item}"`) || [];
25
+ const witty_words = theme.aside?.my_card?.witty_words || [];
26
26
  const [hello_prefix, hello_back] = [_p('aside.hello'), _p('aside.back')];
27
27
 
28
28
  let comment = false
@@ -36,13 +36,13 @@
36
36
 
37
37
  let copyright = false;
38
38
  if (theme.copy.enable && theme.copy.copyright.enable) {
39
- copyright = JSON.stringify({
39
+ copyright = {
40
40
  limit: theme.copy.copyright.limit,
41
41
  author: _p("copy_copyright.author") + ': ' + config.author,
42
42
  link: _p("copy_copyright.link") + ': ',
43
43
  source: _p("copy_copyright.source") + ': ' + config.title,
44
44
  info: _p("copy_copyright.info")
45
- })
45
+ }
46
46
  }
47
47
 
48
48
  let lang = false
@@ -116,7 +116,11 @@
116
116
  if (theme.translate.enable) {
117
117
  translate = {
118
118
  translateDelay: theme.translate.translateDelay,
119
- defaultEncoding: theme.translate.defaultEncoding
119
+ defaultEncoding: theme.translate.defaultEncoding,
120
+ toSimplified: _p('right_menu.cht_to_chs'),
121
+ toTraditional: _p('right_menu.chs_to_cht'),
122
+ switchedToSimplified: _p('right_menu.converted_to_chs'),
123
+ switchedToTraditional: _p('right_menu.converted_to_cht')
120
124
  }
121
125
  }
122
126
 
@@ -148,41 +152,81 @@
148
152
  }
149
153
  }
150
154
 
151
- script.
152
- const GLOBAL_CONFIG = {
153
- root: '!{config.root}',
154
- algolia: !{algolia ? algolia : 'undefined'},
155
- localsearch: !{localSearch ? localSearch : 'undefined'},
156
- runtime: '!{theme.aside.siteinfo.runtimeenable ? theme.aside.siteinfo.runtime : false}',
155
+ const friendLinksGroups = site.data.links && Array.isArray(site.data.links.links) ? site.data.links.links : []
156
+ const friendLinksTotal = friendLinksGroups.reduce((count, group) => count + (Array.isArray(group.link_list) ? group.link_list.length : 0), 0)
157
+ const configuredFriendLinksThreshold = Number(theme.page && theme.page.links && theme.page.links.async_threshold)
158
+ const friendLinksThreshold = Number.isInteger(configuredFriendLinksThreshold) && configuredFriendLinksThreshold >= 0 ? configuredFriendLinksThreshold : 200
159
+ const friendLinks = {
160
+ async: friendLinksTotal > friendLinksThreshold,
161
+ path: url_for('/links.json'),
162
+ total: friendLinksTotal,
163
+ placeholder: theme.lazyload.placeholder ? url_for(theme.lazyload.placeholder) : '',
164
+ default_avatar: url_for('/img/default_avatar.avif'),
165
+ more_url: url_for('/links/'),
166
+ loading: _p('link.loading'),
167
+ error: _p('link.error'),
168
+ retry: _p('link.retry'),
169
+ random: _p('link.random'),
170
+ to: _p('link.to'),
171
+ more: _p('more'),
172
+ default_sort: _p('link.default_sort'),
173
+ random_sort: _p('link.random_sort'),
174
+ sort_label: _p('link.sort_label'),
175
+ scroll_left: _p('link.scroll_left'),
176
+ scroll_right: _p('link.scroll_right')
177
+ }
178
+
179
+ -
180
+ const globalConfig = {
181
+ root: config.root,
182
+ algolia,
183
+ localsearch: localSearch,
184
+ runtime: theme.aside.siteinfo.runtimeenable ? theme.aside.siteinfo.runtime : false,
157
185
  lazyload: {
158
- enable: !{theme.lazyload.enable},
159
- error: '!{theme.lazyload.errorimg}'
186
+ enable: theme.lazyload.enable,
187
+ error: theme.lazyload.errorimg
160
188
  },
161
- copyright: !{copyright},
162
- highlight: !{highlight ? JSON.stringify(highlight) : false},
163
- randomlink: !{theme.footer.randomlink},
164
- lang: !{JSON.stringify(lang)},
189
+ copyright,
190
+ highlight,
191
+ friend_links: friendLinks,
192
+ random_posts: site.posts.filter(post => post.random !== false).map(post => post.path),
193
+ randomlink: theme.footer.randomlink,
194
+ feature_modules: {
195
+ search: theme.search.enable ? theme.search.type : false,
196
+ post_ai: theme.post.ai.enable,
197
+ friend_links: friendLinks.total > 0,
198
+ music: theme.capsule.enable || theme.music.enable || (theme.brevity.enable && theme.brevity.music),
199
+ right_menu: theme.right_menu.enable,
200
+ translate: theme.translate.enable,
201
+ covercolor: theme.post.covercolor.enable ? theme.post.covercolor.mode : false
202
+ },
203
+ lang,
165
204
  aside: {
166
205
  state: {
167
- morning: "!{theme.aside.my_card.state.morning}",
168
- noon: "!{theme.aside.my_card.state.noon}",
169
- afternoon: "!{theme.aside.my_card.state.afternoon}",
170
- night: "!{theme.aside.my_card.state.night}",
171
- goodnight: "!{theme.aside.my_card.state.goodnight}",
206
+ morning: theme.aside.my_card.state.morning,
207
+ noon: theme.aside.my_card.state.noon,
208
+ afternoon: theme.aside.my_card.state.afternoon,
209
+ night: theme.aside.my_card.state.night,
210
+ goodnight: theme.aside.my_card.state.goodnight
172
211
  },
173
- witty_words: [!{witty_words}],
212
+ witty_words,
174
213
  witty_comment: {
175
- prefix: '!{hello_prefix}',
176
- back: '!{hello_back}',
177
- },
214
+ prefix: hello_prefix,
215
+ back: hello_back
216
+ }
178
217
  },
179
218
  covercolor: {
180
- enable: !{theme.post.covercolor.enable}
219
+ enable: theme.post.covercolor.enable,
220
+ mode: theme.post.covercolor.mode,
221
+ api: theme.post.covercolor.api,
222
+ time: theme.post.covercolor.time
181
223
  },
182
- comment: !{comment ? JSON.stringify(comment) : false},
183
- lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}',
184
- right_menu: !{rightMenu ? JSON.stringify(rightMenu) : false},
185
- translate: !{translate ? JSON.stringify(translate) : false},
186
- lure: !{lure ? JSON.stringify(lure) : false},
187
- expire: !{expire ? JSON.stringify(expire) : false},
188
- };
224
+ comment,
225
+ lightbox: theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : null),
226
+ right_menu: rightMenu,
227
+ translate,
228
+ lure,
229
+ expire
230
+ };
231
+
232
+ template#site-config!= JSON.stringify(globalConfig).replace(/</g, '\\u003c')
@@ -3,7 +3,7 @@ case theme.display_mode.type
3
3
  script.
4
4
  initTheme = () => {
5
5
  let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
6
- const cachedMode = utils.saveToLocal.get('theme');
6
+ const cachedMode = Solitude.saveToLocal.get('theme');
7
7
  if (cachedMode === undefined) {
8
8
  const nowMode =
9
9
  isDarkMode ? 'dark' : 'light'
@@ -11,28 +11,28 @@ case theme.display_mode.type
11
11
  } else {
12
12
  document.documentElement.setAttribute('data-theme', cachedMode);
13
13
  }
14
- typeof rm === 'object' && rm.mode(cachedMode === 'dark' && isDarkMode)
14
+ Solitude.rightMenu?.mode(cachedMode === 'dark' && isDarkMode)
15
15
  }
16
16
  initTheme()
17
17
  when "dark"
18
18
  script.
19
19
  initTheme = () => {
20
- const cachedMode = utils.saveToLocal.get('theme');
20
+ const cachedMode = Solitude.saveToLocal.get('theme');
21
21
  if (cachedMode === undefined)
22
22
  document.documentElement.setAttribute('data-theme', 'dark');
23
23
  else
24
24
  document.documentElement.setAttribute('data-theme', cachedMode);
25
- typeof rm === 'object' && rm.mode(cachedMode === undefined || cachedMode === 'dark')
25
+ Solitude.rightMenu?.mode(cachedMode === undefined || cachedMode === 'dark')
26
26
  }
27
27
  initTheme()
28
28
  when "light"
29
29
  script.
30
30
  initTheme = () => {
31
- const cachedMode = utils.saveToLocal.get('theme');
31
+ const cachedMode = Solitude.saveToLocal.get('theme');
32
32
  if (cachedMode === undefined)
33
33
  document.documentElement.setAttribute('data-theme', 'light');
34
34
  else
35
35
  document.documentElement.setAttribute('data-theme', cachedMode);
36
- typeof rm === 'object' && rm.mode(cachedMode === 'dark')
36
+ Solitude.rightMenu?.mode(cachedMode === 'dark')
37
37
  }
38
- initTheme()
38
+ initTheme()
@@ -1,13 +1,22 @@
1
1
  - var showToc = !!page.toc && (toc(page.content) !== '' || page.encrypt === true);
2
2
 
3
- script#config-diff.
4
- var PAGE_CONFIG = {
5
- is_post: !{is_post()},
6
- is_page: !{!is_post() && !is_home()},
7
- is_home: !{is_home()},
8
- page: '!{page.type}',
9
- toc: !{showToc},
10
- comment: !{!!page.comment},
11
- ai_text: !{is_post && theme.post.ai.enable && page.ai_text ? "'"+ page.ai_text+"'" : false},
12
- color: !{page.color ? "'"+ page.color+"'" : false},
13
- }
3
+ -
4
+ const pageConfig = {
5
+ is_post: is_post(),
6
+ is_page: !is_post() && !is_home(),
7
+ is_home: is_home(),
8
+ page: is_post()
9
+ ? 'post'
10
+ : (is_home()
11
+ ? 'solitude'
12
+ : (is_archive()
13
+ ? 'archive'
14
+ : (is_category()
15
+ ? 'category'
16
+ : (is_tag() ? 'tag' : (page.type || page.layout || 'page'))))),
17
+ toc: showToc,
18
+ comment: !!page.comment,
19
+ ai_text: is_post() && theme.post.ai.enable && page.ai_text ? page.ai_text : false,
20
+ color: page.color || false
21
+ }
22
+ template#config-diff!= JSON.stringify(pageConfig).replace(/</g, '\\u003c')
@@ -1,4 +1,9 @@
1
1
  - page.type = is_post() ? 'post' : page.type
2
+ - const bodyFriendLinksGroups = site.data.links && Array.isArray(site.data.links.links) ? site.data.links.links : []
3
+ - const bodyFriendLinksTotal = bodyFriendLinksGroups.reduce((count, group) => count + (Array.isArray(group.link_list) ? group.link_list.length : 0), 0)
4
+ - const configuredBodyFriendLinksThreshold = Number(theme.page && theme.page.links && theme.page.links.async_threshold)
5
+ - const bodyFriendLinksThreshold = Number.isInteger(configuredBodyFriendLinksThreshold) && configuredBodyFriendLinksThreshold >= 0 ? configuredBodyFriendLinksThreshold : 200
6
+ - const bodyFriendLinksAsync = bodyFriendLinksTotal > bodyFriendLinksThreshold
2
7
 
3
8
  mixin katex
4
9
  if theme.katex.copytex
@@ -6,17 +11,16 @@ mixin katex
6
11
  script.
7
12
  (() => {
8
13
  document.querySelectorAll('.article-container span.katex-display').forEach(item => {
9
- utils.wrap(item, 'div', {class: 'katex-wrap'})
14
+ Solitude.wrap(item, 'div', {class: 'katex-wrap'})
10
15
  })
11
16
  })();
12
17
 
13
18
  div
14
19
  // Critical scripts loaded synchronously
15
20
  script(src=url_for(theme.cdn.utils))
16
- script(src=url_for(theme.cdn.main))
17
21
 
18
22
  // Non-critical scripts loaded asynchronously
19
- script(async src=url_for(theme.cdn.waterfall))
23
+ script(defer src=url_for(theme.cdn.waterfall))
20
24
  script(src=url_for(theme.cdn.pjax))
21
25
 
22
26
  // Feature-specific scripts loaded asynchronously
@@ -39,9 +43,6 @@ div
39
43
  if (typeof dark === 'function') dark();
40
44
  });
41
45
 
42
- if theme.translate.enable
43
- script(defer src=url_for(theme.cdn.translate_js))
44
-
45
46
  if theme.katex && theme.katex.enable
46
47
  if theme.katex.per_page && (is_post() || is_page())
47
48
  +katex
@@ -60,9 +61,6 @@ div
60
61
  if (theme.brevity.home_mini && theme.brevity.enable)
61
62
  script(src=url_for(theme.cdn.swiper_js))
62
63
 
63
- if theme.post.ai.enable
64
- script(defer src=url_for(theme.cdn.post_ai))
65
-
66
64
  // Music player scripts
67
65
  if theme.capsule.enable || theme.music.enable || theme.brevity.enable && theme.brevity.music
68
66
  script.
@@ -71,24 +69,8 @@ div
71
69
  script(defer src=url_for(theme.cdn.meting_js))
72
70
 
73
71
  // Cover color processing scripts
74
- if theme.post.covercolor.enable
75
- case theme.post.covercolor.mode
76
- when 'local'
77
- script(defer src=url_for(theme.cdn.color_thief))
78
- script(defer src=url_for(theme.cdn.cover_local))
79
- when 'api'
80
- script.
81
- const coverColorConfig = {
82
- api: '!{theme.post.covercolor.api}',
83
- time: !{theme.post.covercolor.time}
84
- }
85
- script(defer src=url_for(theme.cdn.cover_api))
86
- when 'ave'
87
- script.
88
- const coverColorConfig = {
89
- time: !{theme.post.covercolor.time}
90
- }
91
- script(defer src=url_for(theme.cdn.cover_ave))
72
+ if theme.post.covercolor.enable && theme.post.covercolor.mode === 'local'
73
+ script(defer src=url_for(theme.cdn.color_thief))
92
74
 
93
75
  if theme.loading.pace
94
76
  include ../mixins/pace.pug
@@ -96,11 +78,9 @@ div
96
78
  // Search functionality
97
79
  if theme.search.enable && theme.search.type === "algolia"
98
80
  script(defer src=url_for(theme.cdn.instantsearch))
99
- script(defer src=url_for(theme.cdn.algolia_search))
100
81
 
101
- // Right menu functionality
102
- if theme.right_menu.enable
103
- script(defer src=url_for(theme.cdn.right_menu_js))
82
+ // Main module dynamically imports enabled first-party features.
83
+ script(type="module" src=url_for(theme.cdn.main))
104
84
 
105
85
  if theme.extends.body
106
86
  each item in theme.extends.body
@@ -109,11 +89,11 @@ div
109
89
  .js-pjax
110
90
  if is_home() && theme.brevity.enable && theme.brevity.home_mini
111
91
  script.
112
- sco.initbbtalk()
92
+ Solitude.initbbtalk()
113
93
  if page.type === 'brevity' && theme.brevity.enable
114
94
  script.
115
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
116
- sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
95
+ Solitude.config.lightbox && Solitude.lightbox(document.querySelectorAll(".bber-content-img img"));
96
+ Solitude.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
117
97
  if page.comment
118
98
  include ../widgets/third-party/comments/js
119
99
  if theme.mermaid
@@ -124,8 +104,6 @@ div
124
104
  script(defer pjax src=url_for(theme.cdn.busuanzi_js))
125
105
 
126
106
 
127
- if theme.footer.randomlink
128
- include ../widgets/randomlink.pug
129
107
 
130
108
  // pjax
131
109
  != partial("includes/widgets/third-party/pjax", {}, {cache: true})
@@ -30,12 +30,12 @@ script.
30
30
  }
31
31
  } else {
32
32
  if (e.key === keyboards[i].key) {
33
- pjax.loadUrl(keyboards[i].url);
33
+ Solitude.navigate(keyboards[i].url);
34
34
  }
35
35
  }
36
36
  } else if (keyboards[i].sco) {
37
37
  if (e.key === keyboards[i].key) {
38
- sco[keyboards[i].sco]();
38
+ Solitude[keyboards[i].sco]?.();
39
39
  }
40
40
  } else if (keyboards[i].func) {
41
41
  if (e.key === keyboards[i].key) {
@@ -63,4 +63,4 @@ script.
63
63
  openKeyboard();
64
64
  let keyboard = document.getElementById('consoleKeyboard');
65
65
  keyboard?.classList.add('on');
66
- }
66
+ }
@@ -1,39 +1,3 @@
1
- div(id="loading-box" onclick="preloader.endLoading();" style="zoom:1")
1
+ div(id="loading-box" data-solitude-action="endLoading" style="zoom:1")
2
2
  div.loading-bg
3
3
  img.loading-img.nolazyload(src=url_for(theme.loading.favicon || theme.site.icon), alt="loading image")
4
-
5
- script.
6
- const preloader = {
7
- isLoaded: false,
8
- endLoading: () => {
9
- if (!preloader.isLoaded) {
10
- document.getElementById('loading-box').classList.add('loaded');
11
- preloader.isLoaded = true;
12
- preloader.togglePaceDone();
13
- }
14
- },
15
- initLoading: () => {
16
- document.getElementById('loading-box').classList.remove('loaded');
17
- preloader.isLoaded = false;
18
- preloader.togglePaceDone();
19
- },
20
- togglePaceDone: () => {
21
- document.getElementById('body').className = preloader.isLoaded ? 'pace-done' : '';
22
- }
23
- }
24
-
25
- window.addEventListener('load', () => {
26
- preloader.endLoading();
27
- });
28
-
29
- window.addEventListener('pjax:send', () => {
30
- preloader.initLoading();
31
- });
32
-
33
- document.addEventListener('pjax:complete', () => {
34
- preloader.endLoading();
35
- });
36
-
37
- setTimeout(() => {
38
- preloader.endLoading();
39
- }, 5000);
@@ -7,10 +7,10 @@ each post in page.posts.find({ parent: { $exists: false } }).data
7
7
  a.article-sort-item-img(href=url_for(post.path) title=post.title)
8
8
  img(src=url_for(post.cover) alt=post.title)
9
9
  .article-sort-item-info
10
- a.article-sort-item-title(href=url_for(post.path) title=post.title onclick="window.event.cancelBubble=true;") #{post.title}
10
+ a.article-sort-item-title(href=url_for(post.path) title=post.title data-solitude-action="noop" data-solitude-stop="true") #{post.title}
11
11
  .article-sort-item-tags
12
12
  each tags in post.tags.data
13
- a.article-meta__tags(href=url_for(tags.path) onclick="window.event.cancelBubble=true;")
13
+ a.article-meta__tags(href=url_for(tags.path) data-solitude-action="noop" data-solitude-stop="true")
14
14
  span.tags-punctuation
15
15
  i.solitude.fas.fa-hashtag
16
- =tags.name
16
+ =tags.name
@@ -16,14 +16,18 @@ mixin link(url, text, options)
16
16
  - var target = options.target
17
17
  - var className = options.class
18
18
  - var id = options.id
19
- - var onclick = options.onclick
19
+ - var action = options.action
20
+ - var stop = options.stop
21
+ - var heotip = options.heotip
20
22
  a(
21
23
  href=url_for(url)
22
24
  title=title
23
25
  target=target
24
26
  class=className
25
27
  id=id
26
- onclick=onclick
28
+ data-solitude-action=action
29
+ data-solitude-stop=stop
30
+ heotip=heotip
27
31
  )
28
32
  if text
29
33
  = text
@@ -93,7 +97,7 @@ mixin postMeta(post, options)
93
97
  if showTags && post.tags && post.tags.length > 0
94
98
  span.article-meta.tags
95
99
  each tag in post.tags.data
96
- - var linkOptions = { class: 'article-meta__tags', onclick: 'event.stopPropagation();' }
100
+ - var linkOptions = { class: 'article-meta__tags', action: 'noop', stop: 'true' }
97
101
  +link(tag.path, '', linkOptions)
98
102
  span.tags-punctuation
99
103
  +icon('fas fa-hashtag')
@@ -176,4 +180,4 @@ mixin shareButton(platform, url, title)
176
180
 
177
181
  - var linkOptions = { class: 'share-' + platform, target: '_blank', title: '分享到' + platform }
178
182
  +link(shareUrl, '', linkOptions)
179
- +icon('fab fa-' + platform)
183
+ +icon('fab fa-' + platform)
@@ -3,7 +3,7 @@ script.
3
3
  restartOnPushState: false
4
4
  }
5
5
 
6
- utils.addGlobalFn('pjaxSend', () => {
6
+ Solitude.addGlobalFn('pjaxSend', () => {
7
7
  Pace.restart()
8
8
  }, 'pace_restart')
9
9
 
@@ -3,6 +3,6 @@ nav#pagination
3
3
  - var options = {mid_size: 1,escape: false,next_text: `<div class="pagination_tips_next">${_p("pagination.next")}</div> <i class="solitude fas fa-chevron-right"></i>`,prev_text: `<i class="solitude fas fa-chevron-left"></i> <div class="pagination_tips_prev">${_p("pagination.prev")}</div>`}
4
4
  !=paginator(options)
5
5
  div.toPageGroup
6
- input#toPageText(oninput="value=value.replace(/[^0-9]/g,'')" maxlength="3" title=_p('pagination.to') onkeyup="if (this.value === '0') this.value = ''")
7
- a#toPageButton(onclick="sco.toPage()")
8
- i.solitude.fas.fa-angles-right
6
+ input#toPageText(inputmode="numeric" pattern="[0-9]*" maxlength="3" title=_p('pagination.to'))
7
+ a#toPageButton(data-solitude-action="toPage")
8
+ i.solitude.fas.fa-angles-right
@@ -8,7 +8,8 @@ include ./mixins/common.pug
8
8
  mixin siteName()
9
9
  +link('/', '', {
10
10
  id: 'site-name',
11
- title: _p('nav.site_name_title')
11
+ title: _p('nav.site_name_title'),
12
+ heotip: _p('nav.site_name_title')
12
13
  })
13
14
  case theme.site.name.class
14
15
  when 'i_class'
@@ -19,7 +20,7 @@ mixin siteName()
19
20
  span.title= theme.site.name.custom
20
21
  +icon('fas fa-home')
21
22
 
22
- nav#nav.show
23
+ nav#nav.show(data-solitude-action="onNavBlankClickCloseConsole" data-solitude-event="true")
23
24
  #nav-group
24
25
  #blog_name
25
26
  //- 分组导航按钮
@@ -34,7 +35,7 @@ nav#nav.show
34
35
  //- 页面名称遮罩
35
36
  #page-name-mask
36
37
  #page-name
37
- a#page-name-text(onclick="sco.toTop()")= title || config.title
38
+ a#page-name-text(data-solitude-action="toTop" title=_p('nav.backtop') heotip=_p('nav.backtop'))= title || config.title
38
39
 
39
40
  //- 主菜单
40
41
  #menus
@@ -1,11 +1,12 @@
1
1
  if site.data.about
2
2
  #about-page
3
3
  include ../widgets/page/about/authorinfo
4
- include ../widgets/page/about/contentinfo
5
- include ../widgets/page/about/skillsinfo
6
- include ../widgets/page/about/personalities
7
- include ../widgets/page/about/motto
8
- include ../widgets/page/about/hobbies
9
- include ../widgets/page/about/other
10
- include ../widgets/page/about/tenyear
11
- include ../widgets/page/about/award
4
+ .author-page-content
5
+ include ../widgets/page/about/contentinfo
6
+ include ../widgets/page/about/skillsinfo
7
+ include ../widgets/page/about/personalities
8
+ include ../widgets/page/about/motto
9
+ include ../widgets/page/about/hobbies
10
+ include ../widgets/page/about/other
11
+ include ../widgets/page/about/tenyear
12
+ include ../widgets/page/about/award
@@ -12,7 +12,7 @@ if theme.brevity.enable
12
12
  span.bber_nick= config.author
13
13
  time.datetime.bber_date(datetime=moment(item.date).format())
14
14
  if theme.comment.use && item.content
15
- a.bber-reply.goComment(onclick=`sco.toTalk('${item.content}')`)
15
+ a.bber-reply.goComment(data-solitude-action="toTalk" data-solitude-value=item.content)
16
16
  i.solitude.fas.fa-comment
17
17
 
18
18
  #bber-content
@@ -52,7 +52,7 @@ if theme.brevity.enable
52
52
  i.solitude.fas.fa-link
53
53
  = _p('essay.link')
54
54
  if theme.comment.use && item.content
55
- a.bber-reply(onclick=`sco.toTalk('${item.content}')`)
55
+ a.bber-reply(data-solitude-action="toTalk" data-solitude-value=item.content)
56
56
  i.solitude.fas.fa-comment
57
57
  #bber-tips
58
58
  if theme.brevity.strip === -1
@@ -1,16 +1,28 @@
1
1
  - var $data = page.data
2
+ - const linksPageData = site.data[$data]
3
+ - const linksGroups = linksPageData && Array.isArray(linksPageData.links) ? linksPageData.links : []
4
+ - const linksTotal = linksGroups.reduce((count, group) => count + (Array.isArray(group.link_list) ? group.link_list.length : 0), 0)
5
+ - const configuredLinksThreshold = Number(theme.page && theme.page.links && theme.page.links.async_threshold)
6
+ - const linksThreshold = Number.isInteger(configuredLinksThreshold) && configuredLinksThreshold >= 0 ? configuredLinksThreshold : 200
7
+ - const asyncLinks = linksTotal > linksThreshold
2
8
  if page.banner
3
9
  .flink#banners
4
10
  include ../widgets/page/links/banner
5
11
  .flink.article-container
6
- each data in site.data[$data].links
7
- h2= data.class_name + " (" + data.link_list.length + ")"
8
- .flink-desc= data.descr
9
- case data.type
10
- when 'card'
11
- include ../widgets/page/links/linksCard
12
- when 'item'
13
- include ../widgets/page/links/linksItem
14
- when 'discn'
15
- include ../widgets/page/links/linksDiscn
16
- != page.content
12
+ if asyncLinks
13
+ .friend-links-dynamic(data-friend-links-list)
14
+ .flink-loading-skeleton(role="status" aria-label=_p('link.loading'))
15
+ each item in [0, 1, 2, 3, 4, 5]
16
+ .flink-loading-item
17
+ else
18
+ each data in linksGroups
19
+ h2= data.class_name + " (" + data.link_list.length + ")"
20
+ .flink-desc= data.descr
21
+ case data.type
22
+ when 'card'
23
+ include ../widgets/page/links/linksCard
24
+ when 'item'
25
+ include ../widgets/page/links/linksItem
26
+ when 'discn'
27
+ include ../widgets/page/links/linksDiscn
28
+ != page.content
@@ -4,8 +4,3 @@ if theme.music.enable
4
4
  meting-js(id=theme.music.id server=theme.music.server type=theme.music.type mutex=theme.music.mutex ? "true" : "false" volume=theme.music.volume preload="none" data-lrctype="0" order=theme.music.order)
5
5
  .Music-loading
6
6
  div APlayer加载中...
7
- script(pjax).
8
- (async function () {
9
- if (typeof initializeMusicPlayer === "undefined") await utils.getScript('!{url_for(theme.cdn.music_js)}').then(() => initializeMusicPlayer())
10
- else initializeMusicPlayer()
11
- })()