hexo-theme-solitude 1.7.3 → 1.7.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 +2 -0
- package/languages/en.yml +6 -9
- package/languages/zh-CN.yml +6 -9
- package/languages/zh-TW.yml +6 -9
- package/layout/includes/head/config.pug +6 -9
- package/layout/includes/inject/body.pug +0 -3
- package/layout/includes/inject/head.pug +1 -1
- package/layout/index.pug +6 -6
- package/package.json +1 -1
- package/scripts/event/cdn.js +1 -6
- package/scripts/event/merge_config.js +4 -3
- package/scripts/filter/default.js +1 -1
- package/source/css/_global/index.styl +3 -1
- package/source/css/_layout/article-container.styl +8 -1
- package/source/css/_layout/aside.styl +4 -1
- package/source/css/_page/_home/home.styl +8 -7
- package/source/css/_page/_home/recent-post.styl +4 -0
- package/source/js/main.js +61 -14
- package/source/js/utils.js +50 -9
package/_config.yml
CHANGED
@@ -164,6 +164,7 @@ aside:
|
|
164
164
|
page:
|
165
165
|
noSticky: "about"
|
166
166
|
Sticky: "newestPost,allInfo"
|
167
|
+
position: 0 # left(0): 左侧 / right(1): 右侧
|
167
168
|
# 侧边栏个人信息卡片
|
168
169
|
# Sidebar personal information
|
169
170
|
card:
|
@@ -708,6 +709,7 @@ comment:
|
|
708
709
|
commentBarrage: false # 热评开关 / Hot comment switch
|
709
710
|
lazyload: true # 懒加载
|
710
711
|
count: true # 评论数展示
|
712
|
+
avatar: https://cravatar.cn # Gravatar link
|
711
713
|
newest_comment:
|
712
714
|
enable: false
|
713
715
|
storage: 421000 # 缓存时间
|
package/languages/en.yml
CHANGED
@@ -16,15 +16,12 @@ copy_copyright:
|
|
16
16
|
source: Source
|
17
17
|
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
month:
|
25
|
-
year: ' year'
|
26
|
-
ago: ' ago'
|
27
|
-
error: ' NaN'
|
19
|
+
time:
|
20
|
+
day: " days ago"
|
21
|
+
hour: " hours ago"
|
22
|
+
just: "just"
|
23
|
+
min: " minutes ago"
|
24
|
+
month: " months ago"
|
28
25
|
|
29
26
|
page:
|
30
27
|
tag: Tags
|
package/languages/zh-CN.yml
CHANGED
@@ -17,15 +17,12 @@ copy_copyright:
|
|
17
17
|
source: 来源
|
18
18
|
info: 著作权归作者所有。 商业转载请联系作者获得授权,非商业转载请注明出处。
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
month:
|
26
|
-
year: 年
|
27
|
-
ago: 前
|
28
|
-
error: NaN
|
20
|
+
time:
|
21
|
+
day: "天前"
|
22
|
+
hour: "小时前"
|
23
|
+
just: "刚刚"
|
24
|
+
min: "分钟前"
|
25
|
+
month: "个月前"
|
29
26
|
|
30
27
|
page:
|
31
28
|
tag: 标签
|
package/languages/zh-TW.yml
CHANGED
@@ -17,15 +17,12 @@ copy_copyright:
|
|
17
17
|
source: 來源
|
18
18
|
info: 著作權歸作者所有。 商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
month:
|
26
|
-
year: 年
|
27
|
-
ago: 前
|
28
|
-
error: NaN
|
20
|
+
time:
|
21
|
+
day: "天前"
|
22
|
+
hour: "小時前"
|
23
|
+
just: "剛剛"
|
24
|
+
min: "分鐘前"
|
25
|
+
month: "個月前"
|
29
26
|
|
30
27
|
page:
|
31
28
|
tag: 標籤
|
@@ -97,15 +97,12 @@
|
|
97
97
|
error: _p('copy.error'),
|
98
98
|
},
|
99
99
|
backtop: _p('nav.backtop'),
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
month: _p('
|
106
|
-
year: _p('lately.year'),
|
107
|
-
ago: _p('lately.ago'),
|
108
|
-
error: _p('lately.error'),
|
100
|
+
time: {
|
101
|
+
day: _p('time.day'),
|
102
|
+
hour: _p('time.hour'),
|
103
|
+
just: _p('time.just'),
|
104
|
+
min: _p('time.min'),
|
105
|
+
month: _p('time.month')
|
109
106
|
},
|
110
107
|
f12: _p('f12'),
|
111
108
|
}
|
@@ -111,7 +111,7 @@ script.
|
|
111
111
|
)(window)
|
112
112
|
|
113
113
|
console.log(
|
114
|
-
"%c Program: Hexo %c Theme: Solitude %c Version: v1.7.
|
114
|
+
"%c Program: Hexo %c Theme: Solitude %c Version: v1.7.4",
|
115
115
|
"border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
|
116
116
|
"padding: 5px 10px;color:white;background:#3e9f50;",
|
117
117
|
"border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
|
package/layout/index.pug
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
extends includes/layout
|
2
2
|
|
3
3
|
block content
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
if theme.hometop.enable || theme.says.home_mini
|
5
|
+
#home_top
|
6
|
+
if theme.says.home_mini
|
7
|
+
include ./includes/widgets/home/bbTimeList
|
8
|
+
if theme.hometop.enable && is_home_first_page()
|
9
|
+
include ./includes/widgets/home/hometop
|
9
10
|
main.layout#content-inner
|
10
11
|
.recent-posts#recent-posts
|
11
12
|
#category-bar
|
@@ -15,6 +16,5 @@ block content
|
|
15
16
|
|
16
17
|
// pageination
|
17
18
|
include ./includes/mixins/pagination
|
18
|
-
|
19
19
|
// aside
|
20
20
|
include ./includes/widgets/aside/aside
|
package/package.json
CHANGED
package/scripts/event/cdn.js
CHANGED
@@ -83,12 +83,7 @@ hexo.extend.filter.register('before_generate', () => {
|
|
83
83
|
name: 'hexo-theme-solitude',
|
84
84
|
file: 'js/third_party/universe.min.js',
|
85
85
|
version
|
86
|
-
}
|
87
|
-
lately_js: {
|
88
|
-
name: 'hexo-theme-solitude',
|
89
|
-
file: 'js/third_party/lately.min.js',
|
90
|
-
version
|
91
|
-
},
|
86
|
+
}
|
92
87
|
}
|
93
88
|
|
94
89
|
const minFile = file => {
|
@@ -82,9 +82,10 @@ hexo.extend.filter.register('before_generate', () => {
|
|
82
82
|
comment: false,
|
83
83
|
}, award: {
|
84
84
|
enable: false,
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
appreciators: '/',
|
86
|
+
title: '感谢您的赞赏。',
|
87
|
+
desc: '因为有你们的支持,我才体会到写文章的价值。',
|
88
|
+
list: [],
|
88
89
|
}, rss: null, covercolor: {
|
89
90
|
enable: false, mode: 'local', api: 'https://api.qjqq.cn/api/Imgcolor?img=', time: 43200000,
|
90
91
|
}
|
@@ -10,7 +10,7 @@ hexo.extend.filter.register('after_post_render', function (data) {
|
|
10
10
|
data.cc = data.cc || copyright
|
11
11
|
data.cover = data.cover || cover[getRandomInt(0, cover?.length)]
|
12
12
|
data.excerpt = data.description || data.excerpt
|
13
|
-
data.toc = !!(config.aside.toc.post && data.toc !== false)
|
13
|
+
data.toc = !!(config.aside.toc.post && data.toc !== false)
|
14
14
|
}
|
15
15
|
if (data.layout === 'page') {
|
16
16
|
let {cover} = hexo.theme.config.page.default
|
@@ -389,7 +389,7 @@ i.solitude
|
|
389
389
|
+maxWidth1200()
|
390
390
|
width 100%
|
391
391
|
|
392
|
-
> div:first-child:not(.recent-posts)
|
392
|
+
> div:first-child:not(.recent-posts,.aside-content)
|
393
393
|
box-shadow var(--efu-shadow-border)
|
394
394
|
padding 1rem 2rem
|
395
395
|
border-radius 12px
|
@@ -398,6 +398,8 @@ i.solitude
|
|
398
398
|
align-self flex-start
|
399
399
|
animation slide-in .6s .1s backwards
|
400
400
|
position relative
|
401
|
+
if hexo-config('aside.position') == 0
|
402
|
+
order 2
|
401
403
|
|
402
404
|
+maxWidth768()
|
403
405
|
box-shadow none
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
if hexo-config('hometop.enable') || hexo-config('says.enable')
|
2
|
+
#home_top
|
3
|
+
max-width 1400px
|
4
|
+
margin .5rem auto auto
|
5
|
+
padding 0 1.5rem
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
+maxWidth768()
|
8
|
+
padding 0
|
9
|
+
margin-top 0
|
9
10
|
|
10
11
|
if hexo-config('hometop.enable')
|
11
12
|
@import "home-top.styl"
|
package/source/js/main.js
CHANGED
@@ -332,14 +332,17 @@ let sco = {
|
|
332
332
|
},
|
333
333
|
addRuntime: function () {
|
334
334
|
let el = document.getElementById('runtimeshow')
|
335
|
-
el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.
|
335
|
+
el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.day)
|
336
336
|
},
|
337
337
|
toTalk: function (txt) {
|
338
338
|
const inputs = ["#wl-edit", ".el-textarea__inner"]
|
339
339
|
for (let i = 0; i < inputs.length; i++) {
|
340
340
|
let el = document.querySelector(inputs[i])
|
341
341
|
if (el != null) {
|
342
|
-
el.dispatchEvent(new Event('input', {
|
342
|
+
el.dispatchEvent(new Event('input', {
|
343
|
+
bubble: true,
|
344
|
+
cancelable: true
|
345
|
+
}))
|
343
346
|
el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n'
|
344
347
|
utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
|
345
348
|
el.focus()
|
@@ -383,12 +386,31 @@ let sco = {
|
|
383
386
|
const timeNow = new Date();
|
384
387
|
const hours = timeNow.getHours();
|
385
388
|
const lang = GLOBAL_CONFIG.aside.sayhello;
|
386
|
-
const greetings = [
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
{
|
389
|
+
const greetings = [{
|
390
|
+
start: 0,
|
391
|
+
end: 5,
|
392
|
+
text: lang.goodnight
|
393
|
+
},
|
394
|
+
{
|
395
|
+
start: 6,
|
396
|
+
end: 10,
|
397
|
+
text: lang.morning
|
398
|
+
},
|
399
|
+
{
|
400
|
+
start: 11,
|
401
|
+
end: 14,
|
402
|
+
text: lang.noon
|
403
|
+
},
|
404
|
+
{
|
405
|
+
start: 15,
|
406
|
+
end: 18,
|
407
|
+
text: lang.afternoon
|
408
|
+
},
|
409
|
+
{
|
410
|
+
start: 19,
|
411
|
+
end: 24,
|
412
|
+
text: lang.night
|
413
|
+
},
|
392
414
|
];
|
393
415
|
for (let greeting of greetings) {
|
394
416
|
if (hours >= greeting.start && hours <= greeting.end) {
|
@@ -631,6 +653,13 @@ let sco = {
|
|
631
653
|
|
632
654
|
document.addEventListener('mouseover', debounce(showOwoBig, 100));
|
633
655
|
document.addEventListener('mouseout', hideOwoBig);
|
656
|
+
},
|
657
|
+
changeTimeFormat(selector) {
|
658
|
+
selector.forEach(item => {
|
659
|
+
const timeVal = item.getAttribute('datetime')
|
660
|
+
item.textContent = utils.diffDate(timeVal, true)
|
661
|
+
item.style.display = 'inline'
|
662
|
+
})
|
634
663
|
}
|
635
664
|
}
|
636
665
|
|
@@ -638,7 +667,12 @@ const addHighlight = () => {
|
|
638
667
|
const highlight = GLOBAL_CONFIG.highlight;
|
639
668
|
if (!highlight) return;
|
640
669
|
|
641
|
-
const {
|
670
|
+
const {
|
671
|
+
copy,
|
672
|
+
expand,
|
673
|
+
limit,
|
674
|
+
syntax
|
675
|
+
} = highlight;
|
642
676
|
const $isPrismjs = syntax === 'prismjs';
|
643
677
|
const $isShowTool = highlight.enable || copy || expand || limit;
|
644
678
|
const expandClass = !expand === true ? 'closed' : ''
|
@@ -722,7 +756,9 @@ const addHighlight = () => {
|
|
722
756
|
$syntaxHighlight.forEach(item => {
|
723
757
|
const langName = item.getAttribute('data-language') || 'Code'
|
724
758
|
const highlightLangEle = `<div class="code-lang">${langName}</div>`
|
725
|
-
utils.wrap(item, 'figure', {
|
759
|
+
utils.wrap(item, 'figure', {
|
760
|
+
class: 'highlight'
|
761
|
+
})
|
726
762
|
createEle(highlightLangEle, item)
|
727
763
|
})
|
728
764
|
} else {
|
@@ -737,7 +773,13 @@ const addHighlight = () => {
|
|
737
773
|
|
738
774
|
const addCopyright = () => {
|
739
775
|
if (!GLOBAL_CONFIG.copyright) return
|
740
|
-
const {
|
776
|
+
const {
|
777
|
+
limit,
|
778
|
+
author,
|
779
|
+
link,
|
780
|
+
source,
|
781
|
+
info
|
782
|
+
} = GLOBAL_CONFIG.copyright
|
741
783
|
const handleCopy = (e) => {
|
742
784
|
e.preventDefault()
|
743
785
|
const copyText = window.getSelection(0).toString()
|
@@ -792,11 +834,17 @@ class tabs {
|
|
792
834
|
}
|
793
835
|
|
794
836
|
window.refreshFn = () => {
|
837
|
+
if (PAGE_CONFIG.is_home) {
|
838
|
+
sco.changeTimeFormat(document.querySelectorAll('#recent-posts time'))
|
839
|
+
GLOBAL_CONFIG.runtime && sco.addRuntime()
|
840
|
+
} else {
|
841
|
+
sco.changeTimeFormat(document.querySelectorAll('#post-meta time'))
|
842
|
+
}
|
843
|
+
|
795
844
|
sco.initAdjust()
|
796
845
|
scrollFn()
|
797
846
|
sidebarFn()
|
798
847
|
initObserver()
|
799
|
-
sco.addRuntime()
|
800
848
|
sco.hideCookie()
|
801
849
|
sco.addPhotoFigcaption()
|
802
850
|
sco.setTimeState()
|
@@ -804,7 +852,6 @@ window.refreshFn = () => {
|
|
804
852
|
sco.categoriesBarActive()
|
805
853
|
sco.listenToPageInputPress()
|
806
854
|
sco.addNavBackgroundInit()
|
807
|
-
utils.changeTimeFormat()
|
808
855
|
GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg()
|
809
856
|
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar)"))
|
810
857
|
GLOBAL_CONFIG.randomlink && randomLinksList()
|
@@ -830,4 +877,4 @@ window.onkeydown = function (e) {
|
|
830
877
|
(27 === e.keyCode) && sco.hideConsole();
|
831
878
|
}
|
832
879
|
|
833
|
-
document.addEventListener('copy', () => utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success,false,3e3))
|
880
|
+
document.addEventListener('copy', () => utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success, false, 3e3))
|
package/source/js/utils.js
CHANGED
@@ -72,7 +72,10 @@ const utils = {
|
|
72
72
|
const dur = (typeof duration !== 'undefined') ? duration : 5000
|
73
73
|
document.styleSheets[0].addRule(':root', '--efu-snackbar-time:' + dur + 'ms!important')
|
74
74
|
Snackbar.show({
|
75
|
-
text: text,
|
75
|
+
text: text,
|
76
|
+
showAction: sa,
|
77
|
+
duration: dur,
|
78
|
+
pos: 'top-center'
|
76
79
|
})
|
77
80
|
},
|
78
81
|
|
@@ -109,7 +112,8 @@ const utils = {
|
|
109
112
|
if (currentPos > pos || isNavFixed) pos = pos - 70
|
110
113
|
if ('scrollBehavior' in document.documentElement.style) {
|
111
114
|
window.scrollTo({
|
112
|
-
top: pos,
|
115
|
+
top: pos,
|
116
|
+
behavior: 'smooth'
|
113
117
|
})
|
114
118
|
return
|
115
119
|
}
|
@@ -175,7 +179,10 @@ const utils = {
|
|
175
179
|
},
|
176
180
|
lazyloadImg: function () {
|
177
181
|
window.lazyLoadInstance = new LazyLoad({
|
178
|
-
elements_selector: 'img',
|
182
|
+
elements_selector: 'img',
|
183
|
+
threshold: 0,
|
184
|
+
data_src: 'lazy-src',
|
185
|
+
callback_error: (img) => {
|
179
186
|
img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
|
180
187
|
}
|
181
188
|
})
|
@@ -184,7 +191,9 @@ const utils = {
|
|
184
191
|
const lightbox = GLOBAL_CONFIG.lightbox
|
185
192
|
|
186
193
|
if (lightbox === 'mediumZoom' && mediumZoom) {
|
187
|
-
mediumZoom(selector, {
|
194
|
+
mediumZoom(selector, {
|
195
|
+
background: "var(--efu-card-bg)"
|
196
|
+
});
|
188
197
|
}
|
189
198
|
|
190
199
|
if (lightbox === 'fancybox') {
|
@@ -204,15 +213,19 @@ const utils = {
|
|
204
213
|
|
205
214
|
if (!window.fancyboxRun) {
|
206
215
|
Fancybox.bind('[data-fancybox]', {
|
207
|
-
Hash: false,
|
216
|
+
Hash: false,
|
217
|
+
Thumbs: {
|
208
218
|
showOnStart: false
|
209
|
-
},
|
219
|
+
},
|
220
|
+
Images: {
|
210
221
|
Panzoom: {
|
211
222
|
maxScale: 4
|
212
223
|
}
|
213
|
-
},
|
224
|
+
},
|
225
|
+
Carousel: {
|
214
226
|
transition: 'slide'
|
215
|
-
},
|
227
|
+
},
|
228
|
+
Toolbar: {
|
216
229
|
display: {
|
217
230
|
left: ['infobar'],
|
218
231
|
middle: ['zoomIn', 'zoomOut', 'toggle1to1', 'rotateCCW', 'rotateCW', 'flipX', 'flipY'],
|
@@ -230,6 +243,32 @@ const utils = {
|
|
230
243
|
lang: GLOBAL_CONFIG.lang.lately,
|
231
244
|
})
|
232
245
|
},
|
246
|
+
diffDate: (d, more = false) => {
|
247
|
+
const dateNow = new Date()
|
248
|
+
const datePost = new Date(d)
|
249
|
+
const dateDiff = dateNow.getTime() - datePost.getTime()
|
250
|
+
const minute = 1000 * 60
|
251
|
+
const hour = minute * 60
|
252
|
+
const day = hour * 24
|
253
|
+
const month = day * 30
|
254
|
+
const {
|
255
|
+
time
|
256
|
+
} = GLOBAL_CONFIG.lang
|
257
|
+
|
258
|
+
if (!more) return parseInt(dateDiff / day)
|
259
|
+
|
260
|
+
const monthCount = dateDiff / month
|
261
|
+
const dayCount = dateDiff / day
|
262
|
+
const hourCount = dateDiff / hour
|
263
|
+
const minuteCount = dateDiff / minute
|
264
|
+
|
265
|
+
if (monthCount > 12) return datePost.toISOString().slice(0, 10)
|
266
|
+
if (monthCount >= 1) return `${parseInt(monthCount)} ${time.month}`
|
267
|
+
if (dayCount >= 1) return `${parseInt(dayCount)} ${time.day}`
|
268
|
+
if (hourCount >= 1) return `${parseInt(hourCount)} ${time.hour}`
|
269
|
+
if (minuteCount >= 1) return `${parseInt(minuteCount)} ${time.min}`
|
270
|
+
return time.just
|
271
|
+
},
|
233
272
|
loadComment: (dom, callback) => {
|
234
273
|
if ('IntersectionObserver' in window) {
|
235
274
|
const observerItem = new IntersectionObserver((entries) => {
|
@@ -237,7 +276,9 @@ const utils = {
|
|
237
276
|
callback()
|
238
277
|
observerItem.disconnect()
|
239
278
|
}
|
240
|
-
}, {
|
279
|
+
}, {
|
280
|
+
threshold: [0]
|
281
|
+
})
|
241
282
|
observerItem.observe(dom)
|
242
283
|
} else {
|
243
284
|
callback()
|