PageSourceSearch

https://dusablemuseum.org/wp-content/plugins/woo-product-filter/mo…/js/frontend.woofilters.js?ver=2.7.4

js dusablemuseum.org collected 2026-10-02 11:02:48 UTC 150,154 bytes, 3,934 lines download raw bytes

1(function ($, app) {
2	"use strict";
3	function WpfFrontendPage() {
4		this.$obj = this;
5		this.noWoo = this.$obj.checkNoWooPage();
6		this.readyFuncs = ['.berocket_load_more_preload', 'woocommerce-product-bundle-hide', 'show_variation', 'woo_variation_swatches_pro_init', '.variations_form', 'yith_infs_start', 'flatsome_infinite_scroll','.dipl_woo_products_pagination_wrapper', 'divi_filter_loadmore_ajax_handler'];
7		this.isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') == -1 && navigator.userAgent.indexOf('FxiOS') == -1;
8		this.disableScrollJs = true;
9		this.lastFids = [];
10		return this.$obj;
11	}
12
13	WpfFrontendPage.prototype.init = (function () {
14		var _thisObj = this.$obj;
15		app.wpfNewUrl = '';
16		window.wpfDoNotLoadMore = false;
17		_thisObj.filterClick = true;
18		_thisObj.filteringId = 0;
19
20		_thisObj.setCurrentLocation();
21		_thisObj.filterLoadTypes = [];
22		_thisObj.defaultProductSelector = 'ul.products';
23		_thisObj.isAdminPreview = jQuery('#wpfFiltersEditForm').length > 0 || (typeof isElementorPreview != 'undefined' && isElementorPreview == 1);
24		_thisObj.moveFloatingElements();
25		_thisObj.checkForceFilters();
26		_thisObj.eventsPriceFilter();
27		_thisObj.disableLeerOptions();
28		_thisObj.eventsFrontend();
29		_thisObj.changeSlugByUrl();
30		_thisObj.runCustomJs();
31		_thisObj.addCustomCss();
32		_thisObj.chageRangeFieldWidth();
33		_thisObj.addSpecificPluginActions();
34		_thisObj.resizeWindow();
35		_thisObj.changeOrderBy();
36		_thisObj.copySelectsForSafari();
37
38		jQuery('.wpfMainWrapper').each(function() {
39			_thisObj.markCheckboxSelected(jQuery(this), true);
40		});
41
42		if (_thisObj.isAdminPreview) {
43			_thisObj.hideFiltersLoader();
44		} else {
45			setTimeout(function () {
46				_thisObj.hideFiltersLoader();
47			}, 100);
48		}
49	});
50	WpfFrontendPage.prototype.moveFloatingElements = (function () {
51		var _thisObj = this.$obj;
52		if (!_thisObj.isAdminPreview && jQuery('.wpfFloatingBlock').length == 0 && jQuery('.wpfFloatingWrapper').length == 1) {
53			jQuery('body').append('<div class="wpfFloatingBlock"></div>');
54			if (jQuery('.wpfFloatingSwitcher').length == 1) {
55				var button = $('.wpfFloatingSwitcher');
56				if (button.hasClass('wpfSwitcherRealFloat')) {
57					button.detach();
58					$('.wpfFloatingBlock').append(button);
59				}
60			}
61			if (jQuery('.wpfFloatingOverlay').length == 1) {
62				var overlay = $('.wpfFloatingOverlay').detach();
63				$('.wpfFloatingBlock').append(overlay);
64			}
65			var block = $('.wpfFloatingWrapper').detach();
66			$('.wpfFloatingBlock').append(block);
67			
68		}
69	});
70
71	WpfFrontendPage.prototype.changeOrderBy = (function () {
72		jQuery('.woocommerce-ordering select').on('change', function (e) {
73			e.preventDefault();
74			var orderBy = jQuery(this).val(),
75				curUrl = window.location.href;
76
77			if ((curUrl.indexOf('?') === -1)) {
78				curUrl += '?orderby=' + orderBy;
79				jQuery('.wpfMainWrapper').each(function () {
80					var filter = $(this).data('filter-settings');
81					if (typeof filter.settings.filters.defaults !== 'undefined') {
82						curUrl += '&' + filter.settings.filters.defaults.replace(';', '&');
83					}
84				});
85			} else {
86				if (curUrl.indexOf('orderby') === -1) {
87					curUrl += ((curUrl.indexOf('?') === -1) ? '?' : '&') + 'orderby=' + orderBy;
88				} else {
89					curUrl = curUrl.replace(/(orderby=)[^&]*/, '$1' + orderBy);
90				}
91			}
92			jQuery(location).attr('href', curUrl);
93			return false;
94		});
95	});
96
97	WpfFrontendPage.prototype.resizeWindow = (function() {
98		var _thisObj = this.$obj;
99		_thisObj.filterOptionsForDevices();
100		jQuery( window ).on('resize', function() {
101			_thisObj.filterOptionsForDevices();
102		});
103	});
104
105	WpfFrontendPage.prototype.copySelectsForSafari = (function() {
106		var _thisObj = this.$obj;
107		if (!_thisObj.isSafari) return;
108
109		jQuery('.wpfMainWrapper').each(function () {
110			var $wrapper = jQuery(this),
111				$selectsWrapper = $wrapper.find('.wpfSelectCopies');
112			if ($selectsWrapper.length == 0) {
113				jQuery('<div/>').addClass('wpfSelectCopies').appendTo($wrapper);
114				$selectsWrapper = $wrapper.find('.wpfSelectCopies');
115			}
116			if ($selectsWrapper.length == 0) return;
117
118			$wrapper.find('.wpfFilterWrapper[data-display-type="dropdown"] select').each(function() {
119				var $select = jQuery(this),
120					$filter = $select.closest('.wpfFilterWrapper'),
121					blockId = $filter.attr('id');
122				if ($selectsWrapper.find('select[data-block="' + blockId + '"]').length == 0) {
123					$select.clone().attr('data-block', blockId).appendTo($selectsWrapper);
124				}
125			});
126			_thisObj.removeHiddenOptionsForSafari($wrapper);
127		});
128	});
129
130	WpfFrontendPage.prototype.restoreSelectsForSafari = (function() {
131		var _thisObj = this.$obj;
132		if (!_thisObj.isSafari) return;
133
134		jQuery('.wpfMainWrapper').each(function () {
135			var $wrapper = jQuery(this),
136			$selectsWrapper = $wrapper.find('.wpfSelectCopies');
137			if ($selectsWrapper.length == 1) {
138
139				$selectsWrapper.find('select').each(function() {
140					var $select = jQuery(this),
141						blockId = $select.attr('data-block'),
142						$filterSelect = $wrapper.find('#' + blockId + ' select');
143					if ($filterSelect.length == 1) {
144						var value = $filterSelect.val();
145						$filterSelect.html($select.html());
146						$filterSelect.val(value);
147					}
148				});
149			}
150		});
151	});
152	WpfFrontendPage.prototype.removeHiddenOptionsForSafari = (function() {
153		var _thisObj = this.$obj;
154		if (!_thisObj.isSafari) return;
155
156		jQuery('.wpfFilterWrapper[data-display-type="dropdown"] select:visible option').each(function() {
157			if (jQuery(this).css('display') == 'none') jQuery(this).remove();
158		});
159	});
160
161	WpfFrontendPage.prototype.checkForceFilters = (function() {
162		var forceShowFilter = jQuery('.wpfMainWrapper[data-force="1"]');
163		if (!forceShowFilter.length) return;
164		
165		jQuery('.wpfMainWrapper').each(function () {
166			var wrapper = jQuery(this),
167				forceShowCurrent = wrapper.attr('data-force');
168			if (!forceShowCurrent){
169				wrapper.remove();
170				if (wrapper.closest('.WpfWoofiltersWidget').length) {
171					wrapper.closest('.WpfWoofiltersWidget').remove();
172				}
173			}
174		});
175	});
176	
177	WpfFrontendPage.prototype.showFiltersLoader = (function() {
178		jQuery('.wpfMainWrapper').each(function () {
179			var wrapper = jQuery(this);
180			wrapper.css('position','relative');
181			if (!wrapper.find('.wpfLoaderLayout').length){
182				jQuery('<div/>').addClass('wpfLoaderLayout').appendTo(wrapper);
183				wrapper.find('.wpfLoaderLayout').append('<i class="fa fa-spinner fa-pulse fa-3x fa-fw"/>');
184			}
185
186			wrapper.find('.wpfLoaderLayout').show();
187		});
188	});
189
190	WpfFrontendPage.prototype.hideFiltersLoader = (function() {
191		jQuery('.wpfMainWrapper').each(function () {
192			var wrapper = jQuery(this);
193
194			hideFilterLoader(wrapper);
195		});
196	});
197
198	WpfFrontendPage.prototype.runCustomJs = (function () {
199		var _thisObj = this.$obj;
200		jQuery('.wpfMainWrapper').each(function () {
201			var wrapper = jQuery(this),
202				jsCodeStr = '',
203				settings = _thisObj.getFilterMainSettings(wrapper);
204			if(settings){
205				settings = settings.settings;
206				jsCodeStr = settings.js_editor;
207			}
208			if(jsCodeStr.length > 0){
209				try {
210					eval(jsCodeStr);
211				}catch(e) {
212					console.log(e);
213				}
214
215			}
216		});
217	});
218
219	WpfFrontendPage.prototype.addCustomCss = (function () {
220		if (jQuery('style#wpfCustomCss').length === 0) {
221			var cssCodeStr = '';
222
223			jQuery('.wpfMainWrapper').each(function () {
224				var wrapper = jQuery(this),
225					customCss = jQuery('style#wpfCustomCss-' + wrapper.attr('data-viewid'));
226				if (customCss.length) {
227					cssCodeStr += customCss.html();
228					customCss.remove();
229				}
230			});
231			if (cssCodeStr.length > 0) {
232				jQuery('<style type="text/css" id="wpfCustomCss">' + cssCodeStr + '</style>').appendTo('head');
233			}
234		}
235	});
236
237	WpfFrontendPage.prototype.chageRangeFieldWidth = (function () {
238		var _thisObj = this.$obj;
239		jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"]').each(function () {
240			var filter = jQuery(this),
241				input1 = filter.find('#wpfMinPrice'),
242				input2 = filter.find('#wpfMaxPrice'),
243				fontSize1 = input1.css('font-size'),
244				fontSize2 = input2.css('font-size'),
245				visbleBuffer1 = filter.find('.wpfVisibleBufferMin'),
246				visbleBuffer2 = filter.find('.wpfVisibleBufferMax');
247			if(fontSize1) visbleBuffer1.css('font-size', fontSize1);
248			if(fontSize2) visbleBuffer2.css('font-size', fontSize2);
249
250			jQuery(visbleBuffer1).text(input1.val());
251			jQuery(visbleBuffer2).text(input2.val());
252
253			if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
254				jQuery(input1).width(visbleBuffer1.width()+20);
255				jQuery(input2).width(visbleBuffer2.width()+20);
256			} else {
257				jQuery(input1).width(visbleBuffer1.width()+10);
258				jQuery(input2).width(visbleBuffer2.width()+10);
259			}
260		});
261	});
262
263	WpfFrontendPage.prototype.eventsPriceFilter = (function () {
264		var _thisObj = this.$obj;
265
266		jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"]').each(function () {
267			_thisObj.initDefaultSlider(jQuery(this));
268		});
269
270		//change price filters
271		jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"]').on('wpfPriceChange', function(event){
272			var filter = jQuery(this),
273				mainWrapper = filter.closest('.wpfMainWrapper');
274
275			mainWrapper.find('.wpfFilterWrapper[data-filter-type="wpfPriceRange"] input').prop('checked', false);
276			mainWrapper.find('.wpfFilterWrapper[data-filter-type="wpfPriceRange"] select')
277				.val(mainWrapper.find('.wpfFilterWrapper[data-filter-type="wpfPriceRange"] select option:first').val());
278
279			filter.removeClass('wpfNotActive');
280			mainWrapper.find('.wpfFilterWrapper[data-filter-type="wpfPriceRange"]').addClass('wpfNotActive');
281		});
282
283		//change price range
284		jQuery('.wpfFilterWrapper[data-filter-type="wpfPriceRange"] input, .wpfFilterWrapper[data-filter-type="wpfPriceRange"] select').on('change', function(e){
285			e.preventDefault();
286
287			jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"]').addClass('wpfNotActive');
288		});
289
290	});
291	
292	WpfFrontendPage.prototype.initDefaultSlider = (function (filter, type) {
293		var _thisObj = this.$obj,
294			wrapper = filter.closest('.wpfMainWrapper'),
295			filterType = typeof type !== 'undefined' ? type : 'price',
296			getAttr = filter.data('get-attribute'),
297			minInputId = '#wpfMinPrice',
298			maxInputId = '#wpfMaxPrice',
299			triggerName = 'wpfPriceChange';
300		
301		if (filterType === 'attr') {
302			minInputId = '#wpfMinAttrNum';
303			maxInputId = '#wpfMaxAttrNum';
304			triggerName = 'wpfAttrSliderChange';
305		}
306		
307		var minSelector = wrapper.find(minInputId),
308			maxSelector = wrapper.find(maxInputId),
309			wpfDataStep = wrapper.find('#wpfDataStep').val()
310		if (wpfDataStep == '0.001') {
311			wpfDataStep = '0.00000001';
312		}
313		wpfDataStep = Number(wpfDataStep);
314
315		var valMin = parseFloat(minSelector.attr('min')),
316			valMax = parseFloat(maxSelector.attr('max')),
317			curUrl = window.location.href,
318			urlParams = _thisObj.findGetParameter(curUrl),
319			rate = filter.data('rate');
320
321		urlParams = _thisObj.getConvertedPrices(urlParams, rate);
322
323		var	minPriceGetParams = urlParams.wpf_min_price ? parseFloat(urlParams.wpf_min_price) : valMin,
324			maxPriceGetParams = urlParams.wpf_max_price ? parseFloat(urlParams.wpf_max_price) : valMax;
325		
326		if (filterType === 'attr') {
327			if (urlParams[getAttr]) {
328				var idsAnd = urlParams[getAttr].split(','),
329					idsOr = urlParams[getAttr].split('|'),
330					isAnd = idsAnd.length > idsOr.length;
331				var filterTypeValues = isAnd ? idsAnd : idsOr;
332			}
333			minPriceGetParams = urlParams[getAttr] ? parseFloat(filterTypeValues[0]) : valMin;
334			maxPriceGetParams = urlParams[getAttr] ? parseFloat(filterTypeValues.pop()) : valMax;
335		}
336			
337		var sliderWrapper = filter.find("#wpfSliderRange"),
338			autoFilteringEnable = (wrapper.find('.wpfFilterButton').length == 0),
339			skin = filter.attr('data-price-skin');
340		if(skin === 'default'){
341			sliderWrapper.slider({
342				range: true,
343				orientation: "horizontal",
344				min: valMin,
345				max: valMax,
346				step: wpfDataStep,
347				values: [minPriceGetParams, maxPriceGetParams],
348				slide: function (event, ui) {
349					minSelector.val(ui.values[0]);
350					maxSelector.val(ui.values[1]);
351					filter.trigger(triggerName);
352				},
353				start: function () {
354					filter.trigger(triggerName);
355				},
356				stop: function () {
357					if(autoFilteringEnable){
358						_thisObj.setCurrentLocation();
359						_thisObj.filtering(wrapper);
360					}
361				},
362			});
363			minSelector.val(sliderWrapper.slider("values", 0));
364			maxSelector.val(sliderWrapper.slider("values", 1));
365		}
366	});
367
368	// add/remove get query param
369	WpfFrontendPage.prototype.QStringWork = (function ($attr, $value, $noWooPage, $filterWrapper, $type) {
370
371		$noWooPage = false;
372		if (window.wpfAdminPage) {
373			$noWooPage = true;
374		}
375		if($type === 'change'){
376			var curUrl = changeUrl($attr, $value, $noWooPage, $filterWrapper );
377			$filterWrapper.attr('data-hide-url', decodeURI(curUrl));
378		}else if($type === 'remove'){
379			var curUrl = removeQString($attr, $noWooPage, $filterWrapper);
380			$filterWrapper.attr('data-hide-url', decodeURI(curUrl));
381		}
382	});
383
384	WpfFrontendPage.prototype.eventChangeFilter = (function (e) {
385		var _thisObj = this.$obj,
386			_this = jQuery(e.target),
387			mainWrapper = _this.closest('.wpfMainWrapper'),
388			settings = _thisObj.getFilterMainSettings(mainWrapper);
389		_thisObj.setCurrentLocation();
390
391		_this.closest('.wpfFilterWrapper').removeClass('wpfNotActive');
392		if(typeof(_thisObj.eventChangeFilterPro) == 'function') {
393			_thisObj.eventChangeFilterPro(_this, settings);
394		}
395
396		var redirectOnlyClick = Number(settings.settings.redirect_only_click),
397		    autoUpdateFilter  = Number(settings.settings.auto_update_filter),
398			loaderEnable  = Number(settings.settings.filter_loader_icon_onload_enable),
399			isButton = ( mainWrapper.find('.wpfFilterButton').length > 0 ),
400			isCheckbox = _this.attr('type') == 'checkbox',
401			redirectLink = isCheckbox ? _this.closest('li' ).attr('data-link') : _this.find('option:selected').attr('data-link');
402
403		if (typeof redirectLink !== 'undefined' && isCheckbox) {
404			var filter = _this.closest('.wpfFilterWrapper');
405			if (filter.attr('data-display-type') != 'list' && _this.is(':checked')){
406				filter.find('input').prop('checked', false);
407				_this.prop('checked', true);
408			}
409		}
410
411		if (isButton) {
412			// if there is a button and autoUpdateFilter is selected, then we only change the filter.
413			// If redirectOnlyClick is selected, then we change the filter and products, but do not redirect until the button is clicked
414
415			if (autoUpdateFilter || redirectOnlyClick) {
416				if (loaderEnable) {
417					mainWrapper.find('.wpfLoaderLayout').show();
418				}
419				_thisObj.filterClick = false;
420				_thisObj.filtering(mainWrapper, false, redirectLink);
421			}
422
423		} else {
424			_thisObj.filterClick = true;
425			_thisObj.filtering(mainWrapper, false, redirectLink);
426		}
427	});
428
429
430	WpfFrontendPage.prototype.eventsFrontend = (function () {
431		var _thisObj = this.$obj,
432			searchParams = jQuery.toQueryParams(window.location.search);
433
434		//for Impreza LoadMore Pagination
435		if (searchParams['all_products_filtering'] && searchParams['all_products_filtering'] == '1') {
436			jQuery( document ).ajaxSend(function( event, jqxhr, settings ) {
437				if (settings.data) {
438					var response = _thisObj.unserializeStr(settings.data);
439					if (response['action'] && response['action'] == 'us_ajax_grid') {
440						if (response['template_vars'] && response['template_vars'].length) {
441							try {
442								var query = JSON.parse(response['template_vars']);
443							}catch(e){
444								var query = false;
445							}
446							if (query && query['query_args']) {
447								var args = query['query_args'];
448								if (args['product_cat']) delete args.product_cat;
449								if (args['product_tag']) delete args.product_tag;
450								response['template_vars'] = JSON.stringify(query);
451								var result = [];
452								jQuery.each(response, function(key, val) {
453									result.push(encodeURIComponent(key) + "=" + encodeURIComponent(val));
454								});
455								settings.data = result.join("&").replace(/%20/g, "+");
456							}
457						}
458					}
459				}
460			});
461		}
462		//for Divi Filter LoadMore / eael-pagination
463		if (jQuery('.divi-filter-archive-loop, .eael-woo-pagination').length) {
464			var actions = ['divi_filter_loadmore_ajax_handler', 'woo_product_pagination_product'];
465			jQuery( document ).ajaxSend(function( event, jqxhr, settings ) {
466				if (settings.data) {
467					var response = _thisObj.unserializeStr(settings.data);
468					if (response['action'] && actions.indexOf(response['action']) != -1) {
469						var s = window.location.search;
470						if (s && s.length > 1) {
471							response['with_wpf_filter'] = s.replace('?','');
472							var result = [];
473							jQuery.each(response, function(key, val) {
474								result.push(encodeURIComponent(key) + "=" + encodeURIComponent(val));
475							});
476							settings.data = result.join("&").replace(/%20/g, "+");
477						}
478					}
479				}
480			});
481		}
482		//for woocommerce-blocks (All products and others)
483		if (typeof window.wpfFetchHookCreated == 'undefined' || window.wpfFetchHookCreated != 1) {
484			window.fetch = new Proxy(window.fetch, {
485				apply(fetch, that, args) {
486					var url = args.length ? args[0] : '';
487					if (typeof url === 'string' && url.length) {
488						if (url.indexOf('wp-json/wc/store/') != -1 && url.indexOf('/products?') != -1 && url.indexOf('per_page=') != -1) {
489							var s = window.location.search;
490							if (s.length) args[0] += s.replace('?','&');
491							else {
492								var urlPreselects = '';
493								jQuery('.wpfMainWrapper').each(function() {
494									var settings = _thisObj.getFilterMainSettings(jQuery(this)),
495										preselects = typeof settings.settings.filters.preselect !== 'undefined' ? settings.settings.filters.preselect : '';
496									if (preselects.length) {
497										urlPreselects += '&'+preselects.replace(/;/g,'&');
498										if (settings.settings.filtering_by_variations=='1') urlPreselects += '&wpf_fbv=1';
499										if (settings.settings.exclude_backorder_variations=='1') urlPreselects += '&wpf_ebv=1';
500										if (settings.settings.display_product_variations=='1') urlPreselects += '&wpf_dpv=1';
501									}
502								});
503								if (urlPreselects.length) {
504									args[0] += urlPreselects + '&wpf_preselects=1';
505									
506								}
507							}
508						} else {
509							//Elementor Loop Load More
510							if ((jQuery('.e-load-more-anchor').length == 1) && jQuery('.e-load-more-spinner').length && url.indexOf('?') == -1) {
511								var $elementorLoadMoreAnchor = jQuery('.e-load-more-anchor'),
512									s = window.location.search;
513								if (s.length) {
514									var nextPage = $elementorLoadMoreAnchor.attr('data-next-page');
515									if (nextPage == url) args[0]+= s;
516								}		
517		
518							}
519						}
520					}
521					const result = fetch.apply(that, args);
522					return result;
523				}
524			});
525			window.wpfFetchHookCreated = 1;
526		}
527
528		//for themes with ajax-paginations, ajax-ordering
529		jQuery(document).ajaxComplete(function(event, xhr, options) {
530			setTimeout(function() {
531				if (jQuery('.wpfLoaderLayout:visible').length) {
532					window.wpfFrontendPage.init();
533					if (typeof(window.wpfFrontendPage.eventsFrontendPro) == 'function') {
534						window.wpfFrontendPage.eventsFrontendPro();
535					}
536				}
537			}, 500);
538			//if (jQuery('.wpfLoaderLayout:visible').length) window.wpfFrontendPage.init();
539		});
540
541		jQuery('.wpfMainWrapper').find('select[multiple]').each(function(){
542			var select = jQuery(this),
543				selectAll = select.attr('data-placeholder'),
544				search = JSON.parse(select.attr('data-search')),
545			    singleSelect = select.data('single-select'),
546				showCheckbox = (typeof select.data('hide-checkboxes') === 'undefined');
547
548			setTimeout(function () {
549				select.multiselect({
550					search: search.show,
551					columns: 1,
552					placeholder: selectAll ? selectAll : 'Select options',
553					optionAttributes: ['style', 'data-term-id'],
554					searchOptions: {'default': search.placeholder},
555					showCheckbox: showCheckbox,
556					onOptionClick: function (element, option) {
557						if (typeof singleSelect !== 'undefined') {
558							var value = jQuery(option).val();
559							jQuery(option).closest('ul').find('input[type="checkbox"][value!=' + value + ']').prop('checked', false);
560							jQuery(element).val(value);
561							jQuery(element).siblings('.ms-options-wrap').find('.ms-options:visible').hide();
562						}
563					},
564				});
565			}, 100);
566
567			if (search.show) {
568				jQuery('.ms-options-wrap').on('click', 'button', function () {
569					$(this).next('.ms-options').find('.ms-search input').focus();
570				});
571			}
572
573		});
574
575		if(jQuery('.wpfFilterWrapper[data-filter-type="wpfSortBy"]').length == 0) {
576			jQuery('.woocommerce-ordering').css('display', 'block');
577		}
578		
579		jQuery('.wpfFilterWrapper[data-hide-single="1"]').each(function(){
580			var filter = jQuery(this),
581				selector = filter.find('.wpfColorsFilter').length ? 'li[data-term-slug]' : '[data-term-id]',
582				visible = 0;
583			if (filter.attr('data-display-type') != 'slider') {
584				filter.find(selector).each(function(){
585					if (jQuery(this).css('display') != 'none') visible++;
586				});
587				if (visible <= 1) {
588					filter.hide();
589				}
590			}
591		});
592
593		//if no enabled filters hide all html
594		if(jQuery('.wpfFilterWrapper').length < 1){
595			jQuery('.wpfMainWrapper').addClass('wpfHidden');
596		}
597		
598		//Start filtering
599		jQuery('body').on('mousedown', '.wpfFilterButton, .js-wpfFilterButtonSearch', function (e) {
600			e.preventDefault();
601			var $this = jQuery(this),
602				mainWrapper = $this.closest('.wpfMainWrapper'),
603				inputSearch = mainWrapper.find('.js-passiveFilterSearch');
604			if (inputSearch.length) {
605				inputSearch.each(function() {
606					var $sElem = jQuery(this);
607					if ($sElem.val() !== '') {
608						$sElem.closest('.wpfFilterWrapper').removeClass('wpfNotActive');
609					}
610					$sElem.trigger('blur');
611				});
612				
613			}
614			applyFilter(_thisObj, $this);
615		});
616
617		jQuery('input.js-passiveFilterSearch').on('keydown', function (e) {
618			var char_code = e.which;
619			if (parseInt(char_code) == 13) {
620				e.preventDefault();
621				var $this = jQuery(this);
622				$this.closest('.wpfFilterWrapper').removeClass('wpfNotActive');
623				$this.trigger('blur');
624				applyFilter(_thisObj, $this);
625			}
626		});
627
628
629		//Clear filters
630		jQuery('body').on('click', '.wpfClearButton', function (e) {
631			e.preventDefault();
632			var $filterWrapper = jQuery(this).closest('.wpfMainWrapper'),
633				settings = _thisObj.getFilterMainSettings($filterWrapper),
634				resetAllFilters = typeof settings.settings.reset_all_filters !== 'undefined' ? settings.settings.reset_all_filters : 0;
635			_thisObj.setCurrentLocation();
636
637			if (resetAllFilters !== '0') {
638				jQuery('.wpfMainWrapper').each(function(){
639					_thisObj.clearFilters(jQuery(this).find('.wpfFilterWrapper'), true);
640				});
641			} else {
642				_thisObj.clearFilters($filterWrapper.find('.wpfFilterWrapper'), true);
643			}
644			if (Number(settings.settings.redirect_after_select) || Number(settings.settings.redirect_only_click)) {
645				_thisObj.filterClick = false;
646			}
647			_thisObj.filtering($filterWrapper, true);
648
649			if (typeof (_thisObj.initOneByOne) == 'function') {
650				_thisObj.initOneByOne($filterWrapper);
651			}
652
653		});
654
655		//price range choose only one checkbox
656		jQuery('.wpfFilterWrapper[data-filter-type="wpfPriceRange"] .wpfFilterContent input').on('change', function (e) {
657			e.preventDefault();
658			var input = jQuery(this),
659				inputs = input.closest('.wpfFilterWrapper').find('input');
660			if(input.is(":checked")){
661				inputs.prop('checked', false);
662				input.prop('checked', true);
663			}
664		});
665
666		//category/brand list choose only one checkbox
667		jQuery('.wpfFilterWrapper[data-filter-type="wpfCategory"], .wpfFilterWrapper[data-filter-type="wpfPerfectBrand"], .wpfFilterWrapper[data-filter-type="wpfAttribute"]').each(function() {
668			var categoryFilter = jQuery(this),
669				displayType = categoryFilter.data('display-type'),
670				categoryMulti = displayType == 'multi';
671			if (categoryFilter.data('filter-type') == 'wpfAttribute') {
672				if (displayType == 'list' || displayType == 'switch') categoryMulti = true;
673			}
674
675			categoryFilter.find('.wpfFilterContent input').on('change', function (e) {
676				e.preventDefault();
677				var input = jQuery(this);
678				if(categoryMulti) {
679					var mainWrapper = input.closest('.wpfMainWrapper'),
680						filterWrapper = input.closest('.wpfFilterWrapper'),
681						expandSelectedToChild = _thisObj.getFilterParam('f_multi_extend_parent_select', mainWrapper, filterWrapper);
682
683					if(expandSelectedToChild && input.is(':checked')) {
684						input.closest('li').find('ul input').prop('checked', true);
685					}
686
687					if (expandSelectedToChild && ! input.is(':checked') ) {
688						input.closest('li').find('ul input').prop('checked', false);
689					}
690				}
691			});
692		});
693
694		//rating choose only one checkbox
695		jQuery('.wpfFilterWrapper[data-filter-type="wpfRating"] .wpfFilterContent input').on('change', function (e) {
696			e.preventDefault();
697			var input = jQuery(this),
698				inputs = input.closest('.wpfFilterWrapper').find('input');
699			if(input.is(":checked")){
700				inputs.prop('checked', false);
701				input.prop('checked', true);
702			}
703		});
704
705		//after change input or dropdown make this filter active
706		//check if ajax mode enable and filtering on filter elements change
707		jQuery('body').off('change', '.wpfFilterWrapper select, .wpfFilterWrapper input:not(.passiveFilter)').on('change', '.wpfFilterWrapper select, .wpfFilterWrapper input:not(.passiveFilter)', function (e) {
708			e.preventDefault();
709			var isExeptionCase = _thisObj.checkExeptionCasesBeforeFiltering(this);
710			// exeption checkbox in multidropdown
711			if (!isExeptionCase) {
712				var $this = jQuery(this);
713				if ($this.is('input') && $this.closest('.wpfFilterWrapper').data('display-type') == 'mul_dropdown') {
714					isExeptionCase = true;
715				}
716			}
717
718			if (!isExeptionCase) {
719				setTimeout(function() {
720					_thisObj.eventChangeFilter(e);
721				}, 100);
722			}
723		});
724
725		//after change input or dropdown make this filter active
726		jQuery('.wpfFilterWrapper input:not(.passiveFilter)').on('change', function (e) {
727			e.preventDefault();
728			// check if input change move to top
729			_thisObj.moveCheckedToTop(jQuery(this));
730			// check multy or single input (radio or checkbox)
731			_thisObj.detectSingleCheckbox(jQuery(this))
732			// Mark selected
733			_thisObj.markCheckboxSelected(jQuery(this).closest('.wpfFilterWrapper'));
734		});
735		
736		jQuery('.wpfMainWrapper').each(function() {
737			var mainWrapper = jQuery(this),
738				settings = _thisObj.getFilterMainSettings(mainWrapper);
739			if (settings && settings.settings && settings.settings.checked_items_top === '1') {
740				mainWrapper.find('.wpfFilterWrapper input').attr('autocomplete', 'off');
741				mainWrapper.find('.wpfFilterWrapper input:checked').each(function() {
742					_thisObj.moveCheckedToTop(jQuery(this), false);
743				});
744			}
745		});
746
747		/*jQuery('.wpfFilterWrapper input:checked').each(function() {
748			_thisObj.moveCheckedToTop(jQuery(this), false);
749		});*/
750
751		//search field work
752		jQuery('.wpfFilterWrapper .wpfSearchFieldsFilter').on('keyup', function (e) {
753			var _this = jQuery(this),
754				wrapper = _this.closest('.wpfFilterWrapper'),
755				searchVal = _this.val().toLowerCase(),
756				isIconFunc = typeof (_thisObj.getIcons) == 'function',
757				unfolding = (searchVal.length && _this.attr('data-unfolding') == '1' && isIconFunc),
758				collapse = (searchVal.length == 0 && _this.attr('data-collapse-search') == '1' && isIconFunc);
759			wrapper.find('.wpfFilterContent li:not(.wpfShowFewerWrapper)').filter(function() {
760				var $li = jQuery(this);
761				if ($li.find('.wpfValue').text().toLowerCase().indexOf(searchVal) > -1) {
762					$li.removeClass('wpfSearchHidden');
763					if (unfolding || collapse) {
764						var $parentLi = $li.closest('li');
765						while ($parentLi.length && $parentLi.closest('.wpfFilterWrapper')) {
766							var $label = $parentLi.children('label'),
767							    $icon = $label.length ? $label.find('i.fa, svg') : '';
768							if ($icon.length) {
769								var $icons = _thisObj.getIcons($icon.eq(0));
770								if ($icons.collapsed && unfolding || !$icons.collapsed && collapse) {
771									_thisObj.collapsibleToggle($icon.eq(0), $icons, $parentLi);
772								}
773							}
774							$parentLi = $parentLi.closest('ul').closest('li');
775						}
776					}
777				} else {
778					$li.addClass('wpfSearchHidden');
779				}
780			});
781			if(typeof(_thisObj.initShowMore) == 'function') {
782				_thisObj.initShowMore(wrapper.find('.wpfFilterVerScroll'));
783			}
784		});
785		/*jQuery('.wpfFilterWrapper .wpfSearchFieldsFilter').on('change', function (e) {
786			jQuery(this).closest('.wpfFilterWrapper').find('.wpfFilterContent li.wpfSearchHidden .wpfCheckbox input').prop('checked', false);
787		});*/
788
789		//uncheck one slug
790		jQuery('body').off('click', '.wpfSlugDelete').on('click', '.wpfSlugDelete', function(){
791			var _this = jQuery(this),
792				wrapper = _this.closest('.wpfSlug'),
793				filterType = wrapper.attr('data-filter-type'),
794				filterAttr = wrapper.attr('data-get-attribute'),
795				filterWrapper = false;
796			_thisObj.setCurrentLocation();
797
798			jQuery('.wpfFilterWrapper[data-filter-type="'+filterType+'"][data-get-attribute="'+filterAttr+'"]').each(function(){
799				var $this = jQuery(this),
800					filterType = $this.attr("data-filter-type");
801				if (filterType == 'wpfPrice' || filterType == 'wpfPriceRange') {
802					_thisObj.clearFilters($("[data-filter-type='wpfPrice']:not(.wpfSelectedParameter)"));
803					_thisObj.clearFilters($("[data-filter-type='wpfPriceRange']:not(.wpfSelectedParameter)"));
804				} else {
805					_thisObj.clearFilters($this);
806				}
807				if(filterWrapper == false) {
808					filterWrapper = $this.closest('.wpfMainWrapper');
809				}
810			});
811			if(filterWrapper != false) {
812				_thisObj.filtering(filterWrapper);
813			}
814		});
815
816		jQuery('body').off('click', '.wpfFilterWrapper .wpfFilterTitle').on('click', '.wpfFilterWrapper .wpfFilterTitle', function (e) {
817			e.preventDefault();
818			var _this = jQuery(this),
819				wrapper = _this.closest('.wpfMainWrapper'),
820				settings = _thisObj.getFilterMainSettings(wrapper),
821				content = _this.closest('.wpfFilterWrapper').find('.wpfFilterContent');
822
823			setTimeout(function () {
824				var toggle = _this.find('i.wpfTitleToggle, svg'),
825					icons  = {};
826				if (toggle.length) {
827					if (typeof (_thisObj.getIcons) == 'function') {
828						icons = _thisObj.getIcons(toggle);
829					} else {
830						icons = {collapsed: toggle.hasClass('fa-plus'), plusIcon: 'fa-plus', minusIcon: 'fa-minus'};
831					}
832
833					if (settings.settings.hide_filter_icon !== '0') {
834						if (icons.collapsed) {
835							_thisObj.openFilterToggle(toggle, content, true, icons);
836						} else {
837							_thisObj.closeFilterToggle(toggle, content, true, icons);
838						}
839					}
840				}
841			}, 100);
842		});
843
844		jQuery('body').off('click', '.wpfFilterWrapper .wpfBlockClear').on('click', '.wpfFilterWrapper .wpfBlockClear',  function(){
845			var parent = jQuery(this).closest(".wpfFilterWrapper"),
846				parentAttr = parent.attr("data-filter-type");
847			_thisObj.setCurrentLocation();
848			if (parentAttr == 'wpfPrice' || parentAttr == 'wpfPriceRange') {
849				_thisObj.clearFilters($("[data-filter-type='wpfPrice']:not(.wpfSelectedParameter)"));
850				_thisObj.clearFilters($("[data-filter-type='wpfPriceRange']:not(.wpfSelectedParameter)"));
851			} else {
852				_thisObj.clearFilters(parent);
853			}
854			_thisObj.filtering(parent.closest('.wpfMainWrapper'));
855			return false;
856		});
857
858		jQuery('body').off('wpffiltering').on('wpffiltering', function () {
859			_thisObj.setPagination(1);
860			_thisObj.setCurrentLocation();
861			_thisObj.filtering();
862			_thisObj.setPagination(0);
863		});
864
865		//click on new pagination link with page number
866		jQuery('body').off('click', '.wpfNoWooPage .woocommerce-pagination a.page-numbers').on('click', '.wpfNoWooPage .woocommerce-pagination a.page-numbers', function (e) {
867			e.preventDefault();
868			var _this = jQuery(this),
869				paginationWrapper = _this.closest('.woocommerce-pagination'),
870				currentNumber = paginationWrapper.find('.current').text();
871			if(!_this.hasClass('next') && !_this.hasClass('prev') ){
872				var number = _this.text();
873			}else if(_this.hasClass('next')){
874				var number = parseInt(currentNumber) + 1;
875			}else if(_this.hasClass('prev')){
876				var number = (parseInt(currentNumber) - 1) < 1 ? parseInt(currentNumber) - 1 : 1;
877			}
878			var wrapper = jQuery('.wpfMainWrapper').first(),
879				$queryVars = wrapper.attr('data-settings');
880			try{
881				var settings = JSON.parse($queryVars);
882			}catch(e){
883				var settings = false;
884			}
885			if(settings){
886				settings.paged = number;
887				settings.pagination = 1;
888				wrapper.attr('data-settings', JSON.stringify(settings) );
889			}
890			_thisObj.setCurrentLocation();
891
892			// todo: testing for two+ filters on page
893			_thisObj.filtering( jQuery('.wpfMainWrapper') );
894			_thisObj.setPagination(0);
895		});
896
897		var prevLocation = location.href.split('#').shift();
898		jQuery(window).on('popstate', function (e) {
899
900			var currentLocation = location.href.split('#').shift();
901			if (location.href.split('#').length > 1 && prevLocation === currentLocation) {
902				return;
903			}
904
905			if (typeof window.wpfAdminPage === 'undefined' && !_thisObj.isSafari) {
906				location.reload();
907			}
908		});
909		jQuery('.wpfPreselected:not([data-filter-type="wpfPriceRange"]) .wpfCheckbox input').prop('checked', true);
910		
911		jQuery('#wpfOverlay:not([data-filter]').each(function() {
912			var $overlay = jQuery(this),
913				$wrapper = $overlay.closest('.wpfMainWrapper');
914			$overlay.attr('data-filter-for', $wrapper.attr('id')).attr('data-filter',$wrapper.attr('data-filter'));
915			$overlay.appendTo('body');
916		});
917
918	});
919
920	function applyFilter(_thisObj, $this) {
921		var mainWrapper = $this.closest('.wpfMainWrapper');
922		_thisObj.setCurrentLocation();
923
924		_thisObj.filterClick = true;
925		_thisObj.filtering(mainWrapper);
926	}
927
928	WpfFrontendPage.prototype.filterOptionsForDevices = (function () {
929		var _thisObj = this.$obj;
930		jQuery('.wpfMainWrapper .wpfFilterWrapper').each(function () {
931			var _this = jQuery(this),
932				wrapper = _this.closest('.wpfMainWrapper'),
933				settings = _thisObj.getFilterMainSettings(wrapper),
934				isMobile = false,
935				screenSize = jQuery(window).width();
936
937			if (settings.settings !== undefined) {
938				var isMobileBreakpoint = settings.settings.desctop_mobile_breakpoint_switcher,
939					mobileBreakpoinWidth = isMobileBreakpoint && isMobileBreakpoint == '1' ? settings.settings.desctop_mobile_breakpoint_width : '0',
940
941					displayFor = settings.settings.display_for,
942
943					filterWidthDesktop          = settings.settings.filter_width,
944					filterWidthDesktopUnit      = settings.settings.filter_width_in,
945					filterWidthMobile           = settings.settings.filter_width_mobile,
946					filterWidthMobileUnit       = settings.settings.filter_width_in_mobile,
947					filterBlockWidthDesktop     = settings.settings.filter_block_width,
948					filterBlockWidthDesktopUnit = settings.settings.filter_block_width_in,
949					filterBlockWidthMobile      = settings.settings.filter_block_width_mobile,
950					filterBlockWidthMobileUnit  = settings.settings.filter_block_width_in_mobile;
951
952				if (mobileBreakpoinWidth && '0' !== mobileBreakpoinWidth) {
953					if (screenSize <= mobileBreakpoinWidth) {
954						isMobile = true;
955					}
956
957					// "Filter Width" and "Filter Block Width" options
958					if (isMobile && filterBlockWidthMobile != '0') {
959						wrapper.css('width', filterWidthMobile+filterWidthMobileUnit);
960						_this.css('width', filterBlockWidthMobile+filterBlockWidthMobileUnit);
961						if (filterBlockWidthMobile+filterBlockWidthMobileUnit != '100%') {
962							_this.css('float', 'left');
963						}
964					} else if (!isMobile && filterBlockWidthDesktop != '0') {
965						wrapper.css('width', filterWidthDesktop+filterWidthDesktopUnit);
966						_this.css('width', filterBlockWidthDesktop+filterBlockWidthDesktopUnit);
967						if (filterBlockWidthDesktop+filterBlockWidthDesktopUnit != '100%') {
968							_this.css('float', 'left');
969						}
970					}
971
972					// "Display filter on"  option
973					if (isMobile && displayFor == 'desktop') {
974						wrapper.hide();
975					} else if (!isMobile && displayFor == 'mobile') {
976						wrapper.hide();
977					}
978
979					// filters title
980					_this.find('.wpfFilterTitle[data-show-on-mobile]').each(function() {
981						jQuery(this).closest('.wpfFilterMainWrapper').find('wpfLoaderLayout').show();
982							var showDesctop = jQuery(this).data('show-on-desctop'),
983								showMobile = jQuery(this).data('show-on-mobile'),
984								content = jQuery(this).closest('.wpfFilterWrapper').find('.wpfFilterContent'),
985								title = jQuery(this).find('.wfpTitle'),
986								icons = {};
987						title.show();
988
989						var toggle = jQuery(this).closest('.wpfFilterWrapper').find('i.wpfTitleToggle, svg');
990						setTimeout(function () {
991							if (toggle.length) {
992								toggle.show();
993								if (typeof (_thisObj.getIcons) == 'function') {
994									icons = _thisObj.getIcons(toggle);
995								} else {
996									icons = {collapsed: toggle.hasClass('fa-plus'), plusIcon: 'fa-plus', minusIcon: 'fa-minus'};
997								}
998
999								if (isMobile) {
1000									if (showMobile == 'yes_open') {
1001										_thisObj.openFilterToggle(toggle, content, false, icons);
1002									} else if (showMobile == 'yes_close') {
1003										_thisObj.closeFilterToggle(toggle, content, false, icons);
1004									} else if (showMobile == 'no') {
1005										_thisObj.openFilterToggle(toggle, content, false, icons);
1006										toggle.hide();
1007										title.hide();
1008									}
1009								} else {
1010									if (showDesctop == 'yes_open') {
1011										_thisObj.openFilterToggle(toggle, content, false, icons);
1012									} else if (showDesctop == 'yes_close') {
1013										_thisObj.closeFilterToggle(toggle, content, false, icons);
1014									} else if (showDesctop == 'no') {
1015										_thisObj.openFilterToggle(toggle, content, false, icons);
1016										toggle.hide();
1017										title.hide();
1018									}
1019								}
1020							}
1021						}, 100);
1022					});
1023				}
1024			}
1025		});
1026	});
1027
1028	WpfFrontendPage.prototype.checkExeptionCasesBeforeFiltering = (function (filterInput) {
1029		var isExeption = false;
1030		// exeption when custom price do not set but input activated
1031		if ( jQuery(filterInput).parent().hasClass('wpfPriceCheckboxCustom')) {
1032			var customPriceWrapper = jQuery(filterInput).closest('li'),
1033				customMin = customPriceWrapper.find('input[name=wpf_custom_min]').val(),
1034				customMax = customPriceWrapper.find('input[name=wpf_custom_max]').val();
1035
1036			if (!customMin && !customMax) {
1037				isExeption = true;
1038			}
1039		}
1040		return isExeption;
1041	});
1042
1043	WpfFrontendPage.prototype.detectSingleCheckbox = (function (checkedInput) {
1044		var filterWrapper = checkedInput.closest('.wpfFilterWrapper'),
1045			displayType = filterWrapper.data('display-type'),
1046			filterType = filterWrapper.data('filter-type');
1047
1048		if (filterType == 'wpfCategory' || filterType == 'wpfPerfectBrand'|| filterType == 'wpfBrand') {
1049			var isOne = displayType == 'list';
1050		} else {
1051			var isOne = displayType == 'radio';
1052		}
1053
1054		if (isOne) {
1055			var inputs = filterWrapper.find('input');
1056
1057			if (checkedInput.is(':checked')) {
1058				inputs.prop('checked', false);
1059				checkedInput.prop('checked', true);
1060			}
1061		}
1062	});
1063
1064	WpfFrontendPage.prototype.moveCheckedToTop = (function (checkedInput, setPause) {
1065		var _thisObj = this.$obj,
1066			sPause = setPause === false ? 0 : 200;
1067		setTimeout(function() {
1068			var checkboxWrapper = checkedInput.closest('li'),
1069				mainWrapper = checkedInput.closest('.wpfMainWrapper'),
1070				filterWrapper = checkedInput.closest('.wpfFilterWrapper'),
1071				isHierarchical = filterWrapper.data('show-hierarchical'),
1072				settings = _thisObj.getFilterMainSettings(mainWrapper),
1073				checkboxesWrapper = checkedInput.closest(isHierarchical ? 'ul' : '.wpfFilterVerScroll');
1074			//if(settings && !isHierarchical) {
1075			if(settings && checkboxesWrapper.length) {
1076				settings = settings.settings;
1077				var checkedItemsTop = settings.checked_items_top === '1',
1078					isExeptionCase = _thisObj.checkExeptionCasesBeforeFiltering(checkedInput);
1079				if(checkedItemsTop && !isExeptionCase){
1080					if (checkedInput.is(":checked")) {
1081						checkboxesWrapper.prepend(checkboxWrapper);
1082					} else {
1083						checkboxesWrapper.append(checkboxWrapper);
1084						checkboxesWrapper.append(checkboxesWrapper.find('.wpfShowFewerWrapper,.wpfShowMoreWrapper'));
1085					}
1086					checkboxesWrapper.scrollTop(0);
1087				}
1088			}
1089		}, sPause);
1090	});
1091
1092	WpfFrontendPage.prototype.closeFilterToggle = (function (toggle, content, isTimeout, icons) {
1093		if (toggle.hasClass(icons.minusIcon)) {
1094			toggle.removeClass(icons.minusIcon);
1095			toggle.addClass(icons.plusIcon);
1096			content.addClass('wpfBlockAnimated');
1097			if (typeof isTimeout !== 'undefined' && isTimeout) {
1098				setTimeout(function () {
1099					if (content.hasClass('wpfBlockAnimated')) content.addClass('wpfHide');
1100				}, 10);
1101			} else {
1102				if (content.hasClass('wpfBlockAnimated')) content.addClass('wpfHide');
1103			}
1104		}
1105	});
1106
1107	WpfFrontendPage.prototype.openFilterToggle = (function (toggle, content, isTimeout, icons) {
1108		if (toggle.hasClass(icons.plusIcon)) {
1109			toggle.removeClass(icons.plusIcon);
1110			toggle.addClass(icons.minusIcon);
1111			content.removeClass('wpfHide');
1112			if (typeof isTimeout !== 'undefined' && isTimeout) {
1113				setTimeout(function () {
1114					if (!content.hasClass('wpfHide')) content.removeClass('wpfBlockAnimated');
1115				}, 400);
1116			} else {
1117				if (!content.hasClass('wpfHide')) content.removeClass('wpfBlockAnimated');
1118			}
1119		}
1120	});
1121
1122	WpfFrontendPage.prototype.setPagination = (function (pagination) {
1123		var wrapper = jQuery('.wpfMainWrapper').first(),
1124			$queryVars = wrapper.attr('data-settings');
1125		try{
1126			var settings = JSON.parse($queryVars);
1127		}catch(e){
1128			var settings = false;
1129		}
1130		if(settings){
1131			settings.pagination = pagination;
1132			wrapper.attr('data-settings', JSON.stringify(settings) );
1133		}
1134	});
1135	WpfFrontendPage.prototype.setCurrentLocation = (function() {
1136		app.wpfOldUrl = window.location.href;
1137		app.wpfNewUrl = app.wpfOldUrl;
1138	});
1139
1140	WpfFrontendPage.prototype.filtering = (function ($filterWrapper, clearAll, redirectLink, onlyRecalcFilter) {
1141		var _thisObj = this.$obj;
1142		_thisObj.chageRangeFieldWidth();
1143		if(_thisObj.isAdminPreview) return;
1144
1145		if(typeof $filterWrapper == 'undefined' || $filterWrapper.length == 0) {
1146			$filterWrapper = jQuery('.wpfMainWrapper').first();
1147		}
1148		if (_thisObj.filterClick && $filterWrapper.length) {
1149			_thisObj.createOverlay($filterWrapper.attr('id'));
1150		}
1151		if (typeof (_thisObj.beforeFilteringPro) === 'function') {
1152			_thisObj.beforeFilteringPro($filterWrapper);
1153		}
1154		
1155		_thisObj.isSynchro = false;
1156		_thisObj.isStatistics = false;
1157
1158		if ($filterWrapper.length !== 0) {
1159			_thisObj.filteringId++;
1160			_thisObj.lastFids[$filterWrapper.data('viewid')] = _thisObj.filteringId;
1161			
1162			var $filtersDataBackend = [],
1163				$filtersDataFrontend = [],
1164				noWooPage = _thisObj.noWoo,
1165				$generalSettings = _thisObj.getFilterMainSettings($filterWrapper);
1166			_thisObj.isSynchro = $generalSettings['settings']['use_filter_synchro'] && ($generalSettings['settings']['use_filter_synchro'] == '1') ? true : false;
1167			_thisObj.isStatistics = $filterWrapper.attr('data-is-stats') == 1;
1168			
1169			if(_thisObj.isSynchro) {
1170				_thisObj.syncronizeFilters($filterWrapper);
1171			}
1172
1173			(_thisObj.isSynchro ? jQuery('.wpfMainWrapper') : $filterWrapper).find('.wpfFilterWrapper:not(.wpfNotActive), .wpfFilterWrapper.wpfPreselected').each(function () {
1174				var $filter = jQuery(this),
1175					filterType = $filter.attr('data-filter-type'),
1176					filterName = $filter.attr('data-get-attribute'),
1177					wrapper = $filter.closest('.wpfMainWrapper'),
1178					idFilter = wrapper.data('filter'),
1179					uniqId = $filter.attr('data-uniq-id'),
1180					allSettings = _thisObj.getFilterOptionsByType($filter, filterType),
1181					valueToPushBackend = {},
1182					valueToPushFrontend = {},
1183					logic = $filter.attr('data-query-logic'),
1184					isGroup = false,
1185					cgIndex = null;
1186				if(_thisObj.isStatistics && typeof (_thisObj.prepareStatisticsData) == 'function') {
1187					_thisObj.prepareStatisticsData($filter, allSettings);
1188				}
1189
1190				try {
1191					var order = JSON.parse(_thisObj.getFilterMainSettings(wrapper).settings.filters.order);
1192					jQuery.each(order, function (i, v) {
1193						if (v.uniqId === uniqId) {
1194							jQuery.each(v.settings, function (i, v) {
1195								cgIndex = i.match(/^f_cglist\[(\d+)\]/);
1196								if (cgIndex !== null && typeof cgIndex[1] !== 'undefined' && v !== '') {
1197									isGroup = true;
1198								}
1199							});
1200						}
1201					});
1202				} catch (e) {
1203				}
1204
1205				if (typeof logic === 'undefined') {
1206					logic = 'or';
1207				} else if (logic == 'not') {
1208					var notIds = $filter.attr('data-not-ids');
1209					if (notIds && notIds.length > 0) {
1210						allSettings = {backend: notIds.split(',')};
1211					}
1212				}
1213				var withChildren = $filter.attr('data-query-children');
1214				if (typeof withChildren === 'undefined') {
1215					withChildren = '1';
1216				}
1217
1218				if (allSettings['backend'].length && typeof allSettings['backend'] !== 'undefined' || filterType === 'wpfSearchText'  || filterType === 'wpfSearchNumber') {
1219					valueToPushBackend['id'] = filterType;
1220					valueToPushBackend['uniqId'] = uniqId;
1221					valueToPushBackend['logic'] = logic;
1222					valueToPushBackend['children'] = withChildren;
1223					valueToPushBackend['settings'] = allSettings['backend'];
1224					valueToPushBackend['name'] = filterName;
1225					$filtersDataBackend.push(valueToPushBackend);
1226				}
1227				if ('frontend' in allSettings) {
1228
1229					valueToPushFrontend['id'] = filterType;
1230
1231					var logicDelimetrList = {
1232						or: '|',
1233						and: ',',
1234						not_in: ';'
1235					}
1236
1237					valueToPushFrontend['delim'] = logicDelimetrList[logic];
1238					valueToPushFrontend['children'] = withChildren;
1239					valueToPushFrontend['settings'] = allSettings['frontend'];
1240					valueToPushFrontend['name'] = filterName;
1241					if (isGroup) {
1242						valueToPushFrontend['idFilter'] = idFilter;
1243						valueToPushFrontend['idBlock'] = uniqId.replace(/^wpf/, '');
1244					}
1245					$filtersDataFrontend.push(valueToPushFrontend);
1246				}
1247			});
1248			
1249			var redirectTerm = typeof redirectLink !== 'undefined';
1250			if (redirectTerm || (typeof $filterWrapper.data('redirect-page-url') !== 'undefined' && _thisObj.filterClick)) {
1251				history.pushState({state: 1, rand: Math.random(), wpf: true}, '', location.protocol + '//' + location.host + location.pathname);
1252			}
1253
1254			var filterId = $filterWrapper.data('filter');
1255			if (typeof filterId !== 'undefined') {
1256				jQuery('span.wpfHidden').each(function () {
1257					var $span = jQuery(this),
1258						attribute = $span.data('shortcode-attribute'),
1259						fclass = 'wpf-filter-' + filterId;
1260					if ((attribute.class !== '' && fclass === attribute.class) || $span.closest('.'+fclass).length) {
1261						_thisObj.QStringWork('wpf_id', filterId, noWooPage, $filterWrapper, 'change');
1262					}
1263				});
1264			}
1265			
1266			_thisObj.changeUrlByFilterParams($filtersDataFrontend);
1267			_thisObj.QStringWork('wpf_reload', '', noWooPage, $filterWrapper, 'remove');
1268
1269			//get paged params from html
1270			var $queryVars = $filterWrapper.attr('data-settings'),
1271				$defQuery = $filterWrapper.attr('data-default-query'),
1272				$queryVarsSettings = JSON.parse($queryVars);
1273
1274			var $filterSettings = $generalSettings === false ? {} : {
1275				'wpf_fid': _thisObj.filteringId,
1276				'filter_recount': $generalSettings['settings']['filter_recount'] && ($generalSettings['settings']['filter_recount'] == '1') ? true : false,
1277				'filter_recount_price': $generalSettings['settings']['filter_recount_price'] && ($generalSettings['settings']['filter_recount_price'] == '1') ? true : false,
1278				'text_no_products': $generalSettings['settings']['text_no_products'] ? $generalSettings['settings']['text_no_products'] : '',
1279				'count_product_shop': $generalSettings['settings']['count_product_shop'] ? parseInt($generalSettings['settings']['count_product_shop']) : 0,
1280				'f_multi_logic': $generalSettings['settings']['f_multi_logic'] ? $generalSettings['settings']['f_multi_logic'] : 'and',
1281				'remove_actions': $generalSettings['settings']['remove_actions'] && ($generalSettings['settings']['remove_actions'] == '1') ? true : false,
1282				'filtering_by_variations': $generalSettings['settings']['filtering_by_variations'] && ($generalSettings['settings']['filtering_by_variations'] == '1') ? true : false,
1283				'form_filter_by_variations': $generalSettings['settings']['form_filter_by_variations'] && ($generalSettings['settings']['form_filter_by_variations'] == '1') ? true : false,
1284				'exclude_backorder_variations': $generalSettings['settings']['exclude_backorder_variations'] && ($generalSettings['settings']['exclude_backorder_variations'] == '1') ? true : false,
1285				'display_product_variations': $generalSettings['settings']['display_product_variations'] && ($generalSettings['settings']['display_product_variations'] == '1') ? true : false,
1286				'all_products_filtering': $generalSettings['settings']['all_products_filtering'] && ($generalSettings['settings']['all_products_filtering'] == '1') ? true : false,
1287				'do_not_use_shortcut': $generalSettings['settings']['do_not_use_shortcut'] && ($generalSettings['settings']['do_not_use_shortcut'] == '1') ? true : false,
1288				'use_category_filtration': $generalSettings['settings']['use_category_filtration'] ? $generalSettings['settings']['use_category_filtration'] : 1,
1289				'product_list_selector': $generalSettings['settings']['product_list_selector'] ? $generalSettings['settings']['product_list_selector'] : '',
1290				'product_container_selector': $generalSettings['settings']['product_container_selector'] ? $generalSettings['settings']['product_container_selector'] : '',
1291				'auto_update_filter' : Number($generalSettings['settings']['auto_update_filter']),
1292				'redirect_only_click' : Number($generalSettings['settings']['redirect_only_click']),
1293				'display_status_private' : $generalSettings['settings']['display_status_private'] && ($generalSettings['settings']['display_status_private'] == '1') ? true : false,
1294				'open_one_by_one': $generalSettings['settings']['open_one_by_one'] ? $generalSettings['settings']['open_one_by_one'] : '',
1295				'obo_only_children': $generalSettings['settings']['obo_only_children'] ? $generalSettings['settings']['obo_only_children'] : '',
1296			};
1297			var $withPerPage = $filterWrapper.find('select.wpfPerPageDD'),
1298				perPageCount = $withPerPage.length ? $withPerPage.find('option:selected') : '';
1299			if (perPageCount.length) {
1300				$filterSettings['count_product_shop'] = perPageCount.val();
1301			}
1302				
1303			$filterSettings['sort_by_title'] = ($generalSettings['settings']['sort_by_title'] != undefined && $generalSettings['settings']['sort_by_title'] == '1' ? true : false);
1304			if (typeof $defQuery !== 'undefined' && $defQuery.length) $filterSettings['default_query'] = JSON.parse($defQuery);
1305                        
1306			// find woocommerce product loop type ( shorcode, loop )
1307			var productContainerSelector = _thisObj.fixSelector($filterSettings['product_container_selector'], ''),
1308				productContainerElem = (productContainerSelector !== '')
1309					? jQuery(productContainerSelector)
1310					: jQuery(document);
1311
1312			$queryVars = JSON.parse($queryVars);
1313			var shortcode = jQuery('span[data-shortcode-attribute]', productContainerElem),
1314				$shortcodeAttr = {};
1315
1316			if (shortcode.length) {
1317				$shortcodeAttr = shortcode.data('shortcode-attribute');
1318
1319				if ($shortcodeAttr['limit'] > 0) {
1320					$queryVars['posts_per_page'] = $shortcodeAttr['limit'];
1321				}
1322
1323				$queryVars['wc_loop_type'] = 'shortcode';
1324				$queryVars['paginate_type'] = 'shortcode';
1325				$queryVars['paginate_base'] = 'product-page';
1326			} else {
1327				$queryVars['wc_loop_type'] = 'loop';
1328			}
1329			
1330			// for plugin WooCommerce Products Per Page
1331			var $wppp = jQuery('.wppp-select').first();
1332			if ($wppp.length) {
1333				$queryVars['posts_per_page'] = $wppp.val();
1334			}
1335
1336			$queryVars = JSON.stringify($queryVars);
1337			$shortcodeAttr = JSON.stringify($shortcodeAttr);
1338
1339			if (clearAll) {
1340				var newUrl = getCurrentUrlPartsWpf();
1341				if (newUrl.search.length && newUrl.search.indexOf('wpf_')) clearAll = false;
1342			}
1343
1344			if ($filterSettings['count_product_shop'] > 0 && !clearAll) {
1345				_thisObj.QStringWork('wpf_count', $filterSettings['count_product_shop'], noWooPage, $filterWrapper, 'change');
1346			}
1347			if ($filterSettings['sort_by_title']) {
1348				_thisObj.QStringWork('wpf_order', 'title', noWooPage, $filterWrapper, 'change');
1349			}
1350			if ($filterSettings['filtering_by_variations'] && !clearAll) {
1351				_thisObj.QStringWork('wpf_fbv', 1, noWooPage, $filterWrapper, 'change');
1352			}
1353			if ($filterSettings['exclude_backorder_variations'] && !clearAll) {
1354				_thisObj.QStringWork('wpf_ebv', 1, noWooPage, $filterWrapper, 'change');
1355			}
1356			if ($filterSettings['display_product_variations'] && !clearAll) {
1357				_thisObj.QStringWork('wpf_dpv', 1, noWooPage, $filterWrapper, 'change');
1358			}
1359			if ($filterSettings['all_products_filtering'] && !clearAll) {
1360				_thisObj.QStringWork('all_products_filtering', '1', noWooPage, $filterWrapper, 'change');
1361			}
1362			if ($filtersDataBackend.length === 0) {
1363				_thisObj.QStringWork('all_products_filtering', '', noWooPage, $filterWrapper, 'remove');
1364			}
1365			if ($filterSettings['f_multi_logic'] !== 'and' && !clearAll) {
1366				_thisObj.QStringWork('wpf_filter_tax_block_logic', $filterSettings['f_multi_logic'], noWooPage, $filterWrapper, 'change');
1367			}
1368			if ($filtersDataBackend.length === 0) {
1369				_thisObj.QStringWork('wpf_filter_tax_block_logic', '', noWooPage, $filterWrapper, 'remove');
1370			}
1371			// we always start from first page after filtering
1372			//if ($queryVarsSettings['paginate_type'] == 'query' || $queryVarsSettings['paginate_type'] == 'shortcode') {
1373			_thisObj.QStringWork($queryVarsSettings['paginate_base'], '', noWooPage, $filterWrapper, 'remove');
1374			_thisObj.QStringWork('product-page', '', noWooPage, $filterWrapper, 'remove');
1375			_thisObj.QStringWork('shopPage', '', noWooPage, $filterWrapper, 'remove');
1376			var curUrl = getCurrentUrlPartsWpf();
1377			if (curUrl.search.length) {
1378				var $pages = curUrl.search.match(/query-\d+-page/i);
1379				if ($pages != null && $pages.length) _thisObj.QStringWork($pages[0], '', noWooPage, $filterWrapper, 'remove');
1380			}
1381
1382			var $woocommerceSettings = {};
1383			if (jQuery('.wpfFilterWrapper[data-filter-type="wpfSortBy"]').length == 0) {
1384				var $wooCommerceSort = jQuery('.woocommerce-ordering select');
1385				if ($wooCommerceSort.length > 0) {
1386					$woocommerceSettings['woocommercefSortBy'] = $wooCommerceSort.eq(0).val();
1387				}
1388			}
1389			if (onlyRecalcFilter) {
1390				// this block for forced filter refresh without product filtering
1391				// you can call this with custom js: window.wpfFrontendPage.filtering(jQuery('.wpfMainWrapper[data-filter="1"]'),false,false,true);
1392				var requestData =_thisObj.getAjaxRequestData($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings);
1393				_thisObj.ajaxOnlyRecount(requestData, $filterWrapper.attr('id'));
1394				return;
1395			}
1396			var redirect = (typeof $filterWrapper.data('redirect-page-url') !== 'undefined');
1397
1398			if (history.pushState && app.wpfNewUrl != window.wpfOldUrl && !redirect && !redirectTerm) {
1399				var newUrl = app.wpfNewUrl.indexOf('pr_search_') > 0 ? app.wpfNewUrl.replace('+', '%2b') : app.wpfNewUrl;
1400				history.pushState({state: 1, rand: Math.random(), wpf: true}, '', newUrl);
1401				app.wpfOldUrl = app.wpfNewUrl;
1402				_thisObj.changeSlugByUrl();
1403			}
1404
1405			if (redirectTerm || (redirect && _thisObj.filterClick)) {
1406				let queryString = app.wpfNewUrl.split('?')[1] || '';
1407				if (queryString !== '') {
1408					if (_thisObj.isStatistics) {
1409						var requestData =_thisObj.getAjaxRequestData($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings);
1410						wpfDoActionsAfterLoad(_thisObj.filteringId, -1, requestData);
1411					}
1412					var redLink = (redirectTerm ? redirectLink : $filterWrapper.data('redirect-page-url'));
1413					jQuery(location).attr('href', redLink + (redLink.indexOf('?') == -1 ? '?' : '&') + queryString + '&redirect');
1414				}
1415			} else {
1416				if ($generalSettings && $generalSettings.settings.enable_ajax !== '1') {
1417					if (_thisObj.isStatistics) {
1418						var requestData =_thisObj.getAjaxRequestData($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings);
1419						wpfDoActionsAfterLoad(_thisObj.filteringId, -1, requestData);
1420					}
1421					if (_thisObj.isSafari || navigator.userAgent.match(/firefox|fxios/i)) location.reload(true);
1422					else location.reload();
1423					return;
1424				}
1425
1426				_thisObj.currentFilterBackend = $filtersDataBackend;
1427				// event for custom javascript hook
1428				var customEvent = document.createEvent('Event');
1429				customEvent.initEvent('wpfAjaxStart', false, true);
1430				document.dispatchEvent(customEvent);
1431				//ajax call to server
1432				_thisObj.currentLoadId = $filterWrapper.attr('id');
1433				if ($filterWrapper.closest('.wpfFilterForWtbp').length) {
1434					var wtbpTableId = $filterWrapper.closest('.wtbpTableWrapper').attr('data-table-id'),
1435						wtbpTable = wtbpTableId ? window.woobewoo.WooTablepress.getTableInstanceById(wtbpTableId) : false;
1436					if (wtbpTable && wtbpTable.isSSP) {
1437						wtbpTable.ajax.reload();
1438						return;
1439					}
1440				}
1441				_thisObj.sendFiltersOptionsByAjax(_thisObj.currentFilterBackend, $queryVars, $filterSettings, $generalSettings, $woocommerceSettings, $shortcodeAttr);
1442				if (_thisObj.isSynchro) {
1443					jQuery('.wpfMainWrapper:not(#'+_thisObj.currentLoadId+')').each(function(){
1444						var $synchroWrapper = jQuery(this);
1445
1446						$generalSettings = _thisObj.getFilterMainSettings($synchroWrapper);
1447						var requestData =_thisObj.getAjaxRequestData($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings);
1448
1449						_thisObj.ajaxOnlyRecount(requestData, $synchroWrapper.attr('id'));
1450			
1451					});
1452				}
1453			}
1454		}
1455	});
1456	
1457	WpfFrontendPage.prototype.getAjaxRequestData = (function ($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings) {
1458		$generalSettings = $generalSettings ? $generalSettings['settings']['filters']['order'] : [];
1459		var typeSettings = typeof $generalSettings;
1460		if (typeSettings == 'undefined') $generalSettings = '[]';
1461		else if (typeSettings != 'string') $generalSettings = JSON.stringify($generalSettings);
1462						
1463		return {
1464			mod: 'woofilters',
1465			action: 'filtersFrontend',
1466			filtersDataBackend: JSON.stringify($filtersDataBackend),
1467			queryvars: $queryVars,
1468			filterSettings: JSON.stringify($filterSettings),
1469			generalSettings: $generalSettings,
1470			shortcodeAttr: $shortcodeAttr,
1471			woocommerceSettings: JSON.stringify($woocommerceSettings),
1472			currenturl: window.location.href,
1473		};
1474	});
1475
1476	WpfFrontendPage.prototype.createOverlay = (function (filterId) {
1477		var selector = '#wpfOverlay';
1478		if (typeof filterId != 'undefined') selector += '[data-filter-for="'+filterId+'"]';
1479		jQuery(selector).css({'display':'block'});
1480	});
1481
1482	WpfFrontendPage.prototype.removeOverlay = (function () {
1483		jQuery('#wpfOverlay').css({'display':'none'});
1484		jQuery('#wpfOverlay[data-filter-for]').css({'display':'none'});
1485	});
1486	
1487	WpfFrontendPage.prototype.syncronizeFilters = (function ($filterWrapper) {
1488		var _thisObj = this.$obj,
1489			filterId = $filterWrapper.attr('id');
1490
1491		$filterWrapper.find('.wpfFilterWrapper').each(function () {
1492			var $filter = jQuery(this),
1493				filterType = $filter.attr('data-filter-type'),
1494				filterDisplay = $filter.attr('data-display-type'),
1495				filterSlug = $filter.attr('data-slug'),
1496				filterTaxonomy = $filter.attr('data-taxonomy'),
1497				selector = '.wpfMainWrapper:not(#'+filterId+') .wpfFilterWrapper[data-filter-type="'+filterType+'"]';
1498			if (filterDisplay) selector += '[data-display-type="'+filterDisplay+'"]';
1499			if (filterSlug) selector += '[data-slug="'+filterSlug+'"]';
1500			if (filterTaxonomy) selector += '[data-taxonomy="'+filterTaxonomy+'"]';
1501			var $synchroFilters = jQuery(selector);
1502			if ($synchroFilters.length) {
1503				$synchroFilters.find('input').prop('checked', false).trigger('wpf-synchro');
1504				$filter.find('input:checked').each(function(){
1505					var $li = jQuery(this).closest('[data-term-id]');
1506					if ($li) {
1507						var $synchroInput = $synchroFilters.find('[data-term-id="'+$li.attr('data-term-id')+'"] input');
1508						if ($synchroInput.length == 0 && filterDisplay == 'colors') $synchroInput = $synchroFilters.find('input[data-term-id="'+$li.attr('data-term-id')+'"]');
1509						if ($synchroInput.length) $synchroInput.prop('checked', true).trigger('wpf-synchro');
1510					}
1511				});
1512				if (filterType === 'wpfPrice'){
1513					var min = $filter.find('#wpfMinPrice').val(),
1514						max = $filter.find('#wpfMaxPrice').val();
1515					$synchroFilters.each(function() {
1516						var $slider = jQuery(this);
1517						$slider.find('#wpfMinPrice').val(min);
1518						$slider.find('#wpfMaxPrice').val(max);
1519						//$slider.find('#wpfSliderRange').slider("option", "values", [ min, max ]);
1520					});
1521				} else if (filterDisplay == 'mul_dropdown') {
1522					$synchroFilters.find('select').val($filter.find('select').val());
1523					$synchroFilters.find('select.jqmsLoaded').multiselect('reload');
1524				} else if(filterDisplay == 'text') {
1525					$synchroFilters.find('input').val($filter.find('input').val());
1526				} else {
1527					var value = $filter.find('select').val();
1528					$synchroFilters.find('select').each(function() {
1529						if (jQuery(this).find('option[value="'+value+'"]').length) jQuery(this).val(value);
1530					});
1531				}
1532				
1533				if(typeof(_thisObj.syncronizeFiltersPro) == 'function') {
1534					_thisObj.syncronizeFiltersPro($filter, $synchroFilters);
1535				}
1536					
1537				if ($filter.hasClass('wpfNotActive')) $synchroFilters.addClass('wpfNotActive');
1538				else $synchroFilters.removeClass('wpfNotActive');
1539			}
1540
1541			
1542
1543		});
1544
1545		//_thisObj.markCheckboxSelected(filter);
1546	});
1547
1548	WpfFrontendPage.prototype.clearFilters = (function (filter, clearAll) {
1549		var _thisObj = this.$obj,
1550			noWooPage = _thisObj.noWoo,
1551			clearAll = typeof clearAll == 'undefined' ? false : true;
1552
1553		(filter ? filter : jQuery('.wpfFilterWrapper')).each(function () {
1554			var $filter = jQuery(this),
1555				$filterWrapper = $filter.closest('.wpfMainWrapper'),
1556				filterAttribute = $filter.attr('data-get-attribute'),
1557				filterType = $filter.attr('data-display-type'),
1558				defValue = $filter.attr('data-filter-default');
1559			if (typeof defValue === 'undefined') {
1560				defValue = '';
1561			}
1562
1563			filterAttribute = filterAttribute.split(",");
1564			var count = filterAttribute.length;
1565			for(var i = 0; i < count; i++){
1566				_thisObj.QStringWork(filterAttribute[i], '', noWooPage, $filterWrapper, 'remove');
1567			}
1568
1569			if($filter.hasClass('wpfHidden')){
1570				$filter.removeClass('wpfNotActive');
1571			} else {
1572				$filter.find('input').prop('checked', false);
1573
1574				if(filterType == 'mul_dropdown') {
1575					$filter.find('select').val('');
1576					$filter.find('select.jqmsLoaded').multiselect('reload');
1577				} else if(filterType == 'text') {
1578					$filter.find('input').val('');
1579				} else {
1580					$filter.find("select").val($filter.find("select option:first").val());
1581				}
1582				if (defValue.length && clearAll) {
1583					if(filterType == 'dropdown') {
1584						$filter.find('select').val($filter.find('select option[data-term-slug="'+defValue+'"]').val());
1585					} else {
1586						$filter.find('li[data-term-slug="'+defValue+'"] input').prop('checked', true);
1587					}
1588					$filter.removeClass('wpfNotActive');
1589				} else {
1590					$filter.addClass('wpfNotActive');
1591				}
1592			}
1593
1594			if($filter.attr('data-filter-type') === 'wpfPrice'){
1595				var min = $filter.find('#wpfMinPrice').attr('min'),
1596					max = $filter.find('#wpfMaxPrice').attr('max');
1597				$filter.find('#wpfMinPrice').val(min);
1598				$filter.find('#wpfMaxPrice').val(max);
1599
1600				jQuery( "#wpfSliderRange" ).slider( "option", "values", [ min, max ] );
1601			}
1602
1603			if(typeof(_thisObj.clearFiltersPro) == 'function') {
1604				_thisObj.clearFiltersPro($filter);
1605			}
1606			if(typeof(_thisObj.eventChangeFilterPro) == 'function') {
1607				_thisObj.eventChangeFilterPro($filter);
1608			}
1609			if(clearAll) {
1610				_thisObj.QStringWork('wpf_order', '', noWooPage, $filterWrapper, 'remove');
1611				_thisObj.QStringWork('wpf_count', '', noWooPage, $filterWrapper, 'remove');
1612				_thisObj.QStringWork('all_products_filtering', '', noWooPage, $filterWrapper, 'remove');
1613				_thisObj.QStringWork('wpf_oistock', '', noWooPage, $filterWrapper, 'remove');
1614				_thisObj.QStringWork('wpf_fbv', '', noWooPage, $filterWrapper, 'remove');
1615				_thisObj.QStringWork('wpf_dpv', '', noWooPage, $filterWrapper, 'remove');
1616				_thisObj.QStringWork('wpf_ebv', '', noWooPage, $filterWrapper, 'remove');
1617			}
1618		});
1619
1620		_thisObj.markCheckboxSelected(filter);
1621	});
1622
1623	WpfFrontendPage.prototype.getFilterMainSettings = (function ($selector) {
1624		var settingsStr = $selector.attr('data-filter-settings');
1625		try{
1626			var settings = JSON.parse(settingsStr);
1627		}catch(e){
1628			var settings = false;
1629		}
1630		if (settings === false) {
1631			settingsStr = settingsStr.replace('}]"', '}]').replace('"[{', '[{');
1632			try{
1633				settings = JSON.parse(settingsStr);
1634			}catch(e){
1635				settings = false;
1636			}
1637		}
1638		return settings;
1639	});
1640
1641	WpfFrontendPage.prototype.getFilterParam = (function (paramSlug, mainWrapper, filterWrapper) {
1642		var paramValue = null,
1643			_thisObj = this.$obj,
1644			mainSettings = _thisObj.getFilterMainSettings(mainWrapper),
1645			orderKey = filterWrapper.attr('data-order-key');
1646		if (mainSettings.settings.filters.order && typeof orderKey !== undefined) {
1647			var filtersOderList = JSON.parse(mainSettings.settings.filters.order);
1648			if ( typeof filtersOderList[orderKey] !== undefined ) {
1649				var filterParamList = filtersOderList[orderKey].settings;
1650				if ( typeof filterParamList[paramSlug] !== undefined ) {
1651					paramValue = filterParamList[paramSlug];
1652				}
1653			}
1654		}
1655		return paramValue;
1656	});
1657
1658	WpfFrontendPage.prototype.checkNoWooPage = (function () {
1659		var noWooPage = false;
1660		if(jQuery('.wpfMainWrapper').first().attr('data-nowoo')){
1661			noWooPage = true;
1662		}
1663		return noWooPage;
1664	});
1665	
1666	WpfFrontendPage.prototype.changeLmpButton = (function () {
1667		var lmpBtn = jQuery('.br_lmp_button_settings .lmp_button');
1668		if (lmpBtn.length) {
1669			var parentStyle = lmpBtn.parent().attr('style').replace(' ', '');
1670			if (parentStyle.indexOf('display:none') > -1) {
1671				return;
1672			}
1673			var url = lmpBtn.attr('href').split('?')[0];
1674			url += window.location.search;
1675			url = url.indexOf('/page/2') > -1 ? url : url.replace(/\/page\/[0-9]{1,}/ig, '/page/2');
1676			lmpBtn.attr('href', url);
1677			setTimeout(function(){
1678				jQuery('.woocommerce-pagination').addClass('wpfHidden');
1679			}, 1000);
1680		}
1681	});
1682
1683
1684	WpfFrontendPage.prototype.changeUrlByFilterParams = (function ($filtersDataFrontend) {
1685		var _thisObj = this.$obj,
1686			noWooPage = _thisObj.noWoo;
1687		if (typeof $filtersDataFrontend !== 'undefined' && $filtersDataFrontend.length > 0) {
1688			// the array is defined and has at least one element
1689			var count = $filtersDataFrontend.length,
1690				filterWrapper = jQuery('.wpfMainWrapper'),
1691				priceFlag = true;
1692			for(var i = 0; i < count; i++){
1693				switch ($filtersDataFrontend[i]['id']){
1694					case 'wpfPrice':
1695					case 'wpfPriceRange':
1696						if (priceFlag) {
1697							var minPrice = $filtersDataFrontend[i]['settings']['wpf_min_price'],
1698								maxPrice = $filtersDataFrontend[i]['settings']['wpf_max_price'],
1699								tax = $filtersDataFrontend[i]['settings']['tax'];
1700
1701							if (typeof minPrice !== 'undefined' && minPrice.length > 0) {
1702								_thisObj.QStringWork('wpf_min_price', minPrice, noWooPage, filterWrapper, 'change');
1703							} else {
1704								_thisObj.QStringWork('wpf_min_price', '', noWooPage, filterWrapper, 'remove');
1705							}
1706							if (typeof maxPrice !== 'undefined' && maxPrice.length > 0) {
1707								_thisObj.QStringWork('wpf_max_price', maxPrice, noWooPage, filterWrapper, 'change');
1708							} else {
1709								_thisObj.QStringWork('wpf_max_price', '', noWooPage, filterWrapper, 'remove');
1710							}
1711							if (typeof tax !== 'undefined') {
1712								_thisObj.QStringWork('tax', tax, noWooPage, filterWrapper, 'change');
1713							} else {
1714								_thisObj.QStringWork('tax', '', noWooPage, filterWrapper, 'remove');
1715							}
1716							priceFlag = false;
1717						}
1718						break;
1719					case 'wpfSortBy':
1720						var orderby = $filtersDataFrontend[i]['settings']['orderby'],
1721							oistock = $filtersDataFrontend[i]['settings']['oistock'];
1722						if (typeof orderby !== 'undefined' && orderby.length > 0 ) {
1723							_thisObj.QStringWork('orderby', orderby, noWooPage, filterWrapper, 'change');
1724						}else{
1725							_thisObj.QStringWork('orderby', '', noWooPage, filterWrapper, 'remove');
1726						}
1727						if (typeof oistock !== 'undefined' && oistock == 1 ) {
1728							_thisObj.QStringWork('wpf_oistock', 1, noWooPage, filterWrapper, 'change');
1729						}else{
1730							_thisObj.QStringWork('wpf_oistock', '', noWooPage, filterWrapper, 'remove');
1731						}
1732						break;
1733					case 'wpfCategory':
1734					case 'wpfPerfectBrand':
1735						var product_cat = $filtersDataFrontend[i]['settings']['settings'],
1736							name = $filtersDataFrontend[i]['name'],
1737							delim = $filtersDataFrontend[i]['delim'];
1738						product_cat = product_cat.join(delim ? delim : '|');
1739						if (typeof product_cat !== 'undefined' && product_cat.length > 0) {
1740							_thisObj.QStringWork(name, product_cat, noWooPage, filterWrapper, 'change');
1741						}else{
1742							_thisObj.QStringWork(name, '', noWooPage, filterWrapper, 'remove');
1743						}
1744						break;
1745					case 'wpfTags':
1746						var product_tag = $filtersDataFrontend[i]['settings']['settings'],
1747							name = $filtersDataFrontend[i]['name'],
1748							delim = $filtersDataFrontend[i]['delim'];
1749						product_tag = product_tag.join(delim ? delim : '|');
1750						if (typeof product_tag !== 'undefined' && product_tag.length > 0) {
1751							_thisObj.QStringWork(name, product_tag, noWooPage, filterWrapper, 'change');
1752						}else{
1753							_thisObj.QStringWork(name, '', noWooPage, filterWrapper, 'remove');
1754						}
1755						break;
1756					case 'wpfAttribute':
1757						var product_taxonomy = $filtersDataFrontend[i]['settings']['taxonomy'],
1758							product_attr = $filtersDataFrontend[i]['settings']['settings'],
1759							delim = $filtersDataFrontend[i]['delim'];
1760						product_attr = product_attr.join(delim ? delim : '|');
1761						if (typeof product_attr !== 'undefined' && product_attr.length > 0) {
1762							_thisObj.QStringWork(product_taxonomy, product_attr, noWooPage, filterWrapper, 'change');
1763						}else{
1764							_thisObj.QStringWork(product_taxonomy, '', noWooPage, filterWrapper, 'remove');
1765						}
1766
1767						if (typeof $filtersDataFrontend[i]['idBlock']!== 'undefined' && typeof $filtersDataFrontend[i]['idFilter']!== 'undefined' ) {
1768							_thisObj.QStringWork('group' + product_taxonomy.replace('filter', '') + $filtersDataFrontend[i]['idBlock'], $filtersDataFrontend[i]['idFilter'], noWooPage, filterWrapper, 'change');
1769						}
1770						break;
1771					case 'wpfAuthor':
1772						var authorVal = $filtersDataFrontend[i]['settings']['settings'],
1773							name = $filtersDataFrontend[i]['name'],
1774							delim = $filtersDataFrontend[i]['delim'];
1775							authorVal = authorVal.join(delim ? delim : '|');
1776						if (typeof authorVal !== 'undefined' && authorVal.length > 0) {
1777							_thisObj.QStringWork('pr_author', authorVal, noWooPage, filterWrapper, 'change');
1778						}else{
1779							_thisObj.QStringWork('pr_author', '', noWooPage, filterWrapper, 'remove');
1780						}
1781						break;
1782					case 'wpfFeatured':
1783						var featureVal = $filtersDataFrontend[i]['settings']['settings'];
1784						if (typeof featureVal !== 'undefined' && featureVal.length > 0) {
1785							_thisObj.QStringWork('pr_featured', featureVal, noWooPage, filterWrapper, 'change');
1786						}else{
1787							_thisObj.QStringWork('pr_featured', '', noWooPage, filterWrapper, 'remove');
1788						}
1789						break;
1790					case 'wpfOnSale':
1791						var onSaleVal = $filtersDataFrontend[i]['settings']['settings'];
1792						if (typeof onSaleVal !== 'undefined' && onSaleVal.length > 0) {
1793							_thisObj.QStringWork('pr_onsale', onSaleVal, noWooPage, filterWrapper, 'change');
1794						}else{
1795							_thisObj.QStringWork('pr_onsale', '', noWooPage, filterWrapper, 'remove');
1796						}
1797						break;
1798					case 'wpfInStock':
1799						var pr_stock = $filtersDataFrontend[i]['settings']['settings'];
1800						pr_stock = pr_stock.join(delim ? delim : '|');
1801						if (typeof pr_stock !== 'undefined' && pr_stock.length > 0 ) {
1802							_thisObj.QStringWork('pr_stock', pr_stock, noWooPage, filterWrapper, 'change');
1803						}else{
1804							_thisObj.QStringWork('pr_stock', '', noWooPage, filterWrapper, 'remove');
1805						}
1806						break;
1807					case 'wpfRating':
1808						var ratingVal = $filtersDataFrontend[i]['settings']['settings'];
1809						if (typeof ratingVal !== 'undefined' && checkArray(ratingVal) && ratingVal.length > 0 ) {
1810							_thisObj.QStringWork('pr_rating', ratingVal, noWooPage, filterWrapper, 'change');
1811						}else{
1812							_thisObj.QStringWork('pr_rating', '', noWooPage, filterWrapper, 'remove');
1813						}
1814						break;
1815					default:
1816						if(typeof(_thisObj.changeUrlByFilterParamsPro) == 'function') {
1817							_thisObj.changeUrlByFilterParamsPro($filtersDataFrontend[i], noWooPage, filterWrapper);
1818						}
1819						break;
1820				}
1821			}
1822		}else{
1823			return false;
1824		}
1825
1826	});
1827
1828	WpfFrontendPage.prototype.changeSlugByUrl = (function () {
1829		jQuery('.wpfSlugWrapper .wpfSlug').remove();
1830		var _thisObj = this.$obj,
1831			noWooPage = _thisObj.noWoo;
1832		if(noWooPage){
1833			if( jQuery('.wpfMainWrapper').first().attr('data-hide-url')){
1834				var searchParams =  jQuery.toQueryParams(jQuery('.wpfMainWrapper').first().attr('data-hide-url'));
1835			}
1836		}else{
1837			var searchParams = jQuery.toQueryParams(window.location.search);
1838		}
1839
1840		for (var key in searchParams) {
1841			if(key === 'wpf_min_price'){
1842				key = 'wpf_min_price,wpf_max_price,tax';
1843			}
1844
1845			if(jQuery('.wpfFilterWrapper[data-get-attribute="'+key+'"]').length > 0){
1846				var elem = jQuery('.wpfFilterWrapper[data-get-attribute="'+key+'"]').first(),
1847					$slug = elem.attr('data-slug'),
1848					$label = elem.attr('data-label'),
1849					$title = elem.attr('data-title'),
1850					$getAttr = elem.attr('data-get-attribute'),
1851					$filterType = elem.attr('data-filter-type');
1852				if(typeof $title != 'undefined') $label = $title;
1853				else if(typeof $label == 'undefined') $label = $slug;
1854
1855				var html = '';
1856				if(jQuery('.wpfSlugWrapper').length > 0){
1857					if( !jQuery('.wpfSlugWrapper .wpfSlug[data-slug="'+$slug+'"]').length > 0 ) {
1858						html += '<div class="wpfSlug" data-slug="'+$slug+'" data-get-attribute="'+$getAttr+'" data-filter-type="'+$filterType+'"><div class="wpfSlugTitle">'+$label+'</div><div class="wpfSlugDelete">x</div></div>';
1859						jQuery('.wpfSlugWrapper').append(html);
1860					}
1861				}else{
1862					if( !jQuery('.wpfSlugWrapper .wpfSlug[data-slug="'+$slug+'"]').length > 0 ) {
1863						html += '<div class="wpfSlugWrapper">';
1864						html += '<div class="wpfSlug" data-slug="'+$slug+'" data-get-attribute="'+$getAttr+'" data-filter-type="'+$filterType+'"><div class="wpfSlugTitle">'+$label+'</div><div class="wpfSlugDelete">x</div></div>';
1865						html += '</div>';
1866						jQuery('.storefront-sorting').append(html);
1867					}
1868				}
1869			}
1870		}
1871
1872	});
1873
1874	WpfFrontendPage.prototype.sendFiltersOptionsByAjax = (function ($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $woocommerceSettings, $shortcodeAttr) {
1875		var _thisObj = this.$obj,
1876			$wrapperSettings = [];
1877		if ( window.wpfAdminPage ) {
1878			return false;
1879		}
1880		_thisObj.currentAjaxJSLoaded = false;
1881		_thisObj.currentProductBlock = false;
1882
1883		if (_thisObj.filterLoadTypes[_thisObj.currentLoadId] && _thisObj.filterLoadTypes[_thisObj.currentLoadId] == 'reload') {
1884			location.reload();
1885			return;
1886		}
1887		var ajax_leave_products = $generalSettings && $generalSettings['settings'] && $generalSettings['settings']['ajax_leave_products'] == '1'
1888		
1889		if (typeof $generalSettings !== 'undefined') {
1890			$wrapperSettings = $generalSettings['settings'];
1891		}
1892		
1893		var customListSelector = $filterSettings['product_list_selector'],
1894			productListSelector = _thisObj.fixSelector(customListSelector, _thisObj.defaultProductSelector),
1895			productContainerSelector = _thisObj.fixSelector($filterSettings['product_container_selector'], ''),
1896			forceThemeTemplates = ($wrapperSettings['force_theme_templates'] == 1);
1897
1898		var productContainerElem = (productContainerSelector !== '')
1899			? jQuery(productContainerSelector)
1900			: jQuery(document);
1901
1902		if (productContainerElem.length === 0) {
1903			location.reload();
1904			return;
1905		}
1906
1907		var productListElem = jQuery(productListSelector, productContainerElem);
1908		if (productListElem.hasClass('wpfNoWooPage') || productListElem.closest('.wpfNoWooPage').length) {
1909			forceThemeTemplates = false;
1910		}
1911
1912		if (productListElem.length && (_thisObj.filterClick)) {
1913			if (_thisObj.enableFiltersLoaderPro && ajax_leave_products) {
1914				_thisObj.enableFiltersLoaderPro(_thisObj.currentLoadId, productListElem);
1915			} else {
1916				_thisObj.enableFiltersLoader(_thisObj.currentLoadId, productListElem);
1917			}
1918		}
1919
1920		var onlyRecount = false;
1921		if ($filterSettings === undefined) {
1922			$filterSettings = [];
1923		} else {
1924			if (!_thisObj.filterClick && $filterSettings.auto_update_filter && !$filterSettings.redirect_only_click) {
1925				onlyRecount = true;
1926			}
1927		}
1928		
1929		var requestData =_thisObj.getAjaxRequestData($filtersDataBackend, $queryVars, $filterSettings, $generalSettings, $shortcodeAttr, $woocommerceSettings);
1930
1931		if (onlyRecount) {
1932			_thisObj.ajaxOnlyRecount(requestData, _thisObj.currentLoadId, $wrapperSettings);
1933			return;
1934		} else if (forceThemeTemplates || _thisObj.filterLoadTypes[_thisObj.currentLoadId] == 'force') {
1935			_thisObj.ajaxForceThemeTemplates(productContainerSelector, productListSelector, requestData, $wrapperSettings);
1936			return;
1937		}
1938
1939		/**
1940		 * There are some cases when we do not provide ajax functionlity
1941		 */
1942		if ( window.InfiniteScroll && window.InfiniteScroll.prototype ) {
1943			/**
1944			 * Flatsome theme compability
1945			 * We do not privide ajax functionlity with infinite scroll
1946			 *
1947			 * @link https://themeforest.net/item/flatsome-multipurpose-responsive-woocommerce-theme/5484319
1948			 */
1949			if (_thisObj.filterClick && jQuery('body').hasClass('theme-flatsome')) {
1950				location.reload();
1951				return;
1952			}
1953		}
1954		_thisObj.filterLoadTypes[_thisObj.currentLoadId] = 'ajax';
1955
1956		jQuery.sendFormWpf({
1957			data: requestData,
1958			onSuccess: function(res) {
1959				if (!res.error) {
1960					if ('fid' in res.data && toeInArray(res.data['fid'], _thisObj.lastFids) == -1) {
1961						return false;
1962					}
1963					if ('jscript' in res.data) {
1964						_thisObj.setAjaxJScript(res.data['jscript']);
1965					}
1966					if (_thisObj.filterClick) {
1967						if (customListSelector !== '' && productListElem.length) {
1968							var loopContainer = productListElem;
1969							loopContainer.html(res.data['productHtml']);
1970						} else {
1971							var catSelector = wpfGetSelector(res.data['categoryHtml'], true, _thisObj.defaultProductSelector, 1, false, productContainerElem),
1972								loopSelector = wpfGetSelector(res.data['loopStartHtml'], true, _thisObj.defaultProductSelector, 3, false, productContainerElem),
1973								loopContainer = jQuery(loopSelector, productContainerElem);
1974
1975							if (!loopContainer.length) {
1976								// trying to obtain loop container without dynamically change classes with numbers in it names
1977								loopSelector = wpfGetSelector(res.data['loopStartHtml'], true, _thisObj.defaultProductSelector, 3, true, productContainerElem);
1978								loopContainer = jQuery(loopSelector, productContainerElem);
1979							}
1980
1981							loopContainer.prev('.brand-description').remove();
1982							if (typeof res.data['beforeProductHtml'] !== 'undefined') {
1983								loopContainer.before('<div class="brand-description">' + res.data['beforeProductHtml'] + '</div>');
1984							}
1985							if (typeof jQuery('.product-categories-wrapper', productContainerElem) !== 'undefined' && jQuery('.product-categories-wrapper > ul.products', productContainerElem).length > 0) {
1986								//replace cats html
1987								if (res.data['categoryHtml'].length) {
1988									jQuery('.product-categories-wrapper > ul.products', productContainerElem).html(res.data['categoryHtml']);
1989								}
1990								//replace products html
1991								jQuery(_thisObj.defaultProductSelector, productContainerElem).eq(1).html(res.data['productHtml']);
1992							} else if (jQuery('.elementor-widget-container ul.products', productContainerElem).length > 0) {
1993								jQuery('.elementor-widget-container ul.products', productContainerElem).each(function () {
1994									if (!jQuery(this).find('.product-category').length) {
1995										jQuery(this).html(res.data['categoryHtml'] + res.data['productHtml']);
1996									}
1997								});
1998							} else if (jQuery('.woocommerce > .products[data-filterargs][data-innerargs]', productContainerElem).length > 0) {
1999								jQuery('.woocommerce > .products[data-filterargs][data-innerargs]', productContainerElem).html(res.data['categoryHtml'] + res.data['productHtml']);
2000							} else {
2001								if (!loopContainer.length) {
2002									if (!jQuery('.wpfMainWrapper', productContainerElem).attr('data-nowoo') !== typeof undefined
2003										&& !jQuery('.wpfMainWrapper', productContainerElem).attr('data-nowoo') !== false)
2004										_thisObj.ajaxForceThemeTemplates(productContainerSelector, productListSelector, requestData, $wrapperSettings);
2005									else {
2006										location.reload(true);
2007									}
2008									_thisObj.afterAjaxFiltering($wrapperSettings);
2009									return false;
2010								}
2011
2012								loopContainer.each(function () {
2013									//replace cats html
2014									jQuery(this).html(res.data['categoryHtml']);
2015									//replace products html
2016									jQuery(this).append(res.data['productHtml']);
2017								});
2018							}
2019						}
2020
2021						var countSelector = wpfGetSelector(res.data['resultCountHtml'], true, '.woocommerce-result-count', 1, false, productContainerElem),
2022							wooCount = jQuery(countSelector, productContainerElem);
2023						if (wooCount.length > 0) {
2024							wooCount.replaceWith(res.data['resultCountHtml']);
2025						}
2026
2027						var isLeerPagination = res.data['paginationHtml'] == '',
2028							paginationSelector = wpfGetSelector(res.data[isLeerPagination ? 'paginationLeerHtml' : 'paginationHtml'], false, '.woocommerce-pagination', 1, false, productContainerElem),
2029							wooPagination = jQuery(paginationSelector, productContainerElem),
2030							newPagination = res.data['paginationHtml'];
2031
2032						if (wooPagination.length > 0) {
2033							if (typeof _thisObj.paginationClasses == 'undefined') {
2034								_thisObj.paginationClasses = wooPagination.attr('class');
2035							}
2036							if (isLeerPagination) {
2037								wooPagination.css({'display': 'none'});
2038								wooPagination.empty();
2039							} else {
2040								wooPagination.replaceWith(newPagination);
2041							}
2042						} else if (!isLeerPagination) {
2043							var afterLoop = jQuery('.after-shop-loop', productContainerElem);
2044							if (afterLoop.length > 0) {
2045								afterLoop.prepend(newPagination);
2046							} else {
2047								wooCount = jQuery('.storefront-sorting ' + countSelector, productContainerElem);
2048								if (wooCount.length > 0) {
2049									wooCount.after(newPagination);
2050								} else {
2051									let shortcodeData = productContainerElem.find('span[data-shortcode-attribute]'),
2052										isPaginate = shortcodeData.length ? shortcodeData.data('shortcode-attribute').paginate : true;
2053									if (typeof isPaginate === 'undefined' || isPaginate) {
2054										loopContainer.eq(0).after(newPagination);
2055									}
2056								}
2057							}
2058						}
2059						if (typeof _thisObj.paginationClasses != 'undefined') {
2060							jQuery(paginationSelector, productContainerElem).attr('class', _thisObj.paginationClasses);
2061						}
2062						_thisObj.currentProductBlock = loopContainer.selector;
2063						if (!_thisObj.currentProductBlock) {
2064							loopContainer.addClass('wpfCurrentProductBlock');
2065							_thisObj.currentProductBlock = '.wpfCurrentProductBlock';
2066						}
2067					}
2068					_thisObj.afterAjaxFiltering($wrapperSettings);
2069					jQuery('.wpfLoaderLayout').hide();
2070				}
2071			}
2072		});
2073	});
2074
2075	WpfFrontendPage.prototype.ajaxForceThemeTemplates = (function (productContainerSelector, productListSelector, requestData, $wrapperSettings) {
2076		var _thisObj = this.$obj,
2077			curUrl = window.location.href,
2078			isContainer = (productContainerSelector != '');
2079
2080		_thisObj.filterLoadTypes[_thisObj.currentLoadId] = 'force';
2081		if ($wrapperSettings.recalculate_filters !== '1') {
2082			_thisObj.ajaxOnlyRecount(requestData);
2083		}
2084		jQuery.ajax({
2085			type: "GET",
2086			url: curUrl + (curUrl.indexOf('?') == -1 ? '?' : '&') + 'wpf_skip=1&wpf_fid=' + _thisObj.filteringId,
2087			cache: false,
2088			dataType: 'html',
2089			success: function(data){
2090				var block = '',
2091					foundContainer = false,
2092					noProducts = false,
2093					$loadedData = jQuery(data),
2094					$loadedJS = $loadedData.find('.wpfExistsTermsJS');
2095				if ($loadedJS.length) {
2096					if (toeInArray($loadedJS.eq(0).attr('data-fid'), _thisObj.lastFids) == -1) {
2097						return false;
2098					}
2099				}
2100				
2101				if (isContainer) {
2102					block = jQuery(data).find(productContainerSelector);
2103				}
2104				if (block.length) {
2105					foundContainer = true;
2106				} else {
2107					block = jQuery(data).find(productListSelector);
2108				}
2109				var pageBlock = jQuery(isContainer && (foundContainer || block.length == 0) ? productContainerSelector : productListSelector);
2110				if (block.length == 0 || pageBlock.length == 0) {
2111					if ($wrapperSettings.recalculate_filters === '1') {
2112						var existsTermsJS = jQuery(data).find('.wpfExistsTermsJS').html();
2113						_thisObj.setAjaxJScript(existsTermsJS);
2114					}
2115					if ($wrapperSettings.no_redirect_by_no_products === '1' && pageBlock.length > 0) {
2116						block = jQuery('<div><div class="wpfNoProducts">' + $wrapperSettings.text_no_products + '</div></div>');
2117						noProducts = true;
2118					} else {
2119						_thisObj.filterLoadTypes[_thisObj.currentLoadId] = 'reload';
2120						location.reload();
2121						return;
2122					}
2123				}
2124				_thisObj.currentProductBlock = (typeof pageBlock.selector !== 'undefined') ? pageBlock.selector : productListSelector ;
2125
2126				block.each(function (index, value) {
2127					var blockWhere = pageBlock.eq(index),
2128						blockWhat = jQuery(value);
2129
2130					if (!foundContainer && !noProducts) {
2131						blockWhere = blockWhere.parent();
2132						blockWhat = blockWhat.parent();
2133					}
2134					// some plugins save url parameters in input fields
2135					blockWhat.find('input[name="wpf_skip"]').remove();
2136		
2137					blockWhere.html(blockWhat.html().replace(/wpf_skip=1/g, '').replace(/wpf_fid=[0-9]*/g, '').replace(/&amp;&amp;/g, '&amp;'));
2138
2139					// if pagination is not in the block to be replaced, we will try to find and replace it
2140					var paginationPageBlock = jQuery(blockWhere).find('.woocommerce-pagination');
2141					if (!paginationPageBlock.length) {
2142						var paginationPage = jQuery('.woocommerce-pagination');
2143						var paginationResponse = jQuery(data).find('.woocommerce-pagination');
2144						if (paginationResponse.length) {
2145							paginationResponse = paginationResponse.eq(0).html().replace(/wpf_skip=1/g, '').replace(/wpf_fid=[0-9]*/g, '').replace(/&amp;&amp;/g, '&amp;');
2146							if (paginationPage.length) {
2147								paginationPage.html(paginationResponse);
2148							} else {
2149								jQuery(blockWhere).parent().after('<nav class="woocommerce-pagination">' + paginationResponse + '</nav>');
2150							}
2151						} else if (paginationPage.length) {
2152							paginationPage.remove();
2153						}
2154					}
2155
2156					// if result count is not in the block to be replaced, we will try to find and replace it
2157					var resultCountBlock = jQuery(blockWhere).find('.woocommerce-result-count');
2158					var resultCountResponse = jQuery(data).find('.woocommerce-result-count');
2159					if (!resultCountBlock.length && resultCountResponse.length) {
2160						var resultCount = jQuery('.woocommerce-result-count');
2161						if (resultCount.length) {
2162							resultCount.replaceWith(resultCountResponse);
2163						}
2164					}
2165				});
2166				// for Divi archive loop
2167				var $styleObj = jQuery('style[id^="et-builder-module-design-"]');
2168				if ($styleObj.length == 1) {
2169					var $styleObjLoaded = $loadedData.find('style[id^="et-builder-module-design-"]');
2170					if ($styleObjLoaded.length == 0) $styleObjLoaded = $loadedData.filter('style[id^="et-builder-module-design-"]');
2171					if ($styleObjLoaded.length == 1) $styleObj.html($styleObjLoaded.html());
2172				}
2173
2174				_thisObj.afterAjaxFiltering($wrapperSettings);
2175				_thisObj.runReadyList();
2176				if ($wrapperSettings.recalculate_filters === '1') {
2177					var existsTermsJS = jQuery(data).find('.wpfExistsTermsJS').html();
2178					_thisObj.setAjaxJScript(existsTermsJS);
2179				}
2180
2181    		}
2182		});
2183
2184		return false;
2185	});
2186
2187	WpfFrontendPage.prototype.ajaxOnlyRecount = (function (requestData, filterId, $wrapperSettings) {
2188		var _thisObj = this.$obj;
2189
2190		if (!_thisObj.currentAjaxJSLoaded && requestData) {
2191			requestData['only_recound'] = 1;
2192
2193			if (typeof filterId !==  'undefined') {
2194				requestData['synchro_filter_id'] = filterId;
2195			}
2196
2197			jQuery.sendFormWpf({
2198				data: requestData,
2199				onSuccess: function (res) {
2200
2201					if (typeof $wrapperSettings !== 'undefined'
2202						&& typeof $wrapperSettings.filter_loader_icon_onload_enable !== 'undefined'
2203						&& Number($wrapperSettings.filter_loader_icon_onload_enable)) {
2204						hideFilterLoader(jQuery('#' + filterId));
2205					}
2206
2207					if (!res.error) {
2208
2209						if ('jscript' in res.data) {
2210							_thisObj.setAjaxJScript(res.data['jscript'], filterId);
2211						}
2212
2213					}
2214					_thisObj.removeOverlay();
2215				}
2216			});
2217		}
2218
2219	});
2220
2221	WpfFrontendPage.prototype.setAjaxJScript = (function(jscript, filterId){
2222		var _thisObj = this.$obj,
2223			filter = jQuery('#' + (typeof(filterId) == 'undefined' ? _thisObj.currentLoadId : filterId));
2224		if (filter.length && jscript != '') {
2225			var jsBlock = filter.find('.wpfAjaxJSBlock');
2226			if (jsBlock.length == 0) {
2227				jQuery('<div class="wpfAjaxJSBlock wpfHidden"></div>').appendTo(filter);
2228			}
2229			filter.find('.wpfAjaxJSBlock').html(jscript);
2230		}
2231		_thisObj.currentAjaxJSLoaded = true;
2232	});
2233	WpfFrontendPage.prototype.afterAjaxFiltering = (function($wrapperSettings){
2234		var _thisObj = this.$obj;
2235		
2236		//if changed min/max price and we have wpfPrice filter
2237		//we need change slider
2238		_thisObj.getUrlParamsChangeFiltersValues();
2239
2240		_thisObj.disableFiltersLoader();
2241		_thisObj.removeOverlay();
2242		toggleClear();
2243
2244		// fix for OceanWP theme
2245		if ( jQuery('body').find('.products').hasClass('oceanwp-row') ) {
2246			var products = jQuery('body').find('.products'),
2247				aligns = ['center', 'left', 'right'];
2248			products.find('li:first').addClass('col');
2249			for (var i = 1; i <= 7; i++) {
2250				if (products.find('li').hasClass('span_1_of_' + i)) {
2251					products.find('li:first').addClass('span_1_of_' + i);
2252					break;
2253				}
2254			}
2255			for (var j = 0; j < aligns.length; j++) {
2256    			if (products.find('li').hasClass('owp-content-' + aligns[j])) {
2257					products.find('li:first').addClass('owp-content-' + aligns[j]);
2258					break;
2259				}
2260			}
2261		}
2262					
2263		_thisObj.changeLmpButton();
2264		
2265		// for yith quick view
2266		jQuery(document).trigger('yith_wcqv_wcajaxnav_update');
2267
2268		if (typeof (_thisObj.scrollToProductsPro) == 'function') {
2269			_thisObj.scrollToProductsPro($wrapperSettings);
2270		}
2271		
2272		if (jQuery(_thisObj.defaultProductSelector).closest('.et_pb_shop').length && jQuery(_thisObj.defaultProductSelector).find('[loading="lazy"]').length == 0) {
2273			heightIdenticalInRow('.et_pb_shop li.product');
2274		}
2275		
2276		// Improve compatibility with 'Woocommerce Products Per Page'
2277		jQuery('.form-wppp-select').each( function () {
2278			var $form = jQuery(this);
2279			$form.attr('action', jQuery('#'+_thisObj.currentLoadId).attr('data-hide-url'));
2280			$form.find('input[type="hidden"]').remove();
2281		});
2282
2283		// event for custom javascript hook, example: document.addEventListener('wpfAjaxSuccess', function(event) {console.log('Custom js');});
2284		//document.dispatchEvent(new Event('wpfAjaxSuccess')); - not work in IE11
2285		var customEvent = document.createEvent('Event');
2286		customEvent.initEvent('wpfAjaxSuccess', false, true); 
2287		document.dispatchEvent(customEvent);
2288	});
2289
2290	WpfFrontendPage.prototype.runReadyList = (function(){
2291		if (window.readyList && readyList.length) {
2292			var _thisObj = this.$obj;
2293			if (_thisObj.disableScrollJs) {
2294				jQuery(window).off("yith_infs_start").off("scroll touchstart");
2295				if (typeof(jQuery.fn) == 'object' && typeof(jQuery.fn.init_infinitescroll) == 'function') {
2296					jQuery.fn.init_infinitescroll();
2297				}
2298			}
2299			jQuery(window.readyList).each(function(i, el) {
2300				var strFunc = el['a'][0].toString();
2301				if (strFunc.indexOf('WpfFrontendPage') == -1) {
2302					for(var i = 0; i < _thisObj.readyFuncs.length; i++) {
2303						if (strFunc.indexOf(_thisObj.readyFuncs[i]) != -1 && (strFunc.indexOf('.ajaxComplete(') == -1 || i == 3 || i == 4)) {
2304							try {
2305								window.originalReadyMethod.apply(el['c'], el['a']);
2306							} catch(e) {
2307								console.log(e);
2308							}
2309							break;
2310						}
2311					}
2312				}
2313			});
2314		}
2315		jQuery(window).trigger("fusion-element-render-fusion_woo_product_grid");
2316		var fusionPrInfinite = jQuery(".fusion-products-container-infinite");
2317		if (fusionPrInfinite.length && typeof(fusionPrInfinite.infinitescroll) == 'function') {
2318			fusionPrInfinite.infinitescroll('unbind');
2319			fusionPrInfinite.infinitescroll('bind');
2320		}
2321		
2322		var $eaPagination = jQuery('.elementor-widget-eicon-woocommerce');
2323		if ($eaPagination.length && window.elementorFrontend && window.elementorFrontend.hooks) {
2324			window.elementorFrontend.hooks.doAction('frontend/element_ready/eicon-woocommerce.default', $eaPagination, jQuery);
2325		}
2326		
2327		// AVADA infinitescroll
2328		if (jQuery('.fusion-grid-container-infinite').length == 1) {
2329			jQuery(document).trigger('fusion-element-render-fusion_post_cards');
2330			jQuery('.fusion-grid-container-infinite').infinitescroll('unbind');
2331			jQuery('.fusion-grid-container-infinite').infinitescroll('bind');
2332		}
2333	});
2334
2335	/*WpfFrontendPage.prototype.runReadyList = (function(){
2336		if (window.readyList && window.readyList.length) {
2337			
2338			jQuery(window.readyList).each(function(i, el) {
2339				var strFunc = el['a'][0].toString();
2340				if (strFunc.indexOf('WpfFrontendPage') == -1 && strFunc.indexOf('.ajaxComplete(') == -1) {
2341					try {
2342						window.originalReadyMethod.apply(el['c'], el['a']);
2343					} catch(e) {
2344						console.log(e);
2345					}
2346				}
2347			});
2348		}
2349	});*/
2350
2351	WpfFrontendPage.prototype.enableFiltersLoader = (function(idWrapper, productListElem){
2352		var preview = jQuery('#' + idWrapper + ' .wpfPreviewLoader').first().clone().removeClass('wpfHidden');
2353		productListElem.html(preview);
2354	});
2355
2356	WpfFrontendPage.prototype.disableFiltersLoader =(function(){
2357		jQuery('.wpfPreviewLoader').first().clone().addClass('wpfHidden');
2358	});
2359
2360	//after load change price and price range filters params if find get params
2361	WpfFrontendPage.prototype.getUrlParamsChangeFiltersValues = (function(){
2362		var _thisObj = this.$obj,
2363			noWooPage = _thisObj.noWoo;
2364		if(noWooPage){
2365			var curUrl = jQuery('.wpfMainWrapper').first().attr('data-hide-url');
2366		}else{
2367			var curUrl = window.location.href;
2368		}
2369		if(!curUrl){
2370			return;
2371		}
2372		//get all get params
2373		var urlParams = _thisObj.findGetParameter(curUrl);
2374		jQuery('.wpfFilterWrapper').each(function () {
2375			var $filter = jQuery(this),
2376				filterType = $filter.attr('data-filter-type'),
2377				settings = _thisObj.getFilterMainSettings($filter.closest('.wpfMainWrapper'));
2378
2379			switch(filterType){
2380				case 'wpfAttribute':
2381					if(typeof(_thisObj.eventChangeFilterPro) == 'function') {
2382						_thisObj.eventChangeFilterPro($filter, settings);
2383					}
2384					break;
2385				case 'wpfPrice':
2386					var rate = $filter.data('rate');
2387					urlParams = _thisObj.getConvertedPrices(urlParams, rate);
2388					var minPrice = urlParams.wpf_min_price ? urlParams.wpf_min_price : $filter.attr('data-minvalue'),
2389						maxPrice = urlParams.wpf_max_price ? urlParams.wpf_max_price : $filter.attr('data-maxvalue'),
2390						skin = 'default';
2391
2392					if(minPrice){
2393						$filter.find('#wpfMinPrice').val(minPrice);
2394					}
2395					if(maxPrice){
2396						$filter.find('#wpfMaxPrice').val(maxPrice);
2397					}
2398					if(settings){
2399						skin = $filter.attr('data-price-skin');
2400					}
2401					if(skin === 'default'){
2402						var sliderWrapper = $filter.find("#wpfSliderRange");
2403					}else{
2404						var sliderCurBefore = ($filter.attr('data-slider-currency-before') != undefined) ? $filter.attr('data-slider-currency-before') : '';
2405						var sliderCurAfter = ($filter.attr('data-slider-currency-after') != undefined) ? $filter.attr('data-slider-currency-after') : '';
2406						var sliderWrapper = $filter.find('.ion-range-slider').data('ionRangeSlider');
2407						$filter.addClass('wpfNotActiveSlider');
2408						
2409						if (sliderCurBefore || sliderCurAfter) {
2410							setTimeout(function()
2411							{
2412								$filter.find('span.irs-min:first').html(sliderCurBefore + sliderWrapper['result'].min_pretty + sliderCurAfter);
2413								$filter.find('span.irs-max:first').html(sliderCurBefore + sliderWrapper['result'].max_pretty + sliderCurAfter);
2414								$filter.find('span.irs-from:first').html(sliderCurBefore + sliderWrapper['result'].from_pretty + sliderCurAfter);
2415								$filter.find('span.irs-to:first').html(sliderCurBefore + sliderWrapper['result'].to_pretty + sliderCurAfter);
2416							}, 500);
2417						}
2418					}
2419					if(minPrice && maxPrice){
2420						if(skin === 'default'){
2421							sliderWrapper.slider({
2422								values: [minPrice, maxPrice]
2423							});
2424						}else if(typeof(sliderWrapper) != 'undefined') {
2425							sliderWrapper.update({from: minPrice, to: maxPrice});
2426							$filter.removeClass('wpfNotActiveSlider');
2427						}
2428					}
2429					_thisObj.chageRangeFieldWidth();
2430					if(typeof(_thisObj.eventChangeFilterPro) == 'function') {
2431						_thisObj.eventChangeFilterPro($filter, settings);
2432					}
2433					break;
2434				case 'wpfPriceRange':
2435					var rate = $filter.data('rate');
2436					urlParams = _thisObj.getConvertedPrices(urlParams, rate);
2437					var minPrice = urlParams.wpf_min_price ? parseFloat(urlParams.wpf_min_price) : false,
2438						maxPrice = urlParams.wpf_max_price ? parseFloat(urlParams.wpf_max_price) : false,
2439						$options = $filter.find('li');
2440					$options.find('input[type="checkbox"]').prop('checked', false);
2441					$options.each(function () {
2442						var _this = jQuery(this),
2443							range = _this.attr('data-range');
2444						if(typeof range != 'undefined') {
2445							range = range.split(',');
2446							var minRange = range[0] == '' ? false : parseFloat(range[0]),
2447								maxRange = range[1] == '' ? false : parseFloat(range[1]),
2448								minPrices = [minPrice - 1, minPrice, minPrice + 1], // rounding error correction
2449								maxPrices = [maxPrice - 1, maxPrice, maxPrice + 1]; // rounding error correction
2450
2451							if(minPrices.includes(minRange) && maxPrices.includes(maxRange)){
2452								_this.find('input[type="checkbox"]').prop('checked', true);
2453								return false;
2454							}
2455						}
2456					});
2457					if(typeof(_thisObj.eventChangeFilterPro) == 'function') {
2458						_thisObj.eventChangeFilterPro($filter, settings);
2459					}
2460					break;
2461			}
2462		});
2463
2464	});
2465
2466	WpfFrontendPage.prototype.findGetParameter =(function(url){
2467		// This function is anonymous, is executed immediately and
2468		// the return value is assigned to QueryString!
2469		var query_string = {},
2470			usefulParam = url.split("?")[1] || "",
2471			query = usefulParam || "",
2472			vars = query.split("&");
2473
2474		for (var i = 0; i < vars.length; i++) {
2475			var pair = vars[i].split("=");
2476
2477			// If first entry with this name
2478			if (typeof query_string[pair[0]] === "undefined") {
2479				query_string[pair[0]] = decodeURIComponent(pair[1]);
2480				// If second entry with this name
2481			} else if (typeof query_string[pair[0]] === "string") {
2482				var arr = [query_string[pair[0]], decodeURIComponent(pair[1])];
2483				query_string[pair[0]] = arr;
2484				// If third or later entry with this name
2485			} else {
2486				query_string[pair[0]].push(decodeURIComponent(pair[1]));
2487			}
2488		}
2489		return query_string;
2490	});
2491
2492	WpfFrontendPage.prototype.getClearLabel = (function (label, withCount) {
2493		if(withCount) {
2494			var cnt = label.lastIndexOf('(');
2495			if(cnt == -1) cnt = label.lastIndexOf('<span');
2496			if(cnt != -1) label = label.substring(0, cnt).trim();
2497		}
2498
2499		label = label.replace(/&nbsp;/g,'');
2500
2501		return label;
2502	});
2503
2504	WpfFrontendPage.prototype.getFilterOptionsByType = (function($filter, filterType){
2505		var _thisObj = this.$obj;
2506		return _thisObj['get' + filterType.replace('wpf', '') + 'FilterOptions']($filter);
2507	});
2508
2509	WpfFrontendPage.prototype.getPriceFilterOptions = (function ($filter) {
2510		var _thisObj = this.$obj,
2511			optionsArray = [],
2512			options = [],
2513			minPrice = $filter.find('#wpfMinPrice').val(),
2514			maxPrice = $filter.find('#wpfMaxPrice').val(),
2515			tax = $filter.data('tax'),
2516			rate = $filter.data('rate'),
2517			str = '';
2518
2519		[minPrice, maxPrice, tax] = _thisObj.getConvertedPrices([minPrice, maxPrice, tax], rate);
2520		str = minPrice + ',' + maxPrice;
2521		options.push(str);
2522
2523		//options for frontend(change url)
2524		var frontendOptions = [],
2525			getParams = $filter.attr('data-get-attribute');
2526		frontendOptions['rate'] = rate;
2527
2528		getParams = getParams.split(",");
2529		for (var i = 0; i < getParams.length; i++) {
2530			if (i === 0) {
2531				frontendOptions[getParams[i]] = minPrice;
2532			}
2533			if (i === 1) {
2534				frontendOptions[getParams[i]] = maxPrice;
2535			}
2536			if (i === 2 && tax !== '') {
2537				frontendOptions[getParams[i]] = tax;
2538			}
2539		}
2540		var symbol = $filter.find('.wpfCurrencySymbol'),
2541			symbolB = symbol.length && !symbol.is(':last-child') ? symbol.html() : '',
2542			symbolA = symbol.length && symbol.is(':last-child') ? symbol.html() : '',
2543			selectedOptions = {'is_one': true, 'list': [symbolB + minPrice + symbolA + ' - ' + symbolB + maxPrice + symbolA]};
2544
2545		optionsArray['backend'] = options;
2546		optionsArray['frontend'] = frontendOptions;
2547		optionsArray['selected'] = selectedOptions;
2548		optionsArray['stats'] = [[minPrice, maxPrice]];
2549
2550		return optionsArray;
2551	});
2552
2553	WpfFrontendPage.prototype.getPriceRangeFilterOptions = (function ($filter) {
2554		var _thisObj = this.$obj,
2555			optionsArray = [],
2556			options = [],
2557			frontendOptions = [],
2558			selectedOptions = {'is_one': true, 'list': []},
2559			statistics = [],
2560			i = 0,
2561			rate = $filter.data('rate');
2562
2563		if ($filter.attr('data-display-type') === 'list') {
2564			if ($filter.find("input:checked").length) {
2565				var li = $filter.find('input:checked').closest('li');
2566				options[i] = li.attr('data-range');
2567				selectedOptions['list'][i] = li.find('.wpfValue').html();
2568			}
2569		}else if($filter.attr('data-display-type') === 'dropdown'){
2570			if($filter.find(":selected").attr('data-range')){
2571				var option = $filter.find(":selected");
2572				options[i] = option.attr('data-range');
2573				selectedOptions['list'][i] = option.html();
2574			}
2575
2576		}
2577
2578		//options for frontend(change url)
2579		if (typeof options !== 'undefined' && options.length > 0) {
2580			var getParams = $filter.attr('data-get-attribute'),
2581				tax = $filter.data('tax');
2582			frontendOptions['rate'] = rate;
2583			getParams = getParams.split(",");
2584			if (typeof options[0] !== 'undefined' && options[0].length > 0) {
2585				var prices = options[0].split(',');
2586				[prices[0], prices[1], tax] = _thisObj.getConvertedPrices([prices[0], prices[1], tax], rate);
2587				frontendOptions[getParams[0]] = prices[0];
2588				frontendOptions[getParams[1]] = prices[1];
2589				if (typeof tax !== 'undefined') {
2590					frontendOptions[getParams[2]] = tax;
2591				}
2592			}
2593		}
2594		if (options.length == 0) {
2595			var defRange = $filter.attr('data-default');
2596			if (typeof defRange != 'undefined' && defRange.length) {
2597				options[i] = defRange;
2598			}
2599		}
2600
2601		if (typeof rate !== 'undefined') {
2602			var minPrice = '',
2603				maxPrice = '';
2604			options = options.map(function (elem) {
2605				[minPrice, maxPrice] = _thisObj.getConvertedPrices(elem.split(","), rate);
2606				return minPrice + ',' + maxPrice;
2607			});
2608		}
2609		
2610		if (options.length) {
2611			statistics = options.map(function (elem) {
2612				return elem.split(",");
2613			});
2614		}
2615		optionsArray['backend'] = options;
2616		optionsArray['frontend'] = frontendOptions;
2617		optionsArray['selected'] = selectedOptions;
2618		optionsArray['stats'] = statistics;
2619
2620		return optionsArray;
2621	});
2622
2623	WpfFrontendPage.prototype.getSortByFilterOptions = (function ($filter) {
2624		var optionsArray = [],
2625			options = [],
2626			frontendOptions = [],
2627			selectedOptions = {'is_one': true, 'list': []},
2628			value = '';
2629		if ($filter.data('display-type') === 'radio') {
2630			var elem = $filter.find('input:checked').closest('li'),
2631				name = elem.find('.wpfFilterTaxNameWrapper').html();
2632		} else {
2633			var elem = $filter.find('select:not(.wpfPerPageDD)').find('option:selected'),
2634				name = elem.html();
2635		}
2636		if (elem.length) {
2637			value = elem.data('term-slug');
2638			//options for backend (filtering)
2639			options.push(value);
2640
2641			//options for frontend(change url)
2642			var getParams = $filter.attr('data-get-attribute');
2643			frontendOptions[getParams] = value;
2644			selectedOptions['list'][0] = name;
2645			optionsArray['stats'] = [name];
2646		}
2647		if ($filter.data('first-instock') == '1') {
2648			frontendOptions['oistock'] = 1;
2649			options.push('oistock');
2650		}
2651		
2652		optionsArray['backend'] = options;
2653		optionsArray['frontend'] = frontendOptions;
2654		optionsArray['selected'] = selectedOptions;
2655		return optionsArray;
2656	});
2657
2658	WpfFrontendPage.prototype.getInStockFilterOptions = (function ($filter) {
2659		var optionsArray = [],
2660			frontendOptions = [],
2661			options = [],
2662			filterType = $filter.attr('data-display-type'),
2663			selectedOptions = {'is_one': (filterType === 'dropdown'), 'list': []},
2664			statistics = [],
2665			i = 0;
2666
2667		//options for backend (filtering)
2668		if(filterType === 'dropdown'){
2669			var option = $filter.find(":selected"),
2670				value = option.attr('data-slug');
2671			if(value != '') {
2672				options[i] = value;
2673				frontendOptions[i] = value;
2674				var name = option.html();
2675				selectedOptions['list'][i] = name;
2676				statistics.push(name);
2677			}
2678		} else {
2679			$filter.find('input:checked').each(function () {
2680				var li = jQuery(this).closest('li'),
2681					slug = li.attr('data-term-slug'),
2682					name = li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : li.find('.wpfValue').html();
2683				options[i] = slug;
2684				frontendOptions[i] = slug;
2685				selectedOptions['list'][li.attr('data-term-id')] = name;
2686				statistics.push(name);
2687				i++;
2688			});
2689		}
2690		optionsArray['backend'] = options;
2691
2692		//options for frontend(change url)
2693		var getParams = $filter.attr('data-get-attribute');
2694
2695		optionsArray['frontend'] = [];
2696		optionsArray['frontend']['taxonomy'] = getParams;
2697		optionsArray['frontend']['settings'] = frontendOptions;
2698		optionsArray['selected'] = selectedOptions;
2699		optionsArray['stats'] = statistics;
2700
2701		return optionsArray;
2702	});
2703
2704	WpfFrontendPage.prototype.getCategoryFilterOptions = (function ($filter) {
2705		var _thisObj = this.$obj,
2706			optionsArray = [],
2707			frontendOptions = [],
2708			options = [],
2709			filterType = $filter.attr('data-display-type'),
2710			useSlugs = $filter.attr('data-use-slugs') == '1',
2711			selectedOptions = {'is_one': (filterType == 'list' || filterType == 'dropdown'), 'list': []},
2712			statistics = [],
2713			i = 0;
2714
2715		//options for backend (filtering)
2716		if(filterType === 'dropdown'){
2717			var option = $filter.find(":selected"),
2718				id = option.attr('data-term-id'),
2719				value = option.val();
2720			if(value != '') {
2721				options[i] = value;
2722				var name = _thisObj.getClearLabel(option.html(), $filter.hasClass('wpfShowCount'));
2723				selectedOptions['list'][id] = name;
2724				statistics.push(name);
2725			}
2726			frontendOptions[i] = (useSlugs ? option.attr('data-term-slug') : id);
2727		} else if(filterType === 'mul_dropdown'){
2728			$filter.find(':selected').each(function () {
2729				var option = jQuery(this),
2730					id = option.attr('data-term-id');
2731				options[i] = option.val();
2732				frontendOptions[i] = (useSlugs ? option.attr('data-term-slug') : id);
2733				var name = _thisObj.getClearLabel(option.html(), $filter.hasClass('wpfShowCount'));
2734				selectedOptions['list'][id] = name;
2735				statistics.push(name);
2736				i++;
2737			});
2738		} else {
2739			var removeSelectedList = [];
2740			$filter.find('input').each(function () {
2741				var inputCurent = jQuery(this),
2742					liCurent = inputCurent.closest('li'),
2743					id = liCurent.data('term-id'),
2744					isParent = liCurent.children('ul').length > 0,
2745					isChecked = inputCurent.is(':checked'),
2746					hierarchicalLogic = $filter.attr('data-logic-hierarchical'),
2747					type = $filter.attr('data-display-type'),
2748					isHierarchical = $filter.attr('data-show-hierarchical'),
2749					isHierarchicalLogic = isHierarchical === 'true' && type === 'multi' || type === 'text';
2750
2751				if ( isParent ) {
2752					var isAllChildChecked = true,
2753						childList = [];
2754
2755					liCurent.find('ul li').each(function() {
2756						var childId = jQuery(this).data('term-id'),
2757							childLi = jQuery(this),
2758							childInput = childLi.find('input'),
2759							isChildChecked = childInput.prop('checked');
2760
2761						childList.push(childId);
2762
2763						if (!isChildChecked) {
2764							isAllChildChecked = false;
2765							return false;
2766						}
2767					});
2768
2769					if (isChecked && isAllChildChecked) {
2770						removeSelectedList = removeSelectedList.concat(childList);
2771
2772						var onlyUnique = function(value, index, self) {
2773							return self.indexOf(value) === index;
2774						}
2775
2776						removeSelectedList = removeSelectedList.filter( onlyUnique );
2777						selectedOptions.removeSelected = removeSelectedList;
2778					}
2779				}
2780
2781				if (jQuery(this).is(':checked')) {
2782					if ( isHierarchicalLogic && hierarchicalLogic == 'child' ) {
2783						var liElements = liCurent.find('li'),
2784							isChildChicked = false;
2785
2786						for (var j = 0; j < liElements.length; ++j) {
2787							 var li = liElements[j];
2788							if (jQuery(li).find('input').prop('checked')) {
2789								isChildChicked = true;
2790							}
2791						}
2792						if (!isChildChicked) {
2793							options[i] = id;
2794							frontendOptions[i] = (useSlugs ? liCurent.attr('data-term-slug') : id);
2795						}
2796					} else if(isHierarchicalLogic && hierarchicalLogic == 'parent') {
2797						var parents = liCurent.parents('li'),
2798							isChildChicked = false;
2799
2800						for (var j = 0; j < parents.length; ++j) {
2801							 var li = parents[j];
2802							if (jQuery(li).find('input').prop('checked')) {
2803								isChildChicked = true;
2804							}
2805						}
2806						if (!isChildChicked) {
2807							options[i] = id;
2808							frontendOptions[i] = (useSlugs ? liCurent.attr('data-term-slug') : id);
2809						}
2810					} else {
2811						options[i] = id;
2812						frontendOptions[i] = (useSlugs ? liCurent.attr('data-term-slug') : id);
2813					}
2814					var name = liCurent.find('.wpfValue').html();
2815					selectedOptions['list'][id] = name;
2816					statistics.push(liCurent.find('.wpfFilterTaxNameWrapper:first').length ? liCurent.find('.wpfFilterTaxNameWrapper:first').html() : name);
2817					i++;
2818				}
2819			});
2820		}
2821
2822		var options = options.filter(function (el) {
2823			return el != null;
2824		});
2825		var frontendOptions = frontendOptions.filter(function (el) {
2826			return el != null;
2827		});
2828
2829
2830		optionsArray['backend'] = options;
2831
2832		//options for frontend(change url)
2833		var getParams = $filter.attr('data-get-attribute');
2834
2835		optionsArray['frontend'] = [];
2836		optionsArray['frontend']['taxonomy'] = getParams;
2837		optionsArray['frontend']['settings'] = frontendOptions;
2838		optionsArray['selected'] = selectedOptions;
2839		optionsArray['stats'] = statistics;
2840
2841		return optionsArray;
2842	});
2843
2844	WpfFrontendPage.prototype.getPerfectBrandFilterOptions = (function ($filter) {
2845		return this.$obj.getCategoryFilterOptions($filter);
2846	});
2847
2848	WpfFrontendPage.prototype.getTagsFilterOptions = (function ($filter) {
2849		var _thisObj = this.$obj,
2850			optionsArray = [],
2851			options = [],
2852			frontendOptions = [],
2853			filterType = $filter.attr('data-display-type'),
2854			selectedOptions = {'is_one': (filterType == 'dropdown'), 'list': []},
2855			statistics = [],
2856			withCount = $filter.hasClass('wpfShowCount'),
2857			i = 0,
2858			proFilterType = [
2859				'colors'
2860			];
2861
2862		//options for backend (filtering)
2863		if(filterType === 'dropdown'){
2864			var option = $filter.find(":selected"),
2865				value = option.val();
2866			if(value != '') {
2867				options[i] = value;
2868				frontendOptions[i] = option.attr('data-slug');
2869				var name = _thisObj.getClearLabel(option.html(), withCount);
2870				selectedOptions['list'][option.attr('data-term-id')] = name;
2871				statistics.push(name);
2872			}
2873		} else if (filterType === 'mul_dropdown'){
2874			$filter.find(':selected').each(function () {
2875				var option = jQuery(this);
2876				options[i] = option.val();
2877				frontendOptions[i] = option.attr('data-slug');
2878				var name = _thisObj.getClearLabel(option.html(), withCount);
2879				selectedOptions['list'][option.attr('data-term-id')] = name;
2880				statistics.push(name);
2881				i++;
2882			});
2883		} else if (jQuery.inArray(filterType, proFilterType) == -1 ) {
2884			$filter.find('input:checked').each(function () {
2885				var li = jQuery(this).closest('li'),
2886					id = li.attr('data-term-id');
2887				options[i] = id;
2888				frontendOptions[i] = li.attr('data-term-slug');
2889				var name = li.find('.wpfValue').html();
2890				selectedOptions['list'][id] = name;
2891				statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
2892				i++;
2893			});
2894		}
2895		
2896		var data = {
2897			options : options,
2898			frontendOptions : frontendOptions,
2899			selectedOptions : selectedOptions,
2900			statistics : statistics,
2901			i : i,
2902		}
2903
2904		if (typeof window.wpfFrontendPage.getTagsFilterOptionsPro == 'function') {
2905			data = window.wpfFrontendPage.getTagsFilterOptionsPro($filter, data);
2906		}
2907
2908		optionsArray['backend'] = data.options;
2909
2910		//options for frontend(change url)
2911		var getParams = $filter.attr('data-get-attribute');
2912
2913		optionsArray['frontend'] = [];
2914		optionsArray['frontend']['taxonomy'] = getParams;
2915		optionsArray['frontend']['settings'] = data.frontendOptions;
2916		optionsArray['selected'] = data.selectedOptions;
2917		optionsArray['stats'] = data.statistics;
2918
2919		return optionsArray;
2920	});
2921
2922	WpfFrontendPage.prototype.getAttributeFilterOptions = (function ($filter) {
2923		var _thisObj = this.$obj,
2924			optionsArray = [],
2925			options = [],
2926			frontendOptions = [],
2927			filterType = $filter.attr('data-display-type'),
2928			selectedOptions = {'is_one': (filterType == 'dropdown'), 'list': []},
2929			statistics = [],
2930			withCount = $filter.hasClass('wpfShowCount'),
2931			i = 0,
2932			proFilterType = [
2933				'slider',
2934				'colors'
2935			];
2936
2937		//options for backend (filtering)
2938		if (filterType === 'dropdown'){
2939			var option = $filter.find(":selected"),
2940				value = option.val();
2941			if (value != '') {
2942				options[i] = value;
2943				frontendOptions[i] = option.attr('data-slug');
2944				var name = _thisObj.getClearLabel(option.html(), withCount);
2945				selectedOptions['list'][option.attr('data-term-id')] = name;
2946				statistics.push(name);
2947			}
2948		} else if (filterType === 'mul_dropdown'){
2949			$filter.find(':selected').each(function () {
2950				var option = jQuery(this);
2951				options[i] = option.val();
2952				frontendOptions[i] = option.attr('data-slug');
2953				var name = _thisObj.getClearLabel(option.html(), withCount);
2954				selectedOptions['list'][option.attr('data-term-id')] = name;
2955				statistics.push(name);
2956				i++;
2957			});
2958		} else if (jQuery.inArray(filterType, proFilterType) == -1 ) {
2959			$filter.find('input:checked').each(function () {
2960				var li = jQuery(this).closest('li'),
2961					id = li.attr('data-term-id');
2962				options[i] = id;
2963				frontendOptions[i] = li.attr('data-term-slug');
2964				var name = li.find('.wpfValue').html();
2965				selectedOptions['list'][id] = name;
2966				statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
2967				i++;
2968			});
2969		}
2970
2971		var data = {
2972			options : options,
2973			frontendOptions : frontendOptions,
2974			selectedOptions : selectedOptions,
2975			statistics : statistics,
2976			i : i,
2977		}
2978
2979		if (typeof window.wpfFrontendPage.getAttributeFilterOptionsPro == 'function') {
2980			data = window.wpfFrontendPage.getAttributeFilterOptionsPro($filter, data);
2981		}
2982
2983		optionsArray['backend'] = data.options;
2984
2985		//options for frontend(change url)
2986		var getParams = $filter.attr('data-get-attribute');
2987
2988		optionsArray['frontend'] = [];
2989		optionsArray['frontend']['taxonomy'] = getParams;
2990		optionsArray['frontend']['settings'] = data.frontendOptions;
2991		optionsArray['selected'] = data.selectedOptions;
2992		optionsArray['stats'] = data.statistics;
2993
2994		return optionsArray;
2995	});
2996
2997	WpfFrontendPage.prototype.getAuthorFilterOptions = (function ($filter) {
2998		var _thisObj = this.$obj,
2999			optionsArray = [],
3000			options = [],
3001			frontendOptions = [],
3002			filterType = $filter.attr('data-display-type'),
3003			selectedOptions = {'is_one': (filterType == 'dropdown'), 'list': []},
3004			statistics = [],
3005			i = 0;
3006
3007		//options for backend (filtering)
3008		if(filterType === 'list'){
3009			$filter.find('input:checked').each(function () {
3010				var li = jQuery(this).closest('li'),
3011					id = li.attr('data-term-id');
3012				options[i] = id;
3013				frontendOptions[i] = li.attr('data-term-slug');
3014				var name = li.find('.wpfValue').html();
3015				selectedOptions['list'][id] = name;
3016				statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
3017				i++;
3018			});
3019		} else if (filterType === 'mul_dropdown'){
3020			$filter.find(':selected').each(function () {
3021				var option = jQuery(this);
3022				options[i] = option.val();
3023				frontendOptions[i] = option.attr('data-slug');
3024				var name = _thisObj.getClearLabel(option.html());
3025				selectedOptions['list'][option.attr('data-term-id')] = name;
3026				statistics.push(name);
3027				i++;
3028			});
3029		} else if (filterType === 'dropdown'){
3030			var option = $filter.find(":selected"),
3031				value = option.val();
3032			options[i] = value;
3033			if(value != '') {
3034				frontendOptions[i] = option.attr('data-slug');
3035				var name = option.html();
3036				selectedOptions['list'][option.attr('data-term-id')] = name;
3037				statistics.push(name);
3038			}
3039		}
3040		optionsArray['backend'] = options;
3041
3042		//options for frontend(change url)
3043		var getParams = $filter.attr('data-get-attribute');
3044
3045		optionsArray['frontend'] = [];
3046		optionsArray['frontend']['taxonomy'] = getParams;
3047		optionsArray['frontend']['settings'] = frontendOptions;
3048		optionsArray['selected'] = selectedOptions;
3049		optionsArray['stats'] = statistics;
3050
3051		return optionsArray;
3052	});
3053
3054	WpfFrontendPage.prototype.getFeaturedFilterOptions = (function ($filter) {
3055		var optionsArray = [],
3056			options = [],
3057			frontendOptions = [],
3058			filterType = $filter.attr('data-display-type'),
3059			selectedOptions = {'is_one': (filterType == 'dropdown'), 'list': []},
3060			statistics = [],
3061			i = 0;
3062
3063		$filter.find('input:checked').each(function () {
3064			var li = jQuery(this).closest('li'),
3065				id = li.attr('data-term-id');
3066			options[i] = id;
3067			frontendOptions[i] = li.attr('data-term-slug');
3068			var name = li.find('.wpfValue').html();
3069			selectedOptions['list'][id] = name;
3070			statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
3071			i++;
3072		});
3073		optionsArray['backend'] = options;
3074
3075		//options for frontend(change url)
3076		var getParams = $filter.attr('data-get-attribute');
3077
3078		optionsArray['frontend'] = [];
3079		optionsArray['frontend']['taxonomy'] = getParams;
3080		optionsArray['frontend']['settings'] = frontendOptions;
3081		optionsArray['selected'] = selectedOptions;
3082		optionsArray['stats'] = statistics;
3083
3084		return optionsArray;
3085	});
3086
3087	WpfFrontendPage.prototype.getOnSaleFilterOptions = (function ($filter) {
3088		var optionsArray = [],
3089			options = [],
3090			frontendOptions = [],
3091			filterType = $filter.attr('data-display-type'),
3092			selectedOptions = {'is_one': (filterType == 'dropdown'), 'list': []},
3093			statistics = [],
3094			i = 0;
3095
3096		$filter.find('input:checked').each(function () {
3097			var li = jQuery(this).closest('li'),
3098				id = li.attr('data-term-id');
3099			options[i] = id;
3100			frontendOptions[i] = li.attr('data-term-slug');
3101			var name = li.find('.wpfValue').html();
3102			selectedOptions['list'][id] = name;
3103			statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
3104			i++;
3105		});
3106		optionsArray['backend'] = options;
3107
3108		//options for frontend(change url)
3109		var getParams = $filter.attr('data-get-attribute');
3110
3111		optionsArray['frontend'] = [];
3112		optionsArray['frontend']['taxonomy'] = getParams;
3113		optionsArray['frontend']['settings'] = frontendOptions;
3114		optionsArray['selected'] = selectedOptions;
3115		optionsArray['stats'] = statistics;
3116
3117		return optionsArray;
3118	});
3119
3120	WpfFrontendPage.prototype.getRatingFilterOptions = (function ($filter) {
3121		var optionsArray = [],
3122			frontendOptions = [],
3123			options = [],
3124			filterType = $filter.attr('data-display-type'),
3125			selectedOptions = {'is_one': true, 'list': []},
3126			statistics = [],
3127			i = 0;
3128
3129		//options for backend (filtering)
3130		if(filterType == 'linestars' || filterType == 'liststars'){
3131			var input = $filter.find('input.wpfStarInput:checked'),
3132				rating = input.val();
3133			options[i] = rating;
3134			frontendOptions[i] = rating;
3135			var name = input.attr('data-label');
3136			selectedOptions['list'][i] = name;
3137			statistics.push(name);
3138		}else if(filterType == 'list'){
3139			$filter.find('input:checked').each(function () {
3140				var li = jQuery(this).closest('li'),
3141					id = li.attr('data-term-id');
3142				options[i] = id;
3143				frontendOptions[i] = li.attr('data-term-slug');
3144				var name = li.find('.wpfValue').html();
3145				selectedOptions['list'][id] = name;
3146				statistics.push(li.find('.wpfFilterTaxNameWrapper').length ? li.find('.wpfFilterTaxNameWrapper').html() : name);
3147				i++;
3148			});
3149		}else if(filterType == 'dropdown'){
3150			var option = $filter.find(":selected"),
3151				value = option.val();
3152			options[i] = value;
3153			if(value != '') {
3154				frontendOptions[i] = option.attr('data-slug');
3155				var name = option.html();
3156				selectedOptions['list'][option.attr('data-term-id')] = name;
3157				statistics.push(name);
3158			}
3159		}
3160		optionsArray['backend'] = options;
3161
3162		//options for frontend(change url)
3163		var getParams = $filter.attr('data-get-attribute');
3164
3165		optionsArray['frontend'] = [];
3166		optionsArray['frontend']['taxonomy'] = getParams;
3167		optionsArray['frontend']['settings'] = frontendOptions;
3168		optionsArray['selected'] = selectedOptions;
3169		optionsArray['stats'] = statistics;
3170
3171		return optionsArray;
3172	});
3173
3174	WpfFrontendPage.prototype.disableLeerOptions = (function () {
3175		var _thisObj = this.$obj;
3176		jQuery('.wpfMainWrapper').each(function () {
3177			var mainWrapper = jQuery(this),
3178				settings = _thisObj.getFilterMainSettings(mainWrapper);
3179			if(settings && settings.settings.filter_null_disabled === '1') {
3180				var filters = mainWrapper.find('.wpfFilterWrapper.wpfShowCount');
3181				if(filters.length) {
3182					filters.find('option[data-term-id]').prop('disabled', false);
3183					filters.find('option[data-term-id][data-count="0"]').prop('disabled', true);
3184					filters.find('.wpfCount').each(function(){
3185						var cntObj = jQuery(this),
3186							leer = cntObj.html() == '(0)',
3187							el = cntObj.closest('[data-term-id]'),
3188							input = false;
3189						if(el.length == 0) {
3190							el = cntObj.closest('[data-term-slug]');
3191						}
3192						if(el.length) {
3193							if(el.is('input')) {
3194								input = el;
3195								el = input.parent();
3196							} else {
3197								input = el.find('input');
3198							}
3199							input.prop('disabled', leer);
3200							if(leer) el.addClass('wpfOptionDisabled');
3201							else el.removeClass('wpfOptionDisabled');
3202						}
3203					});
3204				}
3205			}
3206		});
3207	});
3208
3209	WpfFrontendPage.prototype.addSpecificPluginActions = (function() {
3210		// elementor plugin, action when widgets in admin panek are ready
3211		jQuery(window).on('load', function() {
3212			if ( window.elementorFrontend ) {
3213				if ( window.elementorFrontend.hooks ) {
3214					elementorFrontend.hooks.addAction( 'frontend/element_ready/widget', function( $scope ) {
3215						var wrapper = $scope.find('.wpfMainWrapper');
3216
3217						hideFilterLoader(wrapper);
3218					});
3219				}
3220			} else if ( jQuery('.elementor .wpfMainWrapper').length ) {
3221				setTimeout(function() {
3222					jQuery('.elementor .wpfMainWrapper').each(function() {
3223						var wrapper = jQuery(this);
3224						hideFilterLoader(wrapper);
3225					});
3226				}, 2000);
3227			}
3228		});
3229	});
3230
3231	WpfFrontendPage.prototype.fixSelector = (function(selector, defaultSelector) {
3232		if (typeof selector == 'undefined' || selector === '') {
3233			return typeof defaultSelector == 'undefined' ? '' : defaultSelector;
3234		}
3235		return (selector.search(/\.|#/) === -1) ? '.' + selector.replace(/(\s+)(\w+)/g, ' .$2')	: selector ;
3236	});
3237
3238	WpfFrontendPage.prototype.markCheckboxSelected = (function ($filter, first) {
3239		if ($filter.length) {
3240			var settings = this.getFilterMainSettings($filter.closest('.wpfMainWrapper'));
3241			if(settings) {
3242				if (settings.settings.checked_items_bold == '1') {
3243					var wpfMainWrapper = $filter.closest('.wpfMainWrapper');
3244					wpfMainWrapper.find('.wpfDisplay').css('font-weight', '');
3245					wpfMainWrapper.find('.wpfAttrLabel').css('font-weight', '');
3246					// console.log(wpfMainWrapper.find('input:checked'))
3247					wpfMainWrapper.find('input:checked').each(function () {
3248						var wpfDisplay = jQuery(this).closest('.wpfLiLabel').find('.wpfDisplay'),
3249							wpfAttrLabel = jQuery(this).closest('.wpfColorsColBlock').find('.wpfAttrLabel');
3250
3251						wpfDisplay.css('font-weight', 'bold');
3252						wpfAttrLabel.css('font-weight', 'bold');
3253					});
3254				}
3255			}
3256			if (first) {
3257				//need to delete automatic checked inputs by goback in browser Chrome/FF
3258				setTimeout(function () {
3259					$filter.find('input').each(function() {
3260						var input = this;
3261						if (input.type == "checkbox") {
3262							if (input.defaultChecked == true) {
3263								if (input.checked != true) input.checked = true;
3264							} else {
3265								if (input.checked == true) {
3266									input.checked = false;
3267									jQuery(input).closest('.wpfLiLabel').find('.wpfDisplay').removeClass('selected').css('font-weight', '');
3268								}
3269							}
3270							
3271						}
3272					});
3273				}, 100);
3274			}
3275		}
3276	});
3277
3278	jQuery(document).ready(function () {
3279		window.wpfFrontendPage = new WpfFrontendPage();
3280		if (typeof isElementorEditMode == 'undefined') {
3281			window.wpfFrontendPage.init();
3282		}
3283	});
3284	WpfFrontendPage.prototype.unserializeStr = function(serializedString){
3285		var str = decodeURI(serializedString);
3286        var pairs = str.split('&');
3287        var obj = {}, p, idx;
3288        for (var i=0, n=pairs.length; i < n; i++) {
3289            p = pairs[i].split('=');
3290            idx = p[0]; 
3291            if (obj[idx] === undefined) {
3292                obj[idx] = unescape(p[1]).replace ( /\+/g, ' ' );
3293            }else{
3294                if (typeof obj[idx] == "string") {
3295                    obj[idx]=[obj[idx]];
3296                }
3297                obj[idx].push(unescape(p[1]).replace ( /\+/g, ' ' ));
3298            }
3299        }
3300        return obj;
3301	};
3302
3303	WpfFrontendPage.prototype.getConvertedPrices = function (data, rate) {
3304		if (typeof rate !== 'undefined' && rate !== 1 ) {
3305			if (typeof data[0] !== 'undefined') {
3306				data[0] = String(Math.round(data[0] / rate));
3307				if (typeof data[1] !== 'undefined') {
3308					data[1] = String(Math.round(data[1] / rate));
3309				}
3310				if (typeof data[2] !== 'undefined') {
3311					data[2] = String(Math.round(data[2] / rate));
3312				}
3313			} else {
3314				if (data.wpf_min_price) {
3315					data.wpf_min_price = String(Math.round(data.wpf_min_price * rate));
3316				}
3317				if (data.wpf_max_price) {
3318					data.wpf_max_price = String(Math.round(data.wpf_max_price * rate));
3319				}
3320				if (data.tax) {
3321					data.tax = String(Math.round(data.tax * rate));
3322				}
3323			}
3324		}
3325		return data;
3326	};
3327
3328	if (jQuery('.variations_form').length > 0 && typeof $(this).wc_variation_form == 'function') {
3329		document.addEventListener('wpfAjaxSuccess', function (event) {
3330			$('.variations_form').each(function () {
3331				$(this).wc_variation_form();
3332			});
3333		});
3334	}
3335
3336	if (jQuery('.jetpack-lazy-image').length > 0) {
3337		document.addEventListener('wpfAjaxSuccess', function (event) {
3338			jQuery('.jetpack-lazy-image').each(function () {
3339				jQuery(this).removeAttr('srcset');
3340			});
3341		});
3342	}
3343	if (jQuery('.jetpack-lazy-image').length > 0) {
3344		document.addEventListener('wpfAjaxSuccess', function (event) {
3345			jQuery('.jetpack-lazy-image').each(function () {
3346				jQuery(this).removeAttr('srcset');
3347			});
3348		});
3349	}
3350	
3351	// added for ElementorPro Loop Load More
3352	if (jQuery('div.elementor-widget[data-widget_type="loop-grid.product"]').length > 0) {
3353		document.addEventListener('wpfAjaxSuccess', function (event) {
3354			if (window.elementorFrontend && window.elementorFrontend.elementsHandler) {
3355				var $products = jQuery('div.elementor-widget[data-widget_type="loop-grid.product"]');
3356				if ($products.length == 1 && $products.find('.e-load-more-anchor').length == 1) {
3357					$products.removeClass('e-load-more-pagination-end');
3358					window.elementorFrontend.elementsHandler.runReadyTrigger($products);
3359				}
3360			}
3361		});
3362	}
3363
3364	// added for plugin: WooCommerce Load More Products
3365	jQuery(document).ready(function () {
3366		if (jQuery('a.lmp_button').length > 0) {
3367			document.addEventListener('wpfAjaxSuccess', function (event) {
3368				if (!window.wpfDoNotLoadMore && typeof load_next_page == 'function') {
3369					load_next_page(true, decodeURIComponent(location.href));
3370				}
3371			});
3372		}
3373	});
3374	
3375	// plugin event woocommerce-product-search
3376	// https://docs.woocommerce.com/documentation/plugins/woocommerce/woocommerce-extensions/woocommerce-product-search/
3377	jQuery(document).on('ixProductFilterRequestProcessed', function (event) {
3378		window.wpfFrontendPage.filtering();
3379	});
3380
3381}(window.jQuery, window));
3382
3383var objQueryString={};
3384
3385toggleClear();
3386
3387// try to get jquery selector from random html string
3388function wpfGetSelector(html, controlExist, defSelector, countChilds, removeDynamicClasse
3388s, context) {
3389	if(html.length == 0) return defSelector;
3390
3391	var elem     = (typeof context !== 'undefined') ? jQuery(html, context) : jQuery(html),
3392		selector = '',
3393		i = 0;
3394
3395	if (typeof countChilds == 'undefined') {
3396		countChilds = 1;
3397	}
3398
3399	while (i < countChilds && elem && elem.length) {
3400		if (i > 0) {
3401			selector += ' ';
3402		}
3403
3404		i++;
3405
3406		if (elem.length > 1) {
3407			elem = elem.last();
3408		}
3409
3410		var elemId = elem.attr('id');
3411		if (typeof elemId != 'undefined') {
3412			selector += '#' + elemId;
3413		} else {
3414			var elemClass = elem.attr('class');
3415
3416			// try to remove some dinamically changed classes that contains a number in it name
3417			if (removeDynamicClasses) {
3418				classList = elemClass.split(' ');
3419				classList.forEach( function( className, key ) {
3420					var hasNumber = /\d/.test(className);
3421					if ( hasNumber ) {
3422						classList.splice(key, 1);
3423					}
3424				});
3425				elemClass = classList.join(' ');
3426			}
3427
3428			if ( typeof elemClass != 'undefined' && elemClass != '' ) {
3429				if (elemClass == 'container' && countChilds == 1) countChilds = 2;
3430				selector += elem.get(0).tagName + '.' + elemClass.trim().replace(/ +/g, '.');
3431			}
3432		}
3433
3434		if (controlExist && selector != '' && jQuery(selector).length == 0) {
3435			selector = '';
3436			break;
3437		}
3438
3439		var elem = elem.children();
3440	}
3441
3442	return selector.length == 0 ? defSelector : selector;
3443}
3444
3445
3446function getUrlParams () {
3447	var params={};
3448	window.location.search
3449	  .replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str,key,value) {
3450		params[key] = value;
3451	  }
3452	);
3453	return params;
3454}
3455
3456function toggleClear() {
3457	var params = getUrlParams();
3458	jQuery(".wpfBlockClear").hide();
3459	jQuery(".wpfFilterWrapper").each(function(){
3460		var attr = jQuery(this).attr('data-get-attribute');
3461		if (attr in params) {
3462			jQuery(this).find(".wpfBlockClear").show();
3463		}
3464	});
3465	if ('wpf_min_price' in params || 'wpf_max_price' in params) {
3466		jQuery("[data-filter-type='wpfPrice']").find(".wpfBlockClear").show();
3467		jQuery("[data-filter-type='wpfPriceRange']").find(".wpfBlockClear").show();
3468	}
3469}
3470
3471//Get querystring value
3472function getParameterByName(name, searchUrl) {
3473	name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
3474	var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
3475		results = regex.exec(searchUrl);
3476	return results === null ? "" : decodeURIComponent(results[1]);//decodeURIComponent(results[1].replace(/\+/g, " "));
3477}
3478function getCurrentUrlPartsWpf() {
3479	var parts = window.wpfNewUrl.split('?'),
3480		s = (parts[1] || '');
3481	return {href: window.wpfNewUrl, path: parts[0].replace(/#.*$/, ''), search: (s.length ? '?' + s : '')};
3482}
3483
3484//Add or modify querystring
3485function changeUrl(filterSlug, filterValue, $wooPage, $filterWrapper) {
3486	removePageQString();
3487	//Get query string filterValue
3488	$wooPage = (typeof $wooPage != 'undefined' ? $wooPage: false);
3489	var curUrl = getCurrentUrlPartsWpf();
3490	if(!$wooPage){
3491		var searchUrl = decodeURIComponent(curUrl.search);
3492	}else{
3493		if($filterWrapper.attr('data-hide-url')){
3494			var searchUrl=$filterWrapper.attr('data-hide-url');
3495		} else {
3496			var searchUrl = '';
3497		}
3498	}
3499
3500	if (searchUrl.indexOf("redirect")!==-1) {
3501		searchUrl = '';
3502	}
3503
3504	if(searchUrl.indexOf("?")== "-1") {
3505		var urlValue = curUrl.path + '?'+filterSlug+'='+filterValue;
3506	} else {
3507		//Check for filterSlug in query string, if not present
3508		if(searchUrl.indexOf('&'+filterSlug+'=')== "-1" && searchUrl.indexOf('?'+filterSlug+'=')== "-1") {
3509			var urlValue=searchUrl+'&'+filterSlug+'='+filterValue;
3510		//If filterSlug present in query string
3511		} else {
3512			var oldValue = getParameterByName(filterSlug, searchUrl);
3513			if(searchUrl.indexOf("?"+filterSlug+"=")!= "-1") {
3514				var urlValue = searchUrl.replace('?'+filterSlug+'='+oldValue,'?'+filterSlug+'='+filterValue);
3515			// add existing in url filter with another option
3516			} else {
3517				var urlValue = searchUrl.replace('&'+filterSlug+'='+oldValue,'&'+filterSlug+'='+filterValue);
3518			}
3519		}
3520		urlValue = curUrl.path + urlValue;
3521		//history.pushState function is used to add history state.
3522		//It takes three parameters: a state object, a title (which is currently ignored), and (optionally) a URL.
3523	}
3524	if(!$wooPage){
3525		window.wpfNewUrl = encodeURI(urlValue).indexOf('%25') === -1 ? encodeURI(urlValue) : urlValue;
3526	}
3527	objQueryString.key=filterValue;
3528	return urlValue;
3529}
3530
3531function removePageQString() {
3532	var curUrl = getCurrentUrlPartsWpf(),
3533		path = curUrl.path,
3534		page = path.indexOf('/page/');
3535	if(page != -1 && history.pushState) {
3536		window.wpfNewUrl = path.substr(0, page + 1) + curUrl.search;
3537	}
3538}
3539//Function used to remove querystring
3540function removeQString(key, $wooPage, $filterWrapper) {
3541	removePageQString();
3542	//Get query string value
3543	var curUrl = getCurrentUrlPartsWpf(),
3544		urlValue=decodeURI(curUrl.href);
3545	$wooPage = (typeof $wooPage != 'undefined' ? $wooPage: false);
3546	if(!$wooPage){
3547		var searchUrl=decodeURIComponent(curUrl.search);
3548	}else{
3549		if($filterWrapper.attr('data-hide-url')){
3550			var searchUrl=decodeURI($filterWrapper.attr('data-hide-url'));
3551		}else {
3552			var searchUrl = '';
3553		}
3554		var urlValue=curUrl.href + searchUrl;
3555	}
3556	if(key!="") {
3557		var oldValue = getParameterByName(key, searchUrl),
3558			removeVal=key+"="+oldValue;
3559
3560		if(searchUrl.indexOf('?'+removeVal+'&')!= "-1") {
3561			urlValue=urlValue.replace('?'+removeVal+'&','?');
3562		}
3563		else if(searchUrl.indexOf('&'+removeVal+'&')!= "-1") {
3564			urlValue=urlValue.replace('&'+removeVal+'&','&');
3565		}
3566		else if(searchUrl.indexOf('?'+removeVal)!= "-1") {
3567			urlValue=urlValue.replace('?'+removeVal,'');
3568		}
3569		else if(searchUrl.indexOf('&'+removeVal)!= "-1") {
3570			urlValue=urlValue.replace('&'+removeVal,'');
3571		}
3572		if($wooPage){
3573			urlValue = urlValue.replace(curUrl.href,'');
3574		}
3575	} else {
3576		if(!$wooPage){
3577			var searchUrl=decodeURIComponent(curUrl.search);
3578			urlValue=urlValue.replace(searchUrl,'');
3579		}else{
3580			var searchUrl=$filterWrapper.attr('data-hide-url');
3581			urlValue=urlValue.replace(searchUrl,'');
3582			urlValue = urlValue.replace(curUrl.href,'');
3583		}
3584	}
3585	if(!$wooPage){
3586		window.wpfNewUrl = encodeURI(urlValue).indexOf('%25') === -1 ? encodeURI(urlValue) : urlValue;
3587	}
3588	return urlValue.indexOf('%25') !== -1 ? decodeURI(urlValue) : urlValue;
3589}
3590function checkArray(my_arr){
3591	for(var i=0;i<my_arr.length;i++){
3592		if(my_arr[i] === "")
3593			return false;
3594	}
3595	return true;
3596}
3597jQuery.toQueryParams = function(str, separator) {
3598	separator = separator || '&';
3599	var obj = {};
3600	if (str.length == 0)
3601		return obj
3602	var c = str.substr(0,1),
3603		s = c=='?' || c=='#'  ? str.substr(1) : str,
3604		a = s.split(separator);
3605	for (var i=0; i<a.length; i++) {
3606		var p = a[i].indexOf('=');
3607		if (p < 0) {
3608			obj[a[i]] = '';
3609			continue
3610		}
3611		var k = decodeURIComponent(a[i].substr(0,p)),
3612			v = decodeURIComponent(a[i].substr(p+1)),
3613			bps = k.indexOf('[');
3614		if (bps < 0) {
3615			obj[k] = v
3616			continue;
3617		}
3618
3619		var bpe = k.substr(bps+1).indexOf(']');
3620		if (bpe < 0) {
3621			obj[k] = v
3622			continue;
3623		}
3624
3625		var bpv = k.substr(bps+1, bps+bpe-1),
3626			k = k.substr(0,bps);
3627		if (bpv.length <= 0) {
3628			if (typeof(obj[k]) != 'object') obj[k] = [];
3629			obj[k].push(v);
3630		} else {
3631			if (typeof(obj[k]) != 'object') obj[k] = {};
3632			obj[k][bpv] = v;
3633		}
3634	}
3635	return obj;
3636}
3637function wpfChangeFiltersCount (wpfExistTerms, synchroFilterId) {
3638	
3639	var wpfPage = window.wpfFrontendPage,
3640		curFilter = wpfPage.isSynchro ? (typeof(synchroFilterId) != 'undefined' && synchroFilterId.length ? '#'+synchroFilterId : '#'+wpfPage.currentLoadId) : 'body';
3641
3642	jQuery(curFilter).find(".wpfShowCount").find(".wpfCount").html("(0)");
3643	jQuery(curFilter).find(".wpfShowCount select:not([multiple]) option[data-count]").each(function(){
3644		var attr = jQuery(this).attr("data-term-name");
3645		jQuery(this).attr('data-count', 0).html(attr+" (0)");
3646	});
3647	jQuery(curFilter).find(".wpfShowCount select[multiple]").find("option").each(function(){
3648		attr = jQuery(this).attr("data-term-name");
3649		jQuery(this).attr('data-count', 0).html(attr+" (0)");
3650	});
3651
3652	jQuery(curFilter).find(".wpfShowCount").each(function(filterCounter){
3653
3654		var filter = jQuery(this);
3655		if (filter.attr("data-filter-type").length > 0) {
3656			var taxonomy = filter.data('taxonomy');
3657			if(typeof taxonomy == 'undefined' || taxonomy.length == 0) taxonomy = filter.data('slug');
3658			
3659			if (taxonomy in wpfExistTerms) {
3660
3661				if (typeof (wpfExistTerms[taxonomy].relation) !== 'undefined') {
3662					var htmlArray = {};
3663					jQuery(curFilter).find('div.wpfShowCount[data-taxonomy="' + taxonomy + '"] li').each(function () {
3664						htmlArray[jQuery(this).data('term-id')] = jQuery('.wpfFilterTaxNameWrapper', this).html();
3665					});
3666
3667					jQuery.each(wpfExistTerms[taxonomy].relation, function (index, value) {
3668						jQuery.each(htmlArray, function (i, v) {
3669							if (v === value && i !== index) {
3670								wpfExistTerms[taxonomy][i] = wpfExistTerms[taxonomy][index];
3671								delete wpfExistTerms[taxonomy][index];
3672							}
3673						});
3674					});
3675				}
3676
3677				jQuery.each(wpfExistTerms[taxonomy], function (index, value) {
3678					changeCount(taxonomy, index, value, curFilter);
3679				});
3680
3681				delete wpfExistTerms[taxonomy];
3682			}
3683
3684		}
3685	});
3686
3687	window.wpfFrontendPage.disableLeerOptions();
3688	var multi = jQuery('.wpfShowCount').find('select[multiple]');
3689	if (multi.length) multi.multiselect('reload');
3690};
3691
3692function changeCount(taxonomy, index, value, curFilter) {
3693
3694	var oIndex = index;
3695	index = index.toLowerCase();
3696	var els = jQuery(curFilter).find('div.wpfShowCount[data-taxonomy="' + taxonomy + '"] [data-term-id="' + oIndex + '"]');
3697	if (els.length === 0) {
3698		els = jQuery(curFilter).find('div.wpfShowCount[data-slug="' + taxonomy + '"] [data-term-id="' + oIndex + '"]');
3699	}
3700	if (els.length === 0) {
3701		els = jQuery(curFilter).find('div.wpfShowCount[data-taxonomy="' + taxonomy + '"] [data-term-id="' + index + '"]');
3702	}
3703	if (els.length === 0) {
3704		els = jQuery(curFilter).find('div.wpfShowCount[data-slug="' + taxonomy + '"] [data-term-id="' + index + '"]');
3705	}
3706	if (els.length > 0) {
3707		els.each(function () {
3708			var el = jQuery(this);
3709			if (el.find('.wpfCount').length > 0) {
3710				el.find('.wpfCount:first').html('(' + value + ')');
3711			} else if (el.parent().attr('class') == 'wpfColorsColBlock') {
3712				el.parent().find('.wpfCount').html('(' + value + ')');
3713			} else {
3714				var attrname = el.attr('data-term-name');
3715				var tooltipstered = el.siblings('.tooltipstered');
3716				if (tooltipstered.length) {
3717					attrname = tooltipstered.attr('data-term-name');
3718					tooltipstered.tooltipster('content', '' + attrname + ' (' + value + ')');
3719					if (tooltipstered.attr('data-show-count')) tooltipstered.text(value);
3720				} else if (attrname !== undefined) {
3721					el.html('' + attrname + ' (' + value + ')');
3722				} else {
3723					el.html('' + index + ' (' + value + ')');
3724				}
3725			}
3726			if (el.is('option')) {
3727				el.attr('data-count', value);
3728			}
3729		});
3730	}
3731}
3732
3733// show/hide individual filter items
3734function wpfShowHideFiltersAtts(wpfExistTerms, wpfExistUsers, synchroFilterId) {
3735
3736	var wpfPage = window.wpfFrontendPage,
3737		curFilter = typeof(synchroFilterId) != 'undefined' && synchroFilterId.length ? synchroFilterId : wpfPage.currentLoadId;
3738
3739	wpfPage.restoreSelectsForSafari();
3740
3741	jQuery((curFilter ? '#' + curFilter + ' ' : '') + '.wpfFilterWrapper').each(function(){
3742		var filter = jQuery(this),
3743			filterType = filter.data('filter-type'),
3744			isTextFilter = filter.attr('data-display-type') == 'text',
3745			filterContentType = isTextFilter && filter.attr('data-control-products') == '1' ? 'taxonomy' : filter.data('content-type'),
3746			taxonomy = filter.data('taxonomy'),
3747			getAttr = filter.data('get-attribute'),
3748			isFilterCurentlyActivated = getParameterByName(getAttr, location.search),
3749			isHideActive = filter.data('hide-active'),
3750			isShowAll = Boolean(filter.data('show-all')),
3751			isNotInLogic = getAttr.indexOf('pr_filter') == -1 ? false : true,
3752			userExistIds = [];
3753		
3754		switch (filterContentType) {
3755			case 'user':
3756				jQuery.each(wpfExistUsers, function (index, value) {
3757					userExistIds.push(parseInt(value.ID));
3758				});
3759				if (!isFilterCurentlyActivated && userExistIds.length > 0) {
3760					filter.find('[data-term-id]').each(function () {
3761						var el = jQuery(this),
3762							userId = el.data('term-id');
3763						if (userExistIds.indexOf(userId) >= 0) {
3764							el.show();
3765						} else {
3766							el.hide();
3767						}
3768					});
3769				}
3770				break;
3771			case 'taxonomy':
3772				if (typeof taxonomy == 'undefined' || taxonomy.length == 0) {
3773					taxonomy = filter.data('slug');
3774				}
3775
3776				if ((!isFilterCurentlyActivated || isHideActive) && !isNotInLogic && !isShowAll ) {
3777					if (taxonomy in wpfExistTerms || isFilterCurentlyActivated) {
3778						var termIds = wpfExistTerms[taxonomy] || {};
3779						filter.find('[data-term-id]').each(function () {
3780							var elem = jQuery(this),
3781								id = elem.data('term-id'),
3782								selected = isFilterCurentlyActivated && (elem.is('input:checked') || elem.find('input:checked').length || elem.is('option:selected'));
3783							if (id in termIds || selected) {
3784								if(elem.closest('.wpfButtonsFilter').length) elem.css('display', 'inline-block');
3785								else elem.show();
3786								if (elem.parent().hasClass('wpfColorsColBlock')) {
3787									elem.parent().parent().show();
3788								}
3789								if (elem.closest('.wpfColorsRow').length) {
3790									elem.parent().css('display', 'inline-block');
3791								}
3792							} else {
3793								elem.hide();
3794								elem.find('input').prop('checked', false);
3795								if (elem.parent().hasClass('wpfColorsColBlock')) {
3796									elem.parent().parent().hide();
3797								}
3798								if (elem.closest('.wpfColorsRow').length) {
3799									elem.parent().hide();
3800								}
3801							}
3802						});
3803
3804						if (filter.attr('data-display-type') == 'slider' ) {
3805							if (typeof(wpfPage.updateAttrSlider) == 'function') {
3806								wpfPage.updateAttrSlider(filter, termIds);
3807							}
3808						} else {
3809							// all terms display block already has css display none
3810							var hideSingle = filter.attr('data-hide-single') == '1',
3811								preSelector = hideSingle && filter.find('select[multiple]').length ? 'option' : '',
3812								selector = hideSingle && filter.find('.wpfColorsFilter').length ? 'li[data-term-slug]' : '[data-term-id]',
3813								cntAll = isTextFilter ? 1 : filter.find(preSelector+selector).length,
3814								cntHidden = filter.find(preSelector+selector+'[style*="none"]').length,
3815								limit = hideSingle ? 1 : 0;
3816							if (cntAll-cntHidden <= limit) {
3817								filter.hide();
3818							} else {
3819								filter.show();
3820							}
3821						}
3822					} else {
3823						filter.find('input').prop('checked', false);
3824						filter.find('select').val('');
3825						filter.hide();
3826					}
3827				}
3828				var multi = filter.find('select[multiple]');
3829				if (multi.length) multi.multiselect('reload');
3830
3831				if(typeof(window.wpfFrontendPage.wpfShowHideFiltersAttsPro) == 'function') {
3832					window.wpfFrontendPage.wpfShowHideFiltersAttsPro(filter);
3833				}
3834				break;
3835			default:
3836				// console.log(`Sorry, we are out of ${expr}.`);
3837		}
3838	});
3839	wpfPage.removeHiddenOptionsForSafari();
3840}
3841
3842function wpfChangePriceFiltersCount(prices) {
3843	var _thisObj = window.wpfFrontendPage,
3844		noWooPage = _thisObj.noWoo,
3845		filterWrapper = jQuery('.wpfMainWrapper'),
3846		priceFilters = jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"].wpfNotActive');
3847	
3848	jQuery('.wpfFilterWrapper[data-filter-type="wpfPrice"]').each(function () {
3849		var wpfPrice = jQuery(this);
3850		wpfPrice.attr('data-minvalue', prices.wpf_min_price).attr('data-maxvalue', prices.wpf_max_price);
3851		
3852		wpfPrice.find('#wpfMinPrice').attr('min', prices.wpf_min_price).val(prices.wpf_min_price);
3853		wpfPrice.find('#wpfMaxPrice').attr('max', prices.wpf_max_price).val(prices.wpf_max_price);
3854		
3855		if (wpfPrice.find(".ion-range-slider").length) {
3856			wpfPrice.find(".ion-range-slider").each(function () {
3857				jQuery(this).attr('data-min', prices.wpf_min_price).attr('data-max', prices.wpf_max_price);
3858				var ionSlider = jQuery(this).data("ionRangeSlider");
3859				ionSlider.update({
3860					min: prices.wpf_min_price,
3861					max: prices.wpf_max_price,
3862				});
3863			});
3864		}
3865	});
3866	window.wpfFrontendPage.eventsPriceFilter();
3867	_thisObj.getUrlParamsChangeFiltersValues();
3868	/*if (typeof(window.wpfFrontendPage.eventsFrontendPro) == 'function') {
3869		window.wpfFrontendPage.eventsFrontendPro();
3870	}*/
3871}
3872
3873function hideFilterLoader( wrapper ) {
3874	wrapper.find('.wpfLoaderLayout').hide();
3875	wrapper.css({
3876		position: ''
3877	});
3878	wrapper.find('.wpfFilterWrapper').css({
3879		visibility: 'inherit'
3880	});
3881}
3882
3883function heightIdenticalInRow(selector) {
3884	var setMaxHeight = function (elements) {
3885		if (elements.length > 1) {
3886			var elementHeightMax = elements[0].height;
3887			for (var j = 1; j < elements.length; j++) {
3888				if (elements[j].height > elementHeightMax) {
3889					elementHeightMax = elements[j].height;
3890				}
3891			}
3892			for (var j = 0; j < elements.length; j++) {
3893				jQuery(elements[j].selector).height(elementHeightMax);
3894			}
3895		}
3896	};
3897	var elementsHeight = [];
3898	var rowIndex = 0;
3899	var elementIndex = 0;
3900	
3901	jQuery(selector).each(function (index, element) {
3902		if (!elementsHeight[rowIndex]) {
3903			elementsHeight[rowIndex] = [];
3904		}
3905		if (
3906			elementsHeight[rowIndex][elementsHeight[rowIndex].length - 1]
3907			&&
3908			elementsHeight[rowIndex][elementsHeight[rowIndex].length - 1].top
3909			&&
3910			elementsHeight[rowIndex][elementsHeight[rowIndex].length - 1].top !== jQuery(element).offset().top
3911		) {
3912			
3913			setMaxHeight(elementsHeight[rowIndex]);
3914			rowIndex++;
3915		}
3916		if (!elementsHeight[rowIndex]) {
3917			elementsHeight[rowIndex] = [];
3918		}
3919		elementsHeight[rowIndex].push({
3920			selector: selector + ':eq(' + elementIndex + ')',
3921			height: jQuery(element).height(),
3922			top: jQuery(element).offset().top
3923		});
3924		elementIndex++;
3925	});
3926	if (elementsHeight[rowIndex]) {
3927		setMaxHeight(elementsHeight[rowIndex]);
3928	}
3929}
3930function wpfDoActionsAfterLoad (fid, isFound, requestData) {
3931	if (typeof (window.wpfFrontendPage.saveStatistics) == 'function') {
3932		window.wpfFrontendPage.saveStatistics(fid, isFound, requestData);
3933	}
3934}

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.