hexo-theme-solitude 3.0.20 → 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 (143) 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 +38 -24
  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 +18 -40
  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 +5 -4
  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/index.pug +1 -1
  68. package/layout/includes/widgets/third-party/hot/twikoo.pug +1 -1
  69. package/layout/includes/widgets/third-party/music.pug +9 -5
  70. package/layout/includes/widgets/third-party/news-comment/artalk.pug +6 -6
  71. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +7 -7
  72. package/layout/includes/widgets/third-party/news-comment/valine.pug +8 -8
  73. package/layout/includes/widgets/third-party/news-comment/waline.pug +7 -7
  74. package/layout/includes/widgets/third-party/pjax.pug +16 -10
  75. package/layout/includes/widgets/third-party/search/algolia-search.pug +2 -2
  76. package/layout/includes/widgets/third-party/search/docsearch.pug +3 -3
  77. package/layout/includes/widgets/third-party/search/index.pug +1 -3
  78. package/layout/includes/widgets/third-party/search/local-search.pug +9 -9
  79. package/layout/index.pug +10 -8
  80. package/package.json +8 -7
  81. package/plugins.yml +22 -21
  82. package/scripts/event/cdn.js +11 -6
  83. package/scripts/event/friend_links.js +30 -0
  84. package/scripts/event/merge_config.js +15 -7
  85. package/scripts/filter/comment.js +2 -2
  86. package/scripts/filter/default.js +1 -1
  87. package/scripts/helper/inject_head_js.js +79 -33
  88. package/scripts/helper/related_post.js +16 -21
  89. package/scripts/tags/chart.js +1 -1
  90. package/scripts/tags/typeit.js +1 -1
  91. package/source/css/_components/capsule.styl +259 -168
  92. package/source/css/_components/rightside.styl +98 -242
  93. package/source/css/_global/animation.styl +1 -10
  94. package/source/css/_global/index.styl +27 -1
  95. package/source/css/_layout/aside.styl +7 -1
  96. package/source/css/_layout/console.styl +144 -163
  97. package/source/css/_layout/header.styl +238 -47
  98. package/source/css/_layout/pagination.styl +176 -132
  99. package/source/css/_layout/rightmenu.styl +11 -2
  100. package/source/css/_layout/sidebar.styl +39 -17
  101. package/source/css/_mode/index.styl +7 -1
  102. package/source/css/_page/_about/about.styl +18 -2
  103. package/source/css/_page/_about/buff.styl +1 -1
  104. package/source/css/_page/_about/contentinfo.styl +2 -1
  105. package/source/css/_page/_about/game.styl +57 -1
  106. package/source/css/_page/_about/like.styl +7 -2
  107. package/source/css/_page/_about/maxim.styl +1 -1
  108. package/source/css/_page/_about/reward.styl +226 -108
  109. package/source/css/_page/_about/skills.styl +5 -3
  110. package/source/css/_page/_home/category-bar.styl +162 -88
  111. package/source/css/_page/_home/home-top.styl +309 -263
  112. package/source/css/_page/_home/home.styl +34 -7
  113. package/source/css/_page/archive.styl +412 -0
  114. package/source/css/_page/category.styl +27 -1
  115. package/source/css/_page/index.styl +2 -0
  116. package/source/css/_page/links.styl +190 -0
  117. package/source/css/_page/other.styl +37 -0
  118. package/source/css/_post/index.styl +2 -1
  119. package/source/css/_post/meta.styl +245 -217
  120. package/source/css/_search/local-search.styl +158 -82
  121. package/source/css/var.styl +2 -2
  122. package/source/js/archive-page.js +191 -0
  123. package/source/js/core/actions.js +48 -0
  124. package/source/js/core/api.js +32 -0
  125. package/source/js/core/config.js +13 -0
  126. package/source/js/core/lifecycle.js +52 -0
  127. package/source/js/core/preloader.js +34 -0
  128. package/source/js/core/resources.js +65 -0
  129. package/source/js/covercolor/api.js +13 -103
  130. package/source/js/covercolor/ave.js +14 -77
  131. package/source/js/covercolor/local.js +22 -116
  132. package/source/js/covercolor/shared.js +102 -0
  133. package/source/js/friend_links.js +502 -0
  134. package/source/js/main.js +793 -177
  135. package/source/js/music.js +24 -14
  136. package/source/js/post_ai.js +13 -2
  137. package/source/js/right_menu.js +44 -24
  138. package/source/js/search/algolia.js +29 -21
  139. package/source/js/search/local.js +231 -266
  140. package/source/js/tw_cn.js +37 -12
  141. package/source/js/utils.js +37 -25
  142. package/layout/includes/widgets/randomlink.pug +0 -43
  143. package/scripts/filter/randomPosts.js +0 -16
