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
@@ -4,30 +4,41 @@
4
4
 
5
5
  .banner-button-group
6
6
  if theme.footer.randomlink
7
- a.banner-button.secondary(onclick="travelling()")
7
+ a.banner-button.secondary(data-solitude-action="travelling")
8
8
  i.solitude.fas.fa-tower-broadcast
9
9
  span.banner-button-text=_p('link.banner.random')
10
10
  if theme.comment.use
11
- a.banner-button(onclick="sco.scrollToComment()")
11
+ a.banner-button(data-solitude-action="scrollToComment")
12
12
  i.solitude.fas.fa-circle-chevron-right
13
13
  span.solitude.banner-button-text=_p('link.banner.toComment')
14
14
 
15
+ - const bannerGroups = site.data.links && Array.isArray(site.data.links.links) ? site.data.links.links : []
16
+ - const bannerLinksTotal = bannerGroups.reduce((count, group) => count + (Array.isArray(group.link_list) ? group.link_list.length : 0), 0)
17
+ - const configuredBannerThreshold = Number(theme.page && theme.page.links && theme.page.links.async_threshold)
18
+ - const bannerThreshold = Number.isInteger(configuredBannerThreshold) && configuredBannerThreshold >= 0 ? configuredBannerThreshold : 200
19
+ - const asyncBannerLinks = bannerLinksTotal > bannerThreshold
15
20
  - if (site.data.links.swiper !== false)
16
- .tags-group-all.nowrapMove
17
- - const data = site.data.links.links.filter(x => x.type !== 'discn')
18
- - const links = data.flatMap(x => x.link_list)
19
- .tags-group-wrapper
20
- - const pairs = links.reduce(function(acc, link, index) {
21
- - if (index % 2 === 0) acc.push([link])
22
- - else acc[acc.length - 1].push(link)
23
- - return acc
24
- - }, [])
25
- each i in [0, 1]
26
- each pair in pairs
27
- .tags-group-icon-pair
28
- each y in pair
29
- a.tags-group-icon(href=url_for(y.link), title=y.name)
30
- img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
31
- span.tags-group-title=y.name
21
+ if asyncBannerLinks
22
+ .tags-group-all.nowrapMove(data-friend-links-banner)
23
+ .friend-links-status(role="status")
24
+ i.solitude.fas.fa-spinner.fa-spin(aria-hidden="true")
25
+ span= _p('link.loading')
26
+ else
27
+ .tags-group-all.nowrapMove
28
+ - const data = site.data.links.links.filter(x => x.type !== 'discn')
29
+ - const links = data.flatMap(x => x.link_list).slice(0, 30)
30
+ .tags-group-wrapper
31
+ - const pairs = links.reduce(function(acc, link, index) {
32
+ - if (index % 2 === 0) acc.push([link])
33
+ - else acc[acc.length - 1].push(link)
34
+ - return acc
35
+ - }, [])
36
+ each i in [0, 1]
37
+ each pair in pairs
38
+ .tags-group-icon-pair
39
+ each y in pair
40
+ a.tags-group-icon(href=url_for(y.link), title=y.name)
41
+ img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
42
+ span.tags-group-title=y.name
32
43
  - else
33
- .tags-group-all(style="height:calc(3rem + 72px);")
44
+ .tags-group-all(style="height:calc(3rem + 72px);")
@@ -3,7 +3,7 @@
3
3
  script(pjax).
4
4
  (async () => {
5
5
  const emojiReg = /<img [^>]+ atk-emoticon="[^"]+">/g
6
- if (typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
6
+ if (typeof EasyDanmaku === "undefined") await Solitude.getScript('!{url_for(theme.cdn.envelope_js)}')
7
7
  const envel = new EasyDanmaku({
8
8
  page: '!{theme.envelope.page}',
9
9
  el: '#barrage',
@@ -12,7 +12,7 @@ script(pjax).
12
12
  hover: !{hover},
13
13
  loop: !{loop},
14
14
  })
15
- const data = utils.saveToLocal.get('enevlope')
15
+ const data = Solitude.saveToLocal.get('enevlope')
16
16
  if (data) {
17
17
  envel.batchSend(data, true)
18
18
  return
@@ -30,7 +30,7 @@ script(pjax).
30
30
  })
31
31
  }
32
32
  envel.batchSend(ls, true)
33
- utils.saveToLocal.set('enevlope', ls, .02)
33
+ Solitude.saveToLocal.set('enevlope', ls, .02)
34
34
  }).catch(error => {
35
35
  console.error("An error occurred while fetching comments: ", error)
36
36
  })
