mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 17:30:53 +08:00
breaking changes: 移除 subtitle 一句網調用(api 已失效)
feat: 右下角按鈕增加預覽進度顯示 feat: toc可設置是否顯示預覽進度 fix: 修復 TypeError: require(...) is not a function 的報錯 #1102 improvement: 日期設置相對日期時,文章的日期格式和最新評論的日期格式統一為 年月日
This commit is contained in:
@@ -88,7 +88,7 @@ const btf = {
|
||||
const minuteCount = dateDiff / minute
|
||||
|
||||
if (monthCount > 12) {
|
||||
result = datePost.toLocaleDateString().replace(/\//g, '-')
|
||||
result = datePost.toISOString().slice(0,10)
|
||||
} else if (monthCount >= 1) {
|
||||
result = parseInt(monthCount) + ' ' + GLOBAL_CONFIG.date_suffix.month
|
||||
} else if (dayCount >= 1) {
|
||||
@@ -274,5 +274,16 @@ const btf = {
|
||||
title: title
|
||||
}, title, anchor)
|
||||
}
|
||||
},
|
||||
|
||||
getScrollPercent: (currentTop,ele) => {
|
||||
const docHeight = ele.clientHeight
|
||||
const winHeight = document.documentElement.clientHeight
|
||||
const headerHeight = ele.offsetTop
|
||||
const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : (document.documentElement.scrollHeight - winHeight)
|
||||
const scrollPercent = (currentTop - headerHeight) / (contentMath)
|
||||
const scrollPercentRounded = Math.round(scrollPercent * 100)
|
||||
const percentage = (scrollPercentRounded > 100) ? 100 : (scrollPercentRounded <= 0) ? 0 : scrollPercentRounded
|
||||
return percentage
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user