Skip to content

Commit 3a4ef9a

Browse files
authored
Merge pull request #228 from EvanNotFound/dev
v2.4.3
2 parents a6ea3e7 + 1d47c10 commit 3a4ef9a

File tree

23 files changed

+579
-436
lines changed

23 files changed

+579
-436
lines changed

DONATION.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,26 @@
55

66
## 引言 / Introduction
77

8-
刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。
9-
Initially, this theme was created for my personal use, but later, some readers came across my blog and asked me how I
10-
customized it.
11-
12-
想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多
13-
Star,在这里非常感谢各位的支持。
14-
After giving it some thought, I decided to start a project. Along the way, I encountered some challenges and went
15-
through several versions. I also received valuable feedback from many users. Moreover, it's the first time I've received
16-
such a high number of stars. I want to express my sincere appreciation for all your support.
17-
18-
本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr
19-
做 cdn,但是那个速度真的感人。
20-
Originally, I hadn't planned on requesting any contributions. However, currently, the average monthly consumption of
21-
downstream traffic on Aliyun in China is around 100GB, and my monthly traffic cost is approximately 20 yuan. I
22-
considered switching to unpkg/jsdelivr as a CDN, but the speed there is truly disappointing.
23-
24-
如果各位能支持一下,**一块两块都已足够**,就能维持阿里云 CDN 的流量费用,本人实在是感激不尽。
25-
If any of you could provide some support, even a small amount such as one or two yuan, it would be sufficient to cover
26-
the CDN traffic cost on Aliyun. I would be immensely grateful for your assistance.
27-
28-
感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力!
29-
Thank you to all the friends who have sponsored this project. Your support is what motivates me to keep updating and
30-
improving it!
8+
刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。
9+
10+
想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多 Star,在这里非常感谢各位的支持。
11+
12+
本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr 做 CDN,但是那个速度真的感人。
13+
14+
如果各位能支持一下,一块两块都已足够,就能维持阿里云 CDN 的流量费用,本人实在是感激不尽。
15+
16+
感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力!
17+
18+
Initially, I designed this theme just for my personal use. However, as time went on, some readers stumbled upon my blog and inquired about the customizations I had made.
19+
20+
After giving it some thought, I decided to turn this into a project. Along the journey, I encountered a few bumps and went through several iterations. I also received valuable feedback from numerous users. And it's quite exhilarating to see it receiving such a high number of stars for the first time. I want to express my genuine appreciation for all the support you've shown.
21+
22+
At first, I hadn't really thought about asking for contributions. But at present, the average monthly data consumption on Aliyun in China is around 100GB. My monthly data costs are roughly 20 yuan. I considered switching to unpkg/jsdelivr for a CDN, but the speed there is a real letdown.
23+
24+
If any of you could provide a bit of support, even a small amount like one or two dollars, it would be enough to cover the CDN data costs on Aliyun. I would be incredibly thankful for your help.
25+
26+
A big thank you to all the friends who have sponsored this project. Your support is what keeps me motivated to keep refining and updating it!
27+
3128

3229
## 赞助方法 / Sponsorship Methods
3330

layout/_partials/home-banner.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
</div>
3636
<% } %>
3737