@@ -2,8 +2,8 @@
2
2
  != page.content
3
3
  if theme.envelope.enable
4
4
  .switch_message
5
- button.open(type='button' onclick="document.getElementById('barrage').classList.remove('hide')")
5
+ button.open(type='button' data-solitude-action="setTargetClass" data-solitude-target="#barrage" data-solitude-class="hide" data-solitude-enabled="false")
6
6
  span(aria-hidden='true')= __('message.open')
7
- button.close(type='button' onclick="document.getElementById('barrage').classList.add('hide')")
7
+ button.close(type='button' data-solitude-action="setTargetClass" data-solitude-target="#barrage" data-solitude-class="hide" data-solitude-enabled="true")
8
8
  span(aria-hidden='true')= __('message.close')
9
- #barrage
9
+ #barrage
@@ -3,7 +3,7 @@
3
3
  script(pjax).
4
4
  (async () => {
5
5
  const emojiReg = /<img class="tk-owo-emotion" [^>]+>/g
6
- if (typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
6
+ if (typeof EasyDanmaku === "undefined") await Solitude.getScript('!{url_for(theme.cdn.envelope_js)}')
7
7
  const Danmaku = new EasyDanmaku({
8
8
  page: '!{theme.envelope.page}',
9
9
  el: '#barrage',
@@ -12,7 +12,7 @@ script(pjax).
12
12
  hover: !{hover},
13
13
  loop: !{loop},
14
14
  })
15
- const data = utils.saveToLocal.get('enevlope')
15
+ const data = Solitude.saveToLocal.get('enevlope')
16
16
  if (data) {
17
17
  Danmaku.batchSend(data, true)
18
18
  return
@@ -32,7 +32,7 @@ script(pjax).
32
32
  ls.push({avatar: i.avatar, content: i.nick + ': ' + formatDanmaku(i.comment), url: i.url + '#' + i.id})
33
33
  }
34
34
  Danmaku.batchSend(ls, true);
35
- utils.saveToLocal.set('envelope', ls, 0.02)
35
+ Solitude.saveToLocal.set('envelope', ls, 0.02)
36
36
  });
37
37
 
38
38
  function formatDanmaku(str) {
@@ -3,7 +3,7 @@
3
3
  script(pjax).
4
4
  (async () => {
5
5
  const emojiReg = /:[a-z0-9_\u4e00-\u9fa5]+:/g
6
- if(typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
6
+ if(typeof EasyDanmaku === "undefined") await Solitude.getScript('!{url_for(theme.cdn.envelope_js)}')
7
7
  const envel = new EasyDanmaku({
8
8
  page: '!{theme.envelope.page}',
9
9
  el: '#barrage',
@@ -12,7 +12,7 @@ script(pjax).
12
12
  hover: !{hover},
13
13
  loop: !{loop},
14
14
  })
15
- const data = utils.saveToLocal.get('enevlope')
15
+ const data = Solitude.saveToLocal.get('enevlope')
16
16
  if(data){
17
17
  envel.batchSend(data,true)
18
18
  return
@@ -40,9 +40,9 @@ script(pjax).
40
40
  avatar: '!{avatar}/avatar/'+md5(item.mail),
41
41
  url: item.url
42
42
  }))
43
- if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
43
+ if (typeof md5 === "undefined") await Solitude.getScript('!{url_for(theme.cdn.blueimp_md5)}')
44
44
  envel.batchSend(init(),true)
45
- utils.saveToLocal.set('enevlope',init(),.02)
45
+ Solitude.saveToLocal.set('enevlope',init(),.02)
46
46
  } catch (error) {
47
47
  console.error("An error occurred while fetching comments: ", error)
48
48
  }
@@ -1,7 +1,7 @@
1
1
  script(pjax).
2
2
  (async () => {
3
3
  const emojiReg = /<img [^>]+ class="wl-emoji">/g
4
- if(typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
4
+ if(typeof EasyDanmaku === "undefined") await Solitude.getScript('!{url_for(theme.cdn.envelope_js)}')
5
5
  const envel = new EasyDanmaku({
6
6
  page: '!{theme.envelope.page}',
7
7
  el: '#barrage',
@@ -10,7 +10,7 @@ script(pjax).
10
10
  hover: !{hover},
11
11
  loop: !{loop},
12
12
  })
13
- const data = utils.saveToLocal.get('enevlope')
13
+ const data = Solitude.saveToLocal.get('enevlope')
14
14
  if(data){
15
15
  envel.batchSend(data,true)
16
16
  return
@@ -26,7 +26,7 @@ script(pjax).
26
26
  })
27
27
  }
28
28
  envel.batchSend(ls,true)
29
- utils.saveToLocal.set('enevlope',ls,.02)
29
+ Solitude.saveToLocal.set('enevlope',ls,.02)
30
30
  }).catch(error => {
31
31
  console.error("An error occurred while fetching comments: ", error)
32
32
  })
@@ -4,7 +4,7 @@ script(pjax).
4
4
  (async () => {
5
5
  document.querySelector('!{sel}').textContent = `#{__("loading")}`
6
6
  const emojiReg = /<img [^>]+ atk-emoticon="[^"]+">/g
7
- let cache = utils.saveToLocal.get('!{str_name}')
7
+ let cache = Solitude.saveToLocal.get('!{str_name}')
8
8
  if (cache) {
9
9
  setHtml(document.querySelector('!{sel}'), cache)
10
10
  return
@@ -38,12 +38,12 @@ script(pjax).
38
38
  })
39
39
  }
