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
@@ -24,12 +24,12 @@ script().
24
24
  region: '!{region}',
25
25
  path: window.location.pathname,
26
26
  onCommentLoaded: () => {
27
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
27
+ Solitude.config.lightbox && Solitude.lightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
28
28
  }
29
29
  }, !{JSON.stringify(option)}))
30
30
 
31
31
  !{count ? ' && getCount()' : ''}
32
- sco.owoBig({
32
+ Solitude.owoBig({
33
33
  body: '.OwO-body',
34
34
  item: '.OwO-items li'
35
35
  })
@@ -39,11 +39,11 @@ script().
39
39
 
40
40
  const loadTwikoo = () => {
41
41
  if (typeof twikoo === 'object') setTimeout(init,0)
42
- else utils.getScript('!{url_for(theme.cdn.twikoo)}').then(init)
42
+ else Solitude.getScript('!{url_for(theme.cdn.twikoo)}').then(init)
43
43
  }
44
44
 
45
45
  if ('!{use[0]}' === 'Twikoo' || !{lazyload}) {
46
- if (!{lazyload}) utils.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
46
+ if (!{lazyload}) Solitude.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
47
47
  else loadTwikoo()
48
48
  } else {
49
49
  window.loadTwoComment = loadTwikoo
@@ -74,7 +74,7 @@ if commentBarrage
74
74
  id: item.id
75
75
  })))
76
76
  }
77
- if (typeof initializeCommentBarrage === "undefined") await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
77
+ if (typeof initializeCommentBarrage === "undefined") await Solitude.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
78
78
  else init()
79
79
  }).catch(error => console.error("An error occurred while fetching comments: ", error))
80
80
  }
@@ -19,18 +19,18 @@ script.
19
19
  visitor: #{visitor},
20
20
  ...!{JSON.stringify(option)}
21
21
  })
22
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#comment .vcontent img:not(.vemoji)'))
23
- sco.owoBig({body: '.vwrap', item: '.vemojis i'})
22
+ Solitude.config.lightbox && Solitude.lightbox(document.querySelectorAll('#comment .vcontent img:not(.vemoji)'))
23
+ Solitude.owoBig({body: '.vwrap', item: '.vemojis i'})
24
24
  }
25
25
  const loadValine = async () => {
26
26
  if (typeof Valine === 'function') setTimeout(initValine, 0)
27
27
  else {
28
- await utils.getScript('!{url_for(theme.cdn.valine)}').then(initValine)
28
+ await Solitude.getScript('!{url_for(theme.cdn.valine)}').then(initValine)
29
29
  }
30
30
  !{commentBarrage} && barrageValine()
31
31
  }
32
32
  if ('!{use[0]}' === 'Valine' || !{lazyload}) {
33
- if (!{lazyload}) utils.loadComment(document.getElementById('vcomment'), loadValine)
33
+ if (!{lazyload}) Solitude.loadComment(document.getElementById('vcomment'), loadValine)
34
34
  else loadValine()
35
35
  } else {
36
36
  window.loadTwoComment = loadValine
@@ -65,8 +65,8 @@ if commentBarrage
65
65
  mailMd5: md5(item.mail),
66
66
  id: item.objectId
67
67
  })))
68
- if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
69
- if (typeof initializeCommentBarrage === "undefined") await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
68
+ if (typeof md5 === "undefined") await Solitude.getScript('!{url_for(theme.cdn.blueimp_md5)}')
69
+ if (typeof initializeCommentBarrage === "undefined") await Solitude.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
70
70
  else init()
71
71
  }).catch(error => console.error("An error occurred while fetching comments: ", error))
72
72
  }
@@ -16,9 +16,9 @@ script.
16
16
  ...!{JSON.stringify(option)}
17
17
  }
18
18
  const walineInstance = initFn(walineOptions)
