Skip to content

Commit

Permalink
增加首页 Hitokoto 显示作者的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgdn committed Aug 9, 2024
1 parent 0f7ac23 commit 67b3805
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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
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

0 comments on commit 67b3805

Please sign in to comment.