Initial commit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fish03
2026-09-23 14:43:16 +07:00
co-authored by Claude Opus 5.5
commit bef9f8b4ed
663 changed files with 81305 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
(function () {
var scrollToTopButton = document.getElementById("scrollToTopButton");
if (!scrollToTopButton) return;
var ticking = false;
var lastVisible = null;
function updateVisibility() {
ticking = false;
// 用 visualViewport / 近似阈值,避免反复读 layout 几何属性触发强制重排
var threshold = Math.max(window.innerHeight || 600, 600);
var shouldShow = (window.scrollY || window.pageYOffset || 0) > threshold;
if (shouldShow === lastVisible) return;
lastVisible = shouldShow;
scrollToTopButton.classList.toggle("is-visible", shouldShow);
}
function onScroll() {
if (ticking) return;
ticking = true;
window.requestAnimationFrame(updateVisibility);
}
scrollToTopButton.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
window.addEventListener("scroll", onScroll, { passive: true });
window.requestAnimationFrame(updateVisibility);
})();