@@ -1,39 +1,68 @@
1
- - award = site.data.about.award
1
+ - const award = site.data.about.award
2
+ - const rewardList = Array.isArray(site.data.about.rewardList) ? site.data.about.rewardList.slice() : []
3
+ - const sortedRewards = rewardList.sort((a, b) => new Date(b.time) - new Date(a.time))
4
+ - const visibleRewards = sortedRewards.slice(0, 11)
5
+ - const sum = rewardList.reduce((total, reward) => total + Number(reward.money || 0), 0)
6
+ - const rewardConfig = theme.post && theme.post.award ? theme.post.award : {}
7
+ - const rewardMethods = Array.isArray(rewardConfig.list) ? rewardConfig.list.filter(item => item && item.name && item.qcode) : []
8
+ - const showRewardButton = rewardConfig.enable && rewardMethods.length > 0
9
+ - const appreciators = rewardConfig.appreciators
2
10
 
3
- - var sum = 0
4
- if site.data.about.rewardList && site.data.about.award.enable
5
- .author-content
6
- .author-content-item.single.reward
7
- .author-content-item-tips= _p('award.thanks')
8
- span.author-content-item-title= _p('award.title')
9
- .author-content-item-description
10
- != award.description
11
- .reward-list-all
12
- each reward in site.data.about.rewardList.sort((a, b) => b.time - a.time) || []
13
- - sum += reward.money
14
- .reward-list-item
15
- .reward-list-item-name= reward.name
16
- .reward-list-bottom-group
17
- .reward-list-item-money(style="background-color:" + reward.color)
18
- if reward.icon
19
- i.solitude(class=reward.icon)
20
- | ¥ #{reward.money}
21
- time.datetime.reward-list-item-time(datetime=moment(reward.time).format())
22
- if theme.post.award.enable
23
- .post-reward
24
- .post-reward(onclick="AddRewardMask()")
25
- .reward-button(title=_p('award.tipping'))
26
- i.solitude.fas.fa-heart
27
- = _p('award.tipping')
28
- .reward-main
29
- ul.reward-all
30
- span.reward-title= theme.post.award.title
31
- ul.reward-group
32
- - var rewards = theme.post.award.list
33
- each reward in rewards
34
- li.reward-item
35
- a(href=url_for(reward.url))
36
- img.post-qr-code-img(alt=reward.name, src=reward.qcode, style="border-color:" + reward.color)
37
- .post-qr-code-desc= reward.name
38
- .reward-list-tips
39
- p= award.tips.replace('{sum}', sum.toFixed(2))
11
+ if rewardList.length && award && award.enable
12
+ .author-content
13
+ .author-content-item.single.reward
14
+ .author-content-item-tips= _p('award.thanks')
15
+ span.author-content-item-title= _p('award.title')
16
+ .author-content-item-description!= award.description
17
+
18
+ if showRewardButton
19
+ .post-reward
20
+ .reward-button(
21
+ role='button'
22
+ tabindex='0'
23
+ title=_p('award.tipping')
24
+ aria-label=_p('award.tipping')
25
+ data-solitude-action='showReward'
26
+ )
27
+ i.solitude.fas.fa-heart(aria-hidden='true')
28
+ = _p('award.tipping')
29
+ .reward-main
30
+ ul.reward-all
31
+ span.reward-title= rewardConfig.title
32
+ ul.reward-group
33
+ each method in rewardMethods
34
+ li.reward-item
35
+ a(href=url_for(method.url))
36
+ img.post-qr-code-img.nolazyload(
37
+ alt=method.name
38
+ src=method.qcode
39
+ style=method.color ? 'border-color:' + method.color : null
40
+ )
41
+ .post-qr-code-desc= method.name
42
+
43
+ .reward-list-all
44
+ each reward in visibleRewards
45
+ - const amount = Number(reward.money || 0)
46
+ - const amountTier = amount >= 100 ? 'reward-list-item-money-high' : amount >= 20 ? 'reward-list-item-money-medium' : 'reward-list-item-money-low'
47
+ .reward-list-item(tabindex='0')
48
+ .reward-list-item-name(title=reward.name)= reward.name
49
+ .reward-list-bottom-group
50
+ .reward-list-item-money(
51
+ class=amountTier
52
+ style=reward.color ? 'background-color:' + reward.color : null
53
+ )
54
+ if reward.icon
55
+ i.solitude(class=reward.icon aria-hidden='true')
56
+ | ¥ #{reward.money}
57
+ time.datetime.reward-list-item-time(datetime=moment(reward.time).format())= moment(reward.time).format('YYYY-MM-DD')
58
+
59
+ if appreciators
60
+ a.reward-list-item.reward-list-item-more(
61
+ href=url_for(appreciators)
62
+ aria-label='查看全部打赏名单'
63
+ )
64
+ span 查看全部
65
+ i.solitude.fas.fa-arrow-right(aria-hidden='true')
66
+
67
+ .reward-list-tips
68
+ p= award.tips.replace('{sum}', sum.toFixed(2))
@@ -10,16 +10,25 @@ if games
10
10
  .author-content-item.game(class=`game-${index}`, style=`background: url(${game.img}) no-repeat top; background-size: cover;`)
