Skip to content

Commit

Permalink
Merge pull request #228 from EvanNotFound/dev
Browse files Browse the repository at this point in the history
v2.4.3
  • Loading branch information
EvanNotFound authored Aug 22, 2023
2 parents a6ea3e7 + 1d47c10 commit 3a4ef9a
Show file tree
Hide file tree
Showing 23 changed files with 579 additions and 436 deletions.
43 changes: 20 additions & 23 deletions DONATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,26 @@

## 引言 / Introduction

刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。
Initially, this theme was created for my personal use, but later, some readers came across my blog and asked me how I
customized it.

想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多
Star,在这里非常感谢各位的支持。
After giving it some thought, I decided to start a project. Along the way, I encountered some challenges and went
through several versions. I also received valuable feedback from many users. Moreover, it's the first time I've received
such a high number of stars. I want to express my sincere appreciation for all your support.

本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr
做 cdn,但是那个速度真的感人。
Originally, I hadn't planned on requesting any contributions. However, currently, the average monthly consumption of
downstream traffic on Aliyun in China is around 100GB, and my monthly traffic cost is approximately 20 yuan. I
considered switching to unpkg/jsdelivr as a CDN, but the speed there is truly disappointing.

如果各位能支持一下,**一块两块都已足够**,就能维持阿里云 CDN 的流量费用,本人实在是感激不尽。
If any of you could provide some support, even a small amount such as one or two yuan, it would be sufficient to cover
the CDN traffic cost on Aliyun. I would be immensely grateful for your assistance.

感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力!
Thank you to all the friends who have sponsored this project. Your support is what motivates me to keep updating and
improving it!
刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。

想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多 Star,在这里非常感谢各位的支持。

本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr 做 CDN,但是那个速度真的感人。

如果各位能支持一下,一块两块都已足够,就能维持阿里云 CDN 的流量费用,本人实在是感激不尽。

感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力!

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.

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.

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.

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.

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!


## 赞助方法 / Sponsorship Methods

Expand Down
4 changes: 2 additions & 2 deletions layout/_partials/home-banner.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
</div>
<% } %>