40
40
  setHtml(document.querySelector('!{sel}'), ls)
41
- utils.saveToLocal.set('!{str_name}', ls, !{cache})
41
+ Solitude.saveToLocal.set('!{str_name}', ls, !{cache})
42
42
  })
43
43
 
44
44
  function setHtml(el, data) {
45
45
  el.innerHTML = data.length !== 0 ? data.map(i => `
46
- <div class="comment-card" title="${i.title}" onclick="pjax.loadUrl('${i.url}')">
46
+ <div class="comment-card" title="${i.title}" data-solitude-action="navigateTo" data-solitude-url="${i.url}">
47
47
  <div class="comment-info">
48
48
  <img src="${i.avatar}" class="nolazyload" alt="${i.nick}">
49
49
  <div>
@@ -57,11 +57,7 @@ script(pjax).
57
57
  ${i.title}</div>
58
58
  </div>
59
59
  `).join('') : `#{__("console.newest_comment.empty")}`
60
- if (typeof utils !== 'undefined') utils.diffDateFormat(document.querySelectorAll('.comment-time'))
61
- else {
62
- document.addEventListener('pjax:complete', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
63
- document.addEventListener('DOMContentLoaded', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
64
- }
60
+ Solitude.diffDateFormat(document.querySelectorAll('.comment-time'))
65
61
  }
66
62
 
67
63
  function checkEmoji(content) {
@@ -75,4 +71,4 @@ script(pjax).
75
71
  content = content.replace(/```.*?```/g, '[!{__("console.newest_comment.code")}]')
76
72
  return content
77
73
  }
78
- })()
74
+ })()
@@ -5,7 +5,7 @@ script(pjax).
5
5
  (async () => {
6
6
  document.querySelector('!{sel}').textContent = `#{__("loading")}`
7
7
  const emojiReg = /<img class="tk-owo-emotion" [^>]+>/g
8
- let cache = utils.saveToLocal.get('!{str_name}')
8
+ let cache = Solitude.saveToLocal.get('!{str_name}')
9
9
  if (cache) {
10
10
  setHtml(document.querySelector('!{sel}'), cache)
11
11
  return
@@ -46,12 +46,12 @@ script(pjax).
46
46
  })
47
47
  }
48
48
  setHtml(document.querySelector('!{sel}'), ls)
49
- utils.saveToLocal.set('!{str_name}', ls, !{cache})
49
+ Solitude.saveToLocal.set('!{str_name}', ls, !{cache})
50
50
  });
51
51
 
