hexo-theme-solitude 2.1.14 → 2.1.15

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.
package/_config.yml CHANGED
@@ -553,7 +553,7 @@ footer:
553
553
  author: false # img url / false
554
554
  left:
555
555
  # Github: https://github.com/everfu || fab fa-github # 名称: 链接 || 图标
556
- # Mail: mailto:o@everfu.org || fab fa-envelope
556
+ # Mail: mailto:o@everfu.org || far fa-envelope
557
557
  right:
558
558
  # Bilibili: https://space.bilibili.com/1329819902 || fab fa-bilibili
559
559
  # Douyin: https://v.douyin.com/iJsLc8jt/ || fab fa-tiktok
@@ -998,21 +998,34 @@ CDN:
998
998
  custom_format: https://fastly.jsdelivr.net/npm/${name}@${version}/${min_file} # 自定义格式
999
999
  # 直接覆盖默认 CDN 链接(优先级最高)
1000
1000
  options:
1001
- # algolia_search:
1002
- # instantsearch:
1003
- # pjax:
1004
- # twikoo:
1005
- # waline_js:
1006
- # waline_css:
1007
- # katex:
1008
- # katex_copytex:
1009
- # lazyload:
1010
- # aplayer_css:
1011
- # aplayer_js:
1012
- # meting_js:
1013
- # pace_js:
1014
- # swiper_css:
1015
- # swiper_js:
1016
- # busuanzi_js:
1017
- # snackbar_js:
1001
+ # algolia_search
1002
+ # aplayer_css
1003
+ # aplayer_js
1004
+ # artalk_css
1005
+ # artalk_js
1006
+ # blueimp_md5
1007
+ # busuanzi_js
1008
+ # chart_js
1009
+ # color_thief
1010
+ # fancyapps_css
1011
+ # fancyapps_ui
1012
+ # fontawesome
1013
+ # instantsearch
1014
+ # katex
1015
+ # katex_copytex
1016
+ # lazyload
1017
+ # medium_zoom
1018
+ # mermaid_js
1019
+ # meting_js
1020
+ # pace_js
1021
+ # pjax
1022
+ # qrcode
1023
+ # snackbar
1024
+ # swiper_css
1025
+ # swiper_js
1026
+ # twikoo
1027
+ # typeit_js
1028
+ # valine
1029
+ # waline_css
1030
+ # waline_js
1018
1031
  # --------------------------- end ---------------------------
@@ -8,6 +8,5 @@ if theme.OpenGraph.enable
8
8
  }
9
9
  -
10
10
  != open_graph(ogOption)
11
- meta(name="description" content=page_description())
12
11
  else
13
12
  meta(name="description" content=page_description())
@@ -111,7 +111,7 @@ div
111
111
  if is_home() && theme.carousel && site.posts.data.filter(item => item.recommend === true).slice(0, 6) || false
112
112
  script.
113
113
  carousel_swiper()
114
- if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
114
+ if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv || is_post() && theme.post.meta.pv)
115
115
  script(defer pjax src=url_for(theme.cdn.busuanzi_js))
116
116
 
117
117
 
@@ -17,6 +17,12 @@ div#sidebar(style="zoom: 1;")
17
17
  a(href=url_for('/tags/'))
18
18
  .headline=_p('page.tag')
19
19
  .length-num=site.tags.find({parent: {$exists: false}}).length
20
+ if theme.recent_comments.enable
21
+ .data-item.is-center
22
+ .data-item-link
23
+ a(href=url_for(theme.recent_comments.page))
24
+ .headline=_p('comment.title')
25
+ include ./widgets/sidebar/comment
20
26
  span.sidebar-menu-item-title= __('sidebar.function')
21
27
  div.sidebar-menu-item
22
28
  span.darkmode_switchbutton.menu-child(onclick="sco.switchDarkMode()")
@@ -12,17 +12,19 @@ if skills || careers
12
12
  .tags-group-all
13
13
  .tags-group-wrapper
14
14
  - var pair = []
