/** * Crawler for Elementor * Customizable ticker for Elementor editor * Exclusively on https://1.envato.market/crawler-elementor * * @encoding UTF-8 * @version 1.0.7 * @copyright (C) 2018 - 2021 Merkulove ( https://merkulov.design/ ). All rights reserved. * @license Envato License https://1.envato.market/KYbje * @contributors Nemirovskiy Vitaliy (nemirovskiyvitaliy@gmail.com), Dmitry Merkulov (dmitry@merkulov.design), Cherviakov Vlad (vladchervjakov@gmail.com) * @support help@merkulov.design **/ "use strict";const mdpCrawler={crawler:function(e){const t=document.querySelector("."+e).dataset.tickerType,n=document.querySelector("."+e).dataset.tickerMode;function r(){const t=document.querySelector(`.${e} .mdp-crawler-elementor-content-wrapper`).offsetWidth,n=document.querySelector(`.${e} .mdp-crawler-elementor-content-wrapper`),r=document.querySelector(`.${e} .mdp-crawler-elementor-ticker-content`),o=document.querySelector(`.${e} .mdp-crawler-elementor-ticker`).offsetWidth,i=document.documentElement;t{e.classList.add("mdp-crawler-elementor-ticker-content-enable-animation"),o+=e.offsetWidth});const i=Math.ceil(n/o);if(i)for(let e=0;e{e.classList.add("mdp-crawler-elementor-ticker-content-enable-animation");const n=e.cloneNode(!0);n.classList.add("mdp-crawler-elementor-ticker-content-enable-animation"),t.appendChild(n)})}if("slider"===t){const t=+document.querySelector(`.${e} `).dataset.slidesToShowWidescreen,n=+document.querySelector(`.${e} `).dataset.slidesToShowLaptop,r=+document.querySelector(`.${e} `).dataset.slidesToShowTabletExtra,o=+document.querySelector("."+e).dataset.slidesToShowTablet,c=+document.querySelector("."+e).dataset.slidesToShowMobileExtra,l=+document.querySelector("."+e).dataset.slidesToShowMobile;function i(){let i;return elementorFrontend.config.responsive.activeBreakpoints.hasOwnProperty("widescreen")&&window.matchMedia(`(min-width: ${elementorFrontend.config.responsive.activeBreakpoints.widescreen.value}px)`).matches&&t&&(i=t),t&&elementorFrontend.config.responsive.activeBreakpoints.hasOwnProperty("widescreen")?window.matchMedia(`(min-width: ${elementorFrontend.config.responsive.activeBreakpoints.tablet.value+1}px)`).matches&&window.matchMedia(`(max-width: ${elementorFrontend.config.responsive.activeBreakpoints.widescreen.value-1}px)`).matches&&(i=+document.querySelector("."+e).dataset.slidesToShow):window.matchMedia(`(min-width: ${elementorFrontend.config.responsive.activeBreakpoints.tablet.value+1}px)`).matches&&(i=+document.querySelector("."+e).dataset.slidesToShow),elementorFrontend.config.responsive.activeBreakpoints.hasOwnProperty("laptop")&&window.matchMedia(`(max-width: ${elementorFrontend.config.responsive.activeBreakpoints.laptop.value}px)`).matches&&n&&(i=n),elementorFrontend.config.responsive.activeBreakpoints.hasOwnProperty("tablet_extra")&&window.matchMedia(`(max-width: ${elementorFrontend.config.responsive.activeBreakpoints.tablet_extra.value}px) `).matches&&r&&(i=r),window.matchMedia(`(max-width: ${elementorFrontend.config.responsive.activeBreakpoints.tablet.value}px)`).matches&&o&&(i=o),elementorFrontend.config.responsive.activeBreakpoints.hasOwnProperty("mobile_extra")&&window.matchMedia(` (max-width: ${elementorFrontend.config.responsive.activeBreakpoints.mobile_extra.value}px) `).matches&&c&&(i=c),window.matchMedia(`(max-width: ${elementorFrontend.config.responsive.activeBreakpoints.mobile.value}px)`).matches&&l&&(i=l),i}setTimeout(()=>{this.tickerSlider(e,i())},200),window.addEventListener("resize",()=>{setTimeout(()=>{this.tickerSlider(e,i())},200)})}else{const t=new ResizeObserver(e=>{for(const i of e){0!==i.contentRect.width&&("gapped"===n?r():o(),t.disconnect())}});t.observe(document.querySelector(`.${e} .mdp-crawler-elementor-ticker`))}},tickerSlider:function(e,t){if("slider"!==document.querySelector("."+e).dataset.tickerType)return;const n=document.querySelector(`.${e} .mdp-crawler-elementor-ticker-slider`),r=document.querySelector(`.${e} .mdp-crawler-elementor-next-arrow`),o=document.querySelector(`.${e} .mdp-crawler-elementor-previous-arrow`),i=document.querySelector(`.${e} .mdp-crawler-elementor-ticker-label`),c=n.children,l=n.children.length,s=+document.querySelector("."+e).dataset.slidesToScroll,a=+document.querySelector("."+e).dataset.slidesTransitionSpeed,d=document.querySelector("."+e).dataset.sliderAnimation,m=document.querySelector("."+e).dataset.slidesDirection,u=document.querySelector("."+e).dataset.infiniteLoop;let p,h,w,v,f=0,y=!0,x=!0;if("slide"===d){"right"===m&&(n.style.flexDirection="row-reverse"),t||(t=+document.querySelector("."+e).dataset.slidesToShow);let d=0;if(i){d=i.getBoundingClientRect().width.toFixed(2);const t=document.querySelector("."+e).getBoundingClientRect().width.toFixed(2)-d;n.parentElement.style.width=t+"px"}else n.parentElement.style.width="100%";"yes"===u&&n.children.length>=t&&function(){let e=[],r=[],o=l-1;for(let n=0;n=t?L(1,"drag"):v-w>100&&n.children.length>=t?L(-1,"drag"):n.style.left=w+"px",document.onmouseup=null,document.onmousemove=null}function L(e,r){a&&(n.style.transition=`all ${a}s`),r||!y&&!x||(w=parseFloat(window.getComputedStyle(n).getPropertyValue("left"))),1===e&&x&&n.children.length>=t?(f+=s,n.style.left="right"===m?w+q*s+"px":w-q*s+"px",f>=l-t&&"yes"!==u&&(n.style.left="right"===m?q*(l-t)+"px":-q*(l-t)+"px"),x=!1):-1===e&&y&&n.children.length>=t&&(f-=s,n.style.left="right"===m?w-q*s+"px":w+q*s+"px",f<=0&&"yes"!==u&&(n.style.left="0px"),y=!1)}n.style.left="left"===m?"yes"===u&&n.children.length>=t?-q*t+"px":"0px":"yes"===u&&n.children.length>=t?q*t+"px":"0px",n.addEventListener("transitionend",(function(){if(n.style.transition="none",y=!0,x=!0,0===f&&"yes"!==u)y=!1;else if(f<=-1){f+=l;const e=q*(f+t);n.style.left="right"===m?e+"px":-e+"px"}if(f>=l-t&&"yes"!==u)x=!1;else if(f>=l){f-=l;const e=q*(f+t);n.style.left="right"===m?e+"px":-e+"px"}})),n.onmousedown=S,n.addEventListener("touchstart",S),n.addEventListener("touchend",g),n.addEventListener("touchmove",k),(r||o)&&(r.addEventListener("click",()=>{L(1)}),o.addEventListener("click",()=>{L(-1)}))}else{for(let e=0;e{q(1)}),o.addEventListener("click",()=>{q(-1)}));let i=!1;function E(e){t="touchstart"===e.type?e.touches[0].clientX:e.clientX,i=!0,"touchstart"===e.type?n.addEventListener("touchmove",b,!1):n.addEventListener("mousemove",b,!1)}function $(e){i=!1,n.removeEventListener("mousemove",b,!1),n.removeEventListener("touchmove",b,!1)}function b(e){if(e.preventDefault(),!i)return;q(("touchmove"===e.type?Math.round(t-e.touches[0].clientX):t-e.clientX)>0?1:-1),i=!1}n.addEventListener("mousedown",E,!1),n.addEventListener("mouseup",$,!1),n.addEventListener("mouseleave",$,!1),n.addEventListener("touchstart",E,!1),n.addEventListener("touchend",$,!1),n.addEventListener("touchcancel",$,!1)}},addCrawler:function(){const e=document.querySelectorAll(".mdp-crawler-elementor-box");for(let t=0;t