19
- utils.addGlobalFn('pjax', () => walineInstance.destroy(), 'destroyWaline')
20
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#comment .wl-content img:not(.wl-emoji)'))
21
- sco.owoBig({
19
+ Solitude.addGlobalFn('pjax', () => walineInstance.destroy(), 'destroyWaline')
20
+ Solitude.config.lightbox && Solitude.lightbox(document.querySelectorAll('#comment .wl-content img:not(.wl-emoji)'))
21
+ Solitude.owoBig({
22
22
  body: '.wl-emoji-popup',
23
23
  item: '.wl-tab-wrapper button'
24
24
  })
@@ -27,7 +27,7 @@ script.
27
27
  async function loadWaline() {
28
28
  if (walineInitFunction) initWaline(walineInitFunction)
29
29
  else {
30
- await utils.getCSS('!{url_for(theme.cdn.waline_css)}')
30
+ await Solitude.getCSS('!{url_for(theme.cdn.waline_css)}')
31
31
  const {init} = await import('!{url_for(theme.cdn.waline_js)}')
32
32
  walineInitFunction = init || Waline.init
33
33
  initWaline(walineInitFunction)
@@ -37,7 +37,7 @@ script.
37
37
  }
38
38
 
39
39
  if (!{use[0] === 'Waline'} || !{lazyload}) {
40
- if (!{lazyload}) utils.loadComment(document.getElementById('waline-wrap'), loadWaline)
40
+ if (!{lazyload}) Solitude.loadComment(document.getElementById('waline-wrap'), loadWaline)
41
41
  else loadWaline()
42
42
  } else window.loadTwoComment = loadWaline
43
43
  })()
@@ -61,7 +61,7 @@ if commentBarrage
61
61
  id: item.objectId
62
62
  })))
63
63
  }
64
- if (typeof initializeCommentBarrage === "undefined") await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
64
+ if (typeof initializeCommentBarrage === "undefined") await Solitude.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
65
65
  else init()
66
66
  }).catch(error => console.error("An error occurred while fetching comments: ", error))
67
67
  }
@@ -52,6 +52,6 @@ script.
52
52
  if (typeof twikoo === 'object') {
53
53
  fetchCommentsCount();
54
54
  } else {
55
- utils.getScript('!{url_for(theme.cdn.twikoo)}').then(fetchCommentsCount);
55
+ Solitude.getScript('!{url_for(theme.cdn.twikoo)}').then(fetchCommentsCount);
56
56
  }
57
57
  }
@@ -1,8 +1,12 @@
1
- div.needEndHide#nav-music
1
+ div.needEndHide#nav-music(data-solitude-action='handleMusicClick' data-solitude-event='true')
2
2
  #nav-music-hoverTips
3
- i#music-prev.music-control-btn.fas.fa-backward-step(onclick='sco.musicSkipBack()')
4
- i#music-pause.music-control-btn.fas.fa-pause(onclick='sco.musicToggle()')
5
- i#music-play.music-control-btn.fas.fa-play(onclick='sco.musicToggle()')
6
- i#music-next.music-control-btn.fas.fa-forward-step(onclick='sco.musicSkipForward()')
3
+ button#music-prev.music-control-btn(type='button' title=_p('right_menu.music.back') aria-label=_p('right_menu.music.back') data-solitude-action='musicSkipBack' data-solitude-stop='true')
4
+ i.fas.fa-backward-step
5
+ button#music-pause.music-control-btn(type='button' title=_p('right_menu.music.stop') aria-label=_p('right_menu.music.stop') data-solitude-action='musicToggle' data-solitude-stop='true')
6
+ i.fas.fa-pause
7
+ button#music-play.music-control-btn(type='button' title=_p('right_menu.music.start') aria-label=_p('right_menu.music.start') data-solitude-action='musicToggle' data-solitude-stop='true')
8
+ i.fas.fa-play
9
+ button#music-next.music-control-btn(type='button' title=_p('right_menu.music.forward') aria-label=_p('right_menu.music.forward') data-solitude-action='musicSkipForward' data-solitude-stop='true')
10
+ i.fas.fa-forward-step
7
11
 
8
12
  meting-js(id=theme.capsule.id server=theme.capsule.server type=theme.capsule.type mutex="true" preload="none" theme="var(--efu-main)" data-lrctype="0" order="random" volume=theme.capsule.volume)
@@ -34,14 +34,14 @@ script(pjax).
34
34
  <img src='${item.avatar}' alt='${item.nick}'>
35
35
  </div>
36
36
  <div class='content'>
37
- <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
37
+ <div class='comment' data-solitude-action='navigateTo' data-solitude-url='${item.url}'>${item.content}</div>
38
38
  <time class="datetime" datetime="${item.date}"></time>
39
39
  </div>
40
40
  </div>
