mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
- fix: 修正 Umami Analytics API 參數與資料處理邏輯
- style: 最佳化程式碼高亮工具列顯示與間距設定 - improve: 改善複製工具提示的定位邏輯 - bump: 版本號更新至 5.5.3
This commit is contained in:
@@ -84,10 +84,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const buttonRect = ele.getBoundingClientRect()
|
||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
||||
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
|
||||
const finalTop = buttonRect.top + scrollTop - 40
|
||||
const finalLeft = buttonRect.left + scrollLeft + buttonRect.width / 2
|
||||
|
||||
const topValue = ele.closest('figure.highlight').classList.contains('code-fullpage') ? finalTop + 60 : finalTop
|
||||
// Show tooltip below button if too close to top
|
||||
const normalTop = buttonRect.top + scrollTop - 40
|
||||
const shouldShowBelow = buttonRect.top < 60 || normalTop < 10
|
||||
|
||||
const topValue = shouldShowBelow ? buttonRect.top + scrollTop + buttonRect.height + 10 : normalTop
|
||||
|
||||
newEle.style.cssText = `
|
||||
top: ${topValue + 10}px;
|
||||
@@ -111,6 +114,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}, 800)
|
||||
}
|
||||
}
|
||||
|
||||
const copy = async (text, ctx) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
|
||||
Reference in New Issue
Block a user