PageSourceSearch

https://www.zavodstil.ru/content/plugins/woocommerce-ajax-filters/js/widget.min.js?ver=1.1.8.1

js zavodstil.ru collected 2026-10-07 17:50:44 UTC 32,301 bytes, 712 lines download raw bytes

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

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.