41
41
  `).join('') : "!{_p('newest_comment.zero')}";
42
42
  window.lazyLoadInstance?.update();
43
- window.pjax?.refresh();
44
- sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'));
43
+ Solitude.pjax?.refresh();
44
+ Solitude.changeTimeFormat?.(document.querySelectorAll('.aside-list-item time'));
45
45
  };
46
46
 
47
47
  const getSetting = async () => {
@@ -68,7 +68,7 @@ script(pjax).
68
68
  url: e.page_key + `#atk-comment-${e.id}`,
69
69
  date: e.date,
70
70
  })).slice(0, !{limit});
71
- utils.saveToLocal.set('artalk-newest-comments', artalk, !{theme.comment.newest_comment.storage});
71
+ Solitude.saveToLocal.set('artalk-newest-comments', artalk, !{theme.comment.newest_comment.storage});
72
72
  generateHtml(artalk, asideList);
73
73
  }).catch(error => {
74
74
  console.error(error);
@@ -78,7 +78,7 @@ script(pjax).
78
78
 
79
79
  const newestCommentInit = (asideList) => {
80
80
  if (!asideList) return;
81
- const data = utils.saveToLocal.get('artalk-newest-comments');
81
+ const data = Solitude.saveToLocal.get('artalk-newest-comments');
82
82
  if (data) {
83
83
  generateHtml(data, asideList);
84
84
  } else {
@@ -89,4 +89,4 @@ script(pjax).
89
89
  const $asideList = document.querySelector('.card-recent-comment .aside-list');
90
90
  window.addEventListener('DOMContentLoaded', () => newestCommentInit($asideList), false)
91
91
  window.addEventListener('pjax:complete', () => newestCommentInit(document.querySelector('.card-recent-comment .aside-list')), false);
92
- })();
92
+ })();
@@ -21,15 +21,15 @@ script.
21
21
  <img src='${item.avatar}' alt='${item.nick}'>
22
22
  </div>
23
23
  <div class='content'>
24
- <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
24
+ <div class='comment' data-solitude-action='navigateTo' data-solitude-url='${item.url}'>${item.content}</div>
25
25
  <time class="datetime" datetime="${item.date}"></time>
26
26
  </div>
27
27
  </div>
28
28
  `).join('')
29
29
  document.querySelector('.card-recent-comment .aside-list').innerHTML = array.length ? html : "!{_p('newest_comment.zero')}"
30
30
  window.lazyLoadInstance?.update()
31
- window.pjax?.refresh()
32
- sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
31
+ Solitude.pjax?.refresh()
32
+ Solitude.changeTimeFormat?.(document.querySelectorAll('.aside-list-item time'))
33
33
  }
34
34
  const getComment = async () => {
35
35
  const runTwikoo = () => {
@@ -46,7 +46,7 @@ script.
46
46
  url: `${e.url}#${e.id}`,
47
47
  date: new Date(e.created).toString()
48
48
  })).slice(0, 6)
49
- utils.saveToLocal.set('twikoo-newest-comment', twikooArray, !{theme.comment.newest_comment.storage})
49
+ Solitude.saveToLocal.set('twikoo-newest-comment', twikooArray, !{theme.comment.newest_comment.storage})
50
50
  generateHtml(twikooArray)
51
51
  }).catch((err) => {
52
52
  console.error(err);
@@ -56,14 +56,14 @@ script.
56
56
  if (typeof twikoo === 'object') {
57
57
  runTwikoo()
58
58
  } else {
59
- utils.getScript('!{url_for(theme.cdn.twikoo)}').then(runTwikoo)
59
+ Solitude.getScript('!{url_for(theme.cdn.twikoo)}').then(runTwikoo)
60
60
  }
61
61
  }
62
62
  const newestCommentInit = () => {
63
63
  if (!document.querySelector('.card-recent-comment')) return
64
- const data = utils.saveToLocal.get('twikoo-newest-comment')
64
+ const data = Solitude.saveToLocal.get('twikoo-newest-comment')
65
65
  data ? generateHtml(data) : getComment()
66
66
  }
67
67
  window.addEventListener('DOMContentLoaded', newestCommentInit, false)
68
68
  window.addEventListener('pjax:complete', newestCommentInit, false);
69
- })()
69
+ })()
@@ -22,7 +22,7 @@ script.
22
22
  const $asideList = document.querySelector('.card-recent-comment .aside-list')
