hexo-theme-solitude 1.8.1 → 1.8.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/README.md +12 -9
- package/README_en.md +9 -6
- package/README_zh-tw.md +8 -7
- package/layout/includes/inject/body.pug +15 -13
- package/layout/includes/inject/head.pug +1 -1
- package/layout/includes/widgets/third-party/comments/artalk.pug +1 -1
- package/layout/includes/widgets/third-party/comments/comment.pug +1 -12
- package/layout/includes/widgets/third-party/comments/js.pug +12 -0
- package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -1
- package/layout/includes/widgets/third-party/comments/valine.pug +11 -11
- package/layout/includes/widgets/third-party/comments/waline.pug +22 -21
- package/layout/includes/widgets/third-party/news-comment/artalk.pug +6 -7
- package/layout/includes/widgets/third-party/news-comment/valine.pug +3 -3
- package/layout/includes/widgets/third-party/news-comment/waline.pug +11 -9
- package/layout/includes/widgets/third-party/pjax.pug +1 -11
- package/layout/page.pug +1 -0
- package/layout/post.pug +1 -0
- package/package.json +1 -1
- package/plugins.yml +5 -4
- package/source/js/barrage_comment.js +1 -1
package/README.md
CHANGED
@@ -10,11 +10,11 @@
|
|
10
10
|
|
11
11
|
主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!
|
12
12
|
|
13
|
-

|
14
14
|

|
15
15
|

