feat: 增加 post_pagination 配置(可關閉/配置分頁展示邏輯)

feat: 可配置最新評論的緩存時間
fix: 修復pjax下不會跳轉404頁面的bug
fix: 修復手持設備橫向翻轉時,menu 沒有進行判斷,而導致樣式錯亂的bug
fix: 修復文字點擊關閉random無效的bug
fix: 修復子目錄下,打賞圖片跳轉鏈接會錯誤的bug
improvement: 文章版權右上角改為 版權icon
improvement: pangu的操作範圍增大到 body-wrap裏的內容
improvement: pug 判斷優化
improvement: 最新評論js優化
remove: 移除 fragment_cache 配置(默認開啟)
remove: 移除百度推送(百度已棄用)和百度轉碼
This commit is contained in:
Jerry
2021-01-10 19:26:32 +08:00
parent 81fc48df40
commit 0eac648267
31 changed files with 130 additions and 176 deletions

View File

@@ -18,7 +18,6 @@ script.
const getIcon = (icon, mail) => {
if (icon) return icon
let defaultIcon = '!{ default_avatar ? `?d=${default_avatar}` : ''}'
let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
return iconUrl
@@ -32,10 +31,7 @@ script.
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
let name = 'src'
if(!{theme.lazyload.enable}) {
name = 'data-lazy-src'
}
const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}'
result += `<a href='${array[i].url}' class="thumbnail"><img ${name}='${getIcon(array[i].avatar, array[i].mail)}' alt='${array[i].nick}'></a>`
}
@@ -55,12 +51,7 @@ script.
}
const getComment = () => {
let serverURL = ''
if (!{Boolean(theme.valine.serverURLs)}) {
serverURL = '!{theme.valine.serverURLs}'
} else {
serverURL = 'https://!{theme.valine.appId.substring(0,8)}.api.lncldglobal.com'
}
const serverURL = '!{theme.valine.serverURLs || `https://${theme.valine.appId.substring(0,8)}.api.lncldglobal.com` }'
var settings = {
"method": "GET",
@@ -84,7 +75,7 @@ script.
'date': e.createdAt,
}
})
saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24))
saveToLocal.set('valine-newest-comments', JSON.stringify(valineArray), !{theme.newest_comments.storage}/(60*24))
generateHtml(valineArray)
}).catch(e => {
const $dom = document.querySelector('#card-newest-comments .aside-list')
@@ -94,7 +85,7 @@ script.
const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('leancloud-newest-comments')
const data = saveToLocal.get('valine-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {