PageSourceSearch

https://maskenzauber.com/wp-content/plugins/woocommerce-products-filter/js/front.js?ver=2.2.9.4

js maskenzauber.com collected 2026-09-27 03:51:12 UTC 60,554 bytes, 1,726 lines download raw bytes

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

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.