JezK
Edit File: ethemePostProduct.min.js
!function(y){"use strict";y(window).on("elementor/frontend/init",function(){var n=elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.local_params={clicked:!1},this.masonry=null,this.masonrySettings={},this.run()},getDefaultSettings:function(){return{selectors:{wrapperGrid:".etheme-product-grid",wrapperList:".etheme-product-list",gridItem:".etheme-product-grid-item",listItem:".etheme-product-list-item",image:".etheme-product-grid-image",fadeInArea:".etheme-product-grid-fadeIn-area",showMoreInfo:".etheme-product-grid-more-info-btn",sliderImages:".etheme-product-image-hover-slider",carouselImages:".etheme-product-image-hover-carousel",loadButton:".etheme-elementor-lazy-button",loadButtonProgressText:".etheme-elementor-lazy-progress-bar-title",loadButtonProgressBarInner:".etheme-elementor-lazy-progress-bar-inner",pagination:".etheme-elementor-pagination-ajax",wrapperPosts:".etheme-posts-wrapper",postItem:".etheme-post",tabContent:".etheme-elementor-tab-content",tabContentActive:".etheme-elementor-tab-content-active"},vars:{w_width:y(window).width(),w_height:y(window).height()}}},getDefaultElements:function(){var e=this.getSettings("selectors");return{$wrapperGrid:this.$element.find(e.wrapperGrid),$wrapperList:this.$element.find(e.wrapperList),$gridItem:this.$element.find(e.gridItem),$listItem:this.$element.find(e.listItem),$sliderImages:this.$element.find(e.sliderImages),$carouselImages:this.$element.find(e.carouselImages),$loadButton:this.$element.find(e.loadButton),$loadButtonProgressText:this.$element.find(e.loadButtonProgressText),$loadButtonProgressBarInner:this.$element.find(e.loadButtonProgressBarInner),$pagination:this.$element.find(e.pagination),$wrapperPosts:this.$element.find(e.wrapperPosts),$postItem:this.$element.find(e.postItem)}},run:function(){var o=this,t=o.getElementSettings(),n=o.getSettings("selectors"),a=o.getSettings("vars"),i=elementorFrontend.isEditMode();let r="etheme_posts_tabs"==o.getWidgetType(),s=!!t.masonry,d=t.animation_type;if(o.elements.$loadButton.length&&"scroll"==t.navigation){let n=o.elements.$loadButton;elementorFrontend.elements.$window.on("scroll",function(){var e=n.offset().top,t=n.outerHeight();y(this).scrollTop()<e+t-a.w_height||!n||o.local_params.clicked||o.elements.$loadButton.trigger("click")})}o.elements.$loadButton.on("click",function(){var e;r&&y(this).parents(n.tabContent).length&&!y(this).parents(n.tabContentActive).length||("current_query"==t.query_type?(e=o.elements.$pagination.find(".next"),o.loadPostProductCurrentQuery(o,n,t,i,y.trim(y(e).attr("href")),s)):o.loadPostProduct(o,y(this),y(this),s))}),o.elements.$pagination.on("click","a",function(e){e.preventDefault(),"current_query"==t.query_type?(i||(o.$element.addClass(d?"etheme-reloading":"etheme-loading"),"skeleton_animation"==d&&o.$element.addClass("etheme-skeleton-loading")),o.loadPostProductCurrentQuery(o,n,t,i,y.trim(y(this).attr("href")),s,"pagination")):(o.$element.addClass(d?"etheme-reloading":"etheme-loading"),"skeleton_animation"==d&&o.$element.addClass("etheme-skeleton-loading"),o.loadPostProduct(o,y(this).parents(n.pagination),y(this),s,"pagination"))}),o.elements.$sliderImages.length&&o.elements.$sliderImages.each(function(){o.sliderImagesHoverInit(y(this),n)}),o.elements.$carouselImages.length&&void 0!==window.hoverSlider&&(window.hoverSlider.init({}),window.hoverSlider.prepareMarkup()),t.product_attributes&&(o.calculateContent(o,n),y(document).on("etProductMoreDescriptionOpen",function(e,t){o.calculateSpacer(t,n)}),y(document).on("click",n.showMoreInfo,function(e){e.preventDefault();e=y(this).parents(n.gridItem);o.fadeInContentShowMore(y(this),e)})),s&&this.initMasonry()},sliderImagesHoverInit:function(e,t){var n={slider:e,index:0,process:!1,time:300,imagesWrapper:e.find(t.image),arrowsHTML:'<span class="hover-arrow hover-arrow-left"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\n<path d="M17.976 22.8l-10.44-10.8 10.464-10.848c0.24-0.288 0.24-0.72-0.024-0.96-0.24-0.24-0.72-0.264-0.984 0l-10.92 11.328c-0.264 0.264-0.264 0.672 0 0.984l10.92 11.28c0.144 0.144 0.312 0.216 0.504 0.216 0.168 0 0.336-0.072 0.456-0.192 0.144-0.12 0.216-0.288 0.24-0.48 0-0.216-0.072-0.384-0.216-0.528z"></path>\n</svg></span><span class="hover-arrow hover-arrow-right"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\n<path d="M17.88 11.496l-10.728-11.304c-0.264-0.264-0.672-0.264-0.96-0.024-0.144 0.12-0.216 0.312-0.216 0.504 0 0.168 0.072 0.336 0.192 0.48l10.272 10.8-10.272 10.8c-0.12 0.12-0.192 0.312-0.192 0.504s0.072 0.36 0.192 0.504c0.12 0.144 0.312 0.216 0.48 0.216 0.144 0 0.312-0.048 0.456-0.192l0.024-0.024 10.752-11.328c0.264-0.264 0.24-0.672 0-0.936z"></path>\n</svg></span>'};function o(e){n.process=!1,n.image.attr("src",n.imagesList[e]).attr("srcset",""),n.image.removeAttr("srcset")}n.image=e.find(t.image).find("img"),n.imagesList=e.attr("data-images").split(";"),1<n.imagesList.length&&(n.imagesWrapper.hasClass("hover-arrows-added")||(n.imagesWrapper.addClass("hover-arrows-added").prepend(n.arrowsHTML),n.slider.find(".hover-arrow").mouseover(function(){n.slider.addClass("is_hover-arrows-hovered")}),n.slider.find(".hover-arrow").on("mouseleave",function(){n.slider.removeClass("is_hover-arrows-hovered")}),n.slider.find(".hover-arrow-left").on("click",function(e){n.process||(n.process=!0,0<n.index?n.index--:n.index=n.imagesList.length-1,o(n.index))}),n.slider.find(".hover-arrow-right").on("click",function(e){n.process||(n.process=!0,n.index<n.imagesList.length-1?n.index++:n.index=0,o(n.index))})))},getClosureMethodsNames:function(){return elementorModules.frontend.handlers.Base.prototype.getClosureMethodsNames.apply(this,arguments).concat(["onWindowResize","runMasonry"])},onWindowResize:function(){this.getElementSettings("masonry")&&this.runMasonry()},onElementChange:function(){this.getElementSettings("masonry")&&setTimeout(this.runMasonry)},setColsCountSettings:function(){var e,t,n=this.getElementSettings();switch(elementorFrontend.getCurrentDeviceMode()){case"mobile":e=n.cols_mobile,t=n.rows_gap_mobile.size;break;case"tablet":e=n.cols_tablet,t=n.rows_gap_tablet.size;break;default:e=n.cols,t=n.rows_gap.size}t=(t=t||n.rows_gap.size)||20,this.setSettings("colsCount",e),this.setSettings("rowsGap",t||n.rows_gap.size)},calculateContent:function(e,t){e.$element.find(t.gridItem).on("mouseenter touchstart",function(){let a=y(this);a.data("content-calculated")||a.imagesLoaded(function(){var e=a.find(".etheme-product-grid-more-info"),t=e.find(".etheme-product-grid-more-info-inner"),n=e.find(".etheme-product-grid-more-info-btn"),o=e.outerHeight(),t=t.outerHeight()-o;30<t?n.removeClass("hidden"):0<t&&e.css("height",o+t),a.data("content-calculated","yes")}),a.data("fadeIn-content-calculated")||a.imagesLoaded(function(){e.calculateSpacer(a,t)})})},calculateSpacer:function(e,t){e.find(".etheme-product-grid-more-info-inner").outerHeight()<e.find(".etheme-product-grid-more-info-inner table").outerHeight()&&e.find(".etheme-product-grid-more-info-btn").removeClass("hidden");var n=e.find(".etheme-product-grid-fadeIn-area").outerHeight();n+=e.height(),e.find(".etheme-product-grid-spacer").css({height:n}),y(this).data("fadeIn-content-calculated","yes")},fadeInContentShowMore:function(e,t){t.find(".limited-height").removeClass("limited-height"),y(document).trigger("etProductMoreDescriptionOpen",[t]),e.remove()},initMasonry:function(){imagesLoaded(this.elements.$postItem,this.runMasonry)},runMasonry:function(){var e=this.getSettings("selectors"),t=this.elements,n=(this.$element.find(e.postItem).css({marginTop:"",transitionDuration:""}),this.setColsCountSettings(),this.getSettings("colsCount")),o=this.getSettings("rowsGap"),a=2<=n;t.$wrapperPosts.toggleClass("etheme-masonry",a),a?(a=elementorModules.utils.Masonry,this.masonrySettings={container:t.$wrapperPosts,items:this.$element.find(e.postItem),columnsCount:n,verticalSpaceBetween:o},this.masonry=new a(this.masonrySettings),this.masonry.run()):t.$wrapperPosts.height("")},loadPostProduct:function(n,a,e,o,i="button"){n.local_params.clicked=!0;var r=n.getElementSettings(),s=this.getSettings("selectors"),d=parseInt(a.attr("data-paged")),l=parseInt(a.attr("data-max-paged")),m=r.posts_per_page,c=parseInt(a.attr("data-limit")),p="pagination"==i;if(p||a.addClass("loading"),!(l<=d)){d+=1;let t={"posts-per-page":m};a.attr("data-offset")&&(t.offset=a.attr("data-offset"));var h,g,u,f,w=a.attr("data-widget-type"),_=!0,v={action:"etheme_elementor_lazy_load",security:a.attr("data-nonce"),query:a.attr("data-query-settings"),widgetType:w};switch(w){case"product-list":h=n.elements.$wrapperList,u=s.listItem,g=parseInt(h.find(s.listItem).length),f=g+parseInt(m),c&&c<=f&&(t.limit=parseInt(m)-(f-c)),v.postSettings=a.attr("data-product-settings");break;case"product-grid":h=n.elements.$wrapperGrid,u=s.gridItem,g=parseInt(h.find(s.gridItem).length),f=g+parseInt(m),v.postSettings=a.attr("data-product-settings");break;default:_=!1,h="posts-tabs"==w?(u=s.tabContentActive+" "+s.postItem,a.parents(s.tabContentActive).find(s.wrapperPosts)):(u=s.postItem,n.elements.$wrapperPosts),g=parseInt(h.find(s.postItem).length),f=g+parseInt(m),v.postSettings=a.attr("data-post-settings")}p?(e=new URL(e.attr("href")),v.widgetId=a.attr("data-widget-id"),d=e.searchParams.get("etheme-"+w+"-"+v.widgetId+"-page"),v.totalPages=parseInt(a.attr("data-total-pages")),v.permalink=a.attr("data-permalink"),t.limit=c,"current_query"==r.query_type&&-1<y.inArray(w,["product-list","product-grid"])&&"undefined"!=typeof etAjaxFiltersConfig&&etAjaxFiltersConfig.scroll_top_after_ajax&&(e=h.offset().top,e-=110,y("html, body").animate({scrollTop:e},1e3))):c&&c<=f&&(t.limit=parseInt(m)-(f-c)),t.paged=d,v.attr=t,v.loading_type=i,y.ajax({url:etConfig.ajaxurl,method:"POST",data:v,dataType:"json",success:function(e){var t,o=y(JSON.parse(e.content));if(r.animation_type){let n="fadeInUp_animation"==r.animation_type?100:0;o.each(function(e,t){y(t).css("transition-delay",e*n+"ms").addClass("etheme-post-product-loading")})}p?(h.html(o),a.html(JSON.parse(e.pagination))):(h.append(o),"button"==i&&"advanced"==r.navigation_button_type&&(e=a.attr("data-found-posts"),t=(o=n.$element.find(u).length)/e*100,o=n.elements.$loadButtonProgressText.attr("data-text").replace("{{current_count}}",o).replace("{{all_count}}",e),"posts-tabs"==w?(n.$element.find(s.tabContentActive).find(s.loadButtonProgressText).text(o),n.$element.find(s.tabContentActive).find(s.loadButtonProgressBarInner).css({width:t+"%"}),100==t&&n.$element.find(s.tabContentActive).find(s.loadButtonProgressBarInner).addClass("finished")):(n.elements.$loadButtonProgressText.text(o),n.elements.$loadButtonProgressBarInner.css({width:t+"%"}),100==t&&n.elements.$loadButtonProgressBarInner.addClass("finished")))),r.animation_type&&(setTimeout(function(){y(h).find(_?".type-product":".type-post").removeClass("etheme-post-product-loading")},300),setTimeout(function(){y(h).find(_?".type-product":".type-post").attr("style",null)},700)),"product-list"==w&&r.show_divider&&n.$element.find(s.listItem).addClass("has-divider").last().removeClass("has-divider")},error:function(e){etTheme.et_notice("products","error")},complete:function(){var e;-1<y.inArray(w,["product-list","product-grid"])&&(y(document).trigger("etheme_product_grid_ajax_loaded"),y(document).trigger("yith_wcwl_reload_fragments"),(e=n.$element.find(s.sliderImages)).length&&e.each(function(){n.sliderImagesHoverInit(y(this),s)}),e=n.$element.find(s.carouselImages),void 0!==etTheme.reinitSwatches&&etTheme.reinitSwatches(),e.length)&&void 0!==window.hoverSlider&&(window.hoverSlider.init({}),window.hoverSlider.prepareMarkup()),p||(a.attr("data-paged",d),l<=d||c&&c<=f?a.remove():a.removeClass("loading").addClass("loaded"),t.offset&&f>=a.attr("data-found-posts")&&a.remove()),n.$element.removeClass("etheme-loading etheme-reloading etheme-skeleton-loading"),"skeleton_animation"==r.animation_type&&(n.$element.addClass("etheme-skeleton-loaded"),setTimeout(function(){n.$element.removeClass("etheme-skeleton-loaded")},700)),n.local_params.clicked=!1,o&&setTimeout(n.runMasonry())}})}},loadPostProductCurrentQuery:function(d,l,m,e,t,c,p="button"){if(""!=t&&!e){d.local_params.clicked=!0,d.msieversion()||history.pushState(null,null,t);let r=y('[data-id="'+d.getID()+'"]'),s=d.getWidgetType();var h="pagination"==p;h||r.find(l.loadButton).addClass("loading");h&&-1<y.inArray(s,["etheme_product_grid","etheme_product_list","woocommerce-etheme_archive_products"])&&"undefined"!=typeof etAjaxFiltersConfig&&etAjaxFiltersConfig.scroll_top_after_ajax&&(e=r.offset().top,e-=110,y("html, body").animate({scrollTop:e},1e3)),y.get(t,function(e){var t,o="",n=!1,a="etheme_product_list"!=s?l.wrapperGrid:l.wrapperList,e=y(e).find('[data-id="'+d.getID()+'"]'),o=e.find(a).html(),i=e.find(l.pagination).html();if(h||(n=e.find(l.pagination).find(".next").length),a){if(o=y(o),m.animation_type){let n="fadeInUp_animation"==m.animation_type?100:0;o.each(function(e,t){y(t).css("transition-delay",e*n+"ms").addClass("etheme-post-product-loading")})}h?r.find(a).html(o):(r.find(a).append(o),"button"==p&&"advanced"==m.navigation_button_type&&(e=parseInt(d.elements.$loadButton.attr("data-found-posts")),t=(o=("etheme_product_list"!=s?d.$element.find(l.gridItem):d.$element.find(l.listItem)).length)/e*100,o=d.elements.$loadButtonProgressText.attr("data-text").replace("{{current_count}}",o).replace("{{all_count}}",e),d.elements.$loadButtonProgressText.text(o),d.elements.$loadButtonProgressBarInner.css({width:t+"%"}),100==t)&&d.elements.$loadButtonProgressBarInner.addClass("finished")),m.animation_type&&(setTimeout(function(){r.find(a).find(".type-product").removeClass("etheme-post-product-loading")},300),setTimeout(function(){r.find(a).find(".type-product").attr("style",null)},700)),"etheme_product_list"==s&&m.show_divider&&d.$element.find(l.listItem).addClass("has-divider").last().removeClass("has-divider"),i&&(h||(r.find(l.loadButton).removeClass("loading").addClass("loaded"),n)||r.find(l.loadButton).remove(),r.find(l.pagination).html(i)),-1<y.inArray(s,["etheme_product_grid","woocommerce-etheme_archive_products","etheme_product_list"])&&(y(document).trigger("etheme_product_grid_ajax_loaded"),y(document).trigger("yith_wcwl_reload_fragments"),void 0!==etTheme.global_image_lazy&&etTheme.global_image_lazy(),(e=d.$element.find(l.sliderImages)).length&&e.each(function(){d.sliderImagesHoverInit(y(this),l)}),o=d.$element.find(l.carouselImages),void 0!==etTheme.reinitSwatches&&etTheme.reinitSwatches(),o.length)&&void 0!==window.hoverSlider&&(window.hoverSlider.init({}),window.hoverSlider.prepareMarkup()),d.$element.removeClass("etheme-loading etheme-reloading etheme-skeleton-loading"),"skeleton_animation"==m.animation_type&&(d.$element.addClass("etheme-skeleton-loaded"),setTimeout(function(){d.$element.removeClass("etheme-skeleton-loaded")},700)),d.local_params.clicked=!1,c&&setTimeout(d.runMasonry())}})}},msieversion:function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return 0<t&&parseInt(e.substring(t+5,e.indexOf(".",t)))}});y.each(["etheme_product_grid","etheme_product_list","etheme_product_carousel","woocommerce-etheme_archive_products","etheme_posts","etheme_posts_chess","etheme_posts_tabs"],function(e,t){elementorFrontend.hooks.addAction("frontend/element_ready/"+t+".default",function(e){elementorFrontend.elementsHandler.addHandler(n,{$element:e})})})})}(jQuery);