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