15
- each tag, index in skills.tags
16
- - pair.push(tag)
17
- if pair.length === 2 || index === skills.tags.length - 1
18
- .tags-group-icon-pair
19
- each item in pair
20
- .tags-group-icon(style=`background:${item.color}`)
21
- if item.img
22
- img(src=item.img, title=item.title)
23
- else if item.icon
24
- i(class=item.icon, title=item.title, style=`color: ${item.icon_color ? item.icon_color : ''}`)
25
- - pair = []
15
+ - let times = skills.tags.length? Math.ceil(20/skills.tags.length):0
16
+ - for (let i = 0; i < 4 * times; i++)
17
+ each tag, index in skills.tags
18
+ - pair.push(tag)
19
+ if pair.length === 2
20
+ .tags-group-icon-pair
21
+ each item in pair
22
+ .tags-group-icon(style=`background:${item.color}`)
23
+ if item.img
24
+ img(src=item.img, title=item.title)
25
+ else if item.icon
26
+ i(class=item.icon, title=item.title, style=`color: ${item.icon_color ? item.icon_color : ''}`)
27
+ - pair = []
26
28
  .skills-list
27
29
  each tag in skills.tags
28
30
  .skill-info
@@ -1,6 +1,6 @@
1
1
  .banners-title
2
- .banners-title-small= page.title
3
- .banners-title-big= page.desc
2
+ .banners-title-small= page.desc
3
+ .banners-title-big= page.title
4
4
 
5
5
  .banner-button-group
6
6
  if theme.footer.randomlink
@@ -12,23 +12,31 @@
12
12
  i.solitude.fa-solid.fa-circle-chevron-right
13
13
  span.solitude.banner-button-text=_p('link.banner.toComment')
14
14
 
15
- .tags-group-all.nowrapMove
16
- .tags-group-wrapper
17
- - const data = site.data.links.links
18
- - for (let i = 0; i < 2; i++)
19
- - var links = []
20
- each x in data
21
- each y in x.link_list
22
- - links.push(y)
23
- - var pairs = []
24
- each link, index in links
25
- if (index % 2 === 0)
26
- - pairs.push([link])
27
- else
28
- - pairs[pairs.length - 1].push(link)
29
- each pair in pairs
30
- .tags-group-icon-pair
31
- each y in pair
32
- a.tags-group-icon(href=url_for(y.link), title=y.name)
33
- img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
34
- span.tags-group-title=y.name
15
+ - if (site.data.links.swiper !== false)
16
+ .tags-group-all.nowrapMove
17
+ .tags-group-wrapper
18
+ - const data = site.data.links.links
19
+ - var links = []
20
+ each x in data
21
+ each y in x.link_list
22
+ - links.push(y)
23
+ - if (links.length)
24
+ - let originalLinks = links
25
+ - while (links.length<20)
26
+ - links = links.concat(originalLinks)
27
+ each i in [1,2]
28
+ - links = links.concat(links)
29
+ - var pairs = []
30
+ each link, index in links
31
+ if (index % 2 === 0)
32
+ - pairs.push([link])
33
+ else
34
+ - pairs[pairs.length - 1].push(link)
35
+ each pair in pairs
36
+ .tags-group-icon-pair
37
+ each y in pair
38
+ a.tags-group-icon(href=url_for(y.link), title=y.name)
39
+ img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
40
+ span.tags-group-title=y.name
41
+ - else
42
+ .tags-group-all(style="height:calc(3rem + 72px);")
@@ -37,7 +37,7 @@
37
37
  span.post-meta-position(title=_p('post.ip') + page.locate)
38
38
  i.post-meta-icon.solitude.fas.fa-location-dot
39
39
  span= page.locate
40
- if theme.post.meta.pv
40
+ if theme.post.meta.pv && (theme.comment.use && theme.comment.pv || theme.busuanzi)
41
41
  a.post-meta-pv(href=url_for(page.path), title=_p('post.pv'))
42
42
  i.post-meta-icon.solitude.fa-solid.fa-fire-flame-curved
43
43
  if theme.comment.use && theme.comment.pv
@@ -4,7 +4,7 @@
4
4
  if theme.rightside.hide.mode
5
5
  button.mode(type='button' title=_p('rightside.hide.mode') onclick='sco.switchDarkMode()')
6
6
  i.fas.fa-circle-half-stroke
7
- if theme.rightside.hide.aside
7
+ if theme.rightside.hide.aside && theme.console.enable
8
8
  button.aside.pc(type='button' title=_p('rightside.hide.aside') onclick='sco.switchHideAside()')
9
9
  i.fas.fa-arrows-alt-h
10
10
  if theme.keyboard.enable
