PageSourceSearch

https://www.heizsparer.de/wp-content/plugins/ollie-menu-designer/b…/mega-menu/view.js?ver=a0c95525a5287c260559

js heizsparer.de collected 2026-09-24 21:57:28 UTC 7,107 bytes, 1 lines download raw bytes

1import{getContext as e,getElement as t,store as n,withScope as i,withSyncEvent as s}from"@wordpress/interactivity";const o=150,l=300,a=2,c=200,u=400,r=24,d=100,p=1,m="rgba(255, 255, 255, 1)",f=".wp-block-ollie-mega-menu__menu-container",g=".wp-block-navigation",h=".wp-block-navigation__responsive-container",M=e=>e.querySelector(f),y=(e,t)=>e.classList.contains({custom:"menu-width-custom",content:"menu-width-content",wide:"menu-width-wide",full:"menu-width-full"}[t]);let w=null,v=null;const k=new WeakMap,{state:x,actions:T}=n("ollie/mega-menu",{state:{get isMenuOpen(){return Object.values(x.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){return e().menuOpenedBy},get isDesktop(){return window.innerWidth>=600},hoverTimeout:null,get dynamicHoverDelay(){const t=(e().topSpacing||0)*a;return l+t},isProcessingClick:!1},actions:{closeAllMenus(){T.closeMenu("click"),T.closeMenu("focus"),T.closeMenu("hover")},applyMobileBackgroundColor(e){if(!x.isDesktop&&x.isMenuOpen){const s=(e=>e.closest(h))(e);if(s){const o=(e=>{if(!e||"transparent"===e||"rgba(0, 0, 0, 0)"===e)return null;const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)/);if(t){const[,e,n,i,s]=t;return{r:e,g:n,b:i,a:s||1}}return null})(window.getComputedStyle(s).backgroundColor);e.style.backgroundColor=o?(t=o.r,n=o.g,i=o.b,`rgba(${t}, ${n}, ${i}, ${p})`):m}}else e.style.backgroundColor="";var t,n,i},applyTopSpacing(e){const t=e.dataset.topSpacing;t&&parseInt(t)>0&&x.isDesktop?e.style.top=`${t}px`:x.isDesktop||(e.style.top="")},applyMaxHeight(e){if(x.isDesktop){const t=window.innerHeight-e.getBoundingClientRect().top-r;e.style.maxHeight=`${Math.max(t,d)}px`,e.style.overflowY="auto"}else e.style.maxHeight="",e.style.overflowY=""},applyMenuWidth(e){if(y(e,"custom")){const t=e.dataset.customWidth;t&&parseInt(t)>0&&(e.style.width=`${t}px`,e.style.maxWidth=`${t}px`)}else(y(e,"content")||y(e,"wide")||y(e,"full"))&&(e.style.width="",e.style.maxWidth="")},determineJustification:(e,t)=>e.classList.contains("menu-justified-center")?"center":e.classList.contains("menu-justified-right")?"right":e.classList.contains("menu-justified-left")?"left":t.classList.contains("items-justified-center")||t.classList.contains("items-justified-space-between")?"center":t.classList.contains("items-justified-right")?"right":"left",getMenuMeasurements(e,t){const n=window.innerWidth;let i=e.offsetWidth;return y(e,"custom")&&e.dataset.customWidth&&(i=parseInt(e.dataset.customWidth)),{windowSpace:n,originalMenuWidth:i,menuRect:e.getBoundingClientRect(),navBlockRect:t.getBoundingClientRect(),leftOffset:t.getBoundingClientRect().left,leftSpace:(n-i)/2}},resetMenuPositionStyles(e){e.style.left="",e.style.width="",e.style.maxWidth="",e.style.maxHeight=""},adjustMegaMenu(){const{ref:e}=t(),n=M(e);if(!n)return;const i=(e=>e.closest(g))(n);if(!i)return;T.applyTopSpacing(n),T.applyMobileBackgroundColor(n),T.applyMenuWidth(n),T.applyMaxHeight(n);const s=T.determineJustification(n,i),o=T.getMenuMeasurements(n,i);T.applyJustificationPositioning(n,s,o.windowSpace,o.originalMenuWidth,o.menuRect,o.leftOffset,o.leftSpace,o.navBlockRect)},applyJustificationPositioning(e,t,n,i,s){const o=c;if(i>n){const t=Math.max(n,o);e.style.width=`${t}px`,i=t}if(y(e,"full"))return e.style.width=`${n}px`,e.style.maxWidth=`${n}px`,void(e.style.left=-s.left+"px");if(y(e,"wide")){if("center"===t){const t=n/2-i/2-s.left,o=parseFloat(e.style.left||0)+t;e.style.left=`${o}px`}}else if("center"===t&&y(e,"custom")&&parseInt(e.dataset.customWidth)&&(e.style.left=`calc( ( -1 * ${i}px / 2 ) + 50% )`),y(e,"content")||y(e,"custom")){const s=e.getBoundingClientRect(),o=s.left,l=s.right;if(o<0||l>n)if("center"===t){let t=0;if(o<0?t=Math.abs(o):l>n&&(t=-(l-n)),y(e,"custom"))e.style.left=`calc( ( -1 * ${i}px / 2 ) + 50% + ${t}px )`;else{const n=parseFloat(e.style.left||window.getComputedStyle(e).left||0);e.style.left=`${n+t}px`}}else{let s=i,a=!1;if(o<0){const e=Math.abs(o);s=Math.min(s,i-e)}if(l>n){const e=l-n;s=Math.min(s,i-e)}if(a=s<u,a&&"true"!==e.dataset.justificationSwapped){const n="left"===t?"right":"left";return e.classList.remove("menu-justified-left","menu-justified-right","menu-justified-center"),e.classList.add(`menu-justified-${n}`),e.dataset.justificationSwapped="true",e.style.width="",e.style.left="",e.style.maxWidth="",T.adjustMegaMenu()}if(!a){const t=Math.max(s,c);e.style.width=`${t}px`}}}},handleResize(){const{ref:e}=t(),n=M(e);if(!n)return;T.clearHoverTimeout(),!x.isDesktop&&x.menuOpenedBy.hover&&T.closeMenu("hover");const s=k.get(e);s&&cancelAnimationFrame(s),k.set(e,requestAnimationFrame(i(()=>{delete n.dataset.justificationSwapped,T.resetMenuPositionStyles(n),T.adjustMegaMenu(),x.isMenuOpen&&T.applyMobileBackgroun
1dColor(n),k.delete(e)})))},toggleMenuOnClick:s(n=>{const i=e(),{ref:s}=t();x.isProcessingClick=!0,n&&n.preventDefault&&n.preventDefault(),window.document.activeElement!==s&&s.focus(),v&&v!==i&&(v.menuOpenedBy.click=!1,v.menuOpenedBy.focus=!1),x.isMenuOpen?(T.clearHoverTimeout(),T.closeAllMenus()):(i.previousFocus=s,T.openMenu("click"),v=i),setTimeout(()=>{x.isProcessingClick=!1},100)}),closeMenuOnClick(){T.clearHoverTimeout(),T.closeAllMenus()},clearHoverTimeout(){x.hoverTimeout&&(clearTimeout(x.hoverTimeout),x.hoverTimeout=null)},setHoverTimeout(e,t){T.clearHoverTimeout(),x.hoverTimeout=setTimeout(i(e),t)},shouldActivateHover(){if(!e().showOnHover||!x.isDesktop)return!1;if(!window.matchMedia("(hover: hover)").matches)return!1;const{ref:n}=t(),i=n.closest(h);return!i?.classList.contains("is-menu-open")},handleMouseEnter(){T.shouldActivateHover()&&(x.menuOpenedBy.hover?T.clearHoverTimeout():T.setHoverTimeout(()=>{x.menuOpenedBy.click||(w&&w!==e()&&(w.menuOpenedBy.hover=!1),w=e(),T.openMenu("hover"))},o))},handleMouseLeave(){T.shouldActivateHover()&&T.setHoverTimeout(()=>{T.closeMenu("hover")},x.dynamicHoverDelay)},handleMenuKeydown(e){x.isMenuOpen&&"Escape"===e?.key&&(T.clearHoverTimeout(),T.closeAllMenus())},handleMenuFocusout(n){if(x.isProcessingClick)return;const s=e(),{ref:o}=t(),l=s.megaMenu?.querySelector(".wp-block-ollie-mega-menu__menu-container");n.relatedTarget&&(n.relatedTarget.classList?.contains("wp-block-navigation__responsive-close")||n.relatedTarget===o)||(null!==n.relatedTarget?l?.contains(n.relatedTarget)||n.target===window.document.activeElement||T.closeAllMenus():setTimeout(i(()=>{document.hasFocus()&&(l?.contains(window.document.activeElement)||window.document.activeElement===o||T.closeAllMenus())}),0))},openMenu(e="click"){x.menuOpenedBy[e]=!0},closeMenu(t="click"){const n=e();if(x.menuOpenedBy[t]=!1,!x.isMenuOpen){if(w===n&&(w=null),v===n&&(v=null),n.megaMenu?.contains(window.document.activeElement)&&n.previousFocus?.focus(),n.previousFocus=null,n.megaMenu){const e=M(n.megaMenu);e&&delete e.dataset.justificationSwapped}n.megaMenu=null}}},callbacks:{initMenu(){const n=e(),{ref:i}=t();if(x.isMenuOpen){n.megaMenu=i;const e=M(i);e&&(T.applyMobileBackgroundColor(e),T.applyMaxHeight(e))}},initMenuLayout(){"complete"===document.readyState?T.adjustMegaMenu():window.addEventListener("load",i(()=>{T.adjustMegaMenu()}),{once:!0})}}});

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.