PageSourceSearch

https://www.termasfederacion.com/wp-content/themes/listingpro/assets/js/search-ajax.js

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

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.