PageSourceSearch

https://www.lepple.de/wp-content/plugins/woocommerce-products-filter/js/front.js?ver=2.2.6.1

js lepple.de collected 2026-10-06 13:59:09 UTC 57,798 bytes, 1,640 lines download raw bytes

1"use strict";
2var woof_redirect = '';//if we use redirect attribute in shortcode [woof]
3var woof_reset_btn_action = false;
4jQuery(function () {
5try
6{
7woof_current_values = JSON.parse(woof_current_values);
8} catch (e)
9{
10woof_current_values = null;
11}
12if (woof_current_values == null || woof_current_values.length == 0) {
13woof_current_values = {};
14}
15
16});
17
18//***
19if (typeof woof_lang_custom == 'undefined') {
20    var woof_lang_custom = {};/*!!important*/
21}
22if (typeof woof_ext_filter_titles != 'undefined') {
23    woof_lang_custom = Object.assign({}, woof_lang_custom, woof_ext_filter_titles);
24}
25
26jQuery(function ($) {
27    jQuery('body').append('<div id="woof_html_buffer" class="woof_info_popup" style="display: none;"></div>');
28//http://stackoverflow.com/questions/2389540/jquery-hasparent
29    jQuery.extend(jQuery.fn, {
30        within: function (pSelector) {
31            // Returns a subset of items using jQuery.filter
32            return this.filter(function () {
33                // Return truthy/falsey based on presence in parent
34                return jQuery(this).closest(pSelector).length;
35            });
36        }
37    });
38
39    //+++
40
41    if (jQuery('#woof_results_by_ajax').length > 0) {
42        woof_is_ajax = 1;
43    }
44
45    //listening attributes in shortcode [woof]
46    woof_autosubmit = parseInt(jQuery('.woof').eq(0).data('autosubmit'), 10);
47    woof_ajax_redraw = parseInt(jQuery('.woof').eq(0).data('ajax-redraw'), 10);
48
49
50
51    //+++
52
53    woof_ext_init_functions = JSON.parse(woof_ext_init_functions);
54
55    //fix for native woo price range
56    woof_init_native_woo_price_filter();
57
58
59    jQuery('body').on('price_slider_change', function (event, min, max) {
60
61        if (woof_autosubmit && !woof_show_price_search_button && jQuery('.price_slider_wrapper').length < 3) {
62
63            jQuery('.woof .widget_price_filter form').trigger('submit');
64
65        } else {
66            var min_price = jQuery(this).find('.price_slider_amount #min_price').val();
67            var max_price = jQuery(this).find('.price_slider_amount #max_price').val();
68            woof_current_values.min_price = min_price;
69            woof_current_values.max_price = max_price;
70        }
71    });
72
73    jQuery('body').on('change', '.woof_price_filter_dropdown', function () {
74        var val = jQuery(this).val();
75        if (parseInt(val, 10) == -1) {
76            delete woof_current_values.min_price;
77            delete woof_current_values.max_price;
78        } else {
79            var val = val.split("-");
80            woof_current_values.min_price = val[0];
81            woof_current_values.max_price = val[1];
82        }
83
84        if (woof_autosubmit || jQuery(this).within('.woof').length == 0) {
85            woof_submit_link(woof_get_submit_link());
86        }
87    });
88
89    //change value in textinput price filter if WOOCS is installed
90    woof_recount_text_price_filter();
91    //+++
92    jQuery('body').on('change', '.woof_price_filter_txt', function () {
93
94        var from = parseInt(jQuery(this).parent().find('.woof_price_filter_txt_from').val(), 10);
95        var to = parseInt(jQuery(this).parent().find('.woof_price_filter_txt_to').val(), 10);
96
97        if (to < from || from < 0) {
98            delete woof_current_values.min_price;
99            delete woof_current_values.max_price;
100        } else {
101            if (typeof woocs_current_currency !== 'undefined') {
102                from = Math.ceil(from / parseFloat(woocs_current_currency.rate));
103                to = Math.ceil(to / parseFloat(woocs_current_currency.rate));
104            }
105
106            woof_current_values.min_price = from;
107            woof_current_values.max_price = to;
108        }
109
110        if (woof_autosubmit || jQuery(this).within('.woof').length == 0) {
111            woof_submit_link(woof_get_submit_link());
112        }
113    });
114
115
116    //***
117
118    jQuery('body').on('click', '.woof_open_hidden_li_btn', function () {
119        var state = jQuery(this).data('state');
120        var type = jQuery(this).data('type');
121
122        if (state == 'closed') {
123            jQuery(this).parents('.woof_list').find('.woof_hidden_term').addClass('woof_hidden_term2');
124            jQuery(this).parents('.woof_list').find('.woof_hidden_term').removeClass('woof_hidden_term');
125            if (type == 'image') {
126                jQuery(this).find('img').attr('src', jQuery(this).data('opened'));
127            } else {
128                jQuery(this).html(jQuery(this).data('opened'));
129            }
130
131            jQuery(this).data('state', 'opened');
132        } else {
133            jQuery(this).parents('.woof_list').find('.woof_hidden_term2').addClass('woof_hidden_term');
134            jQuery(this).parents('.woof_list').find('.woof_hidden_term2').removeClass('woof_hidden_term2');
135
136            if (type == 'image') {
137                jQuery(this).find('img').attr('src', jQuery(this).data('closed'));
138            } else {
139                jQuery(this).text(jQuery(this).data('closed'));
140            }
141
142            jQuery(this).data('state', 'closed');
143        }
144
145
146        return false;
147    });
148    //open hidden block
149    woof_open_hidden_li();
150
151    //*** woocommerce native "AVERAGE RATING" widget synchronizing
152    jQuery('.widget_rating_filter li.wc-layered-nav-rating a').on('click', function () {
153        var is_chosen = jQuery(this).parent().hasClass('chosen');
154        var parsed_url = woof_parse_url(jQuery(this).attr('href'));
155        var rate = 0;
156        if (parsed_url.query !== undefined) {
157            if (parsed_url.query.indexOf('min_rating') !== -1) {
158                var arrayOfStrings = parsed_url.query.split('min_rating=');
159                rate = parseInt(arrayOfStrings[1], 10);
160            }
161        }
162        jQuery(this).parents('ul').find('li').removeClass('chosen');
163        if (is_chosen) {
164            delete woof_current_values.min_rating;
165        } else {
166            woof_current_values.min_rating = rate;
167            jQuery(this).parent().addClass('chosen');
168        }
169
170        woof_submit_link(woof_get_submit_link());
171
172        return false;
173    });
174
175    //WOOF start filtering button action
176    jQuery('body').on('click', '.woof_start_filtering_btn', function () {
177
178        var shortcode = jQuery(this).parents('.woof').data('shortcode');
179        jQuery(this).html(woof_lang_loading);
180        jQuery(this).addClass('woof_start_filtering_btn2');
181        jQuery(this).removeClass('woof_start_filtering_btn');
182        //redrawing [woof ajax_redraw=1] only
183        var data = {
184            action: "woof_draw_products",
185            page: 1,
186            shortcode: 'woof_nothing', //we do not need get any products, seacrh form data only
187            woof_shortcode: shortcode
188        };
189
190        jQuery.post(woof_ajaxurl, data, function (content) {
191            content = JSON.parse(content);
192            jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone'));
193            woof_mass_reinit();
194	    woof_init_tooltip();
195        });
196
197
198        return false;
199    });
200
201    //***
202    var str = window.location.href;
203    window.onpopstate = function (event) {
204        try {
205            if (Object.keys(woof_current_values).length) {
206
207                var temp = str.split('?');
208                var get1 = "";
209                if (temp[1] != undefined) {
210                    get1 = temp[1].split('#');
211                }
212                var str2 = window.location.href;
213                var temp2 = str2.split('?');
214                if (temp2[1] == undefined) {
215                    //return false;
216                    var get2 = {0: "", 1: ""};
217
218                } else {
219                    var get2 = temp2[1].split('#');
220                }
221
222                if (get2[0] != get1[0]) {
223                    woof_show_info_popup(woof_lang_loading);
224                    window.location.reload();
225                }
226                return false;
227            }
228        } catch (e) {
229            console.log(e);
230        }
231    };
232    //***
233
234    //ion-slider price range slider
235    woof_init_ion_sliders();
236
237    //***
238
239    woof_init_show_auto_form();
240    woof_init_hide_auto_form();
241
242    //***
243    woof_remove_empty_elements();
244
245    woof_init_search_form();
246    woof_init_pagination();
247    woof_init_orderby();
248    woof_init_reset_button();
249    woof_init_beauty_scroll();
250    //+++
251    woof_draw_products_top_panel();
252    woof_shortcode_observer();
253
254    //tooltip  
255    woof_init_tooltip();
256
257    //mobile filter
258    woof_init_mobile_filter();
259
260
261//+++
262    //if we use redirect attribute in shortcode [woof is_ajax=0]
263    //not for ajax, for redirect mode only
264    if (!woof_is_ajax) {
265        woof_redirect_init();
266    }
267
268    woof_init_toggles();
269
270});
271
272//if we use redirect attribute in shortcode [woof is_ajax=0]
273//not for ajax, for redirect mode only
274function woof_redirect_init() {
275
276    try {
277        if (jQuery('.woof').length) {
278            //https://wordpress.org/support/topic/javascript-error-in-frontjs?replies=1
279            if (undefined !== jQuery('.woof').val()) {
280                woof_redirect = jQuery('.woof').eq(0).data('redirect');//default value
281                if (woof_redirect.length > 0) {
282                    woof_shop_page = woof_current_page_link = woof_redirect;
283                }
284                return woof_redirect;
285            }
286        }
287    } catch (e) {
288        console.log(e);
289    }
290
291}
292
293function woof_init_orderby() {
294    jQuery('body').on('submit', 'form.woocommerce-ordering', function () {
295        /* woo3.3 */
296        if (!jQuery("#is_woo_shortcode").length) {
297            return false;
298        }
299        /* +++ */
300    });
301    jQuery('body').on('change', 'form.woocommerce-ordering select.orderby', function () {
302        /* woo3.3 */
303        if (!jQuery("#is_woo_shortcode").length) {
304            woof_current_values.orderby = jQuery(this).val();
305            woof_ajax_page_num = 1;
306            woof_submit_link(woof_get_submit_link(), 0);
307            return false;
308        }
309        /* +++ */
310    });
311}
312
313function woof_init_reset_button() {
314
315    jQuery('body').on('click', '.woof_reset_search_form', function () {
316        //var link = jQuery(this).data('link');
317        woof_ajax_page_num = 1;
318        woof_ajax_redraw = 0;
319        woof_reset_btn_action = true;
320        if (woof_is_permalink) {
321            woof_current_values = {};	   
322            woof_submit_link(woof_get_submit_link().split("page/")[0]);
323
324        } else {
325            var link = woof_shop_page;
326            if (woof_current_values.hasOwnProperty('page_id')) {
327                link = location.protocol + '//' + location.host + "/?page_id=" + woof_current_values.page_id;
328                woof_current_values = {'page_id': woof_current_values.page_id};
329                woof_get_submit_link();
330            }
331            //***
332            woof_submit_link(link);
333            if (woof_is_ajax) {
334                history.pushState({}, "", link);
335                if (woof_current_values.hasOwnProperty('page_id')) {
336                    woof_current_values = {'page_id': woof_current_values.page_id};
337                } else {
338                    woof_current_values = {};
339                }
340            }
341        }
342        return false;
343    });
344}
345
346function woof_init_pagination() {
347
348    if (woof_is_ajax === 1) {
349        //jQuery('.woocommerce-pagination ul.page-numbers a.page-numbers').life('click', function () {
350        jQuery('body').on('click', '.woocommerce-pagination a.page-numbers', function () {
351            var l = jQuery(this).attr('href');
352
353            if (woof_ajax_first_done) {
354                //wp-admin/admin-ajax.php?paged=2
355                var res = l.split("paged=");
356                if (typeof res[1] !== 'undefined') {
357                    woof_ajax_page_num = parseInt(res[1]);
358                } else {
359                    woof_ajax_page_num = 1;
360                }
361                var res2 = l.split("product-page=");
362                if (typeof res2[1] !== 'undefined') {
363                    woof_ajax_page_num = parseInt(res2[1]);
364                }
365            } else {
366                var res = l.split("page/");
367                if (typeof res[1] !== 'undefined') {
368                    woof_ajax_page_num = parseInt(res[1]);
369                } else {
370                    woof_ajax_page_num = 1;
371                }
372                var res2 = l.split("product-page=");
373                if (typeof res2[1] !== 'undefined') {
374                    woof_ajax_page_num = parseInt(res2[1]);
375                }
376            }
377
378            //+++
379
380
381            {
382                woof_submit_link(woof_get_submit_link(), 0);
383            }
384
385            return false;
386        });
387    }
388}
389
390function woof_init_search_form() {
391    woof_init_checkboxes();
392    woof_init_mselects();
393    woof_init_radios();
394    woof_price_filter_radio_init();
395    woof_init_selects();
396
397
398    //for extensions
399    if (woof_ext_init_functions !== null) {
400        jQuery.each(woof_ext_init_functions, function (type, func) {
401            eval(func + '()');
402        });
403    }
404
405    //+++
406    jQuery('.woof_submit_search_form').on('click', function () {
407
408        if (woof_ajax_redraw) {
409            //[woof redirect="http://test-all/" autosubmit=1 ajax_redraw=1 is_ajax=1 tax_only="locations" by_only="none"]
410            woof_ajax_redraw = 0;
411            woof_is_ajax = 0;
412        }
413        //***
414        woof_submit_link(woof_get_submit_link());
415        return false;
416    });
417
418
419
420    //***
421    jQuery('ul.woof_childs_list').parent('li').addClass('woof_childs_list_li');
422
423    //***
424
425    woof_remove_class_widget();
426    woof_checkboxes_slide();
427}
428
429var woof_submit_link_locked = false;
430function woof_submit_link(link, ajax_redraw) {
431
432
433    if (woof_submit_link_locked) {
434        return;
435    }
436    if (typeof WoofTurboMode != 'undefined') {
437        WoofTurboMode.woof_submit_link(link);
438
439        return;
440    }
441    if (typeof ajax_redraw == 'undefined') {
442        ajax_redraw = woof_ajax_redraw;
443    }
444
445    woof_submit_link_locked = true;
446    woof_show_info_popup(woof_lang_loading);
447
448    if (woof_is_ajax === 1 && !ajax_redraw) {
449
450        woof_ajax_first_done = true;
451        var data = {
452            action: "woof_draw_products",
453            link: link,
454            page: woof_ajax_page_num,
455            shortcode: jQuery('#woof_results_by_ajax').data('shortcode'),
456            woof_shortcode: jQuery('div.woof').data('shortcode')
457        };
458
459        jQuery.post(woof_ajaxurl, data, function (content) {
460            content = JSON.parse(content);
461            if (jQuery('.woof_results_by_ajax_shortcode').length) {
462                if (typeof content.products != "undefined") {
463                    jQuery('#woof_results_by_ajax').replaceWith(content.products);
464
465                    /* compatibility found products count*/
466                    var found_count = jQuery('.woof_found_count');
467                    jQuery(found_count).show();
468                    if (found_count.length > 0) {
469                        var count_prod = jQuery("#woof_results_by_ajax").data('count');
470                        if (typeof count_prod != "undefined") {
471                            jQuery(found_count).text(count_prod);
472                        }
473
474                    }
475
476                }
477            } else {
478                if (typeof content.products != "undefined") {
479                    jQuery('.woof_shortcode_output').replaceWith(content.products);
480                }
481            }
482            if (typeof content.additional_fields != "undefined") {
483                jQuery.each(content.additional_fields, function (selector, html_data) {
484                    jQuery(selector).replaceWith(html_data);
485                });
486            }
487
488
489            jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone'));
490            woof_draw_products_top_panel();
491            woof_mass_reinit();
492            woof_submit_link_locked = false;
493            //removing id woof_results_by_ajax - multi in ajax mode sometimes
494            //when uses shorcode woof_products in ajax and in settings try ajaxify shop is Yes
495            jQuery.each(jQuery('#woof_results_by_ajax'), function (index, item) {
496                if (index == 0) {
497                    return;
498                }
499
500                jQuery(item).removeAttr('id');
501            });
502            /*mobile  behavior*/
503            jQuery('.woof_hide_mobile_filter').trigger('click');
504
505
506
507            //infinite scroll
508            woof_infinite();
509            //*** script after ajax loading here
510            woof_js_after_ajax_done();
511            //***  change  link  in button "add to cart"
512            woof_change_link_addtocart();
513
514            /*tooltip*/
515            woof_init_tooltip();
516
517            document.dispatchEvent(new CustomEvent('woof-ajax-form-redrawing', {detail: {
518                    link: link
519                }}));
520
521        });
522
523    } else {
524
525        if (ajax_redraw) {
526            //redrawing [woof ajax_redraw=1] only
527            var data = {
528                action: "woof_draw_products",
529                link: link,
530                page: 1,
531                shortcode: 'woof_nothing', //we do not need get any products, seacrh form data only
532                woof_shortcode: jQuery('div.woof').eq(0).data('shortcode')
533            };
534            jQuery.post(woof_ajaxurl, data, function (content) {
535                content = JSON.parse(content);
536                jQuery('div.woof_redraw_zone').replaceWith(jQuery(content.form).find('.woof_redraw_zone'));
537                woof_mass_reinit();
538                woof_submit_link_locked = false;
539                /*tooltip*/
540                woof_init_tooltip();
541
542                document.dispatchEvent(new CustomEvent('woof-ajax-form-redrawing', {detail: {
543                        link: link
544                    }}));
545            });
546        } else {
547
548            window.location = link;
549            woof_show_info_popup(woof_lang_loading);
550        }
551    }
552}
553
554function woof_remove_empty_elements() {
555    // lets check for empty drop-downs
556    jQuery.each(jQuery('.woof_container select'), function (index, select) {
557        var size = jQuery(select).find('option').length;
558        if (size === 0) {
559            jQuery(select).parents('.woof_container').remove();
560        }
561    });
562    //+++
563    // lets check for empty checkboxes, radio, color conatiners
564    jQuery.each(jQuery('ul.woof_list'), function (index, ch) {
565        var size = jQuery(ch).find('li').length;
566        if (size === 0) {
567            jQuery(ch).parents('.woof_container').remove();
568        }
569    });
570}
571
572function woof_get_submit_link() {
573//filter woof_current_values values
574    if (woof_is_ajax) {
575        woof_current_values.page = woof_ajax_page_num;
576    }
577//+++
578    if (Object.keys(woof_current_values).length > 0) {
579        jQuery.each(woof_current_values, function (index, value) {
580            if (index == swoof_search_slug) {
581                delete woof_current_values[index];
582            }
583            if (index == 's') {
584                delete woof_current_values[index];
585            }
586            if (index == 'product') {
587//for single product page (when no permalinks)
588                delete woof_current_values[index];
589            }
590            if (index == 'really_curr_tax') {
591                delete woof_current_values[index];
592            }
593        });
594    }
595
596
597    //***
598    if (Object.keys(woof_current_values).length === 2) {
599        if (('min_price' in woof_current_values) && ('max_price' in woof_current_values)) {
600            woof_current_page_link = woof_current_page_link.replace(new RegExp(/page\/(\d+)/), "");
601            var l = woof_current_page_link + '?min_price=' + woof_current_values.min_price + '&max_price=' + woof_current_values.max_price;
602            if (woof_is_ajax) {
603                history.pushState({}, "", l);
604            }
605            return l;
606        }
607    }
608
609
610
611    //***
612
613    if (Object.keys(woof_current_values).length === 0) {
614        if (woof_is_ajax) {
615            history.pushState({}, "", woof_current_page_link);
616        }
617        return woof_current_page_link;
618    }
619    //+++
620    if (Object.keys(woof_really_curr_tax).length > 0) {
621        woof_current_values['really_curr_tax'] = woof_really_curr_tax.term_id + '-' + woof_really_curr_tax.taxonomy;
622    }
623    //+++
624    var link = woof_current_page_link + "?" + swoof_search_slug + "=1";
625
626    //just for the case when no permalinks enabled
627    if (!woof_is_permalink) {
628
629        if (woof_redirect.length > 0) {
630            link = woof_redirect + "?" + swoof_search_slug + "=1";
631            if (woof_current_values.hasOwnProperty('page_id')) {
632                delete woof_current_values.page_id;
633            }
634        } else {
635            link = location.protocol + '//' + location.host + "?" + swoof_search_slug + "=1";
636
637        }
638    }
639
640    //any trash for different sites, useful for quick support
641    var woof_exclude_accept_array = ['path'];
642
643    if (Object.keys(woof_current_values).length > 0) {
644        jQuery.each(woof_current_values, function (index, value) {
645            if (index == 'page' && woof_is_ajax) {
646                index = 'paged';//for right pagination if copy/paste this link and send somebody another by email for example
647            }
648            if (index == "product-page") {
649                return;
650            }
651
652            //http://dev.products-filter.com/?swoof=1&woof_author=3&woof_sku&woof_text=single
653            //avoid links where values is empty
654            if (typeof value !== 'undefined') {
655                if ((typeof value && value.length > 0) || typeof value == 'number')
656                {
657                    if (jQuery.inArray(index, woof_exclude_accept_array) == -1) {
658
659                        link = link + "&" + index + "=" + value;
660                    }
661                }
662            }
663
664        });
665    }
666
667    //+++
668    //remove wp pagination like 'page/2'
669    link = link.replace(new RegExp(/page\/(\d+)/), "");
670    if (woof_is_ajax) {
671        history.pushState({}, "", link);
672
673    }
674
675    return link;
676}
677
678
679
680function woof_show_info_popup(text) {
681    if (woof_overlay_skin == 'default') {
682        jQuery("#woof_html_buffer").text(text);
683        jQuery("#woof_html_buffer").fadeTo(200, 0.9);
684    } else {
685        //http://jxnblk.com/loading/
686        switch (woof_overlay_skin) {
687            case 'loading-balls':
688            case 'loading-bars':
689            case 'loading-bubbles':
690            case 'loading-cubes':
691            case 'loading-cylon':
692            case 'loading-spin':
693            case 'loading-spinning-bubbles':
694            case 'loading-spokes':
695                jQuery('body').plainOverlay('show', {progress: function () {
696                        //img style should be inlined
697                        return jQuery('<div id="woof_svg_load_container"><img style="height: 100%; width: 100%" src="' + woof_link + 'img/loading-master/' + woof_overlay_skin + '.svg" alt=""></div>');
698                    }});
699                break;
700            default:
701                jQuery('body').plainOverlay('show', {duration: -1});
702                break;
703        }
704    }
705}
706
707
708function woof_hide_info_popup() {
709    if (woof_overlay_skin == 'default') {
710        window.setTimeout(function () {
711            jQuery("#woof_html_buffer").fadeOut(400);
712        }, 200);
713    } else {
714        jQuery('body').plainOverlay('hide');
715    }
716}
717
718function woof_draw_products_top_panel() {
719
720    if (woof_is_ajax) {
721        jQuery('#woof_results_by_ajax').prev('.woof_products_top_panel').remove();
722    }
723
724    var panel = jQuery('.woof_products_top_panel');
725
726    panel.html('');
727    if (Object.keys(woof_current_values).length > 0) {
728        panel.show();
729        panel.html('<ul></ul>');
730        panel.find('ul').attr('class', 'woof_products_top_panel_ul');
731        var is_price_in = false;
732        //lets show this on the panel
733
734        jQuery.each(woof_current_values, function (index, value) {
735            //lets filter data for the panel
736
737            if (jQuery.inArray(index, woof_accept_array) == -1 && jQuery.inArray(index.replace("rev_", ""), woof_accept_array) == -1) {
738                return;
739            }
740
741            //***
742
743            if ((index == 'min_price' || index == 'max_price') && is_price_in) {
744                return;
745            }
746
747            if ((index == 'min_price' || index == 'max_price') && !is_price_in) {
748                is_price_in = true;
749                index = 'price';
750                value = woof_lang_pricerange;
751            }
752            //+++
753            value = value.toString().trim();
754            if (value.search(',')) {
755                value = value.split(',');
756            }
757            //+++
758            jQuery.each(value, function (i, v) {
759                if (index == 'page') {
760                    return;
761                }
762
763                if (index == 'post_type') {
764                    return;
765                }
766
767                var txt = v;
768                if (index == 'orderby') {
769                    if (woof_lang[v] !== undefined) {
770                        txt = woof_lang.orderby + ': ' + woof_lang[v];
771                    } else {
772                        txt = woof_lang.orderby + ': ' + v;
773                    }
774                } else if (index == 'perpage') {
775                    txt = woof_lang.perpage;
776                } else if (index == 'price') {
777                    txt = woof_lang.pricerange;
778                } else {
779
780                    var is_in_custom = false;
781                    if (Object.keys(woof_lang_custom).length > 0) {
782                        jQuery.each(woof_lang_custom, function (i, tt) {
783                            if (i == index) {
784                                is_in_custom = true;
785                                txt = tt;
786                                if (index == 'woof_sku') {
787                                    txt += " " + v;//because search by SKU can by more than 1 value
788                                }
789                            }
790                        });
791                    }
792
793                    if (!is_in_custom) {
794
795                        try {
796                            txt = jQuery("input[data-anchor='woof_n_" + index + '_' + v + "']").val();
797                        } catch (e) {
798                            console.log(e);
799                        }
800
801                        if (typeof txt === 'undefined')
802                        {
803                            txt = v;
804                        }
805                    }
806
807
808                }
809                if (typeof woof_filter_titles[index] != 'undefined') {
810
811                    var cont_item = panel.find('ul.woof_products_top_panel_ul li ul[data-container=' + index + ']');
812
813                    if (cont_item.length) {
814                        cont_item.append(
815                                jQuery('<li>').append(
816                                jQuery('<a>').attr('href', "").attr('data-tax', index).attr('data-slug', v).append(
817                                jQuery('<span>').attr('class', 'woof_remove_ppi').append(txt)
818                                )));
819                    } else {
820                        panel.find('ul.woof_products_top_panel_ul').append(
821                                jQuery('<li>').append(
822                                jQuery('<ul>').attr('data-container', index).append(
823                                jQuery('<li>').text(woof_filter_titles[index] + ":")).append(
824                                jQuery('<li>').append(
825                                jQuery('<a>').attr('href', "").attr('data-tax', index).attr('data-slug', v).append(
826                                jQuery('<span>').attr('class', 'woof_remove_ppi').append(txt)
827                                )))));
828                    }
829                } else {
830                    panel.find('ul.woof_products_top_panel_ul').append(
831                            jQuery('<li>').append(
832                            jQuery('<a>').attr('href', "").attr('data-tax', index).attr('data-slug', v).append(
833                            jQuery('<span>').attr('class', 'woof_remove_ppi').append(txt)
834                            )));
835                }
836
837            });
838
839
840        });
841    }
842
843
844    if (jQuery(panel).find('li').length == 0 || !jQuery('.woof_products_top_panel').length) {
845        panel.hide();
846    } else {
847        panel.find('ul.woof_products_top_panel_ul').prepend(
848                jQuery('<li>').append(
849                jQuery('<button>').attr('class', "woof_reset_button_2").append(woof_lang.clear_all))
850                );
851    }
852
853    jQuery('.woof_reset_button_2').on('click', function () {
854        woof_ajax_page_num = 1;
855        woof_ajax_redraw = 0;
856        woof_reset_btn_action = true;
857
858        if (woof_is_permalink) {
859            woof_current_values = {};
860            woof_submit_link(woof_get_submit_link().split("page/")[0]);
861        } else {
862            var link = woof_shop_page;
863            if (woof_current_values.hasOwnProperty('page_id')) {
864                link = location.protocol + '//' + location.host + "/?page_id=" + woof_current_values.page_id;
865                woof_current_values = {'page_id': woof_current_values.page_id};
866                woof_get_submit_link();
867            }
868            //***
869            woof_submit_link(link);
870            if (woof_is_ajax) {
871                history.pushState({}, "", link);
872                if (woof_current_values.hasOwnProperty('page_id')) {
873                    woof_current_values = {'page_id': woof_current_values.page_id};
874                } else {
875                    woof_current_values = {};
876                }
877            }
878        }
879        return false;
880    });
881    //+++
882    jQuery('.woof_remove_ppi').parent().on('click', function () {
883        event.preventDefault();
884        var tax = jQuery(this).data('tax');
885        var name = jQuery(this).data('slug');
886
887        //***
888
889        if (tax != 'price') {
890
891            var values = woof_current_values[tax];
892            values = values.split(',');
893            var tmp = [];
894            jQuery.each(values, function (index, value) {
895                if (value != name) {
896                    tmp.push(value);
897                }
898            });
899            values = tmp;
900
901            if (values.length) {
902                woof_current_values[tax] = values.join(',');
903            } else {
904                delete woof_current_values[tax];
905            }
906        } else {
907            delete woof_current_values['min_price'];
908            delete woof_current_values['max_price'];
909        }
910        woof_ajax_page_num = 1;
911        woof_reset_btn_action = true;
912        {
913            woof_submit_link(woof_get_submit_link());
914        }
915        jQuery('.woof_products_top_panel').find("[data-tax='" + tax + "'][href='" + name + "']").hide(333);
916        return false;
917
918    });
919
920}
921
922//control conditions if proucts shortcode uses on the page
923function woof_shortcode_observer() {
924
925    var redirect = true;
926    if (jQuery('.woof_shortcode_output').length || (jQuery('.woocommerce .products').length && !jQuery('.single-product').length)) {
927        redirect = false;
928    }
929    if (jQuery('.woocommerce .woocommerce-info').length) {
930        redirect = false;
931    }
932    if (typeof woof_not_redirect !== 'undefined' && woof_not_redirect == 1) {
933        redirect = false;
934    }
935
936    if (jQuery('.woot-data-table').length) {
937        redirect = false;
938    }
939
940    if (!redirect) {
941        woof_current_page_link = location.protocol + '//' + location.host + location.pathname;
942    }
943
944    if (jQuery('#woof_results_by_ajax').length) {
945        woof_is_ajax = 1;
946    }
947}
948
949
950
951function woof_init_beauty_scroll() {
952    if (woof_use_beauty_scroll) {
953        try {
954            var anchor = ".woof_section_scrolled, .woof_sid_auto_shortcode .woof_container_radio .woof_block_html_items, .woof_sid_auto_shortcode .woof_container_
954checkbox .woof_block_html_items, .woof_sid_auto_shortcode .woof_container_label .woof_block_html_items";
955            jQuery("" + anchor).addClass('woof_use_beauty_scroll');
956        } catch (e) {
957            console.log(e);
958        }
959    }
960}
961
962//just for inbuilt price range widget
963function woof_remove_class_widget() {
964    jQuery('.woof_container_inner').find('.widget').removeClass('widget');
965}
966
967function woof_init_show_auto_form() {
968    jQuery('.woof_show_auto_form').off('click');
969
970    if (jQuery('.woof_show_auto_form.woof_btn').length) {
971        jQuery('.woof_btn_default').remove();
972    }
973
974    jQuery('.woof_show_auto_form').on('click', function () {
975        var _this = this;
976        jQuery(_this).addClass('woof_hide_auto_form').removeClass('woof_show_auto_form');
977        jQuery(".woof_auto_show").show().animate(
978                {
979                    height: (jQuery(".woof_auto_show_indent").height() + 20) + "px",
980                    opacity: 1
981                }, 377, function () {
982            woof_init_hide_auto_form();
983            jQuery('.woof_auto_show').removeClass('woof_overflow_hidden');
984            jQuery('.woof_auto_show_indent').removeClass('woof_overflow_hidden');
985            jQuery(".woof_auto_show").height('auto');
986        });
987
988
989        return false;
990    });
991
992
993}
994
995function woof_init_hide_auto_form() {
996    jQuery('.woof_hide_auto_form').off('click');
997    jQuery('.woof_hide_auto_form').on('click', function () {
998        var _this = this;
999        jQuery(_this).addClass('woof_show_auto_form').removeClass('woof_hide_auto_form');
1000        jQuery(".woof_auto_show").show().animate(
1001                {
1002                    height: "1px",
1003                    opacity: 0
1004                }, 377, function () {
1005
1006            jQuery('.woof_auto_show').addClass('woof_overflow_hidden');
1007            jQuery('.woof_auto_show_indent').addClass('woof_overflow_hidden');
1008            woof_init_show_auto_form();
1009        });
1010
1011        return false;
1012    });
1013
1014
1015}
1016
1017//if we have mode - child checkboxes closed - append openers buttons by js
1018function woof_checkboxes_slide() {
1019    if (woof_checkboxes_slide_flag == true) {
1020        var childs = jQuery('ul.woof_childs_list');
1021        if (childs.length) {
1022            jQuery.each(childs, function (index, ul) {
1023
1024                if (jQuery(ul).parents('.woof_no_close_childs').length) {
1025                    return;
1026                }
1027
1028
1029                var span_class = 'woof_is_closed';
1030                if (woof_supports_html5_storage()) {
1031                    //test mode  from 06.11.2017
1032                    var preulstate = localStorage.getItem(jQuery(ul).closest('li').attr("class"));
1033                    if (preulstate && preulstate == 'woof_is_opened') {
1034                        var span_class = 'woof_is_opened';
1035                        jQuery(ul).show();
1036                    }
1037                    jQuery(ul).parent('li').children('label').after('<a href="javascript:void(0);" class="woof_childs_list_opener" ><span class="' + span_class + '"></span></a>');
1038                    //++   
1039                } else {
1040                    if (jQuery(ul).find('input[type=checkbox],input[type=radio]').is(':checked')) {
1041                        jQuery(ul).show();
1042                        span_class = 'woof_is_opened';
1043                    }
1044                    jQuery(ul).parent('li').children('label').after('<a href="javascript:void(0);" class="woof_childs_list_opener" ><span class="' + span_class + '"></span></a>');
1045
1046                }
1047
1048            });
1049	    
1050	    
1051
1052            jQuery.each(jQuery('a.woof_childs_list_opener span'), function (index, a) {
1053
1054                jQuery(a).on('click', function () {
1055                    var span = jQuery(this);
1056                    var this_ = jQuery(this).parent(".woof_childs_list_opener");
1057                    if (span.hasClass('woof_is_closed')) {
1058                        //lets open
1059                        jQuery(this_).parent().find('ul.woof_childs_list').first().show(333);
1060                        span.removeClass('woof_is_closed');
1061                        span.addClass('woof_is_opened');
1062                    } else {
1063                        //lets close
1064                        jQuery(this_).parent().find('ul.woof_childs_list').first().hide(333);
1065                        span.removeClass('woof_is_opened');
1066                        span.addClass('woof_is_closed');
1067                    }
1068
1069                    if (woof_supports_html5_storage()) {
1070                        //test mode  from 06.11.2017
1071                        var ullabel = jQuery(this_).closest('li').attr("class");
1072                        var ullstate = jQuery(this_).children("span").attr("class");
1073                        localStorage.setItem(ullabel, ullstate);
1074                    }
1075                    return false;
1076                });
1077            });
1078        }
1079    }
1080}
1081
1082function woof_init_ion_sliders() {
1083
1084    jQuery.each(jQuery('.woof_range_slider'), function (index, input) {
1085        try {
1086
1087
1088            jQuery(input).ionRangeSlider({
1089                min: jQuery(input).data('min'),
1090                max: jQuery(input).data('max'),
1091                from: jQuery(input).data('min-now'),
1092                to: jQuery(input).data('max-now'),
1093                type: 'double',
1094                prefix: jQuery(input).data('slider-prefix'),
1095                postfix: jQuery(input).data('slider-postfix'),
1096                prettify: true,
1097                hideMinMax: false,
1098                hideFromTo: false,
1099                grid: true,
1100                step: jQuery(input).data('step'),
1101                onFinish: function (ui) {
1102                    var tax = jQuery(input).data('taxes');
1103                    woof_current_values.min_price = (parseFloat(ui.from, 10) / tax);
1104                    woof_current_values.max_price = (parseFloat(ui.to, 10) / tax);
1105                    //woocs adaptation
1106                    if (typeof woocs_current_currency !== 'undefined') {
1107                        woof_current_values.min_price = woof_current_values.min_price / parseFloat(woocs_current_currency.rate);
1108                        woof_current_values.max_price = woof_current_values.max_price / parseFloat(woocs_current_currency.rate);
1109                    }
1110                    //***
1111                    woof_ajax_page_num = 1;
1112                    if (woof_autosubmit || jQuery(input).within('.woof').length == 0) {
1113                        woof_submit_link(woof_get_submit_link());
1114                    }
1115                    return false;
1116                },
1117                onChange: function (data) {
1118                    if (jQuery('.woof_price_filter_txt')) {
1119                        var tax = jQuery(input).data('taxes');
1120                        jQuery('.woof_price_filter_txt_from').val(parseInt(data.from, 10) / tax);
1121                        jQuery('.woof_price_filter_txt_to').val(parseInt(data.to, 10) / tax);
1122                        //woocs adaptation
1123                        if (typeof woocs_current_currency !== 'undefined') {
1124                            jQuery('.woof_price_filter_txt_from').val(Math.ceil(jQuery('.woof_price_filter_txt_from').val() / parseFloat(woocs_current_currency.rate)));
1125                            jQuery('.woof_price_filter_txt_to').val(Math.ceil(jQuery('.woof_price_filter_txt_to').val() / parseFloat(woocs_current_currency.rate)));
1126                        }
1127                    }
1128                },
1129            });
1130        } catch (e) {
1131
1132        }
1133    });
1134}
1135
1136function woof_init_native_woo_price_filter() {
1137    jQuery('.widget_price_filter form').off('submit');
1138    jQuery('.widget_price_filter form').on('submit', function () {
1139
1140        var min_price = jQuery(this).find('.price_slider_amount #min_price').val();
1141        var max_price = jQuery(this).find('.price_slider_amount #max_price').val();
1142        woof_current_values.min_price = min_price;
1143        woof_current_values.max_price = max_price;
1144        woof_ajax_page_num = 1;
1145        if (woof_autosubmit) {
1146            //comment next code row to avoid endless ajax requests
1147            woof_submit_link(woof_get_submit_link());
1148        }
1149        return false;
1150    });
1151
1152}
1153
1154//we need after ajax redrawing of the search form
1155function woof_reinit_native_woo_price_filter() {
1156
1157    // woocommerce_price_slider_params is required to continue, ensure the object exists
1158    if (typeof woocommerce_price_slider_params === 'undefined') {
1159
1160        return false;
1161    }
1162
1163    // Get markup ready for slider
1164    jQuery('input#min_price, input#max_price').hide();
1165    jQuery('.price_slider, .price_label').show();
1166
1167    // Price slider uses jquery ui
1168    var min_price = jQuery('.price_slider_amount #min_price').data('min'),
1169            max_price = jQuery('.price_slider_amount #max_price').data('max'),
1170            current_min_price = parseInt(min_price, 10),
1171            current_max_price = parseInt(max_price, 10);
1172
1173    if (woof_current_values.hasOwnProperty('min_price')) {
1174        current_min_price = parseInt(woof_current_values.min_price, 10);
1175        current_max_price = parseInt(woof_current_values.max_price, 10);
1176    } else {
1177        if (woocommerce_price_slider_params.min_price) {
1178            current_min_price = parseInt(woocommerce_price_slider_params.min_price, 10);
1179        }
1180        if (woocommerce_price_slider_params.max_price) {
1181            current_max_price = parseInt(woocommerce_price_slider_params.max_price, 10);
1182        }
1183    }
1184
1185    //***
1186
1187    var currency_symbol = woocommerce_price_slider_params.currency_symbol;
1188    if (typeof currency_symbol == 'undefined') {
1189        currency_symbol = woocommerce_price_slider_params.currency_format_symbol;
1190    }
1191
1192    jQuery(document.body).on('price_slider_create price_slider_slide', function (event, min, max) {
1193
1194        if (typeof woocs_current_currency !== 'undefined') {
1195            var label_min = min;
1196            var label_max = max;
1197            if (typeof currency_symbol == 'undefined') {
1198
1199                currency_symbol = woocs_current_currency.symbol
1200            }
1201
1202
1203            if (woocs_current_currency.rate !== 1) {
1204                label_min = Math.ceil(label_min * parseFloat(woocs_current_currency.rate));
1205                label_max = Math.ceil(label_max * parseFloat(woocs_current_currency.rate));
1206            }
1207
1208            //+++
1209            label_min = woof_front_number_format(label_min, 2, '.', ',');
1210            label_max = woof_front_number_format(label_max, 2, '.', ',');
1211            if (jQuery.inArray(woocs_current_currency.name, woocs_array_no_cents) || woocs_current_currency.hide_cents == 1) {
1212                label_min = label_min.replace('.00', '');
1213                label_max = label_max.replace('.00', '');
1214            }
1215            //+++
1216
1217
1218            if (woocs_current_currency.position === 'left') {
1219
1220                jQuery('.price_slider_amount span.from').html(currency_symbol + label_min);
1221                jQuery('.price_slider_amount span.to').html(currency_symbol + label_max);
1222
1223            } else if (woocs_current_currency.position === 'left_space') {
1224
1225                jQuery('.price_slider_amount span.from').html(currency_symbol + " " + label_min);
1226                jQuery('.price_slider_amount span.to').html(currency_symbol + " " + label_max);
1227
1228            } else if (woocs_current_currency.position === 'right') {
1229
1230                jQuery('.price_slider_amount span.from').html(label_min + currency_symbol);
1231                jQuery('.price_slider_amount span.to').html(label_max + currency_symbol);
1232
1233            } else if (woocs_current_currency.position === 'right_space') {
1234
1235                jQuery('.price_slider_amount span.from').html(label_min + " " + currency_symbol);
1236                jQuery('.price_slider_amount span.to').html(label_max + " " + currency_symbol);
1237
1238            }
1239
1240        } else {
1241
1242            if (woocommerce_price_slider_params.currency_pos === 'left') {
1243
1244                jQuery('.price_slider_amount span.from').html(currency_symbol + min);
1245                jQuery('.price_slider_amount span.to').html(currency_symbol + max);
1246
1247            } else if (woocommerce_price_slider_params.currency_pos === 'left_space') {
1248
1249                jQuery('.price_slider_amount span.from').html(currency_symbol + ' ' + min);
1250                jQuery('.price_slider_amount span.to').html(currency_symbol + ' ' + max);
1251
1252            } else if (woocommerce_price_slider_params.currency_pos === 'right') {
1253
1254                jQuery('.price_slider_amount span.from').html(min + currency_symbol);
1255                jQuery('.price_slider_amount span.to').html(max + currency_symbol);
1256
1257            } else if (woocommerce_price_slider_params.currency_pos === 'right_space') {
1258
1259                jQuery('.price_slider_amount span.from').html(min + ' ' + currency_symbol);
1260                jQuery('.price_slider_amount span.to').html(max + ' ' + currency_symbol);
1261
1262            }
1263        }
1264
1265        jQuery(document.body).trigger('price_slider_updated', [min, max]);
1266    });
1267
1268    jQuery('.price_slider').slider({
1269        range: true,
1270        animate: true,
1271        min: min_price,
1272        max: max_price,
1273        values: [current_min_price, current_max_price],
1274        create: function () {
1275
1276            jQuery('.price_slider_amount #min_price').val(current_min_price);
1277            jQuery('.price_slider_amount #max_price').val(current_max_price);
1278
1279            jQuery(document.body).trigger('price_slider_create', [current_min_price, current_max_price]);
1280        },
1281        slide: function (event, ui) {
1282
1283            jQuery('input#min_price').val(ui.values[0]);
1284            jQuery('input#max_price').val(ui.values[1]);
1285
1286            jQuery(document.body).trigger('price_slider_slide', [ui.values[0], ui.values[1]]);
1287        },
1288        change: function (event, ui) {
1289            jQuery(document.body).trigger('price_slider_change', [ui.values[0], ui.values[1]]);
1290        }
1291    });
1292
1293
1294    //***
1295    woof_init_native_woo_price_filter();
1296}
1297
1298function woof_mass_reinit() {
1299    woof_remove_empty_elements();
1300    woof_open_hidden_li();
1301    woof_init_search_form();
1302    woof_hide_info_popup();
1303    woof_init_beauty_scroll();
1304    woof_init_ion_sliders();
1305    woof_reinit_native_woo_price_filter();//native woo price range slider reinit
1306    woof_recount_text_price_filter();
1307    woof_draw_products_top_panel();
1308}
1309
1310function woof_recount_text_price_filter() {
1311    //change value in textinput price filter if WOOCS is installed
1312    if (typeof woocs_current_currency !== 'undefined') {
1313        jQuery.each(jQuery('.woof_price_filter_txt_from, .woof_price_filter_txt_to'), function (i, item) {
1314            jQuery(this).val(Math.ceil(jQuery(this).data('value')));
1315        });
1316    }
1317}
1318
1319function woof_init_toggles() {
1320    jQuery('body').on('click', '.woof_front_toggle', function () {
1321        if (jQuery(this).data('condition') == 'opened') {
1322            jQuery(this).removeClass('woof_front_toggle_opened');
1323            jQuery(this).addClass('woof_front_toggle_closed');
1324            jQuery(this).data('condition', 'closed');
1325
1326            if (woof_toggle_type == 'text') {
1327                jQuery(this).text(woof_toggle_closed_text);
1328            } else {
1329                jQuery(this).find('img').prop('src', woof_toggle_closed_image);
1330            }
1331        } else {
1332
1333            jQuery(this).addClass('woof_front_toggle_opened');
1334            jQuery(this).removeClass('woof_front_toggle_closed');
1335            jQuery(this).data('condition', 'opened');
1336            if (woof_toggle_type == 'text') {
1337                jQuery(this).text(woof_toggle_opened_text);
1338            } else {
1339                jQuery(this).find('img').prop('src', woof_toggle_opened_image);
1340            }
1341        }
1342
1343        jQuery(this).parents('.woof_container_inner').find('.woof_block_html_items').slideToggle(500);
1344
1345        /* fix  for chosen*/
1346        var is_chosen_here = jQuery(this).parents('.woof_container_inner').find('.chosen-container');
1347        if (is_chosen_here.length && jQuery(this).hasClass('woof_front_toggle_opened')) {
1348            jQuery(this).parents('.woof_container_inner').find('select').chosen('destroy').trigger("liszt:updated");
1349            jQuery(this).parents('.woof_container_inner').find('select').chosen(/*{disable_search_threshold: 10}*/);
1350        }
1351
1352        return false;
1353    });
1354}
1355
1356//for "Show more" blocks
1357function woof_open_hidden_li() {
1358    if (jQuery('.woof_open_hidden_li_btn').length > 0) {
1359        jQuery.each(jQuery('.woof_open_hidden_li_btn'), function (i, b) {
1360            if (jQuery(b).parents('ul').find('li.woof_hidden_term input[type=checkbox],li.woof_hidden_term input[type=radio]').is(':checked')) {
1361                jQuery(b).trigger('click');
1362            }
1363        });
1364    }
1365}
1366
1367//http://stackoverflow.com/questions/814613/how-to-read-get-data-from-a-url-using-javascript
1368function $_woof_GET(q, s) {
1369    s = (s) ? s : window.location.search;
1370    var re = new RegExp('&' + q + '=([^&]*)', 'i');
1371    return (s = s.replace(/^\?/, '&').match(re)) ? s = s[1] : s = '';
1372}
1373
1374function woof_parse_url(url) {
1375    var pattern = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
1376    var matches = url.match(pattern);
1377    return {
1378        scheme: matches[2],
1379        authority: matches[4],
1380        path: matches[5],
1381        query: matches[7],
1382        fragment: matches[9]
1383    };
1384}
1385
1386
1387//      woof price radio;
1388function woof_price_filter_radio_init() {
1389    if (icheck_skin != 'none') {
1390        jQuery('.woof_price_filter_radio').iCheck('destroy');
1391
1392        jQuery('.woof_price_filter_radio').iCheck({
1393            radioClass: 'iradio_' + icheck_skin.skin + '-' + icheck_skin.color,
1394
1395        });
1396
1397        jQuery('.woof_price_filter_radio').siblings('div').removeClass('checked');
1398
1399        jQuery('.woof_price_filter_radio').off('ifChecked');
1400        jQuery('.woof_price_filter_radio').on('ifChecked', function (event) {
1401            jQuery(this).attr("checked", true);
1402            jQuery('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible');
1403            jQuery(this).parents('.woof_list').find('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible');
1404            jQuery(this).parents('.woof_list').find('.woof_radio_price_reset').hide();
1405            jQuery(this).parents('li').eq(0).find('.woof_radio_price_reset').eq(0).addClass('woof_radio_term_reset_visible');
1406            var val = jQuery(this).val();
1407            if (parseInt(val, 10) == -1) {
1408                delete woof_current_values.min_price;
1409                delete woof_current_values.max_price;
1410                jQuery(this).removeAttr('checked');
1411                jQuery(this).siblings('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible');
1412            } else {
1413                var val = val.split("-");
1414                woof_current_values.min_price = val[0];
1415                woof_current_values.max_price = val[1];
1416                jQuery(this).siblings('.woof_radio_price_reset').addClass('woof_radio_term_reset_visible');
1417                jQuery(this).attr("checked", true);
1418            }
1419            if (woof_autosubmit || jQuery(this).within('.woof').length == 0) {
1420                woof_submit_link(woof_get_submit_link());
1421            }
1422        });
1423
1424    } else {
1425        jQuery('body').on('change', '.woof_price_filter_radio', function () {
1426            var val = jQuery(this).val();
1427            jQuery('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible');
1428            if (parseInt(val, 10) == -1) {
1429                delete woof_current_values.min_price;
1430                delete woof_current_values.max_price;
1431                jQuery(this).removeAttr('checked');
1432                jQuery(this).siblings('.woof_radio_price_reset').removeClass('woof_radio_term_reset_visible');
1433            } else {
1434                var val = val.split("-");
1435                woof_current_values.min_price = val[0];
1436                woof_current_values.max_price = val[1];
1437                jQuery(this).siblings('.woof_radio_price_reset').addClass('woof_radio_term_reset_visible');
1438                jQuery(this).attr("checked", true);
1439            }
1440            if (woof_autosubmit || jQuery(this).within('.woof').length == 0) {
1441                woof_submit_link(woof_get_submit_link());
1442            }
1443        });
1444    }
1445    //***
1446    jQuery('.woof_radio_price_reset').on('click', function () {
1447        delete woof_current_values.min_price;
1448        delete woof_current_values.max_price;
1449        jQuery(this).siblings('div').removeClass('checked');
1450        jQuery(this).parents('.woof_list').find('input[type=radio]').removeAttr('checked');
1451
1452        jQuery(this).removeClass('woof_radio_term_reset_visible');
1453        if (woof_autosubmit) {
1454            woof_submit_link(woof_get_submit_link());
1455        }
1456        return false;
1457    });
1458}
1459//    END  woof price radio;
1460
1461
1462
1463//compatibility with YITH Infinite Scrolling
1464function woof_serialize(serializedString) {
1465    var str = decodeURI(serializedString);
1466    var pairs = str.split('&');
1467    var obj = {}, p, idx, val;
1468    for (var i = 0, n = pairs.length; i < n; i++) {
1469        p = pairs[i].split('=');
1470        idx = p[0];
1471
1472        if (idx.indexOf("[]") == (idx.length - 2)) {
1473            // Eh um vetor
1474            var ind = idx.substring(0, idx.length - 2)
1475            if (obj[ind] === undefined) {
1476                obj[ind] = [];
1477            }
1478            obj[ind].push(p[1]);
1479        } else {
1480            obj[idx] = p[1];
1481        }
1482    }
1483    return obj;
1484}
1485
1486
1487//compatibility with YITH Infinite Scrolling
1488function woof_infinite() {
1489
1490    if (typeof yith_infs === 'undefined') {
1491        return;
1492    }
1493
1494
1495    //***
1496    var infinite_scroll1 = {
1497        //'nextSelector': ".woof_infinity .nav-links .next",
1498        'nextSelector': '.woocommerce-pagination li .next',
1499        'navSelector': yith_infs.navSelector,
1500        'itemSelector': yith_infs.itemSelector,
1501        'contentSelector': yith_infs.contentSelector,
1502        'loader': '<img src="' + yith_infs.loader + '">',
1503        'is_shop': yith_infs.shop
1504    };
1505    var curr_l = window.location.href;
1506    var curr_link = curr_l.split('?');
1507    var get = "";
1508    if (curr_link[1] != undefined) {
1509        var temp = woof_serialize(curr_link[1]);
1510        delete temp['paged'];
1511        get = decodeURIComponent(jQuery.param(temp))
1512    }
1513
1514    var page_link = jQuery('.woocommerce-pagination li .next').attr("href");
1515
1516    if (page_link == undefined) {
1517        page_link = curr_link + "page/1/"
1518    }
1519
1520    var ajax_link = page_link.split('?');
1521    var page = "";
1522    if (ajax_link[1] != undefined) {
1523        var temp1 = woof_serialize(ajax_link[1]);
1524        if (temp1['paged'] != undefined) {
1525            page = "page/" + temp1['paged'] + "/";
1526        }
1527    }
1528
1529    page_link = curr_link[0] + page + '?' + get;
1530
1531    jQuery('.woocommerce-pagination li .next').attr('href', page_link);
1532
1533    jQuery(window).off("yith_infs_start"), jQuery(yith_infs.contentSelector).yit_infinitescroll(infinite_scroll1)
1534}
1535//End infinity scroll
1536
1537//fix  if woof - is ajax  and  cart - is redirect
1538function woof_change_link_addtocart() {
1539    if (!woof_is_ajax) {
1540        return;
1541    }
1542    jQuery(".add_to_cart_button").each(function (i, elem) {
1543        var link = jQuery(elem).attr('href');
1544        if (link) {
1545            var link_items = link.split("?");
1546            var site_link_items = window.location.href.split("?");
1547            if (link_items[1] != undefined) {
1548                link = site_link_items[0] + "?" + link_items[1];
1549                jQuery(elem).attr('href', link);
1550            }
1551        }
1552    });
1553
1554}
1555//https://github.com/kvz/phpjs/blob/master/functions/strings/number_format.js
1556function woof_front_number_format(number, decimals, dec_point, thousands_sep) {
1557    number = (number + '')
1558            .replace(/[^0-9+\-Ee.]/g, '');
1559    var n = !isFinite(+number) ? 0 : +number,
1560            prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
1561            sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
1562            dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
1563            s = '',
1564            toFixedFix = function (n, prec) {
1565                var k = Math.pow(10, prec);
1566                return '' + (Math.round(n * k) / k)
1567                        .toFixed(prec);
1568            };
1569// Fix for IE parseFloat(0.55).toFixed(0) = 0;
1570    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n))
1571            .split('.');
1572    if (s[0].length > 3) {
1573        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
1574    }
1575    if ((s[1] || '')
1576            .length < prec) {
1577        s[1] = s[1] || '';
1578        s[1] += new Array(prec - s[1].length + 1)
1579                .join('0');
1580    }
1581    return s.join(dec);
1582}
1583
1584//additional function to check local storage
1585
1586function woof_supports_html5_storage() {
1587    try {
1588        return 'localStorage' in window && window['localStorage'] !== null;
1589    } catch (e) {
1590        return false;
1591    }
1592}
1593
1594function woof_init_tooltip() {
1595    var tooltips = jQuery(".woof_tooltip_header");
1596
1597    if (tooltips.length) {
1598
1599        jQuery(tooltips).tooltipster({
1600            theme: 'tooltipster-noir',
1601            side: 'right',
1602	    trigger: 'click'
1603        });
1604    }
1605
1606}
1607
1608function woof_init_mobile_filter() {
1609    var show_btn = jQuery('.woof_show_mobile_filter');
1610    var show_btn_container = jQuery('.woof_show_mobile_filter_container');
1611    var def_container = jQuery(woof_m_b_container);
1612    if (!show_btn_container.length) {
1613        show_btn_container = def_container;
1614    }
1615    if (show_btn && show_btn_container) {
1616        jQuery(show_btn_container).append(show_btn);
1617    }
1618
1619
1620    jQuery('.woof_show_mobile_filter').on('click', function (e) {
1621        var sid = jQuery(this).data('sid');
1622        jQuery('.woof.woof_sid_' + sid).toggleClass('woof_show_filter_for_mobile');
1623	setTimeout(function(){
1624	try {
1625	    jQuery('.woof.woof_sid_' + sid).find("select.woof_mselect").chosen('destroy');
1626	    jQuery('.woof.woof_sid_' + sid).find("select.woof_select").chosen('destroy');	
1627	    jQuery('.woof.woof_sid_' + sid).find("select.woof_mselect").chosen();
1628	    jQuery('.woof.woof_sid_' + sid).find("select.woof_select").chosen();
1629	} catch (e) {
1630
1631	}	
1632	}, 300);
1633
1634    });
1635    jQuery('.woof_hide_mobile_filter').on('click', function (e) {
1636        jQuery(this).parents('.woof').toggleClass('woof_show_filter_for_mobile');
1637    });
1638    
1639    
1640}

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.