23
23
  const newestCommentInit = () => {
24
24
  if (!document.querySelector('.card-recent-comment')) return
25
- const data = utils.saveToLocal.get('valine-newest-comment')
25
+ const data = Solitude.saveToLocal.get('valine-newest-comment')
26
26
  if (data) {
27
27
  generateHtml(data)
28
28
  } else {
@@ -39,7 +39,7 @@ script.
39
39
  "Content-Type": "application/json"
40
40
  },
41
41
  }
42
- if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
42
+ if (typeof md5 === "undefined") await Solitude.getScript('!{url_for(theme.cdn.blueimp_md5)}')
43
43
  await fetch('!{theme.valine.serverURLs}/1.1/classes/Comment?limit=8&order=-createdAt', settings).then(res => res.json())
44
44
  .then(async result => {
45
45
  let ls = []
@@ -53,7 +53,7 @@ script.
53
53
  date: i.updatedAt || i.createdAt
54
54
  })
55
55
  }
56
- utils.saveToLocal.set('valine-newest-comment', ls, !{theme.comment.newest_comment.storage})
56
+ Solitude.saveToLocal.set('valine-newest-comment', ls, !{theme.comment.newest_comment.storage})
57
57
  generateHtml(ls)
58
58
  }).catch(error => {
59
59
  console.error(error);
@@ -65,21 +65,21 @@ script.
65
65
  const $dom = document.querySelector('.card-recent-comment .aside-list')
66
66
  $dom.innerHTML = array.length ? array.map(item => `
67
67
  <div class='aside-list-item'>
68
- <div onclick='pjax.loadUrl(\"${item.url}\")' class='thumbnail'>
68
+ <div data-solitude-action='navigateTo' data-solitude-url='${item.url}' class='thumbnail'>
69
69
  <img src='${item.avatar}' alt='${item.nick}'>
70
70
  <div class='name'><span>${item.nick}</span></div>
71
71
  </div>
72
72
  <div class='content'>
73
- <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
73
+ <div class='comment' data-solitude-action='navigateTo' data-solitude-url='${item.url}'>${item.content}</div>
74
74
  <time class="datetime" datetime="${item.date}"></time>
75
75
  </div>
76
76
  </div>
77
77
  `).join('') : "!{_p('newest_comment.zero')}"
78
78
  window.lazyLoadInstance?.update()
79
- window.pjax?.refresh()
80
- sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
79
+ Solitude.pjax?.refresh()
80
+ Solitude.changeTimeFormat?.(document.querySelectorAll('.aside-list-item time'))
81
81
  }
82
82
 
83
83
  window.addEventListener('DOMContentLoaded', newestCommentInit, false)
84
84
  window.addEventListener('pjax:complete', newestCommentInit, false);
85
- })()
85
+ })()
@@ -21,7 +21,7 @@ script.
21
21
  const $asideList = document.querySelector('.card-recent-comment .aside-list')
22
22
  const newestCommentInit = () => {
23
23
  if (!document.querySelector('.card-recent-comment')) return
24
- const data = utils.saveToLocal.get('waline-newest-comment')
24
+ const data = Solitude.saveToLocal.get('waline-newest-comment')
25
25
  if (data) {
26
26
  generateHtml(data)
27
27
  } else {
@@ -41,7 +41,7 @@ script.
41
41
  'date': new Date(e.time || e.insertedAt)
42
42
  }
43
43
  })
44
- utils.saveToLocal.set('waline-newest-comment', walineArray, !{theme.comment.newest_comment.storage})
44
+ Solitude.saveToLocal.set('waline-newest-comment', walineArray, !{theme.comment.newest_comment.storage})
45
45
  generateHtml(walineArray)
