?? GreyFile — Mystic File Browser

Current path: home/webdevt/www/wdp/wp-content/plugins/supreme-modules-pro-for-divi/includes/modules/AdvancedTabs/



?? Go up: /home/webdevt/www/wdp/wp-content/plugins/supreme-modules-pro-for-divi/includes/modules

?? Viewing: frontend.min.js

class AdvancedTabs{constructor(t){this.container=t,this.tabs=t.querySelectorAll(":scope > .dsm-advanced-tabs-wrapper > .dsm-tab"),this.tabsContent=t.querySelectorAll(":scope > .dsm-advanced-tabs-content-wrapper > .dsm-content-wrapper"),this.trigger=t.dataset.trigger,this.animationName=t.dataset.animation,this.innerAnimationName=t.dataset.inner_animation,this.deepLink="on"===t.dataset.deep_link,this.autoScrollMobile="on"===t.dataset.auto_scroll_mobile,this.anchorLink="on"===t.dataset.anchor_link,this.init()}init(){this.setupEventListeners(),this.handleInitialState()}setupEventListeners(){this.tabs.forEach(t=>{"click"===this.trigger?t.addEventListener("click",e=>this.handleEvent(e,t)):"hover"===this.trigger&&t.addEventListener("mouseover",e=>this.handleEvent(e,t)),t.addEventListener("keydown",e=>{"Enter"===e.key&&this.handleEvent(e,t)})})}handleInitialState(){let t=this.tabs[0],e=!1;if(this.deepLink&&location.hash){let a=location.hash.substring(1),i=Array.from(this.tabs).find(t=>{let e=t.querySelector(".dsm-title");return e&&e.textContent.toLowerCase().replace(/\s+/g,"-")===a});i&&(t=i,e=!0)}this.setActiveTab(t,!1),this.anchorInitScroll(),e&&t.scrollIntoView({behavior:"smooth",block:"start"})}handleEvent(t,e){t.stopPropagation(),this.setActiveTab(e),this.autoScrollOnMobile(e)}setActiveTab(t,e=!0){let a=t.dataset.tabid.trim(),i=Array.from(this.tabsContent).find(t=>t.dataset.contentid.trim()===a);if(!i)return;this.tabs.forEach(t=>t.classList.remove("dsm-active",this.animationName)),this.tabsContent.forEach(t=>{t.classList.remove("dsm-active",this.animationName);let e=t.querySelector(".dsm-inner-content-wrapper");e&&e.classList.remove("animated",this.innerAnimationName)}),t.classList.add("dsm-active"),i.classList.add("dsm-active",this.animationName);let n=i.querySelector(".dsm-inner-content-wrapper");if(n&&n.classList.add("animated",this.innerAnimationName),this.deepLink&&e){let s=t.querySelector(".dsm-title");if(s){let r=s.textContent.toLowerCase().replace(/\s+/g,"-");history.pushState(null,null,`#${r}`),this.container.classList.add("dsm-active-deep-link")}}}autoScrollOnMobile(t){let e=t.dataset.tabid.trim(),a=Array.from(this.tabsContent).find(t=>t.dataset.contentid.trim()===e);this.autoScrollMobile&&window.innerWidth<=768&&a.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}anchorSmoothScroll(t){let e=null,a=t.replace(/-/g,"");e=document.querySelector(`.${a}`),this.anchorLink&&this.deepLink&&e&&e.scrollIntoView({behavior:"smooth",block:"start"})}findMatchingTab(t){let e=t.replace(/-/g,""),a=Array.from(this.tabs).find(t=>t.classList.contains(e));return a?(this.setActiveTab(a),a):null}anchorInitScroll(){let t=document.querySelectorAll("a");for(let e=0;e<t.length;e++){let a=t[e],i=a.getAttribute("href");i&&i.startsWith("#")&&i.length>=1&&a.addEventListener("click",t=>{let e=i.slice(1);this.anchorSmoothScroll(e),this.findMatchingTab(e)})}}}window.addEventListener("load",()=>{let t=e=>{new AdvancedTabs(e);let a=e.querySelectorAll(":scope .dsm-content-wrapper .dsm-advanced-tabs-container");a.forEach(e=>{t(e)})},e=document.querySelectorAll(".dsm-advanced-tabs-container:not(.dsm-content-wrapper .dsm-advanced-tabs-container)");e.forEach(e=>{t(e)}),jQuery(()=>{jQuery(".dsm-content p").each(function(){0===jQuery(this).html().replace(/\s|&nbsp;/g,"").length&&jQuery(this).remove()})})});


??

??