52
52
  function setHtml(el, data) {
53
53
  el.innerHTML = data.length !== 0 ? data.map(i => `
54
- <div class="comment-card" title="${i.title}" onclick="pjax.loadUrl('${i.url}')">
54
+ <div class="comment-card" title="${i.title}" data-solitude-action="navigateTo" data-solitude-url="${i.url}">
55
55
  <div class="comment-info">
56
56
  <img src="${i.avatar}" class="nolazyload" alt="${i.nick}">
57
57
  <div>
@@ -65,11 +65,7 @@ script(pjax).
65
65
  ${i.title}</div>
66
66
  </div>
67
67
  `).join('') : `#{__("console.newest_comment.empty")}`
68
- if (typeof utils !== 'undefined') utils.diffDateFormat(document.querySelectorAll('.comment-time'))
69
- else {
70
- document.addEventListener('pjax:complete', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
71
- document.addEventListener('DOMContentLoaded', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
72
- }
68
+ Solitude.diffDateFormat(document.querySelectorAll('.comment-time'))
73
69
  }
74
70
 
75
71
  function formatContent(content) {
@@ -81,4 +77,4 @@ script(pjax).
81
77
  content = content.replace(/<.*?>/g, '');
82
78
  return content
83
79
  }
84
- })()
80
+ })()
@@ -4,13 +4,13 @@ script(pjax).
4
4
  (async () => {
5
5
  document.querySelector('!{sel}').textContent = `#{__("loading")}`
6
6
  const emojiReg = /:[a-z0-9_\u4e00-\u9fa5]+:/g
7
- let cache = utils.saveToLocal.get('!{str_name}')
7
+ let cache = Solitude.saveToLocal.get('!{str_name}')
8
8
  if (cache) {
9
9
  setHtml(document.querySelector('!{sel}'), cache)
10
10
  return
11
11
  }
12
12
  let ls = []
13
- if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
13
+ if (typeof md5 === "undefined") await Solitude.getScript('!{url_for(theme.cdn.blueimp_md5)}')
14
14
  await fetch('!{serverURLs}/1.1/classes/Comment?limit=8&order=-createdAt', {
15
15
  method: "GET",
16
16
  headers: {
@@ -43,12 +43,12 @@ script(pjax).
43
43
  })
44
44
  }
45
45
  setHtml(document.querySelector('!{sel}'), ls)
46
- utils.saveToLocal.set('!{str_name}', ls, !{cache})
46
+ Solitude.saveToLocal.set('!{str_name}', ls, !{cache})
47
47
  })
48
48
 
49
49
  function setHtml(el, data) {
50
50
  el.innerHTML = data.length !== 0 ? data.map(i => `
51
- <div class="comment-card" title="${i.title}" onclick="pjax.loadUrl('${i.url}')">
51
+ <div class="comment-card" title="${i.title}" data-solitude-action="navigateTo" data-solitude-url="${i.url}">
52
52
  <div class="comment-info">
53
53
  <img src="${i.avatar}" class="nolazyload" alt="${i.nick}">
54
54
  <div>
@@ -62,11 +62,7 @@ script(pjax).
62
62
  ${i.title}</div>
63
63
  </div>
64
64
  `).join('') : `#{__("console.newest_comment.empty")}`
65
- if (typeof utils !== 'undefined') utils.diffDateFormat(document.querySelectorAll('.comment-time'))
66
- else {
67
- document.addEventListener('pjax:complete', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
68
- document.addEventListener('DOMContentLoaded', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
69
- }
65
+ Solitude.diffDateFormat(document.querySelectorAll('.comment-time'))
70
66
  }
71
67
 
72
68
  function formatContent(content) {
@@ -76,4 +72,4 @@ script(pjax).
76
72
  content = content.replace(/```.*?```/g, '[!{__("console.newest_comment.code")}]')
77
73
  return content
78
74
  }
79
- })()
75
+ })()
@@ -2,7 +2,7 @@ script(pjax).
2
2
  (async () => {
3
3
  document.querySelector('!{sel}').textContent = `#{__("loading")}`
4
4
  const emojiReg = /<img [^>]+ class="wl-emoji">/g
5
- let cache = utils.saveToLocal.get('!{str_name}')
5
+ let cache = Solitude.saveToLocal.get('!{str_name}')
6
6
  if (cache) {
7
7
  setHtml(document.querySelector('!{sel}'), cache)
8
8
  return
@@ -34,12 +34,12 @@ script(pjax).
34
34
  })
35
35
  }
36
36
  setHtml(document.querySelector('!{sel}'), ls)
37
- utils.saveToLocal.set('!{str_name}', ls, !{cache})
37
+ Solitude.saveToLocal.set('!{str_name}', ls, !{cache})
38
38
  })
39
39
 
