// function addGoogleReviews() { // let topHeader = document.getElementById('main-header') // if (!topHeader) return console.log('topHeader not found'); // let topHeaderMain = topHeader.querySelector('.functional-header .main') // if (!topHeaderMain) return console.log('topHeaderMain not found'); // let children = topHeaderMain.querySelectorAll(':scope > div') // if (children.length > 1) { // children[1].remove() // } // let newDiv = document.createElement('div') // newDiv.className = // 'col-md-3 col-sm-4 hidden-xs hidden-sm sm-center google-reviews' // newDiv.innerHTML = ` // // // // ` // topHeaderMain.appendChild(newDiv) // } // addGoogleReviews() function addBtnHomePage() { let slider = document.getElementById('widget197464156') if (!slider) return let sliders = slider.querySelectorAll('.carousel .carousel-inner .item') console.log(sliders) sliders.forEach(function (item) { let newLink = document.createElement('a') newLink.innerHTML = 'Skontaktuj się z nami' newLink.href = '/contact' newLink.className = 'extra-link btn' item.querySelector('.text-container').appendChild(newLink) }) } addBtnHomePage() //! New header let header_html = `
` const mainHeader = document.querySelector('#main-header') const firstRow = mainHeader.querySelector('.row.sortable-row') if (firstRow) { firstRow.outerHTML = header_html } // MARK: hamburger menu (function () { const menuList = document.querySelector('nav.main-nav ul.mega-menu-content'); if (!menuList) return; menuList.insertAdjacentHTML('beforebegin', `
`); menuList.id = menuList.id || 'mega-menu-list'; const hamburgerBtn = document.querySelector('.mega-menu-hamburger-btn'); function slideUp(element, duration = 300) { element.style.height = element.offsetHeight + 'px'; element.offsetHeight; element.style.transitionProperty = 'height, margin, padding'; element.style.transitionDuration = duration + 'ms'; element.style.overflow = 'hidden'; element.style.height = '0'; element.style.paddingTop = '0'; element.style.paddingBottom = '0'; element.style.marginTop = '0'; element.style.marginBottom = '0'; window.setTimeout(function () { element.style.display = 'none'; element.style.removeProperty('height'); element.style.removeProperty('padding-top'); element.style.removeProperty('padding-bottom'); element.style.removeProperty('margin-top'); element.style.removeProperty('margin-bottom'); element.style.removeProperty('overflow'); element.style.removeProperty('transition-duration'); element.style.removeProperty('transition-property'); }, duration); } function slideDown(element, duration = 300) { element.style.removeProperty('display'); let display = window.getComputedStyle(element).display; if (display === 'none') display = 'flex'; element.style.display = display; const height = element.scrollHeight; element.style.overflow = 'hidden'; element.style.height = '0'; element.style.paddingTop = '0'; element.style.paddingBottom = '0'; element.style.marginTop = '0'; element.style.marginBottom = '0'; element.offsetHeight; element.style.transitionProperty = 'height, margin, padding'; element.style.transitionDuration = duration + 'ms'; element.style.height = height + 'px'; window.setTimeout(function () { element.style.removeProperty('height'); element.style.removeProperty('overflow'); element.style.removeProperty('transition-duration'); element.style.removeProperty('transition-property'); element.style.removeProperty('padding-top'); element.style.removeProperty('padding-bottom'); element.style.removeProperty('margin-top'); element.style.removeProperty('margin-bottom'); }, duration); } function slideToggle(element, duration = 300) { if (window.getComputedStyle(element).display === 'none') { slideDown(element, duration); } else { slideUp(element, duration); } } if (hamburgerBtn) { hamburgerBtn.addEventListener('click', function () { hamburgerBtn.classList.toggle('active'); const isExpanded = hamburgerBtn.classList.contains('active'); hamburgerBtn.setAttribute('aria-expanded', String(isExpanded)); slideToggle(menuList, 250); }); } })();