|
16
16
|
[](https://github.com/valor-x/hexo-theme-solitude/stargazers)
|
17
|
-
[](https://www.npmjs.com/package/hexo-theme-solitude)
|
18
18
|
|
19
19
|

|
20
20
|

|
@@ -28,8 +28,9 @@
|
|
28
28
|

|
29
29
|
[](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
|
30
30
|
|
31
|
-
[](https://twitter.com/efu_oo)
|
32
|
+
[](https://t.me/solitudePro)
|
33
|
+
[](https://discord.gg/Y8VEvVgW)
|
33
34
|
|
34
35
|

|
35
36
|

|
@@ -37,7 +38,7 @@
|
|
37
38
|
[](https://gitee.com/nsjjd_w/hexo-theme-solitude)
|
38
39
|
[](https://gitlab.com/efu/hexo-theme-solitude)
|
39
40
|
|
40
|
-
[预览](https://efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
|
41
|
+
[预览](https://www.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
|
41
42
|
|
42
43
|
</div>
|
43
44
|
|
@@ -47,7 +48,7 @@
|
|
47
48
|
|
48
49
|
- 页面懒加载(Pjax)、图片懒加载(LazyLoad)、离线应用(PWA)
|
49
50
|
- 评论(Twikoo、Waline、Valine、Artalk),支持双评论
|
50
|
-
-
|
51
|
+
- 昼夜切换(ColorMode)
|
51
52
|
- 灯箱(medium-zoom、fancybox)
|
52
53
|
- 数学公式(Latex)
|
53
54
|
- 特色页面:即刻短文、我的装备、在线工具、音乐馆、友链鱼塘、相册页、豆瓣页
|
@@ -55,9 +56,11 @@
|
|
55
56
|
|
56
57
|
## Todo
|
57
58
|
|
58
|
-
- [x]
|
59
|
-
- [
|
60
|
-
- [
|
59
|
+
- [x] Artalk 评论
|
60
|
+
- [x] 双评论
|
61
|
+
- [x] 相册
|
62
|
+
|
63
|
+
> 如有問題請提 [issue](https://github.com/valor-x/hexo-theme-solitude/issues)
|
61
64
|
|
62
65
|
## 应用
|
63
66
|
|
package/README_en.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|

|
15
15
|

|
16
16
|
[](https://github.com/valor-x/hexo-theme-solitude/stargazers)
|
17
|
-
[](https://www.npmjs.com/package/hexo-theme-solitude)
|
18
18
|
|
19
19
|

|
20
20
|

|
@@ -28,8 +28,9 @@
|
|
28
28
|

|
29
29
|
[](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
|
30
30
|
|
31
|
-
[](https://twitter.com/efu_oo)
|
32
|
+
[](https://t.me/solitudePro)
|
33
|
+
[](https://discord.gg/Y8VEvVgW)
|
33
34
|
|
34
35
|

|
35
36
|

|
@@ -55,9 +56,11 @@
|
|
55
56
|
|
56
57
|
## Todo
|
57
58
|
|
58
|
-
- [x]
|
59
|
-
- [
|
60
|
-
- [
|
59
|
+
- [x] Artalk
|
60
|
+
- [x] Use double comment
|
61
|
+
- [x] Album
|
62
|
+
|
63
|
+
> If you have any questions, please issue an [issue](https://github.com/valor-x/hexo-theme-solitude/issues)
|
61
64
|
|
62
65
|
## Setup
|
63
66
|
|
package/README_zh-tw.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|

|
15
15
|

|
16
16
|
[](https://github.com/valor-x/hexo-theme-solitude/stargazers)
|
17
|
-
[](https://www.npmjs.com/package/hexo-theme-solitude)
|
18
18
|
|
19
19
|

|
20
20
|

|
@@ -28,8 +28,9 @@
|
|
28
28
|

|
29
29
|
[](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
|
30
30
|
|
31
|
-
[](https://twitter.com/efu_oo)
|
32
|
+
[](https://t.me/solitudePro)
|
33
|
+
[](https://discord.gg/Y8VEvVgW)
|
33
34
|
|
34
35
|

|
35
36
|

|
@@ -47,7 +48,7 @@
|
|
47
48
|
|
48
49
|
- 頁面懶載入(Pjax)、圖片懶載入(LazyLoad)、離線應用(PWA)
|
49
50
|
- 評論(Twikoo、Waline、Valine、Artalk),支援雙評論
|
50
|
-
-
|
51
|
+
- 晝夜切換(ColorMode)
|
51
52
|
- 燈箱(medium-zoom、fancybox)
|
52
53
|
- 數學公式(Latex)
|
53
54
|
- 特色頁面:即刻短文、我的裝備、在線工具、音樂館、友鏈魚塘、相冊頁、豆瓣頁
|
@@ -55,9 +56,9 @@
|
|
55
56
|
|
56
57
|
## Todo
|
57
58
|
|
58
|
-
- [x]
|
59
|
-
- [
|
60
|
-
- [
|
59
|
+
- [x] Artalk 評論
|
60
|
+
- [x] 雙評論
|
61
|
+
- [x] 相冊
|
61
62
|
|
62
63
|
## 應用
|
63
64
|
|
@@ -80,19 +80,21 @@ div
|
|
80
80
|
each item in theme.extends.body
|
81
81
|
!= item
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
83
|
+
.js-pjax
|
84
|
+
if comment_js
|
85
|
+
include ../widgets/third-party/comments/js
|
86
|
+
if theme.mermaid
|
87
|
+
script.
|
88
|
+
mermaid.run();
|
89
|
+
if is_home() && theme.carousel && site.posts.data.filter(item => item.recommend === true).slice(0, 6) || false
|
90
|
+
script.
|
91
|
+
carousel_swiper()
|
92
|
+
if page.type === 'says' && theme.says.enable
|
93
|
+
script.
|
94
|
+
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
|
95
|
+
sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
|
96
|
+
if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
|
97
|
+
script(async src=url_for(theme.cdn.busuanzi_js))
|
96
98
|
|
97
99
|
|
98
100
|
if theme.footer.randomlink
|
@@ -28,7 +28,7 @@ if theme.pwa.enable
|
|
28
28
|
|
29
29
|
script.
|
30
30
|
console.log(
|
31
|
-
"%c Program: Hexo %c Theme: Solitude %c Version: v1.8.
|
31
|
+
"%c Program: Hexo %c Theme: Solitude %c Version: v1.8.2",
|
32
32
|
"border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
|
33
33
|
"padding: 5px 10px;color:white;background:#3e9f50;",
|
34
34
|
"border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
|
@@ -39,15 +39,4 @@
|
|
39
39
|
when 'Waline'
|
40
40
|
#waline-wrap
|
41
41
|
when 'Artalk'
|
42
|
-
#artalk-wrap
|
43
|
-
|
44
|
-
each name in use
|
45
|
-
case name
|
46
|
-
when 'Twikoo'
|
47
|
-
!=partial('includes/widgets/third-party/comments/twikoo', {}, {cache: true})
|
48
|
-
when 'Waline'
|
49
|
-
!=partial('includes/widgets/third-party/comments/waline', {}, {cache: true})
|
50
|
-
when 'Valine'
|
51
|
-
!=partial('includes/widgets/third-party/comments/valine', {}, {cache: true})
|
52
|
-
when 'Artalk'
|
53
|
-
!=partial('includes/widgets/third-party/comments/artalk', {}, {cache: true})
|
42
|
+
#artalk-wrap
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- const {use} = theme.comment
|
2
|
+
|
3
|
+
each name in use
|
4
|
+
case name
|
5
|
+
when 'Twikoo'
|
6
|
+
!=partial('includes/widgets/third-party/comments/twikoo', {}, {cache: true})
|
7
|
+
when 'Waline'
|
8
|
+
!=partial('includes/widgets/third-party/comments/waline', {}, {cache: true})
|
9
|
+
when 'Valine'
|
10
|
+
!=partial('includes/widgets/third-party/comments/valine', {}, {cache: true})
|
11
|
+
when 'Artalk'
|
12
|
+
!=partial('includes/widgets/third-party/comments/artalk', {}, {cache: true})
|
@@ -39,7 +39,7 @@ script.
|
|
39
39
|
|
40
40
|
if commentBarrage
|
41
41
|
script.
|
42
|
-
|
42
|
+
async function barrageValine() {
|
43
43
|
const url = new URL('!{serverURLs}/1.1/classes/Comment')
|
44
44
|
const params = {
|
45
45
|
url: window.location.pathname,
|
@@ -56,15 +56,15 @@ if commentBarrage
|
|
56
56
|
}).then(async res => {
|
57
57
|
if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`)
|
58
58
|
const data = await res.json()
|
59
|
-
if(typeof md5 ==="undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
|
60
|
-
await utils.getScript('!{url_for(theme.cdn.commentBarrage)}')
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
|
60
|
+
await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(() =>
|
61
|
+
initializeCommentBarrage(data.results
|
62
|
+
.filter(item => item.url === window.location.pathname)
|
63
|
+
.map(item => ({
|
64
|
+
content: item.comment,
|
65
|
+
nick: item.nick,
|
66
|
+
mailMd5: md5(item.mail),
|
67
|
+
id: item.objectId
|
68
|
+
}))))
|
69
69
|
}).catch(error => console.error("An error occurred while fetching comments: ", error))
|
70
70
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
- const { envId, option ,pageview } = theme.
|
2
|
-
- const { lazyload, count, commentBarrage } = theme.comment
|
1
|
+
- const { envId, option ,pageview } = theme.waline
|
2
|
+
- const { lazyload, count, commentBarrage,use } = theme.comment
|
3
3
|
|
4
4
|
script.
|
5
5
|
!function () {
|
@@ -18,7 +18,10 @@ script.
|
|
18
18
|
const walineInstance = initFn(walineOptions)
|
19
19
|
utils.addGlobalFn('pjax', () => walineInstance.destroy(), 'destroyWaline')
|
20
20
|
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll('#comment .wl-content img:not(.wl-emoji)'))
|
21
|
-
sco.owoBig(
|
21
|
+
sco.owoBig({
|
22
|
+
body: '.wl-emoji-popup',
|
23
|
+
item: '.wl-tab-wrapper button'
|
24
|
+
})
|
22
25
|
}
|
23
26
|
|
24
27
|
async function loadWaline() {
|
@@ -30,10 +33,10 @@ script.
|
|
30
33
|
initWaline(walineInitFunction)
|
31
34
|
window.walineFn = walineInitFunction
|
32
35
|
}
|
33
|
-
|
36
|
+
!{commentBarrage} && barrageWaline()
|
34
37
|
}
|
35
38
|
|
36
|
-
if (
|
39
|
+
if (!{use[0] === 'Waline'} || !{lazyload}) {
|
37
40
|
if (!{lazyload}) utils.loadComment(document.getElementById('waline-wrap'), loadWaline)
|
38
41
|
else loadWaline()
|
39
42
|
} else window.loadTwoComment = loadWaline
|
@@ -41,24 +44,22 @@ script.
|
|
41
44
|
|
42
45
|
if commentBarrage
|
43
46
|
script.
|
44
|
-
|
47
|
+
async function barrageWaline() {
|
45
48
|
const url = new URL('!{envId}/api/comment')
|
46
49
|
const params = {path: window.location.pathname, sortBy: 'insertedAt_asc'}
|
47
50
|
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value))
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
id: item.objectId
|
62
|
-
})))
|
51
|
+
await fetch(url).then(async res => {
|
52
|
+
if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`)
|
53
|
+
const data = await res.json();
|
54
|
+
const regex = /<img [^>]*class="wl-emoji"[^>]*>/;
|
55
|
+
await utils.getScript('!{url_for(theme.cdn.commentBarrage)}').then(() => {
|
56
|
+
initializeCommentBarrage(data.data.data
|
57
|
+
.map(item => ({
|
58
|
+
nick: item.nick,
|
59
|
+
mailId: item.avatar,
|
60
|
+
content: item.comment.replace(regex, ''),
|
61
|
+
id: item.objectId
|
62
|
+
})))
|
63
|
+
})
|
63
64
|
}).catch(error => console.error("An error occurred while fetching comments: ", error))
|
64
65
|
}
|
@@ -47,9 +47,8 @@ script.
|
|
47
47
|
}
|
48
48
|
|
49
49
|
const getComment = async (asideList) => {
|
50
|
-
|
51
|
-
|
52
|
-
const res = await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, {method: 'GET'})
|
50
|
+
const searchParams = new URLSearchParams({'site_name': "!{site}", 'limit': '6'})
|
51
|
+
await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, {method: 'GET'}).then(async res => {
|
53
52
|
const result = await res.json()
|
54
53
|
const avatarConfig = await getSetting()
|
55
54
|
const {mirror, params, default: defaults} = avatarConfig.frontend_conf.gravatar
|
@@ -65,11 +64,11 @@ script.
|
|
65
64
|
}))
|
66
65
|
utils.saveToLocal.set('artalk-newest-comments', artalk, !{theme.comment.newest_comment.storage})
|
67
66
|
generateHtml(artalk, asideList)
|
68
|
-
}
|
69
|
-
console.error(
|
67
|
+
}).catch(error => {
|
68
|
+
console.error(error);
|
70
69
|
asideList.textContent = "!{_p('newest_comment.error')}"
|
71
|
-
}
|
72
|
-
}
|
70
|
+
})
|
71
|
+
}
|
73
72
|
|
74
73
|
const newestCommentInit = (asideList) => {
|
75
74
|
const data = utils.saveToLocal.get('artalk-newest-comments')
|
@@ -72,9 +72,9 @@ script.
|
|
72
72
|
</div>
|
73
73
|
</div>
|
74
74
|
`).join('') : "!{_p('newest_comment.zero')}"
|
75
|
-
window.lazyLoadInstance
|
76
|
-
window.pjax
|
77
|
-
sco
|
75
|
+
window.lazyLoadInstance?.update()
|
76
|
+
window.pjax?.refresh()
|
77
|
+
sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
|
78
78
|
}
|
79
79
|
|
80
80
|
newestCommentInit()
|
@@ -5,7 +5,10 @@ script.
|
|
5
5
|
|
6
6
|
const replacements = [
|
7
7
|
{regex: /<img.*?src="(.*?)"?[^\>]+>/ig, replacement: '[!{_p("console.newest_comment.image")}]'},
|
8
|
-
{
|
8
|
+
{
|
9
|
+
regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,
|
10
|
+
replacement: '[!{_p("console.newest_comment.link")}]'
|
11
|
+
},
|
9
12
|
{regex: /<pre><code>.*?<\/pre>/gi, replacement: '[!{_p("console.newest_comment.code")}]'},
|
10
13
|
{regex: /<[^>]+>/g, replacement: ""}
|
11
14
|
];
|
@@ -26,8 +29,7 @@ script.
|
|
26
29
|
}
|
27
30
|
|
28
31
|
const getComment = async () => {
|
29
|
-
|
30
|
-
const res = await fetch('!{theme.waline.envId}/api/comment?type=recent&count=8', {method: 'GET'})
|
32
|
+
await fetch('!{theme.waline.envId}/api/comment?type=recent&count=8', {method: 'GET'}).then(async res => {
|
31
33
|
const result = await res.json()
|
32
34
|
const walineArray = result.data.map(e => {
|
33
35
|
return {
|
@@ -40,10 +42,10 @@ script.
|
|
40
42
|
})
|
41
43
|
utils.saveToLocal.set('waline-newest-comment', walineArray, !{theme.comment.newest_comment.storage})
|
42
44
|
generateHtml(walineArray)
|
43
|
-
}
|
44
|
-
console.error(
|
45
|
+
}).catch(error => {
|
46
|
+
console.error(error)
|
45
47
|
$asideList.textContent = "!{_p('newest_comment.error')}"
|
46
|
-
}
|
48
|
+
})
|
47
49
|
}
|
48
50
|
|
49
51
|
const generateHtml = array => {
|
@@ -60,9 +62,9 @@ script.
|
|
60
62
|
</div>
|
61
63
|
</div>
|
62
64
|
`).join('') : "!{_p('newest_comment.zero')}"
|
63
|
-
window.lazyLoadInstance
|
64
|
-
window.pjax
|
65
|
-
sco
|
65
|
+
window.lazyLoadInstance?.update()
|
66
|
+
window.pjax?.refresh()
|
67
|
+
sco?.changeTimeFormat(document.querySelectorAll('.aside-list-item time'))
|
66
68
|
}
|
67
69
|
|
68
70
|
newestCommentInit()
|
@@ -1,17 +1,7 @@
|
|
1
1
|
script.
|
2
|
-
let pjaxSelectors = [
|
3
|
-
'title',
|
4
|
-
'#body-wrap',
|
5
|
-
'#site-config',
|
6
|
-
'meta[name="description"]',
|
7
|
-
'#js-pjax',
|
8
|
-
'meta[property^="og:"]',
|
9
|
-
'#config-diff'
|
10
|
-
]
|
11
|
-
|
12
2
|
const pjax = new Pjax({
|
13
3
|
elements: 'a:not([target="_blank"])',
|
14
|
-
selectors:
|
4
|
+
selectors: ['title','#body-wrap','#site-config','meta[name="description"]','.js-pjax','meta[property^="og:"]','#config-diff'],
|
15
5
|
cacheBust: false,
|
16
6
|
analytics: false,
|
17
7
|
scrollRestoration: false
|
package/layout/page.pug
CHANGED
package/layout/post.pug
CHANGED
package/package.json
CHANGED
package/plugins.yml
CHANGED
@@ -15,14 +15,15 @@ twikoo:
|
|
15
15
|
file: dist/twikoo.all.min.js
|
16
16
|
version: 1.6.32
|
17
17
|
waline_js:
|
18
|
-
name: 'waline'
|
18
|
+
name: '@waline/client'
|
19
19
|
file: dist/waline.js
|
20
20
|
other_name: waline
|
21
21
|
version: 3.1.3
|
22
22
|
waline_css:
|
23
|
-
name: 'waline'
|
23
|
+
name: '@waline/client'
|
24
24
|
file: dist/waline.css
|
25
25
|
version: 3.1.3
|
26
|
+
other_name: waline
|
26
27
|
valine:
|
27
28
|
name: valine
|
28
29
|
file: dist/Valine.min.js
|
@@ -95,12 +96,12 @@ medium_zoom:
|
|
95
96
|
fancyapps_ui:
|
96
97
|
name: '@fancyapps/ui'
|
97
98
|
file: dist/fancybox/fancybox.umd.js
|
98
|
-
version: 5.0.
|
99
|
+
version: 5.0.36
|
99
100
|
other_name: fancyapps-ui
|
100
101
|
fancyapps_css:
|
101
102
|
name: '@fancyapps/ui'
|
102
103
|
file: dist/fancybox/fancybox.css
|
103
|
-
version: 5.0.
|
104
|
+
version: 5.0.36
|
104
105
|
other_name: fancyapps-ui
|
105
106
|
mermaid_js:
|
106
107
|
name: mermaid
|