feat: 預設關閉 structured_data

feat: 升級一些項目依賴
feat: 重寫 README.md 和 README_CN.md,改進文檔結構和內容
feat: tags 標籤插件夜間模式調整
feat: 加按鈕懸停效果和動畫
fix: 修復右下角箭頭圖標位置沒有居中的 bug
feat: 增加右下角箭頭和滾動百分比的切換效果
improvement: 優化 tags 頁標籤雲顯示效果
improvement: 整合部分js到 init.js
improvement: 統一 CSS 變數使用,改進主題一致性
This commit is contained in:
Jerry
2025-08-19 14:49:39 +08:00
parent 0e9b8f5b69
commit 5ee24defc3
25 changed files with 1425 additions and 900 deletions

View File

@@ -13,7 +13,7 @@ hexo.extend.helper.register('postDesc', data => {
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
let { source, minfontsize, maxfontsize, limit, unit = 'px', orderby, order } = options
let { source, minfontsize, maxfontsize, limit, unit = 'px', orderby, order, page = 'tags' } = options
if (limit > 0) {
source = source.limit(limit)
@@ -29,14 +29,19 @@ hexo.extend.helper.register('cloudTags', function (options = {}) {
return `rgb(${Math.max(r, 50)}, ${Math.max(g, 50)}, ${Math.max(b, 50)})`
}
const generateStyle = (size, unit) =>
`font-size: ${parseFloat(size.toFixed(2)) + unit}; color: ${getRandomColor()};`
const generateStyle = (size, unit, page) => {
if (page === 'tags') {
return `font-size: ${parseFloat(size.toFixed(2)) + unit}; background-color: ${getRandomColor()};`
} else {
return `font-size: ${parseFloat(size.toFixed(2)) + unit}; color: ${getRandomColor()};`
}
}
const length = sizes.length - 1
const result = source.sort(orderby, order).map(tag => {
const ratio = length ? sizes.indexOf(tag.length) / length : 0
const size = minfontsize + ((maxfontsize - minfontsize) * ratio)
const style = generateStyle(size, unit)
const style = generateStyle(size, unit, page)
return `<a href="${env.url_for(tag.path)}" style="${style}">${tag.name}</a>`
}).join('')