46
46
  }).catch(error => {
47
47
  console.error(error)
@@ -53,21 +53,21 @@ script.
53
53
  const $dom = document.querySelector('.card-recent-comment .aside-list')
54
54
  $dom.innerHTML = array.length ? array.map(item => `
55
55
  <div class='aside-list-item'>
56
- <div onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
56
+ <div data-solitude-action='navigateTo' data-solitude-url='${item.url}' class='thumbnail'>
57
57
  <img src='${item.avatar}' alt='${item.nick}'>
58
58
  <div class='name'><span>${item.nick}</span></div>
59
59
  </div>
60
60
  <div class='content'>
61
- <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
61
+ <div class='comment' data-solitude-action='navigateTo' data-solitude-url='${item.url}'>${item.content}</div>
62
62
  <time class="datetime" datetime="${item.date}"></time>
63
63
  </div>
64
64
  </div>
65
65
  `).join('') : "!{_p('newest_comment.zero')}"
66
66
  window.lazyLoadInstance?.update()
67
- window.pjax?.refresh()
68
- sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
67
+ Solitude.pjax?.refresh()
68
+ Solitude.changeTimeFormat?.(document.querySelectorAll('.aside-list-item time'))
69
69
  }
70
70
 
71
71
  window.addEventListener('DOMContentLoaded', newestCommentInit, false)
72
72
  window.addEventListener('pjax:complete', newestCommentInit, false);
73
- })()
73
+ })()
@@ -2,16 +2,13 @@
2
2
  - const select = ['title','#body-wrap','#site-config','meta[name="description"]','.js-pjax','meta[property^="og:"]','#config-diff', '.rs_show', '.rs_hide']
3
3
 
4
4
  script.
5
- let pjax = null;
6
-
7
5
  function initPjax() {
8
6
  if (typeof Pjax === 'undefined') {
9
- console.warn('Pjax is not loaded yet, retrying...');
10
7
  setTimeout(initPjax, 100);
11
8
  return;
12
9
  }
13
10
 
14
- pjax = new Pjax({
11
+ const instance = new Pjax({
15
12
  elements: 'a:not([target="_blank"])',
16
13
  selectors: !{JSON.stringify(select)},
17
14
  cacheBust: false,
@@ -19,8 +16,7 @@ script.
19
16
  scrollRestoration: false
20
17
  })
21
18
 
22
- // pjax 实例挂载到全局
23
- window.pjax = pjax;
19
+ Solitude.pjax = instance;
24
20
 
25
21
  document.querySelectorAll('script[data-pjax]').forEach(item => {
26
22
  const newScript = document.createElement('script')
@@ -30,8 +26,15 @@ script.
30
26
  item.parentNode.replaceChild(newScript, item)
31
27
  })
32
28
 
33
- document.addEventListener('pjax:complete', () => {
34
- window.refreshFn()
29
+ document.addEventListener('pjax:send', () => {
30
+ document.dispatchEvent(new CustomEvent('solitude:beforeNavigate'))
31
+ Solitude.disposePage?.()
32
+ Object.values(window.globalFn?.pjax || {}).forEach(dispose => dispose())
33
+ if (window.globalFn) window.globalFn.pjax = {}
34
+ })
35
+
36
+ document.addEventListener('pjax:complete', async () => {
37
+ await Solitude.refresh()
35
38
 
36
39
  document.querySelectorAll('script[data-pjax]').forEach(item => {
37
40
  const newScript = document.createElement('script')
@@ -41,13 +44,16 @@ script.
41
44
  item.parentNode.replaceChild(newScript, item)
42
45
  })
43
46
 
44
- GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
47
+ Solitude.config.lazyload.enable && window.lazyLoadInstance?.update()
48
+ document.dispatchEvent(new CustomEvent('solitude:afterNavigate', {
49
+ detail: {page: Solitude.page}
50
+ }))
45
51
 
46
52
  })
47
53
 
48
54
  document.addEventListener('pjax:error', (e) => {
49
55
  if (e.request.status === 404) {
50
- pjax.loadUrl('/404.html')
56
+ Solitude.navigate('/404.html')
51
57
  }
52
58
  })
53
59
  }
@@ -12,9 +12,9 @@
12
12
  #search-results
13
13
  #algolia-hits
14
14
  each tag in theme.search.tags || []
15
- a.tag-list(href='javascript:void(0);' onclick="pjax.loadUrl('" + url_for('/tags/' + tag) + "/')")=tag
15
+ a.tag-list(href='javascript:void(0);' data-solitude-action="navigateTo" data-solitude-url=url_for('/tags/' + tag) + "/")=tag
16
16
 
17
17
  #algolia-tips
18
18
  #algolia-pagination
19
19
  #algolia-stats
20
- #search-mask
20
+ #search-mask
@@ -10,7 +10,7 @@
10
10
  apiKey: '!{apiKey}',
11
11
  indexName: '!{indexName}',
12
12
  container: '#docsearch',
13
- placeholder: '!{ placeholder || _p("search.input_placeholder")}',
13
+ placeholder: '!{ placeholder || _p("search.placeholder")}',
14
14
  }, !{JSON.stringify(option)}))
15
15
 
16
16
  const handleClick = () => {
@@ -18,9 +18,9 @@
18
18
  }
19
19
 
20
20
  const searchClickFn = () => {
21
- utils.addEventListenerPjax(document.querySelector('#search-button > .search'), 'click', handleClick)
21
+ Solitude.addEventListenerPjax(document.querySelector('#search-button > .search'), 'click', handleClick)
22
22
  }
23
23
 
24
24
  searchClickFn()
25
25
  window.addEventListener('pjax:complete', searchClickFn)
26
- })()
26
+ })()
@@ -2,10 +2,8 @@ if theme.search.enable
2
2
  case theme.search.type