40
40
  function setHtml(el, data) {
41
41
  el.innerHTML = data.length !== 0 ? data.map(i => `
42
- <div class="comment-card" title="${i.title}" onclick="pjax.loadUrl('${i.url}')">
42
+ <div class="comment-card" title="${i.title}" data-solitude-action="navigateTo" data-solitude-url="${i.url}">
43
43
  <div class="comment-info">
44
44
  <img src="${i.avatar}" class="nolazyload" alt="${i.nick}">
45
45
  <div>
@@ -53,11 +53,7 @@ script(pjax).
53
53
  ${i.title}</div>
54
54
  </div>
55
55
  `).join('') : `#{__("console.newest_comment.empty")}`
56
- if (typeof utils !== 'undefined') utils.diffDateFormat(document.querySelectorAll('.comment-time'))
57
- else {
58
- document.addEventListener('pjax:complete', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
59
- document.addEventListener('DOMContentLoaded', () => utils.diffDateFormat(document.querySelectorAll('.comment-time')))
60
- }
56
+ Solitude.diffDateFormat(document.querySelectorAll('.comment-time'))
61
57
  }
62
58
 
63
59
  function formatContent(content) {
@@ -68,4 +64,4 @@ script(pjax).
68
64
  content = content.replace(/<.*?>/g, '');
69
65
  return content
70
66
  }
71
- })()
67
+ })()
@@ -1,5 +1,5 @@
1
1
  .post-reward
2
- .reward-button(title=_p('award.tipping') onclick="AddRewardMask()")
2
+ .reward-button(title=_p('award.tipping') heotip=_p('award.tipping') data-solitude-action="showReward")
3
3
  i.solitude.fas.fa-heart
4
4
  =_p('award.tipping')
5
5
  .reward-main
@@ -15,30 +15,3 @@
15
15
  a.reward-main-btn(href=url_for(theme.post.award.appreciators))
16
16
  .reward-text= _p('award.title')
17
17
  .reward-dec=theme.post.award.desc
18
-
19
- script.
20
- function RemoveRewardMask() {
21
- let rewardMainElements = document.querySelectorAll(".reward-main");
22
- let quitBoxElement = document.querySelector("#quit-box");
23
-
24
- rewardMainElements.forEach(element => {
25
- element.style.display = "none";
26
- });
27
-
28
- if (quitBoxElement) {
29
- quitBoxElement.style.display = "none";
30
- }
31
- }
32
-
33
- function AddRewardMask() {
34
- let rewardMainElements = document.querySelectorAll(".reward-main");
35
- let quitBoxElement = document.querySelector("#quit-box");
36
-
37
- rewardMainElements.forEach(element => {
38
- element.style.display = "flex";
39
- });
40
-
41
- if (quitBoxElement) {
42
- quitBoxElement.style.display = "flex";
43
- }
44
- }
@@ -7,7 +7,7 @@
7
7
  .post-copyright__author_desc= page.desc || config.subtitle
8
8
  .post-tools#post-tools
9
9
  .post-tools-left
10
- #quit-box(onclick="RemoveRewardMask()")
10
+ #quit-box(data-solitude-action="hideReward")
11
11
  if theme.post.award.enable
12
12
  include ./award
13
13
  if theme.post.rss
@@ -25,31 +25,31 @@
25
25
  each item in theme.post.share.list || []
26
26
  case item
27
27
  when 'qq'
28
- a.social-share-ico.icon-qq(href=`https://connect.qq.com/widget/shareqq/index.html?url=${encodedPath}&title=${encodedTitle}&desc=${encodedDescription}&summary=${encodedDescription}&site=${encodedTitle}&pics=${encodedIcon}` title=_p('post.share.qq'))
28
+ a.social-share-ico.icon-qq(href=`https://connect.qq.com/widget/shareqq/index.html?url=${encodedPath}&title=${encodedTitle}&desc=${encodedDescription}&summary=${encodedDescription}&site=${encodedTitle}&pics=${encodedIcon}` title=_p('post.share.qq') heotip=_p('post.share.qq'))
29
29
  i.solitude.fab.fa-qq
30
30
  when 'weibo'
31
- a.social-share-ico.icon-weibo(href=`http://service.weibo.com/share/share.php?url=${encodedPath}&title=${encodedTitle}&pic=${encodedIcon}` title=_p('post.share.weibo'))
31
+ a.social-share-ico.icon-weibo(href=`http://service.weibo.com/share/share.php?url=${encodedPath}&title=${encodedTitle}&pic=${encodedIcon}` title=_p('post.share.weibo') heotip=_p('post.share.weibo'))
32
32
  i.solitude.fab.fa-weibo
33
33
  when 'telegram'
34
- a.social-share-ico.icon-telegram(href=`https://t.me/share/url?url=${encodedPath}&text=${encodedTitle}` title=_p('post.share.telegram'))
34
+ a.social-share-ico.icon-telegram(href=`https://t.me/share/url?url=${encodedPath}&text=${encodedTitle}` title=_p('post.share.telegram') heotip=_p('post.share.telegram'))
35
35
  i.solitude.fab.fa-telegram
