Business Insider

`; const adLabel = document.createElement('div'); adLabel.classList.add(this.anchorContainer.id + '_Ad_Label'); adLabel.classList.add(this.anchorContainer.id + '_Ad_Label_Small'); adLabel.innerHTML = 'AD'; brandedTop.appendChild(adLabel); const anchorObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (entry.target.dataset.mixBrandedViewed === '0') { entry.target.dataset.mixBrandedViewed = '1'; if (adContent.ad_pings && Array.isArray(adContent.ad_pings) && adContent.ad_pings.length > 0) { adContent.ad_pings.forEach((adPing) => { adPing.event = 'print'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); adContent.ad_pings.forEach((adPing) => { adPing.event = 'show'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); } if (adContent.pixel_trackings && Array.isArray(adContent.pixel_trackings) && adContent.pixel_trackings.length > 0) { this.addBrandedTrackings(adContent); } } } }); }, {threshold: [0.6]}); const isMobile = this.isMobile(); anchorItems.forEach((anchorItem, anchorIndex) => { if (isMobile && adContent.top_banner.on_mobile === 'first_item' && anchorIndex > 0) { return; } else if (!isMobile && adContent.top_banner.on_desktop === 'first_item' && anchorIndex > 0) { return; } const brandedTopClone = brandedTop.cloneNode(true); anchorItem.appendChild(brandedTopClone); anchorObserver.observe(brandedTopClone); document.documentElement.style.setProperty("--MIX-branded-top-banner-height", `${brandedTopClone.offsetHeight}px`); if (anchorIndex === 0) { window.addEventListener('resize', function () { document.documentElement.style.setProperty("--MIX-branded-top-banner-height", `${brandedTopClone.offsetHeight}px`); }); let resizeInterval = null; let resizeIntervalCount = 0; resizeInterval = setInterval(() => { resizeIntervalCount++; if (resizeIntervalCount > 10) { clearInterval(resizeInterval); } window.dispatchEvent(new Event('resize')); }, 500); } const currentLink = anchorItem.querySelector('a[class$="ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_Link"]'); if (currentLink) { currentLink.style.position = 'relative'; currentLink.style.borderTop = 'var(--MIX-branded-top-banner-height) solid transparent'; if (adContent.top_banner.item_url_params) { if (currentLink.href.includes('?')) { currentLink.href += `&${adContent.top_banner.item_url_params}`; } else { currentLink.href += `?${adContent.top_banner.item_url_params}`; } } } if (adContent.ad_pings && Array.isArray(adContent.ad_pings) && adContent.ad_pings.length > 0) { brandedTopClone.addEventListener('click', () => { adContent.ad_pings.forEach((adPing) => { adPing.event = 'click'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); }, { passive: true }); } }); } } checkAnchorTitleVariables(adContent) { if ( adContent.anchor_title.indexOf("{{DATE_COUNTER}}") > 0 && adContent.title_variable_data && adContent.title_variable_data.date && adContent.title_variable_data.endTitle ) { var endtime = adContent.title_variable_data.date; var total = Date.parse(endtime) - Date.parse(new Date()); var seconds = ('0' + (Math.floor((total / 1000) % 60))).slice(-2); var minutes = ('0' + (Math.floor((total / 1000 / 60) % 60))).slice(-2); var hours = ('0' + (Math.floor((total / (1000 * 60 * 60)) % 24))).slice(-2); var days = Math.floor(total / (1000 * 60 * 60 * 24)); var replacement = []; if (total 0) { replacement.push(days + 'd'); replacement.push(hours + 'h'); } else { replacement.push(hours + 'h'); replacement.push(minutes + 'm'); } adContent.anchor_title = adContent.anchor_title.replace("{{DATE_COUNTER}}", replacement.join(' ')); } return adContent.anchor_title; } addBrandedTrackings(adContent) { adContent.pixel_trackings.forEach((pixelUrl) => { const pixelImage = document.createElement('img'); pixelImage.setAttribute('class', this.anchorContainer.id + '_Branded_Tracking'); pixelImage.setAttribute('height', '1'); pixelImage.setAttribute('width', '1'); pixelImage.setAttribute('border', '0'); pixelImage.setAttribute('style', 'position:fixed!important;width:1px!important;height:1px!important;top:-100px!important;left:-100px!important;'); pixelImage.setAttribute('src', pixelUrl); this.anchorContainer.appendChild(pixelImage); }); }}(function () { try { const ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER = document.querySelector('#ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR:not([data-mix-init-data="1"])'); if (ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER) { const MIX_Script = new ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Script(ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER); MIX_Script.init(); } } catch(e) { console.error('Error D001 - Internal error'); console.error(e); }})();class ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Videos { constructor(container) { this.anchorContainer = container; this.anchorContainer.dataset.mixInitVideos = '1'; this.anchorLinks = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_Container'); this.anchorVideos = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_Video video'); this.anchorVideosDuration = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_VideoDuration'); this.allVideos = []; this.videosPool = []; this.videoTimer = null; } init() { if (this.anchorVideos.length === 0 && this.anchorVideosDuration.length === 0) { return; } const srcObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (!entry.target.hasAttribute('src')) { entry.target.addEventListener('loadeddata', () => { this.checkVideosPool(); }); entry.target.src = entry.target.dataset.mixVideoSrc; } } }); }, {threshold: [0]}); const videosObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (entry.target === this.allVideos[0]) { this.videosPool.unshift(entry.target); } else { this.videosPool.push(entry.target); } } else { this.videosPool = this.videosPool.filter((item) => item !== entry.target); } this.checkVideosPool(); }); }, {threshold: [1]}); this.anchorLinks.forEach((link, i) => { const video = link.querySelector('video'); if (video) { srcObserver.observe(video); const videoDuration = link.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_VideoDuration'); if (videoDuration) { video.addEventListener('loadedmetadata', () => { const duration = video.duration; if (!isNaN(duration) && duration !== Infinity) { const minutes = Math.floor(duration / 60); const seconds = Math.floor(duration - (minutes * 60)); videoDuration.innerHTML = `${minutes}:${seconds}`; videoDuration.dataset.mixShow = '1'; } }); } if (this.isMobile()) { this.allVideos.push(video); videosObserver.observe(video); } else { link.addEventListener('mouseenter', () => { if (link.classList.contains('disabled')) { video.pause(); } else { const loopStart = parseInt(video.dataset.mixVideoStart || '0'); const loopDuration = parseInt(video.dataset.mixVideoLoop || '2'); video.currentTime = loopStart; video.play().then(() => { this.videoTimer && clearInterval(this.videoTimer); this.videoTimer = setInterval(() => { video.currentTime = loopStart; }, loopDuration * 1000); }).catch(() => { }); } }); link.addEventListener('mouseleave', () => { const loopStart = parseInt(video.dataset.mixVideoStart || '0'); this.videoTimer && clearInterval(this.videoTimer); video.pause(); video.currentTime = loopStart; }); } } else { const videoDuration = link.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_VideoDuration'); if (videoDuration && videoDuration.dataset.mixVideoUrl) { const video = document.createElement('video'); video.addEventListener('loadedmetadata', () => { const duration = video.duration; if (!isNaN(duration) && duration !== Infinity) { const minutes = Math.floor(duration / 60); const seconds = Math.floor(duration - (minutes * 60)); videoDuration.innerHTML = `${minutes}:${seconds}`; videoDuration.dataset.mixShow = '1'; } }); video.src = videoDuration.dataset.mixVideoUrl; } } }); } checkVideosPool() { if (this.videosPool.length > 0) { const video = this.videosPool[0]; const loopStart = parseInt(video.dataset.mixVideoStart || '0'); const loopDuration = parseInt(video.dataset.mixVideoLoop || '2'); video.currentTime = loopStart; video.play().then(() => { this.videoTimer && clearInterval(this.videoTimer); this.videoTimer = setInterval(() => { video.currentTime = loopStart; }, loopDuration * 1000); }).catch(() => { }); this.allVideos.forEach((item) => { if (item !== video) { item.pause(); item.currentTime = loopStart; } }); } } isMobile() { return !!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)); }}(function () { try { const ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER = document.querySelector('#ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR:not([data-mix-init-videos="1"])'); if (ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER) { const MIX_Videos = new ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Videos(ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER); MIX_Videos.init(); } } catch(e) { console.error('Error V001 - Internal error'); console.error(e); }})();class ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Slider { constructor(container) { this.anchorContainer = container; this.anchorContainer.dataset.mixInitSlider = '1'; this.anchorId = this.anchorContainer.dataset.mixId; this.anchorTitle = this.anchorContainer.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Title_Container'); this.anchorContent = this.anchorContainer.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Items_Container'); this.anchorContentInner = this.anchorContainer.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Items_Container_Inner'); this.anchorLinks = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Items_Container_Inner a'); this.dragType = (navigator.maxTouchPoints > 0) ? 'touch' : 'mouse'; this.swipping = false; this.scrolling = false; this.sliderDirection = 0; this.clickPrevented = false; this.itemSize = { width: 0, height: 0, gap: 0 }; this.position = { startX: 0, startY: 0, clientStartX: 0, clientStartY: 0, x: 0, y: 0, clientX: 0, clientY: 0 }; this.showBtns = this.anchorContainer.dataset.mixShowBtns === '1'; this.btnsPosition = this.anchorContainer.dataset.mixBtnsPos; this.btnsMove = this.anchorContainer.dataset.mixBtnsMove; if (this.btnsMove !== 'pager') { this.btnsMove = parseInt(this.btnsMove); } this.btnPrev = this.btnNext = null; } init() { if (this.isMobile() || this.anchorLinks.length === 0) { return; } if (!this.anchorContentInner) { throw new Error('Error C001 - Anchor container not found'); } this.anchorContent.style.overflowX = 'hidden'; this.anchorContentInner.dataset.mixDragType = this.dragType; this.anchorContentInner.style.left = '0px'; this.initSliderEffect(); this.getItemSize(); this.addEvents(); if (this.showBtns) { this.addBtns(); } } initSliderEffect() { this.sliderEffect = { slider: this, lastPosition: 0, checkNewAction: true, actions: [], newAction: function (clientX) { if (this.checkNewAction) { this.checkNewAction = false; const newPosition = Math.abs(clientX) - Math.abs(this.lastPosition); this.lastPosition = clientX; this.actions.push(Math.abs(newPosition)); setTimeout(() => { this.checkNewAction = true; }, 20); } }, reset: function() { this.checkNewAction = true; this.actions = []; }, applyEffect: function (clientX) { if (this.actions.length { this.slider.anchorContentInner.style.transition = `${time}s`; let leftMove = this.slider.position.startX + -(this.slider.position.clientStartX - clientX) + percent * (this.slider.sliderDirection 0) { leftMove = 0; } if (this.slider.anchorContentInner.parentElement.clientWidth - this.slider.anchorContentInner.clientWidth > leftMove) { leftMove = this.slider.anchorContentInner.parentElement.clientWidth - this.slider.anchorContentInner.clientWidth; } this.slider.anchorContentInner.style.left = `${leftMove}px`; setTimeout(() => { this.slider.anchorContentInner.style.transition = ''; }, (time * 1000) + 100); }; this.newAction(clientX); let tmp = 0; let progressive = 1; let lastOne = this.actions[this.actions.length - 1]; let lastAction = this.actions[this.actions.length - 1] + (this.actions[this.actions.length - 2] / 10); for (let i = this.actions.length - 1; i >= 0 && i > this.actions.length - 5; i--) { tmp += this.actions[i]; if (progressive >= 0 && this.actions[i] > lastOne + 30) { progressive--; } lastOne = this.actions[i]; } if (lastAction > 10 && tmp > 600 && progressive >= 0) { effect(0.5, tmp); } else if (lastAction > 10 && tmp > 300) { effect(0.4, tmp * 0.8); } else if (lastAction > 10 && tmp > 50) { effect(0.5, tmp * 0.6); } } } } addEvents() { const lastTouch = { x: 0, y: 0 }; this.anchorContentInner.addEventListener('mousedown', (e) => { if ( this.dragType === 'touch' && Math.round(this.getClientPosition(e, 'x')) === Math.round(lastTouch.x) && Math.round(that.getClientPosition(e, 'y')) === Math.round(lastTouch.y) ) { return false; } if (e.button === 0 && this.anchorContentInner.clientWidth > this.anchorContentInner.parentElement.clientWidth) { this.dragStart(e); } }, { passive: true }); window.addEventListener('resize', () => { this.getItemSize(); if (typeof this.sliderEffect === 'undefined' && navigator.maxTouchPoints 0) { this.sliderEffect = undefined; this.dragType = 'touch'; } this.anchorContentInner.dataset.mixDragType = this.dragType; }); window.addEventListener('MIXv2_Event', (event) => { if (event.detail && event.detail.mixId && event.detail.mixId == this.anchorId && event.detail.eventId) { if (['BTN_PREV', 'BTN_NEXT'].includes(event.detail.eventId)) { this.onBtnClick(event.detail.eventId === 'BTN_PREV' ? 'prev' : 'next'); } } }); } addBtns() { let iconSrc = 'https://files.socy.cloud/_20/f/202407/upload/uf_1721812542tkzV0jsHV3RebrDx0IBA1Punyt.svg'; if (this.anchorContainer.dataset.mixBtnsUrl) { iconSrc = decodeURIComponent(this.anchorContainer.dataset.mixBtnsUrl); } let customBtnsHtmlStr = ''; const customBtnsHtml = document.querySelector('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CustomBtnsHTML'); if (customBtnsHtml) { customBtnsHtmlStr = customBtnsHtml.innerHTML; customBtnsHtml.remove(); } let btnsTitleContainer = null; let btnsFooterContainer = null; if (this.btnsPosition === 'title' && this.anchorTitle) { btnsTitleContainer = document.createElement('div'); btnsTitleContainer.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btns_Container', 'ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btns_Container_Title'); this.anchorTitle.append(btnsTitleContainer); } else if (this.btnsPosition === 'footer') { btnsFooterContainer = document.createElement('div'); btnsFooterContainer.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btns_Container', 'ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btns_Container_Footer'); this.anchorContainer.append(btnsFooterContainer); } const prevBtn = document.createElement('div'); prevBtn.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn'); prevBtn.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Prev'); prevBtn.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); prevBtn.dataset.mixBtnDirection = 'prev'; if (customBtnsHtmlStr) { prevBtn.innerHTML = customBtnsHtmlStr; } else { const prevIcon = document.createElement('img'); prevIcon.src = iconSrc; prevBtn.append(prevIcon); } if (btnsTitleContainer) { btnsTitleContainer.append(prevBtn); } else if (btnsFooterContainer) { btnsFooterContainer.append(prevBtn); } else { this.anchorContent.append(prevBtn); } this.btnPrev = prevBtn; prevBtn.addEventListener('click', (evt) => { evt.cancelable && evt.preventDefault(); evt.stopPropagation(); this.onBtnClick('prev'); }, { passive: false }); const nextBtn = document.createElement('div'); nextBtn.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn'); nextBtn.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Next'); nextBtn.dataset.mixBtnDirection = 'next'; if (customBtnsHtmlStr) { nextBtn.innerHTML = customBtnsHtmlStr; } else { const nextIcon = document.createElement('img'); nextIcon.src = iconSrc; nextBtn.append(nextIcon); } if (btnsTitleContainer) { btnsTitleContainer.append(nextBtn); } else if (btnsFooterContainer) { btnsFooterContainer.append(nextBtn); } else { this.anchorContent.append(nextBtn); } this.btnNext = nextBtn; nextBtn.addEventListener('click', (evt) => { evt.cancelable && evt.preventDefault(); evt.stopPropagation(); this.onBtnClick('next'); }, { passive: false }); } isMobile() { return !!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)); } getItemSize() { if (this.anchorContentInner.children && this.anchorContentInner.children.length > 0) { this.itemSize.width = this.anchorContentInner.children[0].offsetWidth; this.itemSize.height = this.anchorContentInner.children[0].offsetHeight; this.itemSize.gap = parseFloat(window.getComputedStyle(this.anchorContentInner).gap); } } getClientPosition(e, xy) { if (xy === 'x') { return (e.type.includes('touch')) ? e.touches[0].clientX : e.clientX; } else if (xy === 'y') { return (e.type.includes('touch')) ? e.touches[0].clientY : e.clientY; } return false; } onBtnClick(direction) { if (this.anchorContentInner.clientWidth > this.anchorContentInner.parentElement.clientWidth) { this.getItemSize(); const itemWidth = this.itemSize.width + this.itemSize.gap; let moveItems = itemWidth; if (this.btnsMove === 'pager') { moveItems *= this.getVisibleItems(); } else { moveItems *= this.btnsMove; } const maxRight = this.anchorContentInner.offsetWidth - this.anchorContentInner.parentElement.offsetWidth - Math.abs(this.anchorContentInner.offsetLeft); const maxLeft = Math.abs(this.anchorContentInner.offsetLeft); if (direction === 'next' && moveItems >= maxRight) { moveItems = maxRight; this.btnNext && this.btnNext.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); this.btnPrev && this.btnPrev.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); } else if (direction === 'prev' && moveItems >= maxLeft) { moveItems = maxLeft; this.btnPrev && this.btnPrev.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); this.btnNext && this.btnNext.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); } else { this.btnPrev && this.btnPrev.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); this.btnNext && this.btnNext.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); } if (direction === 'next') { moveItems *= -1; } this.anchorContentInner.style.transition = '0.8s'; this.anchorContentInner.style.left = `${this.anchorContentInner.offsetLeft + moveItems}px`; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 800); } } getVisibleItems() { const itemWidth = this.itemSize.width + this.itemSize.gap; const anchorWidth = this.anchorContentInner.parentElement.offsetWidth + this.itemSize.gap; return Math.floor(anchorWidth / itemWidth); } dragStart(e) { if (e.type.includes('touch') || this.isMobile()) { return false; } this.anchorContentInner.style.transition = ''; this.position.startX = this.anchorContentInner.offsetLeft; this.position.startY = this.anchorContentInner.offsetTop; this.position.clientStartX = this.getClientPosition(e, 'x'); this.position.clientStartY = this.getClientPosition(e, 'y'); if (typeof this.sliderEffect !== 'undefined') { this.sliderEffect.reset(); } this.swipping = undefined; this.scrolling = undefined; this.clickPrevented = false; this.anchorContainer.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Dragging'); this.btnPrev && this.btnPrev.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); this.btnNext && this.btnNext.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); document.onmouseup = (ev) => {this.dragEnd(ev);}; document.onmouseleave = (ev) => {this.dragEnd(ev);}; document.onmousemove = (ev) => {this.dragAction(ev);}; } dragAction (e) { if (e.type.includes('touch') || this.isMobile()) { return false; } if (((this.swipping && !this.scrolling) || (typeof this.swipping === 'undefined' && typeof this.scrolling === 'undefined')) && this.dragType === 'mouse') { const clientX = this.getClientPosition(e, 'x'); e.preventDefault(); if (!this.clickPrevented) { this.clickPrevented = true; this.anchorLinks = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Items_Container_Inner a'); this.anchorLinks.forEach((anchorLink) => { anchorLink.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_Link_Disabled'); }); } let lastSliderDirection = this.sliderDirection; this.sliderDirection = clientX - this.position.x; if (this.anchorContentInner.parentElement.clientWidth - this.anchorContentInner.clientWidth > this.anchorContentInner.offsetLeft + 30 && this.sliderDirection = 30 && this.sliderDirection > 0) { let leftPos = this.position.startX + -(this.position.clientStartX - clientX); this.anchorContentInner.style.left = `${leftPos}px`; if (typeof this.sliderEffect !== 'undefined'){ this.sliderEffect.reset(); } } else { let leftPos = this.position.startX + -(this.position.clientStartX - clientX); this.anchorContentInner.style.left = `${leftPos}px`; if (typeof this.sliderEffect !== 'undefined'){ this.sliderEffect.newAction(clientX); if ((lastSliderDirection 0) || (lastSliderDirection > 0 && this.sliderDirection this.anchorContentInner.offsetLeft) { this.anchorContentInner.style.transition = '0.5s'; this.anchorContentInner.style.left = `${this.anchorContentInner.parentElement.clientWidth - this.anchorContentInner.clientWidth}px`; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 600); this.btnNext && this.btnNext.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); } else if (this.anchorContentInner.offsetLeft >= 30) { this.anchorContentInner.style.transition = '0.5s'; this.anchorContentInner.style.left = '0px'; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 600); this.btnPrev && this.btnPrev.classList.add('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Btn_Hide'); } else { if (typeof this.sliderEffect !== 'undefined') { this.sliderEffect.applyEffect(this.getClientPosition(e, 'x')); } } this.anchorLinks = this.anchorContainer.querySelectorAll('.ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Items_Container_Inner a'); this.anchorLinks.forEach((anchorLink) => { anchorLink.classList.remove('ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Item_Link_Disabled'); }); document.onmouseup = null; document.onmouseleave = null; document.onmousemove = null; this.anchorContentInner.touchmove = null; }}(function () { try { const ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER = document.querySelector('#ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR:not([data-mix-init-slider="1"])'); if (ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER) { const MIX_Slider = new ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_Slider(ac940230_a639_4027_8c2c_5a996980d5fd_MIX_ANCHOR_CONTAINER); MIX_Slider.init(); } } catch(e) { console.error('Error S001 - Internal error'); console.error(e); }})();