PageSourceSearch

https://www.ackerman.pl/plug/woocommerce-ajax-filters/js/widget.min.js

js ackerman.pl collected 2026-10-08 08:45:15 UTC 31,708 bytes, 711 lines download raw bytes

1/* packer link http://dean.edwards.name/packer/ */
2
3
4(function ($){
5    $(document).ready(function (){
6    	
7		
8
9        var berocket_aapf_widget_product_filters = [],
10            berocket_aapf_widget_product_limits = [],
11            berocket_aapf_widget_product_price_limit = [],
12            woocommerce_pagination_page = 1,
13            berocket_aapf_widget_wait_for_button = false,
14            berocket_aapf_widget_selected_filters = [],
15            berocket_aapf_widget_first_page_jump = true,
16            berocket_aapf_widget_scroll_shop_top = the_ajax_script.scroll_shop_top;
17
18        if( $('.woocommerce-pagination').hasClass('.woocommerce-pagination') ){
19            woocommerce_pagination_page = parseInt( $('.woocommerce-pagination .current').first().text() );
20            if( woocommerce_pagination_page < 1 ) woocommerce_pagination_page = 1;
21        }
22
23        if( $('.berocket_aapf_widget_update_button').hasClass('berocket_aapf_widget_update_button') ){
24            berocket_aapf_widget_wait_for_button = true;
25        }
26
27        function berocket_fire( func ){
28            if ( typeof the_ajax_script.user_func != 'undefined'
29                && the_ajax_script.user_func != null
30                && typeof func != 'undefined'
31                && func.length > 0
32            ) {
33                eval( func );
34            }
35        }
36
37        function update_selected_area() {
38            if ( ! $('.berocket_aapf_widget_selected_area').hasClass('berocket_aapf_widget_selected_area') ) {
39                return false;
40            }
41            tmp_html = '';
42            prev_label = '';
43            el_type = '';
44            $(berocket_aapf_widget_selected_filters).each(function (i, $el) {
45                if ( $el.is('select') ) {
46                    label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
47                    option = $el.find('option:selected').text();
48                    el_type = 'select';
49                    el_id = $el.attr('id');
50                } else if ( $el.is('input') ) {
51                    label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
52                    option = $el.closest('li').find('label').text();
53                    el_type = $el.attr('type');
54                    el_id = $el.attr('id');
55                } else if ( $el.hasClass('berocket_filter_slider') ) {
56                    val1 = $('#'+$el.data('fields_1')).val();
57                    val2 = $('#'+$el.data('fields_2')).val();
58                    if ( val1 != $el.data('min') || val2 != $el.data('max') ) {
59                        if ( $el.hasClass('berocket_filter_price_slider') ) {
60                            label = 'Price';
61                        } else {
62                            label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
63                        }
64                    }
65                    el_type = 'slider';
66                    el_id = $el.data('fields_2');
67                    option = val1+' - '+val2;
68                }
69
70                option = '<li><a href="Unselect '+label+'" data-el_type="'+el_type+'" data-el_id="'+el_id+'">'+option+'</a></li>';
71
72                if ( prev_label == '' ) {
73                    tmp_html += '<div><span>'+label+'</span><ul>'+option;
74                } else if ( prev_label == label ) {
75                    tmp_html += option;
76                } else {
77                    tmp_html += '</ul></div><div><span>'+label+'</span><ul>'+option;
78                }
79
80                prev_label = label;
81            });
82
83            if ( tmp_html == '' ) {
84                $('.berocket_aapf_widget_selected_area').html('').hide().prev().hide();
85            } else {
86                tmp_html += '</ul></div>';
87                $('.berocket_aapf_widget_selected_area').html(tmp_html).show().prev().show();
88            }
89        }
90
91        function update_data_containers() {
92            berocket_aapf_widget_product_filters = [];
93            berocket_aapf_widget_selected_filters = [];
94            $('.berocket_aapf_widget li:not(.slider) input, .berocket_aapf_widget li:not(slider) select').each(function (i,o) {
95                $el = $(o);
96
97                if ( $el.is("select") ) {
98                    el_data = $el.find("option:selected").data();
99
100                    var el_show = true;
101                    $(berocket_aapf_widget_product_filters).each(function (i, o) {
102                        if (o[0] == el_data.taxonomy) {
103                            el_show = false;
104                        }
105                    });
106                    if( el_show && $el.val() ){
107                        berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
108                        berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
109                    }
110                } else {
111                    el_data = $el.data();
112                    
113                    var el_show = true;
114                    $(berocket_aapf_widget_product_filters).each(function (i, o) {
115                        if (o[0] == el_data.taxonomy && o[1] == el_data.term_id) {
116                            el_show = false;
117                        }
118                    });
119                    
120                    if (el_show && ($el.is(':checked') || $el.is(':selected'))) {
121                        berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
122                        berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
123                    }
124                }
125            });
126
127            berocket_aapf_widget_product_limits = [];
128            berocket_aapf_widget_product_price_limit = [];
129            $t = $('.berocket_filter_slider');
130            if( $t.hasClass('berocket_filter_slider') ){
131                $t.each(function (i,o){
132                    val1 = $('#'+$(o).data('fields_1')).val();
133                    val2 = $('#'+$(o).data('fields_2')).val();
134                    if( val1 != $(o).data('min') || val2 != $(o).data('max') ){
135                        berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $(o);
136                        if( $(o).hasClass('berocket_filter_price_slider') ){
137                            berocket_aapf_widget_product_price_limit = [val1, val2];
138                        } else {
139                            var add_limit = true;
140                            for( i = 0 ; i < berocket_aapf_widget_product_limits.length ; i++ ) {
141                                if( berocket_aapf_widget_product_limits[ i ][ 0 ] == $(o).data( 'taxonomy' ) ) {
142                                    add_limit = false;
143                                }
144                            }
145                            if( add_limit ) {
146                                berocket_aapf_widget_product_limits[berocket_aapf_widget_product_limits.length] = [$(o).data('taxonomy'), val1, val2];
147                            }
148                        }
149                    }
150                });
151            }
152        }
153
154        function updateProducts ( $force ){
155            if ( typeof $force == 'undefined' ) $force = false;
156            // if we have update_button on the page we must wait for it to be clicked
157            if ( ! $force && berocket_aapf_widget_wait_for_button ) return false;
158
159            // call user func before_update
160            if( the_ajax_script.user_func != null )
161                berocket_fire( the_ajax_script.user_func.before_update );
162            
163            $(the_ajax_script.products_holder_id).addClass('hide_products'); 
164            $('.hide_products').before('<div class="berocket_aapf_widget_loading" />');
165            // return;
166            /*$(the_ajax_script.products_holder_id).addClass('hide_products');
167            $('mproductList').append('<div class="berocket_aapf_widget_loading" />') */
168
169            update_data_containers();
170            update_selected_area();
171
172            args = {
173                    current_language: the_ajax_script.current_language,
174                    terms: berocket_aapf_widget_product_filters,
175                    price: berocket_aapf_widget_product_price_limit,
176                    limits: berocket_aapf_widget_product_limits,
177                    product_cat: the_ajax_script.product_cat,
178                    action: 'berocket_aapf_listener',
179                    orderby: $('.woocommerce-ordering select.orderby').val(),
180                    perPage: $('#pagination_number').val()
181                };
182
183            if( the_ajax_script.seo_friendly_urls && 'history' in window && 'pushState' in history ) {
184                updateLocation( args, true );
185                args.location = location.href;
186            }else{
187                args.location = the_ajax_script.current_page_url;
188
189                cur_page = $('.woocommerce-pagination span.current').first().text();
190                if( prev_page = location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ){
191                    if( ! parseInt( cur_page ) ){
192                        cur_page = prev_page;
193                    }
194                    if(berocket_aapf_widget_first_page_jump && the_aja
194x_script.first_page) {
195                        cur_page = 1;
196                    }
197                    args.location = args.location.replace(/\/?/,"") + "/page/" + cur_page + "/";
198                }else if( prev_page = location.href.replace(/.+paged?=([0-9]+).+/, "$1") ){
199                    if( ! parseInt( cur_page ) ){
200                        cur_page = prev_page;
201                    }
202                    if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page)   {
203                        cur_page = 1;
204                    }
205                    args.location = args.location.replace(/\/?/,"") + "/?page=" + cur_page + "";
206                }
207                if( the_ajax_script.seo_friendly_urls ) {
208                    uri_request = updateLocation(args, false);
209                    location.hash = '';
210                    if( parseInt( cur_page ) )
211                        location.hash = "paged="+parseInt( cur_page )+"&";
212                    if( uri_request != "")
213                        uri_request = 'filters=' + uri_request;
214                    location.hash += 'filters=('+uri_request+')';
215                }
216            }
217
218            if( berocket_aapf_widget_scroll_shop_top ) {
219             /*   var top_scroll_offset = 0;
220                if( $( the_ajax_script.products_holder_id ).length ) {
221                    top_scroll_offset = $( the_ajax_script.products_holder_id ).offset().top - 180;
222                    if(top_scroll_offset < 0) top_scroll_offset = 0;
223                }
224                $("html, body").animate({ scrollTop: top_scroll_offset }, "slow"); */
225            }
226            args.location = updateLocation(args, true, true);
227            if(the_ajax_script.ajax_request_load) {
228                if( args.location.indexOf('?') > 0 ) {
229                    url = args.location+'&explode=explode&perPage=' + args.perPage;
230                } else {
231                    url = args.location+'/?explode=explode&perPage=' + args.perPage;
232                }
233            } else {
234                url = the_ajax_script.ajaxurl;
235            }
236            if(the_ajax_script.ajax_request_load) {
237                new_args = {
238                    location: args.location
239                };
240            }
241            else
242            {
243                new_args = args;
244            }
245            
246            $.post(url, new_args, function (data) {
247                $('.woocommerce-result-count').remove();
248                $('.woocommerce-pagination').remove();
249                $('form.woocommerce-ordering').remove();
250                $('#content .berocket_lgv_widget').remove();
251                $('#content .br_lgv_product_count_block').remove();
252
253                // call user func on_update
254                if( the_ajax_script.user_func != null )
255                    berocket_fire( the_ajax_script.user_func.on_update );
256
257                if ( $('.woocommerce-info').hasClass('woocommerce-info') && ! $(the_ajax_script.products_holder_id).is(':visible') ) {
258                    if ( typeof data.products != 'undefined' ) {
259                        $('.woocommerce-info').replaceWith(data.products);
260                    }
261                } else {
262                    if ( typeof data.no_products != 'undefined' ) {
263                        $(the_ajax_script.products_holder_id).html(data.no_products).removeClass('hide_products');
264                    } else {
265                        $(the_ajax_script.products_holder_id).replaceWith(data.products).removeClass('hide_products');
266                    }
267                }
268
269                $('.berocket_aapf_widget_loading').remove();
270
271                berocket_aapf_widget_first_page_jump = true;
272                aapf_action_init();
273
274                // call user func after_update
275                if( the_ajax_script.user_func != null )
276                    berocket_fire( the_ajax_script.user_func.after_update );
277            }, "json");
278        }
279
280        
281       
282        
283        $('#updateProductButton').click(function() {
284        	updateProducts(true);
285        });
286       
287        
288
289
290        function updateLocation( args, pushstate, return_request ){
291            if(typeof return_request == 'undefined') return_request = false;
292            uri_request_array = [];
293            uri_request = '';
294            temp_terms = [];
295
296            if( args.orderby && the_ajax_script.default_sorting != args.orderby ){
297                uri_request += 'order-'+args.orderby;
298            }
299            if( args.product_cat && args.product_cat > 0 ){
300                if( uri_request ) uri_request += "|";
301                uri_request += 'pcategory-'+args.product_cat;
302            }
303            if( args.price ){
304                $price_obj = $('.berocket_filter_price_slider');
305                if( args.price[0] && args.price[1] && ( args.price[0] != $price_obj.data('min') || args.price[1] != $price_obj.data('max') ) ){
306                    if( uri_request ) uri_request += "|";
307                    uri_request += 'price['+args.price[0]+'_'+args.price[1]+']';
308                }
309            }
310
311            if( args.limits ){
312                $(args.limits).each(function (i,o){
313                    if( !in_array( o[0].substring(3), temp_terms ) ){
314                        temp_terms[temp_terms.length] = o[0].substring(3);
315                    }
316                    if( typeof uri_request_array[in_array( o[0].substring(3), temp_terms )] == 'undefined' ) {
317                        uri_request_array[in_array(o[0].substring(3), temp_terms)] = [];
318                    }
319
320                    uri_request_array[in_array( o[0].substring(3), temp_terms )]
321                        [uri_request_array[in_array( o[0].substring(3), temp_terms )].length] = [o[1],o[2]];
322                });
323            }
324            if( args.terms ){
325                $(args.terms).each(function (i,o){
326                    if( !in_array( o[0].substring(3), temp_terms ) ){
327                        temp_terms[temp_terms.length] = o[0].substring(3);
328                    }
329                    if( typeof uri_request_array[in_array( o[0].substring(3), temp_terms )] == 'undefined' ) {
330                        uri_request_array[in_array(o[0].substring(3), temp_terms)] = [];
331                    }
332
333                    uri_request_array[in_array( o[0].substring(3), temp_terms )]
334                        [uri_request_array[in_array( o[0].substring(3), temp_terms )].length] = [o[1],o[2]];
335                });
336            }
337
338            var uri = the_ajax_script.current_page_url;
339
340            if( uri_request_array.length ){
341                $(uri_request_array).each(function (i,o){
342                    if( uri_request ) uri_request += "|";
343
344                    if( typeof o != 'object' ){
345                        uri_request += o;
346                    }else{
347                        cnt_oo = false;
348                        uri_request += temp_terms[i]+'[';
349
350                        $(o).each(function (ii,oo){
351                            if( ( oo[1] == 'AND' || oo[1] == 'OR' ) ){
352                                if( cnt_oo ){
353                                    if(oo[1] == 'AND'){
354                                        uri_request += '+';
355                                    }else{
356                                        uri_request += '-';
357                                    }
358                                }
359                            }else{
360                                oo[0] += '_'+oo[1];
361                            }
362                            uri_request += oo[0];
363                            cnt_oo = true;
364                        });
365                        uri_request += ']'
366                    }
367                });
368            }
369
370            if( !pushstate ) {
371                return uri_request;
372            }
373
374            cur_page = $('.woocommerce-pagination span.current').first().text();
375            if( prev_page = parseInt( location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ) ){
376                if( ! parseInt( cur_page ) ){
377                    cur_page = prev_page;
378                }
379                if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page)   {
380                    cur_page = 1;
381                }
382                uri = uri.replace(/\/?$/,"") + "/page/" + cur_page + "/";
383                if( uri_request ){
384                    uri = uri + "?filters=" + uri_request;
385                }
386            }else{
387                something_added = false;
388                if( /\?/.test(location.href) ){
389                    passed_vars1 = location.href.split('?');
390                    if( passed_vars1[1] ){
391                        passed_vars2 = [];
392                        temp2 = [];
393                        if( /&/.test(passed_vars1[1]) ) {
394                            passed_vars2 = passed_vars1[1].split('&');
395                            passed_vars2_length = passed_vars2.length;
396                            for ( k = 0; k < passed_vars2_length; k++ ){
397                                temp = passed_vars2[k].split('=');
398                                passed_vars2[k] = [];
399                                passed_vars2[k][0] = temp.shift();
400                                passed_vars2[k][1] = temp.join("=");
401                            }
402                        }else{
403                            passed_vars2[0] = [];
404                            temp = passed_vars1[1].split('=');
405                            passed_vars2[0][0] = temp.shift();
406                            passed_vars2[0][1] = temp.join("=");
407                        }
408                        for ( k = 0; k < passed_vars2.length; k++ ){
409                            if( passed_vars2[k][0] == 'filters' || passed_vars2[k][0] == 'page'  || passed_vars2[k][0] == 'paged' ) continue;
410
411                            if( something_added ) uri += '&';
412                            else                  uri += '/?';
413
414                            uri += passed_vars2[k][0]+'='+passed_vars2[k][1];
415                            something_added = true;
416                        }
417                    }
418                }
419                if(berocket_aapf_widget_first_page_jump && the_ajax_script.first_page) {
420                    cur_page = 1;
421                }
422                if( something_added && uri_request ){
423                    uri = uri + "&filters=" + uri_request;
424                    if( cur_page > 1 ){
425                        uri = uri + "&paged=" + parseInt( cur_page );
426                    }
427                }else if( uri_request ){
428                    uri = uri + "/?filters=" + uri_request;
429                    if( cur_page > 1 ){
430                        uri = uri + "&paged=" + parseInt( cur_page );
431                    }
432                }else if( something_added && cur_page > 1 ){
433                    uri = uri + "&paged=" + parseInt( cur_page );
434                }else if( cur_page > 1 ){
435                    uri = uri + "/?paged=" + parseInt( cur_page );
436                }
437            }
438
439            if( return_request ) {
440                return uri;
441            } else {
442                var stateParameters = { BeRocket: "Rules" };
443                history.pushState(stateParameters, "BeRocket Rules", uri);
444                history.pathname = uri;
445            }
446        }
447
448        function aapf_action_init(){
449            // Take control over (default) pagination and sorting, make it AJAXy and work with filters
450            $('.woocommerce-pagination').on('click', 'a', function (event) {
451                event.preventDefault();
452                if ( $(this).hasClass('next') ) {
453                	// jeżeli następna
454                	$('.woocommerce-pagination span.current').first().parent('li').next('li').children('a').focus();               	
455                    _next_page = parseInt( $('.woocommerce-pagination span.current').first().text() ) + 1;
456                } else if ( $(this).hasClass('prev') ) {
457                	$('.woocommerce-pagination span.current').first().parent('li').prev('li').children('a').focus();  
458                    _next_page = parseInt( $('.woocommerce-pagination span.current').first().text() ) - 1;
459                } else {
460                    _next_page = $(this).text();
461                }
462                $('.woocommerce-pagination span.current').removeClass('current');
463                $(this).after('<span class="page-numbers current" style="visibility:hidden">'+_next_page+"</span>");
464              //  $( ".woocommerce-pagination ul li:nth-child("+_next_page+")" ).addClass('current');
465                berocket_aapf_widget_first_page_jump = false;
466                
467                updateProducts(true);
468            });
469        }
470
471        function in_array(needle, haystack, strict) {
472            var found = false, key, strict = !!strict;
473            for (key in haystack) {
474                if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
475                    found = key;
476                    break;
477                }
478            }
479            return found;
480        }
481
482        $('.berocket_aapf_widget').on("change", "input, select", function(){
483        	/*   input zmienianie */
484        	
485        	
486        	var min = $('input[name=min]').val();
487        	var max = $('input[name=max]').val();
488        	if(min > max){
489        		var temp = max;
490        		max = min;
491        		min = temp;
492        	}
493        	
494        	$( ".berocket_filter_slider" ).slider({
495        		values: [ min, max ]
496        	});
497        	
498    
499        	
500        	
501            if($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio')
502            {
503                $label = $(this).parents('li').find('.berocket_label_widgets');
504                if( $label.parents('li').find('input').prop('checked')) {
505                    $('.'+$label.attr('for')).prop('checked', false);
506                    $('.'+$label.attr('for')).parents('li').removeClass('berocket_hide_sel_value');
507                } else {
508                    $('.'+$label.attr('for')).prop('checked', true);
509                    if( $label.parents('li').find('input').attr('type') == 'radio' ) {
510                        $('.'+$label.attr('for')).parents('.berocket_aapf_widget').find('li').removeClass('berocket_hide_sel_value');
511                    }
512                    if( the_ajax_script.hide_sel_value ) {
513                        $('.'+$label.attr('for')).parents('li').addClass('berocket_hide_sel_value');
514                    }
515                    $label.addClass('berocket_checked');
516                }
517                $('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
518                if( the_ajax_script.hide_sel_value ) {
519                    $hiden_objects = $(this).parents('.berocket_aapf_widget').find('.berocket_hide_o_value, .berocket_hide_sel_value');
520                    if( $hiden_objects.length == 0 ) {
521                        $(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').hide();
522                    } else {
523                        $(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').show();
524                    }
525                }
526                
527                if($(this).prop('checked'))
528                {
529                    $('.'+$label.attr('for')).prop('checked', true).trigger('refresh');
530                    if( the_ajax_script.hide_sel_value ) {
531                        $('.'+$label.attr('for')).parents('li').addClass('berocket_hide_sel_value');
532                    }
533                }
534                else
535                {
536                    $('.'+$label.attr('for')).prop('checked', false).trigger('refresh').parents('li').removeClass('berocket_hide_sel_value');
537                }
538            } else if($(this).is('select'))
539            {
540                $('select.'+$(this).data('taxonomy')).val($(this).find('option:selected').val()).trigger('refresh');
541            }
542
543        });
544
545        $( ".berocket_filter_slider" ).each(function (i,o){
546            $(o).slider({
547                range: true,
548                min: parseFloat($(o).data('min')),
549                max: parseFloat($(o).data('max')),
550                values: [$(o).data('value1'),$(o).data('value2')],
551                slide: function( event, ui ) {
552                    $o = $(ui.handle).parents('div.berocket_filter_slider');
553                    vals = ui.values;
554                    if( $(o).hasClass('berocket_filter_price_slider') ){
555                        vals[0] = vals[0].toFixed(2);
556                        vals[1] = vals[1].toFixed(2);
557                    }
558                    $( '#'+$o.data('fields_1') ).val( vals[0] );
559                    $( '#'+$o.data('fields_2') ).val( vals[1] );
560
561                    $('.slide div').each(function(i, obj)
562                    {
563                        if($(obj).data('taxonomy') == $(o).data('taxonomy'))
564                        {
565                            $(obj).slider("values", vals);
566                            $( '#'+$(obj).data('fields_1') ).val( vals[0] );
567                            $( '#'+$(obj).data('fields_2') ).val( vals[1] );
568                        }
569                    });
570                },
571            });
572        });
573
574        $(".berocket_aapf_widget_height_control").each(function (i,o){
575            $(o).mCustomScrollbar({
576                axis: "xy",
577                theme: $(o).data('scroll_theme'),
578                scrollInertia: 300
579            });
580        });
581
582        $(".berocket_aapf_widget_selected_area").on('click', 'a', function (event){
583            event.preventDefault();
584            $obj = $(this);
585            el_type = $obj.data('el_type');
586            if ( el_type == 'checkbox' ) {
587                $('#'+$obj.data('el_id')+'-styler').click();
588            } else if ( el_type == 'radio' ) {
589                $('#'+$obj.data('el_id')+'-styler').reset();
590            } else if ( el_type == 'select' ) {
591                $('#'+$obj.data('el_id')+' option:selected').prop('checked', false);
592            } else if ( el_type == 'slider' ) {
593                $slider = $('#'+$obj.data('el_id')).closest('li').find('.berocket_filter_slider');
594
595                val1 = parseFloat($slider.data('min'));
596                val2 = parseFloat($slider.data('max'));
597
598                if( $slider.hasClass('berocket_filter_price_slider') ){
599                    val1 = val1.toFixed(2);
600                    val2 = val2.toFixed(2);
601                }
602
603                $( '#'+$slider.data('fields_1') ).val( val1 );
604                $( '#'+$slider.data('fields_2') ).val( val2 );
605
606                $slider.slider( "values", [ val1, val2 ] );
607
608                updateProducts();
609            }
610        });
611
612        // Option to take control over (default) sorting, make it AJAXy and work with filters
613        if( the_ajax_script.control_sorting ) {
614            $(document).on('submit', 'form.woocommerce-ordering', function (event) {
615                event.preventDefault();
616            });
617            $(document).on('change', 'select.orderby', function (event) {
618                event.preventDefault();
619                updateProducts(true);
620            });
621        }
622
623        aapf_action_init();
624
625        $(document).on('click', '.berocket_aapf_widget_update_button', function (event) {
626            event.preventDefault();
627            updateProducts(true);
628        });
629
630        update_data_containers();
631        update_selected_area();
632
633        $(document).on('click', '.berocket_label_widgets', function(event) {
634            if( $(this).prev('input').attr('type') == 'checkbox' || $(this).prev('input').attr('type') == 'radio' ) {
635                event.preventDefault();
636                event.stopPropagation();
637                $(this).prev('input').trigger('change');
638            }
639        });
640
641        $('.berocket_aapf_widget .berocket_widget_show_values').click(function(event)
642        {
643            event.preventDefault();
644            var widget_block = $(this).parents('ul.berocket_aapf_widget');
645            if(widget_block.hasClass('show_o_sel_values'))
646            {
647                widget_block.removeClass('show_o_sel_values');
648                $(this).find('span').removeClass('hide_button').addClass('show_button');
649            }
650            else
651            {
652                widget_block.addClass('show_o_sel_values');
653                $(this).find('span').removeClass('show_button').addClass('hide_button');
654            }
655        });
656    });
657})(jQuery);
658
659function load_hash_test() {
660    hash = location.hash;
661    if( location.hash != "")
662        location.hash = "";
663    test_loc = location.href;
664    reload = false;
665    var filtersRegex = /filters=\((.*)\)/;
666    if( ( filters_hash = filtersRegex.exec(hash) ) != null ) {
667        if( test_loc.indexOf('?') != -1 ) {
668            href_param = test_loc.split('?');
669            if(href_param[1].indexOf('filters=') != -1) {
670                href_params_array = href_param[1].split('&');
671                for( var i = 0; i < href_params_array.length; i++ ) {
672                    if( href_params_array[i].indexOf('filters=') != -1) {
673                        test_loc = test_loc.replace(href_params_array[i],filters_hash[1]).replace(/#/,"").replace('&&','&');
674                    }
675                }
676            } else {
677                test_loc = test_loc.replace(/#/,"")+"&"+filters_hash[1];
678            }
679        } else {
680            test_loc = test_loc.replace(/#/,"")+"?"+filters_hash[1];
681        }
682        reload = true;
683    }
684    var filtersRegex = /paged=([0-9]+)/;
685    if( ( filters_hash = filtersRegex.exec(hash) ) != null ) {
686        if( test_loc.indexOf('?') != -1 ) {
687            href_param = test_loc.split('?');
688            if(href_param[1].indexOf('paged=') != -1) {
689                href_params_array = href_param[1].split('&');
690                for( var i = 0; i < href_params_array.length; i++ ) {
691                    if( href_params_array[i].indexOf('filters=') != -1) {
692                        test_loc = test_loc.replace(href_params_array[i],filters_hash[0]).replace(/#/,"").replace('&&','&');
693                    }
694                }
695            } else {
696                test_loc = test_loc.replace(/#/,"")+"&"+filters_hash[0];
697            }
698        } else {
699            test_loc = test_loc.replace(/#/,"")+"?"+filters_hash[0];
700        }
701        reload = true;
702    }
703    if(reload) {
704        location.href = test_loc;
705    }
706
707    
708}
709load_hash_test();
710
711

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.