3
3
  when 'algolia'
4
4
  include algolia-search
5
- script(src=url_for(theme.cdn.algolia_js))
6
5
  when 'local'
7
6
  include local-search
8
- script(src=url_for(theme.cdn.local_search))
9
7
  when 'docsearch'
10
8
  include docsearch
11
- link(rel="stylesheet" href=url_for(theme.cdn.docsearch_css))
9
+ link(rel="stylesheet" href=url_for(theme.cdn.docsearch_css))
@@ -1,16 +1,16 @@
1
1
  #local-search
2
- div.search-dialog
2
+ div.search-dialog(role="dialog" aria-modal="true" aria-labelledby="local-search-title")
3
3
  nav.search-nav
4
- span.search-dialog-title=__('nav.search')
5
- button.search-close-button
4
+ span.search-dialog-title#local-search-title=__('nav.search')
5
+ button.search-close-button(type="button" aria-label=__('search.close'))
6
6
  i.solitude.fas.fa-xmark
7
7
  div.search-wrap
8
8
  div.search-box
9
- input.search-box-input#search-input(type="text", autocomplete="off", spellcheck="false", autocorrect="off", autocapitalize="off", placeholder=__('search.placeholder'))
10
- div#search-results
11
- #search-hits
12
- each tag in theme.search.tags || []
13
- a.tag-list(href='javascript:void(0);' onclick="pjax.loadUrl('" + url_for('/tags/' + tag) + "/')")=tag
9
+ input.search-box-input#search-input(type="search" autocomplete="off" spellcheck="false" autocorrect="off" autocapitalize="off" placeholder=__('search.placeholder') aria-label=__('search.placeholder'))
10
+ div#search-suggestions(aria-label=__('search.suggestions'))
11
+ each tag in theme.search.tags || []
12
+ button.tag-list(type="button" data-query=tag)=tag
13
+ ul#search-results(hidden)
14
14
  div#search-pagination
15
15
  div#search-tips
16
- div#search-mask
16
+ div#search-mask
package/layout/index.pug CHANGED
@@ -34,13 +34,15 @@ mixin postsList()
34
34
 
35
35
  //- 首页主内容组件
36
36
  mixin homeContent()
37
- main.layout#content-inner
38
- #home
37
+ main.layout.layout--home#content-inner
38
+ .home-category-bar.category-in-bar
39
39
  +categoryBar()
40
- +postsList()
41
-
42
- //- 侧边栏
43
- include ./includes/widgets/aside/aside
40
+ .home-layout-row
41
+ #home
42
+ +postsList()
43
+
44
+ //- 侧边栏
45
+ include ./includes/widgets/aside/aside
44
46
 
45
47
  block content
46
48
  +homeTop()
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "3.0.21",
3
+ "version": "4.0.0",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.",
5
5
  "main": "package.json",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
6
9
  "keywords": [
7
10
  "hexo",
8
11
  "theme",
9
12
  "solitude",
10
13
  "Card UI Design",
11
14
  "@everfu",
12
- "everly",
15
+ "everfu",
16
+ "伍拾柒",
13
17
  "hexo-theme-solitude"
14
18
  ],
15
19
  "repository": {
@@ -26,8 +30,5 @@
26
30
  },
27
31
  "homepage": "https://solitude.js.org",
28
32
  "author": "Hexo-Theme-Solitude<o@efu.me>",
29
- "license": "Apache-2.0",
30
- "scripts": {
31
- "test": "echo \"Error: no test specified\" && exit 1"
32
- }
33
- }
33
+ "license": "Apache-2.0"
34
+ }