PageSourceSearch

https://www.worldcapital.it/wp-content/cache/min/1/wp-content/them…wcg-elementor-mobile-menu.js?ver=1791280801

js worldcapital.it collected 2026-10-07 13:13:14 UTC 8,462 bytes, 52 lines download raw bytes

1document.addEventListener('DOMContentLoaded',function(){let isDesktopInit=!1;let isMobileInit=!1;function checkBreakpoints(){if(window.innerWidth>1024){document.body.classList.remove('wcg-mobile-menu-open');document.body.style.overflow='';document.body.style.position='';document.body.style.width='';initDesktopMenu()}else{initMobileMenu()}}
2function initDesktopMenu(){if(isDesktopInit)return;const desktopNav=document.querySelector('.megamenu .e-n-menu');if(desktopNav){desktopNav.classList.remove('e-n-menu-tablet','e-n-menu-mobile');desktopNav.classList.add('e-n-menu-desktop');const items=desktopNav.querySelectorAll('.e-n-menu-heading > .e-n-menu-item');items.forEach(item=>{const btn=item.querySelector('.e-n-menu-dropdown-icon');if(!btn)return;item.addEventListener('mouseenter',()=>{if(btn.getAttribute('aria-expanded')!=='true'){btn.click()}});item.addEventListener('mouseleave',()=>{if(btn.getAttribute('aria-expanded')==='true'){btn.click()}})});isDesktopInit=!0}}
3function initMobileMenu(){if(isMobileInit)return;const navContainer=document.querySelector('.megamenu .e-n-menu');if(!navContainer)return;const toggleBtn=document.querySelector('.megamenu .e-n-menu-toggle');let hamburgerHTML=`
4            <div class="wcg-hamburger wcg-mobile-menu-trigger">
5                <span></span>
6                <span></span>
7                <span></span>
8            </div>
9        `;if(toggleBtn){toggleBtn.insertAdjacentHTML('afterend',hamburgerHTML);toggleBtn.style.display='none'}
10let menuTree=[];const topLevelItems=document.querySelectorAll('.megamenu .e-n-menu-heading > .e-n-menu-item');topLevelItems.forEach((item,index)=>{const titleContainer=item.querySelector('.e-n-menu-title-text');const link=item.querySelector('a.e-n-menu-title-container');const dropdownNav=item.querySelector('.elementor-nav-menu--dropdown ul');let menuItem={id:'menu-item-'+index,titleHTML:titleContainer?titleContainer.innerHTML.trim():'',url:link?link.getAttribute('href'):null,isGTranslate:titleContainer&&titleContainer.innerHTML.indexOf('gtranslate_wrapper')!==-1,children:[]};if(dropdownNav){const childItems=dropdownNav.querySelectorAll('li');childItems.forEach((childLi,childIdx)=>{const childLink=childLi.querySelector('a');if(childLink){menuItem.children.push({id:'child-'+index+'-'+childIdx,titleHTML:childLink.innerHTML.trim(),url:childLink.getAttribute('href')})}})}
11const titleLower=menuItem.titleHTML.toLowerCase();if((titleLower.indexOf('contatti')===-1&&titleLower.indexOf('contacts')===-1)||menuItem.children.length>0){menuTree.push(menuItem)}});buildOverlayHTML(menuTree);isMobileInit=!0}
12function buildOverlayHTML(menuTree){let mainListHTML='';let subPanelsHTML='';menuTree.forEach(item=>{const hasChildren=item.children.length>0;mainListHTML+=`<li>`;if(hasChildren){const targetPanel='wcg-panel-'+item.id;mainListHTML+=`
13                    <div class="wcg-menu-parent-link" data-target="${targetPanel}">
14                        ${item.titleHTML}
15                        <span class="wcg-menu-arrow"></span>
16                    </div>
17                `;let childrenHTML='';item.children.forEach(child=>{childrenHTML+=`<li><a href="${child.url}">${child.titleHTML}</a></li>`});subPanelsHTML+=`
18                    <div class="wcg-mobile-menu-panel panel-hidden-right" id="${targetPanel}">
19                        <div class="wcg-mobile-menu-back" data-target="wcg-panel-main">
20                            <span class="wcg-back-arrow"></span>
21                            ${item.titleHTML.replace(/<[^>]*>?/gm, "")} <!-- Strip tags for back button -->
22                        </div>
23                        <ul>
24                            ${childrenHTML}
25                        </ul>
26                    </div>
27                `}else{if(item.isGTranslate){mainListHTML+=`<div class="wcg-gtranslate-mobile">${item.titleHTML}</div>`}else if(!item.url||item.url==='#'){mainListHTML+=`<a>${item.titleHTML}</a>`}else{mainListHTML+=`<a href="${item.url}">${item.titleHTML}</a>`}}
28mainListHTML+=`</li>`});const overlayHTML=`
29            <div class="wcg-mobile-menu-overlay">
30                <div class="wcg-mobile-menu-panels">
31                    <div class="wcg-mobile-menu-panel panel-current" id="wcg-panel-main">
32                        <ul>
33                            ${mainListHTML}
34                        </ul>
35
36                        <div class="wcg-mobile-menu-footer">
37                            ${document.documentElement.lang === 'en'
38                                ? `<a href="/en/contacts/" class="wcg-mobile-menu-contact-btn">Contacts<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M7 17L17 7M17 7H7M17 7V17" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></a>`
39                                : `<a href="/contatti/" class="wcg-mobile-menu-contact-btn">Contatti<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M7 17L17 7M17 7H7M17 7V17" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></a>`
40                            }
41                        </div>
42                    </div>
43
44                    ${subPanelsHTML}
45                </div>
46            </div>
47        `;document.body.insertAdjacentHTML('beforeend',overlayHTML);bindEvents()}
48function bindEvents(){const triggers=document.querySelectorAll('.wcg-mobile-menu-trigger');const body=document.body;const panels=document.querySelectorAll('.wcg-mobile-menu-panel');function toggleMenu(){body.classList.toggle('wcg-mobile-menu-open');if(body.classList.contains('wcg-mobile-menu-open')){let header=document.getElementById('header')||document.querySelector('.rh_header')||document.querySelector('.elementor-location-header')||document.querySelector('header');const overlay=document.querySelector('.wcg-mobile-menu-overlay');if(header&&overlay){const searchBars=document.querySelectorAll('#rh_prop_search_init_sticy, .wcg-search-bar, .home-search-warp');
48searchBars.forEach(sb=>sb.classList.remove('wcg-search-open'));const forms=document.querySelectorAll('.rh_prop_search__form');const origStyles=[];forms.forEach((f)=>{origStyles.push({trans:f.style.transition,anim:f.style.animation,maxH:f.style.maxHeight});f.style.setProperty('transition','none','important');f.style.setProperty('animation','none','important');f.style.setProperty('max-height','0px','important')});let headerHeight=header.offsetHeight;if(headerHeight>150){headerHeight=68}
49forms.forEach((f,i)=>{f.style.transition=origStyles[i].trans;f.style.animation=origStyles[i].anim;f.style.maxHeight=origStyles[i].maxH});const topVal=headerHeight>0?headerHeight:67;overlay.style.setProperty('top',topVal+'px','important');overlay.style.setProperty('height','calc(100vh - '+topVal+'px)','important')}
50body.style.overflow='hidden';body.style.position='fixed';body.style.width='100%'}else{body.style.overflow='';body.style.position='';body.style.width='';setTimeout(resetPanels,300)}}
51triggers.forEach(trigger=>{trigger.addEventListener('click',toggleMenu)});const parentLinks=document.querySelectorAll('.wcg-menu-parent-link');const backBtns=document.querySelectorAll('.wcg-mobile-menu-back');parentLinks.forEach(link=>{link.addEventListener('click',function(e){if(e.target.tagName==='A'||e.target.closest('a'))return;e.preventDefault();const targetId=this.getAttribute('data-target');const targetPanel=document.getElementById(targetId);const currentPanel=this.closest('.wcg-mobile-menu-panel');if(targetPanel&&currentPanel){currentPanel.classList.remove('panel-current');currentPanel.classList.add('panel-hidden-left');targetPanel.classList.remove('panel-hidden-right');targetPanel.classList.add('panel-current')}})});backBtns.forEach(btn=>{btn.addEventListener('click',function(e){e.preventDefault();const targetId=this.getAttribute('data-target');const targetPanel=document.getElementById(targetId);const currentPanel=this.closest('.wcg-mobile-menu-panel');if(targetPanel&&currentPanel){currentPanel.classList.remove('panel-current');currentPanel.classList.add('panel-hidden-right');targetPanel.classList.remove('panel-hidden-left');targetPanel.classList.add('panel-current')}})});function resetPanels(){panels.forEach(panel=>{panel.classList.remove('panel-current','panel-hidden-left','panel-hidden-right');if(panel.id==='wcg-panel-main'){panel.classList.add('panel-current')}else{panel.classList.add('panel-hidden-right')}})}}
52checkBreakpoints();window.addEventListener('resize',()=>{checkBreakpoints()})})

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.