PageSourceSearch

https://www.popcarte.com/min/g=recently_viewed_js&v=57.js

js popcarte.com collected 2026-09-24 09:18:36 UTC 2,919 bytes, 24 lines download raw bytes

1class RecentlyViewedTemplates{init(){if(!this.initProperties())
2return false;return true;}
3initProperties(){if(!this.isActive()){return;}
4this._listeners={};this.$container=$('.rvt_cc');this.cookieName=window.rvt_cookie_name;this.ajaxEndpoint='/ajax/recently_viewed_templates.php';this.currentTemplate='';this.min=window.rvt_min;return true;}
5isActive(){return(typeof window.rvt_active!='undefined'&&window.rvt_active)}
6loadTemplates(){if(!this.isActive())
7return;if(!this.$container.length){return false;}
8if(!$.cookie(this.cookieName))
9return false;this.$sliderContainer=this.$container.find('.rvt');const postData={action:'get_template_list',min:this.min,};if(this.currentTemplate!==''){postData.current_template=this.currentTemplate;}
10$.post(this.ajaxEndpoint,postData,(data)=>{if(data===''||data==='no_templates'){this.$container.removeClass('load visible');this.$container.addClass('hidden');return true;}
11this.$sliderContainer.html(data);const $slides=this.$sliderContainer.find('.swiper-slide');const sectionTitleText=($slides.length===1)?'Récemment consulté':'Récemment consultés';const $sectionTitle=this.$container.find('.rvt_title');$sectionTitle.html(sectionTitleText);this.loadSlider();if(typeof window.pop_wishlist!='undefined'){$slides.each((i,slide)=>{const $productItem=slide.querySelector('.product_item');if($productItem){window.pop_wishlist.addItem($productItem);}});}});}
12loadSlider(){if(!this.isActive())
13return;this.$swiperContainer=this.$sliderContainer.find('.swiper-container');this.productListSlider=new ProductListSlider();this.productListSlider.init(this.$swiperContainer,{on:{init:(swiper)=>{this.$container.removeClass('load');this.$container.addClass('visible loaded');this.initGA4ProductSliderShowEvent();this.dispatchEvent(new Event('load'));}}});}
14addTemplate(tid,ptid,virtual,downloadable){if(!this.isActive())
15return;$.post(this.ajaxEndpoint,{action:'add_template',tid:tid,ptid:ptid,virtual:virtual,downloadable:downloadable,});}
16sendGA4Event(action){const layer={'event':'recently_viewed_templates','action_type':action,};const pageType=getGa4PageType();if(pageType){layer.page_type=pageType;}
17pushDataLayer(layer);}
18initGA4ProductSliderShowEvent(){const observer=new IntersectionObserver(([entry],observer)=>{if(entry.isIntersecting){this.sendGA4Event('recently_viewed_templates_show');observer.disconnect();}},{root:null,rootMargin:"0px",threshold:0});observer.observe(this.$container[0]);}
19addEventListener(type,listener){if(!(type in this._listeners)){this._listeners[type]=[];}
20this._listeners[type].push(listener);}
21removeEventListener(type,listener){if(!(type in this._listeners)){return;}
22const index=this._listeners[type].indexOf(listener);if(index!==-1){this._listeners[type].splice(index,1);}}
23dispatchEvent(event){if(!(event.type in this._listeners)){return;}
24for(const listener of this._listeners[event.type]){listener.call(this,event);}}}

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.