Current Path : /home/e/p/h/ephorei/www/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/ |
Current File : /home/e/p/h/ephorei/www/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/faq.min.js |
function slideUp(e,t){e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.boxSizing="border-box",e.style.height=e.offsetHeight+"px",e.offsetHeight,e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,window.setTimeout(function(){e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)}function slideDown(e,t){e.style.removeProperty("display");let o=window.getComputedStyle(e).display;"none"===o&&(o="block"),e.style.display=o;var a=e.offsetHeight;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height=a+"px",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),window.setTimeout(function(){e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)}function setupFAQ(){const e=new RegExp("^[\\w\\-]+$");var t=window.location.hash.substring(1);const o=document.getElementsByClassName("uagb-faq-expand-first-true"),a=document.getElementsByClassName("uagb-faq-inactive-other-false");if(void 0!==document.getElementById(t)&&null!==document.getElementById(t)&&""!==document.getElementById(t)&&e.test(t)){const i=document.getElementById(t);void 0!==i&&(i.classList.add("uagb-faq-item-active"),i.setAttribute("aria-expanded",!0),(t=i.getElementsByClassName("uagb-faq-content")[0])&&slideDown(t,500))}else for(let t=0;t<o.length;t++)if(!0===o[t].classList.contains("uagb-faq-layout-accordion")){let e=o[t].querySelectorAll(".uagb-faq-child__outer-wrap.uagb-faq-item")[0];(e=e||o[t].querySelectorAll(".uagb-faq-child__outer-wrap .uagb-faq-item")[0]).classList.add("uagb-faq-item-active"),e.setAttribute("aria-expanded",!0),e.querySelectorAll(".uagb-faq-content")[0].style.display="block"}for(let e=0;e<a.length;e++)if(!0===a[e].classList.contains("uagb-faq-layout-accordion")){let t=a[e].querySelectorAll(".uagb-faq-child__outer-wrap.uagb-faq-item");t&&0!==t.length||(t=a[e].querySelectorAll(".uagb-faq-child__outer-wrap .uagb-faq-item"));for(let e=0;e<t.length;e++)t[e].classList.add("uagb-faq-item-active"),t[e].setAttribute("aria-expanded",!0),t[e].querySelectorAll(".uagb-faq-content")[0].style.display="block"}}function faqClick(t,o,a){if(13===t.keyCode||32===t.keyCode||0===t.button)if(o.classList.contains("uagb-faq-item-active"))o.classList.remove("uagb-faq-item-active"),o.setAttribute("aria-expanded",!1),slideUp(o.getElementsByClassName("uagb-faq-content")[0],500);else{const i=t.currentTarget.closest(".wp-block-uagb-faq");let e="true";if(i.classList.contains("wp-block-uagb-faq")&&(e=i.getAttribute("data-faqtoggle")),o.classList.add("uagb-faq-item-active"),o.setAttribute("aria-expanded",!0),slideDown(o.getElementsByClassName("uagb-faq-content")[0],500),"true"===e){a=i.querySelectorAll(".uagb-faq-content");for(let e=0;e<a.length;e++){const l=a[e].parentElement;l!==o&&(l.classList.remove("uagb-faq-item-active"),l.setAttribute("aria-expanded",!1),slideUp(l.getElementsByClassName("uagb-faq-content")[0],500))}}}}window.addEventListener("load",function(){setupFAQ();const t=document.getElementsByClassName("uagb-faq-layout-accordion");for(let e=0;e<t.length;e++){const o=t[e].querySelectorAll(".uagb-faq-questions-button"),a=t[e].querySelectorAll(".uagb-faq-item");for(let e=0;e<o.length;e++)o[e].addEventListener("click",function(e){faqClick(e,this.parentElement,o)});for(let e=0;e<a.length;e++)a[e].addEventListener("keyup",function(e){faqClick(e,this,o)})}});