188 lines
7.8 KiB
JavaScript
188 lines
7.8 KiB
JavaScript
// 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 = `
|
|
// <a href="https://www.google.com/search?sca_esv=a55453b1a2e256c7&sxsrf=AE3TifNoSGmG80uQ-x7mtWOK5gpCW7JsEA:1749074537834&uds=AOm0WdE2fekQnsyfYEw8JPYozOKzrlAVkNCu_AoCAsiKnoHr1pg7JgUIHdDkJWfE1XKjyVTPHC-4q5ESJH2zE7vZdmMS0pOZf973xLUCTLP3IcLLfWH63gy1wQDFC6A5LWKxBohKjBYDyXSgmJGeLQ2eP3t8w5acByaD1qhbVny8b1B6hhsuCyQ&si=AMgyJEuzsz2NflaaWzrzdpjxXXRaJ2hfdMsbe_mSWso6src8s1htkSNfLSEhAxFYP5Svp_mWLUxmfe_GBYavp3unJ16h0Lo9m_I0mYEYNqC9tPHs_bfHt4k%3D&q=Biuro+Podr%C3%B3%C5%BCy+Wagabunda+Rzesz%C3%B3w+Opinie&sa=X&ved=2ahUKEwjLsI204tiNAxWNIRAIHUg5ID4Q3PALegQIQRAF&biw=2560&bih=935&dpr=1" target="_blank">
|
|
// <img src="https://vcms.eu/image/getthumb/513608">
|
|
// </a>
|
|
// `
|
|
|
|
// 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 = '<span>Skontaktuj się z nami</span>'
|
|
newLink.href = '/contact'
|
|
newLink.className = 'extra-link btn'
|
|
|
|
item.querySelector('.text-container').appendChild(newLink)
|
|
})
|
|
}
|
|
|
|
addBtnHomePage()
|
|
|
|
//! New header
|
|
let header_html = `
|
|
<div id="custom-header">
|
|
<div class="container-fluid wrapper">
|
|
<div class="custom-header">
|
|
<div class="c-col c-col-1">
|
|
<a href="/">
|
|
<img src="/image//getbyid/514053">
|
|
<span>specjaliści od wakacji</span>
|
|
</a>
|
|
</div>
|
|
<div class="c-col c-col-2">
|
|
<ul>
|
|
<li><strong>Kontakt z nami:</strong></li>
|
|
<li><strong>RZESZÓW</strong> <a href="tel:178537069">17 853-70-69</a>, <a href="tel:511638822">511-638-822</a></li>
|
|
<li><strong>JAROSŁAW</strong> <a href="tel:166211277">16 621-12-77</a>, <a href="tel:665999981">665-999-981</a></li>
|
|
<li><strong>SANOK</strong> <a href="tel:134643993">13 464-39-93</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="c-col c-col-3">
|
|
<ul>
|
|
<li><strong>Kontakt e-mail:</strong></li>
|
|
<li><a href="mailto:wagabundarz@wp.pl">wagabundarz@wp.pl</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="c-col c-col-4">
|
|
<ul class="box-social-header">
|
|
<li class="box-social-header-1">
|
|
<a href="https://www.facebook.com/479269998793537" target="_blank" class="btn-social text-color-1 background-color-12 mobile-menu-item" data-mobile-menu-item-type="social" data-mobile-menu-item-icon="fa-facebook" id="footer-btn-facebook">
|
|
<img src="https://vcms.eu/image/getthumb/514243">
|
|
</a>
|
|
</li>
|
|
<li class="box-social-header-2">
|
|
<a href="https://www.google.com/search?sca_esv=a55453b1a2e256c7&sxsrf=AE3TifNoSGmG80uQ-x7mtWOK5gpCW7JsEA:1749074537834&uds=AOm0WdE2fekQnsyfYEw8JPYozOKzrlAVkNCu_AoCAsiKnoHr1pg7JgUIHdDkJWfE1XKjyVTPHC-4q5ESJH2zE7vZdmMS0pOZf973xLUCTLP3IcLLfWH63gy1wQDFC6A5LWKxBohKjBYDyXSgmJGeLQ2eP3t8w5acByaD1qhbVny8b1B6hhsuCyQ&si=AMgyJEuzsz2NflaaWzrzdpjxXXRaJ2hfdMsbe_mSWso6src8s1htkSNfLSEhAxFYP5Svp_mWLUxmfe_GBYavp3unJ16h0Lo9m_I0mYEYNqC9tPHs_bfHt4k%3D&q=Biuro+Podr%C3%B3%C5%BCy+Wagabunda+Rzesz%C3%B3w+Opinie&sa=X&ved=2ahUKEwjLsI204tiNAxWNIRAIHUg5ID4Q3PALegQIQRAF&biw=2560&bih=935&dpr=1" target="_blank">
|
|
<img src="https://vcms.eu/image/getthumb/513608">
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
|
|
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', `
|
|
<div class="mega-menu-hamburger">
|
|
<button class="mega-menu-hamburger-btn" aria-expanded="true" aria-controls="mega-menu-list">
|
|
<span></span>
|
|
</button>
|
|
</div>
|
|
`);
|
|
|
|
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);
|
|
});
|
|
}
|
|
})(); |