PageSourceSearch

https://www.maybelline.co/frontend/master/js/renderless-snap-carousel.2bb0ba89.js

js maybelline.co collected 2026-10-08 13:34:28 UTC 6,266 bytes, 1 lines download raw bytes

1"use strict";(self["webpackChunkwsf_master_mny"]=self["webpackChunkwsf_master_mny"]||[]).push([[2664],{9138:function(e,t,i){i.r(t),i.d(t,{default:function(){return v}});var s=i(2895),n=i(3547),r=i(1694),l=i(2954),a=i(3172),o=i(4017);const h=400;var c,m,d={name:"RenderlessSnapCarousel",props:{observableItem:{type:String,required:!0,default:".renderless__grid__item"},scrollingElement:{type:String,required:!0,default:".renderless__grid"},updateActiveElementOnView:{type:Boolean,required:!1,default:!0},multipleCardsCarousel:{type:Boolean,required:!1,default:!1},cardsPerView:{type:Number,required:!1,default:0},paginationCarousel:{type:Boolean,required:!1,default:!1},customSlidesPerPage:{type:Boolean,required:!1,default:!1},tmPush:{type:Boolean,default:!1},impressionSettings:{type:Object,default:()=>({withImpression:!1})},taggingTitle:{type:String,default:"Custom CMS Slide Title",required:!1},taggingTitleTag:{type:String,default:"h2",required:!1},enableSwipe:{type:Boolean,required:!1,default:!1}},data(){return{activeElementId:0,activeElement:"",listOfItems:[],itemDimension:0,componentDimension:0,itemsLeft:0,isTablet:void 0,hasItemsLeft:!0,pages:0,currentPage:0,dynamicCardsPerView:0,isRTL:!1,noScroll:!1,scrollUpdate:!1}},computed:{totalPages(){const e=this.listOfItems.length;return e%this.cardsPerView===0?e/this.cardsPerView:Math.floor(e/this.cardsPerView)+1},impressionHandlerValue(){const{withImpression:e,label:t}=this.impressionSettings;return e?{label:t}:null}},mounted(){this.dynamicCardsPerView=this.cardsPerView,this.listOfItems=this.$el.querySelectorAll(this.observableItem),this.scrollingItem=this.$el.querySelector(this.scrollingElement),this.itemsLeft=this.listOfItems.length,this.pages=this.totalPages,this.isRTL=document.body.classList.contains("rtl"),this.scrollingHandler=(0,n.s)(()=>{this.isScrolling=!1,this.scrollUpdate=!0},h),this.observer=new IntersectionObserver(e=>{e.forEach(e=>{const{target:t}=e;e.isIntersecting?1===e.intersectionRatio&&this.scrollUpdate&&this.isScrolling&&(this.updateActiveElement(t),this.paginationCarousel&&this.enableSwipe&&!this.isRTL&&this.onSwipeAction(this.activeElementId)):this.updateActiveElementOnView&&t.setAttribute("data-active",!1)})},{rootMargin:"0px",threshold:1}),this.listOfItems.forEach(e=>{this.observer.observe(e)}),this.scrollingItem.addEventListener("scroll",this.scrollEventHandler),this.resizeHandler(),window.addEventListener("resize",this.resizeHandler),this.collectionWithOutHoverLink(),this.$nextTick(()=>{if(!this.impressionSettings.withImpression)return;const e=this.$el.querySelector(this.scrollingElement);(0,a.I9)(e,{delay:200,checkIsVisible:!0}).then(()=>{this.taggingImpressionHandler(500)})})},updated(){o.B.$on("userInteractionOn",()=>{this.noScroll=!0}),o.B.$on("userInteractionOff",()=>{this.noScroll=!1})},beforeDestroy(){this.listOfItems.forEach(e=>{this.observer.unobserve(e)}),this.scrollingItem.removeEventListener("scroll",this.scrollEventHandler),window.removeEventListener("resize",this.resizeHandler),o.B.$off("userInteractionOn"),o.B.$off("userInteractionOff")},methods:{onSwipeAction(e){this.dynamicCardsPerView>1&&e>0?this.multipleCardSwipe(e):this.singleCardSwipe()},singleCardSwipe(){this.currentPage=this.activeElementId},multipleCardSwipe(e){let t=0;t=Math.floor(e/this.dynamicCardsPerView),t<this.pages&&(this.activeElementId=t,this.currentPage=t)},onNavigationClick(e){let t;this.scrollUpdate=!1,t=this.paginationCarousel?this.itemDimension*(e*this.dynamicCardsPerView):this.itemDimension*e;const i=this.listOfItems.length>e?this.listOfItems[e]:void 0;if(i){let e=this.isRTL?-t:t;this.scrollingItem.scrollTo({top:0,left:e,behavior:"smooth"}),this.updateActiveElement(i)}},scrollEventHandler(){this.isScrolling=!0,this.scrollingHandler()},resizeHandler(){if(this.listOfItems.length&&(this.itemDimension=Number.parseInt(getComputedStyle(this.listOfItems[0]).width)),this.customSlidesPerPage){this.componentDimension=Number.parseInt(getComputedStyle(this.$el).width);const e=Math.floor(this.componentDimension/this.itemDimension),t=Math.ceil(this.listOfItems.length/e);this.dynamicCardsPerView=Math.floor(e),this.pages=Number.parseInt(t)}window.innerWidth>=768&&window.innerWidth<992?this.isTablet=!0:this.isTablet=!1,this.multipleCardsCarousel&&this.isTablet&&this.pages<=1&&(this.hasItemsLeft=!1)},updateActiveElement(e){this.activeElementId=Number.parseInt(e.getAttribute("data-id")),this.activeElement=e,this.updateActiveElementOnView&&e.setAttribute("data-active",!0)},onArrowClick(e){"next"===e?this.itemsLeft&&(this.onNavigationClick(++this.activeElementId),--this.itemsLeft,this.hasNextNav(),this.tmPushEvent("next")):(this.onNavigationClick(--this.activeElementId),++this.itemsLeft,this.hasItemsLeft=!0,this.tmPushEvent("previous")),this.currentPage=this.activeElementId},hasNextNav(){const e=this.multipleCardsCarousel&&this.isTablet;(1===this.itemsLeft||e&&this.itemsLeft===this.dynamicCardsPerView)&&
1(this.hasItemsLeft=!1)},onPageChange(e){this.currentPage=e,this.onNavigationClick(e)},collectionWithOutHoverLink(){this.listOfItems.forEach(e=>{const t=e.querySelector(".collection-anchor-cards__carousel-list__item__img");if(t){const e=t.getAttribute("href");e&&"#"!==e||t.classList.add("withOutHoverLink")}})},tmPushEvent(e){let t=this.activeElement.querySelector(this.taggingTitleTag),i=this.taggingTitle;null!==t&&""!==t.innerText&&(i=t.innerText),this.tmPush&&l.Xj.pushDataLayer({event:"uaevent",ecommerce:void 0,eventCategory:"slider",eventAction:e,event_Label:this.activeElementId+"::"+i,event_name:"main_slider_button_click",cta_name:i,click_action:e,position:this.activeElementId})},taggingImpressionHandler(e=400){setTimeout(()=>{const e=this.$el.querySelector(this.scrollingElement);e&&(0,r.C)(e,{type:"productImpression",...this.impressionHandlerValue},100)},e)}},render(){return this.$scopedSlots.default({activeId:this.activeElementId,items:this.listOfItems?this.listOfItems.length:0,navigationClick:this.onNavigationClick,onArrowClick:this.onArrowClick,showNav:this.hasItemsLeft,itemsLeft:this.itemsLeft,noScroll:this.noScroll,onPageChange:this.onPageChange,pages:this.pages,currentPage:this.currentPage})}},u=d,g=i(1656),p=(0,g.A)(u,c,m,!1,null,null,null),f=p.exports,v=(0,s.fC)({components:{RenderlessSnapCarousel:f}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.