PageSourceSearch

https://zeroland.co.nz/wp-content/themes/listingpro/assets/js/search-ajax.js?ver=7.1.2

js zeroland.co.nz collected 2026-10-02 11:21:07 UTC 149,969 bytes, 3,507 lines download raw bytes

1/* js for search by zaheer */
2jQuery(document).ready(function ($) {
3    if (jQuery('ul.list-st-img li').hasClass('lp-listing-phone') || jQuery('.widget-social-icons li').hasClass('lp-listing-phone')) {
4        var $country = '';
5        var $city = '';
6        var $zip = '';
7        jQuery('ul.list-st-img li.lp-listing-phone a, .widget-social-icons li a.phone-link').on('click', function () {
8
9            var $lpID = '';
10            var $this = jQuery(this);
11            $lpID = $this.data('lpid');
12
13            jQuery.ajax({
14                type: 'POST',
15                dataType: 'json',
16                url: ajax_search_term_object.ajaxurl,
17                data: {
18                    'action': 'listingpro_phone_clicked',
19                    'lp-id': $lpID,
20                    'lp-country': $country,
21                    'lp-city': $city,
22                    'lp-zip': $zip,
23                    'lpNonce': jQuery('#lpNonce').val()
24                },
25                success: function (data) {
26
27                }
28            });
29        });
30    }
31    jQuery('.search-filter a').on('click', function () { jQuery('select#searchcategory').trigger('change') });
32    /* on 11th may */
33    if ((jQuery('ul.list-st-img li').hasClass('lp-user-web') || (jQuery('.widget-social-icons li').hasClass('lp-user-web')))) {
34        var $country = '';
35        var $city = '';
36        var $zip = '';
37        jQuery('.widget-social-icons li.lp-user-web').on('click', function () {
38            var $this = jQuery(this),
39                $lpID = jQuery(this).find('a').data('lpid');
40
41            jQuery.ajax({
42                type: 'POST',
43                dataType: 'json',
44                url: ajax_search_term_object.ajaxurl,
45                data: {
46                    'action': 'listingpro_website_visit',
47                    'lp-id': $lpID,
48                    'lp-country': $country,
49                    'lp-city': $city,
50                    'lp-zip': $zip,
51                    'lpNonce': jQuery('#lpNonce').val()
52                },
53                success: function (data) {
54
55                }
56            });
57        });
58        jQuery('ul.list-st-img li.lp-user-web a').on('click', function () {
59            var $this = jQuery(this),
60                $lpID = jQuery(this).data('lpid');
61
62            jQuery.ajax({
63                type: 'POST',
64                dataType: 'json',
65                url: ajax_search_term_object.ajaxurl,
66                data: {
67                    'action': 'listingpro_website_visit',
68                    'lp-id': $lpID,
69                    'lp-country': $country,
70                    'lp-city': $city,
71                    'lp-zip': $zip,
72                    'lpNonce': jQuery('#lpNonce').val()
73                },
74                success: function (data) {
75
76                }
77            });
78        });
79    }
80    /* end on 11th may */
81
82    jQuery('input.lp-search-btn, .lp-search-bar-right .lp-search-icon').on('click', function (e) {
83
84        if (jQuery('.lp-left-filter').length != 0) {
85            var parentWrap = jQuery(this).closest('.lp-search-btn-header');
86            parentWrap.find('.fa-magnifying-glass').removeClass('fa-magnifying-glass');
87            parentWrap.find('.lp-search-btn').css('cssText', 'background-image:url() !important; color: transparent');
88            var loaderImg = parentWrap.find('img.searchloading');
89            loaderImg.addClass('test');
90            if (loaderImg.hasClass('loader-inner-header')) {
91                loaderImg.css({
92                    'top': '15px',
93                    'left': '90%',
94                    'width': 'auto',
95                    'height': 'auto',
96                    'margin-left': '0px'
97                });
98            }
99
100            loaderImg.css('display', 'block');
101        } else {
102            jQuery(this).removeClass('fa-magnifying-glass');
103            jQuery(this).closest('form').submit();
104
105            jQuery(this).next('i').removeClass('fa-magnifying-glass');
106            //jQuery(this).css('color', 'transparent');
107            jQuery(this).css('cssText', 'background-image:url() !important; color: transparent');
108            if (jQuery('img.searchloading').hasClass('loader-inner-header')) {
109                jQuery('img.loader-inner-header').css({
110                    'top': '15px',
111                    'left': '70%',
112                    'width': 'auto',
113                    'height': 'auto',
114                    'margin-left': '0px'
115                });
116            }
117
118            jQuery('img.searchloading').css('display', 'block');
119        }
120
121
122    });
123
124    jQuery('#skeyword-filter').keyup(function (e) {
125        jQuery('form i.cross-search-q').css('display', 'block');
126    })
127    jQuery('form i.cross-search-q').on('click', function () {
128        jQuery("form i.cross-search-q").css("display", "none");
129        jQuery('form .lp-suggested-search').val('');
130        jQuery("img.loadinerSearch").css("display", "block");
131        var qString = '';
132
133        jQuery.ajax({
134            type: 'POST',
135            dataType: 'json',
136            url: ajax_search_term_object.ajaxurl,
137            data: {
138                'action': 'listingpro_suggested_search',
139                'tagID': qString,
140                'lpNonce': jQuery('#lpNonce').val()
141            },
142            success: function (data) {
143                if (data) {
144                    jQuery("#input-dropdown ul").empty();
145                    var resArray = [];
146                    if (data.suggestions.cats) {
147                        jQuery.each(data.suggestions.cats, function (i, v) {
148
149                            resArray.push(v);
150
151                        });
152
153                    }
154                    jQuery('img.loadinerSearch').css('display', 'none');
155                    jQuery("#input-dropdown ul").append(resArray);
156                    myDropDown.css('display', 'block');
157                }
158            }
159        });
160
161    });
162
163    var inputField = jQuery('.dropdown_fields');
164    var inputTagField = jQuery('#lp_s_tag');
165    var inputCatField = jQuery('#lp_s_cat');
166    var myDropDown = jQuery("#input-dropdown");
167    var myDropDown1 = jQuery("#input-dropdown ul li");
168    var myDropOption = jQuery('#input-dropdown > option');
169    var html = jQuery('html');
170    var select = jQuery('.dropdown_fields, #input-dropdown > option');
171    var lps_tag = jQuery('.lp-s-tag');
172    var lps_cat = jQuery('.lp-s-cat');
173
174    var length = myDropOption.length;
175    inputField.on('click', function (event) {
176        //event.preventDefault();
177        myDropDown.attr('size', length);
178        myDropDown.css('display', 'block');
179    });
180
181    //myDropDown1.on('click', function(event) {
182    jQuery(document).on('click', '#input-dropdown ul li', function (event) {
183
184        myDropDown.attr('size', 0);
185        var dropValue = jQuery(this).text();
186        dropValue = dropValue.trim();
187        var tagVal = jQuery(this).data('tagid');
188        var catVal = jQuery(this).data('catid');
189        var moreVal = jQuery(this).data('moreval');
190        if (jQuery(this).hasClass('lp-wrap-title')) {
191            inputField.val('');
192            jQuery(".lp-search-btn").prop('disabled', true);
193        } else {
194            inputField.val(dropValue);
195        }
196
197        inputTagField.val(tagVal);
198        inputCatField.val(catVal);
199        if (tagVal == null && catVal == null && moreVal != null) {
200            inputField.val(moreVal);
201        }
202        jQuery("form i.cross-search-q").css("display", "block");
203        myDropDown.css('display', 'none');
204
205        if (jQuery('.lp-home-banner-contianer-inner').length) {
206            if (jQuery('.lp-home-banner-contianer-inner').hasClass('app-view2-header-animate')) {
207                if (jQuery('#searchlocation').length) {
208                    if (jQuery('#searchlocation').hasClass('select2')) {
209                        jQuery('#searchlocation').select2("open");
210                    } else {
211                        jQuery('#searchlocation').trigger("chosen:open");
212                    }
213                }
214
215                event.stopPropagation();
216            }
217        }
218
219    });
220
221    html.on('click', function (event) {
222        //event.preventDefault();
223        myDropDown.attr('size', 0);
224        myDropDown.css('display', 'none');
225    });
226
227    select.on('click', function (event) {
228        event.stopPropagation();
229    });
230
231    var resArray = [];
232    var newResArray = [];
233    var bufferedResArray = [];
234    var prevQString = '?';
235
236    //inputField.on('input', function(){
237
238    function trimAttributes(node) {
239        jQuery.each(node.attributes, function () {
240            var attrName = this.name;
241            var attrValue = this.value;
242            // remove attribute name start with "on", possible unsafe,
243            // for example: onload, onerror...
244            //
245            // remvoe attribute value start with "javascript:" pseudo protocol, possible unsafe,
246            // for example href="javascript:alert(1)"
247            if (attrName.indexOf('on') == 0 || attrValue.indexOf('javascript:') == 0) {
248                jQuery(node).removeAttr(attrName);
249            }
250        });
251    }
252
253    function sanitize(html) {
254        var output = jQuery($.parseHTML('<div>' + html + '</div>', null, false));
255        output.find('*').each(function () {
256            trimAttributes(this);
257        });
258        return output.html();
259    }
260    //inputField.bind('change paste keyup', function(){
261    /* ***************************************************** */
262    var timer;
263    inputField.on('keyup', function () {
264        clearInterval(timer);
265        timer = setTimeout(function () {
266            var $this = inputField;
267            var qString = $this.val();
268            var count = $this.val().length;
269            lpsearchmode = jQuery('body').data('lpsearchmode');
270            noresultMSG = $this.data('noresult');
271            jQuery("#input-dropdown ul").empty();
272            jQuery("#input-dropdown ul li").remove();
273            prevQuery = $this.data('prev-value');
274            $this.data("prev-value", qString.length);
275
276            //if(count>1){
277            jQuery.ajax({
278                type: "POST",
279                dataType: 'json',
280                url: ajax_search_term_object.ajaxurl,
281                data: {
282                    'action': 'listingpro_suggested_search',
283                    'tagID': qString,
284                    'lpNonce': jQuery('#lpNonce').val()
285                },
286                beforeSend: function () {
287                    jQuery("form i.cross-search-q").css("display", "none");
288                    jQuery("img.loadinerSearch").css("display", "block");
289                },
290                success: function (data) {
291                    console.log(data);
292                    //console.log(data.suggestions);
293                    /* ajax response start */
294                    if (data) {
295                        resArray = [];
296                        if (data.suggestions.tag || data.suggestions.tagsncats || data.suggestions.cats || data.suggestions.titles) {
297
298                            if (data.suggestions.tag) {
299                                jQuery.each(data.suggestions.tag, function (i, v) {
300                                    resArray.push(v);
301                                });
302
303                            }
304
305                            if (data.suggestions.tagsncats) {
306                                jQuery.each(data.suggestions.tagsncats, function (i, v) {
307                                    resArray.push(v);
308                                });
309
310                            }
311
312
313                            if (data.suggestions.cats) {
314                                jQuery.each(data.suggestions.cats, function (i, v) {
315
316                                    resArray.push(v);
317
318                                });
319
320                                if (data.suggestions.tag == null && data.suggestions.tagsncats == null && data.suggestions.titles == null) {
321                                    resArray = resArray;
322                                } else { }
323
324
325
326                            }
327
328                            if (data.suggestions.titles) {
329                                jQuery.each(data.suggestions.titles, function (i, v) {
330
331                                    resArray.push(v);
332
333                                });
334
335                            }
336
337                        } else {
338                            if (data.suggestions.more) {
339                                jQuery.each(data.suggestions.more, function (i, v) {
340                                    resArray.push(v);
341                                });
342
343                            }
344                        }
345
346                        prevQString = data.tagID;
347
348                        jQuery('img.loadinerSearch').css('display', 'none');
349                        if (jQuery('form #select').val() == '') {
350                            jQuery("form i.cross-search-q").css("display", "none");
351                        } else {
352                            jQuery("form i.cross-search-q").css("display", "block");
353                        }
354
355                        //jQuery.each( resArray, function( key, value ) {
356
357                        myDropDown.css('display', 'none');
358                        jQuery("#input-dropdown ul").empty();
359
360                        jQuery("#input-dropdown ul").append(resArray);
361                        myDropDown.css('display', 'block');
362                        $this.data("prev-value", qString.length);
363                        //});
364
365
366                    }
367                    /* ajax response ends */
368
369                },
370                complete: function () {
371                    // Handle the complete event
372                    jQuery("form i.cross-search-q").css("display", "block");
373                    jQuery("img.loadinerSearch").css("display", "none");
374                }
375            });
376            //}
377        }, 700);
378    });
379
380    /* ******************************************************** */
381
382    if (jQuery("#lp_search_loc").val() == '' && jQuery('#cities').val() != '') {
383        jQuery("#lp_search_loc").val(jQuery('#cities').val());
384    }
385
386}); /* for version 2.0 */ /* ===============================2nd================================== */
387jQuery(document).on('change', '.lp_extrafields_select', function (event) {
388    $this = jQuery(this);
389    $selectedFields = [];
390    jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
391        keyValuePair = {};
392        keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
393        $selectedFields.push(keyValuePair);
394    });
395
396
397    var new_design_v2 = false;
398    var new_header_filters = false;
399    var listStyle = '';
400
401    if (jQuery('#list-grid-view-v2').length != 0) {
402        if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
403            var new_header_filters = true;
404        }
405        if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
406            listStyle = get_list_style();
407            new_design_v2 = true;
408        }
409    }
410
411    if (new_header_filters == true) {
412        get_filters_before_send();
413        var averageRate = get_filter_RRV('.filter-in-header .rated-filter.header-filter-wrap'),
414            mostRewvied = get_filter_RRV('.filter-in-header .reviewed-filter.header-filter-wrap'),
415            mostViewed = get_filter_RRV('.filter-in-header .viewed-filter.header-filter-wrap'),
416            inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
417            moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
418            pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
419            ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
420            listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
421            listStyle = get_list_style(),
422            skeyword = jQuery('input#skeyword-filter').val();
423        if (jQuery('#searchlocation').length != 0) {
424            seracLoc = jQuery("#searchlocation").val();
425        }
426        if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
427            seracLoc = jQuery("#lp_search_loc").val();
428        }
429
430    } else {
431
432        var docHeight = jQuery(document).height();
433        jQuery("body").prepend('<div id="full-overlay"></div>');
434        jQuery('#full-overlay').css('height', docHeight + 'px');
435        event.preventDefault();
436        jQuery(this).toggleClass('active');
437        jQuery('.lp-filter-pagination').hide();
438        jQuery('#content-grids').html(' ');
439        jQuery('.lp-filter-pagination-ajx').remove();
440        //jQuery('#content-grids').addClass('content-loading');
441        add_listing_skeletons();
442        jQuery('.map-view-list-container').remove();
443        var inexpensive = '';
444        moderate = '';
445        pricey = '';
446        ultra = '';
447        averageRate = '';
448        mostRewvied = '';
449        listing_openTime = '';
450        mostViewed = '';
451        inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
452        moderate = jQuery('.currency-signs #two').find('.active').data('price');
453        pricey = jQuery('.currency-signs #three').find('.active').data('price');
454        ultra = jQuery('.currency-signs #four').find('.active').data('price');
455        if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
456            averageRate = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
457        }
458        if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
459            mostRewvied = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
460        }
461        if (jQuery('.search-filter-attr input[type="checkbox"]#mostviewed').hasClass('active')) {
462            mostviewed = jQuery('.search-filter-attr input[type="checkbox"]#mostviewed').val();
463        }
464        if (jQuery('.search-filter-attr input[type="checkbox"].listing_openTime').hasClass('active')) {
465            listing_openTime = jQuery('.search-filter-attr input[type="checkbox"].listing_openTime').val();
466        }
467        if (jQuery(this).hasClass('active')) {
468            jQuery(this).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
469        } else {
470            jQuery(this).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
471        }
472    }
473    var tags_name = [];
474    tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
475        return jQuery(this).val();
476    }).get();
477    if (tags_name.length > 0) { } else {
478        if (jQuery('#check_featuretax').length > 0) {
479            tags_name.push(jQuery('#check_featuretax').val());
480        }
481    }
482    skeyword = jQuery('input#lp_current_query').val();
483
484
485    if (listStyle == null && jQuery('#list-grid-view-v2').length != 0) {
486        listStyle = jQuery('#list-grid-view-v2').data('layout-class');
487    }
488    if (jQuery('#lp_search_loc').length > 0) {
489        seracLoc = jQuery("#lp_search_loc").val();
490    } else {
491        seracLoc = jQuery("#searchlocation").val();
492    }
493    if (check_if_loc_disabled_fornearme()) {
494        seracLoc = '';
495    }
496
497    jQuery.ajax({
498        type: 'POST',
499        dataType: 'json',
500        url: ajax_search_term_object.ajaxurl,
501        data: {
502            'action': 'ajax_search_tags',
503            'formfields': $selectedFields,
504            'inexpensive': inexpensive,
505            'moderate': moderate,
506            'pricey': pricey,
507            'ultra': ultra,
508            'averageRate': averageRate,
509            'mostRewvied': mostRewvied,
510            'mostviewed': mostViewed,
511            'listing_openTime': listing_openTime,
512            'lpstag': jQuery("#lpstag").val(),
513            'tag_name': tags_name,
514            'cat_id': jQuery("#searchform select#searchcategory").val(),
515            'loc_id': seracLoc,
516            'list_style': listStyle,
517            'skeyword': skeyword,
518            'lpNonce': jQuery('#lpNonce').val()
519        },
520        success: function (data) {
521            jQuery('.app-filter-loader-active').html('<i class="fa fa-check-circle" aria-hidden="true"></i>');
522            jQuery('#full-overlay').remove();
523            if (data) {
524                listing_update(data, new_design_v2, listStyle);
525                lp_append_distance_div();
526                remove_listing_skeletons();
527                if (jQuery('.grid').hasClass('active')) {
528                    jQuery('.grid').trigger('click');
529                } else if (jQuery('.list').hasClass('active')) {
530                    jQuery('.list').trigger('click');
531                }
532
533
534                if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
535                    jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
536                }
537
538
539            }
540        }
541    });
542}); /* end for version 2.0 */
543/* end js for search by zaheer */
544
545
546
547jQuery(document).ready(function ($) {
548
549    jQuery(".lp-search-cats-filter-dropdown").on('click', function () {
550        jQuery('.lp-tooltip-div').css({
551            'opacity': '0',
552            'visibility': 'hidden',
553            'top': 'auto',
554            'z-index': '0'
555        });
556    });
557
558
559    jQuery("select#searchcategory").change(function () {
560        $thiscat = jQuery(this);
561        jQuery('.tags-area').remove();
562        jQuery('.lp-filter-pagination-ajx').remove();
563        jQuery(".chosen-select").val('').trigger('chosen:updated');
564        jQuery("#searchtags").prop('disabled', true).trigger('chosen:updated');
565        jQuery(".outer_all_page_overflow").html('');
566        jQuery(".lp-head-withfilter4").html('');
567        //jQuery(".header-container.4 .lp-features-filter").html('');
568        //jQuery(".lp-features-filter").html('');
569
570        jQuery(".lp_extrafields_select").html('');
571
572        jQuery.ajax({
573            type: 'POST',
574            dataType: 'json',
575            url: ajax_search_term_object.ajaxurl,
576            data: {
577                'action': 'ajax_search_term',
578                'term_id': $thiscat.val(),
579                'lpNonce': jQuery('#lpNonce').val()
580            },
581            success: function (data) {
582                if (data) {
583                    jQuery(".search-row .form-inline").after(data.html);
584                    setTimeout(function () {
585                        jQuery(".header-more-filters.form-inline .lp_all_page_overflow").prepend(data.html);
586                    }, 500);
587                    jQuery(".lp-features-filter").css('opacity', '1');
588                    //jQuery(".header-more-filters .lp-features-filter").html( data.htmlfilter );
589
590                    jQuery(".lp-head-withfilter4").html(data.htmlfilter);
591                    jQuery(".outer_all_page_overflow").html(data.htmlfilter);
592
593                    jQuery(".lp-additional-appview-filter-new").html(data.htmlfilter);
594                    //alert(data.htmlfilter);
595                    //jQuery(".lp-features-filter").eq(1).html(data.htmlfilter);
596                    //jQuery(".header-container.4 .lp-features-filter").eq(1).html('1');
597                    //jQuery(".header-container.4 .lp-features-filter").eq(2).html('3');
598                    //jQuery(".lp-features-filter").html(data.htmlfilter);
599
600                }
601            }
602        });
603    });
604
605
606    jQuery(".header-container.4 select#searchcategory").change(function () {
607        var $this = jQuery(this),
608            thisVal = $this.val(),
609            catsWrap = jQuery('.lp-child-cats-tax'),
610            catsPos = jQuery('.lp-section.listing-style4').attr('data-childcat'),
611            catsShow = jQuery('.lp-section.listing-style4').attr('data-childcatshow');
612
613        catsWrap.html('');
614        catsWrap.css('height', '0px');
615        jQuery.ajax({
616            type: 'POST',
617            dataType: 'json',
618            url: ajax_search_term_object.ajaxurl,
619            data: {
620                'action': 'ajax_search_child_cats',
621                'parent_id': thisVal,
622                'lpNonce': jQuery('#lpNonce').val()
623            },
624            success: function (data) {
625                jQuery('.lp-header-search.archive-search h4.lp-title').find('em').text(data.term_name);
626                if (data.status == 'found' && catsShow != 'hide') {
627                    catsWrap.css('height', '132px');
628                    if (jQuery('.lp-child-cats-tax').length > 0) {
629                        catsWrap.html(data.child_cats);
630                    } else {
631                        if (catsPos == 'fullwidth') {
632                            jQuery('.listing-simple').closest('.col-md-8').before('<div class="lp-child-cats-tax">' + data.child_cats + '</div>');
633                        } else {
634                            jQuery('.listing-simple').before('<div class="lp-child-cats-tax">' + data.child_cats + '</div>');
635                        }
636
637                    }
638
639                    var chilCatsLoc = jQuery('.lp-child-cats-tax-slider').data('child-loc'),
640                        childCatNum = 3;
641
642                    jQuery('.lp-child-cats-tax').addClass('style-' + chilCatsLoc);
643                    if (chilCatsLoc == 'fullwidth') {
644                        childCatNum = 5;
645                    }
646                    if (jQuery('.lp-child-cats-tax-wrap').length > childCatNum) {
647                        jQuery('.lp-child-cats-tax-slider').slick({
648                            infinite: true,
649                            slidesToShow: childCatNum,
650                            slidesToScroll: 1,
651                            prevArrow: "<i class=\"fa fa-angle-right arrow-left\" aria-hidden=\"true\"></i>",
652                            nextArrow: "<i class=\"fa fa-angle-left arrow-right\" aria-hidden=\"true\"></i>"
653                        });
654                    }
655
656
657
658                }
659            }
660        });
661
662    });
663
664    jQuery("select#searchcategory, #filter-in-header #category-select, .lp-header-search-form #category-select, .lp-header-search-form #searchlocation").change(function () {
665        if (jQuery('body.home').length == 0) {
666            $selectedFields = [];
667            jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
668                keyValuePair = {};
669                keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
670                $selectedFields.push(keyValuePair);
671            });
672            var listStyle;
673            var $thiscat = jQuery('select#searchcategory');
674            var new_design_v2 = false;
675            var new_header_filters = false;
676            var listStyle = '';
677            var inexpensive = '';
678            moderate = '';
679            pricey = '';
680            ultra = '';
681            averageRate = '';
682            mostRewvied = '';
683            listing_openTime = '';
684            mostViewed = '';
685            seracLoc = '';
686
687            if (jQuery('#list-grid-view-v2').length != 0) {
688                if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
689                    var new_header_filters = true;
690                }
691                if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
692                    listStyle = get_list_style();
693                    new_design_v2 = true;
694                }
695            }
696
697            if (new_header_filters == true) {
698                get_filters_before_send();
699                var averageRate = get_filter_RRV('#filter-in-header .rated-filter.header-filter-wrap'),
700                    mostRewvied = get_filter_RRV('#filter-in-header .reviewed-filter.header-filter-wrap'),
701                    mostViewed = get_filter_RRV('#filter-in-header .viewed-filter.header-filter-wrap'),
702                    inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
703                    moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
704                    pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
705                    ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
706                    listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
707                    listStyle = get_list_style(),
708                    skeyword = jQuery('input#skeyword-filter').val();
709                if (jQuery("#searchlocation").length != 0) {
710                    seracLoc = jQuery("#searchlocation").val();
711                }
712                if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
713                    seracLoc = jQuery("#lp_search_loc").val();
714                }
715
716            } else {
717                var docHeight = jQuery(document).height();
718                jQuery("body").prepend('<div id="full-overlay"></div>');
719                jQuery('#full-overlay').css('height', docHeight + 'px');
720                jQuery('#content-grids').html(' ');
721                jQuery('.lp-filter-pagination-ajx').remove();
722                //jQuery('#content-grids').addClass('content-loading');
723                add_listing_skeletons();
724                jQuery('.map-view-list-container').remove();
725                jQuery('.lp-filter-pagination').hide();
726
727
728                inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
729                moderate = jQuery('.currency-signs #two').find('.active').data('price');
730                pricey = jQuery('.currency-signs #three').find('.active').data('price');
731                ultra = jQuery('.currency-signs #four').find('.active').data('price');
732
733                mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
734                averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
735                mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
736                listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
737                seracLoc = jQuery("#lp_search_loc").val();
738                skeyword = jQuery('input#lp_current_query').val();
739
740
741            }
742            var tags_name = [];
743            tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
744                return jQuery(this).val();
745            }).get();
746
747            if (tags_name.length > 0) { } else {
748                if (jQuery('#check_featuretax').length > 0) {
749                    tags_name.push(jQuery('#check_featuretax').val());
750                }
751            }
752
753
754            var clatval = jQuery('#searchform input[name=clat]').val();
755            var clongval = jQuery('#searchform input[name=clong]').val();
756
757            if (clatval && clongval) { } else {
758                clatval = jQuery("#pac-input").attr('data-lat');
759                clongval = jQuery("#pac-input").attr('data-lng');
760            }
761
762            if (check_if_loc_disabled_fornearme()) {
763                seracLoc = '';
764            }
765
766            jQuery.ajax({
767                type: 'POST',
768                dataType: 'json',
769                url: ajax_search_term_object.ajaxurl,
770                data: {
771                    'action': 'ajax_search_tags',
772                    'formfields': $selectedFields,
773                    'lpstag': jQuery("#lpstag").val(),
774                    'cat_id': $thiscat.val(),
775                    'loc_id': seracLoc,
776                    'inexpensive': inexpensive,
777                    'moderate': moderate,
778                    'pricey': pricey,
779                    'ultra': ultra,
780                    'averageRate': averageRate,
781                    'mostRewvied': mostRewvied,
782                    'mostviewed': mostViewed,
783                    'listing_openTime': listing_openTime,
784                    'tag_name': tags_name,
785                    'list_style': listStyle,
786                    'skeyword': skeyword,
787                    'clat': clatval,
788                    'clong': clongval,
789                    'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
790                    'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
791                    'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
792                    'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
793                    'data_zoom': jQuery('#pac-input').attr('data-zoom'),
794                    'distance_range': jQuery("#distance_range").val(),
795                    'lpNonce': jQuery('#lpNonce').val()
796                },
797                success: function (data) {
798                    jQuery('#full-overlay').remove();
799                    if (data) {
800                        listing_update(data, new_design_v2, listStyle);
801                        lp_append_distance_div();
802                        remove_listing_skeletons();
803                        if (jQuery('.grid').hasClass('active')) {
804                            jQuery('.grid').trigger('click');
805                        } else if (jQuery('.list').hasClass('active')) {
806                            jQuery('.list').trigger('click');
807                        }
808
809
810                        if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
811                            jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
812                        }
813
814
815                    }
816                }
817            });
818        }
819    });
820
821
822
823
824
825
826    /* ========================== auto location by google filter by z======================== */
827    jQuery(document).on('click', 'body.search .city-autocomplete .help, body.archive .city-autocomplete .help', function () {
828        var seracLoc = '';
829        $selectedFields = [];
830        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
831            keyValuePair = {};
832            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
833            $selectedFields.push(keyValuePair);
834        });
835        var $thiscat = jQuery('select#searchcategory');
836        var new_design_v2 = false;
837        var new_header_filters = false;
838        var listStyle = '';
839
840        if (jQuery('#list-grid-view-v2').length != 0) {
841            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
842                var new_header_filters = true;
843            }
844            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
845                listStyle = get_list_style();
846                new_design_v2 = true;
847            }
848        }
849
850        if (new_header_filters == true) {
851            get_filters_before_send();
852            var averageRate = get_filter_RRV('#filter-in-header .rated-filter.header-filter-wrap'),
853                mostRewvied = get_filter_RRV('#filter-in-header .reviewed-filter.header-filter-wrap'),
854                mostViewed = get_filter_RRV('#filter-in-header .viewed-filter.header-filter-wrap'),
855                inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
856                moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
857                pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
858                ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
859                listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
860                listStyle = get_list_style(),
861                skeyword = jQuery('input#skeyword-filter').val();
862
863            if (jQuery('#searchlocation').length != 0) {
864                seracLoc = jQuery("#searchlocation").val();
865            }
866            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
867                seracLoc = jQuery("#lp_search_loc").val();
868            }
869
870        } else {
871            var docHeight = jQuery(document).height();
872            jQuery("body").prepend('<div id="full-overlay"></div>');
873            jQuery('#full-overlay').css('height', docHeight + 'px');
874            jQuery('#content-grids').html(' ');
875            jQuery('.lp-filter-pagination-ajx').remove();
876            //jQuery('#content-grids').addClass('content-loading');
877            add_listing_skeletons();
878            jQuery('.map-view-list-container').remove();
879            jQuery('.lp-filter-pagination').hide();
880
881            var inexpensive = '';
882            moderate = '';
883            pricey = '';
884            ultra = '';
885            averageRate = '';
886            mostRewvied = '';
887            listing_openTime = '';
888            mostViewed = '';
889            seracLoc = '';
890
891
892            inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
893            moderate = jQuery('.currency-signs #two').find('.active').data('price');
894            pricey = jQuery('.currency-signs #three').find('.active').data('price');
895            ultra = jQuery('.currency-signs #four').find('.active').data('price');
896
897            mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
898            averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
899            mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
900            listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
901            seracLoc = jQuery("#lp_search_loc").val();
902            skeyword = jQuery('input#lp_current_query').val();
903
904
905        }
906        var tags_name = [];
907        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
908            return jQuery(this).val();
909        }).get();
910
911        if (tags_name.length > 0) { } else {
912            if (jQuery('#check_featuretax').length > 0) {
913                tags_name.push(jQuery('#check_featuretax').val());
914            }
915        }
916
917
918        var clatval = jQuery('#searchform input[name=clat]').val();
919        var clongval = jQuery('#searchform input[name=clong]').val();
920
921        if (clatval && clongval) { } else {
922            clatval = jQuery("#pac-input").attr('data-lat');
923            clongval = jQuery("#pac-input").attr('data-lng');
924        }
925
926        if (check_if_loc_disabled_fornearme()) {
927            seracLoc = '';
928        }
929
930        jQuery.ajax({
931            type: 'POST',
932            dataType: 'json',
933            url: ajax_search_term_object.ajaxurl,
934            data: {
935                'action': 'ajax_search_tags',
936                'formfields': $selectedFields,
937                'lpstag': jQuery("#lpstag").val(),
938                'cat_id': $thiscat.val(),
939                'loc_id': seracLoc,
940                'inexpensive': inexpensive,
941                'moderate': moderate,
942                'pricey': pricey,
943                'ultra': ultra,
944                'averageRate': averageRate,
945                'mostRewvied': mostRewvied,
946                'mostviewed': mostViewed,
947                'listing_openTime': listing_openTime,
948                'tag_name': tags_name,
949                'list_style': listStyle,
950                'skeyword': skeyword,
951                'clat': clatval,
952                'clong': clongval,
953                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
954                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
955                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
956                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
957                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
958                'distance_range': jQuery("#distance_range").val(),
959                'lpNonce': jQuery('#lpNonce').val()
960            },
961            success: function (data) {
962                jQuery('#full-overlay').remove();
963                if (data) {
964                    listing_update(data, new_design_v2, listStyle);
965                    lp_append_distance_div();
966                    remove_listing_skeletons();
967                    if (jQuery('.grid').hasClass('active')) {
968                        jQuery('.grid').trigger('click');
969                    } else if (jQuery('.list').hasClass('active')) {
970                        jQuery('.list').trigger('click');
971                    }
972                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
973                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
974                    }
975                }
976            }
977        });
978    });
979
980
981
982
983
984
985
986
987    jQuery(document).on('change', '.tags-area input[type=checkbox]', function (e) {
988        var seracLoc = '';
989        $selectedFields = [];
990        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
991            keyValuePair = {};
992            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
993            $selectedFields.push(keyValuePair);
994        });
995        var skeyword = '';
996        var new_design_v2 = false;
997        var new_header_filters = false;
998        var listStyle = '';
999
1000        if (jQuery('#list-grid-view-v2').length != 0) {
1001            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
1002                var new_header_filters = true;
1003            }
1004            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
1005                listStyle = get_list_style();
1006                new_design_v2 = true;
1007            }
1008        }
1009
1010        if (new_header_filters == true) {
1011            get_filters_before_send();
1012            var averageRate = get_filter_RRV('#filter-in-header .rated-filter.header-filter-wrap'),
1013                mostRewvied = get_filter_RRV('#filter-in-header .reviewed-filter.header-filter-wrap'),
1014                mostViewed = get_filter_RRV('#filter-in-header .viewed-filter.header-filter-wrap'),
1015                inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
1016                moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
1017                pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
1018                ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
1019                listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
1020                listStyle = get_list_style();
1021            if (jQuery('#searchlocation').length != 0) {
1022                seracLoc = jQuery("#searchlocation").val();
1023            }
1024            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
1025                seracLoc = jQuery("#lp_search_loc").val();
1026            }
1027        } else {
1028            var docHeight = jQuery(document).height();
1029            jQuery("body").prepend('<div id="full-overlay"></div>');
1030            jQuery('#full-overlay').css('height', docHeight + 'px');
1031            var tags_name = [];
1032            tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1033                return jQuery(this).val();
1034            }).get();
1035
1036            if (tags_name.length > 0) { } else {
1037                if (jQuery('#check_featuretax').length > 0) {
1038                    tags_name.push(jQuery('#check_featuretax').val());
1039                }
1040            }
1041
1042            jQuery('.lp-filter-pagination').hide();
1043
1044
1045            jQuery('#content-grids').html(' ');
1046            jQuery('.lp-filter-pagination-ajx').remove();
1047            //jQuery('#content-grids').addClass('content-loading');
1048            add_listing_skeletons();
1049            jQuery('.map-view-list-container').remove();
1050
1051            var inexpensive = '';
1052            moderate = '';
1053            pricey = '';
1054            ultra = '';
1055            averageRate = '';
1056            mostRewvied = '';
1057            listing_openTime = '';
1058            mostViewed = '';
1059
1060            inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
1061            moderate = jQuery('.currency-signs #two').find('.active').data('price');
1062            pricey = jQuery('.currency-signs #three').find('.active').data('price');
1063            ultra = jQuery('.currency-signs #four').find('.active').data('price');
1064
1065            mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
1066            averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
1067            mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
1068            listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
1069
1070            skeyword = jQuery('input#lp_current_query').val();
1071            seracLoc = jQuery("#lp_search_loc").val();
1072        }
1073        var clatval = jQuery('#searchform input[name=clat]').val();
1074        var clongval = jQuery('#searchform input[name=clong]').val();
1075
1076        if (clatval && clongval) { } else {
1077            clatval = jQuery("#pac-input").attr('data-lat');
1078            clongval = jQuery("#pac-input").attr('data-lng');
1079        }
1080        var tags_name = [];
1081        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1082            return jQuery(this).val();
1083        }).get();
1084
1085        if (check_if_loc_disabled_fornearme()) {
1086            seracLoc = '';
1087        }
1088        jQuery.ajax({
1089            type: 'POST',
1090            dataType: 'json',
1091            url: ajax_search_term_object.ajaxurl,
1092            data: {
1093                'action': 'ajax_search_tags',
1094                'formfields': $selectedFields,
1095                'lpstag': jQuery("#lpstag").val(),
1096                'cat_id': jQuery("#searchform select#searchcategory").val(),
1097                'loc_id': seracLoc,
1098                'inexpensive': inexpensive,
1099                'moderate': moderate,
1100                'pricey': pricey,
1101                'ultra': ultra,
1102                'averageRate': averageRate,
1103                'mostRewvied': mostRewvied,
1104                'mostviewed': mostViewed,
1105                'listing_openTime': listing_openTime,
1106                'tag_name': tags_name,
1107                'list_style': listStyle,
1108                'skeyword': skeyword,
1109                'clat': clatval,
1110                'clong': clongval,
1111                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
1112                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
1113                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
1114                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
1115                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
1116                'distance_range': jQuery("#distance_range").val(),
1117                'lpNonce': jQuery('#lpNonce').val()
1118            },
1119            success: function (data) {
1120                jQuery('#full-overlay').remove();
1121                if (data) {
1122                    listing_update(data, new_design_v2, listStyle);
1123                    lp_append_distance_div();
1124                    remove_listing_skeletons();
1125                    if (jQuery('.grid').hasClass('active')) {
1126                        jQuery('.grid').trigger('click');
1127                    } else if (jQuery('.list').hasClass('active')) {
1128                        jQuery('.list').trigger('click');
1129                    }
1130                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1131                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1132                    }
1133                }
1134            }
1135        });
1136        e.preventDefault();
1137    });
1138
1139
1140    /* =========================================================== */
1141    jQuery(".sortbyfilter a,ul.priceRangeFilter li a,.listing_openTime a, .keyword-ajax,li.lp-search-best-matches").on('click', function (event) {
1142        event.preventDefault();
1143        var seracLoc = '';
1144
1145        var $this = jQuery(this);
1146        var new_design_v2 = false;
1147        var new_header_filters = false;
1148        var listStyle = '';
1149
1150        if (jQuery('#list-grid-view-v2').length != 0) {
1151            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
1152                var new_header_filters = true;
1153            }
1154            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
1155                listStyle = get_list_style();
1156                new_design_v2 = true;
1157            }
1158        }
1159
1160        if (new_header_filters == true) {
1161            get_filters_before_send();
1162            var coupons = get_filter_RRV('.filter-in-header .coupons-filter.header-filter-wrap'),
1163                listStyle = get_list_style(),
1164                skeyword = jQuery('input#skeyword-filter').val();
1165            if (jQuery('#searchlocation').length != 0) {
1166                seracLoc = jQuery("#searchlocation").val();
1167            }
1168            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
1169                seracLoc = jQuery("#lp_search_loc").val();
1170            }
1171
1172        } else {
1173
1174            var docHeight = jQuery(document).height();
1175            jQuery("body").prepend('<div id="full-overlay"></div>');
1176            jQuery('#full-overlay').css('height', docHeight + 'px');
1177            event.preventDefault();
1178            jQuery('.lp-filter-pagination').hide();
1179            jQuery('.lp-filter-pagination-ajx').remove();
1180            jQuery('#content-grids').html(' ');
1181            //jQuery('#content-grids').addClass('content-loading');
1182            jQuery('.map-view-list-container').remove();
1183            add_listing_skeletons();
1184
1185
1186            skeyword = jQuery('input#lp_current_query').val();
1187            seracLoc = jQuery("#lp_search_loc").val();
1188        }
1189
1190        var tags_name = [];
1191        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1192            return jQuery(this).val();
1193        }).get();
1194
1195        if (tags_name.length > 0) { } else {
1196            if (jQuery('#check_featuretax').length > 0) {
1197                tags_name.push(jQuery('#check_featuretax').val());
1198            }
1199        }
1200
1201
1202        var clatval = jQuery('#searchform input[name=clat]').val();
1203        var clongval = jQuery('#searchform input[name=clong]').val();
1204
1205        if (clatval && clongval) { } else {
1206            clatval = jQuery("#pac-input").attr('data-lat');
1207            clongval = jQuery("#pac-input").attr('data-lng');
1208        }
1209
1210        if (check_if_loc_disabled_fornearme()) {
1211            seracLoc = '';
1212        }
1213
1214        jQuery.ajax({
1215            type: 'POST',
1216            dataType: 'json',
1217            url: ajax_search_term_object.ajaxurl,
1218            data: {
1219                'action': 'ajax_search_tags',
1220                'formfields': get_extra_filter(),
1221                'inexpensive': get_filter_RRV2(this, 'inexpensive'),
1222                'moderate': get_filter_RRV2(this, 'moderate'),
1223                'pricey': get_filter_RRV2(this, 'pricey'),
1224                'ultra': get_filter_RRV2(this, 'ultra_high_end'),
1225                'averageRate': get_filter_RRV2(this, 'listing_rate'),
1226                'mostRewvied': get_filter_RRV2(this, 'listing_reviewed'),
1227                'coupons': coupons,
1228                'mostviewed': get_filter_RRV2(this, 'mostviewed'),
1229                'listing_openTime': get_filter_RRV2(this, 'OpenClose'),
1230                'lpstag': jQuery("#lpstag").val(),
1231                'tag_name': tags_name,
1232                'cat_id': jQuery("#searchform select#searchcategory").val(),
1233                'loc_id': seracLoc,
1234                'list_style': listStyle,
1235                'skeyword': skeyword,
1236                'clat': clatval,
1237                'clong': clongval,
1238                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
1239                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
1240                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
1241                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
1242                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
1243                'distance_range': jQuery("#distance_range").val(),
1244                'lpNonce': jQuery('#lpNonce').val()
1245            },
1246            success: function (data) {
1247                jQuery('#full-overlay').remove();
1248                if (data) {
1249
1250                    listing_update(data, new_design_v2, listStyle);
1251                    lp_append_distance_div();
1252                    remove_listing_skeletons();
1253                    if (jQuery('.grid').hasClass('active')) {
1254                        jQuery('.grid').trigger('click');
1255                    } else if (jQuery('.list').hasClass('active')) {
1256                        jQuery('.list').trigger('click');
1257                    }
1258
1259
1260                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1261                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1262                    }
1263
1264
1265                }
1266            }
1267        });
1268    });
1269
1270
1271    function get_extra_filter() {
1272        $selectedFields = [];
1273        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
1274            keyValuePair = {};
1275            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
1276            $selectedFields.push(keyValuePair);
1277        });
1278        return $selectedFields;
1279    }
1280
1281
1282    function get_filter_RRV2(selecter, SortType) {
1283        activeVal = '';
1284        /* Best match filter */
1285        var attrBest = jQuery(selecter).attr('data-best');
1286        if (typeof attrBest !== typeof undefined && attrBest !== false) {
1287            if ('OpenClose' == SortType) {
1288                jQuery('.listing_openTime').find('a').toggleClass('active');
1289                if (jQuery('.listing_openTime a').hasClass("active")) {
1290                    jQuery('.listing_openTime a').attr('data-time', 'open');
1291                    listing_openTime = 'open';
1292
1293                } else {
1294                    jQuery('.listing_openTime a').attr('data-time', 'close');
1295                    listing_openTime = 'close';
1296                }
1297            }
1298            if ('listing_rate' == SortType) {
1299                jQuery(selecter).find('a').toggleClass('active');
1300                var bestMatch = jQuery(selecter).find('a');
1301                if (bestMatch.hasClass('active')) {
1302                    jQuery('li.sortbyfilter').find('a').removeClass('active');
1303                    jQuery('li#listingRate').find('a').addClass('active');
1304                } else {
1305                    jQuery('li#listingRate').find('a').removeClass('active');
1306                }
1307
1308            }
1309        }
1310
1311        /* SOrting filter */
1312        var attrSort = jQuery(selecter).attr('data-value');
1313        if (typeof attrSort !== typeof undefined && attrSort !== false) {
1314            if ('listing_rate' == SortType) {
1315                jQuery('li.sortbyfilter').find('a').removeClass('active');
1316                jQuery(selecter).toggleClass('active');
1317            }
1318        }
1319        var activeSortVal = jQuery('li.sortbyfilter').find('.active').data('value');
1320        if (activeSortVal == SortType) {
1321            activeVal = activeSortVal;
1322        }
1323
1324        /* Pricing range filter */
1325        var attrPrice = jQuery(selecter).attr('data-price');
1326        if (typeof attrPrice !== typeof undefined && attrPrice !== false) {
1327            if ('inexpensive' == SortType) {
1328                if (jQuery(selecter).hasClass('active')) {
1329                    jQuery(selecter).removeClass('active');
1330                } else {
1331                    jQuery('ul.priceRangeFilter li a').removeClass('active');
1332                    jQuery(selecter).addClass('active');
1333                }
1334            }
1335        }
1336        if ('inexpensive' == SortType || 'moderate' == SortType || 'pricey' == SortType || 'ultra_high_end' == SortType) {
1337            inexpensive = jQuery('ul.priceRangeFilter #one').find('.active').data('price');
1338            moderate = jQuery('ul.priceRangeFilter #two').find('.active').data('price');
1339            pricey = jQuery('ul.priceRangeFilter #three').find('.active').data('price');
1340            ultra = jQuery('ul.priceRangeFilter #four').find('.active').data('price');
1341            if (inexpensive == SortType) {
1342                activeVal = inexpensive;
1343            } else if (moderate == SortType) {
1344                activeVal = moderate;
1345            } else if (pricey == SortType) {
1346                activeVal = pricey;
1347            } else if (ultra == SortType) {
1348                activeVal = ultra;
1349            }
1350        }
1351        /* Open CLose filter */
1352        listing_openTime = jQuery('.listing_openTime').find('.active').data('time');
1353        var attrtime = jQuery(selecter).attr('data-time');
1354        if (typeof attrtime !== typeof undefined && attrtime !== false && 'OpenClose' == SortType) {
1355            jQuery(selecter).toggleClass('active');
1356            if (jQuery(selecter).hasClass("active")) {
1357                jQuery(selecter).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1358                jQuery(selecter).attr('data-time', 'open');
1359                listing_openTime = 'open';
1360
1361            } else {
1362                jQuery(selecter).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1363                jQuery(selecter).attr('data-time', 'close');
1364                listing_openTime = 'close';
1365            }
1366        }
1367        if ('OpenClose' == SortType) {
1368            activeVal = listing_openTime;
1369        }
1370
1371        return activeVal;
1372
1373    }
1374
1375
1376
1377    /* ===============================for best match by  z============================ */
1378    /* ===============================for best match by  z============================ */
1379    jQuery("#filter-in-header .best-match-filter").on('click', function (event) {
1380        var $this = jQuery(this);
1381        $selectedFields = [];
1382        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
1383            keyValuePair = {};
1384            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
1385            $selectedFields.push(keyValuePair);
1386        });
1387        $this.toggleClass('active');
1388        var new_design_v2 = false;
1389        var new_header_filters = false;
1390        var listStyle = '';
1391
1392        if (jQuery('#list-grid-view-v2').length != 0) {
1393            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
1394                var new_header_filters = true;
1395            }
1396            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
1397                listStyle = get_list_style();
1398                new_design_v2 = true;
1399            }
1400        }
1401
1402        if (new_header_filters == true) {
1403            get_filters_before_send();
1404
1405            if ($this.hasClass('active')) {
1406                jQuery('.rated-filter.header-filter-wrap').addClass("active");
1407                jQuery('.reviewed-filter.header-filter-wrap').addClass("active");
1408                jQuery('.viewed-filter.header-filter-wrap').addClass("active");
1409                jQuery('.open-now-filter').addClass('active');
1410            } else {
1411                jQuery('.rated-filter.header-filter-wrap').removeClass("active");
1412                jQuery('.reviewed-filter.header-filter-wrap').removeClass("active");
1413                jQuery('.viewed-filter.header-filter-wrap').removeClass("active");
1414                jQuery('.open-now-filter').removeClass('active');
1415            }
1416
1417            var averageRate = get_filter_RRV('.filter-in-header .rated-filter.header-filter-wrap'),
1418                mostRewvied = get_filter_RRV('.filter-in-header .reviewed-filter.header-filter-wrap'),
1419                mostViewed = get_filter_RRV('.filter-in-header .viewed-filter.header-filter-wrap'),
1420                inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
1421                moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
1422                pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
1423                ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
1424                listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
1425                skeyword = jQuery('input#skeyword-filter').val();
1426            if (jQuery('#searchlocation').length != 0) {
1427                seracLoc = jQuery("#searchlocation").val();
1428            }
1429            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
1430                seracLoc = jQuery("#lp_search_loc").val();
1431            }
1432        } else {
1433            var docHeight = jQuery(document).height();
1434            jQuery("body").prepend('<div id="full-overlay"></div>');
1435            jQuery('#full-overlay').css('height', docHeight + 'px');
1436            event.preventDefault();
1437            jQuery('.lp-filter-pagination').hide();
1438            jQuery('#content-grids').html(' ');
1439            jQuery('.lp-filter-pagination-ajx').remove();
1440            //jQuery('#content-grids').addClass('content-loading');
1441            add_listing_skeletons();
1442            jQuery('.map-view-list-container').remove();
1443            var inexpensive = '';
1444            moderate = '';
1445            pricey = '';
1446            ultra = '';
1447            averageRate = '';
1448            mostRewvied = '';
1449            listing_openTime = '';
1450            mostViewed = '';
1451
1452
1453            inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
1454            moderate = jQuery('.currency-signs #two').find('.active').data('price');
1455            pricey = jQuery('.currency-signs #three').find('.active').data('price');
1456            ultra = jQuery('.currency-signs #four').find('.active').data('price');
1457
1458            $this.find('a').toggleClass('active');
1459            if ($this.find('a').hasClass('active')) {
1460                jQuery('.search-filters li#mostviewed a').addClass("active");
1461                jQuery('.search-filters li#listingRate a').addClass("active");
1462                jQuery('.search-filters li#listingReviewed a').addClass("active");
1463                jQuery('.search-filters li.listing_openTime a').addClass("active");
1464                jQuery('.search-filters li.listing_openTime').find('.active').data('value', 'open');
1465            } else {
1466                jQuery('.search-filters li#mostviewed a').removeClass("active");
1467                jQuery('.search-filters li#listingRate a').removeClass("active");
1468                jQuery('.search-filters li#listingReviewed a').removeClass("active");
1469
1470                jQuery('.search-filters li.listing_openTime a').removeClass("active");
1471                jQuery('.search-filters li.listing_openTime a').data('value', 'close');
1472            }
1473
1474
1475
1476            mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
1477            averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
1478            mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
1479            listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
1480
1481
1482            skeyword = jQuery('input#lp_current_query').val();
1483            seracLoc = jQuery("#lp_search_loc").val();
1484        }
1485
1486        var tags_name = [];
1487        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1488            return jQuery(this).val();
1489        }).get();
1490
1491        if (tags_name.length > 0) { } else {
1492            if (jQuery('#check_featuretax').length > 0) {
1493                tags_name.push(jQuery('#check_featuretax').val());
1494            }
1495        }
1496
1497
1498        var clatval = jQuery('#searchform input[name=clat]').val();
1499        var clongval = jQuery('#searchform input[name=clong]').val();
1500
1501        if (clatval && clongval) { } else {
1502            clatval = jQuery("#pac-input").attr('data-lat');
1503            clongval = jQuery("#pac-input").attr('data-lng');
1504        }
1505
1506
1507        if (listStyle == null && jQuery('#list-grid-view-v2').length != 0) {
1508            listStyle = jQuery('#list-grid-view-v2').data('layout-class');
1509        }
1510
1511        if (check_if_loc_disabled_fornearme()) {
1512            seracLoc = '';
1513        }
1514
1515        jQuery.ajax({
1516            type: 'POST',
1517            dataType: 'json',
1518            url: ajax_search_term_object.ajaxurl,
1519            data: {
1520                'action': 'ajax_search_tags',
1521                'formfields': $selectedFields,
1522                'inexpensive': inexpensive,
1523                'moderate': moderate,
1524                'pricey': pricey,
1525                'ultra': ultra,
1526                'averageRate': averageRate,
1527                'mostRewvied': mostRewvied,
1528                'listing_openTime': listing_openTime,
1529                'mostviewed': mostViewed,
1530                'lpstag': jQuery("#lpstag").val(),
1531                'tag_name': tags_name,
1532                'cat_id': jQuery("#searchform select#searchcategory").val(),
1533                'loc_id': seracLoc,
1534                'list_style': listStyle,
1535                'skeyword': skeyword,
1536                'clat': clatval,
1537                'clong': clongval,
1538                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
1539                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
1540                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
1541                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
1542                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
1543                'distance_range': jQuery("#distance_range").val(),
1544                'lpNonce': jQuery('#lpNonce').val()
1545            },
1546            success: function (data) {
1547                jQuery('#full-overlay').remove();
1548                if (data) {
1549                    listing_update(data, new_design_v2, listStyle);
1550                    lp_append_distance_div();
1551                    remove_listing_skeletons();
1552                    if (jQuery('.grid').hasClass('active')) {
1553                        jQuery('.grid').trigger('click');
1554                    } else if (jQuery('.list').hasClass('active')) {
1555                        jQuery('.list').trigger('click');
1556                    }
1557
1558
1559                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1560                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1561                    }
1562
1563
1564                }
1565            }
1566        });
1567    });
1568
1569
1570    jQuery(document).on('click', '.app-view-filters .currency-signs.search-filter-attr li a', function (event) {
1571        event.preventDefault();
1572
1573        var $this = jQuery(this);
1574        jQuery(this).toggleClass('active');
1575        get_app_view_before_send();
1576
1577        if (jQuery(this).hasClass('active')) {
1578            jQuery(this).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1579        } else {
1580            jQuery(this).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1581        }
1582        var tags_name = [];
1583        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1584            return jQuery(this).val();
1585        }).get();
1586
1587        if (tags_name.length > 0) { } else {
1588            if (jQuery('#check_featuretax').length > 0) {
1589                tags_name.push(jQuery('#check_featuretax').val());
1590            }
1591        }
1592
1593        skeyword = jQuery('input#lp_current_query').val();
1594
1595        seracLoc = jQuery("#lp_search_loc").val();
1596        if (check_if_loc_disabled_fornearme()) {
1597            seracLoc = '';
1598        }
1599        listStyle = '';
1600        jQuery.ajax({
1601            type: 'POST',
1602            dataType: 'json',
1603            url: ajax_search_term_object.ajaxurl,
1604            data: {
1605                'action': 'ajax_search_tags',
1606                'formfields': get_extra_filter(),
1607                'inexpensive': get_app_view_filter_val('.currency-signs.search-filter-attr li a#one', 'inexpensive', 'price_range'),
1608                'moderate': get_app_view_filter_val('.currency-signs.search-filter-attr li a#two', 'moderate', 'price_range'),
1609                'pricey': get_app_view_filter_val('.currency-signs.search-filter-attr li a#three', 'pricey', 'price_range'),
1610                'ultra': get_app_view_filter_val('.currency-signs.search-filter-attr li a#four', 'ultra_high_end', 'price_range'),
1611                'averageRate': get_app_view_filter_val('#listingRate', 'listing_rate'),
1612                'mostRewvied': get_app_view_filter_val('#listingReviewed', 'listing_reviewed'),
1613                'coupons': get_app_view_filter_val('#listingCoupons', 'coupons'),
1614                'mostviewed': get_app_view_filter_val('#mostviewed', 'mostviewed'),
1615                'listing_openTime': get_app_view_filter_val('.listing_openTime', 'open'),
1616                'lpstag': jQuery("#lpstag").val(),
1617                'tag_name': tags_name,
1618                'cat_id': jQuery("#searchform select#searchcategory").val(),
1619                'loc_id': seracLoc,
1620                'list_style': listStyle,
1621                'skeyword': skeyword,
1622                'lpNonce': jQuery('#lpNonce').val()
1623            },
1624            success: function (data) {
1625                jQuery('.app-filter-loader-active').html('<i class="fa fa-check-circle" aria-hidden="true"></i>');
1626                jQuery('#full-overlay').remove();
1627                if (data) {
1628                    listing_update(data);
1629                    lp_append_distance_div();
1630                    remove_listing_skeletons();
1631                    if (jQuery('.grid').hasClass('active')) {
1632                        jQuery('.grid').trigger('click');
1633                    } else if (jQuery('.list').hasClass('active')) {
1634                        jQuery('.list').trigger('click');
1635                    }
1636
1637
1638                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1639                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1640                    }
1641
1642
1643                }
1644            }
1645        });
1646    });
1647    jQuery(document).on('change', '.search-filter-attr input[type="checkbox"].listing_openTime, .search-filter-attr input[type="checkbox"]#bestmatch, .search-filter-attr input[type="checkbox"]#listingCoupons,.search-filter-attr input[type="checkbox"]#listingRate, .search-filter-attr input[type="checkbox"]#listingReviewed, .search-filter-attr input[type="checkbox"]#mostviewed', function (event) {
1648
1649        event.preventDefault();
1650        var $this = jQuery(this);
1651        best_match_filter_toggle($this);
1652        get_app_view_before_send();
1653
1654        if (jQuery(this).hasClass('active')) {
1655            jQuery(this).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1656        } else {
1657            jQuery(this).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
1658        }
1659        var tags_name = [];
1660        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1661            return jQuery(this).val();
1662        }).get();
1663
1664        if (tags_name.length > 0) { } else {
1665            if (jQuery('#check_featuretax').length > 0) {
1666                tags_name.push(jQuery('#check_featuretax').val());
1667            }
1668        }
1669
1670        skeyword = jQuery('input#lp_current_query').val();
1671
1672        seracLoc = jQuery("#lp_search_loc").val();
1673        if (check_if_loc_disabled_fornearme()) {
1674            seracLoc = '';
1675        }
1676        listStyle = '';
1677        jQuery.ajax({
1678            type: 'POST',
1679            dataType: 'json',
1680            url: ajax_search_term_object.ajaxurl,
1681            data: {
1682                'action': 'ajax_search_tags',
1683                'formfields': get_extra_filter(),
1684                'inexpensive': get_app_view_filter_val('.currency-signs.search-filter-attr li a#one', 'inexpensive', 'price_range'),
1685                'moderate': get_app_view_filter_val('.currency-signs.search-filter-attr li a#two', 'moderate', 'price_range'),
1686                'pricey': get_app_view_filter_val('.currency-signs.search-filter-attr li a#three', 'pricey', 'price_range'),
1687                'ultra': get_app_view_filter_val('.currency-signs.search-filter-attr li a#four', 'ultra_high_end', 'price_range'),
1688                'averageRate': get_app_view_filter_val('#listingRate', 'listing_rate'),
1689                'mostRewvied': get_app_view_filter_val('#listingReviewed', 'listing_reviewed'),
1690                'coupons': get_app_view_filter_val('#listingCoupons', 'coupons'),
1691                'mostviewed': get_app_view_filter_val('#mostviewed', 'mostviewed'),
1692                'listing_openTime': get_app_view_filter_val('.listing_openTime', 'open'),
1693                'lpstag': jQuery("#lpstag").val(),
1694                'tag_name': tags_name,
1695                'cat_id': jQuery("#searchform select#searchcategory").val(),
1696                'loc_id': seracLoc,
1697                'list_style': listStyle,
1698                'skeyword': skeyword,
1699                'lpNonce': jQuery('#lpNonce').val()
1700            },
1701            success: function (data) {
1702                jQuery('.app-filter-loader-active').html('<i class="fa fa-check-circle" aria-hidden="true"></i>');
1703                jQuery('#full-overlay').remove();
1704                if (data) {
1705                    listing_update(data);
1706                    lp_append_distance_div();
1707                    remove_listing_skeletons();
1708                    if (jQuery('.grid').hasClass('active')) {
1709                        jQuery('.grid').trigger('click');
1710                    } else if (jQuery('.list').hasClass('active')) {
1711                        jQuery('.list').trigger('click');
1712                    }
1713
1714
1715                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1716                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1717                    }
1718
1719
1720                }
1721            }
1722        });
1723    });
1724
1725    function best_match_filter_toggle(selector) {
1726        if (selector.is('#bestmatch')) {
1727            if (selector.is(':checked')) {
1728                jQuery('.search-filter-attr input[type="checkbox"].listing_openTime').prop('checked', true);
1729                jQuery('.search-filter-attr input[type="checkbox"]#listingRate').prop('checked', true);
1730            } else {
1731                jQuery('.search-filter-attr input[type="checkbox"].listing_openTime').prop('checked', false);
1732                jQuery('.search-filter-attr input[type="checkbox"]#listingRate').prop('checked', false);
1733            }
1734        }
1735    }
1736
1737    function get_app_view_filter_val(selector, filter_val, filterType) {
1738        if (selector == '.listing_openTime') {
1739            var $return = 'close';
1740        } else {
1741            var $return = '';
1742        }
1743        if (filterType == 'price_range') {
1744            if (jQuery(selector).hasClass('active')) {
1745                jQuery(selector).addClass('myclass');
1746                $return = filter_val;
1747            }
1748        } else {
1749            if (jQuery(selector).is(':checked')) {
1750                $return = filter_val;
1751            }
1752        }
1753        return $return;
1754    }
1755
1756    function get_app_view_before_send() {
1757        var docHeight = jQuery(document).height();
1758        jQuery("body").prepend('<div id="full-overlay"></div>');
1759        jQuery('#full-overlay').css('height', docHeight + 'px');
1760        event.preventDefault();
1761
1762        jQuery(this).toggleClass('active');
1763        jQuery('.lp-filter-pagination').hide();
1764        jQuery('#content-grids').html(' ');
1765        jQuery('.lp-filter-pagination-ajx').remove();
1766        jQuery('#content-grids').addClass('content-loading');
1767        jQuery('.map-view-list-container').remove();
1768    }
1769
1770    /* =========================================================== */
1771    jQuery(document).on('click', '.lp-filter-pagination-ajx ul li span.haspaglink', function (event) {
1772
1773        $selectedFields = [];
1774        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
1775            keyValuePair = {};
1776            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
1777            $selectedFields.push(keyValuePair);
1778        });
1779        jQuery('#lp-pages-in-cats').hide(200);
1780        var seracLoc = '';
1781        var $this = jQuery(this);
1782        var new_design_v2 = false;
1783        var new_header_filters = false;
1784        var listStyle = '';
1785
1786        if (jQuery('#list-grid-view-v2').length != 0) {
1787            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
1788                var new_header_filters = true;
1789            }
1790            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
1791                listStyle = get_list_style();
1792                new_design_v2 = true;
1793            }
1794        }
1795
1796        if (new_header_filters == true) {
1797
1798
1799            get_filters_before_send();
1800            var averageRate = get_filter_RRV('.filter-in-header .rated-filter.header-filter-wrap'),
1801                mostRewvied = get_filter_RRV('.filter-in-header .reviewed-filter.header-filter-wrap'),
1802                mostViewed = get_filter_RRV('.filter-in-header .viewed-filter.header-filter-wrap'),
1803                inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
1804                moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
1805                pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
1806                ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
1807                listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
1808                listStyle = get_list_style(),
1809                skeyword = $this.data('skeyword');
1810            if (jQuery('#searchlocation').length != 0) {
1811                seracLoc = jQuery("#searchlocation").val();
1812            }
1813            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
1814                seracLoc = jQuery("#lp_search_loc").val();
1815            }
1816            jQuery('html, body').animate({ scrollTop: 0 }, 500);
1817        } else {
1818
1819
1820
1821            jQuery('.lp-filter-pagination-ajx ul li span').removeClass('active');
1822            var docHeight = jQuery(document).height();
1823            jQuery('html, body').animate({ scrollTop: 0 }, 500);
1824            jQuery("body").prepend('<div id="full-overlay"></div>');
1825            jQuery('#full-overlay').css('height', docHeight + 'px');
1826            event.preventDefault();
1827            jQuery(this).toggleClass('active');
1828
1829            jQuery('#content-grids').html(' ');
1830            jQuery('.lp-filter-pagination-ajx').remove();
1831            //jQuery('#content-grids').addClass('content-loading');
1832            add_listing_skeletons();
1833            jQuery('.map-view-list-container').remove();
1834            var inexpensive = '';
1835            moderate = '';
1836            pricey = '';
1837            ultra = '';
1838            averageRate = '';
1839            mostRewvied = '';
1840            listing_openTime = '';
1841            mostViewed = '';
1842            seracLoc = '';
1843
1844
1845            if (jQuery('#searchlocation').length != 0) {
1846                seracLoc = jQuery("#searchlocation").val();
1847            }
1848            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
1849                seracLoc = jQuery("#lp_search_loc").val();
1850            }
1851
1852            inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
1853            moderate = jQuery('.currency-signs #two').find('.active').data('price');
1854            pricey = jQuery('.currency-signs #three').find('.active').data('price');
1855            ultra = jQuery('.currency-signs #four').find('.active').data('price');
1856
1857            mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
1858            averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
1859            mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
1860            listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
1861
1862
1863            skeyword = jQuery('input#lp_current_query').val();
1864
1865        }
1866        pageno = jQuery(this).data('pageurl');
1867        var tags_name = [];
1868        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
1869            return jQuery(this).val();
1870        }).get();
1871
1872        if (tags_name.length > 0) { } else {
1873            if (jQuery('#check_featuretax').length > 0) {
1874                tags_name.push(jQuery('#check_featuretax').val());
1875            }
1876        }
1877
1878        var clatval = jQuery('#searchform input[name=clat]').val();
1879        var clongval = jQuery('#searchform input[name=clong]').val();
1880
1881        if (clatval && clongval) { } else {
1882            clatval = jQuery("#pac-input").attr('data-lat');
1883            clongval = jQuery("#pac-input").attr('data-lng');
1884        }
1885
1886        if (check_if_loc_disabled_fornearme()) {
1887            seracLoc = '';
1888        }
1889        if (jQuery('body').hasClass('listing-app-view-new')) {
1890            mostViewed = jQuery('.search-filter-attr #mostviewed:checked').val();
1891            averageRate = jQuery('.search-filter-attr #listingRate:checked').val();
1892            mostRewvied = jQuery('.search-filter-attr #listingReviewed:checked').val();
1893            listing_openTime = jQuery('.search-filter-attr .listing_openTime:checked').data('value');
1894        }
1895        var cat_id = '';
1896        var lpstag = '';
1897        if (jQuery("#searchform select#searchcategory").length > 0) {
1898            cat_id = jQuery("#searchform select#searchcategory").val();
1899        } else {
1900            if (jQuery('#lp_s_cat').val() != '') {
1901                cat_id = jQuery("#lp_s_cat").val();
1902            }
1903        }
1904        if (jQuery("#lpstag").length > 0) {
1905            lpstag = jQuery("#lpstag").val();
1906        } else if (jQuery('#lp_s_tag').length > 0) {
1907            lpstag = jQuery("#lp_s_tag").val();
1908        }
1909        jQuery.ajax({
1910            type: 'POST',
1911            dataType: 'json',
1912            url: ajax_search_term_object.ajaxurl,
1913            data: {
1914                'action': 'ajax_search_tags',
1915                'formfields': $selectedFields,
1916                'inexpensive': inexpensive,
1917                'moderate': moderate,
1918                'pricey': pricey,
1919                'ultra': ultra,
1920                'averageRate': averageRate,
1921                'mostRewvied': mostRewvied,
1922                'mostviewed': mostViewed,
1923                'listing_openTime': listing_openTime,
1924                'lpstag': lpstag,
1925                'tag_name': tags_name,
1926                'cat_id': cat_id,
1927                'loc_id': seracLoc,
1928                'list_style': listStyle,
1929                'pageno': pageno,
1930                'skeyword': skeyword,
1931                'clat': clatval,
1932                'clong': clongval,
1933                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
1934                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
1935                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
1936                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
1937                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
1938                'distance_range': jQuery("#distance_range").val(),
1939                'lpNonce': jQuery('#lpNonce').val()
1940            },
1941            success: function (data) {
1942                $this.addClass('active');
1943                jQuery('#full-overlay').remove();
1944                if (data) {
1945                    remove_listing_skeletons();
1946                    listing_update(data, new_design_v2, listStyle);
1947                    lp_append_distance_div();
1948                    if (jQuery('.grid').hasClass('active')) {
1949                        jQuery('.grid').trigger('click');
1950                    } else if (jQuery('.list').hasClass('active')) {
1951                        jQuery('.list').trigger('click');
1952                    }
1953                    if (jQuery('div.promoted-listings div.app-view-new-ads-slider').length) {
1954                        jQuery('div.app-view-new-ads-slider').slick({
1955                            arrows: false,
1956                        });
1957                    }
1958
1959
1960                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
1961                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
1962                    }
1963
1964
1965                }
1966            }
1967        });
1968    });
1969
1970    jQuery(document).on('click', '#filter-in-header .sort-filter-inner .rated-filter, #filter-in-header .sort-filter-inner .reviewed-filter, #filter-in-header .sort-filter-inner .viewed-filter', function (e) {
1971        $selectedFields = [];
1972        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
1973            keyValuePair = {};
1974            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
1975            $selectedFields.push(keyValuePair);
1976        });
1977
1978        get_filters_before_send();
1979        jQuery(this).toggleClass('active');
1980
1981        var new_design_v2 = false;
1982        var listStyle = '';
1983        if (jQuery('#list-grid-view-v2').length != 0) {
1984            new_design_v2 = true;
1985        }
1986
1987        var averageRate = get_filter_RRV('.rated-filter.header-filter-wrap'),
1988            mostRewvied = get_filter_RRV('.reviewed-filter.header-filter-wrap'),
1989            mostViewed = get_filter_RRV('.viewed-filter.header-filter-wrap'),
1990            inexpensive = get_price_range_vals('.price-filter ul li#one'),
1991            moderate = get_price_range_vals('.price-filter ul li#two'),
1992            pricey = get_price_range_vals('.price-filter ul li#three'),
1993            ultra = get_price_range_vals('.price-filter ul li#four'),
1994            listing_openTime = get_open_now_val('.open-now-filter'),
1995            listStyle = get_list_style(),
1996            skeyword = jQuery('input#skeyword-filter').val();
1997        if (jQuery('#searchlocation').length != 0) {
1998            seracLoc = jQuery("#searchlocation").val();
1999        }
2000        if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
2001            seracLoc = jQuery("#lp_search_loc").val();
2002        }
2003
2004
2005        var tags_name = [];
2006        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
2007            return jQuery(this).val();
2008        }).get();
2009        skeyword = jQuery('input#lp_current_query').val();
2010        var clatval = jQuery('#searchform input[name=clat]').val();
2011        var clongval = jQuery('#searchform input[name=clong]').val();
2012
2013        if (clatval && clongval) { } else {
2014            clatval = jQuery("#pac-input").attr('data-lat');
2015            clongval = jQuery("#pac-input").attr('data-lng');
2016        }
2017
2018        if (check_if_loc_disabled_fornearme()) {
2019            seracLoc = '';
2020        }
2021
2022        jQuery.ajax({
2023            type: 'POST',
2024            dataType: 'json',
2025            url: ajax_search_term_object.ajaxurl,
2026            data: {
2027                'action': 'ajax_search_tags',
2028                'formfields': $selectedFields,
2029                'inexpensive': inexpensive,
2030                'moderate': moderate,
2031                'pricey': pricey,
2032                'ultra': ultra,
2033                'averageRate': averageRate,
2034                'mostRewvied': mostRewvied,
2035                'mostviewed': mostViewed,
2036                'listing_openTime': listing_openTime,
2037                'tag_name': tags_name,
2038                'cat_id': jQuery("#category-select").val(),
2039                'loc_id': seracLoc,
2040                'list_style': listStyle,
2041                'skeyword': skeyword,
2042                'clat': clatval,
2043                'clong': clongval,
2044                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
2045                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
2046                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
2047                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
2048                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
2049                'distance_range': jQuery("#distance_range").val(),
2050                'lpNonce': jQuery('#lpNonce').val()
2051            },
2052            success: function (data) {
2053                jQuery('#full-overlay').remove();
2054                if (data) {
2055                    listing_update(data, new_design_v2, listStyle);
2056                    lp_append_distance_div();
2057                    remove_listing_skeletons();
2058                    if (jQuery('.grid').hasClass('active')) {
2059                        jQuery('.grid').trigger('click');
2060                    } else if (jQuery('.list').hasClass('active')) {
2061                        jQuery('.list').trigger('click');
2062                    }
2063
2064
2065                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
2066                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
2067                    }
2068
2069
2070                }
2071            }
2072        });
2073
2074    })
2075
2076    /* =======================Open now========================= */
2077    jQuery(document).on('click', 'input[type="checkbox"].listing_openTime', function (event) {
2078
2079
2080        var new_design_v2 = false;
2081        var listStyle = '';
2082
2083        if (jQuery('#list-grid-view-v2').length != 0) {
2084            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
2085                new_design_v2 = true;
2086                listStyle = get_list_style();
2087            }
2088        }
2089        var docHeight = jQuery(document).height();
2090        jQuery("body").prepend('<div id="full-overlay"></div>');
2091        jQuery('#full-overlay').css('height', docHeight + 'px');
2092        jQuery('.lp-filter-pagination').hide();
2093        jQuery('#content-grids').html(' ');
2094        jQuery('.lp-filter-pagination-ajx').remove();
2095        //jQuery('#content-grids').addClass('content-loading');
2096        add_listing_skeletons();
2097        jQuery('.map-view-list-container').remove();
2098
2099
2100        var inexpensive = '';
2101        moderate = '';
2102        pricey = '';
2103        ultra = '';
2104        averageRate = '';
2105        mostRewvied = '';
2106        coupons = '';
2107        var listing_openTime = '';
2108        mostViewed = '';
2109
2110        inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
2111        moderate = jQuery('.currency-signs #two').find('.active').data('price');
2112        pricey = jQuery('.currency-signs #three').find('.active').data('price');
2113        ultra = jQuery('.currency-signs #four').find('.active').data('price');
2114
2115        if (!jQuery('body').hasClass('listing-app-view')) {
2116            mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
2117            averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
2118            mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
2119            listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
2120            coupons = jQuery('.search-filters li.listing_coupons').find('a.active').data('value');
2121            if (jQuery('.search-filters li.listing_coupons a.active').length > 0) {
2122                coupons = 'coupons';
2123            }
2124            event.preventDefault();
2125        } else {
2126            if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
2127                averageRate = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
2128            }
2129            if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
2130                mostRewvied = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
2131            }
2132        }
2133
2134        jQuery(this).toggleClass('active');
2135        if (jQuery(this).hasClass("active")) {
2136            jQuery(this).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
2137            jQuery(this).attr('data-value', 'open');
2138            listing_openTime = 'open';
2139
2140        } else {
2141            jQuery(this).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
2142            jQuery(this).attr('data-value', 'close');
2143            listing_openTime = 'close';
2144        }
2145        //listing_openTime = jQuery(this).data('value');
2146
2147        var tags_name = [];
2148        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
2149            return jQuery(this).val();
2150        }).get();
2151
2152        if (tags_name.length > 0) { } else {
2153            if (jQuery('#check_featuretax').length > 0) {
2154                tags_name.push(jQuery('#check_featuretax').val());
2155            }
2156        }
2157
2158        skeyword = jQuery('input#lp_current_query').val();
2159
2160        if (skeyword) { } else {
2161            skeyword = jQuery('input#lp_current_query').val();
2162        }
2163
2164        var clatval = jQuery('#searchform input[name=clat]').val();
2165        var clongval = jQuery('#searchform input[name=clong]').val();
2166
2167        if (clatval && clongval) { } else {
2168            clatval = jQuery("#pac-input").attr('data-lat');
2169            clongval = jQuery("#pac-input").attr('data-lng');
2170        }
2171
2172        seracLoc = jQuery("#lp_search_loc").val();
2173        if (check_if_loc_disabled_fornearme()) {
2174            seracLoc = '';
2175        }
2176
2177        jQuery.ajax({
2178            type: 'POST',
2179            dataType: 'json',
2180            url: ajax_search_term_object.ajaxurl,
2181            data: {
2182                'action': 'ajax_search_tags',
2183                'inexpensive': inexpensive,
2184                'moderate': moderate,
2185                'pricey': pricey,
2186                'ultra': ultra,
2187                'averageRate': averageRate,
2188                'mostRewvied': mostRewvied,
2189                'coupons': coupons,
2190                'mostviewed': mostViewed,
2191                'listing_openTime': listing_openTime,
2192                'lpstag': jQuery("#lpstag").val(),
2193                'tag_name': tags_name,
2194                'cat_id': jQuery("#searchform select#searchcategory").val(),
2195                'loc_id': seracLoc,
2196                'list_style': listStyle,
2197                'skeyword': skeyword,
2198                'clat': clatval,
2199                'clong': clongval,
2200                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
2201                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
2202                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
2203                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
2204                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
2205                'distance_range': jQuery("#distance_range").val(),
2206                'lpNonce': jQuery('#lpNonce').val()
2207            },
2208            success: function (data) {
2209                jQuery('.app-filter-loader-active').html('<i class="fa fa-check-circle" aria-hidden="true"></i>');
2210                jQuery('#full-overlay').remove();
2211                if (data) {
2212
2213                    remove_listing_skeletons();
2214                    listing_update(data, new_design_v2, listStyle)
2215                    lp_append_distance_div();
2216                    if (data.opentime != '') {
2217                        var timevalue = '';
2218                        timevalue = data.opentime;
2219                        /* if(timevalue=='open'){
2220                         jQuery('#content-grids .lp-grid-box-contianer .grid-closed:contains("Closed Now")') .closest( ".lp-grid-box-contianer" ).css('display','none');
2221                         }
2222                         if(timevalue=='close'){
2223                         jQuery('#content-grids .lp-grid-box-contianer .grid-closed:contains("Closed Now")') .closest( ".lp-grid-box-contianer" ).css('display','block');
2224                         } */
2225                        if (jQuery('.grid').hasClass('active')) {
2226                            jQuery('.grid').trigger('click');
2227                        } else if (jQuery('.list').hasClass('active')) {
2228                            jQuery('.list').trigger('click');
2229                        }
2230                    }
2231
2232
2233                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
2234                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
2235                    }
2236
2237
2238                }
2239
2240            }
2241        });
2242
2243    });
2244
2245    /* =======================Open now========================= */
2246    jQuery(document).on('click', 'input[type="checkbox"]#listing_openTime', function (event) {
2247        $selectedFields = [];
2248        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
2249            keyValuePair = {};
2250            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
2251            $selectedFields.push(keyValuePair);
2252        });
2253        jQuery(this).toggleClass('active');
2254        var new_design_v2 = false;
2255        var new_header_filters = false;
2256        var listStyle = '';
2257
2258        if (jQuery('#list-grid-view-v2').length != 0) {
2259            if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
2260                var new_header_filters = true;
2261            }
2262            if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
2263                listStyle = get_list_style();
2264                new_design_v2 = true;
2265            }
2266        }
2267
2268        if (new_header_filters == true) {
2269
2270            get_filters_before_send();
2271            var averageRate = get_filter_RRV('.filter-in-header .rated-filter.header-filter-wrap'),
2272                mostRewvied = get_filter_RRV('.filter-in-header .reviewed-filter.header-filter-wrap'),
2273                mostViewed = get_filter_RRV('.filter-in-header .viewed-filter.header-filter-wrap'),
2274                inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
2275                moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
2276                pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
2277                ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
2278                listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
2279                listStyle = get_list_style(),
2280                skeyword = jQuery('input#skeyword-filter').val();
2281            if (jQuery('#searchlocation').length != 0) {
2282                seracLoc = jQuery("#searchlocation").val();
2283            }
2284            if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
2285                seracLoc = jQuery("#lp_search_loc").val();
2286            }
2287        } else {
2288            var docHeight = jQuery(document).height();
2289            jQuery("body").prepend('<div id="full-overlay"></div>');
2290            jQuery('#full-overlay').css('height', docHeight + 'px');
2291            event.preventDefault();
2292            jQuery('.lp-filter-pagination').hide();
2293            jQuery('#content-grids').html(' ');
2294            jQuery('.lp-filter-pagination-ajx').remove();
2295            //jQuery('#content-grids').addClass('content-loading');
2296            add_listing_skeletons();
2297            jQuery('.map-view-list-container').remove();
2298            var inexpensive = '';
2299            moderate = '';
2300            pricey = '';
2301            ultra = '';
2302            averageRate = '';
2303            mostRewvied = '';
2304            var listing_openTime = '';
2305            mostViewed = '';
2306
2307            inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
2308            moderate = jQuery('.currency-signs #two').find('.active').data('price');
2309            pricey = jQuery('.currency-signs #three').find('.active').data('price');
2310            ultra = jQuery('.currency-signs #four').find('.active').data('price');
2311
2312            if (!jQuery('body').hasClass('listing-app-view')) {
2313                mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
2314                averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
2315                mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
2316                listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
2317            } else {
2318                if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
2319                    averageRate = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
2320                }
2321                if (jQuery('.search-filter-attr input[type="checkbox"]#listingRate').hasClass('active')) {
2322                    mostRewvied = jQuery('.search-filter-attr input[type="checkbox"]#listingReviewed').val();
2323                }
2324            }
2325
2326            if (jQuery(this).hasClass("active")) {
2327                jQuery(this).parent('label').children('.app-filter-loader').addClass('app-filter-loader-active').show().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
2328                jQuery(this).attr('data-value', 'open');
2329                listing_openTime = 'open';
2330
2331            } else {
2332                jQuery(this).parent('label').children('.app-filter-loader').hide().html('<i class="fa fa-spinner" aria-hidden="true"></i>');
2333                jQuery(this).attr('data-value', 'close');
2334                listing_openTime = 'close';
2335            }
2336
2337            skeyword = jQuery('input#lp_current_query').val();
2338            skeyword = jQuery('input#lp_current_query').val();
2339            seracLoc = jQuery("#lp_search_loc").val();
2340        }
2341
2342        var tags_name = [];
2343        tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
2344            return jQuery(this).val();
2345        }).get();
2346
2347        if (tags_name.length > 0) { } else {
2348            if (jQuery('#check_featuretax').length > 0) {
2349                tags_name.push(jQuery('#check_featuretax').val());
2350            }
2351        }
2352
2353
2354
2355
2356
2357        var clatval = jQuery('#searchform input[name=clat]').val();
2358        var clongval = jQuery('#searchform input[name=clong]').val();
2359
2360        if (clatval && clongval) { } else {
2361            clatval = jQuery("#pac-input").attr('data-lat');
2362            clongval = jQuery("#pac-input").attr('data-lng');
2363        }
2364
2365        if (check_if_loc_disabled_fornearme()) {
2366            seracLoc = '';
2367        }
2368
2369        jQuery.ajax({
2370            type: 'POST',
2371            dataType: 'json',
2372            url: ajax_search_term_object.ajaxurl,
2373            data: {
2374                'action': 'ajax_search_tags',
2375                'formfields': $selectedFields,
2376                'inexpensive': inexpensive,
2377                'moderate': moderate,
2378                'pricey': pricey,
2379                'ultra': ultra,
2380                'averageRate': averageRate,
2381                'mostRewvied': mostRewvied,
2382                'mostviewed': mostViewed,
2383                'listing_openTime': listing_openTime,
2384                'lpstag': jQuery("#lpstag").val(),
2385                'tag_name': tags_name,
2386                'cat_id': jQuery("#searchform select#searchcategory").val(),
2387                'loc_id': seracLoc,
2388                'list_style': listStyle,
2389                'skeyword': skeyword,
2390                'clat': clatval,
2391                'clong': clongval,
2392                'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
2393                'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
2394                'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
2395                'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
2396                'data_zoom': jQuery('#pac-input').attr('data-zoom'),
2397                'distance_range': jQuery("#distance_range").val(),
2398                'lpNonce': jQuery('#lpNonce').val()
2399            },
2400            success: function (data) {
2401                jQuery('.app-filter-loader-active').html('<i class="fa fa-check-circle" aria-hidden="true"></i>');
2402                jQuery('#full-overlay').remove();
2403                if (data) {
2404                    remove_listing_skeletons();
2405                    listing_update(data, new_design_v2, listStyle);
2406                    lp_append_distance_div();
2407                    if (data.opentime != '') {
2408                        var timevalue = '';
2409                        timevalue = data.opentime;
2410                        /* if(timevalue=='open'){
2411                         jQuery('#content-grids .lp-grid-box-contianer .grid-closed:contains("Closed Now")') .closest( ".lp-grid-box-contianer" ).css('display','none');
2412                         }
2413                         if(timevalue=='close'){
2414                         jQuery('#content-grids .lp-grid-box-contianer .grid-closed:contains("Closed Now")') .closest( ".lp-grid-box-contianer" ).css('display','block');
2415                         } */
2416                        if (jQuery('.grid').hasClass('active')) {
2417                            jQuery('.grid').trigger('click');
2418                        } else if (jQuery('.list').hasClass('active')) {
2419                            jQuery('.list').trigger('click');
2420                        }
2421                    }
2422
2423
2424                    if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
2425                        jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
2426                    }
2427
2428
2429                }
2430            }
2431        });
2432
2433    });
2434    /* =====by zaheer on 13 march====== */
2435
2436    jQuery(document).on('click', '.add-to-fav', function (e) {
2437        e.preventDefault()
2438        $this = jQuery(this);
2439        $this.find('i').addClass('fa-spin fa-spinner');
2440        var val = jQuery(this).data('post-id');
2441        var type = jQuery(this).data('post-type');
2442        jQuery.ajax({
2443            type: 'POST',
2444            dataType: 'json',
2445            url: ajax_search_term_object.ajaxurl,
2446            data: {
2447                'action': 'listingpro_add_favorite',
2448                'post-id': val,
2449                'type': type,
2450                'lpNonce': jQuery('#lpNonce').val()
2451            },
2452            success: function (data) {
2453                if (data) {
2454                    if (data.active == 'yes') {
2455                        $this.removeClass('add-to-fav');
2456                        $this.addClass('remove-fav');
2457                        $this.find('i').removeClass('fa-spin fa-spinner');
2458                        $this.find('i').removeClass('fa-bookmark-o').addClass('fa-bookmark');
2459                        if (data.type == 'grids' || data.type == 'list') {
2460                            var successText = $this.data('success-text');
2461                            $this.find('span').text(successText);
2462                            //alert($this.find('i'));
2463                            $this.find('.fa-regular').removeClass('fa-regular').addClass('fa');
2464                        } else {
2465                            var successText = $this.data('success-text');
2466                            $this.find('span').text(successText);
2467                            $this.find('i').removeClass('fa-regular').addClass('fa');
2468                        }
2469                    }
2470                }
2471            }
2472        });
2473    });
2474
2475
2476    jQuery(document).on('click', '.remove-fav', function (e) {
2477        e.preventDefault()
2478        var val = jQuery(this).data('post-id');
2479        jQuery(this).find('i').removeClass('fa-close');
2480        jQuery(this).find('i').addClass('fa-spinner fa-spin');
2481        $this = jQuery(this);
2482        jQuery.ajax({
2483            type: 'POST',
2484            dataType: 'json',
2485            url: ajax_search_term_object.ajaxurl,
2486            data: {
2487                'action': 'listingpro_remove_favorite',
2488                'post-id': val,
2489                'lpNonce': jQuery('#lpNonce').val()
2490            },
2491            success: function (data) {
2492                if (data) {
2493                    if (data.remove == 'yes') {
2494                        $this.removeClass('remove-fav');
2495                        $this.find('span').text(data.remove_text);
2496                        $this.addClass('add-to-fav');
2497                        $this.find('.fa').removeClass('fa-spinner fa-spin');
2498                        $this.find('.fa').removeClass('fa-bookmark').addClass('fa-bookmark-o');
2499                        $this.find('.fa').removeClass('fa').addClass('fa-regular');
2500                        if (jQuery('.page-template-template-favourites').length != 0) {
2501                            $this.closest(".lp-grid-box-contianer").fadeOut();
2502                            $this.closest(".lp-listing-outer-container").fadeOut();
2503                        }
2504                    }
2505                }
2506            }
2507        });
2508
2509    });
2510
2511
2512
2513});
2514
2515/* for near me locations */
2516jQuery(document).ready(function ($) {
2517    jQuery('#lp-find-near-me a.near-me-btn, #lp-find-near-me a.near-me-btn-style-3, .lp-header-search-filters .near-me-filter').on('click', function (event) {
2518        $this = jQuery(this);
2519        $selectedFields = [];
2520        jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
2521            keyValuePair = {};
2522            keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
2523            $selectedFields.push(keyValuePair);
2524        });
2525        event.preventDefault();
2526        var docHeight = jQuery(document).height();
2527
2528        var clatval = '';
2529        var clongval = '';
2530
2531        var inexpensive = '';
2532        moderate = '';
2533        pricey = '';
2534        ultra = '';
2535        averageRate = '';
2536        mostRewvied = '';
2537        listing_openTime = '';
2538        mostViewed = '';
2539
2540
2541        if ($this.hasClass("active")) {
2542            showPositionResults('', '');
2543            jQuery('.lp-tooltip-div-hidden').removeClass('active');
2544        } else {
2545            getLocation();
2546        }
2547
2548        function getLocation() {
2549            if (navigator.geolocation) {
2550                navigator.geolocation.getCurrentPosition(showPosition, showError);
2551            } else {
2552                x.innerHTML = "Geolocation is not supported by this browser.";
2553            }
2554        }
2555
2556
2557        function showPosition(position) {
2558            var clat = position.coords.latitude;
2559            var clong = position.coords.longitude;
2560            jQuery('.lp-tooltip-div-hidden').addClass('active');
2561            showPositionResults(clat, clong);
2562        }
2563
2564        function showError(error) {
2565            //showPositionResults('', '');
2566            alert('Sorry! nearme will not work untill you share your location');
2567        }
2568
2569
2570        function showPositionResults(clat, clong) {
2571            $this.toggleClass("active");
2572            jQuery('#searchform input[name=clat]').val(clat);
2573            jQuery('#searchform input[name=clong]').val(clong);
2574            clatval = clat;
2575            clongval = clong;
2576
2577
2578            var new_design_v2 = false;
2579            var new_header_filters = false;
2580            var listStyle = '';
2581
2582            if (jQuery('#list-grid-view-v2').length != 0) {
2583                if (jQuery('#list-grid-view-v2').hasClass('header-style-v2')) {
2584                    var new_header_filters = true;
2585                }
2586                if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
2587                    listStyle = get_list_style();
2588                    new_design_v2 = true;
2589                }
2590            }
2591
2592            if (new_header_filters == true) {
2593                get_filters_before_send();
2594                var averageRate = get_filter_RRV('.filter-in-header .rated-filter.header-filter-wrap'),
2595                    mostRewvied = get_filter_RRV('.filter-in-header .reviewed-filter.header-filter-wrap'),
2596                    mostViewed = get_filter_RRV('.filter-in-header .viewed-filter.header-filter-wrap'),
2597                    inexpensive = get_price_range_vals('#filter-in-header .price-filter ul li#n-one'),
2598                    moderate = get_price_range_vals('#filter-in-header .price-filter ul li#n-two'),
2599                    pricey = get_price_range_vals('#filter-in-header .price-filter ul li#n-three'),
2600                    ultra = get_price_range_vals('#filter-in-header .price-filter ul li#n-four'),
2601                    listing_openTime = get_open_now_val('#filter-in-header .open-now-filter'),
2602                    listStyle = get_list_style(),
2603                    skeyword = jQuery('input#skeyword-filter').val();
2604                if (jQuery('#searchlocation').length != 0) {
2605                    seracLoc = jQuery("#searchlocation").val();
2606                }
2607                if ((seracLoc == '' || seracLoc == null || seracLoc == 'undefined') && jQuery('#lp_search_loc').length != 0) {
2608                    seracLoc = jQuery("#lp_search_loc").val();
2609                }
2610            } else {
2611                jQuery("body").prepend('<div id="full-overlay"></div>');
2612                jQuery('#full-overlay').css('height', docHeight + 'px');
2613
2614                jQuery('.lp-filter-pagination').hide();
2615                jQuery('.lp-filter-pagination-ajx').remove();
2616                jQuery('#content-grids').html(' ');
2617                //jQuery('#content-grids').addClass('content-loading');
2618                add_listing_skeletons();
2619                jQuery('.map-view-list-container').remove();
2620
2621                inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
2622                moderate = jQuery('.currency-signs #two').find('.active').data('price');
2623                pricey = jQuery('.currency-signs #three').find('.active').data('price');
2624                ultra = jQuery('.currency-signs #four').find('.active').data('price');
2625
2626                mostViewed = jQuery('.search-filters li#mostviewed').find('.active').data('value');
2627                averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
2628                mostRewvied = jQuery('.search-filters li.listingReviewed').find('.active').data('value');
2629                listing_openTime = jQuery('.search-filters li#listing_openTime, .search-filters li.listing_openTime').find('.active').data('time');
2630
2631                skeyword = jQuery('input#lp_current_query').val();
2632                seracLoc = jQuery("#lp_search_loc").val();
2633            }
2634
2635            var tags_name = [];
2636            tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
2637                return jQuery(this).val();
2638            }).get();
2639
2640            if (tags_name.length > 0) { } else {
2641                if (jQuery('#check_featuretax').length > 0) {
2642                    tags_name.push(jQuery('#check_featuretax').val());
2643                }
2644            }
2645
2646            seracLoc = jQuery("#lp_search_loc").val();
2647            if (check_if_loc_disabled_fornearme()) {
2648                seracLoc = '';
2649            }
2650
2651            jQuery.ajax({
2652                type: 'POST',
2653                dataType: 'json',
2654                url: ajax_search_term_object.ajaxurl,
2655                data: {
2656                    'action': 'ajax_search_tags',
2657                    'formfields': $selectedFields,
2658                    'lpstag': jQuery("#lpstag").val(),
2659                    'cat_id': jQuery("#searchform select#searchcategory").val(),
2660                    'loc_id': seracLoc,
2661                    'inexpensive': inexpensive,
2662                    'moderate': moderate,
2663                    'pricey': pricey,
2664                    'ultra': ultra,
2665                    'averageRate': averageRate,
2666                    'mostRewvied': mostRewvied,
2667                    'mostviewed': mostViewed,
2668                    'listing_openTime': listing_openTime,
2669                    'tag_name': tags_name,
2670                    'list_style': listStyle,
2671                    'skeyword': skeyword,
2672                    'clat': clatval,
2673                    'clong': clongval,
2674                    'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
2675                    'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
2676                    'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
2677                    'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
2678                    'data_zoom': jQuery('#pac-input').attr('data-zoom'),
2679                    'distance_range': jQuery("#distance_range").val(),
2680                    'lpNonce': jQuery('#lpNonce').val()
2681                },
2682                success: function (data) {
2683                    jQuery('#full-overlay').remove();
2684                    if (data) {
2685                        remove_listing_skeletons();
2686                        listing_update(data, new_design_v2, listStyle);
2687                        lp_append_distance_div();
2688                        if (jQuery('.grid').hasClass('active')) {
2689                            jQuery('.grid').trigger('click');
2690                        } else if (jQuery('.list').hasClass('active')) {
2691                            jQuery('.list').trigger('click');
2692                        }
2693
2694
2695                        if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
2696                            jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
2697                        }
2698
2699
2700                    }
2701                }
2702            });
2703
2704        }
2705
2706    });
2707
2708});
2709
2710function lp_append_distance_div() {
2711    if (jQuery(document).find('.lp-nearby-dist-data').length != 0) {
2712        jQuery(document).find(".lp-nearby-dist-data").each(function () {
2713            var $this = jQuery(this);
2714            disdata = $this.data('lpnearbydist');
2715            $this.next('.lp-grid-box-contianer').find('.lp-grid-box-bottom .pull-left').after('<div class="lp-nearest-distance">' + disdata + '</div>');
2716            $this.next('.lp-grid-box-contianer').find('.lp-grid-box-bottom-app-view .pull-left').after('<div class="lp-nearest-distance">' + disdata + '</div>');
2717            $this.next('.lp-grid-box-contianer.grid_view6').find('.lp-grid-box-thumb').append('<div class="lp-nearest-distance">' + disdata + '</div>');
2718            $this.next('.lp-grid-box-contianer').find('.grid-style-container .lp-listing-top,.list-style-cotainer .lp-listing-top').append('<div class="lp-nearest-distance">' + disdata + '</div>');
2719        });
2720    }
2721}
2722
2723
2724function decode_utf8(utf8String) {
2725    if (typeof utf8String != 'string') throw new TypeError('parameter ‘utf8String’ is not a string');
2726    // note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char!
2727    const unicodeString = utf8String.replace(
2728        /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars
2729        function (c) { // (note parentheses for precedence)
2730            var cc = ((c.charCodeAt(0) & 0x0f) << 12) | ((c.charCodeAt(1) & 0x3f) << 6) | (c.charCodeAt(2) & 0x3f);
2731            return String.fromCharCode(cc);
2732        }
2733    ).replace(
2734        /[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars
2735        function (c) { // (note parentheses for precedence)
2736            var cc = (c.charCodeAt(0) & 0x1f) << 6 | c.charCodeAt(1) & 0x3f;
2737            return String.fromCharCode(cc);
2738        }
2739    );
2740    return unicodeString;
2741}
2742
2743function listing_update(data, new_design_v2, listStyle) {
2744    //for search dynamic titles
2745    if (data.searchtitles != '') {
2746        //console.log(data.searchtitles);
2747        $countKeys = Object.keys(data.searchtitles).length;
2748
2749        jQuery('span.dyn_titles').remove();
2750
2751        if (ajax_search_term_object.resultfor) {
2752            var resultfor = ajax_search_term_object.resultfor;
2753            jQuery('.lp-title h3').html(resultfor + ' <span class="font-bold term-name"></span> <span class="font-bold lstring"></span>');
2754        }
2755
2756        if ($countKeys == 3) {
2757            //only single term
2758            if (data.searchtitles['category']) {
2759                document.title = data.searchtitles['category'] + ' - ' + data.searchtitles['website'];
2760                if (jQuery('.lp-header-search.archive-search h4.lp-title').length) {
2761                    jQuery('.lp-header-search.archive-search h4.lp-title').html(jQuery('h4.lp-title').data('rstring') + ' <strong class="term-name">' + data.searchtitles['category'] + '</strong> ' + jQuery('h4.lp-title').data('lstring'));
2762                } else {
2763                    var rstring = jQuery('.lp-title h3').data('rstring');
2764                    var lstring = jQuery('.lp-title h3').find('.lstring').text();
2765                    if (jQuery('body').hasClass('search')) {
2766                        jQuery('.lp-title h3').html(rstring + '<span class="dename"></span><span class="font-bold lstring"> ' + lstring + '</span>');
2767                    } else {
2768                        jQuery('.lp-title h3').find('.font-bold.term-name').text(data.searchtitles['category']);
2769                    }
2770                }
2771
2772            }
2773            if (data.searchtitles['location']) {
2774                document.title = data.searchtitles['location'] + ' - ' + data.searchtitles['website'];
2775                if (jQuery('.lp-header-search.archive-search h4.lp-title').length) {
2776                    jQuery('.lp-header-search.archive-search h4.lp-title').html(jQuery('h4.lp-title').data('rstring') + ' <strong class="term-name">' + data.searchtitles['location'] + '</strong>
2776 ' + jQuery('h4.lp-title').data('lstring'));
2777                } else {
2778                    jQuery('.lp-title h3').html('Results In <span class="font-bold term-name">' + data.searchtitles['location'] + '</span>');
2779                }
2780            }
2781
2782        }
2783        if ($countKeys == 5) {
2784            //cat and loc both terms
2785            document.title = data.searchtitles['category'] + ' ' + data.searchtitles['in'] + ' ' + data.searchtitles['location'] + ' - ' + data.searchtitles['website'];
2786
2787            if (jQuery('.lp-header-search.archive-search h4.lp-title').length) {
2788                jQuery('.lp-header-search.archive-search h4.lp-title').html(jQuery('h4.lp-title').data('rstring') + ' <strong class="term-name">' + data.searchtitles['category'] + '</strong> ' + data.searchtitles['in'] + ' <em>' + data.searchtitles['location'] + '</em>');
2789            } else {
2790                var rstring = jQuery('.lp-title h3').data('rstring');
2791                var lstring = jQuery('.lp-title h3').find('.lstring').text();
2792                jQuery('.lp-title h3').html(rstring + '<span class="font-bold lstring"> ' + lstring + '</span><span class="dename"> ' + data.searchtitles['in'] + ' ' + data.searchtitles['location'] + '</span>');
2793            }
2794
2795
2796        }
2797
2798    } else {
2799        if (ajax_search_term_object.noresult && ajax_search_term_object.listing) {
2800            var noresult = ajax_search_term_object.noresult;
2801            var listing = ajax_search_term_object.listing;
2802            jQuery('.lp-title h3').html(noresult + ' <span class="font-bold term-name"></span> <span class="font-bold lstring">' + listing + '</span>');
2803        }
2804    }
2805    jQuery('.outer_all_page_overflow').slideUp();
2806    var pars = decode_utf8(data.html);
2807    if (new_design_v2 == true) {
2808        if (listStyle == 'list') {
2809            listStyle = 'list-style';
2810        }
2811        if (listStyle == 'grid') {
2812            listStyle = 'grid-style';
2813        }
2814        var parsHtml = '<div class="lp-listings ' + listStyle + ' active-view"> ' +
2815            '<div class="search-filter-response"><div class="lp-listings-inner-wrap">' +
2816            pars +
2817            '<div class="clearfix"></div>' +
2818            '</div> ' +
2819            '</div>' +
2820            '</div>';
2821
2822        jQuery('#content-grids').hide();
2823        jQuery('#content-grids').html(parsHtml);
2824
2825        if (listStyle == 'grid-style') {
2826
2827            if (jQuery('.lp-sidebar').length != 0 || jQuery('.sidemap-fixed').length != 0) {
2828
2829                jQuery('.lp-listings-inner-wrap .loop-switch-class').removeClass('col-md-12').addClass('col-md-6');
2830
2831            } else {
2832
2833                jQuery('.lp-listings-inner-wrap .loop-switch-class').removeClass('col-md-12').addClass('col-md-4');
2834
2835            }
2836        }
2837
2838        if (listStyle == 'list-style') {
2839
2840            jQuery('.lp-listings-inner-wrap .loop-switch-class').removeClass('col-md-6').addClass('col-md-12');
2841
2842        }
2843
2844        jQuery('.loop-switch-class:last').find('.lp-listing').addClass('last');
2845
2846        //jQuery('#listing_found').html('<p>'+data.found+' '+data.foundtext+'</p>');
2847        jQuery('#content-grids').fadeIn('slow');
2848        remove_listing_skeletons();
2849        //jQuery('#content-grids').removeClass('content-loading');
2850        jQuery('.listing-app-view #content-grids').removeClass('content-loading');
2851        if (jQuery('.lp-countdown').length != 0) {
2852            jQuery('.lp-countdown').each(function (i, obj) {
2853                var selector = '#' + jQuery(this).attr('id');
2854                init_countdown(selector);
2855            })
2856        }
2857    } else {
2858        jQuery('#content-grids').hide();
2859        jQuery('#content-grids').html(pars);
2860
2861        //jQuery('#listing_found').html('<p>'+data.found+' '+data.foundtext+'</p>');
2862        jQuery('#content-grids').fadeIn('slow');
2863        remove_listing_skeletons();
2864        //jQuery('#content-grids').removeClass('content-loading');
2865        jQuery('.listing-app-view #content-grids').removeClass('content-loading');
2866    }
2867
2868
2869    var taxonomy = jQuery('section.taxonomy').attr('id');
2870
2871    if (taxonomy == 'location') {
2872        if (data.cat != '') {
2873            var CatName = data.cat;
2874            CatName = CatName.replace('&amp;', '&');
2875            jQuery('.filter-top-section .lp-title span.term-name').html(CatName + ' Listings <span style="font-weight:normal;"> In </span>');
2876            jQuery('.filter-top-section .lp-title span.font-bold:last-child').text(data.city);
2877            //window.history.pushState("Details", "Title", 'location/'+data.cat);
2878        }
2879
2880    } else if (taxonomy == 'listing-category') {
2881
2882        if (data.cat != '') {
2883            var CatName = data.cat;
2884            CatName = CatName.replace('&amp;', '&');
2885            jQuery('.filter-top-section .lp-title span.term-name').text(CatName);
2886            //window.history.pushState("Details", "Title", 'location/'+data.cat);
2887        } else {
2888            CatName = '';
2889            jQuery('.filter-top-section .lp-title span.term-name').text(CatName);
2890        }
2891
2892    } else if (taxonomy == 'features') {
2893        jQuery('.showbread').show();
2894        jQuery('.fst-term').html(data.tags);
2895        if (data.keyword != '') {
2896            jQuery('.s-term').html(',&nbsp;keyword&nbsp;"' + data.keyword + '"');
2897        } else {
2898            jQuery('.s-term').html(' ');
2899        }
2900        if (data.city != '') {
2901            if (data.cat != '') {
2902                jQuery('.sec-term').html('&amp;&nbsp;' + data.city);
2903            } else {
2904                jQuery('.sec-term').html(data.city);
2905            }
2906        } else {
2907            jQuery('.sec-term').html(' ');
2908        }
2909        if (data.tags != '') {
2910            jQuery('.tag-term').html(',&nbsp;tagged&nbsp;(' + data.tags + ')');
2911        }
2912        if (data.tags == null) {
2913            jQuery('.tag-term').html('');
2914        }
2915    } else if (taxonomy == 'keyword') {
2916        jQuery('.showbread').show();
2917        jQuery('.fst-term').html(data.cat);
2918        if (data.keyword != '') {
2919            jQuery('.s-term').html(',&nbsp;keyword&nbsp;"' + data.keyword + '"');
2920        } else {
2921            jQuery('.s-term').html(' ');
2922        }
2923        if (data.city != '') {
2924            if (data.cat != '') {
2925                jQuery('.sec-term').html('&amp;&nbsp;' + data.city);
2926            } else {
2927                jQuery('.sec-term').html(data.city);
2928            }
2929        } else {
2930            jQuery('.sec-term').html(' ');
2931        }
2932
2933        if (data.tags != '') {
2934            jQuery('.tag-term').html(',&nbsp;tagged&nbsp;(' + data.tags + ')');
2935        }
2936        if (data.tags == null) {
2937            jQuery('.tag-term').html('');
2938        }
2939    } else {
2940        if (data.cat != '') {
2941            var CatName = data.cat;
2942            CatName = CatName.replace('&amp;', '&');
2943            jQuery('.filter-top-section .lp-title span.term-name').text(CatName);
2944            //window.history.pushState("Details", "Title", 'location/'+data.cat);
2945        }
2946    }
2947
2948    if (jQuery(this).width() > 781) {
2949
2950        jQuery(".all-list-map").trigger('click');
2951
2952    }
2953
2954    // if (data.found > 0 && jQuery(window).width() < 781) {
2955
2956
2957    jQuery(".listing-app-view-bar .right-icons .map-view-icon").trigger('click');
2958
2959    jQuery(".open-app-view").trigger('click');
2960    //jQuery( ".qickpopup" ).trigger('click');
2961
2962    // }
2963
2964
2965
2966
2967    jQuery(".v2-map-load .v2mapwrap").trigger('click');
2968
2969
2970
2971
2972}
2973
2974/* for find near me filter */
2975
2976/* radiou filter code starts */
2977jQuery(document).ready(function () {
2978
2979    jQuery(document).on('click', '#distance_range_div', function () {
2980        jQuery('#pac-input').attr('data-zoom', '');
2981        listingproc_update_results();
2982    });
2983
2984    var change_Interval = 0;
2985    jQuery(document).on('change', '#distance_range', function () {
2986        clearInterval(change_Interval)
2987        change_Interval = setInterval(function () {
2988            jQuery('#pac-input').attr('data-zoom', '');
2989            listingproc_update_results();
2990            clearInterval(change_Interval)
2991        }, 1000);
2992    });
2993
2994    jQuery(document).on('input', '#distance_range_div .slider', function () {
2995        jQuery('#pac-input').attr('data-zoom', '');
2996        listingproc_update_results();
2997    });
2998
2999});
3000
3001
3002function listingproc_update_results() {
3003    $selectedFields = [];
3004    jQuery('.lp_extrafields_select :checked').each(function (i, selectedElement) {
3005        keyValuePair = {};
3006        keyValuePair[jQuery(selectedElement).data('key')] = jQuery(selectedElement).val();
3007        $selectedFields.push(keyValuePair);
3008    });
3009
3010    var new_design_v2 = false;
3011    var listStyle = '';
3012    if (jQuery('#list-grid-view-v2').length != 0) {
3013        if (jQuery('#list-grid-view-v2').hasClass('list_view_v2') || jQuery('#list-grid-view-v2').hasClass('grid_view_v2')) {
3014            new_design_v2 = true;
3015            listStyle = get_list_style();
3016        }
3017
3018    }
3019    var docHeight = jQuery(document).height();
3020    jQuery("body").prepend('<div id="full-overlay"></div>');
3021    jQuery('#full-overlay').css('height', docHeight + 'px');
3022    jQuery('#content-grids').html(' ');
3023    jQuery('.solitaire-infinite-scroll').remove();
3024    //jQuery('#content-grids').addClass('content-loading');
3025    add_listing_skeletons();
3026    jQuery('.map-view-list-container').remove();
3027    jQuery('.lp-filter-pagination-ajx').remove();
3028    var inexpensive = '';
3029    moderate = '';
3030    pricey = '';
3031    ultra = '';
3032    averageRate = '';
3033    mostRewvied = '';
3034    listing_openTime = '';
3035    mostViewed = '';
3036
3037    inexpensive = jQuery('.currency-signs #one').find('.active').data('price');
3038    moderate = jQuery('.currency-signs #two').find('.active').data('price');
3039    pricey = jQuery('.currency-signs #three').find('.active').data('price');
3040    ultra = jQuery('.currency-signs #four').find('.active').data('price');
3041
3042    skeyword = jQuery('input#lp_current_query').val();
3043
3044    averageRate = jQuery('.search-filters li#listingRate').find('.active').data('value');
3045    mostRewvied = jQuery('.search-filters li#listingReviewed').find('.active').data('value');
3046    listing_openTime = jQuery('.search-filters li.listing_openTime').find('.active').data('time');
3047
3048    var clatval = jQuery('#searchform input[name=clat]').val();
3049    var clongval = jQuery('#searchform input[name=clong]').val();
3050
3051    if (clatval && clongval) { } else {
3052        clatval = jQuery("#pac-input").attr('data-lat');
3053        clongval = jQuery("#pac-input").attr('data-lng');
3054    }
3055
3056    var tags_name = [];
3057    tags_name = jQuery('.tags-area input[type=checkbox]:checked').map(function () {
3058        return jQuery(this).val();
3059    }).get();
3060
3061    if (tags_name.length > 0) { } else {
3062        if (jQuery('#check_featuretax').length > 0) {
3063            tags_name.push(jQuery('#check_featuretax').val());
3064        }
3065    }
3066
3067    seracLoc = jQuery("#lp_search_loc").val();
3068    if (check_if_loc_disabled_fornearme()) {
3069        seracLoc = '';
3070    }
3071
3072    jQuery.ajax({
3073        type: 'POST',
3074        dataType: 'json',
3075        url: ajax_search_term_object.ajaxurl,
3076        data: {
3077            'action': 'ajax_search_tags',
3078            'formfields': $selectedFields,
3079            'lpstag': jQuery("#lpstag").val(),
3080            'cat_id': jQuery("#searchform select#searchcategory").val(),
3081            'loc_id': seracLoc,
3082            'sloc_address': jQuery("#pac-input").val(),
3083            'clat': clatval,
3084            'clong': clongval,
3085            'my_bounds_ne_lat': jQuery("#pac-input").attr('data-ne-lat'),
3086            'my_bounds_ne_lng': jQuery("#pac-input").attr('data-ne-lng'),
3087            'my_bounds_sw_lat': jQuery("#pac-input").attr('data-sw-lat'),
3088            'my_bounds_sw_lng': jQuery("#pac-input").attr('data-sw-lng'),
3089            'data_zoom': jQuery('#pac-input').attr('data-zoom'),
3090            'distance_range': jQuery("#distance_range").val(),
3091            'skeyword': skeyword,
3092            'inexpensive': inexpensive,
3093            'moderate': moderate,
3094            'pricey': pricey,
3095            'ultra': ultra,
3096            'averageRate': averageRate,
3097            'mostRewvied': mostRewvied,
3098            'listing_openTime': listing_openTime,
3099            'tag_name': tags_name,
3100            'list_style': listStyle,
3101            'lpNonce': jQuery('#lpNonce').val()
3102        },
3103        success: function (data) {
3104            jQuery('#full-overlay').remove();
3105            if (data) {
3106                listing_update(data, new_design_v2, listStyle);
3107                lp_append_distance_div();
3108                remove_listing_skeletons();
3109                if (jQuery('.grid').hasClass('active')) {
3110                    jQuery('.grid').trigger('click');
3111                } else if (jQuery('.list').hasClass('active')) {
3112                    jQuery('.list').trigger('click');
3113                }
3114
3115
3116                if (jQuery('.lp-filter-name.sidebar-filter-process').length > 0) {
3117                    jQuery('.lp-filter-name.sidebar-filter-process span:nth-child(2)').text(data.showingString);
3118                }
3119
3120
3121            }
3122        }
3123    });
3124}
3125
3126
3127function initialize() {
3128    if (jQuery('#pac-input').length) {
3129        var input = document.getElementById('pac-input');
3130        var autocomplete = new google.maps.places.Autocomplete(input);
3131        autocomplete.addListener('place_changed', function () {
3132            var place = autocomplete.getPlace();
3133
3134            jQuery('#pac-input').attr('data-zoom', '');
3135
3136            var loc_lat = place.geometry.location.lat();
3137            var loc_lng = place.geometry.location.lng();
3138
3139            jQuery('#pac-input').attr('data-lat', loc_lat);
3140            jQuery('#pac-input').attr('data-lng', loc_lng);
3141
3142            jQuery('#pac-input').attr('data-center-lat', place.geometry.viewport.getCenter().lat());
3143            jQuery('#pac-input').attr('data-center-lng', place.geometry.viewport.getCenter().lng());
3144
3145            jQuery('#pac-input').attr('data-ne-lat', place.geometry.viewport.getNorthEast().lat());
3146            jQuery('#pac-input').attr('data-ne-lng', place.geometry.viewport.getNorthEast().lng());
3147            jQuery('#pac-input').attr('data-sw-lat', place.geometry.viewport.getSouthWest
3147().lat());
3148            jQuery('#pac-input').attr('data-sw-lng', place.geometry.viewport.getSouthWest().lng());
3149
3150            listingproc_update_results();
3151        });
3152    }
3153}
3154
3155
3156function listingproc_get_radius(center_lat, center_lng, ne_lat, ne_lng) {
3157
3158    // r = radius of the earth in statute miles
3159    var r = 6371.0;
3160
3161    // Convert lat or lng from decimal degrees into radians (divide by 57.2958)
3162    var lat1 = center_lat / 57.2958;
3163    var lon1 = center_lng / 57.2958;
3164    var lat2 = ne_lat / 57.2958;
3165    var lon2 = ne_lng / 57.2958;
3166
3167    // distance = circle radius from center to Northeast corner of bounds
3168    return r * Math.acos(Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1));
3169
3170}
3171
3172
3173function getLocation() {
3174    if (navigator.geolocation) {
3175        navigator.geolocation.getCurrentPosition(initMap);
3176    }
3177} // getLocation
3178
3179
3180function initMap(position) {
3181    var geocoder = new google.maps.Geocoder();
3182    geocodeLatLng(geocoder, position.coords.latitude, position.coords.longitude);
3183} // initMap
3184
3185
3186function geocodeLatLng(geocoder, lat, lng) {
3187    var latlng = { lat: lat, lng: lng };
3188    geocoder.geocode({ 'location': latlng }, function (results, status) {
3189        if (status === 'OK') {
3190            if (results[1]) {
3191
3192                jQuery('#pac-input').attr('data-zoom', '');
3193
3194                jQuery('#pac-input').val(results[1].formatted_address);
3195                jQuery('#pac-input').attr('data-lat', lat);
3196                jQuery('#pac-input').attr('data-lng', lng);
3197                listingproc_update_results();
3198            }
3199        }
3200    });
3201} // geocodeLatLng
3202
3203
3204function listingproc_update_markers(map) {
3205    map.on('zoomend dragend', function () {
3206
3207        var bounds = map.getBounds();
3208        window.bounds = bounds;
3209
3210        console.log(window.bounds);
3211
3212        //jQuery( '#pac-input' ).val('');
3213
3214        jQuery('#pac-input').attr('data-zoom', 'yes');
3215
3216        jQuery('#pac-input').attr('data-ne-lat', bounds._northEast.lat);
3217        jQuery('#pac-input').attr('data-ne-lng', bounds._northEast.lng);
3218        jQuery('#pac-input').attr('data-sw-lat', bounds._southWest.lat);
3219        jQuery('#pac-input').attr('data-sw-lng', bounds._southWest.lng);
3220
3221        listingproc_update_results();
3222    });
3223} // listingproc_update_markers
3224
3225
3226var hasOwnProperty = Object.prototype.hasOwnProperty;
3227
3228function listingproc_isEmpty(obj) {
3229
3230    // null and undefined are "empty"
3231    if (obj == null) return true;
3232
3233    // Assume if it has a length property with a non-zero value
3234    // that that property is correct.
3235    if (obj.length > 0) return false;
3236    if (obj.length === 0) return true;
3237
3238    // If it isn't an object at this point
3239    // it is empty, but it can't be anything *but* empty
3240    // Is it empty?  Depends on your application.
3241    if (typeof obj !== "object") return true;
3242
3243    // Otherwise, does it have any properties of its own?
3244    // Note that this doesn't handle
3245    // toString and valueOf enumeration bugs in IE < 9
3246    for (var key in obj) {
3247        if (hasOwnProperty.call(obj, key)) return false;
3248    }
3249
3250    return true;
3251} // listingproc_isEmpty
3252
3253/* radiou filter code ends */
3254
3255/* new radius code  */
3256jQuery(document).ready(function ($) {
3257    jQuery('.lp-radus-filter-wrap li.lp-tooltip-outer .lp-distancesearchbtn').on('click', function () {
3258        $this = jQuery(this);
3259        $this.toggleClass('active');
3260        if ($this.hasClass('active')) {
3261            if (navigator.geolocation) {
3262                navigator.geolocation.getCurrentPosition(showPositionn);
3263            } else {
3264                alert("Geolocation is not supported by this browser.");
3265            }
3266
3267            function showPositionn(position) {
3268                var loc_lat = position.coords.latitude;
3269                var loc_lng = position.coords.longitude;
3270
3271                var myLatlng = new google.maps.LatLng(loc_lat, loc_lng);
3272                var mapProp = {
3273                    center: myLatlng,
3274                    zoom: 8,
3275                    mapTypeId: google.maps.MapTypeId.ROADMAP
3276                };
3277                var map = new google.maps.Map(document.getElementById("lp-hidden-map"), mapProp);
3278                var viewportBox;
3279                google.maps.event.addListener(map, 'idle', function (event) {
3280                    var bounds = map.getBounds();
3281                    var ne = bounds.getNorthEast();
3282                    var sw = bounds.getSouthWest();
3283
3284                    var viewportPoints = [
3285                        ne, new google.maps.LatLng(ne.lat(), sw.lng()),
3286                        sw, new google.maps.LatLng(sw.lat(), ne.lng()), ne
3287                    ];
3288                    if (viewportBox) {
3289                        viewportBox.setPath(viewportPoints);
3290                    } else {
3291                        viewportBox = new google.maps.Polyline({
3292                            path: viewportPoints,
3293                            strokeColor: '#FF0000',
3294                            strokeOpacity: 1.0,
3295                            strokeWeight: 4
3296                        });
3297                        viewportBox.setMap(map);
3298                    };
3299
3300
3301                    var geocoder = geocoder = new google.maps.Geocoder();
3302                    var faddress;
3303                    geocoder.geocode({ 'latLng': myLatlng }, function (results, status) {
3304                        if (status == google.maps.GeocoderStatus.OK) {
3305                            if (results[1]) {
3306                                faddress = results[1].formatted_address;
3307
3308                                jQuery('#pac-input').val(faddress);
3309
3310                                jQuery('#pac-input').attr('data-lat', loc_lat);
3311                                jQuery('#pac-input').attr('data-lng', loc_lng);
3312
3313                                jQuery('#pac-input').attr('data-ne-lat', ne.lat());
3314                                jQuery('#pac-input').attr('data-ne-lng', ne.lng());
3315                                jQuery('#pac-input').attr('data-sw-lat', sw.lat());
3316                                jQuery('#pac-input').attr('data-sw-lng', sw.lng());
3317
3318                                listingproc_update_results();
3319                            }
3320                        }
3321                    });
3322                });
3323
3324            }
3325        } else {
3326            jQuery('#pac-input').val('');
3327
3328            jQuery('#pac-input').attr('data-lat', '');
3329            jQuery('#pac-input').attr('data-lng', '');
3330
3331            jQuery('#pac-input').attr('data-center-lat', '');
3332            jQuery('#pac-input').attr('data-center-lng', '');
3333
3334            jQuery('#pac-input').attr('data-ne-lat', '');
3335            jQuery('#pac-input').attr('data-ne-lng', '');
3336            jQuery('#pac-input').attr('data-sw-lat', '');
3337            jQuery('#pac-input').attr('data-sw-lng', '');
3338            jQuery('#distance_range').val('');
3339
3340            listingproc_update_results();
3341        }
3342
3343    });
3344
3345    /* for search on inner pages */
3346    jQuery('input.lp-suggested-search').on('input', function () {
3347        jQuery('input#lp_s_cat').val('');
3348        jQuery('input#lp_s_tag').val('');
3349    });
3350});
3351/* end new radius code  */
3352
3353
3354
3355
3356function get_list_style() {
3357    var returnval = 'list';
3358    if (jQuery('.lp-listings.grid-style').hasClass('active-view')) {
3359        returnval = 'grid';
3360    }
3361    return returnval;
3362}
3363
3364function get_filters_before_send() {
3365    var docHeight = jQuery(document).height();
3366    jQuery("body").prepend('<div id="full-overlay"></div>');
3367    jQuery('#full-overlay').css('height', docHeight + 'px');
3368    jQuery('.lp-filter-pagination').hide();
3369    if (jQuery('.search-filter-response').length != 0) {
3370        jQuery('.search-filter-response').html(' ');
3371        //jQuery('.search-filter-response').addClass('content-loading');
3372        add_listing_skeletons();
3373    } else {
3374        jQuery('#content-grids').html(' ');
3375        //jQuery('#content-grids').addClass('content-loading');
3376        add_listing_skeletons();
3377    }
3378
3379
3380    jQuery('.lp-filter-pagination-ajx').remove();
3381    jQuery('.map-view-list-container').remove();
3382
3383}
3384
3385function add_listing_skeletons() {
3386    var $listStyle = get_list_style();
3387    if (jQuery('body').hasClass('listing-skeleton-view-list_view')) {
3388        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-list_view');
3389    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view')) {
3390        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view');
3391    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view2')) {
3392        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view2');
3393    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view3')) {
3394        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view3');
3395    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view_v2')) {
3396        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view_v2');
3397    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view_v3')) {
3398        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view_v3');
3399    } else if (jQuery('body').hasClass('listing-skeleton-view-list_view_v2')) {
3400        if ($listStyle == 'list') {
3401            jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-list_view_v2');
3402        } else {
3403            jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-grid_view_v2');
3404        }
3405    } else if (jQuery('body').hasClass('listing-skeleton-view-lp-list-view-compact')) {
3406        jQuery('#content-grids').addClass('content-loading-listing-skeleton-view-lp-list-view-compact');
3407    }
3408}
3409
3410function remove_listing_skeletons() {
3411    var $listStyle = get_list_style();
3412    if (jQuery('body').hasClass('listing-skeleton-view-list_view')) {
3413        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-list_view');
3414    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view')) {
3415        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view');
3416    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view2')) {
3417        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view2');
3418    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view3')) {
3419        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view3');
3420    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view_v2')) {
3421        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view_v2');
3422    } else if (jQuery('body').hasClass('listing-skeleton-view-grid_view_v3')) {
3423        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view_v3');
3424    } else if (jQuery('body').hasClass('listing-skeleton-view-list_view_v2')) {
3425        if ($listStyle == 'list') {
3426            jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-list_view_v2');
3427        } else {
3428            jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-grid_view_v2');
3429        }
3430    } else if (jQuery('body').hasClass('listing-skeleton-view-lp-list-view-compact')) {
3431        jQuery('#content-grids').removeClass('content-loading-listing-skeleton-view-lp-list-view-compact');
3432    }
3433}
3434
3435function get_filter_RRV(selector) {
3436    var $this = jQuery(selector);
3437    if ($this.hasClass('active')) {
3438        return $this.data('value');
3439    } else {
3440        jQuery('ul#select-lp-more-filter li').find('a').removeClass('active');
3441        return '';
3442    }
3443}
3444
3445function get_open_now_val(selector) {
3446    var $this = jQuery(selector),
3447        returnval = '';
3448
3449    if ($this.hasClass('active')) {
3450        returnval = 'open';
3451    }
3452
3453    return returnval;
3454}
3455
3456function get_price_range_vals(selector) {
3457    var $this = jQuery(selector);
3458    if ($this.hasClass('active')) {
3459        return $this.data('price');
3460    } else {
3461        return '';
3462    }
3463}
3464
3465jQuery(document).ready(function () {
3466    jQuery('.outer_filter_show_result_cancel #filter_result').on('click', function () {
3467        jQuery('.outer_all_page_overflow').hide(300);
3468    });
3469});
3470
3471/* for excluding location if on from theme option */
3472function check_if_loc_disabled_fornearme() {
3473    if (jQuery('body').data('locdisablefilter') == 'yes') {
3474        if (jQuery('.near-me-btn').hasClass('active')) {
3475            return true;
3476        } else {
3477            return false;
3478        }
3479
3480    } else {
3481        return false;
3482    }
3483}
3484
3485jQuery(document).on('click', '.lp-open-search-btn-icon', function (event) {
3486    if (jQuery('.lp-home-banner-contianer.lp-home-banner-with-loc').length > 0) {
3487        jQuery('.lp-home-banner-contianer.lp-home-banner-with-loc').toggle();
3488    } else if (jQuery('.listing-app-view.home .pos-relative .lp-home-banner-contianer').length > 0) {
3489        jQuery('.listing-app-view.home .pos-relative .lp-home-banner-contianer').slideToggle();
3490    }
3491});
3492
3493// classic mous out filter tooltip
3494jQuery(document).ready(function ($) {
3495    // Select the elements you want to target
3496    var $filterItems = $('.listing-classic-filters .lp-tooltip-outer');
3497    // Add 'active' class when hovering in
3498    $filterItems.on('mouseenter', function () {
3499        $(this).find('.lp-tooltip-div').addClass('active');
3500    });
3501    // Remove 'active' class when hovering out
3502    $filterItems.on('mouseleave', function () {
3503        $(this).find('.lp-tooltip-div').removeClass('active');
3504    });
3505    jQuery('.lp-search-bar .chosen-container .chosen-results').niceScroll();
3506
3507})

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.