hexo-theme-solitude 1.4.6 → 1.4.7
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 +211 -215
- package/languages/en-US.yml +5 -2
- package/languages/zh-CN.yml +5 -2
- package/languages/zh-TW.yml +5 -2
- package/layout/404.pug +2 -2
- package/layout/includes/head/config.pug +7 -7
- package/layout/includes/head/opengraph.pug +5 -4
- package/layout/includes/head/pwa.pug +2 -3
- package/layout/includes/inject/body.pug +17 -17
- package/layout/includes/inject/head.pug +3 -2
- package/layout/includes/mixins/pagination.pug +1 -1
- package/layout/includes/page/says.pug +44 -7
- package/layout/includes/widgets/home/bbTimeList.pug +13 -7
- package/layout/includes/widgets/page/banner.pug +8 -13
- package/layout/page.pug +0 -2
- package/package.json +1 -1
- package/scripts/event/init.js +18 -17
- package/scripts/event/welcome.js +1 -1
- package/scripts/generator/gallery.js +29 -27
- package/scripts/helper/getArchiveLength.js +5 -9
- package/scripts/helper/related_post.js +28 -39
- package/scripts/helper/stylus.js +5 -9
- package/source/css/_global/animation.styl +307 -0
- package/source/css/_page/index.styl +0 -2
- package/source/css/index.styl +0 -1
- package/source/js/comment/twikoo_commentBarrage.js +76 -75
- package/source/js/covercolor/local.js +11 -10
- package/source/js/music.js +89 -49
- package/layout/includes/page/rss.pug +0 -20
- package/layout/includes/widgets/home/bb/json.pug +0 -25
- package/layout/includes/widgets/home/bb/local.pug +0 -20
- package/layout/includes/widgets/home/bb/memos.pug +0 -28
- package/layout/includes/widgets/page/says/json.pug +0 -82
- package/layout/includes/widgets/page/says/local.pug +0 -44
- package/layout/includes/widgets/page/says/memos.pug +0 -111
- package/source/css/_global/animation.css +0 -813
- package/source/css/_page/rss.styl +0 -82
@@ -7,7 +7,7 @@
|
|
7
7
|
localSearch = JSON.stringify({
|
8
8
|
preload: theme.search.local.preload,
|
9
9
|
path: theme?.search?.local?.CDN || '/search.xml'
|
10
|
-
})
|
10
|
+
});
|
11
11
|
break;
|
12
12
|
case 'algolia':
|
13
13
|
algolia = JSON.stringify({
|
@@ -17,7 +17,7 @@
|
|
17
17
|
hits: {
|
18
18
|
per_page: theme?.search?.algolia?.hits?.per_page || 10
|
19
19
|
}
|
20
|
-
})
|
20
|
+
});
|
21
21
|
break;
|
22
22
|
}
|
23
23
|
}
|
@@ -27,12 +27,12 @@
|
|
27
27
|
translate = JSON.stringify({
|
28
28
|
defaultEncoding: theme.translate.defaultEncoding,
|
29
29
|
translateDelay: theme.translate.translateDelay,
|
30
|
-
})
|
30
|
+
});
|
31
31
|
}
|
32
32
|
|
33
|
-
const commentInfoStart = theme.comment.randomInfoStart.map(item => `"${item}"`) ||
|
34
|
-
const commentInfoEnd = theme.comment.randomInfoEnd.map(item => `"${item}"`) ||
|
35
|
-
|
33
|
+
const commentInfoStart = theme.comment.randomInfoStart.map(item => `"${item}"`) || [];
|
34
|
+
const commentInfoEnd = theme.comment.randomInfoEnd.map(item => `"${item}"`) || [];
|
35
|
+
const sayhello2 = theme.aside.card.sayhello2.map(item => `"${item}"`) || [];
|
36
36
|
|
37
37
|
script.
|
38
38
|
const GLOBAL_CONFIG = {
|
@@ -119,4 +119,4 @@ script.
|
|
119
119
|
enable: !{theme.music.enable},
|
120
120
|
},
|
121
121
|
translate: !{translate},
|
122
|
-
}
|
122
|
+
};
|
@@ -1,10 +1,11 @@
|
|
1
1
|
if theme.opengraph.enable
|
2
2
|
-
|
3
3
|
const coverVal = page.cover || theme.site.siteIcon
|
4
|
-
let ogOption =
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
let ogOption = {
|
5
|
+
type: is_post() ? 'article' : 'website',
|
6
|
+
image: coverVal ? full_url_for(coverVal) : '',
|
7
|
+
...theme.opengraph.options
|
8
|
+
}
|
8
9
|
-
|
9
10
|
!= open_graph(ogOption)
|
10
11
|
else
|
@@ -1,11 +1,11 @@
|
|
1
1
|
if theme.pwa.enable
|
2
2
|
meta(name="theme-color", content=theme.pwa.theme_color)
|
3
3
|
link(rel="manifest" href=url_for(theme.pwa.manifest))
|
4
|
-
if
|
4
|
+
if theme.pwa.theme_color
|
5
5
|
meta(name="msapplication-TileColor" content=theme.pwa.theme_color)
|
6
6
|
if theme.pwa.mask_icon
|
7
7
|
link(rel="mask-icon", href=theme.pwa.mask_icon, color=theme.pwa.theme_color)
|
8
|
-
if
|
8
|
+
if theme.pwa.apple_touch_icon
|
9
9
|
link(rel="apple-touch-icon" sizes="180x180" href=url_for(theme.pwa.apple_touch_icon))
|
10
10
|
if theme.pwa.favicon_16_16
|
11
11
|
link(rel="icon", type="image/png", sizes="16x16", href=theme.pwa.favicon_16_16)
|
@@ -13,7 +13,6 @@ if theme.pwa.enable
|
|
13
13
|
link(rel="icon", type="image/png", sizes="32x32", href=theme.pwa.favicon_32_32)
|
14
14
|
if theme.pwa.bookmark_icon
|
15
15
|
link(rel="bookmark", href=theme.pwa.bookmark_icon)
|
16
|
-
|
17
16
|
else
|
18
17
|
meta(name="apple-mobile-web-app-capable", content=config.title)
|
19
18
|
link(rel="bookmark", href=theme.site.siteIcon)
|
@@ -1,5 +1,15 @@
|
|
1
1
|
- page.type = is_post() ? 'post' : page.type
|
2
2
|
|
3
|
+
mixin katex
|
4
|
+
if theme.katex.copytex
|
5
|
+
script(src=url_for(theme.cdn.katex_copytex))
|
6
|
+
script.
|
7
|
+
(() => {
|
8
|
+
document.querySelectorAll('#article-container span.katex-display').forEach(item => {
|
9
|
+
utils.wrap(item, 'div', {class: 'katex-wrap'})
|
10
|
+
})
|
11
|
+
})();
|
12
|
+
|
3
13
|
div
|
4
14
|
script(src=url_for(theme.cdn.main))
|
5
15
|
script(src=url_for(theme.cdn.utils))
|
@@ -19,24 +29,11 @@ div
|
|
19
29
|
if theme.translate.enable
|
20
30
|
script(src=url_for(theme.cdn.translate))
|
21
31
|
|
22
|
-
mixin katex
|
23
|
-
link(rel="stylesheet", href=url_for(theme.cdn.katex))
|
24
|
-
if theme.katex.copytex
|
25
|
-
script(src=url_for(theme.cdn.katex_copytex))
|
26
|
-
script.
|
27
|
-
(() => {
|
28
|
-
document.querySelectorAll('#article-container span.katex-display').forEach(item => {
|
29
|
-
utils.wrap(item, 'div', {class: 'katex-wrap'})
|
30
|
-
})
|
31
|
-
})()
|
32
|
-
|
33
32
|
if theme.katex && theme.katex.enable
|
34
|
-
if theme.katex.per_page
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if page.katex
|
39
|
-
+katex
|
33
|
+
if theme.katex.per_page && (is_post() || is_page())
|
34
|
+
+katex
|
35
|
+
else if page.katex
|
36
|
+
+katex
|
40
37
|
|
41
38
|
script(src=url_for(theme.cdn.pjax))
|
42
39
|
if theme.lazyload.enable
|
@@ -111,6 +108,9 @@ div#js-pjax
|
|
111
108
|
if page.type === 'album' && theme.album.enable
|
112
109
|
script.
|
113
110
|
initGallery()
|
111
|
+
if is_home() && theme.says.home_mini
|
112
|
+
script.
|
113
|
+
sco.initbbtalk();
|
114
114
|
if page.type === 'says' && theme.says.enable
|
115
115
|
script.
|
116
116
|
window.addEventListener('resize', utils.throttle(function () {
|
@@ -15,6 +15,9 @@ if theme.says.home_mini
|
|
15
15
|
if theme.lightbox && theme.fancybox
|
16
16
|
link(rel="stylesheet", href=url_for(theme.cdn.fancyapps_css))
|
17
17
|
|
18
|
+
if theme.katex && theme.katex.enable
|
19
|
+
link(rel="stylesheet", href=url_for(theme.cdn.katex))
|
20
|
+
|
18
21
|
// Open Graph
|
19
22
|
include ../head/opengraph.pug
|
20
23
|
|
@@ -78,8 +81,6 @@ script.
|
|
78
81
|
"%c🔥 !{_p('head.console')}",
|
79
82
|
"color: #fff; background: linear-gradient(-25deg, #a8edea, #fed6e3); padding: 8px 15px; border-radius: 8px; text-shadow: 2px 2px 4px white; color: black;"
|
80
83
|
);
|
81
|
-
|
82
|
-
// custom inject
|
83
84
|
if theme.extends.head
|
84
85
|
each item in theme.extends.head
|
85
86
|
!= item
|
@@ -3,6 +3,6 @@ nav#pagination
|
|
3
3
|
- var options = {mid_size: 1,escape: false,next_text: '<div class="pagination_tips_next">下页</div> <i class="scoicon sco-arrow-right-bold"></i>',prev_text: '<i class="scoicon sco-arrow-left-bold"></i> <div class="pagination_tips_prev">上页</div>'}
|
4
4
|
!=paginator(options)
|
5
5
|
div.toPageGroup
|
6
|
-
input#toPageText(oninput="value=value.replace(/[^0-9]/g,'')"
|
6
|
+
input#toPageText(oninput="value=value.replace(/[^0-9]/g,'')" maxlength="3" title="跳转到指定页面" onkeyup="if (this.value === '0') this.value = ''")
|
7
7
|
a#toPageButton(onclick="sco.toPage()")
|
8
8
|
i.scoicon.sco-show-right-line
|
@@ -3,13 +3,50 @@ if theme.says.enable
|
|
3
3
|
#bber
|
4
4
|
section.timeline.page-1
|
5
5
|
ul.list#waterfall
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
each item in site.data.essay.essay_list.slice(0, theme.says.strip)
|
7
|
+
li.item
|
8
|
+
if theme.says.style === 2
|
9
|
+
.meta
|
10
|
+
img.avatar(src=theme.aside.card.author.img)
|
11
|
+
.info
|
12
|
+
span.bber_nick= config.author
|
13
|
+
time.datetime.bber_date(datetime=moment(item.date).format())
|
14
|
+
if item.content
|
15
|
+
a.bber-reply.goComment(onclick=`sco.toTalk('${item.content}')`)
|
16
|
+
i.scoicon.sco-chat-fill
|
17
|
+
|
18
|
+
#bber-content
|
19
|
+
p.datacont= item.content
|
20
|
+
if item.image
|
21
|
+
.bber-content-img
|
22
|
+
each img in item.image
|
23
|
+
img(src=img title="即刻短文配图")
|
24
|
+
|
25
|
+
if item.aplayer
|
26
|
+
.bber-music
|
27
|
+
meting-js(server=item.aplayer.server type="song" id=item.aplayer.id mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0")
|
28
|
+
|
29
|
+
if item.video
|
30
|
+
.bber-video
|
31
|
+
if item.video.player
|
32
|
+
video(src=item.video.player controls="controls" style="object-fit: cover;")
|
33
|
+
if item.video.bilibili
|
34
|
+
iframe(src='//player.bilibili.com/player.html?auto-play=0&bvid=' + item.video.bilibili scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true")
|
35
|
+
|
36
|
+
if theme.says.style === 1
|
37
|
+
hr
|
38
|
+
.bber-bottom
|
39
|
+
.bber-info
|
40
|
+
.bber-info-time
|
41
|
+
i.scoicon.sco-calendar-todo-fill
|
42
|
+
time.datetime(datetime=moment(item.date).format())
|
43
|
+
if item.link
|
44
|
+
a.bber-content-link(href=url_for(item.link) title="跳转到短文指引的链接" target="_blank")
|
45
|
+
i.scoicon.sco-link-m-line
|
46
|
+
| 链接
|
47
|
+
if item.content
|
48
|
+
a.bber-reply(onclick=`sco.toTalk('${item.content}')`)
|
49
|
+
i.scoicon.sco-chat-fill
|
13
50
|
#bber-tips
|
14
51
|
if theme.says.strip === -1
|
15
52
|
| - 已展开所有短文 -
|
@@ -2,11 +2,17 @@
|
|
2
2
|
i.bber-logo.scoicon.sco-bblogo(onclick=`pjax.loadUrl('/essay/')`)
|
3
3
|
.swiper-container.swiper-no-swiping.swiper-container-initialized.swiper-container-vertical.swiper-container-pointer-events#bbtalk(tabindex="-1" onclick=`pjax.loadUrl('/essay/')`)
|
4
4
|
.swiper-wrapper#bber-talk
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
each item, i in site.data.essay.essay_list.slice(0, 10)
|
6
|
+
.li-style.swiper-slide
|
7
|
+
| #{item.content}
|
8
|
+
if item.image
|
9
|
+
i.scoicon.sco-image-fill
|
10
|
+
else if item.aplayer
|
11
|
+
i.scoicon.sco-disc-fill
|
12
|
+
else if item.video
|
13
|
+
i.scoicon.sco-video-fill
|
14
|
+
else if item.bilibili
|
15
|
+
i.scoicon.sco-bilibili-line
|
16
|
+
else if item.link
|
17
|
+
i.scoicon.sco-links
|
12
18
|
i.bber-gotobb.scoicon.sco-right-btn-fill(title=_p('home.bbtime.text') onclick=`pjax.loadUrl('/essay/')`)
|
@@ -3,18 +3,13 @@
|
|
3
3
|
.author-content-item-tips= page.title
|
4
4
|
span.author-content-item-title= page.desc
|
5
5
|
.content-bottom
|
6
|
-
if
|
7
|
-
.tips
|
8
|
-
if
|
9
|
-
.tips
|
6
|
+
if page.leftend
|
7
|
+
.tips= page.leftend
|
8
|
+
if page.rightend
|
9
|
+
.tips= page.rightend
|
10
10
|
if page.rightbtn
|
11
11
|
.banner-button-group
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
span.banner-button-text= page.rightbtn
|
17
|
-
when false
|
18
|
-
a.banner-button(href=page.rightbtnlink, target="_blank")
|
19
|
-
i.scoicon.sco-right-btn-fill
|
20
|
-
span.banner-button-text= page.rightbtn
|
12
|
+
- const isInternalLink = page.rightbtnlink.startsWith('/')
|
13
|
+
a.banner-button(onclick=isInternalLink ? `pjax.loadUrl("${page.rightbtnlink}")` : null, href=isInternalLink ? null : page.rightbtnlink, target=isInternalLink ? null : "_blank")
|
14
|
+
i.scoicon.sco-right-btn-fill
|
15
|
+
span.banner-button-text= page.rightbtn
|
package/layout/page.pug
CHANGED
package/package.json
CHANGED
package/scripts/event/init.js
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
hexo.extend.filter.register('before_generate', () => {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1');
|
3
|
+
const nodeVer = process.version.replace(/^v/, '');
|
4
|
+
const [majorVer] = nodeVer.split('.');
|
5
|
+
const logger = hexo.log;
|
6
|
+
const config = hexo.config;
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if (hexoVer < 6.3) {
|
9
|
+
logger.error('请把 Hexo 升级到 V6.3.0 或更高的版本!');
|
10
|
+
process.exit(-1);
|
11
|
+
}
|
12
|
+
|
13
|
+
if (config.prismjs.enable) {
|
14
|
+
logger.error('主题尚未支持 prismjs 请使用 highlightjs !');
|
15
|
+
process.exit(-1);
|
16
|
+
}
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
if (Number(majorVer) < 14) {
|
17
|
-
logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!');
|
18
|
-
process.exit(-1);
|
19
|
-
}
|
18
|
+
if (Number(majorVer) < 14) {
|
19
|
+
logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!');
|
20
|
+
process.exit(-1);
|
20
21
|
}
|
21
|
-
)
|
22
|
+
});
|
package/scripts/event/welcome.js
CHANGED
@@ -9,6 +9,6 @@ hexo.on('ready', () => {
|
|
9
9
|
###### #### ##### ##### # ### ###### ######
|
10
10
|
${version}
|
11
11
|
===================================================================
|
12
|
-
|
12
|
+
GitHub: https://github.com/wleelw/hexo-theme-solitude
|
13
13
|
`)
|
14
14
|
})
|
@@ -6,20 +6,23 @@ hexo.extend.generator.register('gallery', function (locals) {
|
|
6
6
|
if (!hexo.theme.config.album.enable) return;
|
7
7
|
const album = locals.data.gallery.gallery;
|
8
8
|
if (!album) return;
|
9
|
+
const { url, cover, comment, title, album_list, descr, rightbtn, rightbtnlink } = album;
|
9
10
|
return {
|
10
|
-
path:
|
11
|
-
|
12
|
-
|
11
|
+
path: `${url}/index.html`,
|
12
|
+
layout: ['page'],
|
13
|
+
data: {
|
14
|
+
url,
|
15
|
+
cover,
|
13
16
|
type: 'gallery',
|
14
|
-
comment
|
15
|
-
desc:
|
16
|
-
title
|
17
|
-
album:
|
18
|
-
leftend:
|
19
|
-
rightbtn
|
20
|
-
rightbtnlink
|
17
|
+
comment,
|
18
|
+
desc: title,
|
19
|
+
title,
|
20
|
+
album: album_list,
|
21
|
+
leftend: descr,
|
22
|
+
rightbtn,
|
23
|
+
rightbtnlink
|
21
24
|
}
|
22
|
-
}
|
25
|
+
};
|
23
26
|
});
|
24
27
|
|
25
28
|
hexo.extend.generator.register('album', function (locals) {
|
@@ -27,21 +30,20 @@ hexo.extend.generator.register('album', function (locals) {
|
|
27
30
|
const album = locals.data.gallery.gallery;
|
28
31
|
let back = hexo.config.language === 'zh-CN' ? '返回相册' : hexo.config.language === 'zh-TW' ? '返回相冊' : 'Back to Album';
|
29
32
|
if (!album) return;
|
30
|
-
const albumPages =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
});
|
33
|
+
const albumPages = album.album_list.map(item => ({
|
34
|
+
path: `${album.url}/${item.album}/index.html`,
|
35
|
+
layout: ['page'],
|
36
|
+
data: {
|
37
|
+
album: item,
|
38
|
+
type: 'album',
|
39
|
+
cover: item.cover,
|
40
|
+
title: item.class_name,
|
41
|
+
desc: item.class_name,
|
42
|
+
leftend: item.descr,
|
43
|
+
rightbtn: back,
|
44
|
+
rightbtnlink: `/${album.url}/`,
|
45
|
+
comment: item.comment
|
46
|
+
}
|
47
|
+
}));
|
46
48
|
return albumPages;
|
47
49
|
});
|
@@ -6,13 +6,9 @@ hexo.extend.helper.register('getArchiveLength', function (type) {
|
|
6
6
|
}
|
7
7
|
const posts = this.site.posts.sort('-date').data
|
8
8
|
let archive = {}
|
9
|
-
|
9
|
+
for (const post of posts) {
|
10
10
|
const postdate = type === 'year' ? moment(post.date).format('YYYY') : moment(post.date).format('YYYY/MM');
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
});
|
17
|
-
return archive
|
18
|
-
});
|
11
|
+
archive[postdate] = (archive[postdate] || 0) + 1;
|
12
|
+
}
|
13
|
+
return archive;
|
14
|
+
});
|
@@ -1,10 +1,15 @@
|
|
1
1
|
'use strict'
|
2
2
|
|
3
3
|
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
4
|
-
|
4
|
+
const relatedPosts = []
|
5
|
+
const config = hexo.theme.config
|
6
|
+
const limitNum = config.related_post.limit || 6
|
7
|
+
const dateType = config.related_post.date_type || 'created'
|
8
|
+
const headlineLang = this._p('喜欢这篇的人也看了')
|
9
|
+
|
5
10
|
currentPost.tags.forEach(function (tag) {
|
6
11
|
allPosts.forEach(function (post) {
|
7
|
-
if (isTagRelated(tag.name, post.tags)) {
|
12
|
+
if (isTagRelated(tag.name, post.tags) && currentPost.path !== post.path) {
|
8
13
|
const relatedPost = {
|
9
14
|
title: post.title,
|
10
15
|
path: post.path,
|
@@ -18,61 +23,45 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
|
18
23
|
if (index !== -1) {
|
19
24
|
relatedPosts[index].weight += 1
|
20
25
|
} else {
|
21
|
-
|
22
|
-
relatedPosts.push(relatedPost)
|
23
|
-
}
|
26
|
+
relatedPosts.push(relatedPost)
|
24
27
|
}
|
25
28
|
}
|
26
29
|
})
|
27
30
|
})
|
31
|
+
|
28
32
|
if (relatedPosts.length === 0) {
|
29
33
|
return ''
|
30
34
|
}
|
31
|
-
let result = ''
|
32
|
-
const config = hexo.theme.config
|
33
|
-
|
34
|
-
const limitNum = config.related_post.limit || 6
|
35
|
-
const dateType = config.related_post.date_type || 'created'
|
36
|
-
const headlineLang = this._p('喜欢这篇的人也看了')
|
37
|
-
|
38
|
-
relatedPosts = relatedPosts.sort(compare('weight', dateType))
|
39
35
|
|
40
|
-
|
41
|
-
result += '<div class="relatedPosts">'
|
42
|
-
result += `<div class="headline"><i class="scoicon sco-star-smile-fill"></i><span>${headlineLang}</span><div class="relatedPosts-link"><a onclick="event.preventDefault(); toRandomPost();" href="javascript:void(0);" rel="external nofollow" data-pjax-state="">随便逛逛</a></div></div>`
|
43
|
-
result += '<div class="relatedPosts-list">'
|
36
|
+
relatedPosts.sort(compare('weight', dateType))
|
44
37
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
result += `<div><a href="${this.url_for(relatedPosts[i].path)}" title="${title}">`
|
49
|
-
result += `<img class="cover" src="${this.url_for(cover)}" alt="cover">`
|
50
|
-
result += `<div class="content is-center"><div class="title">${title}</div></div>`
|
51
|
-
result += '</a></div>'
|
52
|
-
}
|
38
|
+
let result = '<div class="relatedPosts">'
|
39
|
+
result += `<div class="headline"><i class="scoicon sco-star-smile-fill"></i><span>${headlineLang}</span><div class="relatedPosts-link"><a onclick="event.preventDefault(); toRandomPost();" href="javascript:void(0);" rel="external nofollow" data-pjax-state="">随便逛逛</a></div></div>`
|
40
|
+
result += '<div class="relatedPosts-list">'
|
53
41
|
|
54
|
-
|
55
|
-
|
42
|
+
for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
|
43
|
+
const cover = relatedPosts[i].cover || 'var(--default-bg-color)'
|
44
|
+
const title = this.escape_html(relatedPosts[i].title)
|
45
|
+
result += `<div><a href="${this.url_for(relatedPosts[i].path)}" title="${title}">`
|
46
|
+
result += `<img class="cover" src="${this.url_for(cover)}" alt="cover">`
|
47
|
+
result += `<div class="content is-center"><div class="title">${title}</div></div>`
|
48
|
+
result += '</a></div>'
|
56
49
|
}
|
50
|
+
|
51
|
+
result += '</div></div>'
|
52
|
+
return result
|
57
53
|
})
|
58
54
|
|
59
55
|
function isTagRelated(tagName, TBDtags) {
|
60
|
-
|
61
|
-
|
62
|
-
if (tagName === tag.name) {
|
63
|
-
result = true
|
64
|
-
}
|
56
|
+
return TBDtags.some(function (tag) {
|
57
|
+
return tagName === tag.name
|
65
58
|
})
|
66
|
-
return result
|
67
59
|
}
|
68
60
|
|
69
61
|
function findItem(arrayToSearch, attr, val) {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
}
|
75
|
-
return -1
|
62
|
+
return arrayToSearch.findIndex(function (item) {
|
63
|
+
return item[attr] === val
|
64
|
+
})
|
76
65
|
}
|
77
66
|
|
78
67
|
function compare(attr, dateType) {
|
package/scripts/helper/stylus.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
hexo.extend.filter.register('stylus:renderer', function (style) {
|
2
|
-
const {config, theme} = this
|
2
|
+
const {config, theme} = this;
|
3
3
|
const data = hexo.locals.get('data');
|
4
4
|
|
5
5
|
if (theme.config.aside.tags.highlight) {
|
6
|
-
|
6
|
+
const array = theme.config.aside.tags.list.map(item => encodeURIComponent(item));
|
7
7
|
style.define('highlightTags', array);
|
8
8
|
}
|
9
9
|
|
10
|
-
|
10
|
+
const aside = [
|
11
11
|
theme.config.aside.home.noSticky,
|
12
12
|
theme.config.aside.home.Sticky,
|
13
13
|
theme.config.aside.post.noSticky,
|
@@ -15,14 +15,10 @@ hexo.extend.filter.register('stylus:renderer', function (style) {
|
|
15
15
|
theme.config.aside.page.Sticky,
|
16
16
|
theme.config.aside.page.noSticky
|
17
17
|
].join(',').split(',');
|
18
|
-
|
18
|
+
const uniqueArr = [...new Set(aside)];
|
19
19
|
if (uniqueArr.length > 0) {
|
20
20
|
style.define('aside', uniqueArr);
|
21
21
|
}
|
22
22
|
|
23
|
-
|
24
|
-
style.define('about', Object.keys(data.about));
|
25
|
-
} else {
|
26
|
-
style.define('about', []);
|
27
|
-
}
|
23
|
+
style.define('about', data && data.about ? Object.keys(data.about) : []);
|
28
24
|
});
|