1(function () { 2 3 const cursor = document.getElementById("customCursor"); 4 const dot = document.getElementById("cursorDot"); 5 6 if (!cursor || !dot) return; 7 8 // Inicijalno â uÄitaj zadnju poznatu poziciju iz sessionStorage 9 let mouseX = sessionStorage.getItem("cursorX") 10 ? parseInt(sessionStorage.getItem("cursorX")) 11 : window.innerWidth / 2; 12 let mouseY = sessionStorage.getItem("cursorY") 13 ? parseInt(sessionStorage.getItem("cursorY")) 14 : window.innerHeight / 2; 15 16 let posX = mouseX; 17 let posY = mouseY; 18 let hovering = false; 19 20 cursor.style.opacity = "0"; 21 dot.style.opacity = "0"; 22 23 function updatePointer(e) { 24 mouseX = e.clientX; 25 mouseY = e.clientY; 26 27 // spremi trenutnu poziciju u sessionStorage 28 sessionStorage.setItem("cursorX", mouseX); 29 sessionStorage.setItem("cursorY", mouseY); 30 31 if (cursor.style.opacity === "0") { 32 cursor.style.opacity = "1"; 33 dot.style.opacity = "1"; 34 } 35 } 36 37 window.addEventListener("pointermove", updatePointer, { passive: true }); 38 window.addEventListener("mousemove", updatePointer, { passive: true }); 39 40 // Inicijalno postavljanje na zadnju poziciju 41 posX = mouseX - 20; 42 posY = mouseY - 20; 43 cursor.style.transform = `translate(${posX}px, ${posY}px)`; 44 dot.style.transform = `translate(${mouseX - 5}px, ${mouseY - 5}px)`; 45 46 function animate() { 47 posX += (mouseX - 20 - posX) * 0.25; 48 posY += (mouseY - 20 - posY) * 0.25; 49 50 const scale = hovering ? 2.5 : 1; 51 52 cursor.style.transform = `translate(${posX}px, ${posY}px) scale(${scale})`; 53 dot.style.transform = `translate(${mouseX - 5}px, ${mouseY - 5}px)`; 54 55 requestAnimationFrame(animate); 56 } 57 58 animate(); 59 60 document.addEventListener("mouseover", (e) => { 61 if (e.target.closest('a,button,[role="button"],.elementor-button,.elementor-clickable')) { 62 hovering = true; 63 } 64 }); 65 66 document.addEventListener("mouseout", (e) => { 67 if (e.target.closest('a,button,[role="button"],.elementor-button,.elementor-clickable')) { 68 hovering = false; 69 } 70 }); 71 72})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.