PageSourceSearch

https://ako-tazit-kryptomeny.sk/wp-content/plugins/woocommerce-pro…/step_filer/js/step_filter.js?ver=1.4.3.1

js ako-tazit-kryptomeny.sk collected 2026-10-04 21:49:24 UTC 18,601 bytes, 544 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    jQuery('.woof_container_inner select').on('change',function(){
154        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
155            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
156        }else{
157            jQuery('.woof_step_filter_next').prop( "disabled", true );
158        }  
159    });
160  
161    jQuery('.woof_step_filter_current').on('click',function(){
162	var _this = this;
163	  
164	setTimeout(function(){
165	    
166	    if(woof_step_filter_check_state(_this).has){
167		jQuery('.woof_step_filter_next').prop( "disabled", false ); 
168	    }else{
169		jQuery('.woof_step_filter_next').prop( "disabled", true );
170	    }	    
171	}, 300);
172
173    });
174
175	jQuery('.woof_step_filter_current [type="checkbox"]').on('change', function (event) {
176        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
177            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
178        }else{
179            jQuery('.woof_step_filter_next').prop( "disabled", true );
180        }  
181    });
182    jQuery('.woof_step_filter_current [type="radio"]').on('change', function (event) {
183        if(woof_step_filter_check_state(jQuery(this).parents(".woof_step_filter_current")).has){
184            jQuery('.woof_step_filter_next').prop( "disabled", false ); 
185        }else{
186            jQuery('.woof_step_filter_next').prop( "disabled", true );
187        }  
188    });
189    
190    if(woof_step_filter_check_state(curr_el).has){
191        jQuery('.woof_step_filter_next').prop( "disabled", false );
192    }else{
193        jQuery('.woof_step_filter_next').prop( "disabled", true ); 
194    }
195
196    if(jQuery(curr_el).next('.woof_submit_search_form_container').length){
197        jQuery('.woof_step_filter_next').prop( "disabled", true );
198        woof_autosubmit=1;
199        woof_ajax_redraw = 1;
200        
201        if(jQuery('.woof_step').data('autosubmit')){
202            woof_ajax_redraw = 0; 
203        }
204                
205    }else{
206        woof_autosubmit=0;  
207    }
208
209
210    
211    if(jQuery(curr_el).is(":first-child")){
212        jQuery('.woof_step_filter_prev').prop( "disabled", true );
213    }else{
214        jQuery('.woof_step_filter_prev').prop( "disabled", false );
215    }
216
217    if(!curr_el.length){       
218
219        var prev_btn = jQuery('.woof_step .woof_step_filter_prev').clone();
220        var isset_btn=jQuery('.woof_step .woof_submit_search_form_container').find('.woof_step_filter_prev');
221        if(!isset_btn.length){
222            prev_btn.prependTo('.woof_step .woof_submit_search_form_container'); 
223        }
224               
225        jQuery('.woof_step_next_back_btn').hide();
226            //turbo
227            if(typeof WoofTurboMode!='undefined'){
228               woof_step_autosubmit=1;
229                woof_step_filter_submit();        
230            }
231            //turbo     
232        
233    }else{
234        jQuery('.woof_step .woof .woof_submit_search_form_container').hide();
235        jQuery('.woof_step_next_back_btn').show(); 
236        jQuery('.woof_step .woof_submit_search_form_container .woof_step_filter_prev').remove();
237    }
238    
239}
240
241function woof_step_filter_check_items(type){
242    var items=jQuery('.woof_step .woof .woof_container:not(".woof_container.woof_turbo_hide")');
243    
244    var woof_current_values_temp={};
245    var hide=false;
246    var first=0;
247
248
249    //turbo
250    if(typeof WoofTurboMode!='undefined'){
251       jQuery(items).removeClass('woof_step_filter_current');
252    }   
253    
254    jQuery.each(items, function(i,item){
255        if(type==1){
256            jQuery(item).addClass('woof_step_hide');
257        }else if(type==2){
258            
259            if(i!=0 && hide){
260                jQuery(item).addClass('woof_step_hide');
261            }else{
262                jQuery(item).removeClass('woof_step_hide');
263            }                       
264        }
265  
266        var stat = woof_step_filter_check_state(item);    
267
268        if(!stat.has){
269            hide=true;
270            first++;
271            if(first==1){
272                jQuery(item).addClass('woof_step_filter_current');
273                jQuery(item).removeClass('woof_step_hide');
274            }
275            
276        }  
277        
278        if(!hide && stat.key){
279            jQuery.each(stat.key,function(i,val){
280                if(woof_current_values[val]){
281                    woof_current_values_temp[val] = woof_current_values[val];
282                }
283            });
284            if(woof_current_values['page']!=undefined){
285               woof_current_values_temp['page'] = woof_current_values['page']; 
286            }
287            if(woof_current_values['paged']!=undefined){
288               woof_current_values_temp['paged'] = woof_current_values['paged']; 
289            }
290            if(woof_current_values['orderby']!=undefined){
291               woof_current_values_temp['orderby'] = woof_current_values['orderby'];
292            }
293            if(woof_current_values['order']!=undefined){
294               woof_current_values_temp['order'] = woof_current_values['order']; 
295            }
296                 
297        }
298
299        if(type==2){
300           
301            if(jQuery('.woof_step_filter_current').next('.woof_submit_search_form_container').length){
302             
303                jQuery('.woof_step_filter_current').on('click', function(){                   
304                    woof_step_autosubmit=1;
305                    woof_ajax_redraw = 0;
306                }); 
307            }
308            //turbo
309            if(typeof WoofTurboMode!='undefined'){            
310                if(jQuery('.woof_step_filter_current').nextAll(".woof_container:not('.woof_container.woof_turbo_hide')").length==0){
311                   
312                    jQuery('.woof_step_filter_current').on('click',function(){                   
313                        woof_step_autosubmit=1;
314                        woof_ajax_redraw = 1;
315                        woof_step_filter_submit();
316                    }); 
317                }
318            }        
319        }
320		
321        var curr_el = jQuery('.woof_step_filter_current:not(".woof_container.woof_turbo_hide")');
322
323        if(jQuery(curr_el).length==0){	
324                if(jQuery(woof_step_pre_autosubmit).data('css-class')==jQuery(".woof_step.woof_autosubmit").find(".woof_container").last().data('css-class')){
325                        woof_step_autosubmit=1;
326                        woof_step_filter_submit();
327                }				
328        }else{			
329                woof_step_pre_autosubmit=curr_el
330        }		
331		
332        if(!hide && i == items.length-1){  
333            
334            if(typeof WoofTurboMode!='undefined' && type==2){
335                woof_step_autosubmit=1;
336            }
337            
338            woof_step_filter_submit();
339            
340        }
341
342                
343    });
344    woof_current_values=woof_current_values_temp;    
345    
346    woof_step_filter_image(); 
347    
348}
349
350function woof_step_filter_check_items_(){
351    
352    var items=jQuery('.woof_step .woof .woof_container');
353    var woof_current_values_temp={};
354    var hide=false;
355    var first=0;
356    jQuery.each(items, function(i,item){
357        if(i!=0 && hide){
358            jQuery(item).addClass('woof_step_hide');
359        }else{
360            jQuery(item).removeClass('woof_step_hide');
361        }   
362
363        var stat = woof_step_filter_check_state(item);
364        
365        if(!stat.has){
366            hide=true;
367            first++;
368            if(first==1){
369                jQuery(item).addClass('woof_step_filter_current');
370            }
371            
372        }  
373        
374        
375        if(!hide && stat.key){
376            jQuery.each(stat.key,function(i,val){
377                if(woof_current_values[val]){
378                    woof_current_values_temp[val] = woof_current_values[val];
379                }
380            });
381            if(woof_current_values['page']!=undefined){
382               woof_current_values_temp['page'] = woof_current_values['page']; 
383            }
384            if(woof_current_values['paged']!=undefined){
385               woof_current_values_temp['paged'] = woof_current_values['paged']; 
386            }
387            if(woof_current_values['orderby']!=undefined){
388               woof_current_values_temp['orderby'] = woof_current_values['orderby'];
389            }
390            if(woof_current_values['order']!=undefined){
391               woof_current_values_temp['order'] = woof_current_values['order']; 
392            }
393                 
394        }
395        
396        if(!hide && i == items.length-1){           
397            woof_step_filter_submit();
398
399        }
400
401                
402    });
403    woof_current_values=woof_current_values_temp;
404            
405}
406
407function woof_step_filter_check_state(_this){
408    var stat={
409       has:false,
410       key:[],
411    };
412
413    jQuery.each(woof_current_values, function(i,item){
414	
415        if(i=='min_price'|| i=='max_price'){
416	     
417            if(jQuery(_this).hasClass('woof_price_filter')){     
418                stat.has = true;
419                stat.key = ['min_price','max_price']; 
420            }
421        }else if(i=='min_rating'|| i=='max_rating'){
422            if(jQuery(_this).hasClass('woof_by_rating_container')){               
423                stat.has = true;
424                stat.key = ['min_rating','max_rating'];
425            }
426            
427        }else if(jQuery(_this).hasClass(('woof_container_'+i))){
428	   
429                stat.has = true;
430                stat.key = [i];
431                
432                if(jQuery(_this).hasClass("woof_container_select_hierarchy")){
433                    if(jQuery(_this).find(".woof_block_html_items select:last").val()==0){
434                        stat.has = false;
435                        stat.key = [];
436                    }
437                }
438        }
439    });
440    return stat;
441}
442function woof_step_filter_delete_filter_data(_this){
443    var key=[];
444    if(!jQuery(_this).hasClass('woof_container')){
445        _this=jQuery(_this).prev();
446    }
447    jQuery.each(woof_current_values, function(i,item){
448        
449        if(i=='min_price'|| i=='max_price'){
450            if(jQuery(_this).hasClass('woof_price_filter')){               
451                key = ['min_price','max_price'];
452            }
453            if(jQuery(_this).hasClass('woof_price_filter')){               
454                key = ['min_price','max_price'];
455            }
456
457        }else if(i=='min_rating'|| i=='max_rating'){
458            if(jQuery(_this).hasClass('woof_by_rating_container')){               
459                key = ['min_rating','max_rating'];
460            }
461            
462        }else if(jQuery(_this).hasClass(('woof_container_'+i))){
463                key = [i];
464        }
465    });
466    return key;
467}
468
469function woof_step_filter_submit(){
470    
471    if(jQuery('.woof_step').data('autosubmit') && woof_step_autosubmit){
472        if(typeof WoofTurboMode=='undefined'){
473            jQuery('.woof_submit_search_form_container').hide();
474        }
475
476        woof_submit_link_locked = false;
477
478        woof_ajax_redraw = 0; 
479        
480        woof_step_autosubmit=0;
481	woof_step_pre_autosubmit={};
482        
483        woof_submit_link_locked = false;
484        woof_submit_link(woof_get_submit_link());
485
486       
487    }else{
488        woof_ajax_redraw = 1;
489        jQuery('.woof_step .woof .woof_submit_search_form').on('click', function(){
490            woof_ajax_redraw = 0;
491            //turbo
492            if(typeof WoofTurboMode!='undefined'){
493                woof_submit_link_locked= false;
494                woof_submit_link(woof_get_submit_link());
495                return false;
496            }
497            //turbo
498        })
499        
500        jQuery('.woof_submit_search_form_container').show();
501        jQuery('.woof_step .woof .woof_submit_search_form').show();
502    }
503    
504    
505}
506
507function woof_step_filter_image(){
508    jQuery('.woof_step_filter_image').remove();
509    var image_input=jQuery("input.woof_step_filter_images");
510    var image="";
511    if(image_input.length){
512        var behavior= jQuery(image_input).data("behavior");
513        var selector= jQuery(image_input).data("selector");
514        var images=JSON.parse(atob(jQuery(image_input).val())); 
515        
516        var current_item=jQuery(".woof_step_filter_current");
517        if(jQuery(current_item).hasClass('woof_price_filter')){
518            if(typeof images['by_price']!='undefined'){
519                image=images['by_price'];
520            }
521        }else if(typeof images['by_rating']!='undefined'){
522            if(typeof images['by_rating']!='undefined'){
523                image=images['by_rating'];
524            }                           
525        }else{
526            jQuery.each(images,function(key,img){
527
528                if(jQuery('.woof_container_'+key).hasClass("woof_step_filter_current")){
529                   
530                    image=img;
531                }
532            });
533        }
534        if("append"==behavior){
535            jQuery(selector).append(image);
536        }else{
537            jQuery(selector).prepend(image);
538        }
539        
540    }
541}
542
543
544

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.