PageSourceSearch

https://www.rvsofamerica.com/wp-content/plugins/woocommerce-produc…/step_filer/js/step_filter.js?ver=2.2.9.4

js rvsofamerica.com collected 2026-10-05 18:29:10 UTC 18,263 bytes, 536 lines download raw bytes

1"use strict";
2var woof_step_autosubmit=0;
3var woof_step_pre_autosubmit={};
4
5function woof_step_filter_html_items(){
6    var step_filter= jQuery('.woof_step');
7
8    if(step_filter.length){
9        var type =step_filter.data('filter_type');
10        woof_step_filter_select_fix();
11        
12        if(type==2){
13            woof_submit_link_locked=false;
14            woof_autosubmit=1;
15            woof_ajax_redraw = 1;
16        }
17        
18        woof_step_filter_check_items(type);
19
20        if(type==1){
21	    check_next_prev_btn();
22        }
23        
24        step_filter.slideDown('100');
25	woof_reinit_selects();
26        if(type==1){
27
28            jQuery('.woof_step_filter_next').off('click');
29            jQuery('.woof_step_filter_next').on('click',function(){
30                woof_submit_link_locked = false;
31                woof_ajax_redraw = 1;
32                woof_submit_link(woof_get_submit_link());
33
34            });
35            jQuery('.woof_step_filter_prev').off('click');
36            jQuery('.woof_step_filter_prev').on('click', function(){
37                
38                var element = jQuery('.woof_step_filter_current').prev();
39                if(!element.length){
40                    element=jQuery(this).parents('.woof_step').find('.woof_container.woof_step_hide').last();                    
41                }     
42                
43                var current_filter=woof_step_filter_delete_filter_data(element);
44
45                jQuery.each(current_filter,function(i,item){
46                    delete woof_current_values[item];
47                });
48                woof_submit_link_locked = false;
49                woof_ajax_redraw = 1; 
50                woof_submit_link(woof_get_submit_link());
51
52            });
53        }
54    } 
55
56
57
58}
59
60function woof_step_filter_select_fix(){
61    var mselect = jQuery('.woof_container_mselect');
62    var select = jQuery('.woof_container_select');
63    var select_h = jQuery('.woof_container_select_hierarchy');
64
65    if(jQuery(mselect).length){
66        jQuery.each(jQuery(mselect),function(i,item){
67            if(jQuery(item).find('select option').length<1){
68                jQuery(item).remove();
69            }else if(jQuery(item).find('select option').length==1 && jQuery(item).find('select option').val()==0){
70				jQuery(item).remove();
71			}
72        });
73    }
74    if(jQuery(select).length){
75		           
76        jQuery.each(jQuery(select),function(i,item){
77			 
78            if(jQuery(item).find('select option').length<=1){
79                jQuery(item).remove();
80            }
81        });
82    }
83    if(jQuery(select_h).length){
84        jQuery.each(jQuery(select_h),function(i,item){
85            if(jQuery(item).find('select option').length<=1){
86                jQuery(item).remove();
87            }
88        });
89    }
90}
91function check_next_prev_btn(){
92
93    var curr_el=jQuery('.woof_step_filter_current:not(".woof_container.woof_turbo_hide")');
94
95    jQuery('.woof_step .woof_container_inner input').on('ifChecked', function (event) {
96        if(woof_step_filter_check_state(jQuery(this).parents(".woof_container")).has){
97            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
98        }else{
99            jQuery('.woof_step_filter_next').prop( "disabled", true );
100        }        
101    });
102    jQuery('.woof_step .woof_container_inner input').on('ifUnchecked', function (event) {
103        if(woof_step_filter_check_state(jQuery(this).parents(".woof_container")).has){
104            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
105        }else{
106            jQuery('.woof_step_filter_next').prop( "disabled", true );
107        }        
108    });
109    jQuery('.woof_step .woof_container_inner a').on('click', function (event) {
110        if(woof_step_filter_check_state(jQuery(this).parents(".woof_container")).has){
111            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
112        }else{
113            jQuery('.woof_step_filter_next').prop( "disabled", true );
114        }        
115    });
116    jQuery('.woof_step .price_slider_wrapper .price_slider').on('click', function (event) {
117	
118        if(woof_step_filter_check_state(jQuery(this).parents(".woof_c
118ontainer")).has){
119            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
120        }else{
121            jQuery('.woof_step_filter_next').prop( "disabled", true );
122        }        
123    });
124     jQuery('body').on('change','.woof_step .woof_price_filter_txt', function () {
125        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
126            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
127        }else{
128            jQuery('.woof_step_filter_next').prop( "disabled", true );
129        }        
130    });
131    jQuery('.woof_step .woof_meta_filter_textinput').keyup(function (e) {
132        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
133            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
134        }else{
135            jQuery('.woof_step_filter_next').prop( "disabled", true );
136        }        
137    });
138    jQuery('.woof_step .woof_show_sku_search').keyup(function (e) {
139        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
140            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
141        }else{
142            jQuery('.woof_step_filter_next').prop( "disabled", true );
143        }        
144    });
145    jQuery('.woof_step .woof_show_text_search').keyup(function (e) {
146        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
147            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
148        }else{
149            jQuery('.woof_step_filter_next').prop( "disabled", true );
150        }        
151    });
152    
153    
154    jQuery('.woof_step_filter_current').on('click',function(){
155	var _this = this;
156	setTimeout(function(){
157	    if(woof_step_filter_check_state(_this).has){
158		jQuery('.woof_step_filter_next').prop( "disabled", false ); 
159	    }else{
160		jQuery('.woof_step_filter_next').prop( "disabled", true );
161	    }	    
162	}, 300);
163
164    });
165
166	jQuery('.woof_step_filter_current [type="checkbox"]').on('change', function (event) {
167        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
168            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
169        }else{
170            jQuery('.woof_step_filter_next').prop( "disabled", true );
171        }  
172    });
173    jQuery('.woof_step_filter_current [type="radio"]').on('change', function (event) {
174        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
175            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
176        }else{
177            jQuery('.woof_step_filter_next').prop( "disabled", true );
178        }  
179    });
180    
181    if(woof_step_filter_check_state(curr_el).has){
182        jQuery('.woof_step_filter_next').prop( "disabled", false );
183    }else{
184        jQuery('.woof_step_filter_next').prop( "disabled", true ); 
185    }
186
187    if(jQuery(curr_el).next('.woof_submit_search_form_container').length){
188        jQuery('.woof_step_filter_next').prop( "disabled", true );
189        woof_autosubmit=1;
190        woof_ajax_redraw = 1;
191        
192        if(jQuery('.woof_step').data('autosubmit')){
193            woof_ajax_redraw = 0; 
194        }
195                
196    }else{
197        woof_autosubmit=0;  
198    }
199
200
201    
202    if(jQuery(curr_el).is(":first-child")){
203        jQuery('.woof_step_filter_prev').prop( "disabled", true );
204    }else{
205        jQuery('.woof_step_filter_prev').prop( "disabled", false );
206    }
207
208    if(!curr_el.length){       
209
210        var prev_btn = jQuery('.woof_step .woof_step_filter_prev').clone();
211        var isset_btn=jQuery('.woof_step .woof_submit_search_form_container').find('.woof_step_filter_prev');
212        if(!isset_btn.length){
213            prev_btn.prependTo('.woof_step .woof_submit_search_form_container'); 
214        }
215               
216        jQuery('.woof_step_next_back_btn').hide();
217            //turbo
218            if(typeof WoofTurboMode!='undefined'){
219               woof_step_autosubmit=1;
220                woof_step_filter_submit();        
221            }
222            //turbo     
223        
224    }else{
225        jQuery('.woof_step .woof .woof_submit_search_form_container').hide();
226        jQuery('.woof_step_next_back_btn').show(); 
227        jQuery('.woof_step .woof_submit_search_form_container .woof_step_filter_prev').remove();
228    }
229    
230}
231
232function woof_step_filter_check_items(type){
233    var items=jQuery('.woof_step .woof .woof_container:not(".woof_container.woof_turbo_hide")');
234    
235    var woof_current_values_temp={};
236    var hide=false;
237    var first=0;
238
239
240    //turbo
241    if(typeof WoofTurboMode!='undefined'){
242       jQuery(items).removeClass('woof_step_filter_current');
243    }   
244    
245    jQuery.each(items, function(i,item){
246        if(type==1){
247            jQuery(item).addClass('woof_step_hide');
248        }else if(type==2){
249            
250            if(i!=0 && hide){
251                jQuery(item).addClass('woof_step_hide');
252            }else{
253                jQuery(item).removeClass('woof_step_hide');
254            }                       
255        }
256  
257        var stat = woof_step_filter_check_state(item);    
258
259        if(!stat.has){
260            hide=true;
261            first++;
262            if(first==1){
263                jQuery(item).addClass('woof_step_filter_current');
264                jQuery(item).removeClass('woof_step_hide');
265            }
266            
267        }  
268        
269        if(!hide && stat.key){
270            jQuery.each(stat.key,function(i,val){
271                if(woof_current_values[val]){
272                    woof_current_values_temp[val] = woof_current_values[val];
273                }
274            });
275            if(woof_current_values['page']!=undefined){
276               woof_current_values_temp['page'] = woof_current_values['page']; 
277            }
278            if(woof_current_values['paged']!=undefined){
279               woof_current_values_temp['paged'] = woof_current_values['paged']; 
280            }
281            if(woof_current_values['orderby']!=undefined){
282               woof_current_values_temp['orderby'] = woof_current_values['orderby'];
283            }
284            if(woof_current_values['order']!=undefined){
285               woof_current_values_temp['order'] = woof_current_values['order']; 
286            }
287                 
288        }
289
290        if(type==2){
291           
292            if(jQuery('.woof_step_filter_current').next('.woof_submit_search_form_container').length){
293             
294                jQuery('.woof_step_filter_current').on('click', function(){                   
295                    woof_step_autosubmit=1;
296                    woof_ajax_redraw = 0;
297                }); 
298            }
299            //turbo
300            if(typeof WoofTurboMode!='undefined'){            
301                if(jQuery('.woof_step_filter_current').nextAll(".woof_container:not('.woof_container.woof_turbo_hide')").length==0){
302                   
303                    jQuery('.woof_step_filter_current').on('click',function(){                   
304                        woof_step_autosubmit=1;
305                        woof_ajax_redraw = 1;
306                        woof_step_filter_submit();
307                    }); 
308                }
309            }        
310        }
311		
312        var curr_el = jQuery('.woof_step_filter_current:not(".woof_container.woof_turbo_hide")');
313
314        if(jQuery(curr_el).length==0){	
315                if(jQuery(woof_step_pre_autosubmit).data('css-class')==jQuery(".woof_step.woof_autosubmit").find(".woof_container").last().data('css-class')){
316                        woof_step_autosubmit=1;
317                        woof_step_filter_submit();
318                }				
319        }else{			
320                woof_step_pre_autosubmit=curr_el
321        }		
322		
323        if(!hide && i == items.length-1){  
324            
325            if(typeof WoofTurboMode!='undefined' && type==2){
326                woof_step_autosubmit=1;
327            }
328            
329            woof_step_filter_submit();
330            
331        }
332
333                
334    });
335    woof_current_values=woof_current_values_temp;    
336    
337    woof_step_filter_image(); 
338    
339}
340
341function woof_step_filter_check_items_(){
342    
343    var items=jQuery('.woof_step .woof .woof_container');
344    var woof_current_values_temp={};
345    var hide=false;
346    var first=0;
347    jQuery.each(items, function(i,item){
348        if(i!=0 && hide){
349            jQuery(item).addClass('woof_step_hide');
350        }else{
351            jQuery(item).removeClass('woof_step_hide');
352        }   
353
354        var stat = woof_step_filter_check_state(item);
355        
356        if(!stat.has){
357            hide=true;
358            first++;
359            if(first==1){
360                jQuery(item).addClass('woof_step_filter_current');
361            }
362            
363        }  
364        
365        
366        if(!hide && stat.key){
367            jQuery.each(stat.key,function(i,val){
368                if(woof_current_values[val]){
369                    woof_current_values_temp[val] = woof_current_values[val];
370                }
371            });
372            if(woof_current_values['page']!=undefined){
373               woof_current_values_temp['page'] = woof_current_values['page']; 
374            }
375            if(woof_current_values['paged']!=undefined){
376               woof_current_values_temp['paged'] = woof_current_values['paged']; 
377            }
378            if(woof_current_values['orderby']!=undefined){
379               woof_current_values_temp['orderby'] = woof_current_values['orderby'];
380            }
381            if(woof_current_values['order']!=undefined){
382               woof_current_values_temp['order'] = woof_current_values['order']; 
383            }
384                 
385        }
386        
387        if(!hide && i == items.length-1){           
388            woof_step_filter_submit();
389
390        }
391
392                
393    });
394    woof_current_values=woof_current_values_temp;
395            
396}
397
398function woof_step_filter_check_state(_this){
399    var stat={
400       has:false,
401       key:[],
402    };
403
404    jQuery.each(woof_current_values, function(i,item){
405	
406        if(i=='min_price'|| i=='max_price'){
407	     
408            if(jQuery(_this).hasClass('woof_price_filter')){     
409		//alert();
410                stat.has = true;
411                stat.key = ['min_price','max_price']; 
412            }
413        }else if(i=='min_rating'|| i=='max_rating'){
414            if(jQuery(_this).hasClass('woof_by_rating_container')){               
415                stat.has = true;
416                stat.key = ['min_rating','max_rating'];
417            }
418            
419        }else if(jQuery(_this).hasClass(('woof_container_'+i))){
420	   
421                stat.has = true;
422                stat.key = [i];
423                
424                if(jQuery(_this).hasClass("woof_container_select_hierarchy")){
425                    if(jQuery(_this).find(".woof_block_html_items select:last").val()==0){
426                        stat.has = false;
427                        stat.key = [];
428                    }
429                }
430        }
431    });
432    return stat;
433}
434function woof_step_filter_delete_filter_data(_this){
435    var key=[];
436    if(!jQuery(_this).hasClass('woof_container')){
437        _this=jQuery(_this).prev();
438    }
439    jQuery.each(woof_current_values, function(i,item){
440        
441        if(i=='min_price'|| i=='max_price'){
442            if(jQuery(_this).hasClass('woof_price_filter')){               
443                key = ['min_price','max_price'];
444            }
445            if(jQuery(_this).hasClass('woof_price_filter')){               
446                key = ['min_price','max_price'];
447            }
448
449        }else if(i=='min_rating'|| i=='max_rating'){
450            if(jQuery(_this).hasClass('woof_by_rating_container')){               
451                key = ['min_rating','max_rating'];
452            }
453            
454        }else if(jQuery(_this).hasClass(('woof_container_'+i))){
455                key = [i];
456        }
457    });
458    return key;
459}
460
461function woof_step_filter_submit(){
462    
463    if(jQuery('.woof_step').data('autosubmit') && woof_step_autosubmit){
464        if(typeof WoofTurboMode=='undefined'){
465            jQuery('.woof_submit_search_form_container').hide();
466        }
467
468        woof_submit_link_locked = false;
469
470        woof_ajax_redraw = 0; 
471        
472        woof_step_autosubmit=0;
473	woof_step_pre_autosubmit={};
474        
475        woof_submit_link_locked = false;
476        woof_submit_link(woof_get_submit_link());
477
478       
479    }else{
480        woof_ajax_redraw = 1;
481        jQuery('.woof_step .woof .woof_submit_search_form').on('click', function(){
482            woof_ajax_redraw = 0;
483            //turbo
484            if(typeof WoofTurboMode!='undefined'){
485                woof_submit_link_locked= false;
486                woof_submit_link(woof_get_submit_link());
487                return false;
488            }
489            //turbo
490        })
491        
492        jQuery('.woof_submit_search_form_container').show();
493        jQuery('.woof_step .woof .woof_submit_search_form').show();
494    }
495    
496    
497}
498
499function woof_step_filter_image(){
500    jQuery('.woof_step_filter_image').remove();
501    var image_input=jQuery("input.woof_step_filter_images");
502    var image="";
503    if(image_input.length){
504        var behavior= jQuery(image_input).data("behavior");
505        var selector= jQuery(image_input).data("selector");
506        var images=JSON.parse(atob(jQuery(image_input).val())); 
507        
508        var current_item=jQuery(".woof_step_filter_current");
509        if(jQuery(current_item).hasClass('woof_price_filter')){
510            if(typeof images['by_price']!='undefined'){
511                image=images['by_price'];
512            }
513        }else if(typeof images['by_rating']!='undefined'){
514            if(typeof images['by_rating']!='undefined'){
515                image=images['by_rating'];
516            }                           
517        }else{
518            jQuery.each(images,function(key,img){
519
520                if(jQuery('.woof_container_'+key).hasClass("woof_step_filter_current")){
521                   
522                    image=img;
523                }
524            });
525        }
526        if("append"==behavior){
527            jQuery(selector).append(image);
528        }else{
529            jQuery(selector).prepend(image);
530        }
531        
532    }
533}
534
535
536

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.