Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct time display of shuoshuo & Hitokoto author #409

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ home_banner:
text: [] # subtitle text, array
hitokoto: # 一言配置
enable: false # Whether to enable hitokoto
show_author: false # Whether to show author
api: https://v1.hitokoto.cn # API URL, can add types, see https://developer.hitokoto.cn/sentence/#%E5%8F%A5%E5%AD%90%E7%B1%BB%E5%9E%8B-%E5%8F%82%E6%95%B0
typing_speed: 100 # Typing speed (ms)
backing_speed: 80 # Backing speed (ms)
Expand Down
2 changes: 1 addition & 1 deletion layout/_widgets/essays.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<li class="w-full flex flex-row relative">
<div class="w-10 h-10 mr-4 rounded-lg overflow-hidden border border-border-color p-[1px] flex-shrink-0"><%- image_tag(theme.defaults.avatar, {class: "w-full h-full rounded-[6.2px]"}) %></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 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).utc().locale(config.language).calendar() %></div>
<div id="shuoshuo-content" class="px-4 py-2"><%- markdown(e.content) %></div>
</div>
<div class=" absolute left-[50.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>
Expand Down
6 changes: 5 additions & 1 deletion source/js/plugins/typed.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export default function initTyped(id) {
fetch(usrHitokotoAPI)
.then((response) => response.json())
.then((data) => {
typing(data.hitokoto);
if (data.from_who && theme.home_banner.subtitle.hitokoto.show_author) {
typing(data.hitokoto + "——" + data.from_who);
} else {
typing(data.hitokoto);
}
})
.catch(console.error);
} else {
Expand Down