feat: 不蒜子可配置 CDN closed #1132

feat: gallery 標簽外掛增加圖片懶加載,增加 lazyload rowHeight 和 limit 屬性配置
feat: 可設置固定導航欄 closed #1150
fix: 修復開啟懶加載後,再使用 flink_url 的方式引入友鏈數據,友鏈頭像有可能不顯示的 bug closed #1146
fix: 修復閲讀模式下,代碼塊的背景顏色仍顯示彩色背景的 bug (自定義代碼塊) closed #1139
improvement: 搜索結果換行時不會拆分單詞顯示
improvement: 優化搜索結果顯示滾動條位置
improvement: css/js 優化
This commit is contained in:
Jerry
2023-01-14 00:36:34 +08:00
Unverified
parent 0f915f47ef
commit 9a3b41912a
28 changed files with 244 additions and 135 deletions

View File

@@ -1,13 +1,13 @@
hexo.extend.helper.register('findArchiveLength', function (func) {
const allPostsLength = this.site.posts.length;
if (hexo.config.archive_generator && hexo.config.archive_generator.enable === false ) return allPostsLength
const allPostsLength = this.site.posts.length
if (hexo.config.archive_generator && hexo.config.archive_generator.enable === false) return allPostsLength
const { yearly, monthly, daily } = hexo.config.archive_generator
const { year, month, day } = this.page
if (yearly === false || !year) return allPostsLength
const posts = this.site.posts.sort('date')
const compareFunc = (type,y1,m1,d1,y2,m2,d2) => {
const compareFunc = (type, y1, m1, d1, y2, m2, d2) => {
if (type === 'year') {
return y1 === y2
} else if (type === 'month') {
@@ -18,15 +18,15 @@ hexo.extend.helper.register('findArchiveLength', function (func) {
}
const generateDateObj = (type) => {
let dateObj = []
const dateObj = []
let length = 0
posts.forEach(post => {
let date = post.date.clone()
const date = post.date.clone()
const year = date.year()
const month = date.month() + 1
const day = date.date()
let lastData = dateObj[length - 1]
const lastData = dateObj[length - 1]
if (!lastData || !compareFunc(type, lastData.year, lastData.month, lastData.day, year, month, day)) {
const name = type === 'year' ? year : type === 'month' ? `${year}-${month}` : `${year}-${month}-${day}`
@@ -40,12 +40,12 @@ hexo.extend.helper.register('findArchiveLength', function (func) {
} else {
lastData.count++
}
});
})
return dateObj
}
const data = func('createArchiveObj', ()=> {
const data = func('createArchiveObj', () => {
const yearObj = yearly ? generateDateObj('year') : []
const monthObj = monthly ? generateDateObj('month') : []
const dayObj = daily ? generateDateObj('day') : []
@@ -55,4 +55,4 @@ hexo.extend.helper.register('findArchiveLength', function (func) {
const name = month ? day ? `${year}-${month}-${day}` : `${year}-${month}` : year
return data.find(item => item.name === name).count
})
})

View File

@@ -9,8 +9,8 @@ hexo.extend.helper.register('inject_head_js', function () {
const { darkmode, aside } = this.theme
const { theme_color } = hexo.theme.config
const themeColorLight = theme_color && theme_color.enable && theme_color.meta_theme_color_light || '#ffffff'
const themeColorDark = theme_color && theme_color.enable && theme_color.meta_theme_color_dark || '#0d0d0d'
const themeColorLight = (theme_color && theme_color.enable && theme_color.meta_theme_color_light) || '#ffffff'
const themeColorDark = (theme_color && theme_color.enable && theme_color.meta_theme_color_dark) || '#0d0d0d'
const localStore = `
win.saveToLocal = {

View File

@@ -74,8 +74,8 @@ hexo.extend.helper.register('injectHtml', function (data) {
hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) {
if (page.year) {
const dateStr = page.month ? `${page.year}-${page.month}` : `${page.year}`
const date_format = page.month ? hexo.theme.config.aside.card_archives.format : 'YYYY'
return date(dateStr, date_format)
const dateFormat = page.month ? hexo.theme.config.aside.card_archives.format : 'YYYY'
return date(dateStr, dateFormat)
}
const defaultTitle = this._p('page.archives')
@@ -102,4 +102,4 @@ hexo.extend.helper.register('isImgOrUrl', function (path) {
return true
}
return false
})
})