PageSourceSearch

https://thevapegiant.com/wp-content/plugins/wpbingo/assets/js/wpbingo.js?ver=7.1.2

js thevapegiant.com collected 2026-09-30 18:04:17 UTC 20,581 bytes, 535 lines download raw bytes

1(function($) {
2	"use strict";
3	class Elementor_Js_Wpbingo {
4		static getInstance() {
5			if (!Elementor_Js_Wpbingo.instance) {
6				Elementor_Js_Wpbingo.instance = new Elementor_Js_Wpbingo();
7			}
8			return Elementor_Js_Wpbingo.instance;
9		}
10		constructor() {
11			$(window).on('elementor/frontend/init', () => {
12				this.init();
13			});
14		}
15		init() {
16			elementorFrontend.hooks.addAction('frontend/element_ready/bwp_filter_homepage.default', ($scope) => {
17				let bwpFilterHomepageElem     = $scope.find('.bwp-filter-homepage');
18				bwpFilterHomepageElem.each(function() {
19					var $element = $(this);
20					$(".bwp-filter-toggle",$element).click(function(){
21						if($(this).hasClass('active')){
22							$(this).removeClass('active');
23							$(".bwp-filter-attribute",$element).slideUp();
24						}else{
25							$(this).addClass('active');	
26							$(".bwp-filter-attribute",$element).slideDown();
27						}	
28					});	
29					
30					$("li",$element).click(function(){
31						var $parent = $(this).parent();
32						if($parent.hasClass('filter-orderby')){
33							var order_text = $(this).text();
34							$('.text-orderby').html(order_text);
35						}
36
37						if($parent.hasClass('filter-category') || $parent.hasClass('filter-orderby'))
38							$("li",$parent).removeClass('active');
39						else
40							$(this).removeClass('active');
41						
42						if($(this).hasClass('active')){
43							$(this).removeClass('active');
44						}else{
45							$(this).addClass('active');
46						}
47						
48						var count_loadmore = $(".count_loadmore",$element).data("default");
49						$(".count_loadmore",$element).val(parseInt(count_loadmore));
50						if($element.hasClass("tab-category") || $element.hasClass("tab-product")){
51							var $value = $(this).data("value");
52							if( $(".content-products-"+$value,$element).length > 0 ){
53								$('.content-product-list',$element).addClass("hidden");
54								$(".content-products-"+$value,$element).removeClass("hidden");
55							}else{
56								_eventFilterHomePage($element);
57							}
58						}else{
59							_eventFilterHomePage($element);
60						}
61					});	
62					
63					$(".loadmore",$element).click(function(){
64						_eventFilterHomePage($element,true);
65					});	
66					
67					
68					$('.clear_all',$element).click(function(e){
69						var $content_filter 	= $(".bwp-filter-attribute",$element);
70						var bwp_slider_price 	= $(".bwp_slider_price",$element);
71						$("li",$content_filter).removeClass('active'); 
72						$(".price-filter-min-text",$element).val(bwp_slider_price.data("min"));
73						$(".price-filter-max-text",$element).val(bwp_slider_price.data("max"));
74						$(".text-price-filter-min-text",$element).html(bwp_slider_price.data("min"));
75						$(".text-price-filter-max-text",$element).html(bwp_slider_price.data("max"));
76						$(".ui-slider-range",bwp_slider_price).css({"left": "0px", "width": "100%"});
77						$("span",bwp_slider_price).first().css("left","0px");
78						$("span",bwp_slider_price).last().css("left","100%");
79						_eventFilterHomePage($element); 
80					});		
81					
82					var min_price = $(".price-filter-min-text",$element).val();
83					var max_price =  $(".price-filter-max-text",$element).val();
84					$(".bwp_slider_price",$element).slider({
85					range:true,
86					min: $(".bwp_slider_price",$element).data('min'),
87					max: $(".bwp_slider_price",$element).data('max'),		
88					values: [min_price,max_price],
89					slide : function( event, ui ) {
90							$(".text-price-filter-min-text",$element).html(ui.values[0]);
91							$(".text-price-filter-max-text",$element).html(ui.values[1]);
92							$(".price-filter-min-text",$element).val(ui.values[0]);		
93							$(".price-filter-max-text",$element).val(ui.values[1]);		
94						},
95					change: function( event, ui ) {
96						_eventFilterHomePage($element);		
97					}
98					
99					});	
100				});				
101			});			
102		}
103	}
104	Elementor_Js_Wpbingo.getInstance();
105
106	function _eventFilterHomePage($element,loadmore = false){
107			if(loadmore){
108				$('.loadmore',$element).addClass('loading');
109			}else{
110				$('.bwp-filter-content',$element).addClass('active');
111				$('.bwp-filter-content',$element).append('<div class="loading loading-filter"></div>');
112			}
113			var $filter = new Object();				
114			var $ajax_url = filter_ajax.ajaxurl;
115			$filter.content_product = 	$element.data("content_product") ? $element.data("content_product") : "",
116			$filter.layout_content = 	$element.data("layout_content") ? $element.data("layout_content") : "",
117			$filter.category 		=	$(".filter-category li.active",$element).data("value");		
118			$filter.orderby 		=	$(".filter-orderby li.active",$element).data("value");	
119			$filter.min_price 		= 	$(".price-filter-min-text",$element).val();	
120			$filter.max_price 		= 	$(".price-filter-max-text",$element).val();
121			$filter.class_col 		= 	(!$element.hasClass("slider")) ? $element.data("class_col") : "";
122			$filter.loadmore 		= 	(loadmore) ? 1 : 0;
123			$filter.item_row 		= 	$(".products-list",$element).data("item_row") ? $(".products-list",$element).data("item_row") : 1;
124			if(loadmore){
125				$filter.paged 			= 	$(".count_loadmore",$element).val();			
126			}else{
127				$filter.paged			=	1;				
128			}
129			$filter.product_count 	= 	$element.data("showmore");
130			
131			var atributes			=	$element.data("atributes");
132			if(atributes){
133				var atributes		=	atributes.split(',');	
134				for(var i=0;i<atributes.length;i++){
135					var atr = [];
136					$("."+atributes[i]+" li.active",$element).each(function(index){
137						atr[index] = $(this).data("value");
138					});					
139					$filter[atributes[i]] = atr;
140				}						
141			}	
142		
143			var brands  = [];
144			$(".filter-brand li.active",$element).each(function(index){
145				brands[index] = $(this).data("value");
146			});
147			
148			$filter.brand = brands; 
149			
150			jQuery.ajax({
151				type: "POST", 
152				url: $ajax_url,
153				dataType: 'json',
154				data: {
155					filter 			: $filter,
156					action 			: "bwp_filter_homepage_callback",
157				},
158				success: function (result) {	
159					if(loadmore){
160						if (result.products)
161							$('.products-list',$element).append(result.products);
162						var count_loadmore = $(".count_loadmore",$element).val();
163							$(".count_loadmore",$element).val(parseInt(count_loadmore) + 1);
164					}else{
165						if($element.hasClass("tab-category") || $element.hasClass("tab-product")){
166							if($element.hasClass("tab-category")){
167								var $value = $filter.category;
168							}else{
169								var $value = $filter.orderby;
170							}
171							if($element.hasClass("scroll-list")){
172								var $content_parent = $('.content-product-list',$element).first();
173								var $content_child = $content_parent.children().clone();
174								if (result.products){
175									var $product_list = $('.products-list',$content_parent).clone().html(result.products);
176								}else{
177									var $product_list = $('.products-list',$content_parent).clone().html('');
178								}
179								$('.products-list',$content_child).replaceWith($product_list);
180								$('.content-product-list',$element).addClass("hidden");
181								$( ".content-product-list",$element).last().after( '<div class="content-product-list content-products-'+$value+'"></div>' );
182								$(".content-products-"+$value,$element).html($content_child);
183								var $parent = $(".content-products-"+$value,$element);
184								$(".products-list",$parent).removeAttr("style");
185								$(".handle",$parent).removeAttr("style");
186								_wpbingo_drag_slider($(".list-product",$parent));
187							}else{
188								var $child_product = $('.content-product-list',$element).first();
189								if (result.products){
190									var $product_list = $('.products-list',$child_product).clone().html(result.products);
191								}else{
192									var $product_list = $('.products-list',$child_product).clone().html('');
193								}
194								$('.content-product-list',$element).addClass("hidden");
195								$( ".content-product-list",$element).last().after( '<div class="content-product-list content-products-'+$value+'"></div>' );
196								$(".content-products-"+$value,$element).html($product_list);
197								var $parent = $(".content-products-"+$value,$element);
198								if($element.hasClass("slider")){
199									$(".products-list",$parent).removeClass("slick-slider slick-initialized");
200									_wpbingo_slick_carousel($(".products-list",$parent));
201									_check_nav_slick($(".products-list",$parent));
202								}
203							}
204							_wpbingo_countdown_product($(".products-list",$parent));
205						}else{
206							if (result.products){
207								$('.products-list',$element).html(result.products);
208							}else{
209								$('.products-list',$element).html('');
210							}
211							_wpbingo_countdown_product($(".products-list",$element));
212							if($element.hasClass("slider")){
213								$('.products-list',$element).removeClass("slick-slider slick-initialized");
214								_wpbingo_slick_carousel($('.products-list',$element));
215								_check_nav_slick($('.products-list',$element));
216							}								
217						}
218						_wpbingo_click_atribute_image();
219						_wpbingo_click_add_to_cart();
220						_wpbingo_load_tooltip();
221					}
222
223					_wpbingo_click_quickview_button();
224					
225					if (result.loadmore && result.loadmore == 1)
226						$(".products_loadmore",$element).show();
227					else
228						$(".products_loadmore",$element).hide();
229					
230					if(loadmore){
231						$('.loadmore',$element).removeClass('loading');	
232					}else{
233						$('.bwp-filter-content',$element).removeClass('active');
234						$('.loading',$element).remove();
235					}
236					var $content_filter = $(".bwp-filter-attribute",$element);
237
238					if($("li.active",$content_filter).length > 0 || ($(".price-filter-min-text",$element).val() != $(".bwp_slider_price",$element).data("min"))  || ($(".price-filter-max-text",$element).val() != $(".bwp_slider_price",$element).data("max")))
239						$(".clear_all",$element).show();
240					else
241						$(".clear_all",$element).hide();	
242				},
243				error:function(jqXHR, textStatus, errorThrown) {
244					console.log("error " + textStatus);
245					console.log("incoming Text " + jqXHR.responseText);
246				}
247			});
248			
249		return false;	
250	}
251	function _wpbingo_click_atribute_image(){
252		$(".image-attribute",".product-attribute").on( "click", function() {
253			if(!$(this).hasClass("active")){
254				$(".image-attribute",".product-attribute").removeClass("active");
255				$(this).addClass("active");
256				var $parent = $(this).closest(".products-entry");
257				var $thumb = $(".product-thumb-hover", $parent);
258				var $image = $(this).data("image");
259				$("img",$thumb).last().attr("src", $image);				
260			}
261		});
262	}
263	function _wpbingo_click_add_to_cart(){
264		$(".cart-remove").on( "click", function() {
265			if( $(".vapier-topcart.popup").hasClass("active") ){
266				$(".vapier-topcart.popup").removeClass("active");
267			}
268			if( $("body").hasClass("not-scroll") ){
269				$("body").removeClass("not-scroll");
270			}
271		});
272		$(".cart-icon").on( "click", function() {
273			if( !$("body").hasClass("not-scroll") && $(".vapier-topcart").hasClass("popup") ){
274				$("body").addClass("not-scroll");
275			}
276		});
277		$(".remove-cart-shadow").on( "click", function() {
278			if( $(".vapier-topcart.popup").hasClass("active") ){
279				$(".vapier-topcart.popup").removeClass("active");
280			}
281			if( $("body").hasClass("not-scroll") ){
282				$("body").removeClass("not-scroll");
283			}
284		});
285	}	
286	function _wpbingo_slick_carousel($element){
287		var _body    = $( 'body' );
288		$element.slick({
289			arrows: $element.data("nav") ? true : false ,
290			dots: $element.data("dots") ? true : false ,
291			draggable : $element.data("draggable") ? false : true ,
292			prevArrow: '<i class="slick-arrow  fa-angle-left"></i>',
293			nextArrow: '<i class="slick-arrow  fa-angle-right"></i>',
294			slidesToScroll:$element.data("slidestoscroll") ? $element.data("columns") : 1,
295			slidesToShow: $element.data("columns"),
296			asNavFor: $element.data("asnavfor") ? $element.data("asnavfor") : false ,
297			vertical: $element.data("vertical") ? true : false ,
298			verticalSwiping: $element.data("verticalswiping") ? $element.data("verticalswiping") : false ,
299			rtl: (_body.hasClass("rtl") && !$element.data("vertical")) ? true : false ,
300			centerMode: $element.data("centermode") ? $element.data("centermode") : false ,
301			focusOnSelect: $element.data("focusonselect") ? $element.data("focusonselect") : false ,
302			responsive: [
303				{
304				  breakpoint: 1441,
305				  settings: {
306					slidesToShow: $element.data("columns1440") ? $element.data("columns1440") : $element.data("columns"),
307					slidesToScroll: $element.data("columns1440") ? $element.data("columns1440") : $element.data("columns"),
308				  }
309				},			
310				{
311				  breakpoint: 1200,
312				  settings: {
313					slidesToShow: $element.data("columns1"),
314					slidesToScroll: $element.data("columns1"),
315				  }
316				},				
317				{
318				  breakpoint: 1024,
319				  settings: {
320					slidesToShow: $element.data("columns2"),
321					slidesToScroll: $element.data("columns2"),
322				  }
323				},
324				{
325				  breakpoint: 768,
326				  settings: {
327					slidesToShow: $element.data("columns3"),
328					slidesToScroll: $element.data("columns3"),
329					vertical: false,
330					verticalSwiping : false,
331				  }
332				},
333				{
334				  breakpoint: 480,
335				  vertical: false,
336				  verticalSwiping : false,				  
337				  settings: {
338					slidesToShow: $element.data("columns4"),
339					slidesToScroll: $element.data("columns4"),
340					vertical: false,
341					verticalSwiping : false,					
342				  }
343				}
344			]								
345		});	
346	}
347
348	function _check_nav_slick($element){
349		if($(".slick-arrow",$element).length > 0){
350			var $prev = $(".fa-angle-left",$element).clone();
351			$(".fa-angle-left",$element).remove();
352			if($element.parent().find(".fa-angle-left").length == 0){
353				$prev.prependTo($element.parent());
354			}
355			$prev.click(function() {
356				$element.slick('slickPrev');
357			});
358			
359			var $next =  $(".fa-angle-right",$element).clone();
360			$(".fa-angle-right",$element).remove();
361			if($element.parent().find(".fa-angle-right").length == 0){
362				$next.appendTo($element.parent());
363			}
364			$next.click(function() {
365				$element.slick('slickNext');
366			}); 
367		}else{
368			$(".fa-angle-left",$element.parent()).remove();
369			$(".fa-angle-right",$element.parent()).remove();			
370		}	
371	}
372	
373	function _wpbingo_click_quickview_button(){
374		$('.quickview-button').on( "click", function(e) {
375			e.preventDefault();
376			var product_id  = $(this).data('product_id');
377			$(".quickview-"+product_id).addClass("loading");
378			$.ajax({
379				url: filter_ajax.ajaxurl,
380				data: {
381					"action" : "vapier_quickviewproduct",
382					'product_id' : product_id
383				},
384				success: function(results) {
385					$('.bwp-quick-view').empty().html(results).addClass("active");
386					$(".quickview-"+product_id).removeClass("loading");				
387					$("#quickview-slick-carousel .slick-carousel").each(function(){
388						_wpbingo_slick_carousel($(this));
389					});
390					if( typeof jQuery.fn.tawcvs_variation_swatches_form != 'undefined' ) {
391						jQuery('.variations_form').tawcvs_variation_swatches_form();
392						jQuery(document.body).trigger('tawcvs_initialized');
393					}else{
394						var form_variation = $(".bwp-quick-view").find('.variations_form');
395						var form_variation_select = $(".bwp-quick-view").find('.variations_form .variations select');
396						form_variation.wc_variation_form();
397						form_variation_select.change();
398					}					
399					_wpbingo_click_close_quickview();
400				},
401				error: function(errorThrown) { console.log(errorThrown); },
402			});
403		});
404	}
405	
406	function _wpbingo_click_close_quickview(){
407		$('.quickview-close').on( "click", function(e) {
408			e.preventDefault();
409			$('.bwp-quick-view').empty().removeClass("active");
410		});		
411	}
412	
413	function _wpbingo_countdown_product($element){
414		$('.product-countdown',$element).each(function(event){
415			var $this = $(this);
416			var $id = $(this).data("id");		
417			var $current_time 	= new Date().getTime();
418			var $sttime 	= $(this).data('sttime');
419			var $countdown_time = $this.data('cdtime');
420			var $day = $this.data('day') ? $this.data('day') : "D";
421			var $hour = $this.data('hour') ? $this.data('hour') : "H";
422			var $min = $this.data('min') ? $this.data('min') : "M";
423			var $sec = $this.data('sec') ? $this.data('sec') : "S";			
424			var $austDay 	= new Date();
425			$austDay 		= new Date( $countdown_time * 1000 );	
426			if( $sttime > $current_time  ){
427				$this.remove();
428				return ;
429			}
430			if( $countdown_time.length > 0 && $current_time > $countdown_time ){
431				$this.remove();
432				return ;
433			}
434			if( $countdown_time.length <= 0 ){
435				$this.remove();
436				return ;
437			}
438			$this.countdown($austDay, function(event) {
439				$(this).html(
440					event.strftime('<span class="countdown-content"><span class="days"><span class="countdown-amount">%D</span><span class="countdown-text">'+$day+'</span></span><span class="countdown-section hours"><span class="countdown-amount">%H</span><span class="countdown-text">'+$hour+'</span></span><span class="countdown-section mins"><span class="countdown-amount">%M</span><span class="countdown-text">'+$min+'</span></span><span class="countdown-section secs"><span class="countdown-amount">%S</span><span class="countdown-text">'+$sec+'</span></span></span>')
441				);
442			}).on('finish.countdown', function(event){
443				$this.remove();
444				$id = $this.data( 'id' );
445				$target = this;
446				$this.hide('slow', function(){ $(this).remove(); });	
447				$price = $this.data( 'price' );
448				$('#' + $id + ' .item-price > span').hide('slow', function(){ $('#' + $id + ' .item-price > span').remove(); });					
449				$('#' + $id + ' .item-price' ).append( '<span><span class="amount">' + $price + '</span></span>' );
450			});			
451		});	
452	}
453	function _wpbingo_drag_slider($element){
454		var _window = $( window );
455		var $wrap  = $element.parent();
456		var $content =  $element.closest(".scroll-list");
457		if(_window.width() >= 1200){
458			var $width = Math.ceil($content.width()/($element.data("columns")));
459		}else if( _window.width() < 1200 && _window.width() >= 998 ){
460			var $width = Math.ceil($content.width()/($element.data("columns1")));
461		}else if( _window.width() < 998 && _window.width() >= 768 ){
462			var $width = Math.ceil($content.width()/($element.data("columns2")));
463		}else{
464			var $width = Math.ceil($content.width()/($element.data("columns3")));
465		}
466		$element.find('.item-product').css("width",$width);
467		var options = {
468			horizontal: 1,
469			itemNav: 'basic',
470			smart: 1,
471			activateOn: 'click',
472			mouseDragging: 1,
473			touchDragging: 1,
474			releaseSwing: 1,
475			startAt: 0,
476			scrollBar: $wrap.find('.scrollbar'),
477			scrollBy: 1,
478			pagesBar: $wrap.find('.pages'),
479			activatePageOn: 'click',
480			speed: 300,
481			elasticBounds: 1,
482			dragHandle: 1,
483			dynamicHandle: 1,
484			clickBar: 1,
485			prevPage: $wrap.find('.prev'),
486			nextPage: $wrap.find('.next'),
487			disabledClass: 'disabled'
488		};
489		$element.sly(options);
490	}
491	//Load more Product
492	
493	$( ".bwp-products-loadmore" ).each(function() {
494		var $element = $(this);
495		 $(".loadmore",$element).click(function(e) {
496			e.preventDefault(); 
497			var paged = $(".count_loadmore", $element).val();
498			$.ajax({
499				type: "POST", 
500				url: $element.data("url"),
501				dataType: 'json',
502				data: {
503					action 		: "bwp_load_more_callback",
504					category 	:  $element.data("category"),			
505					orderby 	:  $element.data("orderby"),
506					order 		:  $element.data("order"),
507					numberposts :  $element.data("numberposts"),
508					source 		:  $element.data("source"),
509					attributes 	:  $element.data("attributes"),
510					total 		:  $element.data("total"),
511					content_product : 	$element.data("content_product") ? $element.data("content_product") : "",
512					paged 		: 	paged,
513				},
514				beforeSend: function() {
515	                $('.loadmore',$element).addClass('loading');
516	            },				
517				success: function (result) {	
518					if (result.products){
519						$('.products-list',$element).append(result.products);
520						paged = parseInt(paged) + 1;
521						$('.count_loadmore',$element).val(paged);
522						_wpbingo_click_quickview_button();
523						_wpbingo_countdown_product($(".products-list",$element));
524					}
525					if(result.check_loadmore == 1)
526						$('.products_loadmore',$element).hide();
527					 	$('.loadmore',$element).removeClass('loading');
528				}
529			});
530		});	
531	});
532	function _wpbingo_load_tooltip(){
533		$('[data-title]','.product-button').tooltip();
534	}
535})(jQuery);

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.