// Polyfill for IE11 missing NodeList.forEach if ('NodeList' in window && !NodeList.prototype.forEach) { console.info('polyfill for IE11'); NodeList.prototype.forEach = function (callback, thisArg) { thisArg = thisArg || window; for (var i = 0; i < this.length; i++) { callback.call(thisArg, this[i], i, this); } }; }; // table content if(document.querySelector('.tbd8cd669')){ let tableContent = document.querySelector('.tbd8cd669'), heading = tableContent.querySelector('.heading'); heading.addEventListener('click', function(){ if(tableContent.classList.contains('table__content_open')){ this.setAttribute('aria-expanded', false); tableContent.classList.remove('table__content_open'); } else { this.setAttribute('aria-expanded', true); tableContent.classList.add('table__content_open'); } }); } // faq if(document.querySelector('.faq__block')){ let faqs = document.querySelectorAll('.faq__item'); faqs.forEach(function(el){ let faqBtn = el.querySelector('.heading'); faqBtn.addEventListener('click', function(){ if(el.classList.contains('faq__item__open')){ this.setAttribute('aria-expanded', false); el.classList.remove('faq__item__open'); } else { this.setAttribute('aria-expanded', true); el.classList.add('faq__item__open'); } }) }) } document.addEventListener('DOMContentLoaded', function() { let arrs = document.querySelectorAll('#tefe408ef a'); const toc = document.querySelector('.tefe408ef'); if(arrs.length > 0) { arrs.forEach(function(el) { el.addEventListener('click', function(e) { toc.classList.remove('open'); document.querySelector('body').classList.remove('body_scroll'); }); }); } }); function send_form_data(form) { //form.querySelector('.captcha-false').style.display='none'; let btn = form.querySelector('.btn'); btn.disabled= true; //grecaptcha.ready(function() { //grecaptcha.execute('6LdFrA4qAAAAAIC3TeE1eeC4wtn2HEPCPnmKMSZZ', {action: 'submit'}).then(function(token) { // Add your logic to submit to your backend server here. let formData = new FormData(form); formData.append( 'action', 'send_form' ); // let tel_code=''; // if(tel){tel_code = tel.innerText ;} // formData.append( 'tel_code', tel_code ); // formData.append( 'current_url', current_url); // formData.append( 'g-recaptcha-response', token ); fetch( ajaxurlsend, { method: 'POST', body: formData, } ) .then( res => res.text() ) .then( data => { btn.disabled= false; //console.log(data); // if(data == 'Captcha error'){ // form.querySelector('.captcha-false').style.display='block'; // }else { // btn.innerHTML = 'Sent'; // form.reset(); // } // show popup //show_popup(); }) .catch( err => console.log( err ) ); //}); //}); } let contacts = document.querySelectorAll('.form-contact'); if(contacts){ contacts.forEach((form)=>{ form.addEventListener('submit', function(event) { event.preventDefault(); send_form_data(form); }); }); }