PageSourceSearch

https://www.cancom.com/wp-content/cache/min/2/wp-content/plugins/g…/navigation/frontend.js?ver=1783005945

js cancom.com collected 2026-10-02 10:13:25 UTC 3,334 bytes, 10 lines download raw bytes

1document.addEventListener("DOMContentLoaded",function(){if(!greyd?.scrollObserver)return;function initNavigations(){var navBlocks=document.querySelectorAll('.wp-block-navigation.is-anchor-active-style');if(navBlocks.length==0)return;navBlocks.forEach((wrapper,key)=>{const setup=wrapper.dataset.anchoractive?JSON.parse(wrapper.dataset.anchoractive):{};if(!setup.enable)return;const activeLinks=wrapper.querySelectorAll('a.wp-block-navigation-item__content[href*="#"]');if(activeLinks.length==0)return;let start=setup.start?parseInt(setup.start):0;let end=setup.end?parseInt(setup.end):100;if(end<start){let tmp=start;start=end;end=tmp}
2const multiple=setup.multiple?setup.multiple:'';const none=setup.none?setup.none:'';let items=[];activeLinks.forEach((link,key)=>{const item=link.parentElement;const href=link.href;const id=href.split('#')[1];const anchor=document.getElementById(id);if(anchor){items.push({item:item,anchor:anchor});var simple=start==0&&end==100&&multiple==''&&none=='';if(simple){greyd.scrollObserver.observeElement(anchor,(target,event,inViewport)=>{if(inViewport){item.classList.add('current-menu-item')}else{item.classList.remove('current-menu-item')}},'change')}else{greyd.scrollObserver.observeElement(anchor,(target,event,inViewport)=>{var boundingClientRect=target.getBoundingClientRect();var targetTop=boundingClientRect.y;var targetBottom=targetTop+boundingClientRect.height;var endLine=(window.innerHeight/100)*end;var startLine=(window.innerHeight/100)*start;const getDistance=(element)=>{var bounds=element.getBoundingClientRect();var top=bounds.y;var bottom=top+bounds.height;var center=(endLine+startLine)/2;var distance=0;if(bottom<center&&top<center){distance=center-bottom}
3if(bottom>center&&top>center){distance=top-center}
4return distance};var inside=targetBottom>startLine&&targetTop<endLine;if(inside&&multiple=='closest'){var distance=getDistance(target);items.forEach((other)=>{if(other.item===item||!other.item.classList.contains('current-menu-item'))return;if(getDistance(other.anchor)<distance){inside=!1}})}
5if(inside&&!item.classList.contains('current-menu-item')&&multiple=='latest'){items.forEach((other)=>{if(other.item===item||!other.item.classList.contains('current-menu-item'))return;other.item.classList.remove('current-menu-item')})}
6if(inside){item.classList.add('current-menu-item')}else{item.wasActive=item.classList.contains('current-menu-item');if(item.wasActive)items.forEach((other)=>{if(other.item===item)return;other.item.wasActive=!1});item.classList.remove('current-menu-item')}
7if(none!=''){var anyActive=!1;var distances=[];items.forEach((other,index)=>{if(other.item.classList.contains('keep-anchor-active')){other.item.classList.remove('current-menu-item','keep-anchor-active')}
8if(other.item.classList.contains('current-menu-item')){anyActive=!0}else{distances.push({index:index,distance:getDistance(other.anchor)})}});if(!anyActive){if(none=='keep'){items.forEach((other,index)=>{if(other.item.wasActive){other.item.classList.add('current-menu-item','keep-anchor-active');anyActive=!0}})}
9if(!anyActive){distances.sort((a,b)=>a.distance-b.distance);items[distances[0].index].item.classList.add('current-menu-item','keep-anchor-active')}}}},'always');item.classList.remove('current-menu-item')}}})});console.log("navigation scripts loaded.")}
10initNavigations()})

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.