hexo-theme-solitude 1.3.1 → 1.4.0
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/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +107 -0
- package/.github/ISSUE_TEMPLATE/config.yml +13 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +14 -0
- package/.github/workflows/npm-publish.yml +21 -0
- package/CONTRIBUTING.md +0 -0
- package/LICENSE +0 -0
- package/README.md +60 -43
- package/README_EN.md +60 -42
- package/_config.yml +606 -451
- package/languages/en-US.yml +3 -23
- package/languages/zh-CN.yml +3 -23
- package/layout/404.pug +0 -0
- package/layout/archive.pug +0 -0
- package/layout/category.pug +0 -0
- package/layout/includes/body/mode.pug +1 -6
- package/layout/includes/console.pug +3 -3
- package/layout/includes/footer.pug +16 -15
- package/layout/includes/head/config.pug +38 -30
- package/layout/includes/head/opengraph.pug +0 -0
- package/layout/includes/head/pwa.pug +5 -44
- package/layout/includes/head.pug +3 -1
- package/layout/includes/header.pug +0 -0
- package/layout/includes/inject/body.pug +114 -65
- package/layout/includes/inject/head.pug +11 -46
- package/layout/includes/layout.pug +1 -2
- package/layout/includes/loading.pug +0 -0
- package/layout/includes/mixins/articleSort.pug +0 -0
- package/layout/includes/mixins/pagination.pug +0 -0
- package/layout/includes/nav.pug +1 -1
- package/layout/includes/page/about.pug +1 -1
- package/layout/includes/page/categories.pug +0 -0
- package/layout/includes/page/default.pug +0 -0
- package/layout/includes/page/equipment.pug +0 -0
- package/layout/includes/page/links.pug +2 -2
- package/layout/includes/page/music.pug +0 -0
- package/layout/includes/page/not_configured.pug +0 -0
- package/layout/includes/page/rss.pug +3 -3
- package/layout/includes/page/says.pug +15 -15
- package/layout/includes/page/tags.pug +0 -0
- package/layout/includes/page/tlink.pug +1 -0
- package/layout/includes/recent-posts.pug +0 -0
- package/layout/includes/sidebar.pug +0 -0
- package/layout/includes/widgets/aside/aside.pug +6 -6
- package/layout/includes/widgets/aside/asideAllInfo.pug +0 -0
- package/layout/includes/widgets/aside/asideArchive.pug +0 -0
- package/layout/includes/widgets/aside/asideCustom.pug +1 -1
- package/layout/includes/widgets/aside/asideFlipCard.pug +0 -0
- package/layout/includes/widgets/aside/asideInfoCard.pug +3 -3
- package/layout/includes/widgets/aside/asideNewestPost.pug +0 -0
- package/layout/includes/widgets/aside/asideSwitch.pug +0 -4
- package/layout/includes/widgets/aside/asideTag.pug +1 -1
- package/layout/includes/widgets/aside/asideToc.pug +0 -0
- package/layout/includes/widgets/aside/asideWebInfo.pug +2 -2
- package/layout/includes/widgets/home/banner.pug +0 -0
- package/layout/includes/widgets/home/bb/json.pug +22 -0
- package/layout/includes/widgets/home/bb/local.pug +17 -0
- package/layout/includes/widgets/home/bb/memos.pug +25 -0
- package/layout/includes/widgets/home/bbTimeList.pug +11 -7
- package/layout/includes/widgets/home/categoryBar.pug +0 -0
- package/layout/includes/widgets/home/categoryGroup.pug +1 -1
- package/layout/includes/widgets/home/hometop.pug +0 -0
- package/layout/includes/widgets/home/postList.pug +0 -0
- package/layout/includes/widgets/home/topGroup.pug +0 -0
- package/layout/includes/widgets/nav/left.pug +0 -0
- package/layout/includes/widgets/nav/menu.pug +1 -1
- package/layout/includes/widgets/nav/right.pug +6 -5
- package/layout/includes/widgets/page/about/authorinfo.pug +10 -9
- package/layout/includes/widgets/page/about/award.pug +0 -0
- package/layout/includes/widgets/page/about/contentinfo.pug +35 -34
- package/layout/includes/widgets/page/about/hobbies.pug +21 -17
- package/layout/includes/widgets/page/about/motto.pug +17 -16
- package/layout/includes/widgets/page/about/other.pug +16 -16
- package/layout/includes/widgets/page/about/personalities.pug +15 -14
- package/layout/includes/widgets/page/about/skillsinfo.pug +37 -36
- package/layout/includes/widgets/page/about/tenyear.pug +0 -0
- package/layout/includes/widgets/page/banner.pug +9 -3
- package/layout/includes/widgets/page/equipment/content.pug +0 -0
- package/layout/includes/widgets/page/links/banner.pug +14 -12
- package/layout/includes/widgets/page/links/linksCard.pug +4 -6
- package/layout/includes/widgets/page/links/linksDiscn.pug +8 -0
- package/layout/includes/widgets/page/links/linksItem.pug +4 -6
- package/layout/includes/widgets/page/says/json.pug +80 -0
- package/layout/includes/widgets/page/says/local.pug +48 -0
- package/layout/includes/widgets/page/says/memos.pug +109 -0
- package/layout/includes/widgets/post/award.pug +0 -0
- package/layout/includes/widgets/post/copyright.pug +2 -2
- package/layout/includes/widgets/post/post-ai.pug +12 -0
- package/layout/includes/widgets/post/postMeta.pug +2 -2
- package/layout/includes/widgets/post/postNav.pug +0 -0
- package/layout/includes/widgets/post/wave.pug +0 -0
- package/layout/includes/widgets/randomlink.pug +1 -1
- package/layout/includes/widgets/rightside/index.pug +6 -5
- package/layout/includes/widgets/third-party/comments/comment.pug +1 -5
- package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -1
- package/layout/includes/widgets/third-party/comments/waline.pug +9 -11
- package/layout/includes/widgets/third-party/music.pug +1 -1
- package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -0
- package/layout/includes/widgets/third-party/news-comment/twikoo.pug +70 -0
- package/layout/includes/widgets/third-party/news-comment/waline.pug +64 -0
- package/layout/includes/widgets/third-party/pjax.pug +0 -0
- package/layout/includes/widgets/third-party/search/algolia-search.pug +0 -0
- package/layout/includes/widgets/third-party/search/index.pug +8 -7
- package/layout/includes/widgets/third-party/search/local-search.pug +0 -0
- package/layout/index.pug +3 -3
- package/layout/page.pug +0 -4
- package/layout/post.pug +2 -2
- package/layout/tag.pug +0 -0
- package/package.json +18 -9
- package/plugins.yml +109 -0
- package/scripts/event/cdn.js +129 -0
- package/scripts/event/init.js +0 -0
- package/scripts/event/page.js +1 -21
- package/scripts/event/welcome.js +1 -1
- package/scripts/filter/checkThemeConfig.js +0 -0
- package/scripts/filter/default.js +0 -0
- package/scripts/filter/lazyload.js +1 -1
- package/scripts/filter/randomPosts.js +0 -0
- package/scripts/helper/cdn.js +0 -0
- package/scripts/helper/getArchiveLength.js +0 -0
- package/scripts/helper/page.js +0 -0
- package/scripts/helper/related_post.js +0 -0
- package/scripts/helper/stylus.js +0 -0
- package/scripts/tags/button.js +0 -0
- package/scripts/tags/bvideo.js +0 -0
- package/scripts/tags/card.js +0 -0
- package/scripts/tags/checkbox.js +0 -0
- package/scripts/tags/fold.js +0 -0
- package/scripts/tags/image.js +0 -0
- package/scripts/tags/inline-image.js +0 -0
- package/scripts/tags/label.js +0 -0
- package/scripts/tags/link.js +0 -0
- package/scripts/tags/media.js +0 -0
- package/scripts/tags/note.js +0 -0
- package/scripts/tags/span.js +0 -0
- package/scripts/tags/tabs.js +0 -0
- package/scripts/tags/timeline.js +0 -0
- package/scripts/tags/u.js +0 -0
- package/source/css/_global/animation.css +0 -0
- package/source/css/_global/function.styl +42 -42
- package/source/css/_global/index.styl +1 -1
- package/source/css/_global/var.styl +0 -0
- package/source/css/_layout/basic.styl +10 -12
- package/source/css/_layout/header.styl +7 -2
- package/source/css/_layout/index.styl +59 -5
- package/source/css/_mode/index.styl +1 -17
- package/source/css/_page/_home/category-bar.styl +0 -0
- package/source/css/_page/_home/home-top.styl +10 -31
- package/source/css/_page/_home/index.styl +0 -0
- package/source/css/_page/_home/pagination.styl +3 -0
- package/source/css/_page/_home/recent-post.styl +10 -3
- package/source/css/_page/about/index.styl +0 -0
- package/source/css/_page/about/tenyear.styl +0 -0
- package/source/css/_page/about.styl +9 -0
- package/source/css/_page/category.styl +0 -0
- package/source/css/_page/douban.styl +0 -1
- package/source/css/_page/equipment.styl +0 -0
- package/source/css/_page/error.styl +0 -0
- package/source/css/_page/home.styl +0 -0
- package/source/css/_page/index.styl +2 -3
- package/source/css/_page/links.styl +84 -49
- package/source/css/_page/moment.styl +0 -0
- package/source/css/_page/music.styl +0 -0
- package/source/css/_page/rss.styl +0 -0
- package/source/css/_page/says.styl +10 -0
- package/source/css/_page/tag.styl +0 -0
- package/source/css/_widgets/_aside/allinfo.styl +34 -0
- package/source/css/_widgets/_aside/flip.styl +0 -0
- package/source/css/_widgets/_aside/index.styl +1 -7
- package/source/css/_widgets/_aside/info.styl +0 -0
- package/source/css/_widgets/_aside/newPost.styl +0 -0
- package/source/css/_widgets/_aside/toc.styl +0 -0
- package/source/css/_widgets/_aside/welcome.styl +0 -0
- package/source/css/_widgets/_comment/index.styl +0 -0
- package/source/css/_widgets/_comment/twikoo.styl +0 -2
- package/source/css/_widgets/_comment/waline.styl +0 -0
- package/source/css/_widgets/_extra/console.styl +0 -0
- package/source/css/_widgets/_extra/fullpage.styl +0 -0
- package/source/css/_widgets/_extra/music.styl +1 -1
- package/source/css/_widgets/_extra/pace.styl +0 -0
- package/source/css/_widgets/_extra/rightmenu.styl +0 -0
- package/source/css/_widgets/_mixins/article-sort.styl +0 -0
- package/source/css/_widgets/_mixins/footer.styl +1 -2
- package/source/css/_widgets/_mixins/other.styl +0 -4
- package/source/css/_widgets/_mixins/sidebar.styl +0 -0
- package/source/css/_widgets/_post/_highlight/diff.styl +0 -0
- package/source/css/_widgets/_post/_highlight/index.styl +0 -1
- package/source/css/_widgets/_post/_highlight/theme/default.styl +0 -0
- package/source/css/_widgets/_post/_highlight/theme/mac.styl +0 -0
- package/source/css/_widgets/_post/_highlight/theme.styl +0 -0
- package/source/css/_widgets/_post/commentBarrage.styl +0 -0
- package/source/css/_widgets/_post/content.styl +42 -11
- package/source/css/_widgets/_post/copyright.styl +0 -0
- package/source/css/_widgets/_post/index.styl +1 -1
- package/source/css/_widgets/_post/meta.styl +0 -3
- package/source/css/_widgets/_post/pagination.styl +1 -1
- package/source/css/_widgets/_post/postAI.styl +0 -0
- package/source/css/_widgets/_post/relatedPost.styl +0 -0
- package/source/css/_widgets/_post/tools.styl +0 -0
- package/source/css/_widgets/_search/algolia-search.styl +0 -0
- package/source/css/_widgets/_search/local-search.styl +0 -0
- package/source/css/_widgets/_tags/button.styl +0 -0
- package/source/css/_widgets/_tags/bvideo.styl +0 -0
- package/source/css/_widgets/_tags/card.styl +0 -0
- package/source/css/_widgets/_tags/checkbox.styl +0 -0
- package/source/css/_widgets/_tags/fold.styl +0 -0
- package/source/css/_widgets/_tags/image.styl +0 -0
- package/source/css/_widgets/_tags/index.styl +0 -0
- package/source/css/_widgets/_tags/inline-image.styl +0 -0
- package/source/css/_widgets/_tags/label.styl +0 -0
- package/source/css/_widgets/_tags/link.styl +4 -2
- package/source/css/_widgets/_tags/note.styl +0 -0
- package/source/css/_widgets/_tags/span.styl +0 -0
- package/source/css/_widgets/_tags/tabs.styl +0 -0
- package/source/css/_widgets/_tags/timeline.styl +0 -1
- package/source/css/_widgets/index.styl +4 -4
- package/source/css/index.styl +0 -0
- package/source/img/avatar.png +0 -0
- package/source/img/default.png +0 -0
- package/source/img/error_load.png +0 -0
- package/source/js/{extend/comment/twikoo/commentBarrage.js → comment/twikoo_commentBarrage.js} +0 -0
- package/source/js/{extend/comment/waline/commentBarrage.js → comment/waline_commentBarrage.js} +0 -0
- package/source/js/covercolor/api.js +95 -0
- package/source/js/covercolor/local.js +154 -0
- package/source/js/main.js +28 -235
- package/source/js/music.js +0 -0
- package/source/js/rightside.js +404 -0
- package/source/js/{extend/search/algolia-search.js → search/algolia.js} +10 -0
- package/source/js/{extend/search/local-search.js → search/local.js} +24 -2
- package/source/js/utils.js +75 -1
- package/layout/includes/head/fest.pug +0 -22
- package/layout/includes/page/echarts.pug +0 -7
- package/layout/includes/page/moments.pug +0 -4
- package/layout/includes/widgets/aside/asideHistory.pug +0 -8
- package/layout/includes/widgets/aside/asideWelcome.pug +0 -12
- package/layout/includes/widgets/page/moments/angle.pug +0 -19
- package/layout/includes/widgets/page/moments/index.pug +0 -23
- package/layout/includes/widgets/page/says/saysBottom.pug +0 -11
- package/layout/includes/widgets/page/says/saysContent.pug +0 -6
- package/layout/includes/widgets/page/says/saysFunction.pug +0 -10
- package/layout/includes/widgets/page/says/saysMeta.pug +0 -7
- package/layout/includes/widgets/third-party/ai/index.pug +0 -12
- package/layout/includes/widgets/third-party/comments/gitalk.pug +0 -0
- package/layout/includes/widgets/third-party/comments/valine.pug +0 -0
- package/scripts/helper/echarts.js +0 -407
- package/source/css/_widgets/_aside/history.styl +0 -42
- package/source/js/extend/comment/twikoo/twikoo.js +0 -67
- package/source/js/extend/comment/waline/waline.js +0 -60
- package/source/lib/bundle.min.js +0 -27
- package/source/lib/circle.min.js +0 -1
- package/source/lib/cover-color.min.js +0 -7
- package/source/lib/friends_post.js +0 -4
- package/source/lib/lazyload.min.js +0 -1
- package/source/lib/rightside.min.js +0 -1
- package/source/lib/snackbar.min.css +0 -1
- package/source/lib/snackbar.min.js +0 -9
- package/source/lib/txmap.min.js +0 -1
- package/source/lib/universe.min.js +0 -1
- package/source/lib/view-image.min.js +0 -6
- package/source/lib/waterfall.min.js +0 -1
- /package/source/{lib → js}/sco-ai.min.js +0 -0
@@ -1,12 +0,0 @@
|
|
1
|
-
.post-ai
|
2
|
-
.ai-title
|
3
|
-
.ai-title-left
|
4
|
-
i.ai-title-icon.scoicon.sco-robot-fill
|
5
|
-
.ai-title-text 文章摘要
|
6
|
-
.ai-tag#ai-tag= theme.thirdparty.ai.modelName
|
7
|
-
.ai-explanation(style="display: block;")
|
8
|
-
.ai-suggestions
|
9
|
-
.ai-bottom
|
10
|
-
.ai-tips= theme.thirdparty.ai.tips
|
11
|
-
if theme.thirdparty.ai.report
|
12
|
-
a.ai-report(title="投诉", href=url_for(theme.thirdparty.ai.report)) 投诉
|
File without changes
|
File without changes
|
@@ -1,407 +0,0 @@
|
|
1
|
-
hexo.extend.filter.register('after_render:html', function (locals) {
|
2
|
-
const {config, theme} = this
|
3
|
-
if (!theme.config.about.echarts.enable) return
|
4
|
-
|
5
|
-
const cheerio = require('cheerio')
|
6
|
-
const $ = cheerio.load(locals)
|
7
|
-
const post = $('#posts-chart')
|
8
|
-
const tag = $('#tags-chart')
|
9
|
-
const category = $('#categories-chart')
|
10
|
-
const htmlEncode = false
|
11
|
-
|
12
|
-
if (post.length > 0 || tag.length > 0 || category.length > 0) {
|
13
|
-
if (post.length > 0 && $('#postsChart').length === 0) {
|
14
|
-
if (post.attr('data-encode') === 'true') htmlEncode = true
|
15
|
-
post.after(postsChart(post.attr('data-start')))
|
16
|
-
}
|
17
|
-
if (tag.length > 0 && $('#tagsChart').length === 0) {
|
18
|
-
if (tag.attr('data-encode') === 'true') htmlEncode = true
|
19
|
-
tag.after(tagsChart(tag.attr('data-length')))
|
20
|
-
}
|
21
|
-
if (category.length > 0 && $('#categoriesChart').length === 0) {
|
22
|
-
if (category.attr('data-encode') === 'true') htmlEncode = true
|
23
|
-
category.after(categoriesChart(category.attr('data-parent')))
|
24
|
-
}
|
25
|
-
|
26
|
-
if (htmlEncode) {
|
27
|
-
return $.root().html().replace(/&#/g, '&#')
|
28
|
-
} else {
|
29
|
-
return $.root().html()
|
30
|
-
}
|
31
|
-
} else {
|
32
|
-
return locals
|
33
|
-
}
|
34
|
-
}, 15)
|
35
|
-
|
36
|
-
function postsChart(startMonth) {
|
37
|
-
const moment = require('moment')
|
38
|
-
const startDate = moment(startMonth || '2020-01')
|
39
|
-
const endDate = moment()
|
40
|
-
|
41
|
-
const monthMap = new Map()
|
42
|
-
const dayTime = 3600 * 24 * 1000
|
43
|
-
for (let time = startDate; time <= endDate; time += dayTime) {
|
44
|
-
const month = moment(time).format('YYYY-MM')
|
45
|
-
if (!monthMap.has(month)) {
|
46
|
-
monthMap.set(month, 0)
|
47
|
-
}
|
48
|
-
}
|
49
|
-
hexo.locals.get('posts').forEach(function (post) {
|
50
|
-
const month = post.date.format('YYYY-MM')
|
51
|
-
if (monthMap.has(month)) {
|
52
|
-
monthMap.set(month, monthMap.get(month) + 1)
|
53
|
-
}
|
54
|
-
})
|
55
|
-
const monthArr = JSON.stringify([...monthMap.keys()])
|
56
|
-
const monthValueArr = JSON.stringify([...monthMap.values()])
|
57
|
-
|
58
|
-
return `
|
59
|
-
<script id="postsChart">
|
60
|
-
var color = document.documentElement.getAttribute('data-theme') === 'light' ? '#4c4948' : 'rgba(255,255,255,0.7)'
|
61
|
-
var postsChart = echarts.init(document.getElementById('posts-chart'), 'light');
|
62
|
-
var postsOption = {
|
63
|
-
title: {
|
64
|
-
text: '文章发布统计图',
|
65
|
-
x: 'center',
|
66
|
-
textStyle: {
|
67
|
-
color: color
|
68
|
-
}
|
69
|
-
},
|
70
|
-
tooltip: {
|
71
|
-
trigger: 'axis'
|
72
|
-
},
|
73
|
-
xAxis: {
|
74
|
-
name: '日期',
|
75
|
-
type: 'category',
|
76
|
-
boundaryGap: false,
|
77
|
-
nameTextStyle: {
|
78
|
-
color: color
|
79
|
-
},
|
80
|
-
axisTick: {
|
81
|
-
show: false
|
82
|
-
},
|
83
|
-
axisLabel: {
|
84
|
-
show: true,
|
85
|
-
color: color
|
86
|
-
},
|
87
|
-
axisLine: {
|
88
|
-
show: true,
|
89
|
-
lineStyle: {
|
90
|
-
color: color
|
91
|
-
}
|
92
|
-
},
|
93
|
-
data: ${monthArr}
|
94
|
-
},
|
95
|
-
yAxis: {
|
96
|
-
name: '文章篇数',
|
97
|
-
type: 'value',
|
98
|
-
nameTextStyle: {
|
99
|
-
color: color
|
100
|
-
},
|
101
|
-
splitLine: {
|
102
|
-
show: false
|
103
|
-
},
|
104
|
-
axisTick: {
|
105
|
-
show: false
|
106
|
-
},
|
107
|
-
axisLabel: {
|
108
|
-
show: true,
|
109
|
-
color: color
|
110
|
-
},
|
111
|
-
axisLine: {
|
112
|
-
show: true,
|
113
|
-
lineStyle: {
|
114
|
-
color: color
|
115
|
-
}
|
116
|
-
}
|
117
|
-
},
|
118
|
-
series: [{
|
119
|
-
name: '文章篇数',
|
120
|
-
type: 'line',
|
121
|
-
smooth: true,
|
122
|
-
lineStyle: {
|
123
|
-
width: 0
|
124
|
-
},
|
125
|
-
showSymbol: false,
|
126
|
-
itemStyle: {
|
127
|
-
opacity: 1,
|
128
|
-
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
129
|
-
offset: 0,
|
130
|
-
color: 'rgba(128, 255, 165)'
|
131
|
-
},
|
132
|
-
{
|
133
|
-
offset: 1,
|
134
|
-
color: 'rgba(1, 191, 236)'
|
135
|
-
}])
|
136
|
-
},
|
137
|
-
areaStyle: {
|
138
|
-
opacity: 1,
|
139
|
-
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
140
|
-
offset: 0,
|
141
|
-
color: 'rgba(128, 255, 165)'
|
142
|
-
}, {
|
143
|
-
offset: 1,
|
144
|
-
color: 'rgba(1, 191, 236)'
|
145
|
-
}])
|
146
|
-
},
|
147
|
-
data: ${monthValueArr},
|
148
|
-
markLine: {
|
149
|
-
data: [{
|
150
|
-
name: '平均值',
|
151
|
-
type: 'average',
|
152
|
-
label: {
|
153
|
-
color: color
|
154
|
-
}
|
155
|
-
}]
|
156
|
-
}
|
157
|
-
}]
|
158
|
-
};
|
159
|
-
postsChart.setOption(postsOption);
|
160
|
-
window.addEventListener('resize', () => {
|
161
|
-
postsChart.resize();
|
162
|
-
});
|
163
|
-
postsChart.on('click', 'series', (event) => {
|
164
|
-
if (event.componentType === 'series') window.location.href = '/archives/' + event.name.replace('-', '/');
|
165
|
-
});
|
166
|
-
</script>`
|
167
|
-
}
|
168
|
-
|
169
|
-
function tagsChart(len) {
|
170
|
-
const tagArr = []
|
171
|
-
hexo.locals.get('tags').map(function (tag) {
|
172
|
-
tagArr.push({name: tag.name, value: tag.length, path: tag.path})
|
173
|
-
})
|
174
|
-
tagArr.sort((a, b) => {
|
175
|
-
return b.value - a.value
|
176
|
-
})
|
177
|
-
|
178
|
-
const dataLength = Math.min(tagArr.length, len) || tagArr.length
|
179
|
-
const tagNameArr = []
|
180
|
-
for (let i = 0; i < dataLength; i++) {
|
181
|
-
tagNameArr.push(tagArr[i].name)
|
182
|
-
}
|
183
|
-
const tagNameArrJson = JSON.stringify(tagNameArr)
|
184
|
-
const tagArrJson = JSON.stringify(tagArr)
|
185
|
-
|
186
|
-
return `
|
187
|
-
<script id="tagsChart">
|
188
|
-
var color = document.documentElement.getAttribute('data-theme') === 'light' ? '#4c4948' : 'rgba(255,255,255,0.7)'
|
189
|
-
var tagsChart = echarts.init(document.getElementById('tags-chart'), 'light');
|
190
|
-
var tagsOption = {
|
191
|
-
title: {
|
192
|
-
text: 'Top ${dataLength} 标签统计图',
|
193
|
-
x: 'center',
|
194
|
-
textStyle: {
|
195
|
-
color: color
|
196
|
-
}
|
197
|
-
},
|
198
|
-
tooltip: {},
|
199
|
-
xAxis: {
|
200
|
-
name: '标签',
|
201
|
-
type: 'category',
|
202
|
-
nameTextStyle: {
|
203
|
-
color: color
|
204
|
-
},
|
205
|
-
axisTick: {
|
206
|
-
show: false
|
207
|
-
},
|
208
|
-
axisLabel: {
|
209
|
-
show: true,
|
210
|
-
color: color,
|
211
|
-
interval: 0
|
212
|
-
},
|
213
|
-
axisLine: {
|
214
|
-
show: true,
|
215
|
-
lineStyle: {
|
216
|
-
color: color
|
217
|
-
}
|
218
|
-
},
|
219
|
-
data: ${tagNameArrJson}
|
220
|
-
},
|
221
|
-
yAxis: {
|
222
|
-
name: '文章篇数',
|
223
|
-
type: 'value',
|
224
|
-
splitLine: {
|
225
|
-
show: false
|
226
|
-
},
|
227
|
-
nameTextStyle: {
|
228
|
-
color: color
|
229
|
-
},
|
230
|
-
axisTick: {
|
231
|
-
show: false
|
232
|
-
},
|
233
|
-
axisLabel: {
|
234
|
-
show: true,
|
235
|
-
color: color
|
236
|
-
},
|
237
|
-
axisLine: {
|
238
|
-
show: true,
|
239
|
-
lineStyle: {
|
240
|
-
color: color
|
241
|
-
}
|
242
|
-
}
|
243
|
-
},
|
244
|
-
series: [{
|
245
|
-
name: '文章篇数',
|
246
|
-
type: 'bar',
|
247
|
-
data: ${tagArrJson},
|
248
|
-
itemStyle: {
|
249
|
-
borderRadius: [5, 5, 0, 0],
|
250
|
-
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
251
|
-
offset: 0,
|
252
|
-
color: 'rgba(128, 255, 165)'
|
253
|
-
},
|
254
|
-
{
|
255
|
-
offset: 1,
|
256
|
-
color: 'rgba(1, 191, 236)'
|
257
|
-
}])
|
258
|
-
},
|
259
|
-
emphasis: {
|
260
|
-
itemStyle: {
|
261
|
-
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
262
|
-
offset: 0,
|
263
|
-
color: 'rgba(128, 255, 195)'
|
264
|
-
},
|
265
|
-
{
|
266
|
-
offset: 1,
|
267
|
-
color: 'rgba(1, 211, 255)'
|
268
|
-
}])
|
269
|
-
}
|
270
|
-
},
|
271
|
-
markLine: {
|
272
|
-
data: [{
|
273
|
-
name: '平均值',
|
274
|
-
type: 'average',
|
275
|
-
label: {
|
276
|
-
color: color
|
277
|
-
}
|
278
|
-
}]
|
279
|
-
}
|
280
|
-
}]
|
281
|
-
};
|
282
|
-
tagsChart.setOption(tagsOption);
|
283
|
-
window.addEventListener('resize', () => {
|
284
|
-
tagsChart.resize();
|
285
|
-
});
|
286
|
-
tagsChart.on('click', 'series', (event) => {
|
287
|
-
if(event.data.path) window.location.href = '/' + event.data.path;
|
288
|
-
});
|
289
|
-
</script>`
|
290
|
-
}
|
291
|
-
|
292
|
-
function categoriesChart(dataParent) {
|
293
|
-
const categoryArr = []
|
294
|
-
let categoryParentFlag = false
|
295
|
-
hexo.locals.get('categories').map(function (category) {
|
296
|
-
if (category.parent) categoryParentFlag = true
|
297
|
-
categoryArr.push({
|
298
|
-
name: category.name,
|
299
|
-
value: category.length,
|
300
|
-
path: category.path,
|
301
|
-
id: category._id,
|
302
|
-
parentId: category.parent || '0'
|
303
|
-
})
|
304
|
-
})
|
305
|
-
categoryParentFlag = categoryParentFlag && dataParent === 'true'
|
306
|
-
categoryArr.sort((a, b) => {
|
307
|
-
return b.value - a.value
|
308
|
-
})
|
309
|
-
|
310
|
-
function translateListToTree(data, parent) {
|
311
|
-
let tree = []
|
312
|
-
let temp
|
313
|
-
data.forEach((item, index) => {
|
314
|
-
if (data[index].parentId == parent) {
|
315
|
-
let obj = data[index];
|
316
|
-
temp = translateListToTree(data, data[index].id);
|
317
|
-
if (temp.length > 0) {
|
318
|
-
obj.children = temp
|
319
|
-
}
|
320
|
-
if (tree.indexOf())
|
321
|
-
tree.push(obj)
|
322
|
-
}
|
323
|
-
})
|
324
|
-
return tree
|
325
|
-
}
|
326
|
-
|
327
|
-
const categoryNameJson = JSON.stringify(categoryArr.map(function (category) {
|
328
|
-
return category.name
|
329
|
-
}))
|
330
|
-
const categoryArrJson = JSON.stringify(categoryArr)
|
331
|
-
const categoryArrParentJson = JSON.stringify(translateListToTree(categoryArr, '0'))
|
332
|
-
|
333
|
-
return `
|
334
|
-
<script id="categoriesChart">
|
335
|
-
var color = document.documentElement.getAttribute('data-theme') === 'light' ? '#4c4948' : 'rgba(255,255,255,0.7)'
|
336
|
-
var categoriesChart = echarts.init(document.getElementById('categories-chart'), 'light');
|
337
|
-
var categoryParentFlag = ${categoryParentFlag}
|
338
|
-
var categoriesOption = {
|
339
|
-
title: {
|
340
|
-
text: '文章分类统计图',
|
341
|
-
x: 'center',
|
342
|
-
textStyle: {
|
343
|
-
color: color
|
344
|
-
}
|
345
|
-
},
|
346
|
-
legend: {
|
347
|
-
top: 'bottom',
|
348
|
-
data: ${categoryNameJson},
|
349
|
-
textStyle: {
|
350
|
-
color: color
|
351
|
-
}
|
352
|
-
},
|
353
|
-
tooltip: {
|
354
|
-
trigger: 'item'
|
355
|
-
},
|
356
|
-
series: []
|
357
|
-
};
|
358
|
-
categoriesOption.series.push(
|
359
|
-
categoryParentFlag ?
|
360
|
-
{
|
361
|
-
nodeClick :false,
|
362
|
-
name: '文章篇数',
|
363
|
-
type: 'sunburst',
|
364
|
-
radius: ['15%', '90%'],
|
365
|
-
center: ['50%', '55%'],
|
366
|
-
sort: 'desc',
|
367
|
-
data: ${categoryArrParentJson},
|
368
|
-
itemStyle: {
|
369
|
-
borderColor: '#fff',
|
370
|
-
borderWidth: 2,
|
371
|
-
emphasis: {
|
372
|
-
focus: 'ancestor',
|
373
|
-
shadowBlur: 10,
|
374
|
-
shadowOffsetX: 0,
|
375
|
-
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
376
|
-
}
|
377
|
-
}
|
378
|
-
}
|
379
|
-
:
|
380
|
-
{
|
381
|
-
name: '文章篇数',
|
382
|
-
type: 'pie',
|
383
|
-
radius: [30, 80],
|
384
|
-
roseType: 'area',
|
385
|
-
label: {
|
386
|
-
color: color,
|
387
|
-
formatter: '{b} : {c} ({d}%)'
|
388
|
-
},
|
389
|
-
data: ${categoryArrJson},
|
390
|
-
itemStyle: {
|
391
|
-
emphasis: {
|
392
|
-
shadowBlur: 10,
|
393
|
-
shadowOffsetX: 0,
|
394
|
-
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
395
|
-
}
|
396
|
-
}
|
397
|
-
}
|
398
|
-
)
|
399
|
-
categoriesChart.setOption(categoriesOption);
|
400
|
-
window.addEventListener('resize', () => {
|
401
|
-
categoriesChart.resize();
|
402
|
-
});
|
403
|
-
categoriesChart.on('click', 'series', (event) => {
|
404
|
-
if(event.data.path) window.location.href = '/' + event.data.path;
|
405
|
-
});
|
406
|
-
</script>`
|
407
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#aside-content
|
2
|
-
.card-history
|
3
|
-
.swiper-wrapper
|
4
|
-
flex-direction column
|
5
|
-
|
6
|
-
.history_slide
|
7
|
-
text-align left
|
8
|
-
display flex !important
|
9
|
-
flex-direction column
|
10
|
-
align-items flex-start
|
11
|
-
|
12
|
-
#history-baidu
|
13
|
-
height 100px
|
14
|
-
overflow hidden
|
15
|
-
> .blog-slider__pagination
|
16
|
-
display none
|
17
|
-
|
18
|
-
.history_swiper-containe
|
19
|
-
.swiper-wrapper
|
20
|
-
height 20px
|
21
|
-
|
22
|
-
.history_slide_time
|
23
|
-
color var(--sco-secondtext)
|
24
|
-
font-size 14px
|
25
|
-
font-style italic
|
26
|
-
font-weight lighter
|
27
|
-
|
28
|
-
.history_slide_link
|
29
|
-
line-height 1.5
|
30
|
-
-webkit-line-clamp 2
|
31
|
-
display -webkit-box
|
32
|
-
overflow hidden
|
33
|
-
-webkit-box-orient vertical
|
34
|
-
|
35
|
-
a
|
36
|
-
color var(--sco-main)
|
37
|
-
padding 0 4px
|
38
|
-
border-radius 4px
|
39
|
-
|
40
|
-
&:hover
|
41
|
-
color var(--sco-white)
|
42
|
-
background var(--sco-main)
|
@@ -1,67 +0,0 @@
|
|
1
|
-
const changeContent = (content) => {
|
2
|
-
if (content === '') return content;
|
3
|
-
|
4
|
-
const replacements = [
|
5
|
-
{ regex: /<img.*?src="(.*?)"?[^\>]+>/ig, replacement: '[图片]' },
|
6
|
-
{ regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, replacement: '[链接]' },
|
7
|
-
{ regex: /<pre><code>.*?<\/pre>/gi, replacement: '[代码]' },
|
8
|
-
{ regex: /<[^>]+>/g, replacement: "" }
|
9
|
-
];
|
10
|
-
|
11
|
-
content = replacements.reduce((str, { regex, replacement }) => str.replace(regex, replacement), content);
|
12
|
-
|
13
|
-
return content.length > 150 ? content.substring(0, 150) + '...' : content;
|
14
|
-
}
|
15
|
-
|
16
|
-
const getComment = () => {
|
17
|
-
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
18
|
-
|
19
|
-
const runTwikoo = () => {
|
20
|
-
twikoo.getRecentComments({
|
21
|
-
envId: GLOBAL_CONFIG.comment.twikoo.url,
|
22
|
-
region: '',
|
23
|
-
pageSize: 6,
|
24
|
-
includeReply: true
|
25
|
-
}).then(function (res) {
|
26
|
-
const twikooArray = res.map(e => ({
|
27
|
-
'content': changeContent(e.comment),
|
28
|
-
'avatar': e.avatar,
|
29
|
-
'nick': e.nick,
|
30
|
-
'url': `${e.url}#${e.id}`,
|
31
|
-
'date': new Date(e.created).toISOString()
|
32
|
-
}))
|
33
|
-
generateHtml(twikooArray)
|
34
|
-
}).catch(function (err) {
|
35
|
-
$dom.innerHTML = "无法获取评论,请确认相关配置是否正确"
|
36
|
-
})
|
37
|
-
}
|
38
|
-
runTwikoo()
|
39
|
-
}
|
40
|
-
|
41
|
-
const generateHtml = array => {
|
42
|
-
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
43
|
-
$dom.innerHTML = array.length ? array.map(item => `
|
44
|
-
<div class='aside-list-item'>
|
45
|
-
<a href='${item.url}' class='thumbnail'>
|
46
|
-
<img src='${item.avatar}' alt='${item.nick}'>
|
47
|
-
<div class='name'><span>${item.nick}</span></div>
|
48
|
-
</a>
|
49
|
-
<div class='content'>
|
50
|
-
<a class='comment' href='${item.url}'>${item.content}</a>
|
51
|
-
<time class="datetime" datetime="${item.date}"></time>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
`).join('') : '没有评论'
|
55
|
-
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
56
|
-
window.pjax && window.pjax.refresh($dom)
|
57
|
-
changeTimeFormat()
|
58
|
-
}
|
59
|
-
|
60
|
-
const newestCommentInit = () => {
|
61
|
-
const $asideList = document.querySelector('#card-newest-comments .aside-list')
|
62
|
-
if ($asideList) {
|
63
|
-
getComment()
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
newestCommentInit()
|
@@ -1,60 +0,0 @@
|
|
1
|
-
const changeContent = (content) => {
|
2
|
-
if (content === '') return content;
|
3
|
-
|
4
|
-
const replacements = [
|
5
|
-
{ regex: /<img.*?src="(.*?)"?[^\>]+>/ig, replacement: '[图片]' },
|
6
|
-
{ regex: /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, replacement: '[链接]' },
|
7
|
-
{ regex: /<pre><code>.*?<\/pre>/gi, replacement: '[代码]' },
|
8
|
-
{ regex: /<[^>]+>/g, replacement: "" }
|
9
|
-
];
|
10
|
-
|
11
|
-
content = replacements.reduce((str, { regex, replacement }) => str.replace(regex, replacement), content);
|
12
|
-
|
13
|
-
return content.length > 150 ? content.substring(0, 150) + '...' : content;
|
14
|
-
}
|
15
|
-
|
16
|
-
const $asideList = document.querySelector('#card-newest-comments .aside-list')
|
17
|
-
const newestCommentInit = () => {
|
18
|
-
if ($asideList) {
|
19
|
-
getComment()
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
const getComment = () => {
|
24
|
-
Waline.RecentComments(
|
25
|
-
options = {
|
26
|
-
serverURL: GLOBAL_CONFIG.comment.waline.url,
|
27
|
-
count: 6,
|
28
|
-
}
|
29
|
-
).then(function (res) {
|
30
|
-
const walineArray = res.comments.map(item => ({
|
31
|
-
'content': changeContent(item.comment),
|
32
|
-
'avatar': item.avatar,
|
33
|
-
'nick': item.nick,
|
34
|
-
'url': `${item.url}#${item.objectId}`,
|
35
|
-
'date': new Date(item.insertedAt).toISOString()
|
36
|
-
}))
|
37
|
-
generateHtml(walineArray)
|
38
|
-
}).catch(
|
39
|
-
$asideList.innerHTML = "无法获取评论,请确认相关配置是否正确"
|
40
|
-
)
|
41
|
-
}
|
42
|
-
|
43
|
-
const generateHtml = array => {
|
44
|
-
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
45
|
-
$dom.innerHTML = array.length ? array.map(item => `
|
46
|
-
<div class='aside-list-item'>
|
47
|
-
<a href='${item.url}' class='thumbnail'>
|
48
|
-
<img src='${item.avatar}' alt='${item.nick}'>
|
49
|
-
<div class='name'><span>${item.nick}</span></div>
|
50
|
-
</a>
|
51
|
-
<div class='content'>
|
52
|
-
<a class='comment' href='${item.url}'>${item.content}</a>
|
53
|
-
<time class="datetime" datetime="${item.date}"></time>
|
54
|
-
</div>
|
55
|
-
</div>
|
56
|
-
`).join('') : '没有评论'
|
57
|
-
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
58
|
-
window.pjax && window.pjax.refresh($dom)
|
59
|
-
changeTimeFormat()
|
60
|
-
}
|