hexo-theme-solitude 1.2.3 → 1.2.4
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 +9 -1
- package/layout/category.pug +10 -13
- package/layout/includes/inject/head.pug +6 -2
- package/layout/includes/widgets/third-party/comments/comment.pug +3 -1
- package/layout/includes/widgets/third-party/comments/waline.pug +17 -0
- package/layout/tag.pug +13 -16
- package/package.json +1 -1
- package/source/css/_layout/index.styl +1 -0
- package/source/css/_widgets/comment/waline.styl +75 -0
- package/source/css/index.styl +3 -2
- package/source/js/main.js +28 -4
- /package/source/css/{_comment → _widgets/comment}/index.styl +0 -0
- /package/source/css/{_comment → _widgets/comment}/twikoo.styl +0 -0
package/_config.yml
CHANGED
@@ -407,12 +407,18 @@ thirdparty:
|
|
407
407
|
# 评论
|
408
408
|
comment:
|
409
409
|
enable: false # 是否开启评论
|
410
|
-
type:
|
410
|
+
type: # valine, twikoo
|
411
|
+
lazyload: false # 是否开启懒加载
|
412
|
+
count: false # 是否显示评论数
|
411
413
|
# 评论系统
|
412
414
|
twikoo:
|
413
415
|
envId: # url: https://twikoo.sondy.top/
|
414
416
|
lang: 'zh-CN' # 语言
|
415
417
|
accessToken: # accessToken
|
418
|
+
waline:
|
419
|
+
envId: # url: https://waline.js.org/
|
420
|
+
pageview: false # 是否开启页面访问量统计
|
421
|
+
option: # waline配置项
|
416
422
|
|
417
423
|
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
|
418
424
|
# 插入额外代码 如:统计,广告等
|
@@ -502,6 +508,8 @@ cdn:
|
|
502
508
|
pacejs: https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js
|
503
509
|
echartsjs: https://cdn.bootcdn.net/ajax/libs/echarts/5.4.2/echarts.min.js
|
504
510
|
lunrjs: https://cdn.bootcdn.net/ajax/libs/lunr.js/2.3.9/lunr.min.js
|
511
|
+
walinecss: https://cdn.bootcdn.net/ajax/libs/waline/2.15.7/waline.min.css
|
512
|
+
walinejs: https://cdn.bootcdn.net/ajax/libs/waline/2.15.7/waline.min.js
|
505
513
|
body:
|
506
514
|
viewimagejs: /lib/view-image.min.js
|
507
515
|
waterfalljs: /lib/waterfall.min.js
|
package/layout/category.pug
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
extends includes/layout.pug
|
2
2
|
|
3
3
|
block content
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
include includes/widgets/home/postList
|
15
|
-
include includes/mixins/pagination
|
16
|
-
include includes/widgets/aside/aside
|
4
|
+
main.layout#content-inner
|
5
|
+
div#category
|
6
|
+
div#category-bar
|
7
|
+
div.category-bar-items#category-bar-items
|
8
|
+
include includes/widgets/home/categoryBar
|
9
|
+
div.recent-posts#recent-posts
|
10
|
+
each post in site.posts.find({ parent: { $exists: false } }).data
|
11
|
+
include includes/widgets/home/postList
|
12
|
+
include includes/mixins/pagination
|
13
|
+
include includes/widgets/aside/aside
|
@@ -18,8 +18,12 @@ link(rel="stylesheet", href=cdn.snackbarcss)
|
|
18
18
|
|
19
19
|
// comment
|
20
20
|
if theme.comment.enable
|
21
|
-
|
22
|
-
|
21
|
+
case theme.comment.type
|
22
|
+
when 'twikoo'
|
23
|
+
script(src=cdn.twikoojs)
|
24
|
+
when 'waline'
|
25
|
+
script(src=cdn.walinejs)
|
26
|
+
link(rel="stylesheet", href=cdn.walinecss)
|
23
27
|
|
24
28
|
// search
|
25
29
|
if theme.thirdparty.search.enable
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- const { envId, option, pageview } = theme.comment.waline
|
2
|
+
- const { lazyload, count, type } = theme.comment
|
3
|
+
|
4
|
+
script.
|
5
|
+
async function initComment() {
|
6
|
+
(() => {
|
7
|
+
const waline = Waline.init(Object.assign({
|
8
|
+
el: '#comment',
|
9
|
+
serverURL: '!{envId}',
|
10
|
+
pageview: !{lazyload ? false : pageview},
|
11
|
+
dark: 'html[data-theme="dark"]',
|
12
|
+
path: window.location.pathname,
|
13
|
+
search: false,
|
14
|
+
comment: !{lazyload ? false : count},
|
15
|
+
}, !{JSON.stringify(option)}))
|
16
|
+
})()
|
17
|
+
}
|
package/layout/tag.pug
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
extends includes/layout.pug
|
2
2
|
|
3
3
|
block content
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
include includes/widgets/home/postList
|
18
|
-
include includes/mixins/pagination
|
19
|
-
include includes/widgets/aside/aside
|
4
|
+
main.layout#content-inner
|
5
|
+
div#tag
|
6
|
+
div#tag-page-tags
|
7
|
+
each tag in site.tags.find({ parent: { $exists: false } }).data
|
8
|
+
a(id=tag.name class=(tag.name === page.tag ? 'select' : '') href=url_for(tag.path))
|
9
|
+
span.tags-punctuation
|
10
|
+
| #{tag.name}
|
11
|
+
span.tagsPageCount #{tag.length}
|
12
|
+
div.recent-posts#recent-posts
|
13
|
+
each post in site.posts.find({ parent: { $exists: false } }).data
|
14
|
+
include includes/widgets/home/postList
|
15
|
+
include includes/mixins/pagination
|
16
|
+
include includes/widgets/aside/aside
|
package/package.json
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
#comment
|
2
|
+
.wl-sort li
|
3
|
+
color var(--sco-gray)
|
4
|
+
|
5
|
+
&.active
|
6
|
+
color var(--sco-main) !important
|
7
|
+
|
8
|
+
.wl-comment
|
9
|
+
.wl-panel
|
10
|
+
margin 0 !important
|
11
|
+
|
12
|
+
.wl-footer
|
13
|
+
.wl-info
|
14
|
+
button
|
15
|
+
background-color var(--sco-card-bg)
|
16
|
+
border var(--style-border-always)
|
17
|
+
color var(--sco-fontcolor)
|
18
|
+
|
19
|
+
button:hover
|
20
|
+
background-color var(--sco-main)
|
21
|
+
border-color var(--sco-main)
|
22
|
+
color var(--sco-card-bg)
|
23
|
+
|
24
|
+
#wl-edit
|
25
|
+
font-size 13px
|
26
|
+
line-height 1.5
|
27
|
+
margin .75rem .25rem
|
28
|
+
|
29
|
+
.wl-action
|
30
|
+
transition .3s
|
31
|
+
|
32
|
+
&:hover
|
33
|
+
color var(--sco-main)
|
34
|
+
|
35
|
+
.wl-meta-head
|
36
|
+
.wl-count
|
37
|
+
color var(--sco-gray)
|
38
|
+
font-size 14px
|
39
|
+
font-weight normal
|
40
|
+
|
41
|
+
.wl-cards
|
42
|
+
font-size 16px!important
|
43
|
+
.wl-comment-actions
|
44
|
+
button
|
45
|
+
margin-right 15px
|
46
|
+
font-size 18px
|
47
|
+
|
48
|
+
&:hover
|
49
|
+
color var(--sco-main)
|
50
|
+
.wl-head .wl-nick
|
51
|
+
font-size 20px !important
|
52
|
+
color var(--sco-lighttext)
|
53
|
+
font-weight bolder
|
54
|
+
|
55
|
+
.wl-meta>span
|
56
|
+
background var(--sco-gray)
|
57
|
+
border-radius 5px
|
58
|
+
color var(--sco-card-bg)
|
59
|
+
margin-right 5px
|
60
|
+
|
61
|
+
.wl-user
|
62
|
+
img
|
63
|
+
flex-shrink 0
|
64
|
+
height 2.5rem
|
65
|
+
width 2.5rem
|
66
|
+
overflow hidden
|
67
|
+
text-align center
|
68
|
+
border-radius 2.5rem
|
69
|
+
border 2px solid var(--sco-white)
|
70
|
+
|
71
|
+
[data-waline] a
|
72
|
+
color var(--sco-main) !important
|
73
|
+
|
74
|
+
.wl-content pre, .wl-content pre[class*=language-]
|
75
|
+
padding .5rem!important
|
package/source/css/index.styl
CHANGED
@@ -15,8 +15,9 @@ if hexo-config('css_prefix')
|
|
15
15
|
|
16
16
|
// comment
|
17
17
|
if hexo-config('comment.enable')
|
18
|
-
@import '
|
19
|
-
@import '
|
18
|
+
@import '_widgets/comment/index.styl'
|
19
|
+
@import '_widgets/comment/twikoo.styl' when hexo-config('comment.type') == 'twikoo'
|
20
|
+
@import '_widgets/comment/waline.styl' when hexo-config('comment.type') == 'waline'
|
20
21
|
|
21
22
|
// commentBarrage
|
22
23
|
if hexo-config('thirdparty.comment.enable')
|
package/source/js/main.js
CHANGED
@@ -846,7 +846,7 @@ let sco = {
|
|
846
846
|
|
847
847
|
pageText.addEventListener("keydown", (event) => {
|
848
848
|
if (event.keyCode === 13) {
|
849
|
-
|
849
|
+
sco.toPage();
|
850
850
|
pjax.loadUrl(pageButton.href);
|
851
851
|
}
|
852
852
|
});
|
@@ -881,7 +881,29 @@ let sco = {
|
|
881
881
|
cookiesWindow.style.display = 'none';
|
882
882
|
}
|
883
883
|
}
|
884
|
-
}
|
884
|
+
},
|
885
|
+
/**
|
886
|
+
* 首页分页跳转
|
887
|
+
*/
|
888
|
+
toPage: function () {
|
889
|
+
const pageNumbers = document.querySelectorAll(".page-number");
|
890
|
+
const maxPageNumber = parseInt(pageNumbers[pageNumbers.length - 1].innerHTML);
|
891
|
+
const inputElement = document.getElementById("toPageText");
|
892
|
+
const inputPageNumber = parseInt(inputElement.value);
|
893
|
+
|
894
|
+
if (!isNaN(inputPageNumber) && inputPageNumber > 0 && inputPageNumber <= maxPageNumber) {
|
895
|
+
const currentPageUrl = window.location.href.replace(/\/page\/\d+\/$/, "/");
|
896
|
+
let targetPageUrl;
|
897
|
+
|
898
|
+
if (inputPageNumber === 1) {
|
899
|
+
targetPageUrl = currentPageUrl;
|
900
|
+
} else {
|
901
|
+
targetPageUrl = currentPageUrl + (currentPageUrl.endsWith("/") ? "" : "/") + "page/" + inputPageNumber + "/";
|
902
|
+
}
|
903
|
+
|
904
|
+
document.getElementById("toPageButton").href = targetPageUrl;
|
905
|
+
}
|
906
|
+
},
|
885
907
|
}
|
886
908
|
|
887
909
|
/*
|
@@ -1005,7 +1027,6 @@ window.refreshFn = () => {
|
|
1005
1027
|
GLOBAL_CONFIG.lazyload.enable && sco.lazyloadImg()
|
1006
1028
|
GLOBAL_CONFIG.lightbox && sco.lightbox('')
|
1007
1029
|
GLOBAL_CONFIG.randomlinks && randomLinksList()
|
1008
|
-
GLOBAL_CONFIG.comment.enable && newestCommentInit()
|
1009
1030
|
if (PAGE_CONFIG.comment) {
|
1010
1031
|
initComment()
|
1011
1032
|
}
|
@@ -1022,7 +1043,10 @@ window.refreshFn = () => {
|
|
1022
1043
|
sco.initConsoleState()
|
1023
1044
|
if (document.getElementById('history-baidu')) sco.card_history() // 那年今日
|
1024
1045
|
if (document.getElementById('welcome-info')) sco.card_welcome() // 个性定位
|
1025
|
-
if (GLOBAL_CONFIG.comment.type === "twikoo" && PAGE_CONFIG.comment)
|
1046
|
+
if (GLOBAL_CONFIG.comment.type === "twikoo" && PAGE_CONFIG.comment) {
|
1047
|
+
initializeCommentBarrage() // 热评
|
1048
|
+
GLOBAL_CONFIG.comment.enable && newestCommentInit()
|
1049
|
+
}
|
1026
1050
|
}
|
1027
1051
|
|
1028
1052
|
sco.initTheme()
|
File without changes
|
File without changes
|