hexo-theme-solitude 1.11.0 → 1.11.2
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/FUNDING.yml +3 -3
- package/README.md +3 -3
- package/README_en-US.md +2 -2
- package/README_zh-Hant.md +2 -2
- package/_config.yml +12 -0
- package/languages/default.yml +2 -0
- package/languages/en.yml +2 -0
- package/languages/zh-CN.yml +2 -0
- package/languages/zh-TW.yml +2 -0
- package/layout/includes/head/config.pug +5 -0
- package/layout/includes/inject/head.pug +12 -1
- package/layout/includes/page/says.pug +4 -0
- package/layout/includes/widgets/page/about/other.pug +47 -20
- package/layout/includes/widgets/third-party/comments/artalk.pug +2 -2
- package/layout/includes/widgets/third-party/news-comment/artalk.pug +49 -42
- package/layout/post.pug +1 -1
- package/package.json +1 -1
- package/plugins.yml +5 -5
- package/scripts/filter/default.js +1 -0
- package/source/css/_global/index.styl +9 -1
- package/source/css/_layout/console.styl +1 -0
- package/source/css/_layout/footer.styl +3 -0
- package/source/css/_layout/header.styl +1 -6
- package/source/css/_layout/other.styl +2 -1
- package/source/css/_page/_about/skills.styl +1 -1
- package/source/css/_page/_about/statistic.styl +1 -1
- package/source/css/_page/_home/home-top.styl +3 -0
- package/source/css/_page/other.styl +1 -6
- package/source/css/_page/says.styl +3 -2
- package/source/js/main.js +35 -5
- package/source/js/third_party/efu_ai.min.js +4 -4
package/.github/FUNDING.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# These are supported funding model platforms
|
2
2
|
|
3
|
-
github: [
|
4
|
-
patreon: # Replace with a single Patreon username
|
3
|
+
github: [everfu] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
+
patreon: everfu # Replace with a single Patreon username
|
5
5
|
open_collective: # Replace with a single Open Collective username
|
6
6
|
ko_fi: # Replace with a single Ko-fi username
|
7
7
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
@@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username
|
|
10
10
|
issuehunt: # Replace with a single IssueHunt username
|
11
11
|
otechie: # Replace with a single Otechie username
|
12
12
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
13
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
13
|
+
custom: ['https://afdian.net/a/everfu', 'https://s3.qjqq.cn/47/66374315ebd08.webp!color', 'https://s3.qjqq.cn/47/663742bac8e52.webp!color'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
package/README.md
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
[](https://gitee.com/nsjjd_w/hexo-theme-solitude)
|
39
39
|
[](https://gitlab.com/efu/hexo-theme-solitude)
|
40
40
|
|
41
|
-
[文档
|
41
|
+
[文档](https://solitude.js.org/)丨[预览](https://www.efu.me/)
|
42
42
|
|
43
43
|
</div>
|
44
44
|
|
@@ -60,7 +60,7 @@
|
|
60
60
|
- [x] 双评论
|
61
61
|
- [x] 相册
|
62
62
|
- [x] 弹幕留言页
|
63
|
-
- [
|
63
|
+
- [x] 首页顶部新样式
|
64
64
|
|
65
65
|
> 如有问题请提 [issue](https://github.com/valor-x/hexo-theme-solitude/issues)
|
66
66
|
|
@@ -87,4 +87,4 @@
|
|
87
87
|
|
88
88
|
## 版权
|
89
89
|
|
90
|
-
[MIT](./LICENSE) License © 2023-至今 [EverFu](https://github.com/efuo)
|
90
|
+
[MIT](./LICENSE) License © 2023-至今 [EverFu](https://github.com/efuo)
|
package/README_en-US.md
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
[](https://gitee.com/nsjjd_w/hexo-theme-solitude)
|
39
39
|
[](https://gitlab.com/efu/hexo-theme-solitude)
|
40
40
|
|
41
|
-
[Documentation
|
41
|
+
[Documentation](https://solitude.js.org/)丨[Preview](https://www.efu.me/)
|
42
42
|
|
43
43
|
</div>
|
44
44
|
|
@@ -87,4 +87,4 @@ Check out the [Documentation](https://solitude.js.org/) for more information.
|
|
87
87
|
|
88
88
|
## License
|
89
89
|
|
90
|
-
[MIT](./LICENSE) License © 2023-PRESENT [EverFu](https://github.com/efuo)
|
90
|
+
[MIT](./LICENSE) License © 2023-PRESENT [EverFu](https://github.com/efuo)
|
package/README_zh-Hant.md
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
[](https://gitee.com/nsjjd_w/hexo-theme-solitude)
|
39
39
|
[](https://gitlab.com/efu/hexo-theme-solitude)
|
40
40
|
|
41
|
-
[文档
|
41
|
+
[文档](https://solitude.js.org/)丨[預覽](https://www.efu.me/)
|
42
42
|
|
43
43
|
</div>
|
44
44
|
|
@@ -85,4 +85,4 @@
|
|
85
85
|
|
86
86
|
## 版權
|
87
87
|
|
88
|
-
[MIT](./LICENSE) License © 2023-至今 [Efu](https://github.com/efuo)
|
88
|
+
[MIT](./LICENSE) License © 2023-至今 [Efu](https://github.com/efuo)
|
package/_config.yml
CHANGED
@@ -909,6 +909,18 @@ right_menu:
|
|
909
909
|
# class:
|
910
910
|
# icon: st-afdian-line
|
911
911
|
|
912
|
+
# 哀悼模式,网页黑白
|
913
|
+
# Mourning mode, web page black and white
|
914
|
+
memorial:
|
915
|
+
enable: false
|
916
|
+
# 日期, (M-D)
|
917
|
+
# Date, (M-D)
|
918
|
+
# eg: 7-8, 9-18, 12-13 ...
|
919
|
+
date:
|
920
|
+
- "7-8" #七八卢沟桥事变
|
921
|
+
- "9-18" #九一八事变/建军节
|
922
|
+
- "12-13" #南京国家公祭日
|
923
|
+
|
912
924
|
# CDN
|
913
925
|
# Don't modify the following settings unless you know how they work
|
914
926
|
# 非必要请不要修改
|
package/languages/default.yml
CHANGED
package/languages/en.yml
CHANGED
package/languages/zh-CN.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
}
|
24
24
|
|
25
25
|
const sayhello2 = theme.aside?.card?.sayhello2?.map(item => `"${item}"`) || [];
|
26
|
+
const [hello_prefix, hello_back] = [_p('aside.hello'), _p('aside.back')];
|
26
27
|
|
27
28
|
let comment = false
|
28
29
|
|
@@ -149,6 +150,10 @@ script.
|
|
149
150
|
goodnight: '!{theme.aside.card.sayhello.goodnight}',
|
150
151
|
},
|
151
152
|
sayhello2: [!{sayhello2}],
|
153
|
+
sayhello3: {
|
154
|
+
prefix: '!{hello_prefix}',
|
155
|
+
back: '!{hello_back}',
|
156
|
+
},
|
152
157
|
},
|
153
158
|
covercolor: {
|
154
159
|
enable: !{theme.post.covercolor.enable}
|
@@ -27,12 +27,23 @@ include ../head/pwa.pug
|
|
27
27
|
|
28
28
|
script.
|
29
29
|
console.log(
|
30
|
-
"%c Program: Hexo %c Theme: Solitude %c Version: v1.11.
|
30
|
+
"%c Program: Hexo %c Theme: Solitude %c Version: v1.11.2",
|
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
|
"padding: 5px 10px;color:white;background:#0084ff;border-radius:0 5px 5px 0",
|
34
34
|
)
|
35
35
|
|
36
|
+
if theme.memorial.enable
|
37
|
+
script.
|
38
|
+
let mdate = "!{theme.memorial.date}";
|
39
|
+
mdate = (mdate.split(","));
|
40
|
+
let ndate = new Date();
|
41
|
+
for (let i of mdate) {
|
42
|
+
if (i == (ndate.getMonth()+1) + "-" + (ndate.getDate())) {
|
43
|
+
document.documentElement.classList.add('memorial');
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
36
47
|
if theme.extends.head
|
37
48
|
each item in theme.extends.head
|
38
49
|
!= item
|
@@ -40,6 +40,10 @@ if theme.says.enable
|
|
40
40
|
.bber-info-time
|
41
41
|
i.solitude.st-calendar-todo-fill
|
42
42
|
time.datetime(datetime=moment(item.date).format())
|
43
|
+
if item.location
|
44
|
+
.bber-info-location
|
45
|
+
i.solitude.st-map-pin-fill
|
46
|
+
| #{item.location}
|
43
47
|
if item.link
|
44
48
|
a.bber-content-link(href=url_for(item.link) target="_blank")
|
45
49
|
i.solitude.st-link-m-line
|
@@ -10,26 +10,53 @@
|
|
10
10
|
#statistic
|
11
11
|
.post-tips
|
12
12
|
= _p('about.other.tj.post_tip')
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
case tj.provider
|
14
|
+
when '51la'
|
15
|
+
a(href="https://v6.51.la/") 51la网站统计
|
16
|
+
when 'baidu'
|
17
|
+
a(href="https://tongji.baidu.com/") 百度统计
|
18
|
+
if tj.button
|
19
|
+
.banner-button-group
|
20
|
+
a.banner-button(href=url_for(tj.button_link))
|
21
|
+
i.solitude.st-right-btn-fill
|
22
|
+
span.banner-button-text= tj.button_text
|
23
|
+
|
24
|
+
case tj.provider
|
25
|
+
when '51la'
|
26
|
+
script.
|
27
|
+
fetch("#{tj.url}")
|
28
|
+
.then(res => res.text())
|
29
|
+
.then(data => {
|
30
|
+
const title = ["最近活跃", "今日人数", "今日访问", "昨日人数", "昨日访问", "本月访问", "总访问量"];
|
31
|
+
let num = data.match(/(<\/span><span>).*?(\/span><\/p>)/g);
|
32
|
+
num = num.map(el => {
|
33
|
+
let val = el.replace(/(<\/span><span>)/g, "");
|
34
|
+
return val.replace(/(<\/span><\/p>)/g, "");
|
35
|
+
});
|
36
|
+
const s = document.getElementById("statistic");
|
37
|
+
let html = '';
|
38
|
+
for (let i = 0; i < num.length; i++) {
|
39
|
+
if (i === 0 || i === num.length - 1) continue;
|
40
|
+
html += `<div><span>${title[i]}</span><span id="${title[i]}">${num[i]}</span></div>`;
|
41
|
+
}
|
42
|
+
s.innerHTML = html;
|
43
|
+
});
|
44
|
+
when 'baidu'
|
45
|
+
script.
|
46
|
+
fetch("#{tj.url}")
|
47
|
+
.then(res => res.json())
|
48
|
+
.then(data => {
|
49
|
+
const title = {"today_uv": "今日人数", "today_pv": "今日访问", "yesterday_uv": "昨日人数", "yesterday_pv": "昨日访问", "last_month_pv": "最近月访问", "last_year_pv": "最近年访问"};
|
50
|
+
|
51
|
+
let s = document.getElementById("statistic");
|
52
|
+
|
53
|
+
for (let key in data) {
|
54
|
+
if (data.hasOwnProperty(key) && title[key]) {
|
55
|
+
s.innerHTML += `<div><span>${title[key]}</span><span id="${key}">${data[key]}</span></div>`;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
33
60
|
|
34
61
|
if oneself
|
35
62
|
style.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- const { server, site, option } = theme.artalk
|
2
|
-
- const { lazyload
|
2
|
+
- const { lazyload ,use} = theme.comment
|
3
3
|
|
4
4
|
script.
|
5
5
|
(() => {
|
@@ -10,7 +10,7 @@ script.
|
|
10
10
|
server: '!{server}',
|
11
11
|
site: "!{site}",
|
12
12
|
pageKey: location.pathname,
|
13
|
-
darkMode: document.documentElement.getAttribute('data-theme') === 'dark'
|
13
|
+
darkMode: document.documentElement.getAttribute('data-theme') === 'dark'
|
14
14
|
}, !{JSON.stringify(option)})
|
15
15
|
if (GLOBAL_CONFIG.lightbox === 'null') return
|
16
16
|
artalkItem.on('list-loaded', () => {
|
@@ -1,23 +1,32 @@
|
|
1
1
|
- const { server, site, option } = theme.artalk
|
2
|
-
- const avatarCdn =
|
3
|
-
- const avatarDefault = option !== null && option.gravatar && (option.gravatar.params || option.gravatar.default)
|
2
|
+
- const avatarCdn = theme.comment.avatar
|
4
3
|
|
5
4
|
script.
|
6
5
|
window.addEventListener('load', () => {
|
7
6
|
const changeContent = content => {
|
8
|
-
if (content === '') return content
|
7
|
+
if (content === '') return content;
|
9
8
|
const replacements = [
|
10
|
-
{
|
9
|
+
{
|
10
|
+
regex: /<img.*?src="(.*?)"?[^\>]+>/ig,
|
11
|
+
replacement: '[!{_p("console.newest_comment.image")}]'
|
12
|
+
},
|
11
13
|
{
|
12
14
|
regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,
|
13
15
|
replacement: '[!{_p("console.newest_comment.link")}]'
|
14
16
|
},
|
15
|
-
{
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
{
|
18
|
+
regex: /<pre><code>.*?<\/pre>/gi,
|
19
|
+
replacement: '[!{_p("console.newest_comment.code")}]'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
regex: /<[^>]+>/g,
|
23
|
+
replacement: ''
|
24
|
+
}
|
25
|
+
];
|
26
|
+
content = replacements.reduce((str, {regex, replacement}) => str.replace(regex, replacement), content);
|
27
|
+
return content.length > 150 ? content.substring(0, 150) + '...' : content;
|
28
|
+
};
|
29
|
+
|
21
30
|
const generateHtml = (array, asideList) => {
|
22
31
|
asideList.innerHTML = array.length ? array.map(item => `
|
23
32
|
<div class='aside-list-item'>
|
@@ -30,58 +39,56 @@ script.
|
|
30
39
|
<time class="datetime" datetime="${item.date}"></time>
|
31
40
|
</div>
|
32
41
|
</div>
|
33
|
-
`).join('') : "!{_p('newest_comment.zero')}"
|
34
|
-
window.lazyLoadInstance?.update()
|
35
|
-
window.pjax?.refresh()
|
36
|
-
sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
|
37
|
-
}
|
42
|
+
`).join('') : "!{_p('newest_comment.zero')}";
|
43
|
+
window.lazyLoadInstance?.update();
|
44
|
+
window.pjax?.refresh();
|
45
|
+
sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'));
|
46
|
+
};
|
38
47
|
|
39
48
|
const getSetting = async () => {
|
40
49
|
try {
|
41
|
-
const res = await fetch('!{server}/api/v2/conf', {method: 'GET'})
|
42
|
-
return await res.json()
|
50
|
+
const res = await fetch('!{server}/api/v2/conf', {method: 'GET'});
|
51
|
+
return await res.json();
|
43
52
|
} catch (e) {
|
44
|
-
console.error(e)
|
45
|
-
return null
|
53
|
+
console.error(e);
|
54
|
+
return null;
|
46
55
|
}
|
47
|
-
}
|
56
|
+
};
|
48
57
|
|
49
58
|
const getComment = async (asideList) => {
|
50
|
-
const searchParams = new URLSearchParams({'site_name': "!{site}", 'limit': '6'})
|
59
|
+
const searchParams = new URLSearchParams({'site_name': "!{site}", 'limit': '6'});
|
51
60
|
await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, {method: 'GET'}).then(async res => {
|
52
|
-
const result = await res.json()
|
53
|
-
const avatarConfig = await getSetting()
|
54
|
-
const
|
55
|
-
const
|
56
|
-
let avatarDefault = !{avatarDefault} || params || defaults
|
57
|
-
avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}`
|
61
|
+
const result = await res.json();
|
62
|
+
const avatarConfig = await getSetting();
|
63
|
+
const avatarCdn = '!{avatarCdn}' + '/avatar/';
|
64
|
+
const params = avatarConfig?.gravatar?.params || '';
|
58
65
|
const artalk = result.data.map(e => ({
|
59
|
-
avatar:
|
66
|
+
avatar: avatarCdn + e.email_encrypted + '?' + params,
|
60
67
|
content: changeContent(e.content_marked),
|
61
68
|
nick: e.nick,
|
62
|
-
url: e.page_key
|
69
|
+
url: e.page_key + `#atk-comment-${e.id}`,
|
63
70
|
date: e.date,
|
64
|
-
})).slice(0, 6)
|
65
|
-
utils.saveToLocal.set('artalk-newest-comments', artalk, !{theme.comment.newest_comment.storage})
|
66
|
-
generateHtml(artalk, asideList)
|
71
|
+
})).slice(0, 6);
|
72
|
+
utils.saveToLocal.set('artalk-newest-comments', artalk, !{theme.comment.newest_comment.storage});
|
73
|
+
generateHtml(artalk, asideList);
|
67
74
|
}).catch(error => {
|
68
75
|
console.error(error);
|
69
|
-
asideList.textContent = "!{_p('newest_comment.error')}"
|
70
|
-
})
|
71
|
-
}
|
76
|
+
asideList.textContent = "!{_p('newest_comment.error')}";
|
77
|
+
});
|
78
|
+
};
|
72
79
|
|
73
80
|
const newestCommentInit = (asideList) => {
|
74
|
-
const data = utils.saveToLocal.get('artalk-newest-comments')
|
81
|
+
const data = utils.saveToLocal.get('artalk-newest-comments');
|
75
82
|
if (data) {
|
76
|
-
generateHtml(data, asideList)
|
83
|
+
generateHtml(data, asideList);
|
77
84
|
} else {
|
78
|
-
getComment(asideList)
|
85
|
+
getComment(asideList);
|
79
86
|
}
|
80
|
-
}
|
87
|
+
};
|
81
88
|
|
82
|
-
const $asideList = document.querySelector('#card-newest-comments .aside-list')
|
89
|
+
const $asideList = document.querySelector('#card-newest-comments .aside-list');
|
83
90
|
if ($asideList) {
|
84
|
-
newestCommentInit($asideList)
|
85
|
-
utils.addGlobalFn('pjaxComplete', () => newestCommentInit($asideList), 'artalk_newestComment')
|
91
|
+
newestCommentInit($asideList);
|
92
|
+
utils.addGlobalFn('pjaxComplete', () => newestCommentInit($asideList), 'artalk_newestComment');
|
86
93
|
}
|
87
94
|
});
|
package/layout/post.pug
CHANGED
@@ -3,7 +3,7 @@ extends includes/layout.pug
|
|
3
3
|
block content
|
4
4
|
main.layout#content-inner
|
5
5
|
#post
|
6
|
-
if theme.post_ai.enable
|
6
|
+
if theme.post_ai.enable && page.ai
|
7
7
|
include includes/widgets/post/post-ai
|
8
8
|
article.post-content#article-container!= page.content
|
9
9
|
include includes/widgets/post/copyright
|
package/package.json
CHANGED
package/plugins.yml
CHANGED
@@ -5,7 +5,7 @@ algolia_search:
|
|
5
5
|
instantsearch:
|
6
6
|
name: instantsearch.js
|
7
7
|
file: dist/instantsearch.production.min.js
|
8
|
-
version: 4.
|
8
|
+
version: 4.70.0
|
9
9
|
pjax:
|
10
10
|
name: pjax
|
11
11
|
file: pjax.min.js
|
@@ -13,16 +13,16 @@ pjax:
|
|
13
13
|
twikoo:
|
14
14
|
name: twikoo
|
15
15
|
file: dist/twikoo.all.min.js
|
16
|
-
version: 1.6.
|
16
|
+
version: 1.6.36
|
17
17
|
waline_js:
|
18
18
|
name: '@waline/client'
|
19
19
|
file: dist/waline.js
|
20
20
|
other_name: waline
|
21
|
-
version: 3.1
|
21
|
+
version: 3.2.1
|
22
22
|
waline_css:
|
23
23
|
name: '@waline/client'
|
24
24
|
file: dist/waline.css
|
25
|
-
version: 3.1
|
25
|
+
version: 3.2.1
|
26
26
|
other_name: waline
|
27
27
|
valine:
|
28
28
|
name: valine
|
@@ -110,7 +110,7 @@ fancyapps_css:
|
|
110
110
|
mermaid_js:
|
111
111
|
name: mermaid
|
112
112
|
file: dist/mermaid.min.js
|
113
|
-
version: 10.9.
|
113
|
+
version: 10.9.1
|
114
114
|
blueimp_md5:
|
115
115
|
name: blueimp-md5
|
116
116
|
file: js/md5.min.js
|
@@ -11,6 +11,7 @@ hexo.extend.filter.register('after_post_render', function (data) {
|
|
11
11
|
data.cover = data.cover || cover[getRandomInt(0, cover?.length)]
|
12
12
|
data.excerpt = data.description || data.excerpt
|
13
13
|
data.toc = !!(config.aside.toc.post && data.toc !== false)
|
14
|
+
data.ai = data.ai !== false
|
14
15
|
}
|
15
16
|
if (data.layout === 'page') {
|
16
17
|
let {cover} = hexo.theme.config.page.default
|
@@ -422,4 +422,12 @@ span.tags-punctuation::before
|
|
422
422
|
|
423
423
|
#post-info &
|
424
424
|
font-size 14px
|
425
|
-
line-height 32px
|
425
|
+
line-height 32px
|
426
|
+
|
427
|
+
if hexo-config('memorial.enable')
|
428
|
+
.memorial
|
429
|
+
-webkit-filter grayscale(100%)
|
430
|
+
-moz-filter grayscale(100%)
|
431
|
+
-ms-filter grayscale(100%)
|
432
|
+
-o-filter grayscale(100%)
|
433
|
+
filter grayscale(100%)
|
@@ -10,7 +10,6 @@
|
|
10
10
|
background 0 center
|
11
11
|
|
12
12
|
#nav
|
13
|
-
z-index 998
|
14
13
|
transition .3s
|
15
14
|
background var(--efu-card-bg)
|
16
15
|
|
@@ -187,7 +186,6 @@
|
|
187
186
|
#nav
|
188
187
|
position fixed
|
189
188
|
top 0
|
190
|
-
z-index 103
|
191
189
|
transition .3s
|
192
190
|
box-shadow none
|
193
191
|
background var(--efu-card-bg)
|
@@ -287,7 +285,7 @@
|
|
287
285
|
padding 0
|
288
286
|
position absolute
|
289
287
|
top 0
|
290
|
-
z-index
|
288
|
+
z-index 10
|
291
289
|
display flex
|
292
290
|
flex-wrap wrap
|
293
291
|
-webkit-box-align center
|
@@ -307,7 +305,6 @@
|
|
307
305
|
top 0
|
308
306
|
transition .2s
|
309
307
|
position fixed
|
310
|
-
z-index 91
|
311
308
|
opacity 1
|
312
309
|
filter none
|
313
310
|
|
@@ -862,8 +859,6 @@ if hexo-config('nav.group')
|
|
862
859
|
height 35px
|
863
860
|
line-height 35px
|
864
861
|
border-radius 40px
|
865
|
-
if hexo-config('language') == 'en'
|
866
|
-
letter-spacing 0
|
867
862
|
|
868
863
|
#travellings_button
|
869
864
|
display inline
|
@@ -13,7 +13,7 @@ span.tags-punctuation
|
|
13
13
|
color var(--efu-gray)
|
14
14
|
font-size 14px;
|
15
15
|
position absolute
|
16
|
-
bottom
|
16
|
+
bottom 1rem
|
17
17
|
left 2rem
|
18
18
|
|
19
19
|
+maxWidth768()
|
@@ -22,6 +22,7 @@ span.tags-punctuation
|
|
22
22
|
a
|
23
23
|
color var(--efu-gray)
|
24
24
|
border none
|
25
|
+
margin-left 4px
|
25
26
|
|
26
27
|
&:hover
|
27
28
|
color var(--efu-main)
|
@@ -132,11 +132,6 @@ div#banners
|
|
132
132
|
font-weight 700
|
133
133
|
box-shadow var(--efu-shadow-blackdeep)
|
134
134
|
|
135
|
-
#page &
|
136
|
-
+maxWidth768()
|
137
|
-
width 50px
|
138
|
-
height 50px
|
139
|
-
|
140
135
|
&:nth-child(even)
|
141
136
|
margin-top 1rem
|
142
137
|
transform translate(-60px)
|
@@ -224,7 +219,7 @@ div#banners
|
|
224
219
|
|
225
220
|
.banner-button-group
|
226
221
|
position absolute
|
227
|
-
bottom
|
222
|
+
bottom 1rem
|
228
223
|
right 2rem
|
229
224
|
|
230
225
|
.banner-button
|
@@ -106,7 +106,8 @@ if hexo-config('says.enable')
|
|
106
106
|
.fa-rectangles-mixed
|
107
107
|
margin-right 8px
|
108
108
|
|
109
|
-
.bber-info-time
|
109
|
+
.bber-info-time, .bber-info-location
|
110
|
+
margin-right .5rem
|
110
111
|
color var(--efu-fontcolor)
|
111
112
|
font-size .7rem
|
112
113
|
background-color var(--efu-gray-op)
|
@@ -131,7 +132,7 @@ if hexo-config('says.enable')
|
|
131
132
|
|
132
133
|
.bber-content-link
|
133
134
|
display flex
|
134
|
-
margin-
|
135
|
+
margin-right .5rem
|
135
136
|
color var(--efu-secondtext)
|
136
137
|
font-size .7rem
|
137
138
|
align-items center
|
package/source/js/main.js
CHANGED
@@ -155,6 +155,8 @@ const handleThemeChange = mode => {
|
|
155
155
|
|
156
156
|
// lastSayHello 上次打招呼的内容
|
157
157
|
let lastSayHello = "";
|
158
|
+
// 用于记录标签页是否被隐藏,从而改变下次执行打招呼的内容
|
159
|
+
let wasPageHidden = false;
|
158
160
|
// musicPlaying 是否正在播放音乐
|
159
161
|
let musicPlaying = false
|
160
162
|
// is_rm 是否启用右键菜单
|
@@ -391,12 +393,34 @@ let sco = {
|
|
391
393
|
if (el) {
|
392
394
|
const hours = new Date().getHours();
|
393
395
|
const lang = GLOBAL_CONFIG.aside.sayhello;
|
396
|
+
|
397
|
+
const localData = getLocalData(['twikoo', 'WALINE_USER_META', 'WALINE_USER', '_v_Cache_Meta', 'ArtalkUser']);
|
398
|
+
|
399
|
+
function getLocalData(keys) {
|
400
|
+
for (let key of keys) {
|
401
|
+
const data = localStorage.getItem(key);
|
402
|
+
if (data) {
|
403
|
+
return JSON.parse(data);
|
404
|
+
}
|
405
|
+
}
|
406
|
+
return null;
|
407
|
+
};
|
408
|
+
const nick = localData ? (localData.nick ? localData.nick : localData.display_name) : null;
|
409
|
+
|
410
|
+
let prefix;
|
411
|
+
if (wasPageHidden) {
|
412
|
+
prefix = GLOBAL_CONFIG.aside.sayhello3.back + nick;
|
413
|
+
wasPageHidden = false;
|
414
|
+
} else {
|
415
|
+
prefix = GLOBAL_CONFIG.aside.sayhello3.prefix + nick;
|
416
|
+
}
|
417
|
+
|
394
418
|
const greetings = [
|
395
|
-
{start: 0, end: 5, text: lang.goodnight},
|
396
|
-
{start: 6, end: 10, text: lang.morning},
|
397
|
-
{start: 11, end: 14, text: lang.noon},
|
398
|
-
{start: 15, end: 18, text: lang.afternoon},
|
399
|
-
{start: 19, end: 24, text: lang.night},
|
419
|
+
{start: 0, end: 5, text: nick ? prefix : lang.goodnight},
|
420
|
+
{start: 6, end: 10, text: nick ? prefix : lang.morning},
|
421
|
+
{start: 11, end: 14, text: nick ? prefix : lang.noon},
|
422
|
+
{start: 15, end: 18, text: nick ? prefix : lang.afternoon},
|
423
|
+
{start: 19, end: 24, text: nick ? prefix : lang.night},
|
400
424
|
];
|
401
425
|
const greeting = greetings.find(g => hours >= g.start && hours <= g.end);
|
402
426
|
el.innerText = greeting.text;
|
@@ -804,6 +828,12 @@ window.refreshFn = () => {
|
|
804
828
|
document.addEventListener('DOMContentLoaded', () => {
|
805
829
|
[addCopyright, sco.initConsoleState, window.refreshFn, asideStatus, () => window.onscroll = percent].forEach(fn => fn());
|
806
830
|
});
|
831
|
+
// 监听切换标签页
|
832
|
+
document.addEventListener('visibilitychange', () => {
|
833
|
+
if (document.hidden) {
|
834
|
+
wasPageHidden = true;
|
835
|
+
}
|
836
|
+
});
|
807
837
|
// 一些快捷键绑定
|
808
838
|
window.onkeydown = e => {
|
809
839
|
const {keyCode, ctrlKey, shiftKey} = e;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
2
|
+
* author: Efu
|
3
|
+
* email: o@efu.me
|
4
|
+
* website: https://efu.me
|
5
5
|
*/
|
6
|
-
|
6
|
+
class efuAI{constructor(){this.root="https://summary.tianli0.top",this.aiTalkMode=!1,this.aiPostExplanation='',this.config=GLOBAL_CONFIG.post_ai,this.scoGPTIsRunning=!1}init(){if(!document.querySelector(".ai-explanation"))return;this.scoGPTIsRunning=!1;this.aiPostExplanation=PAGE_CONFIG.ai_text?PAGE_CONFIG.ai_text+"":false;if(!this.aiPostExplanation){this.generate()}else{this.aiShowAnimation(Promise.resolve(this.aiPostExplanation))}this.AIEngine()}getTitleAndContent(){const e=document.getElementById("article-container"),t=document.title,n=e.getElementsByTagName("p"),i=e.querySelectorAll("h1, h2, h3, h4, h5");return(t+" "+Array.from(i).concat(Array.from(n)).map((e=>e.innerText.replace(/https?:\/\/[^\s]+/g,""))).join(" ")).slice(0,1e3)}async generate(){this.aiShowAnimation(this.fetch(document.title,this.getTitleAndContent(),this.config.key))}async fetch(e,t,n){const i=`${this.root}/?content=${encodeURIComponent(t)}&title=${e}&key=${encodeURIComponent(n)}&url=${encodeURIComponent(window.location.href)}`,s=await fetch(i),o=await s.json();return s.ok?(this.aiPostExplanation=o.summary,o.summary):(console.error("Request failed:",o.err_msg),o.err_msg)}aiShowAnimation(e,t=!1){const n=document.querySelector(".ai-explanation"),i=document.querySelector(".ai-tag");if(!n||this.scoGPTIsRunning)return;this.scoGPTIsRunning=!0,this.cleanSuggestions(),i.classList.add("loadingAI"),n.style.display="block",n.innerHTML='生成中...<span class="blinking-cursor"></span>';let s,o,a=!0,c=0,r=!0;const l=new IntersectionObserver((e=>{a=e[0].isIntersecting,a&&requestAnimationFrame(o)}),{threshold:0});e.then((e=>{s=performance.now(),o=()=>{if(c<e.length&&a){const r=performance.now(),g=r-s,h=e.slice(c,c+1),u=/[,。!、?,.!?]/.test(h),m=/[a-zA-Z0-9]/.test(h);g>=(u?100*Math.random()+100:m?10:25)&&(n.innerText=e.slice(0,c+1),s=r,c++,c<e.length?n.innerHTML=e.slice(0,c)+'<span class="blinking-cursor"></span>':(n.innerHTML=e,n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect(),t&&this.createSuggestions())),a&&requestAnimationFrame(o)}},a&&r&&setTimeout((()=>{requestAnimationFrame(o),r=!1}),3e3),l.observe(n)})).catch((e=>{console.error("检索信息失败:",e),n.innerHTML="检索信息失败",n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect()}))}AIEngine(){const e=document.querySelector(".ai-tag");e&&e.addEventListener("click",(()=>{this.scoGPTIsRunning||(this.aiTalkMode=!0,this.aiShowAnimation(Promise.resolve(this.config.talk),!0))}))}cleanSuggestions(){const e=document.querySelector(".ai-suggestions");e?e.innerHTML="":console.error("没有这个元素:'ai-suggestions'")}createSuggestions(){this.aiTalkMode&&(this.cleanSuggestions(),this.createSuggestionItemWithAction("这篇文章讲了什么?",(()=>{""===this.aiPostExplanation?this.generate():this.aiShowAnimation(Promise.resolve(this.aiPostExplanation),!0)})),this.config.randomPost&&this.createSuggestionItemWithAction("带我去看看其他文章",(()=>toRandomPost())),this.aiTalkMode=!0)}createSuggestionItemWithAction(e,t){const n=document.querySelector(".ai-suggestions");if(!n)return void console.error("无法找到具有class为ai-suggestions的元素");const i=document.createElement("div");i.classList.add("ai-suggestions-item"),i.textContent=e,i.addEventListener("click",t),n.appendChild(i)}}const efu_ai=new efuAI;
|