PageSourceSearch

https://musajil.com/wp-content/themes/listingpro/assets/js/search-ajax.js?ver=6.8.11

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

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.