11
11
  .card-content
12
12
  .author-content-item-tips= game.title
13
- span.author-content-item-title= game.subtitle
13
+ if game.mode
14
+ .author-content-item-title
15
+ span.author-content-item-title-text= game.subtitle
16
+ img.mode-img(src=game.mode.img, alt=game.mode.name, title=game.mode.tip, heotip=game.mode.tip)
17
+ else
18
+ span.author-content-item-title= game.subtitle
14
19
  .content-bottom
15
- if game.icon_group
20
+ if game.heroes
21
+ .hero-group
22
+ each hero, heroIndex in game.heroes
23
+ img.hero-group-item(src=hero.img, alt=hero.name, title=`擅长英雄:${hero.name}`, heotip=`擅长英雄:${hero.name}`, style=`--index: ${heroIndex};`)
24
+ else if game.icon_group
16
25
  .icon-group
17
26
  each icon in game.icon_group
18
27
  i(style=`background-image: url(${icon})`)
19
28
  else if game.tips_left
20
29
  .tips= game.tips_left
21
30
  if game.tips_right
22
- .tips= game.tips_right
31
+ .tips(title=game.tips_right_tip, heotip=game.tips_right_tip)= game.tips_right
23
32
 
24
33
  if site.data.about.likes
25
34
  - const likes = site.data.about.likes
@@ -10,6 +10,6 @@
10
10
  if page.rightbtn
11
11
  .banner-button-group
12
12
  - const isInternalLink = page.rightbtnlink.startsWith('/')
13
- a.banner-button(onclick=isInternalLink ? `pjax.loadUrl("${page.rightbtnlink}")`: null, href=isInternalLink ? null : url_for(page.rightbtnlink), target=isInternalLink ? null : "_blank")
13
+ a.banner-button(data-solitude-action=isInternalLink ? "navigateTo" : null, data-solitude-url=isInternalLink ? page.rightbtnlink : null, href=isInternalLink ? null : url_for(page.rightbtnlink), target=isInternalLink ? null : "_blank")
14
14
  i.solitude.fas.fa-circle-chevron-right
15
15
  span.banner-button-text= page.rightbtn
@@ -11,7 +11,7 @@
11
11
  .equipment-item-content-item-cover
12
12
  img.equipment-item-content-item-image(src=item.image, alt=item.name)
13
13
  .equipment-item-content-item-info
14
- .equipment-item-content-item-name(onclick='utils.copy("' + item.name + '")')= item.name
14
+ .equipment-item-content-item-name(data-solitude-action='copy' data-solitude-value=item.name)= item.name
15
15
  .equipment-item-content-item-specification= item.specification
16
16
  .equipment-item-content-item-description= item.description
17
17
  .equipment-item-content-item-toolbar
@@ -21,5 +21,5 @@
21
21
  else
22
22
  a.equipment-item-content-item-link(href=item.link) 查看文章
23
23
  if theme.comment.use
24
- a.bber-reply(onclick=`sco.toTalk('${item.description}')`)
24
+ a.bber-reply(data-solitude-action="toTalk" data-solitude-value=item.description)
25
25
  i.solitude.fas.fa-comment(style="font-size: 1rem;")
@@ -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