hexo-theme-solitude 2.1.14 → 2.1.16
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 +31 -18
- package/layout/includes/head/opengraph.pug +0 -1
- package/layout/includes/inject/body.pug +1 -1
- package/layout/includes/page/says.pug +1 -1
- package/layout/includes/sidebar.pug +6 -0
- package/layout/includes/widgets/page/about/skillsinfo.pug +16 -12
- package/layout/includes/widgets/page/links/banner.pug +29 -21
- package/layout/includes/widgets/post/postInfo.pug +1 -1
- package/layout/includes/widgets/rightside/hide.pug +1 -1
- package/layout/includes/widgets/sidebar/artalk.pug +13 -0
- package/layout/includes/widgets/sidebar/comment.pug +13 -0
- package/layout/includes/widgets/sidebar/twikoo.pug +19 -0
- package/layout/includes/widgets/sidebar/valine.pug +18 -0
- package/layout/includes/widgets/sidebar/waline.pug +10 -0
- package/package.json +1 -1
- package/plugins.yml +1 -1
- package/scripts/helper/page.js +2 -1
- package/source/css/_global/animation.styl +6 -0
- package/source/css/_page/_about/skills.styl +1 -1
- package/source/css/_page/other.styl +1 -1
- package/source/js/covercolor/local.js +28 -16
- package/source/js/main.js +2 -2
- package/source/js/right_menu.js +2 -2
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 ||
|
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
|
-
#
|
1003
|
-
#
|
1004
|
-
#
|
1005
|
-
#
|
1006
|
-
#
|
1007
|
-
#
|
1008
|
-
#
|
1009
|
-
#
|
1010
|
-
#
|
1011
|
-
#
|
1012
|
-
#
|
1013
|
-
#
|
1014
|
-
#
|
1015
|
-
#
|
1016
|
-
#
|
1017
|
-
#
|
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 ---------------------------
|
@@ -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()")
|
@@ -10,19 +10,23 @@ if skills || careers
|
|
10
10
|
span.author-content-item-title= skills.subtitle
|
11
11
|
.skills-style-group
|
12
12
|
.tags-group-all
|
13
|
-
.tags
|
13
|
+
- let times = 4 * (skills.tags.length? Math.ceil(20/skills.tags.length):0)
|
14
|
+
- let length = times * skills.tags.length
|
15
|
+
- let duration = length * 1200 - 900
|
16
|
+
.tags-group-wrapper(style=`animation-duration: ${duration}ms`)
|
14
17
|
- var pair = []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
- for (let i = 0; i < times; i++)
|
19
|
+
each tag, index in skills.tags
|
20
|
+
- pair.push(tag)
|
21
|
+
if pair.length === 2
|
22
|
+
.tags-group-icon-pair
|
23
|
+
each item in pair
|
24
|
+
.tags-group-icon(style=`background:${item.color}`)
|
25
|
+
if item.img
|
26
|
+
img(src=item.img, title=item.title)
|
27
|
+
else if item.icon
|
28
|
+
i(class=item.icon, title=item.title, style=`color: ${item.icon_color ? item.icon_color : ''}`)
|
29
|
+
- pair = []
|
26
30
|
.skills-list
|
27
31
|
each tag in skills.tags
|
28
32
|
.skill-info
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.banners-title
|
2
|
-
.banners-title-small= page.
|
3
|
-
.banners-title-big= page.
|
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
|
-
|
16
|
-
.tags-group-
|
15
|
+
- if (site.data.links.swiper !== false)
|
16
|
+
.tags-group-all.nowrapMove
|
17
17
|
- const data = site.data.links.links
|
18
|
-
-
|
19
|
-
|
20
|
-
each
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
18
|
+
- var links = []
|
19
|
+
each x in data
|
20
|
+
each y in x.link_list
|
21
|
+
- links.push(y)
|
22
|
+
- let times = 4 * (links.length? Math.ceil(20/links.length):0)
|
23
|
+
- let length = times * links.length
|
24
|
+
- let duration = length * 1500 - 1400
|
25
|
+
- let originalLinks = links
|
26
|
+
- for (let i = 1; i < times; i++)
|
27
|
+
- links = links.concat(originalLinks)
|
28
|
+
.tags-group-wrapper(style=`animation-duration: ${duration}ms`)
|
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
package/plugins.yml
CHANGED
package/scripts/helper/page.js
CHANGED
@@ -13,5 +13,6 @@ hexo.extend.helper.register('page_description', function () {
|
|
13
13
|
})
|
14
14
|
|
15
15
|
hexo.extend.helper.register("urlNoIndex", function (url = null) {
|
16
|
-
|
16
|
+
const { config } = this
|
17
|
+
return prettyUrls(url || this.url, config.pretty_urls);
|
17
18
|
});
|
@@ -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
|
-
|
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 = () =>
|
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(((
|
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
|
-
|
65
|
-
|
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.
|
74
|
-
|
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.
|
79
|
-
|
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
|
});
|
package/source/js/main.js
CHANGED
@@ -691,7 +691,7 @@ class tabs {
|
|
691
691
|
const { expire } = GLOBAL_CONFIG;
|
692
692
|
if (!expire) return;
|
693
693
|
const list = document.querySelectorAll('.post-meta-date time');
|
694
|
-
const post_date = list.length ? list[list.length - 1] : document.querySelector('.
|
694
|
+
const post_date = list.length ? list[list.length - 1] : document.querySelector('.datetime');
|
695
695
|
if (!post_date) return;
|
696
696
|
const ex = Math.ceil((new Date().getTime() - new Date(post_date.getAttribute('datetime')).getTime()) / 1000 / 60 / 60 / 24);
|
697
697
|
if (expire.time > ex) return;
|
@@ -734,7 +734,7 @@ const forPostFn = () => {
|
|
734
734
|
window.refreshFn = () => {
|
735
735
|
const { is_home, is_page, page, is_post } = PAGE_CONFIG;
|
736
736
|
const { runtime, lazyload, lightbox, randomlink, covercolor, post_ai, lure, expire } = GLOBAL_CONFIG;
|
737
|
-
const timeSelector = (is_home ? '.post-meta-date time' : is_post ? '.post-meta-date time' : '.
|
737
|
+
const timeSelector = (is_home ? '.post-meta-date time' : is_post ? '.post-meta-date time' : '.datetime') + ', .webinfo-item time';
|
738
738
|
document.body.setAttribute('data-type', page);
|
739
739
|
sco.changeTimeFormat(document.querySelectorAll(timeSelector));
|
740
740
|
runtime && sco.addRuntime();
|
package/source/js/right_menu.js
CHANGED
@@ -123,7 +123,7 @@ window.oncontextmenu = (ele) => {
|
|
123
123
|
|
124
124
|
rm.menuItems.copy.style.display = selectTextNow && window.getSelection() ? "flex" : "none";
|
125
125
|
GLOBAL_CONFIG.comment && (rm.menuItems.comment.style.display = selectTextNow && window.getSelection() ? "flex" : "none");
|
126
|
-
rm.menuItems.search.style.display = selectTextNow && window.getSelection() ? "flex" : "none";
|
126
|
+
rm.menuItems.search && (rm.menuItems.search.style.display = selectTextNow && window.getSelection() ? "flex" : "none");
|
127
127
|
|
128
128
|
rm.menuItems.new.style.display = link ? "flex" : "none";
|
129
129
|
rm.menuItems.copyLink.style.display = link ? "flex" : "none";
|
@@ -198,4 +198,4 @@ window.oncontextmenu = (ele) => {
|
|
198
198
|
addEventListener(rm.menuItems.downloadImg, "click", () => rm.downloadImage() && rm.hideRightMenu());
|
199
199
|
addEventListener(rm.menuItems.copyImg, "click", () => rm.copyImage() && rm.hideRightMenu());
|
200
200
|
addEventListener(rm.menuItems.copyLink, "click", () => rm.copyText(rm.domhref) && rm.hideRightMenu());
|
201
|
-
})();
|
201
|
+
})();
|