36
36
  when 'whatsapp'
37
- a.social-share-ico.icon-whatsapp(href=`https://api.whatsapp.com/send?text=${encodedTitle} ${encodedPath}` title=_p('post.share.whatsapp'))
37
+ a.social-share-ico.icon-whatsapp(href=`https://api.whatsapp.com/send?text=${encodedTitle} ${encodedPath}` title=_p('post.share.whatsapp') heotip=_p('post.share.whatsapp'))
38
38
  i.solitude.fab.fa-whatsapp
39
39
  when 'linkedin'
40
- a.social-share-ico.icon-linkedin(href=`https://www.linkedin.com/shareArticle?mini=true&url=${encodedPath}&title=${encodedTitle}&summary=${encodedDescription}&source=${encodedTitle}` title=_p('post.share.linkedin'))
40
+ a.social-share-ico.icon-linkedin(href=`https://www.linkedin.com/shareArticle?mini=true&url=${encodedPath}&title=${encodedTitle}&summary=${encodedDescription}&source=${encodedTitle}` title=_p('post.share.linkedin') heotip=_p('post.share.linkedin'))
41
41
  i.solitude.fab.fa-linkedin
42
42
  when 'facebook'
43
- a.social-share-ico.icon-facebook(href=`https://www.facebook.com/sharer/sharer.php?u=${encodedPath}` title=_p('post.share.facebook'))
43
+ a.social-share-ico.icon-facebook(href=`https://www.facebook.com/sharer/sharer.php?u=${encodedPath}` title=_p('post.share.facebook') heotip=_p('post.share.facebook'))
44
44
  i.solitude.fab.fa-facebook
45
45
  when 'twitter'
46
- a.social-share-ico.icon-twitter(href=`https://twitter.com/intent/tweet?url=${encodedPath}&text=${encodedTitle}` title=_p('post.share.twitter'))
46
+ a.social-share-ico.icon-twitter(href=`https://twitter.com/intent/tweet?url=${encodedPath}&text=${encodedTitle}` title=_p('post.share.twitter') heotip=_p('post.share.twitter'))
47
47
  i.solitude.fab.fa-twitter
48
48
  when 'link'
49
- .social-share-ico.icon-link(onclick=`utils.copy("${path}")` title=_p('post.share.link'))
49
+ .social-share-ico.icon-link(data-solitude-action="copy" data-solitude-value=path title=_p('post.share.link') heotip=_p('post.share.link'))
50
50
  i.solitude.fas.fa-link
51
51
  when 'qrcode'
52
- .social-share-ico.icon-qrcode(title=_p('post.share.qrcode'))
52
+ .social-share-ico.icon-qrcode(title=_p('post.share.qrcode') heotip=_p('post.share.qrcode'))
53
53
  i.solitude.fas.fa-qrcode
54
54
  .share-main
55
55
  .share-main-all
@@ -16,6 +16,10 @@
16
16
  h1.post-title= page.title
17
17
  #post-meta
18
18
  .meta-secondline
19
+ if theme.wordcount && theme.post.meta.wordcount
20
+ span.post-meta-wordcount
21
+ i.post-meta-icon.solitude.fas.fa-file-word(title=_p('post.wordcount'))
22
+ span.word-count= wordcount(page.content)
19
23
  if theme.post.meta.date
20
24
  span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date))
21
25
  i.post-meta-icon.solitude.fas.fa-calendar-days
@@ -24,15 +28,10 @@
24
28
  span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated))
25
29
  i.post-meta-icon.solitude.fas.fa-arrows-rotate
26
30
  time(datetime=date_xml(page.updated))= date_xml(page.updated)
27
- if theme.wordcount
28
- span.post-meta-wordcount
29
- if theme.post.meta.wordcount
30
- i.post-meta-icon.solitude.fas.fa-file-word(title=_p('post.wordcount'))
31
- span.word-count= wordcount(page.content)
32
- span.post-meta-separator
33
- if theme.post.meta.readtime
34
- i.post-meta-icon.solitude.fas.fa-clock(title=_p('post.minread'))
35
- span= min2read(page.content) + ' ' + _p('post.min')
31
+ if theme.wordcount && theme.post.meta.readtime
32
+ span.post-meta-readtime
33
+ i.post-meta-icon.solitude.fas.fa-clock(title=_p('post.minread'))
34
+ span= min2read(page.content) + ' ' + _p('post.min')
36
35
  if theme.post.meta.locate
