hexo-theme-solitude 2.0.9 → 2.0.10
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 +1 -1
- package/README_zh-Hans.md +3 -3
- package/README_zh-Hant.md +2 -2
- package/_config.yml +12 -2
- package/layout/includes/inject/body.pug +106 -100
- package/layout/includes/widgets/home/topGroup.pug +5 -5
- package/layout/includes/widgets/post/copyright.pug +1 -1
- package/package.json +4 -4
- package/plugins.yml +11 -1
- package/scripts/event/merge_config.js +425 -423
- package/scripts/helper/inject_head_js.js +13 -7
- package/scripts/tags/article.js +39 -0
- package/scripts/tags/chart.js +27 -0
- package/scripts/tags/gallery.js +1 -1
- package/scripts/tags/typeit.js +29 -0
- package/source/css/_layout/article-container.styl +2 -2
- package/source/css/_layout/recent-post.styl +27 -29
- package/source/css/_page/_home/home-top.styl +5 -5
- package/source/js/main.js +1 -1
- package/source/js/utils.js +1 -7
@@ -21,13 +21,13 @@ hexo.extend.helper.register('inject_head_js', function () {
|
|
21
21
|
},
|
22
22
|
get: function getWithExpiry(key) {
|
23
23
|
const itemStr = localStorage.getItem(key)
|
24
|
-
|
24
|
+
|
25
25
|
if (!itemStr) {
|
26
26
|
return undefined
|
27
27
|
}
|
28
28
|
const item = JSON.parse(itemStr)
|
29
29
|
const now = new Date()
|
30
|
-
|
30
|
+
|
31
31
|
if (now.getTime() > item.expiry) {
|
32
32
|
localStorage.removeItem(key)
|
33
33
|
return undefined
|
@@ -62,24 +62,30 @@ hexo.extend.helper.register('inject_head_js', function () {
|
|
62
62
|
script.onload = script.onreadystatechange = null
|
63
63
|
resolve()
|
64
64
|
}
|
65
|
-
|
65
|
+
|
66
66
|
Object.keys(attr).forEach(key => {
|
67
67
|
script.setAttribute(key, attr[key])
|
68
68
|
})
|
69
|
-
|
69
|
+
|
70
70
|
document.head.appendChild(script)
|
71
71
|
}),
|
72
72
|
addGlobalFn: (key, fn, name = false, parent = window) => {
|
73
73
|
const globalFn = parent.globalFn || {}
|
74
74
|
const keyObj = globalFn[key] || {}
|
75
|
-
|
75
|
+
|
76
76
|
if (name && keyObj[name]) return
|
77
|
-
|
77
|
+
|
78
78
|
name = name || Object.keys(keyObj).length
|
79
79
|
keyObj[name] = fn
|
80
80
|
globalFn[key] = keyObj
|
81
81
|
parent.globalFn = globalFn
|
82
82
|
},
|
83
|
+
addEventListenerPjax: (ele, event, fn, option = false) => {
|
84
|
+
ele.addEventListener(event, fn, option)
|
85
|
+
utils.addGlobalFn('pjax', () => {
|
86
|
+
ele.removeEventListener(event, fn, option)
|
87
|
+
})
|
88
|
+
},
|
83
89
|
}
|
84
90
|
`
|
85
91
|
return `<script>(()=>{${createJS()}})()</script>`
|
@@ -88,4 +94,4 @@ hexo.extend.helper.register('inject_head_js', function () {
|
|
88
94
|
hexo.extend.helper.register('packageVersion', function () {
|
89
95
|
const {version} = require('../../package.json')
|
90
96
|
return version
|
91
|
-
})
|
97
|
+
})
|
@@ -0,0 +1,39 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const article = ([path]) => {
|
4
|
+
const post = hexo.locals.get("posts").data.find(post => post.path === path);
|
5
|
+
if (!post) {
|
6
|
+
return '';
|
7
|
+
}
|
8
|
+
const tags = post.tags.map(tag => `<a class="article-meta__tags fancybox" href="${tag.path}" onclick="event.stopPropagation();"><span class="tags-punctuation"><i class="solitude fa-solid fa-hashtag"></i>${tag.name}</span></a>`).join('');
|
9
|
+
const category = post.categories.data.length > 0 ? `<span class="article-meta sticky-warp"><span class="original">${post.categories.data[0].name}</span></span>` : '';
|
10
|
+
return `
|
11
|
+
<div class="recent-post-item" onclick="pjax.loadUrl('${post.path}')">
|
12
|
+
<div class="post_cover">
|
13
|
+
<a href="${post.path}" class="fancybox" title="${post.title}">
|
14
|
+
<img class="post_bg" src="${post.cover}" alt="${post.title}">
|
15
|
+
</a>
|
16
|
+
</div>
|
17
|
+
<div class="recent-post-info">
|
18
|
+
<div class="recent-post-info-top">
|
19
|
+
<div class="recent-post-info-top-tips">
|
20
|
+
${category}
|
21
|
+
</div>
|
22
|
+
<a class="article-title fancybox" href="${post.path}" title="${post.title}">${post.title}</a>
|
23
|
+
</div>
|
24
|
+
<div class="content">
|
25
|
+
${post.description ? post.description : ''}
|
26
|
+
</div>
|
27
|
+
<div class="article-meta-wrap">
|
28
|
+
<span class="article-meta tags">
|
29
|
+
${tags}
|
30
|
+
</span>
|
31
|
+
<span class="post-meta-date">
|
32
|
+
<time datetime="${post.date}" style="display: inline;"></time>
|
33
|
+
</span>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>`;
|
37
|
+
}
|
38
|
+
|
39
|
+
hexo.extend.tag.register('article', article)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Chart.js tag for Solitude theme
|
3
|
+
*/
|
4
|
+
|
5
|
+
'use strict'
|
6
|
+
|
7
|
+
const chart = (args, content) => {
|
8
|
+
const id = Math.random().toString(36).substr(2, 9);
|
9
|
+
return `
|
10
|
+
<div class="chart">
|
11
|
+
<canvas id="chart-${id}"></canvas>
|
12
|
+
<script>
|
13
|
+
!function() {
|
14
|
+
const chart = () => {
|
15
|
+
const canvas = document.getElementById("chart-${id}");
|
16
|
+
if (!canvas) return;
|
17
|
+
const ctx = canvas.getContext("2d");
|
18
|
+
new Chart(ctx, {${content}});
|
19
|
+
};
|
20
|
+
document.addEventListener("DOMContentLoaded", chart);
|
21
|
+
utils.addEventListenerPjax(document, "pjax:complete", chart);
|
22
|
+
}()
|
23
|
+
</script>
|
24
|
+
</div>`;
|
25
|
+
}
|
26
|
+
|
27
|
+
hexo.extend.tag.register('chart', chart, {ends: true})
|
package/scripts/tags/gallery.js
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* Typeit.js tag for Solitude theme
|
3
|
+
*/
|
4
|
+
|
5
|
+
'use strict'
|
6
|
+
|
7
|
+
const typeit = ([tag, options], content) => {
|
8
|
+
const id = Math.random().toString(36).substr(2, 9);
|
9
|
+
tag = tag || 'div';
|
10
|
+
return `
|
11
|
+
<div class="typeit">
|
12
|
+
<${tag} id="typeit-${id}"></${tag}>
|
13
|
+
<script>
|
14
|
+
!function() {
|
15
|
+
const typeit = () => {
|
16
|
+
const ctx = document.getElementById("typeit-${id}");
|
17
|
+
if (!ctx) return;
|
18
|
+
new TypeIt("#typeit-${id}", ${options})
|
19
|
+
.type("${content}")
|
20
|
+
.go();
|
21
|
+
}
|
22
|
+
document.addEventListener("DOMContentLoaded", typeit);
|
23
|
+
utils.addEventListenerPjax(document, "pjax:complete", typeit);
|
24
|
+
}()
|
25
|
+
</script>
|
26
|
+
</div>`
|
27
|
+
}
|
28
|
+
|
29
|
+
hexo.extend.tag.register('typeit', typeit, {ends: true})
|
@@ -99,7 +99,7 @@
|
|
99
99
|
line-height 2
|
100
100
|
box-shadow var(--efu-shadow-border)
|
101
101
|
|
102
|
-
img
|
102
|
+
img:not(.post_bg)
|
103
103
|
border-radius 12px
|
104
104
|
object-fit cover
|
105
105
|
display block
|
@@ -215,4 +215,4 @@ if hexo-config('mediumZoom')
|
|
215
215
|
z-index 10
|
216
216
|
|
217
217
|
.medium-zoom-image--opened
|
218
|
-
z-index 11
|
218
|
+
z-index 11
|
@@ -8,18 +8,7 @@
|
|
8
8
|
padding 0
|
9
9
|
|
10
10
|
if hexo-config('index_post_list.direction') == "column"
|
11
|
-
|
12
|
-
position relative
|
13
|
-
+minWidth1300()
|
14
|
-
display flex
|
15
|
-
flex-wrap wrap
|
16
|
-
gap .5rem
|
17
|
-
transition width .3s
|
18
|
-
|
19
|
-
+maxWidth768()
|
20
|
-
padding 0 1rem
|
21
|
-
|
22
|
-
> .recent-post-item
|
11
|
+
.recent-post-item
|
23
12
|
box-shadow var(--efu-shadow-light2black)
|
24
13
|
display flex
|
25
14
|
align-items center
|
@@ -230,6 +219,16 @@ if hexo-config('index_post_list.direction') == "column"
|
|
230
219
|
|
231
220
|
.sticky
|
232
221
|
color var(--efu-fontcolor)
|
222
|
+
#recent-posts
|
223
|
+
position relative
|
224
|
+
+minWidth1300()
|
225
|
+
display flex
|
226
|
+
flex-wrap wrap
|
227
|
+
gap .5rem
|
228
|
+
transition width .3s
|
229
|
+
|
230
|
+
+maxWidth768()
|
231
|
+
padding 0 1rem
|
233
232
|
|
234
233
|
if hexo-config('index_post_list.direction') == "column" && hexo-config('index_post_list.column') == 2
|
235
234
|
#recent-posts
|
@@ -249,23 +248,9 @@ if hexo-config('index_post_list.direction') == "column"
|
|
249
248
|
flex 1 1 33.3%
|
250
249
|
max-width 32.6%
|
251
250
|
box-shadow var(--efu-shadow-border)
|
252
|
-
|
253
|
-
else if hexo-config('index_post_list.direction') == "row"
|
254
|
-
#recent-posts
|
255
|
-
position relative
|
256
|
-
display flex
|
257
|
-
flex-wrap wrap
|
258
|
-
justify-content space-between
|
259
|
-
align-items flex-start
|
260
|
-
align-content flex-start
|
261
|
-
user-select none
|
262
|
-
gap .5rem
|
263
|
-
transition width .3s
|
264
251
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
> .recent-post-item
|
252
|
+
else if hexo-config('index_post_list.direction') == "row"
|
253
|
+
.recent-post-item
|
269
254
|
display flex
|
270
255
|
align-items center
|
271
256
|
animation slide-in .6s .4s backwards
|
@@ -473,4 +458,17 @@ else if hexo-config('index_post_list.direction') == "row"
|
|
473
458
|
margin 0 .4rem 0 0
|
474
459
|
|
475
460
|
.sticky
|
476
|
-
color var(--efu-fontcolor)
|
461
|
+
color var(--efu-fontcolor)
|
462
|
+
#recent-posts
|
463
|
+
position relative
|
464
|
+
display flex
|
465
|
+
flex-wrap wrap
|
466
|
+
justify-content space-between
|
467
|
+
align-items flex-start
|
468
|
+
align-content flex-start
|
469
|
+
user-select none
|
470
|
+
gap .5rem
|
471
|
+
transition width .3s
|
472
|
+
|
473
|
+
+maxWidth768()
|
474
|
+
padding 0 1rem
|
@@ -22,7 +22,7 @@
|
|
22
22
|
&::-webkit-scrollbar
|
23
23
|
display none
|
24
24
|
|
25
|
-
.
|
25
|
+
.top-post-group
|
26
26
|
display flex
|
27
27
|
flex-direction row
|
28
28
|
justify-content start
|
@@ -76,7 +76,7 @@
|
|
76
76
|
position relative
|
77
77
|
animation slide-in .6s .1s backwards
|
78
78
|
|
79
|
-
.
|
79
|
+
.top-post-item
|
80
80
|
display flex
|
81
81
|
flex-direction column
|
82
82
|
width calc(100% / 3 - 0.5rem)
|
@@ -100,7 +100,7 @@
|
|
100
100
|
width 200px
|
101
101
|
min-width 200px
|
102
102
|
|
103
|
-
&:hover .post_cover a .
|
103
|
+
&:hover .post_cover a .top-post-top-text
|
104
104
|
left 0
|
105
105
|
|
106
106
|
.post_cover
|
@@ -116,7 +116,7 @@
|
|
116
116
|
width 100%
|
117
117
|
background var(--efu-secondbg)
|
118
118
|
|
119
|
-
.
|
119
|
+
.top-post-top-text
|
120
120
|
position absolute
|
121
121
|
top 0
|
122
122
|
left -50px
|
@@ -132,7 +132,7 @@
|
|
132
132
|
if $language == 'en-US'
|
133
133
|
left -90px
|
134
134
|
|
135
|
-
/.
|
135
|
+
/.top-post-info
|
136
136
|
padding .3rem .5rem .3rem .5rem
|
137
137
|
transition .3s
|
138
138
|
|
package/source/js/main.js
CHANGED
@@ -666,7 +666,7 @@ window.refreshFn = () => {
|
|
666
666
|
runtime && sco.addRuntime();
|
667
667
|
[scrollFn, sidebarFn, sco.addPhotoFigcaption, sco.setTimeState, sco.tagPageActive, sco.categoriesBarActive, sco.listenToPageInputPress, sco.addNavBackgroundInit, sco.refreshWaterFall].forEach(fn => fn());
|
668
668
|
lazyload.enable && utils.lazyloadImg();
|
669
|
-
lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img)"));
|
669
|
+
lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img, .no-lightbox)"));
|
670
670
|
randomlink && randomLinksList();
|
671
671
|
post_ai && is_post && efu_ai.init();
|
672
672
|
sco.switchComments();
|
package/source/js/utils.js
CHANGED
@@ -101,12 +101,6 @@
|
|
101
101
|
},
|
102
102
|
isMobile: () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
|
103
103
|
isHidden: e => 0 === e.offsetHeight && 0 === e.offsetWidth,
|
104
|
-
addEventListenerPjax: (ele, event, fn, option = false) => {
|
105
|
-
ele.addEventListener(event, fn, option)
|
106
|
-
utils.addGlobalFn('pjax', () => {
|
107
|
-
ele.removeEventListener(event, fn, option)
|
108
|
-
})
|
109
|
-
},
|
110
104
|
animateIn: (ele, text) => {
|
111
105
|
Object.assign(ele.style, {display: 'block', animation: text});
|
112
106
|
},
|
@@ -205,4 +199,4 @@
|
|
205
199
|
},
|
206
200
|
}
|
207
201
|
window.utils = {...window.utils, ...utilsFn};
|
208
|
-
})()
|
202
|
+
})()
|