PageSourceSearch

https://hashai.co.uk/wp-content/plugins/nextbricks/elements/js/next_cta_nav.min.js?ver=2.2.7

js hashai.co.uk collected 2026-09-29 11:51:41 UTC 3,011 bytes, 7 lines download raw bytes

1let next_cta_nav_executed=!1;function next_cta_nav(){if(next_cta_nav_executed){return}
2document.querySelectorAll(".next-cta-nav").forEach((ctaNav)=>{const offsetTop=parseFloat(ctaNav.getAttribute("data-offset"));const cta=ctaNav.querySelector(".next-cta-nav__cta");const nav=ctaNav.querySelector(".next-cta-nav__nav");let ctaWidth,navWidth,ctaHeight,navHeight;let triggerPosition;function calcDimensions(){cta.style.display='flex';nav.style.display='flex';nav.style.position='absolute';nav.style.visibility='hidden';nav.style.width='auto';ctaNav.offsetHeight;requestAnimationFrame(()=>{const navRect=nav.getBoundingClientRect();const navChildren=Array.from(nav.children);let maxNavWidth=navRect.width;navChildren.forEach(child=>{const childRect=child.getBoundingClientRect();maxNavWidth=Math.max(maxNavWidth,childRect.right-navRect.left)});ctaWidth=cta.getBoundingClientRect().width;navWidth=maxNavWidth;ctaHeight=cta.getBoundingClientRect().height;navHeight=navRect.height;nav.style.position='';nav.style.visibility='';nav.style.width='';cta.style.display='';nav.style.display='';navWidth+=2;updateContainerDimensions();const rect=ctaNav.getBoundingClientRect();const scrollTop=window.pageYOffset||document.documentElement.scrollTop;triggerPosition=rect.top+scrollTop})}
3function updateContainerDimensions(){if(ctaNav.classList.contains("next-cta-nav--stick")){ctaNav.style.width=`${navWidth}px`;ctaNav.style.height=`${navHeight}px`}else{ctaNav.style.width=`${ctaWidth}px`;ctaNav.style.height=`${ctaHeight}px`}}
4function updateButtonVisibility(){const scrollPosition=window.pageYOffset||document.documentElement.scrollTop;const containerRect=ctaNav.getBoundingClientRect();if(containerRect.top<=offsetTop&&detectScrollDirection()==="down"){if(!ctaNav.classList.contains("next-cta-nav--stick")){ctaNav.classList.add("next-cta-nav--stick");requestAnimationFrame(()=>{ctaNav.style.width=`${navWidth}px`;ctaNav.style.height=`${navHeight}px`})}}else if(scrollPosition<=triggerPosition){if(ctaNav.classList.contains("next-cta-nav--stick")){ctaNav.classList.remove("next-cta-nav--stick");requestAnimationFrame(()=>{ctaNav.style.width=`${ctaWidth}px`;ctaNav.style.height=`${ctaHeight}px`})}}}
5calcDimensions();let resizeTimeout;window.addEventListener("resize",()=>{clearTimeout(resizeTimeout);resizeTimeout=setTimeout(calcDimensions,250)});window.addEventListener("orientationchange",()=>{setTimeout(calcDimensions,100)});let scrollTimeout;window.addEventListener("scroll",()=>{if(!scrollTimeout){scrollTimeout=setTimeout(()=>{updateButtonVisibility();scrollTimeout=null},10)}})});let lastScrollTop=0;function detectScrollDirection(){const currentScroll=window.pageYOffset||document.documentElement.scrollTop;const direction=currentScroll>lastScrollTop?"down":"up";lastScrollTop=currentScroll;return direction}
6next_cta_nav_executed=!0}
7document.addEventListener("DOMContentLoaded",function(){if(typeof bricksIsFrontend!=='undefined'&&bricksIsFrontend){document.fonts.ready.then(()=>{setTimeout(next_cta_nav,100)})}})

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.