hexo-theme-solitude 1.1.0 → 1.1.3
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 +56 -19
- package/README_EN.md +98 -0
- package/_config.yml +124 -124
- package/layout/page/about.ejs +3 -1
- package/layout/page/circle.ejs +1 -1
- package/layout/page/echarts.ejs +1 -14
- package/layout/page/links.ejs +1 -1
- package/layout/page/rss.ejs +10 -8
- package/layout/partial/compoment/about/award.ejs +1 -1
- package/layout/partial/compoment/circle/angle.ejs +1 -1
- package/layout/partial/compoment/circle/content.ejs +8 -8
- package/layout/partial/compoment/dorakika/rightmenu.ejs +1 -1
- package/layout/partial/compoment/inject/body.ejs +1 -3
- package/layout/partial/compoment/inject/head.ejs +3 -4
- package/layout/partial/compoment/links/angle.ejs +2 -2
- package/layout/partial/compoment/post/award.ejs +30 -22
- package/layout/partial/compoment/post/copyright.ejs +10 -8
- package/layout/partial/compoment/post/postMeta.ejs +11 -9
- package/layout/partial/footer.ejs +8 -3
- package/layout/partial/nav.ejs +1 -1
- package/layout/post.ejs +3 -3
- package/package.json +2 -2
- package/scripts/helper/charts.js +45 -34
- package/scripts/helper/related_post.js +10 -3
- package/scripts/tags/fold.js +2 -3
- package/scripts/tags/note.js +6 -2
- package/scripts/tags/tabs.js +1 -1
- package/source/css/main.css +24 -159
- package/source/img/default.png +0 -0
- package/source/img/logo-horizontal_version.png +0 -0
- package/source/img/pwa/16.png +0 -0
- package/source/img/pwa/180.png +0 -0
- package/source/img/pwa/192.png +0 -0
- package/source/img/pwa/32.png +0 -0
- package/source/img/pwa/512.png +0 -0
- package/source/img/pwa/logo.png +0 -0
- package/source/img/pwa/siteicon/splash-1125x2436.png +0 -0
- package/source/img/pwa/siteicon/splash-1136x640.png +0 -0
- package/source/img/pwa/siteicon/splash-1170x2532.png +0 -0
- package/source/img/pwa/siteicon/splash-1179x2556.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2208.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2688.png +0 -0
- package/source/img/pwa/siteicon/splash-1248x2778.png +0 -0
- package/source/img/pwa/siteicon/splash-1290x2796.png +0 -0
- package/source/img/pwa/siteicon/splash-1334x750.png +0 -0
- package/source/img/pwa/siteicon/splash-1536x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-1620x2160.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2224.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2388.png +0 -0
- package/source/img/pwa/siteicon/splash-1792x828.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x1536.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x2732.png +0 -0
- package/source/img/pwa/siteicon/splash-2160x1620.png +0 -0
- package/source/img/pwa/siteicon/splash-2208x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2224x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2388x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2436x1125.png +0 -0
- package/source/img/pwa/siteicon/splash-2532x1170.png +0 -0
- package/source/img/pwa/siteicon/splash-2556x1179.png +0 -0
- package/source/img/pwa/siteicon/splash-2688x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2732x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-2778x1248.png +0 -0
- package/source/img/pwa/siteicon/splash-2796x1290.png +0 -0
- package/source/img/pwa/siteicon/splash-640x1136.png +0 -0
- package/source/img/pwa/siteicon/splash-750x1334.png +0 -0
- package/source/img/pwa/siteicon/splash-828x1792.png +0 -0
- package/source/img/solitude-show.jpg +0 -0
- package/source/js/extend/covercolor/local.js +104 -94
- package/source/js/main.js +19 -16
- package/source/lib/chuckle-post-ai.js +1 -1
- package/scripts/filter/katex.js +0 -25
- package/scripts/tags/expand.js +0 -4
- package/scripts/tags/hide.js +0 -70
- package/source/js/extend/covercolor/web.js +0 -137
package/layout/page/rss.ejs
CHANGED
@@ -1,37 +1,39 @@
|
|
1
1
|
<main class="layout hide-aside" id="content-inner">
|
2
2
|
<div id="page">
|
3
3
|
<div class="rss-plan-list">
|
4
|
-
<a class="rss-plan-item rss-plan-wechat" href="<%- theme.footer.rss.wechatOA %>" title="公众号"
|
4
|
+
<a class="rss-plan-item rss-plan-wechat" href="<%- theme.footer.rss.wechatOA %>" title="公众号"
|
5
|
+
target="_blank">
|
5
6
|
<div class="rss-plan-description">推送精选文章<br>推送全文</div>
|
6
7
|
<div class="rss-plan-info-group">
|
7
8
|
<div class="rss-plan-title">公众号订阅</div>
|
8
9
|
<div class="rss-plan-info">推荐的订阅方式</div>
|
9
10
|
<img class="rss-plan-icon" src="https://bu.dusays.com/2023/11/01/6541d14a4de78.png" alt="wechat">
|
10
11
|
</div>
|
11
|
-
</a
|
12
|
-
|
12
|
+
</a>
|
13
|
+
<a class="rss-plan-item rss-plan-mail" href="<%- theme.footer.rss.emailOA %>" rel="external nofollow"
|
14
|
+
title="email" target="_blank">
|
13
15
|
<div class="rss-plan-description">推送全部文章<br>推送封面与简介</div>
|
14
16
|
<div class="rss-plan-info-group">
|
15
17
|
<div class="rss-plan-title">邮件订阅</div>
|
16
18
|
<div class="rss-plan-info">推荐的订阅方式</div>
|
17
|
-
<img class="rss-plan-icon" src="https://bu.dusays.com/2023/11/01/6541d16c3ea22.png" alt="
|
19
|
+
<img class="rss-plan-icon" src="https://bu.dusays.com/2023/11/01/6541d16c3ea22.png" alt="email">
|
18
20
|
</div>
|
19
21
|
</a><a class="rss-plan-item rss-plan-rss" href="<%- theme.footer.rss.rssOA %>" title="rss" target="_blank">
|
20
22
|
<div class="rss-plan-description">推送全部文章<br>推送简介</div>
|
21
23
|
<div class="rss-plan-info-group">
|
22
24
|
<div class="rss-plan-title">RSS</div>
|
23
25
|
<div class="rss-plan-info">备用订阅方式</div>
|
24
|
-
<img class="rss-plan-icon" src="https://bu.dusays.com/2023/11/01/6541d184e2a09.png" alt="
|
26
|
+
<img class="rss-plan-icon" src="https://bu.dusays.com/2023/11/01/6541d184e2a09.png" alt="rss">
|
25
27
|
</div>
|
26
28
|
</a></div>
|
27
|
-
|
29
|
+
<%- page.content %>
|
28
30
|
|
29
31
|
<% if(page.comment){ %>
|
30
32
|
<%- partial('partial/compoment/third-party/comments/comment') %>
|
31
33
|
<% } %>
|
32
34
|
</div>
|
33
35
|
|
34
|
-
<% if(page.aside){%>
|
36
|
+
<% if(page.aside){ %>
|
35
37
|
<%- partial('partial/compoment/aside/aside') %>
|
36
|
-
<%} %>
|
38
|
+
<% } %>
|
37
39
|
</main>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<% if(theme.post.award.enable){ %>
|
25
25
|
<div class="post-reward">
|
26
26
|
<div class="post-reward" onclick="AddRewardMask()"></div>
|
27
|
-
<div class="reward-button" title="赞赏作者"><i class="
|
27
|
+
<div class="reward-button" title="赞赏作者"><i class="scoicon sco-hand-heart-fill"></i> 打赏作者
|
28
28
|
</div>
|
29
29
|
<div class="reward-main">
|
30
30
|
<ul class="reward-all">
|
@@ -2,18 +2,18 @@
|
|
2
2
|
<script>
|
3
3
|
let UserConfig = {
|
4
4
|
// 填写你的api地址
|
5
|
-
private_api_url: '<%= theme.circle.api %>',
|
5
|
+
private_api_url: '<%= theme.thirdparty.circle.api %>',
|
6
6
|
// 默认加载文章数
|
7
|
-
page_init_number: <%= theme.circle.page_init_number%>,
|
7
|
+
page_init_number: <%= theme.thirdparty.circle.page_init_number%>,
|
8
8
|
// 点击加载更多时,一次最多加载几篇文章,默认10
|
9
|
-
page_turning_number: <%= theme.circle.page_turning_number %>,
|
9
|
+
page_turning_number: <%= theme.thirdparty.circle.page_turning_number %>,
|
10
10
|
// 头像加载失败时,默认头像地址
|
11
|
-
error_img: '<%= theme.circle.error_img %>',
|
11
|
+
error_img: '<%= theme.thirdparty.circle.error_img %>',
|
12
12
|
// 进入页面时第一次的排序规则
|
13
|
-
sort_rule: '<%= theme.circle.sort_rule %>',
|
13
|
+
sort_rule: '<%= theme.thirdparty.circle.sort_rule %>',
|
14
14
|
// 本地文章缓存数据过期时间(天)
|
15
|
-
expire_days: <%= theme.circle.expire_days %>,
|
15
|
+
expire_days: <%= theme.thirdparty.circle.expire_days %>,
|
16
16
|
}
|
17
17
|
</script>
|
18
|
-
|
19
|
-
|
18
|
+
<%- js(theme.thirdparty.circle.appjs) %>
|
19
|
+
<%- js(theme.thirdparty.circle.bundlejs) %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<span>复制选中文本</span>
|
20
20
|
</div>
|
21
21
|
<div class="rightMenu-item" id="menu-pastetext">
|
22
|
-
<i class="
|
22
|
+
<i class="scoicon sco-clipboard-fill"></i>
|
23
23
|
<span>粘贴文本</span>
|
24
24
|
</div>
|
25
25
|
<a class="rightMenu-item" id="menu-commenttext" data-pjax-state="">
|
@@ -36,9 +36,7 @@
|
|
36
36
|
var meting_api = "<%- theme.thirdparty.aplayer.api %>";
|
37
37
|
</script>
|
38
38
|
<% } %>
|
39
|
-
<% if(theme.post.covercolor
|
40
|
-
<%- js('/js/extend/covercolor/web') %>
|
41
|
-
<% }else{ %>
|
39
|
+
<% if(theme.post.covercolor){ %>
|
42
40
|
<%- js('/js/extend/covercolor/local') %>
|
43
41
|
<% } %>
|
44
42
|
|
@@ -56,11 +56,10 @@
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
-
const DarkModeStatus =
|
60
|
-
if(DarkModeStatus !==
|
59
|
+
const DarkModeStatus = localStorage.getItem('theme')
|
60
|
+
if(DarkModeStatus !== null){
|
61
61
|
if(DarkModeStatus === 'dark'){
|
62
62
|
document.documentElement.setAttribute('data-theme', 'dark')
|
63
|
-
|
64
63
|
}else{
|
65
64
|
document.documentElement.setAttribute('data-theme', 'light')
|
66
65
|
}
|
@@ -79,6 +78,6 @@
|
|
79
78
|
|
80
79
|
console.log("%c🔥 程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:DuoSco团队 | 官网:https://github.com/DuoSco/Hexo-theme-solitude 😋", "color:#fff; background: linear-gradient(270deg, #18d7d3, #68b7dd, #8695e6, #986fee); padding: 8px 15px; border-radius: 8px");
|
81
80
|
</script>
|
82
|
-
<% if(theme.ai.enable){ %>
|
81
|
+
<% if(theme.thirdparty.ai.enable){ %>
|
83
82
|
<%- js('/lib/chuckle-post-ai') %>
|
84
83
|
<% } %>
|
@@ -18,9 +18,9 @@
|
|
18
18
|
</div>
|
19
19
|
<script>
|
20
20
|
var fdata = {
|
21
|
-
apiurl: "<%= theme.circle.api %>",
|
21
|
+
apiurl: "<%= theme.thirdparty.circle.api %>",
|
22
22
|
defaultFish: 100,
|
23
23
|
hungryFish: 100,
|
24
24
|
}
|
25
25
|
</script>
|
26
|
-
|
26
|
+
<%- js('/lib/friends_post') %>
|
@@ -1,25 +1,6 @@
|
|
1
1
|
<div class="post-reward">
|
2
|
-
<div class="reward-button button--animated" title="赞赏作者">
|
3
|
-
<
|
4
|
-
if (utils.isMobile()) {
|
5
|
-
const showReward = () => {
|
6
|
-
const rewardMain = document.querySelector('.reward-main');
|
7
|
-
rewardMain.style.display = 'flex';
|
8
|
-
document.addEventListener('touchstart', hideReward);
|
9
|
-
};
|
10
|
-
const hideReward = () => {
|
11
|
-
const rewardMain = document.querySelector('.reward-main');
|
12
|
-
rewardMain.style.display = 'none';
|
13
|
-
document.removeEventListener('touchstart', hideReward);
|
14
|
-
};
|
15
|
-
const rewardButton = document.querySelector('.reward-button');
|
16
|
-
rewardButton.addEventListener('touchstart', event => {
|
17
|
-
event.stopPropagation();
|
18
|
-
showReward();
|
19
|
-
});
|
20
|
-
}
|
21
|
-
</script>
|
22
|
-
<i class="heofont icon-hand-heart-fill"></i>
|
2
|
+
<div class="reward-button button--animated" onclick="AddRewardMask()" title="赞赏作者">
|
3
|
+
<i class="scoicon sco-hand-heart-fill"></i>
|
23
4
|
打赏作者
|
24
5
|
</div>
|
25
6
|
<div class="reward-main">
|
@@ -49,4 +30,31 @@
|
|
49
30
|
</a>
|
50
31
|
</ul>
|
51
32
|
</div>
|
52
|
-
</div>
|
33
|
+
</div>
|
34
|
+
<script type="text/javascript">
|
35
|
+
function RemoveRewardMask() {
|
36
|
+
let rewardMainElements = document.querySelectorAll(".reward-main");
|
37
|
+
let quitBoxElement = document.querySelector("#quit-box");
|
38
|
+
|
39
|
+
rewardMainElements.forEach(element => {
|
40
|
+
element.style.display = "none";
|
41
|
+
});
|
42
|
+
|
43
|
+
if (quitBoxElement) {
|
44
|
+
quitBoxElement.style.display = "none";
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function AddRewardMask() {
|
49
|
+
let rewardMainElements = document.querySelectorAll(".reward-main");
|
50
|
+
let quitBoxElement = document.querySelector("#quit-box");
|
51
|
+
|
52
|
+
rewardMainElements.forEach(element => {
|
53
|
+
element.style.display = "flex";
|
54
|
+
});
|
55
|
+
|
56
|
+
if (quitBoxElement) {
|
57
|
+
quitBoxElement.style.display = "flex";
|
58
|
+
}
|
59
|
+
}
|
60
|
+
</script>
|
@@ -11,15 +11,17 @@
|
|
11
11
|
</div>
|
12
12
|
<div class="post-tools" id="post-tools">
|
13
13
|
<div class="post-tools-left">
|
14
|
-
<% if(theme.post.award.enable){%>
|
14
|
+
<% if(theme.post.award.enable){ %>
|
15
15
|
<%- partial('/award', {cache: true}) %>
|
16
|
-
<%} %>
|
17
|
-
|
18
|
-
<
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
<% } %>
|
17
|
+
<% if(theme.footer.rss.enable){ %>
|
18
|
+
<div class="reward-link mode">
|
19
|
+
<a class="reward-link-button" href="<%- theme.footer.rss.url %>">
|
20
|
+
<i class="scoicon sco-plant-fill"></i>
|
21
|
+
订阅
|
22
|
+
</a>
|
23
|
+
</div>
|
24
|
+
<% } %>
|
23
25
|
</div>
|
24
26
|
</div>
|
25
27
|
<div class="post-copyright__notice">
|
@@ -8,11 +8,11 @@
|
|
8
8
|
<%= page.cc %>
|
9
9
|
</a>
|
10
10
|
<% if (page.categories.data.length) { %>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
<span class="post-meta-categories">
|
12
|
+
<% page.categories.data.forEach(item => { %>
|
13
|
+
<a class="post-meta-categories" href="<%= url_for(item.path) %>"><%= item.name %></a>
|
14
|
+
<% }) %>
|
15
|
+
</span>
|
16
16
|
<% } %>
|
17
17
|
<div class="tag_share">
|
18
18
|
<div class="post-meta__tag-list">
|
@@ -29,10 +29,12 @@
|
|
29
29
|
<h1 class="post-title"><%= page.title %></h1>
|
30
30
|
<div id="post-meta">
|
31
31
|
<div class="meta-secondline">
|
32
|
-
|
32
|
+
<% if(theme.post.meta.date){ %>
|
33
|
+
<span class="post-meta-date" title="发布于">
|
33
34
|
<i class="post-meta-icon scoicon sco-calendar-todo-fill"></i>
|
34
35
|
<time datetime="<%= moment(page.date).format() %>"></time>
|
35
36
|
</span>
|
37
|
+
<% } %>
|
36
38
|
<% if(theme.post.meta.updated){ %>
|
37
39
|
<span class="post-meta-date" title="更新于">
|
38
40
|
<i class="post-meta-icon scoicon sco-refresh-line"></i>
|
@@ -66,7 +68,7 @@
|
|
66
68
|
<span id="twikoo_visitors"><i class="scoicon sco-loading-line"></i></span>
|
67
69
|
<% }else{ %>
|
68
70
|
<span id="busuanzi_value_page_pv"><i class="scoicon sco-loading-line"></i></span>
|
69
|
-
<% } %>
|
71
|
+
<% } %>
|
70
72
|
</span>
|
71
73
|
<% } %>
|
72
74
|
<% if(theme.post.meta.comment && page.comment){ %>
|
@@ -76,8 +78,8 @@
|
|
76
78
|
<span id="twikoo-count"><i class="scoicon sco-loading-line"></i></span>
|
77
79
|
</a>
|
78
80
|
</span>
|
79
|
-
<% } %>
|
81
|
+
<% } %>
|
80
82
|
</div>
|
81
83
|
</div>
|
82
84
|
</div>
|
83
|
-
<%- partial('partial/compoment/post/wave', {cache: true}) %>
|
85
|
+
<%- partial('partial/compoment/post/wave', {cache: true}) %>
|
@@ -96,9 +96,14 @@
|
|
96
96
|
<div class="cookies-window-content">
|
97
97
|
<span class="cookies-tip">查看本站为你的个人隐私做出的努力</span>
|
98
98
|
<a class="cookies-link" href="/privacy/" title="本站如何保护你的隐私" data-pjax-state="">
|
99
|
-
<i class="
|
99
|
+
<i class="scoicon sco-arrow-right-circle-fill"></i>
|
100
100
|
</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
|
-
|
104
|
-
|
103
|
+
<% if(theme.post.award.enable){%>
|
104
|
+
<div id="quit-box" onclick="RemoveRewardMask()" style="display: none"></div>
|
105
|
+
<%} %>
|
106
|
+
<% if(theme.comment.enable){ %>
|
107
|
+
<div class="comment-barrage">
|
108
|
+
</div>
|
109
|
+
<% } %>
|
package/layout/partial/nav.ejs
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
<% if (theme.site.name.class === 'i_class') { %>
|
12
12
|
<i class="<%= theme.site.name.custom %>" style="font-size: 16px;"></i>
|
13
13
|
<% } else if (theme.site.name.class === 'img') { %>
|
14
|
-
<
|
14
|
+
<img src="<%= url_for(theme.site.name.custom) %>"></img>
|
15
15
|
<% } else if (theme.site.name.class === 'text') { %>
|
16
16
|
<span class="scoicon"><%= theme.site.name.custom %></span>
|
17
17
|
<% } %>
|
package/layout/post.ejs
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
<%- partial('partial/compoment/aside/aside') %>
|
34
34
|
|
35
|
-
<% if(theme.ai.enable){ %>
|
35
|
+
<% if(theme.thirdparty.ai.enable){ %>
|
36
36
|
<script data-pjax defer>
|
37
37
|
// AI构造函数
|
38
38
|
new ChucklePostAI({
|
@@ -40,12 +40,12 @@
|
|
40
40
|
// 文章内容所在的元素属性的选择器,也是AI挂载的容器,AI将会挂载到该容器的最前面
|
41
41
|
el: '#post #article-container',
|
42
42
|
// 驱动AI所必须的key,即是tianliGPT后端服务所必须的key
|
43
|
-
key: '<%= theme.ai.key %>',
|
43
|
+
key: '<%= theme.thirdparty.ai.key %>',
|
44
44
|
/* 非必须配置,但最好根据自身需要进行配置 */
|
45
45
|
// 文章标题所在的元素属性的选择器,默认获取当前网页的标题
|
46
46
|
title_el: '.post-title',
|
47
47
|
// 文章推荐方式,all:匹配数据库内所有文章进行推荐,web:仅当前站内的文章,默认all
|
48
|
-
rec_method: '<%= theme.ai.rec_method || 'web' %>',
|
48
|
+
rec_method: '<%= theme.thirdparty.ai.rec_method || 'web' %>',
|
49
49
|
})
|
50
50
|
</script>
|
51
51
|
<% } %>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-solitude",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.3",
|
4
4
|
"description": "A beautiful, powerful, and efficient Hexo theme developed by the DuoSco team",
|
5
5
|
"scripts": {
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
@@ -20,4 +20,4 @@
|
|
20
20
|
"url": "https://github.com/DuoSco/Hexo-theme-solitude/issues"
|
21
21
|
},
|
22
22
|
"homepage": "https://github.com/DuoSco/hexo-theme-solitude#readme"
|
23
|
-
}
|
23
|
+
}
|
package/scripts/helper/charts.js
CHANGED
@@ -1,38 +1,41 @@
|
|
1
|
-
const cheerio = require('cheerio')
|
2
|
-
const moment = require('moment')
|
3
|
-
|
4
1
|
hexo.extend.filter.register('after_render:html', function (locals) {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
try {
|
3
|
+
const cheerio = require('cheerio')
|
4
|
+
const $ = cheerio.load(locals)
|
5
|
+
const post = $('#posts-chart')
|
6
|
+
const tag = $('#tags-chart')
|
7
|
+
const category = $('#categories-chart')
|
8
|
+
const htmlEncode = false
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
if (post.length > 0 || tag.length > 0 || category.length > 0) {
|
11
|
+
if (post.length > 0 && $('#postsChart').length === 0) {
|
12
|
+
if (post.attr('data-encode') === 'true') htmlEncode = true
|
13
|
+
post.after(postsChart(post.attr('data-start')))
|
14
|
+
}
|
15
|
+
if (tag.length > 0 && $('#tagsChart').length === 0) {
|
16
|
+
if (tag.attr('data-encode') === 'true') htmlEncode = true
|
17
|
+
tag.after(tagsChart(tag.attr('data-length')))
|
18
|
+
}
|
19
|
+
if (category.length > 0 && $('#categoriesChart').length === 0) {
|
20
|
+
if (category.attr('data-encode') === 'true') htmlEncode = true
|
21
|
+
category.after(categoriesChart(category.attr('data-parent')))
|
22
|
+
}
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
if (htmlEncode) {
|
25
|
+
return $.root().html().replace(/&#/g, '&#')
|
26
|
+
} else {
|
27
|
+
return $.root().html()
|
28
|
+
}
|
27
29
|
} else {
|
28
|
-
return
|
30
|
+
return locals
|
29
31
|
}
|
30
|
-
}
|
31
|
-
|
32
|
+
} catch (e) {
|
33
|
+
|
32
34
|
}
|
33
35
|
}, 15)
|
34
36
|
|
35
|
-
function postsChart
|
37
|
+
function postsChart(startMonth) {
|
38
|
+
const moment = require('moment')
|
36
39
|
const startDate = moment(startMonth || '2020-01')
|
37
40
|
const endDate = moment()
|
38
41
|
|
@@ -164,12 +167,14 @@ function postsChart (startMonth) {
|
|
164
167
|
</script>`
|
165
168
|
}
|
166
169
|
|
167
|
-
function tagsChart
|
170
|
+
function tagsChart(len) {
|
168
171
|
const tagArr = []
|
169
172
|
hexo.locals.get('tags').map(function (tag) {
|
170
|
-
tagArr.push({
|
173
|
+
tagArr.push({name: tag.name, value: tag.length, path: tag.path})
|
174
|
+
})
|
175
|
+
tagArr.sort((a, b) => {
|
176
|
+
return b.value - a.value
|
171
177
|
})
|
172
|
-
tagArr.sort((a, b) => { return b.value - a.value })
|
173
178
|
|
174
179
|
const dataLength = Math.min(tagArr.length, len) || tagArr.length
|
175
180
|
const tagNameArr = []
|
@@ -285,7 +290,7 @@ function tagsChart (len) {
|
|
285
290
|
</script>`
|
286
291
|
}
|
287
292
|
|
288
|
-
function categoriesChart
|
293
|
+
function categoriesChart(dataParent) {
|
289
294
|
const categoryArr = []
|
290
295
|
let categoryParentFlag = false
|
291
296
|
hexo.locals.get('categories').map(function (category) {
|
@@ -299,8 +304,11 @@ function categoriesChart (dataParent) {
|
|
299
304
|
})
|
300
305
|
})
|
301
306
|
categoryParentFlag = categoryParentFlag && dataParent === 'true'
|
302
|
-
categoryArr.sort((a, b) => {
|
303
|
-
|
307
|
+
categoryArr.sort((a, b) => {
|
308
|
+
return b.value - a.value
|
309
|
+
})
|
310
|
+
|
311
|
+
function translateListToTree(data, parent) {
|
304
312
|
let tree = []
|
305
313
|
let temp
|
306
314
|
data.forEach((item, index) => {
|
@@ -316,7 +324,10 @@ function categoriesChart (dataParent) {
|
|
316
324
|
})
|
317
325
|
return tree
|
318
326
|
}
|
319
|
-
|
327
|
+
|
328
|
+
const categoryNameJson = JSON.stringify(categoryArr.map(function (category) {
|
329
|
+
return category.name
|
330
|
+
}))
|
320
331
|
const categoryArrJson = JSON.stringify(categoryArr)
|
321
332
|
const categoryArrParentJson = JSON.stringify(translateListToTree(categoryArr, '0'))
|
322
333
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Solitude
|
3
3
|
* Related Posts
|
4
4
|
* According the tag
|
5
5
|
*/
|
@@ -42,7 +42,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
|
42
42
|
const dateType = config.related_post.date_type || 'created'
|
43
43
|
const headlineLang = this._p('喜欢这篇的人也看了')
|
44
44
|
|
45
|
-
relatedPosts = relatedPosts.sort(compare('weight'))
|
45
|
+
relatedPosts = relatedPosts.sort(compare('weight', dateType))
|
46
46
|
|
47
47
|
if (relatedPosts.length > 0) {
|
48
48
|
result += '<div class="relatedPosts">'
|
@@ -82,10 +82,17 @@ function findItem(arrayToSearch, attr, val) {
|
|
82
82
|
return -1
|
83
83
|
}
|
84
84
|
|
85
|
-
function compare(attr) {
|
85
|
+
function compare(attr, dateType) {
|
86
86
|
return function (a, b) {
|
87
87
|
const val1 = a[attr]
|
88
88
|
const val2 = b[attr]
|
89
|
+
if (val1 === val2) {
|
90
|
+
if (dateType === 'created') {
|
91
|
+
return b.created - a.created
|
92
|
+
} else if (dateType === 'updated') {
|
93
|
+
return b.updated - a.updated
|
94
|
+
}
|
95
|
+
}
|
89
96
|
return val2 - val1
|
90
97
|
}
|
91
98
|
}
|
package/scripts/tags/fold.js
CHANGED
@@ -7,10 +7,9 @@
|
|
7
7
|
|
8
8
|
function postTabs(args, content) {
|
9
9
|
const title = args[0] ? args[0] : ""
|
10
|
-
const
|
11
|
-
const open = args[2] ? args[2] : ""
|
10
|
+
const open = args[1] ? args[1] : ""
|
12
11
|
|
13
|
-
return `<details ${open}><summary>${title
|
12
|
+
return `<details ${open}><summary>${title}</summary><div class="content">${hexo.render.renderSync({
|
14
13
|
text: content,
|
15
14
|
engine: 'markdown'
|
16
15
|
})}</div></details>`
|
package/scripts/tags/note.js
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
-
hexo.extend.tag.register('note', function(
|
2
|
-
|
1
|
+
hexo.extend.tag.register('note', function (types, content) {
|
2
|
+
let type = ""
|
3
|
+
for (let i = 0; i < types.length; i++) {
|
4
|
+
type += " " + types[i]
|
5
|
+
}
|
6
|
+
return `<div class="note ${type}">${hexo.render.renderSync({text: content, engine: 'markdown'})}</div>`
|
3
7
|
}, {ends: true});
|
package/scripts/tags/tabs.js
CHANGED
@@ -41,7 +41,7 @@ function postTabs (args, content) {
|
|
41
41
|
|
42
42
|
const isOnlyicon = tabIcon.length > 0 && tabCaption.length === 0 ? ' style="text-align: center;"' : ''
|
43
43
|
const icon = tabIcon.trim()
|
44
|
-
tabIcon.length > 0 && (tabIcon = `<
|
44
|
+
tabIcon.length > 0 && (tabIcon = `<i ${isOnlyicon} class="tab scoicon ${icon}"></i>`)
|
45
45
|
|
46
46
|
const toTop = '<button type="button" class="tab-to-top" aria-label="scroll to top"><i class="scoicon sco-arrow-up-line"></i></button>'
|
47
47
|
|