<div class="home-banner-container flex-center transition-fade">
<div class="content flex-center">
<div class="home-banner-container flex justify-center items-center transition-fade">
<div class="content flex justify-center items-center">
<div class="description flex flex-col justify-center items-center"
<% if (theme.home_banner.custom_font.enable) { %>
style="font-family: '<%- theme.home_banner.custom_font.family %>', sans-serif; !important;"
Expand Down
14 changes: 7 additions & 7 deletions layout/_partials/navbar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@
</div>

<!-- Mobile drawer -->
<div class="navbar-drawer">
<ul class="drawer-navbar-list">
<div class="navbar-drawer w-full absolute top-0 left-0 bg-background-color">
<ul class="drawer-navbar-list flex flex-col justify-start items-center">
<% for (let i in theme.navbar.links) { %>
<% if (theme.navbar.links[i].path === 'none') {} else {%>
<li class="drawer-navbar-item flex-center">
<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' : '' %>" <% } %>
<li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
<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' : '' %>" <% } %>
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 {%><% } %>>
<% if (theme.navbar.links[i].submenus) { %>
<% if (theme.navbar.links[i].icon) { %>
<i class="<%- theme.navbar.links[i].icon %>"></i>
<% } %>
<%= __(i.toLowerCase()).toUpperCase() %>&nbsp;<i class="fa-solid fa-chevron-down"></i>
<%= __(i.toLowerCase()).toUpperCase() %>&nbsp;<i class="group-hover:rotate-180 transition-transform fa-solid fa-chevron-down"></i>
<% } else {%>
<% if (theme.navbar.links[i].icon) { %>
<i class="<%- theme.navbar.links[i].icon %>"></i>
Expand All @@ -92,8 +92,8 @@
<!-- Submenu -->
<% if (theme.navbar.links[i].submenus) { %>
<% for (var submenu in theme.navbar.links[i].submenus){ %>
<li class="dropdown-item flex-center">
<a class="dropdown-item" href="<%- url_for(theme.navbar.links[i].submenus[submenu]) %>"><%= __(submenu.toLowerCase()).toUpperCase() %></a>
<li class="text-base flex justify-center items-center hover:underline active:underline hover:underline-offset-1 rounded-3xl">
<a class="py-0.5" href="<%- url_for(theme.navbar.links[i].submenus[submenu]) %>"><%= __(submenu.toLowerCase()).toUpperCase() %></a>
</li>
<% } %>
<% } %>
Expand Down
12 changes: 7 additions & 5 deletions layout/_partials/scripts.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%- renderJS([
<%- renderModuleJS([
'js/utils.js',
'js/main.js',
'js/layouts/navbarShrink.js',
Expand Down Expand Up @@ -37,16 +37,18 @@

<% if (theme.masonry || theme.photos || theme.gallery) { %>
<%- renderJS('js/libs/minimasonry.min.js') %>
<%- renderJS('js/plugins/masonry.js') %>
<%- renderModuleJS('js/plugins/masonry.js') %>
<% } %>

<div class="post-scripts" <%= theme.global.single_page === true ? 'data-swup-reload-script' : '' %>>
<% if (theme.articles.toc.enable) { %>
<%- renderJS([
<%- renderJS('js/libs/anime.min.js')%>
<%- renderModuleJS([
'js/tools/tocToggle.js',
'js/layouts/toc.js',
'js/libs/anime.min.js',
'js/plugins/tabs.js',
'js/plugins/tabs.js'
]) %>
<% } %>
</div>
23 changes: 11 additions & 12 deletions layout/_widgets/essays.ejs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<div class="essays-container">
<div>
<h1 class="essays-header"><%= page.title %></h1>
</div>
<ul class="essays-list">
<% const newessays = theme.essays.sort((a, b) => {
<div class="mb-4">
<h1 class="page-title-header"><%= page.title %></h1>
<ul class="flex flex-col mb-4 gap-6">
<%
const newessays = theme.essays.sort((a, b) => {
return moment(b.date).diff(a.date);
});
%>
<% for (const e of newessays) { %>
<li class="essay-item">
<div class="essay-avatar"><%- image_tag(theme.defaults.avatar) %></div>
<div class="essay-content">
<div class="content"><%- markdown(e.content) %></div>
<div class="date"><%- date(e.date, config.date_format) %></div>
<li class="w-full flex flex-row relative">
<div class="w-10 h-10 mr-4 rounded-lg overflow-hidden"><%- image_tag(theme.defaults.avatar, {class: "w-full h-full"}) %></div>
<div class="w-full border-border-color rounded-xl rounded-tl-none redefine-box-shadow-flat overflow-hidden">
<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>
<div id="shuoshuo-content" class="px-4 py-2"><%- markdown(e.content) %></div>
</div>
<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>
</li>
<% } %>
</ul>
<div class="clear"></div>
</div>
4 changes: 1 addition & 3 deletions layout/_widgets/masonry.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
const images = theme.masonry;
%>

<div>
<h1 class="masonry-header"><%= page.title %></h1>
</div>
<h1 class="page-title-header"><%= page.title %></h1>

<div class="loading-placeholder">
<div class="flex-grid generic-card">
Expand Down
22 changes: 11 additions & 11 deletions layout/_widgets/side-tools.ejs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div class="side-tools-container">
<ul class="hidden-tools-list">
<li class="right-bottom-tools tool-font-adjust-plus flex-center">
<li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center">
<i class="fa-regular fa-magnifying-glass-plus"></i>
</li>

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

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

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

<!-- rss -->
<% if (theme.plugins.feed.enable && config.feed) { %>
<li class="right-bottom-tools rss flex-center">
<a class="flex-center"
<li class="right-bottom-tools rss flex justify-center items-center">
<a class="flex justify-center items-center"
href="<%= '/' + config.feed.path %>"
target="_blank"
>
Expand All @@ -29,28 +29,28 @@
<% } %>

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

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

<ul class="visible-tools-list">
<li class="right-bottom-tools toggle-tools-list flex-center">
<li class="right-bottom-tools toggle-tools-list flex justify-center items-center">
<i class="fa-regular fa-cog fa-spin"></i>
</li>
<% if (theme.global.scroll_progress.percentage === true) { %>
<li class="right-bottom-tools tool-scroll-to-top flex-center">
<li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
<i class="arrow-up fas fa-arrow-up"></i>
<span class="percent"></span>
</li>
<% } %>
<% if (theme.plugins.aplayer.enable && theme.plugins.aplayer.type === "mini") { %>
<li class="right-bottom-tools tool-aplayer flex-center">
<li class="right-bottom-tools tool-aplayer flex justify-center items-center">
</li>
<% } %>
Expand Down
8 changes: 4 additions & 4 deletions layout/article-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@
rel="prev"
href="<%= url_for(page.prev.path) %>"
>
<span class="left arrow-icon flex-center">
<span class="left arrow-icon flex justify-center items-center">
<i class="fa-solid fa-chevron-left"></i>
</span>
<span class="title flex-center">
<span class="title flex justify-center items-center">
<span class="post-nav-title-item"><%= page.prev.title %></span>
<span class="post-nav-item"><%= __('prev_posts') %></span>
</span>
Expand All @@ -124,11 +124,11 @@
rel="next"
href="<%= url_for(page.next.path) %>"
>
<span class="title flex-center">
<span class="title flex justify-center items-center">
<span class="post-nav-title-item"><%= page.next.title %></span>
<span class="post-nav-item"><%= __('next_posts') %></span>
</span>
<span class="right arrow-icon flex-center">
<span class="right arrow-icon flex justify-center items-center">
<i class="fa-solid fa-chevron-right"></i>
</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-redefine",
"version": "2.4.2",
"version": "2.4.3",
"private": false,
"description": "Redefine your writing in Hexo Theme Redefine",
"scripts": {
Expand Down
40 changes: 11 additions & 29 deletions scripts/helpers/themeHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ hexo.extend.helper.register("renderJS", function (path) {
return t;
});

hexo.extend.helper.register("renderPjaxJS", function (path) {
hexo.extend.helper.register("renderModuleJS", function (path) {
const _js = hexo.extend.helper.get("js").bind(hexo);
const urlRender = hexo.extend.helper.get("url_for").bind(hexo);
const cdnProviders = {
unpkg: "https://unpkg.com",
jsdelivr: "https://cdn.jsdelivr.net/npm",
Expand All @@ -140,34 +139,17 @@ hexo.extend.helper.register("renderPjaxJS", function (path) {
const cdnPathHandle = (path) => {
const cdnBase =
cdnProviders[this.theme.cdn.provider] || cdnProviders.aliyun;
const renderedPath = urlRender(path);

if (this.theme.global.single_page === true) {
if (this.theme.cdn.provider === "custom") {
const customUrl = cdnBase
.replace("${version}", themeVersion)
.replace("${path}", path);
return this.theme.cdn.enable
? `<script data-swup-reload-script src="${customUrl}"></script>`
: `<script data-swup-reload-script src="${renderedPath}"></script>`;
} else {
return this.theme.cdn.enable
? `<script data-swup-reload-script src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
: `<script data-swup-reload-script src="${renderedPath}"></script>`;
}
if (this.theme.cdn.provider === "custom") {
const customUrl = cdnBase
.replace("${version}", themeVersion)
.replace("${path}", path);
return this.theme.cdn.enable
? `<script type="module" src="${customUrl}"></script>`
: _js({ src: path, type: "module" });
} else {
if (this.theme.cdn.provider === "custom") {
const customUrl = cdnBase
.replace("${version}", themeVersion)
.replace("${path}", path);
return this.theme.cdn.enable
? `<script src="${customUrl}"></script>`
: _js(path);
} else {
return this.theme.cdn.enable
? `<script src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
: _js(path);
}
return this.theme.cdn.enable
? `<script type="module" src="${cdnBase}/hexo-theme-redefine@${themeVersion}/source/${path}"></script>`
: _js({ src: path, type: "module" });
}
};

Expand Down
Loading

0 comments on commit 3a4ef9a

Please sign in to comment.