From 0f7ac23f89b8048c049fbf32c7acb80f4d8f4ae5 Mon Sep 17 00:00:00 2001 From: oasislzy <150250114+jackgdn@users.noreply.github.com> Date: Fri, 9 Aug 2024 00:11:59 +0800 Subject: [PATCH 1/2] fix: correct time display of shuoshuo Change the time zone of the shuoshuo display to UTC to avoid an 8-hour time error. --- layout/_widgets/essays.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/_widgets/essays.ejs b/layout/_widgets/essays.ejs index f0e265da..29171e0a 100644 --- a/layout/_widgets/essays.ejs +++ b/layout/_widgets/essays.ejs @@ -10,7 +10,7 @@
  • <%- image_tag(theme.defaults.avatar, {class: "w-full h-full rounded-[6.2px]"}) %>
    -
    <%- moment(e.date).locale(config.language).calendar() %>
    +
    <%- moment(e.date).utc().locale(config.language).calendar() %>
    <%- markdown(e.content) %>
    From 67b380561e7468d213fc929c8ee55419794faae3 Mon Sep 17 00:00:00 2001 From: oasislzy <150250114+jackgdn@users.noreply.github.com> Date: Fri, 9 Aug 2024 22:55:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A6=96=E9=A1=B5=20Hito?= =?UTF-8?q?koto=20=E6=98=BE=E7=A4=BA=E4=BD=9C=E8=80=85=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 1 + source/js/plugins/typed.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index fa2a2431..765f77fb 100755 --- a/_config.yml +++ b/_config.yml @@ -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) diff --git a/source/js/plugins/typed.js b/source/js/plugins/typed.js index 7b8a115e..3977e931 100644 --- a/source/js/plugins/typed.js +++ b/source/js/plugins/typed.js @@ -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 {