38-
<div class="home-banner-container flex-center transition-fade">
39-
<div class="content flex-center">
38+
<div class="home-banner-container flex justify-center items-center transition-fade">
39+
<div class="content flex justify-center items-center">
4040
<div class="description flex flex-col justify-center items-center"
4141
<% if (theme.home_banner.custom_font.enable) { %>
4242
style="font-family: '<%- theme.home_banner.custom_font.family %>', sans-serif; !important;"

layout/_partials/navbar.ejs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@
6969
</div>
7070

7171
<!-- Mobile drawer -->
72-
<div class="navbar-drawer">
73-
<ul class="drawer-navbar-list">
72+
<div class="navbar-drawer w-full absolute top-0 left-0 bg-background-color">
73+
<ul class="drawer-navbar-list flex flex-col justify-start items-center">
7474
<% for (let i in theme.navbar.links) { %>
7575
<% if (theme.navbar.links[i].path === 'none') {} else {%>
76-
<li class="drawer-navbar-item flex-center">
77-
<a class="<% if (theme.navbar.links[i].submenus) { %>has-dropdown" <% } else {%><%- isInHomePaging(page.path, theme.navbar.links[i].path) ? 'active' : is_current(theme.navbar.links[i].path) ? 'active' : '' %>" <% } %>
76+
<li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
77+
<a class="rounded-3xl py-1.5 px-5 hover:border hover:!text-primary active:!text-primary group <% if (theme.navbar.links[i].submenus) { %>has-dropdown" <% } else {%><%- isInHomePaging(page.path, theme.navbar.links[i].path) ? 'active' : is_current(theme.navbar.links[i].path) ? 'active' : '' %>" <% } %>
7878
href="<% if (theme.navbar.links[i].submenus) { %>#"<% } else {%><%- url_for(theme.navbar.links[i].path) %>" <% } %> <% if (theme.navbar.links[i].submenus) { %>onClick="return false;"<% } else {%><% } %>>
7979
<% if (theme.navbar.links[i].submenus) { %>
8080
<% if (theme.navbar.links[i].icon) { %>
8181
<i class="<%- theme.navbar.links[i].icon %>"></i>
8282
<% } %>
83-
<%= __(i.toLowerCase()).toUpperCase() %>&nbsp;<i class="fa-solid fa-chevron-down"></i>
83+
<%= __(i.toLowerCase()).toUpperCase() %>&nbsp;<i class="group-hover:rotate-180 transition-transform fa-solid fa-chevron-down"></i>
8484
<% } else {%>
8585
<% if (theme.navbar.links[i].icon) { %>
8686
<i class="<%- theme.navbar.links[i].icon %>"></i>
@@ -92,8 +92,8 @@
9292
<!-- Submenu -->
9393
<% if (theme.navbar.links[i].submenus) { %>
9494
<% for (var submenu in theme.navbar.links[i].submenus){ %>
95-
<li class="dropdown-item flex-center">
96-
<a class="dropdown-item" href="<%- url_for(theme.navbar.links[i].submenus[submenu]) %>"><%= __(submenu.toLowerCase()).toUpperCase() %></a>
95+
<li class="text-base flex justify-center items-center hover:underline active:underline hover:underline-offset-1 rounded-3xl">
96+
<a class="py-0.5" href="<%- url_for(theme.navbar.links[i].submenus[submenu]) %>"><%= __(submenu.toLowerCase()).toUpperCase() %></a>
9797
</li>
9898
<% } %>
9999
<% } %>

layout/_partials/scripts.ejs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<%- renderJS([
1+
<%- renderModuleJS([
22
'js/utils.js',
33
'js/main.js',
44
'js/layouts/navbarShrink.js',
@@ -37,16 +37,18 @@
3737

3838
<% if (theme.masonry || theme.photos || theme.gallery) { %>
3939
<%- renderJS('js/libs/minimasonry.min.js') %>
40-
<%- renderJS('js/plugins/masonry.js') %>
40+
<%- renderModuleJS('js/plugins/masonry.js') %>
41+
4142
<% } %>
4243

4344
<div class="post-scripts" <%= theme.global.single_page === true ? 'data-swup-reload-script' : '' %>>
4445
<% if (theme.articles.toc.enable) { %>
45-
<%- renderJS([
46+
<%- renderJS('js/libs/anime.min.js')%>
47+
<%- renderModuleJS([
4648
'js/tools/tocToggle.js',
4749
'js/layouts/toc.js',
48-
'js/libs/anime.min.js',
49-
'js/plugins/tabs.js',
50+
51+
'js/plugins/tabs.js'
5052
]) %>
5153
<% } %>
5254
</div>

layout/_widgets/essays.ejs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
<div class="essays-container">
2-
<div>
3-
<h1 class="essays-header"><%= page.title %></h1>
4-
</div>
5-
<ul class="essays-list">
6-
<% const newessays = theme.essays.sort((a, b) => {
1+
<div class="mb-4">
2+
<h1 class="page-title-header"><%= page.title %></h1>
3+
<ul class="flex flex-col mb-4 gap-6">
4+
<%
5+
const newessays = theme.essays.sort((a, b) => {
76
return moment(b.date).diff(a.date);
87
});
98
%>
109
<% for (const e of newessays) { %>
11-
<li class="essay-item">
12-
<div class="essay-avatar"><%- image_tag(theme.defaults.avatar) %></div>
13-
<div class="essay-content">
14-
<div class="content"><%- markdown(e.content) %></div>
15-
<div class="date"><%- date(e.date, config.date_format) %></div>
10+
<li class="w-full flex flex-row relative">
11+
<div class="w-10 h-10 mr-4 rounded-lg overflow-hidden"><%- image_tag(theme.defaults.avatar, {class: "w-full h-full"}) %></div>
12+
<div class="w-full border-border-color rounded-xl rounded-tl-none redefine-box-shadow-flat overflow-hidden">
13+
<div class="px-4 py-1.5 text-sm border-b border-border-color bg-zinc-50 dark:bg-zinc-800 text-third-text-color"><%- moment(e.date).locale(config.language).calendar() %></div>
14+
<div id="shuoshuo-content" class="px-4 py-2"><%- markdown(e.content) %></div>
1615
</div>
16+
<div class=" absolute left-[48.5px] top-3 transform w-2 h-2 border-solid border-t border-l bg-zinc-50 -rotate-45 border-border-color dark:bg-zinc-800"></div>
1717
</li>
1818
<% } %>
1919
</ul>
20-
<div class="clear"></div>
2120
</div>

layout/_widgets/masonry.ejs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
const images = theme.masonry;
44
%>
55

6-
<div>
7-
<h1 class="masonry-header"><%= page.title %></h1>
8-
</div>
6+
<h1 class="page-title-header"><%= page.title %></h1>
97

108
<div class="loading-placeholder">
119
<div class="flex-grid generic-card">

layout/_widgets/side-tools.ejs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<div class="side-tools-container">
22
<ul class="hidden-tools-list">
3-
<li class="right-bottom-tools tool-font-adjust-plus flex-center">
3+
<li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center">
44
<i class="fa-regular fa-magnifying-glass-plus"></i>
55
</li>
66

7-
<li class="right-bottom-tools tool-font-adjust-minus flex-center">
7+
<li class="right-bottom-tools tool-font-adjust-minus flex justify-center items-center">
88
<i class="fa-regular fa-magnifying-glass-minus"></i>
99
</li>
1010

11-
<li class="right-bottom-tools tool-expand-width flex-center">
11+
<li class="right-bottom-tools tool-expand-width flex justify-center items-center">
1212
<i class="fa-regular fa-expand"></i>
1313
</li>
1414

15-
<li class="right-bottom-tools tool-dark-light-toggle flex-center">
15+
<li class="right-bottom-tools tool-dark-light-toggle flex justify-center items-center">
1616
<i class="fa-regular fa-moon"></i>
1717
</li>
1818

1919
<!-- rss -->
2020
<% if (theme.plugins.feed.enable && config.feed) { %>
21-
<li class="right-bottom-tools rss flex-center">
22-
<a class="flex-center"
21+
<li class="right-bottom-tools rss flex justify-center items-center">
22+
<a class="flex justify-center items-center"
2323
href="<%= '/' + config.feed.path %>"
2424
target="_blank"
2525
>
@@ -29,28 +29,28 @@
2929
<% } %>
3030

3131
<% if (theme.global.scroll_progress.percentage !== true) { %>
32-
<li class="right-bottom-tools tool-scroll-to-top flex-center">
32+
<li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
3333
<i class="fa-regular fa-arrow-up"></i>
3434
</li>
3535
<% } %>
3636

37-
<li class="right-bottom-tools tool-scroll-to-bottom flex-center">
37+
<li class="right-bottom-tools tool-scroll-to-bottom flex justify-center items-center">
3838
<i class="fa-regular fa-arrow-down"></i>
3939
</li>
4040
</ul>
4141

4242
<ul class="visible-tools-list">
43-
<li class="right-bottom-tools toggle-tools-list flex-center">
43+
<li class="right-bottom-tools toggle-tools-list flex justify-center items-center">
4444
<i class="fa-regular fa-cog fa-spin"></i>
4545
</li>
4646
<% if (theme.global.scroll_progress.percentage === true) { %>
47-
<li class="right-bottom-tools tool-scroll-to-top flex-center">
47+
<li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
4848
<i class="arrow-up fas fa-arrow-up"></i>
4949
<span class="percent"></span>
5050
</li>
5151
<% } %>
5252
<% if (theme.plugins.aplayer.enable && theme.plugins.aplayer.type === "mini") { %>
53-
<li class="right-bottom-tools tool-aplayer flex-center">
53+
<li class="right-bottom-tools tool-aplayer flex justify-center items-center">
5454
5555
</li>
5656
<% } %>

layout/article-content.ejs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@
108108
rel="prev"
109109
href="<%= url_for(page.prev.path) %>"
110110
>
111-
<span class="left arrow-icon flex-center">
111+
<span class="left arrow-icon flex justify-center items-center">
112112
<i class="fa-solid fa-chevron-left"></i>
113113
</span>
114-
<span class="title flex-center">
114+
<span class="title flex justify-center items-center">
115115
<span class="post-nav-title-item"><%= page.prev.title %></span>
116116
<span class="post-nav-item"><%= __('prev_posts') %></span>
117117
</span>
@@ -124,11 +124,11 @@
124124
rel="next"
125125
href="<%= url_for(page.next.path) %>"
126126
>
127-
<span class="title flex-center">
127+
<span class="title flex justify-center items-center">
128128
<span class="post-nav-title-item"><%= page.next.title %></span>
129129
<span class="post-nav-item"><%= __('next_posts') %></span>
130130
</span>
131-
<span class="right arrow-icon flex-center">
131+
<span class="right arrow-icon flex justify-center items-center">
132132
<i class="fa-solid fa-chevron-right"></i>
133133
</span>
134134
</a>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hexo-theme-redefine",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"private": false,
55
"description": "Redefine your writing in Hexo Theme Redefine",
66
"scripts": {

scripts/helpers/themeHelpers.js

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ hexo.extend.helper.register("renderJS", function (path) {
127127
return t;
128128
});
129129

130-
hexo.extend.helper.register("renderPjaxJS", function (path) {
130+
hexo.extend.helper.register("renderModuleJS", function (path) {
131131
const _js = hexo.extend.helper.get("js").bind(hexo);
132-
const urlRender = hexo.extend.helper.get("url_for").bind(hexo);
133132
const cdnProviders = {
134133
unpkg: "https://unpkg.com",
135134
jsdelivr: "https://cdn.jsdelivr.net/npm",
@@ -140,34 +139,17 @@ hexo.extend.helper.register("renderPjaxJS", function (path) {
140139
const cdnPathHandle = (path) => {
141140
const cdnBase =
142141
cdnProviders[this.theme.cdn.provider] || cdnProviders.aliyun;
143-
const renderedPath = urlRender(path);
144-
145-
if (this.theme.global.single_page === true) {
146-
if (this.theme.cdn.provider === "custom") {
147-
const customUrl = cdnBase
148-
.replace("${version}", themeVersion)
149-
.replace("${path}", path);
150-
return this.theme.cdn.enable
151-
? `<script data-swup-reload-script src="${customUrl}"></script>`
152-
: `<script data-swup-reload-script src="${renderedPath}"></script>`;
153-
} else {
154-
return this.theme.cdn.enable
155-
? `<script data-swup-reload-script src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
156-
: `<script data-swup-reload-script src="${renderedPath}"></script>`;
157-
}
142+
if (this.theme.cdn.provider === "custom") {
143+
const customUrl = cdnBase
144+
.replace("${version}", themeVersion)
145+
.replace("${path}", path);
146+
return this.theme.cdn.enable
147+
? `<script type="module" src="${customUrl}"></script>`
148+
: _js({ src: path, type: "module" });
158149
} else {
159-
if (this.theme.cdn.provider === "custom") {
160-
const customUrl = cdnBase
161-
.replace("${version}", themeVersion)
162-
.replace("${path}", path);
163-
return this.theme.cdn.enable
164-
? `<script src="${customUrl}"></script>`
165-
: _js(path);
166-
} else {
167-
return this.theme.cdn.enable
168-
? `<script src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
169-
: _js(path);
170-
}
150+
return this.theme.cdn.enable
151+
? `<script type="module" src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
152+
: _js({ src: path, type: "module" });
171153
}
172154
};
173155

0 commit comments

Comments
 (0)