From 90f06b8940b205dda9f529e4e052c196a919c32f Mon Sep 17 00:00:00 2001 From: XPoet Date: Tue, 24 Nov 2020 20:06:08 +0800 Subject: [PATCH] feat: display how long ago in home articles --- languages/en.yml | 8 ++ languages/zh-CN.yml | 8 ++ layout/_partial/comment/valine.ejs | 5 - layout/_partial/home-article-meta-info.ejs | 2 +- scripts/helpers/export-config.js | 46 +++++++--- source/js/left-side-toggle.js | 2 +- source/js/local-search.js | 12 +-- source/js/main.js | 11 +++ source/js/utils.js | 102 ++++++++++++--------- 9 files changed, 131 insertions(+), 65 deletions(-) diff --git a/languages/en.yml b/languages/en.yml index 1281036..7f71166 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -35,3 +35,11 @@ copyright: create_time: Create time license_title: Copyright Notice license_content: "All articles in this blog are licensed under %s unless stating additionally." +ago: + second: "%s seconds ago" + minute: "%s minutes ago" + hour: "%s hours ago" + day: "%s days age" + week: "%s weeks age" + month: "%s months age" + year: "%s years age" diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index e2f0867..5201a6e 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -35,3 +35,11 @@ copyright: create_time: 创建时间 license_title: 版权声明 license_content: "本博客所有文章除特别声明外,均采用 %s 许可协议。转载请注明出处!" +ago: + second: "%s 秒前" + minute: "%s 分钟前" + hour: "%s 小时前" + day: "%s 天前" + week: "%s 周前" + month: "%s 月前" + year: "%s 年前" diff --git a/layout/_partial/comment/valine.ejs b/layout/_partial/comment/valine.ejs index 0744b59..131d857 100755 --- a/layout/_partial/comment/valine.ejs +++ b/layout/_partial/comment/valine.ejs @@ -29,11 +29,6 @@ author = author.toLocaleLowerCase(); } - let email = '<%= theme.base_info.email %>'; - if (email) { - email = email.toLocaleLowerCase(); - } - for (let vcard of vcards) { const vnick = vcard.querySelector('.vhead .vnick'); if (vnick.innerHTML.toLocaleLowerCase() === author) { diff --git a/layout/_partial/home-article-meta-info.ejs b/layout/_partial/home-article-meta-info.ejs index 18d072d..d1d28de 100644 --- a/layout/_partial/home-article-meta-info.ejs +++ b/layout/_partial/home-article-meta-info.ejs @@ -1,6 +1,6 @@