hexo-theme-solitude 1.8.7 → 1.8.9
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/.github/workflows/github-publish.yml +20 -0
- package/.github/workflows/{publish.yml → npm-publish.yml} +2 -3
- package/_config.yml +10 -7
- package/layout/includes/inject/body.pug +1 -1
- package/layout/includes/inject/head.pug +1 -1
- package/layout/includes/widgets/post/copyright.pug +2 -2
- package/layout/includes/widgets/post/postMeta.pug +1 -1
- package/layout/includes/widgets/third-party/comments/comment.pug +1 -1
- package/package.json +1 -1
- package/plugins.yml +3 -3
- package/source/css/_layout/article-container.styl +0 -3
- package/source/css/_post/copyright.styl +4 -0
- package/source/js/covercolor/api.js +0 -22
- package/source/js/covercolor/local.js +0 -22
- package/source/js/main.js +50 -35
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Node.js Package
|
2
|
+
on:
|
3
|
+
release:
|
4
|
+
types: [created]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
publish-gpr:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
permissions:
|
10
|
+
packages: write
|
11
|
+
contents: read
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
- uses: actions/setup-node@v4
|
15
|
+
with:
|
16
|
+
node-version: 16
|
17
|
+
registry-url: https://npm.pkg.github.com/
|
18
|
+
- run: npm publish
|
19
|
+
env:
|
20
|
+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/_config.yml
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Author: Valor Team
|
4
4
|
# Github: https://github.com/valor-x/hexo-theme-solitude
|
5
5
|
#
|
6
|
-
# 配置指南: https://
|
6
|
+
# 配置指南: https://docs.efu.me/
|
7
7
|
# 你可以从指南中获得更详细的说明
|
8
8
|
#
|
9
|
-
# Guide: https://
|
9
|
+
# Guide: https://docs.efu.me/
|
10
10
|
# You can get more detailed help from the guide
|
11
11
|
#
|
12
12
|
# 赞助:https://afdian.net/a/efu0u0
|
@@ -130,7 +130,7 @@ hometop:
|
|
130
130
|
title: Solitude 主题文档
|
131
131
|
# 点击跳转链接
|
132
132
|
# Click the jump link
|
133
|
-
url: https://
|
133
|
+
url: https://docs.efu.me/
|
134
134
|
# 显示背景图片
|
135
135
|
# Display background image
|
136
136
|
img: /img/default.png
|
@@ -330,6 +330,9 @@ post:
|
|
330
330
|
# default post copyright
|
331
331
|
copyright:
|
332
332
|
enable: true
|
333
|
+
author:
|
334
|
+
url: /about/ # 点击头像跳转地址
|
335
|
+
img: # 显示头像,不填写默认显示site_icon
|
333
336
|
license: CC BY-NC-SA 4.0
|
334
337
|
licenurl: https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh
|
335
338
|
# 顶部文章简介
|
@@ -701,7 +704,7 @@ post_ai:
|
|
701
704
|
|
702
705
|
# latex 公式支持
|
703
706
|
# latex formula support
|
704
|
-
# docs: https://
|
707
|
+
# docs: https://docs.efu.me/configuration/extra#数学公式
|
705
708
|
katex:
|
706
709
|
enable: false
|
707
710
|
per_page: false # 是否在每页都加载 / Whether to load on each page
|
@@ -709,12 +712,13 @@ katex:
|
|
709
712
|
|
710
713
|
# 评论
|
711
714
|
# comment
|
712
|
-
# getting start: http://
|
715
|
+
# getting start: http://docs.efu.me/comments/comment
|
713
716
|
comment:
|
714
717
|
use: # waline, twikoo, valine, artalk
|
715
718
|
commentBarrage: false # 热评开关 / Hot comment switch
|
716
719
|
lazyload: false # 懒加载
|
717
720
|
count: false # 评论数展示
|
721
|
+
pv: false # 是否使用評論統計頁面訪問
|
718
722
|
avatar: https://cravatar.cn # Gravatar link
|
719
723
|
newest_comment:
|
720
724
|
enable: false
|
@@ -794,7 +798,7 @@ extends:
|
|
794
798
|
|
795
799
|
# PWA
|
796
800
|
# https://developer.mozilla.org/zh-CN/docs/Web/Progressive_web_apps
|
797
|
-
# docs: https://
|
801
|
+
# docs: https://docs.efu.me/configuration/extra#pwa
|
798
802
|
pwa:
|
799
803
|
enable: false
|
800
804
|
manifest: /manifest.json # manifest.json 文件路径
|
@@ -875,7 +879,6 @@ CDN:
|
|
875
879
|
|
876
880
|
option:
|
877
881
|
solitude_css: https://cdn2.codesign.qq.com/icons/7pOrz0WXB5ZWJPX/latest/iconfont.css
|
878
|
-
busuanzi_js: https://pv.lemonso.com/js # 青秸的 Busanzi,相比较官方更稳定、快速
|
879
882
|
# algolia_search:
|
880
883
|
# instantsearch:
|
881
884
|
# pjax:
|
@@ -96,7 +96,7 @@ div
|
|
96
96
|
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
|
97
97
|
sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
|
98
98
|
if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
|
99
|
-
script(
|
99
|
+
script(defer pjax src=url_for(theme.cdn.busuanzi_js))
|
100
100
|
|
101
101
|
|
102
102
|
if theme.footer.randomlink
|
@@ -27,7 +27,7 @@ include ../head/pwa.pug
|
|
27
27
|
|
28
28
|
script.
|
29
29
|
console.log(
|
30
|
-
"%c Program: Hexo %c Theme: Solitude %c Version: v1.8.
|
30
|
+
"%c Program: Hexo %c Theme: Solitude %c Version: v1.8.9",
|
31
31
|
"border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
|
32
32
|
"padding: 5px 10px;color:white;background:#3e9f50;",
|
33
33
|
"border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
- const {copyright} = theme.post.default
|
2
2
|
.post-copyright
|
3
3
|
.post-copyright__author_group
|
4
|
-
a.post-copyright__author_img(href=url_for(
|
5
|
-
img.post-copyright__author_img_front(src=theme.site.icon)
|
4
|
+
a.post-copyright__author_img(href=url_for(copyright.author.url))
|
5
|
+
img.post-copyright__author_img_front(src=copyright.author.img || theme.site.icon)
|
6
6
|
.post-copyright__author_name= config.title
|
7
7
|
.post-copyright__author_desc= config.subtitle
|
8
8
|
.post-tools#post-tools
|
@@ -40,7 +40,7 @@
|
|
40
40
|
if theme.post.meta.pv
|
41
41
|
a.post-meta-pv(href=url_for(page.path), title=_p('post.pv'))
|
42
42
|
i.post-meta-icon.solitude.st-fire-fill
|
43
|
-
if theme.comment.use
|
43
|
+
if theme.comment.use && theme.comment.pv
|
44
44
|
case theme.comment.use[0]
|
45
45
|
when "Twikoo"
|
46
46
|
span#twikoo_visitors
|
package/package.json
CHANGED
package/plugins.yml
CHANGED
@@ -78,9 +78,9 @@ swiper_js:
|
|
78
78
|
version: 11.0.5
|
79
79
|
other_name: Swiper
|
80
80
|
busuanzi_js:
|
81
|
-
name: busuanzi
|
82
|
-
file: bsz.pure.
|
83
|
-
version:
|
81
|
+
name: pearssauce-busuanzi
|
82
|
+
file: bsz.pure.min.js
|
83
|
+
version: 1.0.0
|
84
84
|
snackbar:
|
85
85
|
name: node-snackbar
|
86
86
|
file: dist/snackbar.min.js
|
@@ -12,6 +12,7 @@
|
|
12
12
|
+maxWidth768()
|
13
13
|
box-shadow var(--efu-shadow-border)
|
14
14
|
padding: 1rem 1.3rem;
|
15
|
+
|
15
16
|
.post-copyright__author_group
|
16
17
|
.post-copyright__author_img
|
17
18
|
width 64px
|
@@ -34,6 +35,9 @@
|
|
34
35
|
bottom 0
|
35
36
|
left 0
|
36
37
|
|
38
|
+
&:hover
|
39
|
+
transform scale(1.3)
|
40
|
+
|
37
41
|
.post-copyright__author_name
|
38
42
|
text-align center
|
39
43
|
font-size 20px
|
@@ -73,26 +73,4 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
73
73
|
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
74
74
|
initThemeColor();
|
75
75
|
}
|
76
|
-
}
|
77
|
-
|
78
|
-
function initThemeColor() {
|
79
|
-
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
80
|
-
let themeColor;
|
81
|
-
if (currentTop > 0) {
|
82
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-card-bg');
|
83
|
-
} else if (PAGE_CONFIG.is_post) {
|
84
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-main');
|
85
|
-
} else {
|
86
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-background');
|
87
|
-
}
|
88
|
-
changeThemeColor(themeColor);
|
89
|
-
}
|
90
|
-
|
91
|
-
function changeThemeColor(color) {
|
92
|
-
if (null !== document.querySelector('meta[name="theme-color"]') && (document.querySelector('meta[name="theme-color"]').setAttribute("content", color),
|
93
|
-
document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]').setAttribute("content", color)),
|
94
|
-
window.matchMedia("(display-mode: standalone)").matches) {
|
95
|
-
const t = document.body;
|
96
|
-
t ? t.style.backgroundColor = color : console.error("document.body不存在")
|
97
|
-
}
|
98
76
|
}
|
@@ -138,26 +138,4 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
138
138
|
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
139
139
|
initThemeColor();
|
140
140
|
}
|
141
|
-
}
|
142
|
-
|
143
|
-
function initThemeColor() {
|
144
|
-
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
145
|
-
let themeColor;
|
146
|
-
if (currentTop > 0) {
|
147
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-card-bg');
|
148
|
-
} else if (PAGE_CONFIG.is_post) {
|
149
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-main');
|
150
|
-
} else {
|
151
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-background');
|
152
|
-
}
|
153
|
-
changeThemeColor(themeColor);
|
154
|
-
}
|
155
|
-
|
156
|
-
function changeThemeColor(color) {
|
157
|
-
if (null !== document.querySelector('meta[name="theme-color"]') && (document.querySelector('meta[name="theme-color"]').setAttribute("content", color),
|
158
|
-
document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]').setAttribute("content", color)),
|
159
|
-
window.matchMedia("(display-mode: standalone)").matches) {
|
160
|
-
const t = document.body;
|
161
|
-
t ? t.style.backgroundColor = color : console.error("document.body not found.")
|
162
|
-
}
|
163
141
|
}
|
package/source/js/main.js
CHANGED
@@ -37,14 +37,12 @@ const sidebarFn = () => {
|
|
37
37
|
const scrollFn = function () {
|
38
38
|
const innerHeight = window.innerHeight;
|
39
39
|
if (document.body.scrollHeight <= innerHeight) return;
|
40
|
-
|
41
40
|
let initTop = 0;
|
42
41
|
const $header = document.getElementById('page-header');
|
43
|
-
|
44
|
-
initThemeColor()
|
42
|
+
const throttledScroll = utils.throttle(function (e) {
|
43
|
+
initThemeColor();
|
45
44
|
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
46
45
|
const isDown = scrollDirection(currentTop);
|
47
|
-
|
48
46
|
if (currentTop > 0) {
|
49
47
|
if (isDown) {
|
50
48
|
if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible');
|
@@ -53,12 +51,15 @@ const scrollFn = function () {
|
|
53
51
|
}
|
54
52
|
$header.classList.add('nav-fixed');
|
55
53
|
} else {
|
56
|
-
if (currentTop ===0){
|
57
54
|
$header.classList.remove('nav-fixed', 'nav-visible');
|
58
|
-
}
|
59
55
|
}
|
60
|
-
}, 200)
|
61
|
-
|
56
|
+
}, 200);
|
57
|
+
window.addEventListener('scroll', function(e) {
|
58
|
+
throttledScroll(e);
|
59
|
+
if (window.scrollY === 0) {
|
60
|
+
$header.classList.remove('nav-fixed', 'nav-visible');
|
61
|
+
}
|
62
|
+
});
|
62
63
|
function scrollDirection(currentTop) {
|
63
64
|
const result = currentTop > initTop;
|
64
65
|
initTop = currentTop;
|
@@ -67,34 +68,26 @@ const scrollFn = function () {
|
|
67
68
|
}
|
68
69
|
|
69
70
|
const percent = () => {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
let elementsToHide = document.querySelectorAll(".needEndHide")
|
88
|
-
if (remainingScroll < 100) {
|
89
|
-
elementsToHide.forEach(function (element) {
|
90
|
-
element.classList.add("hide")
|
91
|
-
})
|
71
|
+
const docEl = document.documentElement;
|
72
|
+
const body = document.body;
|
73
|
+
const scrollPos = window.pageYOffset || docEl.scrollTop;
|
74
|
+
const scrollHeight = Math.max(body.scrollHeight, docEl.scrollHeight, body.offsetHeight, docEl.offsetHeight, body.clientHeight, docEl.clientHeight);
|
75
|
+
const viewportHeight = docEl.clientHeight;
|
76
|
+
const totalScrollableHeight = scrollHeight - viewportHeight;
|
77
|
+
const scrolledPercent = Math.round((scrollPos / totalScrollableHeight) * 100);
|
78
|
+
const navToTop = document.querySelector("#nav-totop");
|
79
|
+
const percentDisplay = document.querySelector("#percent");
|
80
|
+
const commentOrFooter = document.getElementById("post-comment") || document.getElementById("footer");
|
81
|
+
const isNearEnd = (window.scrollY + viewportHeight) >= commentOrFooter.offsetTop;
|
82
|
+
if (isNearEnd || scrolledPercent > 90) {
|
83
|
+
navToTop.classList.add("long");
|
84
|
+
percentDisplay.textContent = GLOBAL_CONFIG.lang.backtop;
|
92
85
|
} else {
|
93
|
-
|
94
|
-
|
95
|
-
})
|
86
|
+
navToTop.classList.remove("long");
|
87
|
+
percentDisplay.textContent = scrolledPercent;
|
96
88
|
}
|
97
|
-
|
89
|
+
const elementsToHide = document.querySelectorAll(".needEndHide");
|
90
|
+
elementsToHide.forEach(item => item.classList.toggle("hide", totalScrollableHeight - scrollPos < 100));
|
98
91
|
window.onscroll = percent
|
99
92
|
}
|
100
93
|
|
@@ -144,6 +137,28 @@ const initObserver = () => {
|
|
144
137
|
}
|
145
138
|
}
|
146
139
|
|
140
|
+
function initThemeColor() {
|
141
|
+
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
142
|
+
let themeColor;
|
143
|
+
if (currentTop > 0) {
|
144
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-card-bg');
|
145
|
+
} else if (PAGE_CONFIG.is_post) {
|
146
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-main');
|
147
|
+
} else {
|
148
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-background');
|
149
|
+
}
|
150
|
+
changeThemeColor(themeColor);
|
151
|
+
}
|
152
|
+
|
153
|
+
function changeThemeColor(color) {
|
154
|
+
if (null !== document.querySelector('meta[name="theme-color"]') && (document.querySelector('meta[name="theme-color"]').setAttribute("content", color),
|
155
|
+
document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]').setAttribute("content", color)),
|
156
|
+
window.matchMedia("(display-mode: standalone)").matches) {
|
157
|
+
const t = document.body;
|
158
|
+
t ? t.style.backgroundColor = color : console.error("document.body不存在")
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
147
162
|
class toc {
|
148
163
|
static init() {
|
149
164
|
const tocContainer = document.getElementById('card-toc')
|
@@ -892,12 +907,12 @@ window.refreshFn = () => {
|
|
892
907
|
|
893
908
|
document.addEventListener('DOMContentLoaded', function () {
|
894
909
|
sco.initAdjust()
|
895
|
-
percent()
|
896
910
|
initObserver()
|
897
911
|
addCopyright()
|
898
912
|
sco.initConsoleState()
|
899
913
|
window.refreshFn()
|
900
914
|
asideStatus()
|
915
|
+
percent()
|
901
916
|
})
|
902
917
|
|
903
918
|
window.onkeydown = function (e) {
|