fix: 修復關閉last push date 後, 報 'hour' 找不到的bugs

This commit is contained in:
Jerry
2020-09-02 00:04:32 +08:00
parent d381d63c08
commit 8603db0545

View File

@@ -14,8 +14,8 @@
hits_stats: _p("algolia_search.hits_stats") hits_stats: _p("algolia_search.hits_stats")
} }
}) })
} }
let localSearch = 'undefined'; let localSearch = 'undefined';
if (theme.local_search && theme.local_search.enable) { if (theme.local_search && theme.local_search.enable) {
localSearch = JSON.stringify({ localSearch = JSON.stringify({
@@ -58,7 +58,6 @@
}) })
} }
let Snackbar = 'undefined'; let Snackbar = 'undefined';
if (theme.snackbar && theme.snackbar.enable) { if (theme.snackbar && theme.snackbar.enable) {
Snackbar = JSON.stringify({ Snackbar = JSON.stringify({
@@ -95,15 +94,11 @@
}) })
} }
let date_suffix = 'undefined'; let date_suffix = JSON.stringify({
if (theme.aside.card_webinfo.last_push_date) { one_hour: _p("date_suffix.one_hour"),
date_suffix = JSON.stringify({ hours: _p("date_suffix.hours"),
one_hour: _p("date_suffix.one_hour"), day: _p('date_suffix.day')
hours: _p("date_suffix.hours"), })
day: _p('date_suffix.day')
})
}
script. script.
var GLOBAL_CONFIG = { var GLOBAL_CONFIG = {
@@ -139,18 +134,18 @@ script.
islazyload: !{theme.lazyload.enable}, islazyload: !{theme.lazyload.enable},
isanchor: !{theme.anchor} isanchor: !{theme.anchor}
}; };
var saveToLocal = { var saveToLocal = {
set: function setWithExpiry(key, value, ttl) { set: function setWithExpiry(key, value, ttl) {
const now = new Date() const now = new Date()
const expiryDay = ttl * 86400000 const expiryDay = ttl * 86400000
const item = { const item = {
value: value, value: value,
expiry: now.getTime() + expiryDay, expiry: now.getTime() + expiryDay,
} }
localStorage.setItem(key, JSON.stringify(item)) localStorage.setItem(key, JSON.stringify(item))
}, },
get: function getWithExpiry(key) { get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key) const itemStr = localStorage.getItem(key)