This commit is contained in:
2026-04-16 12:59:49 +09:00
parent 3ddda7e2ca
commit 14fa83263d
+8 -3
View File
@@ -3,8 +3,8 @@
const linkSelectors = 'a, button, [role="button"], input[type="submit"], input[type="button"]'; const linkSelectors = 'a, button, [role="button"], input[type="submit"], input[type="button"]';
const padding = 6; const padding = 6;
const ac = new AbortController(); let ac = null;
const sig = ac.signal; let sig = null;
let mouseX = 0, mouseY = 0; let mouseX = 0, mouseY = 0;
let currentLinkEl = null; let currentLinkEl = null;
@@ -16,7 +16,7 @@
const TOUCH_MOUSE_GUARD_MS = 800; const TOUCH_MOUSE_GUARD_MS = 800;
window.__scriptCleanup = () => { window.__scriptCleanup = () => {
ac.abort(); if (ac) ac.abort();
if (rafId) { cancelAnimationFrame(rafId); rafId = null; } if (rafId) { cancelAnimationFrame(rafId); rafId = null; }
document.documentElement.style.cursor = ''; document.documentElement.style.cursor = '';
if (cursor) cursor.classList.remove('visible', 'on-link', 'on-text'); if (cursor) cursor.classList.remove('visible', 'on-link', 'on-text');
@@ -66,6 +66,9 @@
document.documentElement.style.cursor = 'none'; document.documentElement.style.cursor = 'none';
function init() { function init() {
ac = new AbortController();
sig = ac.signal;
cursor = document.getElementById('cursor'); cursor = document.getElementById('cursor');
if (!cursor) return; if (!cursor) return;
@@ -279,6 +282,8 @@
cursor.classList.add('on-text'); cursor.classList.add('on-text');
} }
} }
init();
}); });
}, { signal: sig }); }, { signal: sig });