@@ -0,0 +1,13 @@
1
+ .length-num#artalk_allcount
2
+ i.solitude.fa-solid.fa-spinner.fa-spin
3
+
4
+ - const { server, site } = theme.artalk
5
+
6
+ script(pjax).
7
+ (async () => {
8
+ const searchParams = new URLSearchParams({'site_name': "!{site}", 'limit': '-1'})
9
+ await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, {method: 'GET'}).then(async res => res.json())
10
+ .then(async data => {
11
+ document.querySelector('#artalk_allcount').innerHTML = data.length
12
+ })
13
+ })()
@@ -0,0 +1,13 @@
1
+ - const {use} = theme.comment
2
+
3
+ case use[0]
4
+ when 'Twikoo'
5
+ !=partial('includes/widgets/sidebar/twikoo', {}, {cache: true})
6
+ when 'Waline'
7
+ !=partial('includes/widgets/sidebar/waline', {}, {cache: true})
8
+ when 'Valine'
9
+ !=partial('includes/widgets/sidebar/valine', {}, {cache: true})
10
+ when 'Artalk'
11
+ !=partial('includes/widgets/sidebar/artalk', {}, {cache: true})
12
+ when 'Giscus'
13
+ !=partial('includes/widgets/sidebar/giscus', {}, {cache: true})
@@ -0,0 +1,19 @@
1
+ .length-num#twikoo_allcount
2
+ i.solitude.fa-solid.fa-spinner.fa-spin
3
+
4
+ - const {envId} = theme.twikoo
5
+
6
+ script(pjax).
7
+ (async () => {
8
+ await fetch('!{envId}', {
9
+ method: "POST",
10
+ body: JSON.stringify({
11
+ "event": "GET_RECENT_COMMENTS",
12
+ "includeReply": true,
13
+ "pageSize": -1
14
+ }),
15
+ headers: {'Content-Type': 'application/json'}
16
+ }).then(res => res.json()).then(async ({data}) => {
17
+ document.querySelector('#twikoo_allcount').innerHTML = data.length
18
+ })
19
+ })()
@@ -0,0 +1,18 @@
1
+ .length-num#valine_allcount
2
+ i.solitude.fa-solid.fa-spinner.fa-spin
3
+
4
+ - const { appId, appKey, serverURLs } = theme.valine
5
+
6
+ script(pjax).
7
+ (async () => {
8
+ await fetch('!{serverURLs}/1.1/classes/Comment?limit=-1&order=-createdAt', {
9
+ method: "GET",
10
+ headers: {
11
+ "X-LC-Id": '!{appId}',
12
+ "X-LC-Key": '!{appKey}',
13
+ "Content-Type": "application/json"
14
+ }
15
+ }).then(async res => res.json()).then(async results => {
16
+ document.querySelector('#valine_allcount').innerHTML = results.length
17
+ })
18
+ })()
@@ -0,0 +1,10 @@
1
+ .length-num#waline_allcount
2
+ i.solitude.fa-solid.fa-spinner.fa-spin
3
+
4
+ script(pjax).
5
+ (async () => {
6
+ await fetch('!{theme.waline.envId}/api/comment?type=recent&count=-1', {method: 'GET'}).then(async res => res.json())
7
+ .then(async data => {
8
+ document.querySelector('#waline_allcount').innerHTML = data.length
9
+ })
10
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "2.1.14",
3
+ "version": "2.1.15",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
package/plugins.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  algolia_search:
2
2
  name: algoliasearch
3
3
  file: dist/algoliasearch.umd.js
4
- version: 5.17.1
4
+ version: 5.18.0
5
5
  instantsearch:
6
6
  name: instantsearch.js
7
7
  file: dist/instantsearch.production.min.js
@@ -216,6 +216,12 @@
216
216
  to
217
217
  transform translateX(-50%)
218
218
 
219
+ @keyframes rowleft-quarter
220
+ from
221
+ transform translateX(-25%)
222
+ to
223
+ transform translateX(-75%)
224
+
219
225
  @keyframes gradient
220
226
  0%
221
227
  background-position 0 50%
@@ -15,7 +15,7 @@
15
15
  margin-top 40px
16
16
  display flex
17
17
  flex-wrap nowrap
18
- animation rowleft 60s linear infinite
18
+ animation rowleft-quarter 30s linear infinite
19
19
 
20
20
  .skills-style-group
21
21
  position relative
@@ -100,7 +100,7 @@ div#banners
100
100
 
101
101
  .tags-group-wrapper
102
102
  margin-top: 7rem
103
- animation: rowleft 120s linear infinite
103
+ animation: rowleft-quarter 30s linear infinite
104
104
  display flex
105
105
 
106
106
  +maxWidth768()
@@ -1,9 +1,10 @@
1
1
  const coverColor = () => {
2
2
  const pageColor = PAGE_CONFIG.color || document.getElementById("post-cover")?.src;
3
3
  if (pageColor) {
4
- return localColor(pageColor);
4
+ localColor(pageColor);
5
+ } else {
6
+ setDefaultThemeColors();
5
7
  }
6
- setDefaultThemeColors();
7
8
  }
8
9
 
9
10
  const setDefaultThemeColors = () => {
@@ -19,20 +20,20 @@ const setDefaultThemeColors = () => {
19
20
  initThemeColor();
20
21
  }
21
22
 
22
- const localColor = path => {
23
+ const localColor = (path) => {
23
24
  const colorThief = new ColorThief();
24
25
  const img = new Image();
25
26
  img.crossOrigin = "Anonymous";
26
- img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)), ...colorThief.getColor(img));
27
+ img.onload = () => {
28
+ const color = colorThief.getColor(img);
29
+ setThemeColors(rgbToHex(color), ...color);
30
+ };
27
31
  img.onerror = () => console.error('Image Error');
28
32
  img.src = path;
29
33
  }
30
34
 
31
35
  const rgbToHex = ([r, g, b]) => {
32
- return '#' + [r, g, b].map(x => {
33
- const component = Math.floor(x * 0.8);
34
- return component.toString(16).padStart(2, '0');
35
- }).join('');
36
+ return '#' + [r, g, b].map(x => Math.floor(x * 0.8).toString(16).padStart(2, '0')).join('');
36
37
  }
37
38
 
38
39
  const setThemeColors = (value, r = null, g = null, b = null) => {
@@ -44,12 +45,13 @@ const setThemeColors = (value, r = null, g = null, b = null) => {
44
45
  '--efu-main-op-deep': value + 'dd',
45
46
  '--efu-main-none': value + '00'
46
47
  };
48
+
47
49
  Object.entries(themeColors).forEach(([key, color]) => {
48
50
  document.documentElement.style.setProperty(key, color);
49
51
  });
50
52
 
51
- if (r && g && b) {
52
- const brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
53
+ if (r !== null && g !== null && b !== null) {
54
+ const brightness = Math.round(((r * 299) + (g * 587) + (b * 114)) / 1000);
53
55
  if (brightness < 125) {
54
56
  adjustCardStyles();
55
57
  value = LightenDarkenColor(value, 50);
@@ -61,22 +63,32 @@ const setThemeColors = (value, r = null, g = null, b = null) => {
61
63
  initThemeColor();
62
64
  }
63
65
 
64
- function LightenDarkenColor(col, amt) {
65
- var usePound = false;
66
+ const LightenDarkenColor = (col, amt) => {
67
+ let usePound = false;
66
68
  if (col[0] === "#") {
67
69
  col = col.slice(1);
68
70
  usePound = true;
69
71
  }
72
+ let num = parseInt(col, 16);
73
+ let r = (num >> 16) + amt;
74
+ let g = ((num >> 8) & 0x00FF) + amt;
75
+ let b = (num & 0x0000FF) + amt;
76
+
77
+ r = Math.max(Math.min(r, 255), 0);
78
+ g = Math.max(Math.min(g, 255), 0);
79
+ b = Math.max(Math.min(b, 255), 0);
80
+
81
+ return (usePound ? "#" : "") + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
70
82
  }
71
83
 
72
84
  const adjustCardStyles = () => {
73
- const cardContents = document.getElementsByClassName('card-content');
74
- Array.from(cardContents).forEach(item => {
85
+ const cardContents = document.querySelectorAll('.card-content');
86
+ cardContents.forEach(item => {
75
87
  item.style.setProperty('--efu-card-bg', 'var(--efu-white)');
76
88
  });
77
89
 
78
- const authorInfo = document.getElementsByClassName('author-info__sayhi');
79
- Array.from(authorInfo).forEach(item => {
90
+ const authorInfo = document.querySelectorAll('.author-info__sayhi');
91
+ authorInfo.forEach(item => {
80
92
  item.style.setProperty('background', 'var(--efu-white-op)');
81
93
  item.style.setProperty('color', 'var(--efu-white)');
82
94
  });