From f85b596a6689c06a5a6f2e035be02c0bc2d8852c Mon Sep 17 00:00:00 2001 From: Roberto Date: Wed, 3 Jun 2026 23:47:36 +0200 Subject: [PATCH 1/2] Fix cursor movement functionality on page load --- resources/js/app.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index b1cbbab..3fe16df 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -15,14 +15,21 @@ document.addEventListener('DOMContentLoaded', () => { }); }); -const cursor = document.getElementById('custom-cursor'); +window.addEventListener('load', () => { + const cursor = document.getElementById('custom-cursor'); + const gsapInstance = window.gsap; -document.addEventListener('mousemove', (e) => { - gsap.to(cursor, { - duration: 0.2, - x: e.clientX + 20, - y: e.clientY - 15, - ease: 'power2.out' + if (!cursor || !gsapInstance) { + return; + } + + document.addEventListener('mousemove', (e) => { + gsapInstance.to(cursor, { + duration: 0.2, + x: e.clientX + 20, + y: e.clientY - 15, + ease: 'power2.out' + }); }); }); -- 2.47.3 From 2f2b7866c631a037645c6c73763afd53cf55c2a9 Mon Sep 17 00:00:00 2001 From: Roberto Date: Wed, 3 Jun 2026 23:51:30 +0200 Subject: [PATCH 2/2] Refactor visitor ID creation function for improved readability --- resources/views/welcome.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 459b6df..32b699b 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -179,7 +179,8 @@ } const visitorKey = 'cv_visitor_id'; - const createVisitorId = () => window.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`; + const createVisitorId = () => window.crypto?.randomUUID?.() ?? + `${Date.now()}-${Math.random().toString(36).slice(2)}`; let visitorId = createVisitorId(); try { -- 2.47.3