37
36
  span.post-meta-position(title=_p('post.ip') + page.locate)
38
37
  i.post-meta-icon.solitude.fas.fa-location-dot
@@ -64,7 +63,7 @@
64
63
  span#busuanzi_page_pv
65
64
  i.solitude.fas.fa-spinner.fa-spin
66
65
  if theme.post.meta.comment && page.comment && theme.comment.count && theme.comment.use
67
- span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')")
66
+ span.post-meta-commentcount(title=_p('post.comment') data-solitude-action="scrollTo" data-solitude-target="post-comment")
68
67
  i.solitude.fas.fa-comment
69
68
  a(href=url_for(page.path) + "#post-comment")
70
69
  case theme.comment.use[0]
@@ -80,4 +79,4 @@
80
79
  when 'Artalk'
81
80
  span.artalk-comment-count
82
81
  i.solitude.fas.fa-spinner.fa-spin
83
- .post-radius-bottom
82
+ .post-radius-bottom
@@ -1,3 +1,4 @@
1
- .coverdiv#coverdiv
2
- img#post-cover.nolazyload(src=url_for(page.cover), alt=page.title)
1
+ .post-cover-aside
2
+ a.post-cover-aside-link.fancybox(href=url_for(page.cover), target="_blank", rel="noopener", data-fancybox="images", data-caption=page.title, aria-label=page.title)
3
+ img#post-cover.post-cover-aside-img.nolazyload(src=url_for(page.cover), alt=page.title)
3
4
  include ./postInfo
@@ -1,12 +1,12 @@
1
1
  .rs_hide
2
2
  if theme.rightside.hide.translate
3
- button.translate(type='button' title=_p('rightside.hide.translate'))= '简'
3
+ button.translate(type='button' title=_p('rightside.hide.translate') heotip=_p('rightside.hide.translate'))= '简'
4
4
  if theme.rightside.hide.mode
5
- button.mode(type='button' title=_p('rightside.hide.mode') onclick='sco.switchDarkMode()')
5
+ button.mode(type='button' title=_p('rightside.hide.mode') heotip=_p('rightside.hide.mode') data-solitude-action='toggleTheme')
6
6
  i.fas.fa-circle-half-stroke
7
7
  if theme.rightside.hide.aside && theme.console.enable
8
- button.aside.pc(type='button' title=_p('rightside.hide.aside') onclick='sco.switchHideAside()')
8
+ button.aside.pc(type='button' title=_p('rightside.hide.aside') heotip=_p('rightside.hide.aside') data-solitude-action='switchHideAside')
9
9
  i.fas.fa-arrows-alt-h
10
10
  if theme.keyboard.enable
11
- button.keyboard.pc(type='button' title=_p('console.switch_keyboard') onclick="sco.switchKeyboard()")
12
- i.fas.fa-keyboard
11
+ button.keyboard.pc(type='button' title=_p('console.switch_keyboard') heotip=_p('console.switch_keyboard') data-solitude-action='switchKeyboard')
12
+ i.fas.fa-keyboard
@@ -1,16 +1,16 @@
1
1
  .rs_show
2
2
  if theme.rightside.hide.enable
3
- button.config(type='button' title=_p('rightside.show.gear') onclick='document.querySelector(".rs_hide").classList.toggle("show")')
4
- i.fas.fa-gear.fa-spin
3
+ button.config(type='button' title=_p('rightside.show.gear') heotip=_p('rightside.show.gear') data-solitude-action='toggleTargetClass' data-solitude-target='.rs_hide')
4
+ i.fas.fa-gear
5
5
  if showToc
6
- button.mobile.toc(type='button' title=_p('rightside.show.toc') onclick="document.querySelector('#card-toc').classList.toggle('open')")
6
+ button.mobile.toc(type='button' title=_p('rightside.show.toc') heotip=_p('rightside.show.toc') data-solitude-action='toggleTargetClass' data-solitude-target='#card-toc' data-solitude-class='open')
7
7
  i.fas.fa-list
8
8
  if page.comment
9
- button.comment(type='button' title=_p('rightside.show.comment') onclick="sco.scrollTo('post-comment')")
9
+ button.comment(type='button' title=_p('rightside.show.comment') heotip=_p('rightside.show.comment') data-solitude-action='scrollTo' data-solitude-target='post-comment')
10
10
  i.fas.fa-comment
11
11
  if theme.comment.commentBarrage && page.comment
