PageSourceSearch

https://vinkadesign.co.nz/wp-content/plugins/woocommerce-ajax-filt…/assets/frontend/js/widget.min.js?ver=3.2.2

js vinkadesign.co.nz collected 2026-10-10 02:20:22 UTC 76,960 bytes, 1,567 lines download raw bytes

1//Filter functions
2var berocket_filters = {};
3function berocket_make_args_array(args) {
4    var args_array = [];
5    for(var i = 0; i < args.length; i++) {
6        args_array.push(args[i]);
7    }
8    return args_array;
9}
10function berocket_apply_filters(filter_name, filter_element) {
11    if( typeof(berocket_filters[filter_name]) !== 'undefined' ) {
12        var array_args = berocket_make_args_array(arguments);
13        array_args.splice(0, 1);
14        jQuery.each(berocket_filters[filter_name], function(i, callback_data) {
15            filter_element = callback_data.callback.apply(null, array_args);
16            array_args[0] = filter_element;
17        });
18    }
19    return filter_element;
20}
21function berocket_do_action(filter_name) {
22    if( typeof(berocket_filters[filter_name]) !== 'undefined' ) {
23        var array_args = berocket_make_args_array(arguments);
24        array_args.splice(0, 1);
25        jQuery.each(berocket_filters[filter_name], function(i, callback_data) {
26            callback_data.callback.apply(null, array_args);
27        });
28    }
29}
30function berocket_throw_error(error_name) {
31    var filter_name = 'berocket_throw_error';
32    error_exist = true;
33    if( typeof(berocket_filters[filter_name]) !== 'undefined' ) {
34        var array_args = [error_exist];
35        for(var i = 0; i < arguments.length; i++) {
36            array_args.push(arguments[i]);
37        }
38        jQuery.each(berocket_filters[filter_name], function(i, callback_data) {
39            error_exist = callback_data.callback.apply(null, array_args);
40            array_args[0] = error_exist;
41            if( ! error_exist ) {
42                return false;
43            }
44        });
45    }
46    return error_exist;
47}
48function berocket_add_filter(filter_name, callback, priority) {
49    if( typeof(priority) == 'undefined' ) {
50        priority = 10;
51    }
52    if( typeof(berocket_filters[filter_name]) === 'undefined' ) {
53        berocket_filters[filter_name] = [];
54    }
55    var isExist = false;
56    jQuery.each(berocket_filters[filter_name], function(i, callback_data) {
57        if( callback_data.priority === priority && callback_data.callback === callback ) {
58            isExist = true;
59        }
60    });
61    if( ! isExist ) {
62        berocket_filters[filter_name].push({callback:callback, priority:priority});
63        berocket_filters[filter_name] = berocket_sort_by_priority(berocket_filters[filter_name]);
64    }
65}
66function berocket_remove_filter(filter_name, callback, priority) {
67    if( typeof(priority) == 'undefined' ) {
68        priority = 10;
69    }
70    if( typeof(berocket_filters[filter_name]) != 'undefined' ) {
71        var new_array = [];
72        jQuery.each(berocket_filters[filter_name], function(i, callback_data) {
73            if( callback_data.priority !== priority || callback_data.callback !== callback ) {
74                new_array.push(callback_data);
75            }
76        });
77        berocket_filters[filter_name] = berocket_sort_by_priority(new_array);
78    }
79}
80function berocket_sort_by_priority(sorting_array) {
81    if( Array.isArray(sorting_array) ) {
82        sorting_array.sort(function(a, b) {
83            if( a.priority > b.priority ) {
84                return 1;
85            } else if( a.priority < b.priority ) {
86                return -1;
87            }
88            return 0;
89        });
90    }
91    return sorting_array;
92}
93berocket_add_filter('compat_filters_result_single', function(val) {
94    if( typeof( val ) == 'object' && typeof(val.taxonomy) == 'string' && val.taxonomy.substr(0, 3) == 'pa_' ) {
95        val.taxonomy = val.taxonomy.substr(3);
96    }
97    return val;
98});
99
100
101//NEW TEMPLATE 
102
103function berocket_format_number (number, number_style) {
104    if( typeof number_style == 'undefined' ) {
105        number_style = the_ajax_script.number_style;
106    }
107    number = parseFloat(number);
108    if( number === NaN ) {
109        return '0';
110    }
111    var num = number.toFixed(number_style[2]);
112    num = num.toString();
113    var decimal = num.split('.');
114    var new_number = decimal[0];
115    if(num.indexOf('.') != -1)
116    {
117        decimal = decimal[1];
118    }
119    new_number = new_number.replace(/\d(?=(?:\d{3})+(?:$))/g, function($0, i){
120        return $0+number_style[0];
121    });
122    if(num.indexOf('.') != -1)
123    {
124        new_number = new_number+number_style[1]+decimal;
125    }
126    return new_number;
127}
128jQuery(document).trigger('berocket_hooks_ready');
129var braapf_filter_blocked = false,
130//object{taxonomy:"", values:[value:"",html:"name/colorBlock/imgBlock/text"], glue:""}
131braapf_selected_filters = [],
132braapf_filtered_filters = [],
133braapf_filters_var,
134braapf_ajax_request;
135//FUNCTIONS
136var braapf_checkbox_same,
137braapf_update_products,
138braapf_grab_all,
139braapf_grab_single,
140braapf_compact_filters,
141braapf_compat_filters_to_string,
142braapf_build_url_from_urldata,
143braapf_apply_additional_filter_data,
144braapf_glue_by_operator,
145braapf_ajax_load_from_url,
146braapf_ajax_load_from_url_request,
147braapf_init_load,
148braapf_remove_pages_from_url_data,
149braapf_filter_products_by_url,
150braapf_get_current_url_data,
151braapf_reset_buttons_hide,
152bapf_universal_theme_compatibility,
153braapf_disable_ajax_loading,
154braapf_close_tippy,
155braapf_context_is_update,
156braapf_filter_mobile_desktop_filters;
157function braapf_grab_all_init() {braapf_grab_all();}
158function braapf_selected_filters_area_set_init() {braapf_selected_filters_area_set();}
159function braapf_filtered_filters_set() {
160    braapf_filtered_filters = braapf_selected_filters.slice();
161    berocket_do_action('braapf_init_filtered_set', braapf_filtered_filters);
162}
163(function ($){
164    //Main part
165    //Checkbox change script
166    $(document).on("change", ".bapf_sfilter.bapf_ckbox input[type=checkbox]", function(){
167        var value = $(this).val();
168        var taxonomy = $(this).parents('.bapf_sfilter').data('taxonomy');
169        var checked = $(this).prop('checked');
170        braapf_checkbox_same(taxonomy, value, checked);
171        berocket_do_action('input_ckbox_changed', this, taxonomy, value, checked);
172        var filter_changed_element = {
173            element:'#'+$(this).attr('id'),
174            parent: 1,
175            find: false
176        };
177        berocket_apply_filters('filter_changed_element', filter_changed_element, $(this));
178        berocket_do_action('update_products', 'filter', $(this));
179    });
180    braapf_checkbox_same = function (taxonomy, value, checked) {
181        $('.bapf_sfilter[data-taxonomy="'+taxonomy+'"] input[value="'+value+'"]').prop('checked', checked);
182        if( $('.bapf_sfilter[data-taxonomy="'+taxonomy+'"]').length > $('.bapf_sfilter.bapf_ckbox[data-taxonomy="'+taxonomy+'"]').length ) {
183            berocket_throw_error('multiple_filters_for_same_taxonomy', taxonomy);
184        }
185    }
186    $(document).on('braapf_unselect', '.bapf_ckbox', function(event, data) {
187        if( typeof(data) == 'undefined' ) {
188            data = false;
189        }
190        if( data == false ) {
191            var $this = $(this).find('input[type=checkbox]');
192        } else {
193            var $this = $(this).find('input[value="'+data.value+'"]');
194        }
195        if( $this.length > 0 ) {
196            var value = $this.val();
197            var taxonomy = $(this).data('taxonomy');
198            $this.prop('checked', false);
199            braapf_checkbox_same(taxonomy, value, false);
200        }
201    });
202    $(document).on('braapf_unselect_all', '.bapf_ckbox', function(event, data) {
203        $(this).trigger('braapf_unselect', false);
204    });
205    $(document).on('berocket_filters_document_ready', function() {
206        $('.bapf_ckbox input[type=checkbox]:checked').closest('li').parents('li').trigger('bapf_ochild');
207    });
208    //update/reset butons
209    $(document).on('click', '.berocket_aapf_widget_update_button, .bapf_update', function(event) {
210        event.preventDefault();
211        berocket_do_action('update_products', 'update', $(this));
212    });
213    $(document).on('click', '.berocket_aapf_reset_button, .bapf_reset', function(event) {
214        event.preventDefault();
215        braapf_unselect_all();
216        berocket_do_action('update_products', 'reset_all', $(this));
217    });
218    braapf_reset_buttons_hide = function() {
219        if( berocket_apply_filters('bapf_rst_nofltr_hide', (typeof(braapf_filtered_filters) == 'undefined' || braapf_filtered_filters.length <= 0)) ) {
220            $('.bapf_rst_nofltr').hide();
221        } else {
222            $('.bapf_rst_nofltr').show();
223        }
224        var selected = false;
225        if( typeof(braapf_filtered_filters) != 'undefined' && braapf_filtered_filters.length > 0 ) {
226            $.each(braapf_filtered_filters, function(i, taxonomy) {
227                if( taxonomy.values.length > 0 ) {
228                    selected = true;
229                    return false;
230                }
231            });
232        }
233        if( berocket_apply_filters('bapf_rst_sel_show', selected) ) {
234            $('.bapf_rst_sel').show();
235        } else {
236            $('.bapf_rst_sel').hide();
237        }
238    }
239    berocket_add_filter('braapf_init', braapf_reset_buttons_hide, 1500);
240    berocket_add_filter('braapf_init_filtered_set', braapf_reset_buttons_hide, 1500);
241    //Pagination page
242    jQuery(document).ready( function() {
243        var pagination_links = the_ajax_script.pagination_class;
244        pagination_links = pagination_links.replaceAll(',', ' a,');
245        pagination_links = berocket_apply_filters('pagination_links_a_tags', pagination_links+' a', the_ajax_script.pagination_class);
246        if( !the_ajax_script.disable_ajax_loading && the_ajax_script.pagination_ajax && $(the_ajax_script.products_holder_id).length ) {
247            $(document).on('click', pagination_links, function(event) {
248                event.preventDefault();
249                var href = $(this).attr('href');
250                href = berocket_apply_filters('pagination_href_from_clicked_a', decodeURI(href), $(this));
251                braapf_change_url_history_api(href, {replace:the_ajax_script.seo_friendly_urls});
252                berocket_add_filter('ajax_load_from_url_beforeSend', braapf_pagination_prevent_filters_load);
253                braapf_ajax_load_from_url(href, {}, berocket_apply_filters('ajax_load_from_pagination', {done:[braapf_replace_products, braapf_replace_pagination, braapf_replace_result_count, braapf_init_load, braapf_update_data_from_current, braapf_update_seo_elements]}, href));
254            });
255        }
256    });
257    function braapf_pagination_prevent_filters_load(xhr) {
258        berocket_remove_filter('ajax_load_from_url_beforeSend', braapf_pagination_prevent_filters_load);
259        xhr.setRequestHeader('X-Braapfdisable', '1');
260        return xhr;
261    }
262    //Order By override
263    jQuery(document).ready( function() {
264        if( !the_ajax_script.disable_ajax_loading && the_ajax_script.control_sorting ) {
265            $(document).on('submit', the_ajax_script.ordering_class, function(event) {
266                event.preventDefault();
267                var current_url_data = braapf_get_current_url_data();
268                current_url_data = braapf_remove_pages_from_url_data(current_url_data);
269                if( Array.isArray(current_url_data.queryargs) ) {
270                    var newqueryargs = [];
271                    $.each(current_url_data.queryargs, function(i, val) {
272                        if(val.name != 'orderby') {
273                            newqueryargs.push(val);
274                        }
275                    });
276                    current_url_data.queryargs = newqueryargs;
277                } else {
278                    current_url_data.queryargs = [];
279                }
280                var form_data = $(this).serializeArray();
281                if( Array.isArray(form_data) ) {
282                    $.each(form_data, function(i, val) {
283                        if(val.name == 'paged') {
284                            current_url_data.page = parseInt(val.value);
285                        } else if( val.name == 'orderby' ) {
286                            if( the_ajax_script.default_sorting != val.value ) {
287                                current_url_data.queryargs.push(val);
288                            }
289                        } else {
290                            current_url_data.queryargs.push(val);
291                        }
292                    });
293                }
294                var url_filtered = braapf_build_url_from_urldata(current_url_data);
295                braapf_filter_products_by_url(url_filtered);
296            });
297        }
298    });
299    
300    //default update products
301    braapf_get_filters_selected = function() {
302        braapf_grab_all();
303        var compat_filters = braapf_compact_filters();
304        var filter_mask = berocket_apply_filters('braapf_filters_mask', the_aja
304x_script.url_mask);
305        var filter_string = braapf_compat_filters_to_string(compat_filters, filter_mask, the_ajax_script.url_split);
306        return filter_string;
307    }
308    braapf_get_url_with_filters_selected = function() {
309        var filter_string = braapf_get_filters_selected();
310        var current_url_data = braapf_get_current_url_data();
311        current_url_data.filter = filter_string;
312        current_url_data = braapf_remove_pages_from_url_data(current_url_data);
313        current_url_data = braapf_apply_additional_filter_data(current_url_data);
314        var url_filtered = braapf_build_url_from_urldata(current_url_data);
315        return url_filtered;
316    }
317    braapf_update_products = function (context, element) {
318        if( typeof(context) == 'undefined' ) {
319            context = 'filter';
320        }
321        if( typeof(element) == 'undefined' ) {
322            element = false;
323        }
324        context = berocket_apply_filters('before_update_products_context', context, element);
325        var url_filtered = berocket_apply_filters('before_update_products_context_url_filtered', braapf_get_url_with_filters_selected(), context, element);
326        if( berocket_apply_filters('apply_filters_to_page', ($('.berocket_aapf_widget_update_button:visible, .bapf_update:visible').length == 0 || braapf_context_is_update(context)), context, element, url_filtered) ) {
327            braapf_selected_filters_area_set();
328            braapf_filter_products_by_url(url_filtered);
329        } else if( berocket_apply_filters('apply_filters_to_page_partial', false, context, element, url_filtered) ) {
330            braapf_ajax_load_from_url(berocket_apply_filters('before_update_products_context_url_filtered_partial', url_filtered, context, element), {}, berocket_apply_filters('ajax_load_from_filters_partial', {done:[braapf_replace_each_filter, braapf_init_load]}, url_filtered, 'partial'), 'partial');
331        }
332    }
333    
334    braapf_context_is_update = function(context) {
335        return berocket_apply_filters('context_is_update', (context == 'update' || context == 'reset_all' || context == 'reset_single'), context);
336    }
337    braapf_filter_products_by_url = function(url) {
338        if( berocket_apply_filters('page_has_products_holder', (! $(the_ajax_script.products_holder_id).length), url) ) {
339            location.href = url;
340        } else {
341            braapf_change_url_history_api(url, {replace:the_ajax_script.seo_friendly_urls});
342            braapf_ajax_load_from_url(url, {}, berocket_apply_filters('ajax_load_from_filters', {done:[braapf_replace_products, braapf_replace_pagination, braapf_replace_result_count, braapf_replace_orderby, braapf_replace_each_filter, braapf_init_load, braapf_filtered_filters_set, braapf_update_url_history_api_from_current, braapf_update_seo_elements]}, url, 'default'));
343        }
344    }
345    braapf_update_data_from_current = function() {
346        braapf_grab_all();
347        var compat_filters = braapf_compact_filters();
348    }
349    var braapf_update_url_history_api_from_current_action = false;
350    braapf_update_url_history_api_from_current = function(data, textStatus, jqXHR, url, type) {
351        if( the_ajax_script.seo_friendly_urls ) {
352            url_filtered = braapf_get_url_with_filters_selected();
353            braapf_set_manual_scroll_restoration();
354            history.replaceState(history.state, "BeRocket Rules", url_filtered);
355            if( url != url_filtered && the_ajax_script.reload_changed_filters ) {
356                setTimeout(function() {
357                    braapf_filter_products_by_url(url_filtered);
358                }, 5);
359            }
360        }
361    }
362    braapf_filter_mobile_desktop_filters = function(all_filters) {
363        var mobile_width = berocket_apply_filters('filter_mobile_width', 767); 
364        var tablet_width = berocket_apply_filters('filter_tablet_width', 1024);
365        //Hide elements depebnd on devices
366        if( $(window).width() <= mobile_width ) {
367            all_filters = all_filters.filter(function() {
368                return !$(this).is('.bapf_sngl_hd_mobile') && !$(this).parents('.bapf_sngl_hd_mobile').length;
369            });
370        } else if( $(window).width() > mobile_width && $(window).width() <= tablet_width ) {
371            all_filters = all_filters.filter(function() {
372                return !$(this).is('.bapf_sngl_hd_tablet') && !$(this).parents('.bapf_sngl_hd_tablet').length;
373            });
374        } else {
375            all_filters = all_filters.filter(function() {
376                return !$(this).is('.bapf_sngl_hd_desktop') && !$(this).parents('.bapf_sngl_hd_desktop').length;
377            });
378        } 
379        return all_filters;
380    }
381    //Grab filters from page
382    braapf_grab_all = function ($parent) {
383        if( typeof($parent) == 'undefined' ) { $parent = false; }
384        var selected_filters = berocket_apply_filters('before_grab_all_filters', [], $parent);
385        var mobile_width = berocket_apply_filters('filter_mobile_width', 767); 
386        var tablet_width = berocket_apply_filters('filter_tablet_width', 1024); 
387        if( $parent === false ) {
388            var all_filters = $('.bapf_sfilter');
389        } else {
390            var all_filters = $($parent).find('.bapf_sfilter');
391        }
392        all_filters = braapf_filter_mobile_desktop_filters(all_filters);
393        all_filters.each(function() {
394            var single_data = braapf_grab_single(this, selected_filters);
395            if( single_data !== false ) {
396                selected_filters.push(single_data);
397            }
398        });
399        selected_filters = berocket_apply_filters('grab_all_filters', selected_filters, $parent);
400        if( $parent === false ) {
401            braapf_selected_filters = selected_filters;
402        }
403        return selected_filters;
404    }
405    braapf_grab_single = function(element, selected_filters, grab_single) {
406        if( typeof(grab_single) == 'undefined' ) {
407            grab_single = false;
408        }
409        element = $(element);
410        var single_data = false;
411        var exist = false;
412        var taxonomy = element.data('taxonomy');
413        if( typeof(taxonomy) == 'undefined' || ! taxonomy ) {
414            return berocket_apply_filters('grab_single_filter_taxonomy_undefined', single_data, element, selected_filters);
415        }
416        $.each(selected_filters, function(i, val) {
417            if(val.taxonomy == taxonomy ) {
418                exist = true;
419            }
420        });
421        if( ! berocket_apply_filters('grab_single_filter_exist', exist, element, selected_filters) ) {
422            single_data = berocket_apply_filters('grab_single_filter', single_data, element, selected_filters);
423            if( single_data !== false ) return single_data;
424            var operator = element.data('op');
425            var tax_name = element.data('name');
426            if( typeof(tax_name) == 'undefined' ) {
427                tax_name = '';
428            }
429            var glue = braapf_glue_by_operator(operator);
430            var values = [];
431            var values_find = [];
432            if( grab_single ) {
433                var $elements = element;
434            } else {
435                var $elements = $('.bapf_sfilter[data-taxonomy="'+taxonomy+'"]');
436                $elements = braapf_filter_mobile_desktop_filters($elements);
437            }
438            $elements.find('input:checked:not(:disabled)').each(function(i, val) {
439                if( values_find.indexOf($(this).val()) == -1 ) {
440                    values.push({value:$(this).val(), html:$(this).data('name')});
441                    values_find.push($(this).val());
442                }
443            });
444            single_data = {name:tax_name, taxonomy:taxonomy, values:values, glue:glue, operator:operator};
445        }
446        return berocket_apply_filters('grab_single_filter_default', single_data, element, selected_filters, grab_single);
447    }
448    braapf_glue_by_operator = function(operator) {
449        if( typeof(operator) != 'string' ) {
450            operator = '';
451        }
452        var glue = the_ajax_script.operator_or;
453        if( operator.toLowerCase() == 'and' ) {
454            glue = the_ajax_script.operator_and;
455        }
456        return berocket_apply_filters('glue_by_operator', glue, operator);
457    }
458    //compact filters to {taxonomy,values} object
459    braapf_compact_filters = function(filters_start) {
460        if( typeof(filters_start) == 'undefined' ) {
461            filters_start = braapf_selected_filters;
462        }
463        var filters = [];
464        $.each(filters_start, function(i, val) {
465            var values_str = '';
466            if( typeof(val.customValuesLine) != 'undefined' ) {
467                values_str = val.customValuesLine;
468            } else {
469                $.each(val.values, function(i2, val2) {
470                    if( values_str.length ) {
471                        values_str += val.glue;
472                    }
473                    values_str += val2.value;
474                });
475            }
476            if( values_str.length ) {
477                filters.push(berocket_apply_filters('compat_filters_result_single', {taxonomy:val.taxonomy, values:values_str}, val));
478            }
479        });
480        return berocket_apply_filters('compat_filters_result', filters, filters_start);
481    }
482    //Compact all filters to single string
483    braapf_compat_filters_to_string = function (compat_filters, filter_mask, glue_between_taxonomy) {
484        var filters_string = '';
485        $.each(compat_filters, function(i, val) {
486            if( filters_string.length ) {
487                filters_string += glue_between_taxonomy;
488            }
489            var single_string = filter_mask;
490            single_string = single_string.replace('%t%', val.taxonomy);
491            single_string = single_string.replace('%v%', val.values);
492            filters_string += berocket_apply_filters('compat_filters_to_string_single', single_string, val, compat_filters, filter_mask, glue_between_taxonomy);
493        });
494        return berocket_apply_filters('compat_filters_to_string', filters_string, compat_filters, filter_mask, glue_between_taxonomy);
495    }
496    //get object with information about currentUrl/sendedUrl
497    braapf_get_current_url_data = function(url) {
498        if( typeof(url) == 'undefined' ) {
499            var link = location.href.split('#')[0].split('?')[0],
500                query = location.search.substring(1);
501        } else {
502            var link = url.split('#')[0].split('?')[0];
503            if( url.split('#')[0].split('?').length > 1 ) {
504                var query = url.split('#')[0].split('?')[1];
505            } else {
506                var query = '';
507            }
508        }
509        var query_arr = [],
510            page = 1,
511            string_regex = the_ajax_script.pagination_base+'\\/(\\d+)/?',
512            regex_var = new RegExp(string_regex),
513            search_page = link.match(regex_var);
514        if( search_page && typeof(search_page[1]) == 'string' ) {
515            page = parseInt(search_page[1]);
516            link = link.replace(regex_var, '');
517        }
518        query = query.split('&');
519        $.each(query, function(i, val) {
520            if( val.length ) {
521                query[i] = val.split('=');
522                if( query[i][0] == 'paged' ) {
523                    page = parseInt(query[i][1]);
524                } else {
525                    query_arr.push({name:query[i][0], value: query[i][1]});
526                }
527            }
528        });
529        return berocket_apply_filters('get_current_url_data', {baselink:link, queryargs:query_arr, filter:"", page:page}, url, query);
530    }
531    braapf_remove_pages_from_url_data = function(url_data) {
532        url_data.page = 1;
533        if( Array.isArray(url_data.queryargs) ) {
534            var newqueryargs = [];
535            $.each(url_data.queryargs, function(i, val) {
536                if(val.name != 'product-page') {
537                    newqueryargs.push(val);
538                }
539            });
540            url_data.queryargs = newqueryargs;
541        }
542        url_data = berocket_apply_filters('braapf_remove_pages_from_url_data', url_data);
543        return url_data;
544    }
545    braapf_apply_additional_filter_data = function (url_data, filters_start) {
546        if( typeof(filters_start) == 'undefined' ) {
547            filters_start = braapf_selected_filters;
548        }
549        $.each(filters_start, function(i, val) {
550            url_data = berocket_apply_filters('apply_additional_filter_data', url_data, val);
551        });
552        return url_data;
553    }
554    //Build url from url data object
555    braapf_build_url_from_urldata = function (url_data, parameters) {
556        if( typeof(parameters) == 'undefined' ) {
557            parameters = braapf_build_url_parameters_default();
558        }
559        var url = berocket_apply_filters('url_from_urldata_baselink', url_data.baselink, url_data, parameters);
560        var query_get = '';
561        if( url_data.queryargs.length ) {
562            $.each(url_data.queryargs, function(i, val) {
563                if( query_get.length ) {
564                    query_get += '&';
565                }
566                if( typeof(val.name) != 'undefined' && val.name.length && typeof(val.value) != 'undefined' ) {
567                    query_get += val.name + '=' + val.value;
568                }
569            });
570        }
571        if( url_data.page && url_data.page > 1 ) {
572            if( query_get.length ) {
573                query_get += '&';
574            }
575            query_get += 'paged=' + url_data.page;
576        }
577        if( query_get.length ) {
578            query_get = '?' + query_get;
579        }
580        url = berocket_apply_filters('url_from_urldata_linkget', (url+query_get), url_data, parameters, url, query_get);
581        return url;
582    }
583    braapf_build_url_parameters_default = function () {
584        return berocket_apply_filters('build_url_parameters_default', {});
585    }
586    //REPLACE ANY ELEMENT ON PAGE
587    braapf_replace_current_with_new = function(html, selector, argsin) {
588        if( typeof(argsin) == 'undefined' ) {
589            argsin = {};
590        }
591        args = {replace:false};
592        jQuery.extend(args, argsin);
593        args = berocket_apply_filters('replace_current_with_new_args', args, html, selector);
594        var $html = $('<div><div>'+html+'</div></div>');
595        var $new = $html.find(selector);
596        var $current = $(selector);
597        if( $current.length != 0 ) {
598            if( $new.length != $current.length && $new.length != 0 ) {
599                berocket_throw_error('error_notsame_block_qty', selector, $new.length, $current.length);
600            }
601            if( $new.length == 0 ) {
602                $current.html('').addClass('braapfNotReplaced');
603                $current.hide();
604            } else {
605                $current.each(function(i, el) {
606                    if( typeof($new[i]) != 'undefined' ) {
607                        if( args.replace ) {
608                            $(el).replaceWith($($new[i]));
609                        } else {
610                            $(el).html($($new[i]).html()).removeClass('braapfNotReplaced');
611                        }
612                    } else {
613                        $(el).html('').addClass('braapfNotReplaced');
614                    }
615                });
616                $current.show();
617            }
618        }
619    }
620    braapf_replace_products = function (data) {
621        var products_selector = the_ajax_script.products_holder_id;
622        var $html = $('<div><div>'+data+'</div></div>');
623        $('.bapf_no_products').remove();
624        braapf_replace_current_with_new(data, products_selector);
625        if( $('.braapfNotReplaced').filter(products_selector).length ) {
626            $('.braapfNotReplaced').filter(products_selector).before($(the_ajax_script.no_products));
627        }
628    }
629    braapf_replace_pagination = function (data) {
630        var pagination_selector = the_ajax_script.pagination_class;
631        if( $(pagination_selector).length == 0 ) {
632            var products_selector = the_ajax_script.products_holder_id;
633            var $html = $('<div><div>'+data+'</div></div>');
634            var pagination = $html.find(pagination_selector).last();
635            if( pagination.length ) {
636                $(products_selector).last().after(pagination);
637            }
638        } else {
639            braapf_replace_current_with_new(data, pagination_selector, {type:'pagination'});
640        }
641    }
642    braapf_replace_result_count = function (data) {
643        var result_count_selector = the_ajax_script.result_count_class;
644        if( $(result_count_selector).length == 0 ) {
645            var products_selector = the_ajax_script.products_holder_id;
646            var $html = $('<div><div>'+data+'</div></div>');
647            var count_selector = $html.find(result_count_selector).last();
648            if( count_selector.length ) {
649                $(products_selector).last().before(count_selector);
650            }
651        } else {
652            braapf_replace_current_with_new(data, result_count_selector);
653        }
654    }
655    braapf_replace_orderby = function (data) {
656        var orderby_selector = the_ajax_script.ordering_class;
657        if( $(orderby_selector).length == 0 ) {
658            var products_selector = the_ajax_script.products_holder_id;
659            var $html = $('<div><div>'+data+'</div></div>');
660            var orderby = $html.find(orderby_selector).last();
661            if( orderby.length ) {
662                $(products_selector).last().before(orderby);
663            }
664        } else {
665            braapf_replace_current_with_new(data, orderby_selector);
666        }
667    }
668    braapf_replace_each_filter = function(html) {
669        var $html = $('<div><div>'+html+'</div></div>');
670        $html = braapf_sngl_hd_loaded_filters($html);
671        $('.berocket_single_filter_widget').each(function() {
672            var data_id = $(this).data('id');
673            var data_wid = $(this).data('wid');
674            $('.berocket_single_filter_widget_'+data_id+'.bapf_wid_'+data_wid).html($html.find('.berocket_single_filter_widget_'+data_id+'.bapf_wid_'+data_wid).last().html());
675            if( $html.find('.berocket_single_filter_widget_'+data_id+'.bapf_wid_'+data_wid).last().is('.bapf_mt_none') ) {
676                $('.berocket_single_filter_widget_'+data_id+'.bapf_wid_'+data_wid).addClass('bapf_mt_none');
677            } else {
678                $('.berocket_single_filter_widget_'+data_id+'.bapf_wid_'+data_wid).removeClass('bapf_mt_none');
679            }
680        });
681    }
682    braapf_update_seo_elements = function(html) {
683        var $html = $('<div><div>'+html+'</div></div>');
684        $('title').text($html.find('title').text());
685        $('h1').first().html($html.find('h1').first().html());
686        if( $('.bapf_page_title').length > 0 ) {
687            $('.bapf_page_title').first().html($html.find('.bapf_page_title').first().html());
688        }
689    }
690    //Add url HTML5
691    braapf_set_manual_scroll_restoration = function() {
692        if( 'scrollRestoration' in history ) {
693            history.scrollRestoration = 'manual';
694        }
695    }
696    braapf_change_url_history_api = function(new_url, data) {
697        if( typeof(data) != 'undefined' && data.replace ) {
698            braapf_set_manual_scroll_restoration();
699            var stateParameters = { BeRocket: "Rules" };
700            history.replaceState(stateParameters, "");
701            history.pushState(stateParameters, "", new_url);
702            history.pathname = new_url;
703        }
704    }
705    window.addEventListener("popstate", function(event) {
706        if ( berocket_apply_filters('load_products_ajax_on_popstate', true) && event.state != null && event.state.BeRocket == 'Rules' ) {
707            var url = location.href;
708            if( berocket_apply_filters('page_has_products_holder', (! $(the_ajax_script.products_holder_id).length), url) ) {
709                location.href = url;
710            } else {
711                braapf_ajax_load_from_url(url, {}, berocket_apply_filters('ajax_load_from_filters', {done:[braapf_replace_products, braapf_replace_pagination, braapf_replace_result_count, braapf_replace_orderby, braapf_replace_each_filter, braapf_init_load, braapf_filtered_filters_set, braapf_update_data_from_current, braapf_update_seo_elements]}, url, 'default'));
712            }
713        }
714    });
715    //Load data from URL
716    braapf_ajax_load_from_url = function(url, send_data, callback_func, type) {
717        if( typeof(type) == 'undefined' ) {
718            type = 'default';
719        }
720        if( typeof(send_data) != 'object' ) {
721            send_data = {};
722        }
723        if( typeof(callback_func) != 'object' ) {
724            callback_func = {done:[], fail:[], always:[]};
725        }
726        if( typeof(callback_func.done) == 'undefined' || ! Array.isArray(callback_func.done) ) {
727            callback_func.done = [];
728        }
729        if( typeof(callback_func.fail) == 'undefined' || ! Array.isArray(callback_func.fail) ) {
730            callback_func.fail = [];
731        }
732        if( typeof(callback_func.always) == 'undefined' || ! Array.isArray(callback_func.always) ) {
733            callback_func.always = [];
734        }
735        url = berocket_apply_filters('ajax_load_from_url_url', url, send_data, callback_func, type);
736        send_data = berocket_apply_filters('ajax_load_from_url_data', send_data, url, callback_func, type);
737        callback_func = berocket_apply_filters('ajax_load_from_url_callback', callback_func, url, send_data, type);
738        braapf_ajax_load_from_url_request(url, send_data, callback_func, type);
739    }
740    braapf_ajax_load_from_url_request = function(url, send_data, callback_func, type) {
741        $(document).trigger('berocket_ajax_filtering_start');
742        if( typeof(braapf_ajax_request) == 'object' && typeof(braapf_ajax_request.abort) != 'undefined' ) {
743            braapf_ajax_request.abort();
744        }
745        braapf_ajax_request = $.ajax({method:"GET", url: url, data: send_data, beforeSend: function(xhr) {
746                xhr = berocket_apply_filters('ajax_load_from_url_beforeSend', xhr, url, send_data, callback_func, type);
747            }
748        })
749            .done(function(data, textStatus, jqXHR) {
750                $(document).trigger('berocket_ajax_filtering_on_update');
751                data = berocket_apply_filters('ajax_load_from_url_done', data, url, send_data, callback_func, type);
752                $.each(callback_func.done, function(i, val) {
753                    val(data, textStatus, jqXHR, url, type);
754                });
755                data = berocket_apply_filters('ajax_load_from_url_done_after', data, url, send_data, callback_func, type);
756                $(document).trigger('berocket_ajax_products_loaded');
757            })
758            .fail(function(jqXHR, textStatus, errorThrown) {
759                if( textStatus == 'abort' ) {
760                    return false;
761                }
762                $(document).trigger('berocket_ajax_products_not_loaded');
763                jqXHR = berocket_apply_filters('ajax_load_from_url_fail', jqXHR, url, send_data, callback_func, type);
764                $.each(callback_func.fail, function(i, val) {
765                    val(jqXHR, textStatus, errorThrown, url, type);
766                });
767                jqXHR = berocket_apply_filters('ajax_load_from_url_fail_after', jqXHR, url, send_data, callback_func, type);
768                if( type == 'default' ) {
769                    var query_send_data = jQuery.param(send_data);
770                    if( query_send_data ) {
771                        if( url.split('?').length > 1 ) {
772                            url = url + "&" + query_send_data;
773                        } else {
774                            url = url + "?" + query_send_data;
775                        }
776                    }
777                    location.href = url;
778                }
779            })
780            .always(function(data, textStatus, jqXHR) {
781                data = berocket_apply_filters('ajax_load_from_url_always', data, url, send_data, callback_func, type);
782                $.each(callback_func.always, function(i, val) {
783                    val(data, textStatus, jqXHR, url, type);
784                });
785                data = berocket_apply_filters('ajax_load_from_url_always_after', data, url, send_data, callback_func, type);
786                $(document).trigger('berocket_ajax_filtering_end');
787            });
788    }
789    function braapf_additional_header(xhr) {
790        xhr.setRequestHeader('X-Braapf', '1');
791        return xhr;
792    }
793    var braapf_select2_ordering_reinit_check = false;
794    function braapf_select2_ordering_reinit(xhr) {
795        var ordering_class = the_ajax_script.ordering_class;
796        ordering_class = ordering_class.replaceAll(',', ' select,');
797        ordering_class = ordering_class+' select';
798        if( jQuery(ordering_class).data('select2') ) {
799            braapf_select2_ordering_reinit_check = true
800        }
801        return xhr;
802    }
803    jQuery(document).on('berocket_ajax_products_loaded', function() {
804        if( braapf_select2_ordering_reinit_check ) {
805            var ordering_class = the_ajax_script.ordering_class;
806            ordering_class = ordering_class.replaceAll(',', ' select,');
807            ordering_class = ordering_class+' select';
808            jQuery(ordering_class).select2({minimumResultsForSearch: -1});
809        }
810    });
811    function braapf_sngl_hd_loaded_filters($elements) {
812        var mobile_width = berocket_apply_filters('filter_mobile_width', 767); 
813        var tablet_width = berocket_apply_filters('filter_tablet_width', 1024); 
814        $elements.find('.bapf_sngl_hd_mobile').show();
815        $elements.find('.bapf_sngl_hd_tablet').show();
816        $elements.find('.bapf_sngl_hd_desktop').show();
817        if( $(window).width() <= mobile_width ) {
818            $elements.find('.bapf_sngl_hd_mobile').hide();
819        } else if( $(window).width() > mobile_width && $(window).width() <= tablet_width ) {
820            $elements.find('.bapf_sngl_hd_tablet').hide();
821        } else if( $(window).width() > tablet_width ) {
822            $elements.find('.bapf_sngl_hd_desktop').hide();
823        }
824        return $elements;
825    }
826    //INIT filters
827    braapf_init_load = function() {
828        braapf_sngl_hd_loaded_filters($('html'));
829        $('.bapf_sfilter .bapf_body.bapf_mcs:not(.bapf_mcs_ready)').each(function() {
830            $(this).css('max-height', $(this).data('mcs-h')).mCustomScrollbar({scrollInertia: 300}).addClass('bapf_mcs_ready');
831        });
832        $('.berocket_single_filter_widget').each(function() {
833            var data_id = $(this).data('id');
834            if( berocket_apply_filters('remove_same_filters_to_prevent_errors', ($('.berocket_single_filter_widget_'+data_id).length > 1), $(this), data_id ) ) {
835                var $elements = $('.berocket_single_filter_widget_'+data_id).not('.bapf_sngl_hd_mobile').not('.bapf_sngl_hd_tablet');
836                $elements = $elements.not($elements.first());
837                if( $elements.length > 0 ) {
838                    $elements.remove();
839                    berocket_throw_error('same_filters_multiple_times', data_id);
840                }
841                $elements = $('.berocket_single_filter_widget_'+data_id).not('.bapf_sngl_hd_mobile').not('.bapf_sngl_hd_desktop');
842                $elements = $elements.not($elements.first());
843                if( $elements.length > 0 ) {
844                    $elements.remove();
845                    berocket_throw_error('same_filters_multiple_times', data_id);
846                }
847                $elements = $('.berocket_single_filter_widget_'+data_id).not('.bapf_sngl_hd_tablet').not('.bapf_sngl_hd_desktop');
848                $elements = $elements.not($elements.first());
849                if( $elements.length > 0 ) {
850                    $elements.remove();
851                    berocket_throw_error('same_filters_multiple_times', data_id);
852                }
853            }
854        });
855        $('body').on('click', '.bapf_desci', function(e) {
856            e.stopPropagation();
857        });
858        $('body').on('hover', '.bapf_desci', function(e) {
859            e.stopPropagation();
860        });
861        berocket_do_action('braapf_init', braapf_selected_filters);
862        $(document).trigger('berocket_filters_first_load');
863    }
864    braapf_update_page_on_error = function() {
865        if( berocket_apply_filters('update_page_on_error', true) ) {
866            location.reload();
867        }
868    }
869    //Selected filters area
870    braapf_selected_filters_area_set = function() {
871        if( typeof(braapf_filtered_filters) != 'undefined' && braapf_filtered_filters.length > 0 ) {
872            var html = '';
873            $.each(braapf_filtered_filters, function(i, taxonomy) {
874                if( taxonomy.values.length > 0 ) {
875                    taxonomy = berocket_apply_filters('default_selected_filters_area_single_taxonomy', taxonomy);
876                    var html2 = '<div class="bapf_sfa_taxonomy"><span>' + taxonomy.name + '</span>';
877                    html2 += '<ul>';
878                    var html2_elements = '';
879                    $.each(taxonomy.values, function(i2, val) {
880                        html2_elements += berocket_apply_filters('default_selected_filters_area_single', '<li><a href="#unselect_'+val.value+'" class="braapf_unselect" data-taxonomy="'+taxonomy.taxonomy+'" data-value="'+val.value+'"><i class="fa fa-times"></i> '+val.html+'</a></li>', val);
881                    });
882                    html2 += html2_elements;
883                    html2 += '</ul></div>';
884                    html += berocket_apply_filters('default_selected_filters_area_single_taxonomy', html2, taxonomy, html2_elements);
885                }
886            });
887            $('.berocket_aapf_widget_selected_area').parents('.berocket_single_filter_widget').removeClass('bapf_mt_none');
888            if( html ) {
889                $('.bapf_sfa_mt_hide').show().parent().removeClass('bapf_mt_none');
890                html = berocket_apply_filters('default_selected_filters_area_full_exist', '<div class="berocket_aapf_widget_selected_filter">
890' + html + '<ul class="bapf_sfa_unall"><li><a href="#Unselect_all" class="braapf_unselect_all"><i class="fa fa-times"></i> '+the_ajax_script.translate.unselect_all+'</a></li></ul>', html, braapf_filtered_filters);
891            } else {
892                html = berocket_apply_filters('default_selected_filters_area_full_notexist', the_ajax_script.translate.nothing_selected, html, braapf_filtered_filters);
893                $('.bapf_sfa_mt_hide').hide().parent().addClass('bapf_mt_none');
894            }
895            $('.berocket_aapf_widget_selected_area').html(html);
896        }
897    }
898    
899    $(document).on('click', '.berocket_aapf_widget_selected_area .braapf_unselect', function(event) {
900        event.preventDefault();
901        $('.bapf_sfilter[data-taxonomy="'+$(this).data('taxonomy')+'"]').trigger('braapf_unselect', $(this).data());
902        berocket_do_action('update_products', 'reset_single', $(this));
903    });
904    braapf_unselect_all = function() {
905        braapf_grab_all();
906        if( typeof(braapf_selected_filters) != 'undefined' && braapf_selected_filters.length > 0 ) {
907            $.each(braapf_selected_filters, function(i, taxonomy) {
908                if( taxonomy.values.length > 0 ) {
909                    $('.bapf_sfilter[data-taxonomy="'+taxonomy.taxonomy+'"]').trigger('braapf_unselect_all', taxonomy);
910                }
911            });
912        }
913    }
914    $(document).on('click', '.berocket_aapf_widget_selected_area .braapf_unselect_all', function(event) {
915        event.preventDefault();
916        braapf_unselect_all();
917        berocket_do_action('update_products', 'reset_all', $(this));
918    });
919    berocket_add_filter('braapf_init', braapf_grab_all_init, 1000);
920    berocket_add_filter('braapf_init', braapf_selected_filters_area_set_init, 1100);
921    berocket_add_filter('braapf_init_filtered_set', braapf_selected_filters_area_set_init, 1100);
922    //Error catch
923    braapf_reload_page_for_products_error = function(error_exist, selector) {
924        if( selector == the_ajax_script.products_holder_id) {
925            braapf_update_page_on_error();
926        }
927        return error_exist;
928    }
929    //Additional part
930    berocket_add_filter('ajax_load_from_url_beforeSend', braapf_additional_header);
931    berocket_add_filter('ajax_load_from_url_beforeSend', braapf_select2_ordering_reinit);
932    berocket_add_filter('update_products', braapf_update_products);
933    berocket_add_filter('error_notsame_block_qty', braapf_reload_page_for_products_error);
934    bapf_universal_theme_compatibility = function(data) {
935        if( berocket_apply_filters('universal_theme_compatibility', true) ) {
936            $(window).trigger('resize');
937            //UNCODE theme
938            try {if( berocket_apply_filters('uncode_theme_compatibility', (typeof(UNCODE) == 'object' && typeof(UNCODE.init) == 'function' ) ) ) {
939                UNCODE.init();
940            }} catch (e) {berocket_throw_error('uncode_theme_compatibility', e);}
941            //Flatsome theme
942            try {if( berocket_apply_filters('flatsome_theme_compatibility', (typeof(Flatsome) == 'object' && typeof(Flatsome.attach) == 'function' && jQuery(the_ajax_script.products_holder_id).length ) ) ) {
943                Flatsome.attach(jQuery(the_ajax_script.products_holder_id));
944            }} catch (e) {berocket_throw_error('flatsome_theme_compatibility', e);}
945            //Woodmart theme
946            try {if( berocket_apply_filters('woodmart_theme_compatibility', (typeof(woodmartThemeModule) == 'object' ) ) ) {
947                if( typeof(woodmartThemeModule.wooInit) == 'function' ) {
948                    woodmartThemeModule.wooInit();
949                }
950                if( typeof(woodmartThemeModule.lazyLoading) == 'function' ) {
951                    woodmartThemeModule.lazyLoading();
952                }
953                if( typeof(woodmartThemeModule.productsLoadMore) == 'function' ) {
954                    woodmartThemeModule.productsLoadMore();
955                }
956            }} catch (e) {berocket_throw_error('woodmart_theme_compatibility', e);}
957            //Divi theme
958            try {if( berocket_apply_filters('divi_theme_compatibility', (typeof(et_reinit_waypoint_modules) == 'function' ) ) ) {
959                et_reinit_waypoint_modules();
960            }} catch (e) {berocket_throw_error('divi_theme_compatibility', e);}
961            //reyTheme theme
962            try {if( berocket_apply_filters('rey_theme_compatibility', (typeof(jQuery.reyTheme) == 'object' && typeof(jQuery.reyTheme.init) == 'function' ) ) ) {
963                jQuery.reyTheme.init();
964            }} catch (e) {berocket_throw_error('rey_theme_compatibility', e);}
965            //layzyLoadImage script
966            try {if( berocket_apply_filters('layzyloadimage_script_compatibility', (typeof(layzyLoadImage) == 'function' ) ) ) {
967                layzyLoadImage();
968            }} catch (e) {berocket_throw_error('layzyloadimage_script_compatibility', e);}
969            //jetpackLazyImagesModule script
970            try {if( berocket_apply_filters('jetpacklazyimages_script_compatibility', (typeof(jetpackLazyImagesModule) == 'function' ) ) ) {
971                jetpackLazyImagesModule();
972            }} catch (e) {berocket_throw_error('jetpacklazyimages_script_compatibility', e);}
973            try {
974            jQuery('img.jetpack-lazy-image').each(function() {
975                jQuery(this).removeClass('jetpack-lazy-image').attr('src', jQuery(this).data('lazy-src'));
976                jQuery(this).removeClass('jetpack-lazy-image').attr('srcset', '');
977            });
978            } catch (e) {berocket_throw_error('jetpacklazyimages_script_compatibility', e);}
979            //SWIFT script
980            try {if( berocket_apply_filters('swift_script_compatibility', (typeof(SWIFT) == 'object' && typeof(SWIFT.woocommerce) == 'object' && typeof(SWIFT.woocommerce.init) == 'function' ) ) ) {
981                SWIFT.woocommerce.init();
982            }} catch (e) {berocket_throw_error('swift_script_compatibility', e);}
983            try {if( typeof(baapfGet_wprocketInstance) != 'undefined' ) {
984                baapfGet_wprocketInstance.update();
985            }} catch (e) {berocket_throw_error('wprocket_script_compatibility', e);}
986            try {
987                jQuery(document).trigger('facetwp-loaded');
988            } catch (e) {berocket_throw_error('facetwp_script_compatibility', e);}
989            try {if( berocket_apply_filters('etTheme_compatibility', (typeof(etTheme) == 'object' && typeof(etTheme.global_image_lazy) == 'function' ) ) ) {
990                etTheme.global_image_lazy();
991            }} catch (e) {berocket_throw_error('etTheme_compatibility', e);}
992            try {if( berocket_apply_filters('the7_compatibility', ($(the_ajax_script.products_holder_id+' .iso-lazy-load').length > 0) ) ) {
993                $(the_ajax_script.products_holder_id+' .iso-lazy-load').attr('src', function(){
994                    if(typeof($(this).data('src')) != 'undefined' && $(this).data('src')) {
995                        return $(this).data('src');
996                    }
997                    return $(this).attr('src');
998                }).attr('srcset', function() {
999                    if(typeof($(this).data('srcset')) != 'undefined' && $(this).data('srcset')) {
1000                        return $(this).data('srcset');
1001                    }
1002                    return $(this).attr('srcset');
1003                }).removeClass('iso-lazy-load');
1004            }} catch (e) {berocket_throw_error('etTheme_compatibility', e);}
1005            try { if( typeof(InfiniteScroll) == 'function' ) {
1006                var infScroll = InfiniteScroll.data( '.shop-container .products' );
1007                if( typeof(infScroll) == 'object' && infScroll.options ) {
1008                    var infOptionsStore = infScroll.options;
1009                    infScroll.destroy();
1010                    jQuery('.shop-container .products').data('infiniteScroll', '').infiniteScroll(infOptionsStore);
1011                }
1012            }} catch (e) {berocket_throw_error('flatsome_infinitescroll', e);}
1013            try { if( jQuery('.shop-container .products').length && typeof(jQuery('.shop-container .products').data('packery')) == 'object' ) {
1014                jQuery('.shop-container .products').packery('reloadItems').packery('layout');
1015            }} catch (e) {berocket_throw_error('flatsome_packery', e);}
1016            try {if( berocket_apply_filters('JetSmartFilters_compatibility', (typeof(window.JetSmartFilters) == 'object' && typeof(window.JetSmartFilters.initializeFilters) == 'function' ) ) ) {
1017                window.JetSmartFilters.initializeFilters()
1018            }} catch (e) {berocket_throw_error('JetSmartFilters_compatibility', e);}
1019            $(window).trigger('resize');
1020            $(window).trigger('scroll');
1021        }
1022        return data;
1023    }
1024    jQuery(document).on('preInit.dt', '.berocket_product_table_compat .wc-product-table', function (e, settings, data) {
1025        if( the_ajax_script.nice_urls && typeof(settings.ajax) == 'object' && settings.ajax ) {
1026            settings.ajax.data[the_ajax_script.nice_url_variable] = braapf_get_filters_selected();
1027        }
1028    });
1029    berocket_add_filter('ajax_load_from_url_always_after', bapf_universal_theme_compatibility, 2500);
1030    $(document).ready(function(){
1031        if( berocket_apply_filters('remove_shortcode_fix_filters', $('.berocket_wc_shortcode_fix').length) ) {
1032            braapf_replace_each_filter($('.berocket_wc_shortcode_fix').html());
1033            $('.berocket_wc_shortcode_fix').html('');
1034        }
1035        braapf_init_load();
1036        braapf_filtered_filters_set();
1037        braapf_sngl_hd_loaded_filters($('html'));
1038        $(window).on('resize', function() {braapf_sngl_hd_loaded_filters($('html'))});
1039        $(document).trigger('berocket_filters_document_ready');
1040    });
1041    braapf_disable_ajax_loading = function($has_product) {
1042        return true;
1043    }
1044    $(document).ready(function() {
1045        if( the_ajax_script.disable_ajax_loading) {
1046            berocket_add_filter('page_has_products_holder', braapf_disable_ajax_loading);
1047        }
1048    });
1049    braapf_close_tippy = function () {
1050        try{
1051            if( $('.tippy-box').length ) {
1052                $('.tippy-box').each(function() {
1053                    if( typeof($(this).parent()[0]._tippy) != 'undefined' ) {
1054                        $(this).parent()[0]._tippy.hide();
1055                    }
1056                });
1057            }
1058        } catch(e){}
1059    }
1060    berocket_add_filter('update_products', braapf_close_tippy);
1061})(jQuery);
1062var braapf_get_current_filters,
1063braapf_filters_url_decode,
1064braapf_scroll_shop_to_top,
1065braapf_set_filters_to_link,
1066braapf_convert_ckbox_to_radio,
1067braapf_hierarhical_save,
1068braapf_hierarhical_set,
1069braapf_collapse_status_save,
1070braapf_collapse_status_set,
1071braapf_show_hide_values_save,
1072braapf_show_hide_values_set;
1073(function ($){
1074    //default filters
1075    braapf_get_current_filters = function (url_data) {
1076        if( url_data.queryargs.length ) {
1077            var newqueryargs = [];
1078            $.each(url_data.queryargs, function (i, val) {
1079                if( val.name == the_ajax_script.url_variable || decodeURI(val.name) == the_ajax_script.url_variable ) {
1080                    url_data.filter = val.value;
1081                } else {
1082                    newqueryargs.push(val);
1083                }
1084            });
1085            url_data.queryargs = newqueryargs;
1086        }
1087        return url_data;
1088    }
1089    braapf_set_filters_to_link = function(url, url_data, parameters, url_without_query, query_get) {
1090        if( typeof(url_data.filter) == 'string' && url_data.filter.length ) {
1091            if( query_get.length ) {
1092                url += '&';
1093            } else {
1094                url += '?';
1095            }
1096            url += the_ajax_script.url_variable + '=' + url_data.filter;
1097        }
1098        return url;
1099    }
1100    //SINGLE ELEMENT / RADIOBUTTONS
1101    braapf_convert_ckbox_to_radio = function(thisel, taxonomy, value, checked){
1102        var $this = $(thisel);
1103        var parent = $(thisel).closest('.bapf_sfilter.bapf_ckbox');
1104        if( parent.is('.bapf_asradio') ) {
1105            parent.find('input[type=checkbox]:checked:not(:disabled)').each(function() {
1106                var val = $(this).val();
1107                if( val != value ) {
1108                    braapf_checkbox_same(taxonomy, val, false);
1109                }
1110            });
1111        }
1112    }
1113    berocket_add_filter('input_ckbox_changed', braapf_convert_ckbox_to_radio);
1114    //CHILD HIERARCHICAL
1115    $(document).on('click', '.bapf_ochild, .bapf_cchild', function(e) {
1116        e.preventDefault();
1117        e.stopPropagation();
1118        if( $(this).is('.bapf_ochild' ) ) {
1119            $(this).trigger('bapf_ochild');
1120        } else {
1121            $(this).trigger('bapf_cchild');
1122        }
1123    });
1124    $(document).on('bapf_ochild', '.bapf_sfilter.bapf_ckbox ul li', function(e) {
1125        e.stopPropagation();
1126        if( berocket_apply_filters('colaps_child_open_apply', true, $(this)) ) {
1127            var data = $(this).parents('.bapf_sfilter').first().data();
1128            if( typeof(data.ochild) == 'undefined' ) {
1129                data.ochild = 'fa-plus';
1130            }
1131            if( typeof(data.cchild) == 'undefined' ) {
1132                data.cchild = 'fa-minus';
1133            }
1134            $(this).find('.bapf_ochild, .bapf_cchild').first().removeClass('bapf_ochild').removeClass(data.ochild).addClass('bapf_cchild').addClass(data.cchild);
1135            $(this).find('ul').first().show();
1136        }
1137    });
1138    $(document).on('bapf_cchild', '.bapf_sfilter.bapf_ckbox ul li', function(e) {
1139        e.stopPropagation();
1140        if( berocket_apply_filters('colaps_child_close_apply', true, $(this)) ) {
1141            var data = $(this).parents('.bapf_sfilter').first().data();
1142            if( typeof(data.ochild) == 'undefined' ) {
1143                data.ochild = 'fa-plus';
1144            }
1145            if( typeof(data.cchild) == 'undefined' ) {
1146                data.cchild = 'fa-minus';
1147            }
1148            $(this).find('.bapf_ochild, .bapf_cchild').first().addClass('bapf_ochild').addClass(data.ochild).removeClass('bapf_cchild').removeClass(data.cchild);
1149            $(this).find('ul').first().hide();
1150        }
1151    });
1152    var braapf_hierarhical_values = [];
1153    braapf_hierarhical_save = function(data) {
1154        braapf_hierarhical_values = [];
1155        $('.bapf_cchild').each(function() {
1156            braapf_hierarhical_values.push($(this).parent().children('input[type=checkbox]').attr('id'));
1157        });
1158        return data;
1159    }
1160    braapf_hierarhical_set = function(data) {
1161        $.each(braapf_hierarhical_values, function(i, val) {
1162            $('#'+val).trigger('bapf_ochild');
1163        });
1164        return data;
1165    }
1166    berocket_add_filter('ajax_load_from_url_done', braapf_hierarhical_save, 1);
1167    berocket_add_filter('ajax_load_from_url_done_after', braapf_hierarhical_set, 1000);
1168    //SHOW/HIDE FILTERS
1169    $(document).on('click', '.bapf_ocolaps .bapf_colaps_togl, .bapf_ccolaps .bapf_colaps_togl', function(e) {
1170        e.preventDefault;
1171        if( $(this).closest('.bapf_ocolaps, .bapf_ccolaps').is('.bapf_ocolaps' ) ) {
1172            $(this).closest('.bapf_ocolaps, .bapf_ccolaps').trigger('bapf_ocolaps', ["slideDown"]);
1173        } else {
1174            $(this).closest('.bapf_ocolaps, .bapf_ccolaps').trigger('bapf_ccolaps', ["slideUp"]);
1175        }
1176    });
1177    $(document).on('keydown', '.bapf_ocolaps .bapf_colaps_togl, .bapf_ccolaps .bapf_colaps_togl', function(e) {
1178        if( e.key === 'Enter' ) {
1179            e.preventDefault;
1180            if( $(this).closest('.bapf_ocolaps, .bapf_ccolaps').is('.bapf_ocolaps' ) ) {
1181                $(this).closest('.bapf_ocolaps, .bapf_ccolaps').trigger('bapf_ocolaps', ["slideDown"]);
1182            } else {
1183                $(this).closest('.bapf_ocolaps, .bapf_ccolaps').trigger('bapf_ccolaps', ["slideUp"]);
1184            }
1185        }
1186    });
1187    $(document).on('bapf_ocolaps', '.bapf_sfilter.bapf_ocolaps, .bapf_sfilter.bapf_ccolaps', function(e, animation) {
1188        $(this).removeClass('bapf_ocolaps').addClass('bapf_ccolaps');
1189        if( berocket_apply_filters('colaps_smb_open_apply', true, $(this)) ) {
1190            if ( typeof animation == "undefined") animation = "show";
1191            if ( animation == "slideDown" ) {
1192                $(this).find('.bapf_body').first().slideDown();
1193            } else {
1194                $(this).find('.bapf_body').first().show();
1195            }
1196            if( $(this).find('.bapf_colaps_smb').length ) {
1197                var data = $(this).find('.bapf_colaps_smb').data();
1198                if( typeof(data.opened) == 'undefined' ) {
1199                    data.opened = 'fa-chevron-up';
1200                }
1201                if( typeof(data.closed) == 'undefined' ) {
1202                    data.closed = 'fa-chevron-down';
1203                }
1204                $(this).find('.bapf_colaps_smb').removeClass(data.closed).addClass(data.opened);
1205            }
1206        }
1207    });
1208    $(document).on('bapf_ccolaps', '.bapf_sfilter.bapf_ocolaps, .bapf_sfilter.bapf_ccolaps', function(e, animation) {
1209        $(this).addClass('bapf_ocolaps').removeClass('bapf_ccolaps');
1210        if( berocket_apply_filters('colaps_smb_close_apply', true, $(this)) ) {
1211            if ( typeof animation == "undefined") animation = "hide";
1212            if ( animation == "slideUp" ) {
1213                $(this).find('.bapf_body').first().slideUp();
1214            } else {
1215                $(this).find('.bapf_body').first().hide();
1216            }
1217            if( $(this).find('.bapf_colaps_smb').length ) {
1218                var data = $(this).find('.bapf_colaps_smb').data();
1219                if( typeof(data.opened) == 'undefined' ) {
1220                    data.opened = 'fa-chevron-up';
1221                }
1222                if( typeof(data.closed) == 'undefined' ) {
1223                    data.closed = 'fa-chevron-down';
1224                }
1225                $(this).find('.bapf_colaps_smb').addClass(data.closed).removeClass(data.opened);
1226            }
1227        }
1228    });
1229    $(document).on('mouseenter', '.bapf_colaps_smb', function() {
1230        var data = $(this).data();
1231        if( typeof(data) != 'undefined' && typeof(data.hover) != 'undefined' && data.hover ) {
1232            if( typeof(data.opened) == 'undefined' ) {
1233                data.opened = 'fa-chevron-up';
1234            }
1235            if( typeof(data.closed) == 'undefined' ) {
1236                data.closed = 'fa-chevron-down';
1237            }
1238            $(this).removeClass(data.closed).removeClass(data.opened).addClass(data.hover);
1239        }
1240    });
1241    $(document).on('mouseleave', '.bapf_colaps_smb', function() {
1242        var data = $(this).data();
1243        if( typeof(data) != 'undefined' && typeof(data.hover) != 'undefined' && data.hover ) {
1244            if( typeof(data.opened) == 'undefined' ) {
1245                data.opened = 'fa-chevron-up';
1246            }
1247            if( typeof(data.closed) == 'undefined' ) {
1248                data.closed = 'fa-chevron-down';
1249            }
1250            $(this).removeClass(data.hover);
1251            if ( $(this).parents('.bapf_sfilter').first().is('.bapf_ocolaps') ) {
1252                $(this).addClass(data.closed);
1253            } else {
1254                $(this).addClass(data.opened);
1255            }
1256        }
1257    });
1258    var braapf_collapse_status = {open:[], close:[]};
1259    braapf_collapse_status_save = function(data) {
1260        braapf_collapse_status = {open:[], close:[]};
1261        $('.bapf_ocolaps, .bapf_ccolaps').each(function() {
1262            if( $(this).is('.bapf_ocolaps') ) {
1263                braapf_collapse_status.open.push($(this).attr('id'));
1264            } else {
1265                braapf_collapse_status.close.push($(this).attr('id'));
1266            }
1267        });
1268        return data;
1269    }
1270    braapf_collapse_status_set = function(data) {
1271        $.each(braapf_collapse_status.open, function(i, val) {
1272            $('#'+val).trigger('bapf_ccolaps', ["show"]);
1273        });
1274        $.each(braapf_collapse_status.close, function(i, val) {
1275            $('#'+val).trigger('bapf_ocolaps', ["hide"]);
1276        });
1277        return data;
1278    }
1279    berocket_add_filter('ajax_load_from_url_done', braapf_collapse_status_save, 1);
1280    berocket_add_filter('ajax_load_from_url_done_after', braapf_collapse_status_set, 1000);
1281    //Show/Hide values button
1282    $(document).on('click', '.bapf_show_hide', function() {
1283        $(this).closest('.bapf_sfilter').toggleClass('bapf_fhide');
1284        if( $(this).closest('.bapf_sfilter').is('.bapf_fhide') ) {
1285            $(this).text($(this).data('show'));
1286        } else {
1287            $(this).text($(this).data('hide'));
1288        }
1289    });
1290    var braapf_show_hide_values_status = {open:[], close:[]};
1291    braapf_show_hide_values_save = function(data) {
1292        braapf_show_hide_values_status = {open:[], close:[]};
1293        $('.bapf_sfilter').has('.bapf_show_hide').each(function() {
1294            if( $(this).is('.bapf_fhide') ) {
1295                braapf_show_hide_values_status.close.push($(this).attr('id'));
1296            } else {
1297                braapf_show_hide_values_status.open.push($(this).attr('id'));
1298            }
1299        });
1300        return data;
1301    }
1302    braapf_show_hide_values_set = function(data) {
1303        $.each(braapf_show_hide_values_status.open, function(i, val) {
1304            var $filter = $('#'+val).has('.bapf_show_hide');
1305            $filter.removeClass('bapf_fhide');
1306            $filter.find('.bapf_show_hide').text($filter.find('.bapf_show_hide').data('hide'));
1307        });
1308        $.each(braapf_show_hide_values_status.close, function(i, val) {
1309            var $filter = $('#'+val).has('.bapf_show_hide');
1310            $filter.addClass('bapf_fhide');
1311            $filter.find('.bapf_show_hide').text($filter.find('.bapf_show_hide').data('show'));
1312        });
1313        return data;
1314    }
1315    berocket_add_filter('ajax_load_from_url_done', braapf_show_hide_values_save, 1);
1316    berocket_add_filter('ajax_load_from_url_done_after', braapf_show_hide_values_set, 1000);
1317    //Scroll page to the top
1318    braapf_scroll_shop_to_top = function(data, url, send_data, callback_func, type) {
1319        var mobile_width = berocket_apply_filters('filter_mobile_width', 767); 
1320        if( berocket_apply_filters('scroll_shop_to_top', (type == 'default' && ( the_ajax_script.scroll_shop_top == 1 
1321            || (the_ajax_script.scroll_shop_top == 2 && $(window).width() < mobile_width)
1322            || (the_ajax_script.scroll_shop_top == 3 && $(window).width() >= mobile_width) )
1323        ) ) ) {
1324            var top_scroll_offset = 0,
1325                scroll_top_px = parseInt(the_ajax_script.scroll_shop_top_px, 10) || 0,
1326                $scroll_target = false;
1327            if( $( the_ajax_script.products_holder_id ).length ) {
1328                $scroll_target = $( the_ajax_script.products_holder_id ).first();
1329            } else if( $( '.bapf_no_products' ).length ) {
1330                $scroll_target = $( '.bapf_no_products' ).first();
1331            }
1332            if( $scroll_target && $scroll_target.length ) {
1333                top_scroll_offset = $scroll_target.get(0).getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0) + scroll_top_px;
1334                if(top_scroll_offset < 0) top_scroll_offset = 0;
1335            }
1336            var scroll_element = document.scrollingElement || document.documentElement || document.body,
1337                is_ios = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
1338            //iOS fix
1339            if( is_ios && window.requestAnimationFrame ) {
1340                var start_scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
1341                    scroll_change = top_scroll_offset - start_scroll,
1342                    scroll_duration = 600,
1343                    scroll_start_time = null;
1344                var animate_scroll = function(timestamp) {
1345                    if( scroll_start_time === null ) scroll_start_time = timestamp;
1346                    var progress = Math.min((timestamp - scroll_start_time) / scroll_duration, 1),
1347                        ease_progress = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
1348                    window.scrollTo(0, start_scroll + scroll_change * ease_progress);
1349                    if( progress < 1 ) {
1350                        window.requestAnimationFrame(animate_scroll);
1351                    }
1352                };
1353                window.requestAnimationFrame(animate_scroll);
1354            } else if( scroll_element ) {
1355                $(scroll_element).animate({ scrollTop: top_scroll_offset }, "slow");
1356            } else {
1357                window.scrollTo(0, top_scroll_offset);
1358            }
1359        }
1360        return data;
1361    }
1362    berocket_add_filter('ajax_load_from_url_beforeSend', braapf_scroll_shop_to_top);
1363    //Sidebar
1364    $(document).on('mousedown', '.wc-product-table-reset a', function() {
1365        $(this).remove();
1366        br_reset_all_filters();
1367    });
1368    $(document).on('click', '.berocket_element_above_products_is_hide_toggle', function (e){
1369        e.preventDefault();
1370        $(this).toggleClass( "active" ).next().slideToggle(200, 'linear');
1371        var is_active = 'inactive';
1372        if( $(this).is('.active') ) {
1373            is_active = 'active';
1374        }
1375        $(document).trigger('berocket_element_above_products_'+is_active);
1376    });
1377    //Compatibility scripts
1378
1379    function berocket_ajax_load_product_table_compat() {
1380        if( jQuery('.berocket_product_table_compat .dataTables_length select').length ) {
1381            jQuery('.berocket_product_table_compat .wc-product-table').dataTable()._fnSaveState();
1382        }
1383        var tableid = jQuery('.berocket_product_table_compat .wc-product-table').attr('id');
1384        if( typeof(window['config_'+tableid]) != 'undefined' && window['config_'+tableid].serverSide ) {
1385            jQuery('.berocket_product_table_compat .wc-product-table').DataTable().destroy();
1386            var table_html = jQuery('.berocket_product_table_compat').html();
1387            jQuery('.berocket_product_table_compat').html('');
1388            jQuery('.berocket_product_table_compat').html(table_html);
1389            jQuery('.berocket_product_table_compat .blockUI.blockOverlay').remove();
1390            jQuery('.berocket_product_table_compat .wc-product-table').productTable();
1391        }
1392    }
1393    $(document).on('berocket_ajax_filtering_start', function() {
1394        if( jQuery('.berocket_product_table_compat').length ) {
1395            berocket_ajax_load_product_table_compat();
1396        }
1397    });
1398    braapf_filters_url_decode = function(filter) {
1399        if( the_ajax_script.seo_uri_decode ) {
1400            filter = encodeURIComponent(filter);
1401            if( the_ajax_script.nice_urls ) {
1402                filter = filter.replace(/%2F/g, '/');
1403            }
1404        }
1405        return filter;
1406    }
1407	jQuery( document ).on( 'elementor/popup/show', function() {
1408        try{
1409            braapf_init_load();
1410        } catch (e) {berocket_throw_error('elementor_popup_show', e);}
1411	} );
1412	jQuery( document ).on( 'pjax:success', function() {
1413        try{
1414            braapf_init_load();
1415        } catch (e) {berocket_throw_error('woodmart_ajax', e);}
1416	} );
1417})(jQuery);
1418berocket_add_filter('get_current_url_data', braapf_get_current_filters);
1419berocket_add_filter('compat_filters_to_string', braapf_filters_url_decode, 900);
1420berocket_add_filter('url_from_urldata_linkget', braapf_set_filters_to_link);
1421var braapf_child_parent_grab_single,
1422braapf_child_parent_fix_selected,
1423braapf_child_parent_load_with_update_button,
1424braapf_check_partial_load_filters,
1425braapf_add_loader_element,
1426braapf_remove_loader_element,
1427braapf_elementor_sticky_fix,
1428baapfGet_wprocketInstance,
1429brapf_jet_smart_filters_add,
1430brapf_jet_smart_filters_remove_pages,
1431brapf_jet_smart_filters;
1432(function ($){
1433    //CHILD/PARENT FEATURE
1434    braapf_child_parent_grab_single = function(single_data, element, selected_filters) {
1435        var child_position = element.data('child');
1436        if( typeof(child_position) != 'undefined' && child_position > 0 
1437         && typeof(single_data) == 'object' && typeof(single_data.values) != 'undefined' && Array.isArray(single_data.values) && single_data.values.length > 0 ) {
1438            child_position++;
1439            var taxonomy = element.data('taxonomy');
1440            var next_child = $('.bapf_sfilter.bapf_child_'+child_position+'[data-taxonomy="'+taxonomy+'"]');
1441            if( next_child.length ) {
1442                var new_single_data = braapf_grab_single (next_child, [], true);
1443                if( typeof(new_single_data) == 'object' && typeof(new_single_data.values) != 'undefined' && Array.isArray(new_single_data.values) && new_single_data.values.length > 0 ) {
1444                    single_data = new_single_data;
1445                }
1446            }
1447        }
1448        return single_data;
1449    }
1450    braapf_child_parent_fix_selected = function(context, element) {
1451        if( element != false) {
1452            var $filter = element.closest('.bapf_sfilter');
1453            if( $filter.length ) {
1454                var child_position = $filter.data('child');
1455                var taxonomy = $filter.data('taxonomy');
1456                if( typeof(child_position) != 'undefined' && child_position > 0 ) {
1457                    for(i = child_position + 1; $('.bapf_sfilter.bapf_child_'+i+'[data-taxonomy="'+taxonomy+'"]').length; i++) {
1458                        $('.bapf_sfilter.bapf_child_'+i+'[data-taxonomy="'+taxonomy+'"]').trigger('braapf_unselect', false);
1459                    }
1460                }
1461            }
1462        }
1463        return context;
1464    }
1465    braapf_child_parent_load_with_update_button = function(issend, context, element) {
1466        if( element != false) {
1467            var $filter = element.closest('.bapf_sfilter');
1468            if( $filter.length ) {
1469                var child_position = $filter.data('child');
1470                var taxonomy = $filter.data('taxonomy');
1471                if( typeof(child_position) != 'undefined' && child_position > 0 ) {
1472                    issend = true;
1473                }
1474            }
1475        }
1476        return issend;
1477    }
1478    braapf_check_partial_load_filters = function(issend, context, element) {
1479        if( $('.berocket_single_filter_widget.bapf_partload').length > 0 ) {
1480            issend = true;
1481        }
1482        return issend;
1483    }
1484    berocket_add_filter( 'grab_single_filter_default', braapf_child_parent_grab_single, 9000000 );
1485    berocket_add_filter( 'before_update_products_context', braapf_child_parent_fix_selected );
1486    berocket_add_filter( 'apply_filters_to_page_partial', braapf_child_parent_load_with_update_button );
1487    berocket_add_filter( 'apply_filters_to_page_partial', braapf_check_partial_load_filters );
1488    
1489    //LOADER OVER PAGE
1490    var braapf_loader_element;
1491    braapf_add_loader_element = function (data, url, send_data, callback_func, type) {
1492        if( type == 'default' ) {
1493            if( typeof(braapf_loader_element) != 'undefined' && typeof(braapf_loader_element.remove) == 'function' ) {
1494                braapf_loader_element.remove();
1495            }
1496            braapf_loader_element = $(the_ajax_script.load_image);
1497            $('body').append(braapf_loader_element);
1498        }
1499        return data;
1500    }
1501    braapf_remove_loader_element = function (data) {
1502        if( typeof(braapf_loader_element) != 'undefined' && typeof(braapf_loader_element.remove) == 'function' ) {
1503            braapf_loader_element.remove();
1504        }
1505        return data;
1506    }
1507    berocket_add_filter( 'ajax_load_from_url_beforeSend', braapf_add_loader_element );
1508    berocket_add_filter( 'ajax_load_from_url_always_after', braapf_remove_loader_element );
1509    //FILTER LINKS
1510    $(document).on('click', '.bapf_sfilter.bapf_ckbox .bapf_body li label a', function(event){event.preventDefault();$(this).parent().trigger('click')});
1511    //ELEMENTOR PRO
1512    if( jQuery('.elementor-widget').length ) {
1513        jQuery(window).on('scroll', function() {
1514            jQuery('.elementor-sticky__spacer .bapf_sfilter').remove();
1515        });
1516    }
1517    //WP-Rocket
1518    try {
1519        window.addEventListener('LazyLoad::Initialized',function(e){
1520            baapfGet_wprocketInstance = e.detail.instance;
1521        });
1522    } catch (e) {berocket_throw_error('wprocketInstance_get', e);}
1523    //WooCommerce quantity fix
1524    $(document).on("change", "form.cart input.qty", function() {
1525        try {
1526            $(this.form).find("[data-quantity]").attr("data-quantity", this.value);
1527        } catch (e) {berocket_throw_error('wc_quantity_change', e);}
1528    });
1529    //JetWooBuilder
1530    brapf_jet_smart_filters = function(data) {
1531        var $html = $('<div><div>'+data+'</div></div>');
1532        if( jQuery('#jet-smart-filters-js-extra').length >
1532 0 && $html.find('#jet-smart-filters-js-extra').length > 0 ) {
1533            jQuery('#jet-smart-filters-js-extra').replaceWith($html.find('#jet-smart-filters-js-extra'));
1534        }
1535    }
1536    brapf_jet_smart_filters_remove_pages = function(url_data) {
1537        if( Array.isArray(url_data.queryargs) ) {
1538            var newqueryargs = [];
1539            $.each(url_data.queryargs, function(i, val) {
1540                if(val.name != 'pagenum') {
1541                    newqueryargs.push(val);
1542                }
1543            });
1544            url_data.queryargs = newqueryargs;
1545        }
1546        return url_data;
1547    }
1548    brapf_jet_smart_filters_add = function(elem) {
1549        elem.done.push(brapf_jet_smart_filters);
1550        return elem;
1551    }
1552    brapf_JetSmartFilter_extra_props = function() {
1553        var compat_filters = braapf_compact_filters();
1554        var filter_mask = berocket_apply_filters('braapf_filters_mask', the_ajax_script.url_mask);
1555        var filter_string = braapf_compat_filters_to_string(compat_filters, filter_mask, the_ajax_script.url_split);
1556        JetSmartFilterSettings.extra_props.brfilters = filter_string;
1557    }
1558    jQuery(document).ready(function() {
1559        if( berocket_apply_filters('JetSmartFilter_compatibility', (jQuery('#jet-smart-filters-js-extra').length > 0)) ) {
1560            jQuery(document).on('berocket_ajax_products_loaded', brapf_JetSmartFilter_extra_props);
1561            brapf_JetSmartFilter_extra_props();
1562            berocket_add_filter( 'ajax_load_from_filters', brapf_jet_smart_filters_add );
1563            berocket_add_filter( 'braapf_remove_pages_from_url_data', brapf_jet_smart_filters_remove_pages );
1564        }
1565    });
1566})(jQuery);
1567jQuery(document).trigger('bapf_js_loaded');

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.