chore: 初始化 Hugo 博客项目

Hextra 主题,8 篇文章,支持全文搜索/暗色模式
This commit is contained in:
claw
2026-05-13 12:48:53 +08:00
committed by fukunee
commit 07851043b1
624 changed files with 48007 additions and 0 deletions
@@ -0,0 +1,26 @@
// Back to top button
document.addEventListener("DOMContentLoaded", function () {
const backToTop = document.querySelector("#backToTop");
if (backToTop) {
backToTop.addEventListener("click", scrollUp);
document.addEventListener("scroll", (e) => {
if (window.scrollY > 300) {
backToTop.classList.remove("hx:opacity-0");
backToTop.removeAttribute("tabindex");
} else {
backToTop.classList.add("hx:opacity-0");
backToTop.setAttribute("tabindex", "-1");
}
});
}
});
function scrollUp() {
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
window.scroll({
top: 0,
left: 0,
behavior: prefersReducedMotion ? 'auto' : 'smooth',
});
}