12
- button.barrage.pc(type='button' title=_p('rightside.show.barrage') onclick="sco.switchCommentBarrage()")
12
+ button.barrage.pc(type='button' title=_p('rightside.show.barrage') heotip=_p('rightside.show.barrage') data-solitude-action='switchCommentBarrage')
13
13
  span= _p('rightside.show.barrage')
14
- button.top(type='button' title=_p('rightside.show.top') onclick='sco.toTop()')
14
+ button.top(type='button' title=_p('rightside.show.top') heotip=_p('rightside.show.top') data-solitude-action='toTop')
15
15
  i.fas.fa-arrow-up
16
- span#percent= "0"
16
+ span#percent= "0"
@@ -12,7 +12,7 @@ script.
12
12
  pageKey: location.pathname,
13
13
  darkMode: document.documentElement.getAttribute('data-theme') === 'dark'
14
14
  }, !{JSON.stringify(option)})
15
- if (GLOBAL_CONFIG.lightbox === 'null') return
15
+ if (Solitude.config.lightbox === 'null') return
16
16
  artalkItem.on('list-loaded', () => {
17
17
  const array = []
18
18
  artalkItem.ctx.get('list').getCommentNodes().forEach(comment => {
@@ -22,13 +22,13 @@ script.
22
22
  mailMd5: comment.data.email_encrypted,
23
23
  })
24
24
  const $content = comment.getRender().$content
25
- GLOBAL_CONFIG.lightbox && utils.lightbox($content.querySelectorAll('img:not([atk-emoticon])'))
25
+ Solitude.config.lightbox && Solitude.lightbox($content.querySelectorAll('img:not([atk-emoticon])'))
26
26
  })
27
- sco.owoBig({body: '.atk-grp', item: '.atk-item'})
27
+ Solitude.owoBig({body: '.atk-grp', item: '.atk-item'})
28
28
  !{commentBarrage} && barrageArtalk(array)
29
29
  })
30
30
  const destroyArtalk = () => artalkItem.destroy()
31
- utils.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
31
+ Solitude.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
32
32
  document.addEventListener('pjax:complete', function () {
33
33
  artalkItem.update({
34
34
  pageKey: window.location.pathname,
@@ -40,8 +40,8 @@ script.
40
40
  const loadArtalk = async () => {
41
41
  if (typeof Artalk === 'object') initArtalk()
42
42
  else {
43
- await utils.getCSS('!{theme.cdn.artalk_css}')
44
- await utils.getScript('!{theme.cdn.artalk_js}').then(initArtalk)
43
+ await Solitude.getCSS('!{theme.cdn.artalk_css}')
44
+ await Solitude.getScript('!{theme.cdn.artalk_js}').then(initArtalk)
45
45
  }
46
46
  }
47
47
  const artalkChangeMode = theme => {
@@ -50,9 +50,9 @@ script.
50
50
  const isDark = theme === 'dark'
51
51
  artalkItem.setDarkMode(isDark)
52
52
  }
53
- utils.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
53
+ Solitude.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
54
54
  if ('!{use[0]}' === 'Artalk' || !{lazyload}) {
55
- if (!{lazyload}) utils.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
55
+ if (!{lazyload}) Solitude.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
56
56
  else loadArtalk()
57
57
  } else {
58
58
  window.loadTwoComment = loadArtalk
@@ -63,6 +63,6 @@ if commentBarrage
63
63
  script.
64
64
  async function barrageArtalk(array) {
65
65
  const init = () => initializeCommentBarrage(array)
66
- if (typeof initializeCommentBarrage === "undefined") await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
66
+ if (typeof initializeCommentBarrage === "undefined") await Solitude.getScript('!{url_for(theme.cdn.commentBarrage)}').then(init)
67
67
  else init()
68
68
  }
@@ -43,13 +43,13 @@ script.
43
43
  });
44
44
  }
45
45
 
46
- utils.addGlobalFn('themeChange', changeGiscusTheme, 'giscus')
46
+ Solitude.addGlobalFn('themeChange', changeGiscusTheme, 'giscus')
47
47
 
48
48
  if ('!{use[0]}' === 'Giscus' || !!{lazyload}) {
49
49
  if (!{lazyload}) {
50
50
  const giscusWrap = document.getElementById('giscus-wrap')
51
51
  if (giscusWrap) {
52
- utils.loadComment(giscusWrap, loadGiscus)
52
+ Solitude.loadComment(giscusWrap, loadGiscus)
53
53
  }
54
54
  } else {
55
55
  loadGiscus()