From 8603db05456cf482e84cc85ae63b920063e12d38 Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Wed, 2 Sep 2020 00:04:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E9=97=9C=E9=96=89last?= =?UTF-8?q?=20push=20date=20=E5=BE=8C=EF=BC=8C=20=E5=A0=B1=20'hour'=20?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E7=9A=84bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/head/config.pug | 37 ++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 1e4e492..fc6512c 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -14,8 +14,8 @@ hits_stats: _p("algolia_search.hits_stats") } }) - } - + } + let localSearch = 'undefined'; if (theme.local_search && theme.local_search.enable) { localSearch = JSON.stringify({ @@ -58,7 +58,6 @@ }) } - let Snackbar = 'undefined'; if (theme.snackbar && theme.snackbar.enable) { Snackbar = JSON.stringify({ @@ -95,15 +94,11 @@ }) } - let date_suffix = 'undefined'; - if (theme.aside.card_webinfo.last_push_date) { - date_suffix = JSON.stringify({ - one_hour: _p("date_suffix.one_hour"), - hours: _p("date_suffix.hours"), - day: _p('date_suffix.day') - - }) - } + let date_suffix = JSON.stringify({ + one_hour: _p("date_suffix.one_hour"), + hours: _p("date_suffix.hours"), + day: _p('date_suffix.day') + }) script. var GLOBAL_CONFIG = { @@ -139,18 +134,18 @@ script. islazyload: !{theme.lazyload.enable}, isanchor: !{theme.anchor} }; - + var saveToLocal = { set: function setWithExpiry(key, value, ttl) { - const now = new Date() - const expiryDay = ttl * 86400000 - const item = { - value: value, - expiry: now.getTime() + expiryDay, - } - localStorage.setItem(key, JSON.stringify(item)) + const now = new Date() + const expiryDay = ttl * 86400000 + const item = { + value: value, + expiry: now.getTime() + expiryDay, + } + localStorage.setItem(key, JSON.stringify(item)) }, - + get: function getWithExpiry(key) { const itemStr = localStorage.getItem(key)