PageSourceSearch

https://www.fingerlakes.com/wp-content/themes/listingpro/assets/js/main.js?ver=7.1.2

js fingerlakes.com collected 2026-10-02 07:34:14 UTC 202,563 bytes, 5,090 lines download raw bytes

1/* Main.js contains all main JS  */
2/*  Author : CrdioStudio Dev team */
3
4/*moin 31-03-017 strt*/
5jQuery.noConflict();
6
7jQuery(window).on('resize load live', function () {
8    jQuery(window).resize(function () {
9
10        if (jQuery(window).width() <= 768) {
11            jQuery('a.open-map-view').on('click', function (event) {
12                event.preventDefault();
13                jQuery('.sidemap-container').addClass('open-map');
14                jQuery('header').addClass('map-view-content');
15            });
16
17
18            jQuery('a.open-img-view').on('click', function (event) {
19                event.preventDefault();
20                jQuery('.sidemap-container').removeClass('open-map');
21                jQuery('header').removeClass('map-view-content');
22            });
23
24            if (jQuery('#wpadminbar').length > 0) {
25                jQuery('html body').css('margin-top', '-46px');
26            }
27        } else {
28            jQuery('.sidemap-container').removeClass('open-map');
29            if (jQuery('#wpadminbar').length > 0) {
30                jQuery('html body').css('margin-top', '0px');
31            }
32
33            jQuery('a.open-map-view').on('click', function (event) {
34                event.preventDefault();
35                jQuery('.sidemap-container').addClass('open-map');
36                jQuery('header').addClass('map-view-content');
37            });
38
39
40            jQuery('a.open-img-view').on('click', function (event) {
41                event.preventDefault();
42                jQuery('.sidemap-container').removeClass('open-map');
43                jQuery('header').removeClass('map-view-content');
44            });
45        }
46        if (jQuery(window).width() <= 480) {
47            jQuery('#more_filters').hide();
48        } else {
49            jQuery('#more_filters').show();
50        }
51
52    });
53});
54jQuery(document).ready(function () {
55
56    jQuery('.lp_cancel_notic').click(function (e) {
57
58        e.preventDefault();
59
60        jQuery('.lp_notification_wrapper').slideToggle(400);
61
62    })
63
64    jQuery('.claimformtrigger2').click(function () {
65        jQuery('header').addClass('lp-head-zindex');
66        var divHeight = jQuery('.leftside').height();
67        jQuery('.rightside').css('height', divHeight + 'px');
68    })
69
70    jQuery('.lp-click-zindex').click(function () {
71        jQuery('header').removeClass('lp-head-zindex');
72    });
73
74    jQuery('.lp-tagline-submit-tagline label input[type="checkbox"]').click(function (event) {
75        if (jQuery(this).prop("checked") == true) {
76            jQuery(".with-title-cond").fadeIn(700);
77
78        } else if (jQuery(this).prop("checked") == false) {
79            jQuery(".with-title-cond").fadeOut(700);
80
81        }
82    });
83
84    jQuery('.stickynavbar ul li').each(function (e) {
85        var tagetID = jQuery(this).find('a').attr('href');
86        if (jQuery(tagetID).length == 0) {
87            jQuery(this).remove();
88        }
89    });
90
91
92    // Search Top margin in map view
93    var hh = jQuery('header').outerHeight();
94    var ab = jQuery('.absolute');
95    ab.css('top', hh);
96
97
98    // Touch Behaviorr for Mobile devices
99    if (jQuery('.chosen-container').length > 0) {
100        jQuery('.chosen-container').on('touchstart', function (e) {
101            e.stopPropagation();
102            e.preventDefault();
103            // Trigger the mousedown event.
104            jQuery(this).trigger('mousedown');
105        });
106    }
107
108    jQuery('#see_filter').on('click', function (event) {
109        event.preventDefault();
110        var filter = jQuery('#more_filters');
111        jQuery(this).next('#more_filters').toggleClass('open_filter');
112        if (filter.hasClass('open_filter')) {
113            jQuery(this).next('#more_filters').slideDown(400);
114        } else {
115            jQuery(this).next('#more_filters').slideUp(400);
116        }
117
118    });
119
120
121});
122/*moin 31-03-017 ends*/
123
124/* by zaheer on 30 march */
125jQuery(document).ready(function ($) {
126    var loc = jQuery('.ui-widget').data('option');
127    var apiType = jQuery('#page').data('ipapi');
128
129    var currentlocationswitch = '1';
130
131    currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
132    if (currentlocationswitch == "0") {
133        loc = 'locationifoff';
134        jQuery('.lp-location-search .ui-widget > i').fadeOut('fast');
135    }
136
137    if (loc == 'yes') {
138        if ((jQuery('.form-group').is('.lp-location-search') || jQuery('.form-group').is('.lp-location-inner-search')) && (jQuery('body').is('.home') || jQuery('body').is('.app-view-home'))) {
139            if (apiType === "geo_ip_db") {
140                jQuery.getJSON('https://geolocation-db.com/json/geoip.php?jsonp=?')
141                    .done(function (location) {
142                        var c_loc = location.city;
143                        var lp_s_loc = c_loc;
144                        if (jQuery('#page').data('lpattern') == 'with_region') {
145                            c_loc = location.city + " " + location.state + ", " + location.country_name;
146                            lp_s_loc = location.city + " " + location.state;
147                        }
148                        //jQuery('.lp-home-sear-location').val(location.city);
149                        //jQuery(".chosen-select").val('').trigger('chosen:updated');
150                        jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
151                        jQuery('#searchlocation').find('#def_location').text(c_loc);
152                        jQuery('#searchlocation').find('#def_location').val(c_loc);
153                        jQuery('#cities').val(c_loc);
154                        jQuery('input[name=lp_s_loc]').val(lp_s_loc);
155                        // jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
156                        jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
157                        jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
158                        jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
159                    });
160            } else if (apiType === "ip_api") {
161                jQuery.get("https://ipapi.co/json", function (location) {
162                    var c_loc = location.city;
163                    var lp_s_loc = c_loc;
164                    if (jQuery('#page').data('lpattern') == 'with_region') {
165                        c_loc = location.city + " " + location.region_code + ", " + location.country_name;
166                        lp_s_loc = location.city + " " + location.region_code;
167                    }
168                    jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
169                    jQuery('#searchlocation').find('#def_location').text(c_loc);
170                    jQuery('#searchlocation').find('#def_location').val(c_loc);
171                    jQuery('#cities').val(c_loc);
172                    jQuery('input[name=lp_s_loc]').val(lp_s_loc);
173                    // jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
174                    jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
175                    jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
176                    jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
177                }, "json");
178            } else {
179                lpGetGpsLocName(function (lpgetcurrentcityvalue) {
180                    lpgpsclocation = lpgetcurrentcityvalue;
181                    jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
182                    jQuery('#searchlocation').find('#def_location').text(lpgpsclocation);
183                    jQuery('#searchlocation').find('#def_location').val(lpgpsclocation);
184                    jQuery('#cities').val(lpgpsclocation);
185                    jQuery('input[name=lp_s_loc]').val(lpgpsclocation);
186                    // jQuery(".select2-selection__rendered").attr("title",lpgpsclocation).text(lpgpsclocation);
187                    jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
188                    jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
189                    jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
190                });
191            }
192            jQuery('.chosen-select2').chosen({
193                disable_search: true
194            });
195            jQuery('.chosen-select1').chosen({
196                disable_search: true
197            });
198            jQuery('.chosen-select7').chosen({
199                disable_search: true
200            });
201            jQuery('.chosen-select5').chosen({
202                disable_search: true
203            });
204        }
205    } else if (loc == 'no') {
206        jQuery('.lp-location-search .ui-widget > i').on('click', function (event) {
207            event.preventDefault();
208            jQuery(this).addClass('fa-circle-o-notch fa-spin');
209            jQuery(this).removeClass('fa-crosshairs');
210            if (jQuery('.form-group').is('.lp-location-search')) {
211                if (apiType === "geo_ip_db") {
212                    jQuery.getJSON('https://geolocation-db.com/json/geoip.php?jsonp=?')
213                        .done(function (location) {
214                            //jQuery('.lp-home-sear-location').val(location.city);
215                            //jQuery(".chosen-select").val('').trigger('chosen:updated');
216                            jQuery('.chosen-single').addClass('remove-margin');
217                            jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
218
219                            if (location.city == null) {
220                            } else {
221                                jQuery('#select2-searchlocation-container').text(location.city);
222                                // jQuery('#searchlocation').find('#def_location').text(location.city);
223                                jQuery('#searchlocation').find('#def_location').val(location.city).text(location.city);
224                                jQuery('#cities').val(location.city);
225                                jQuery('input[name=lp_s_loc]').val(location.city);
226                                // jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
227                            }
228                            jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
229                            jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
230                            jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
231                        });
232                } else if (apiType === "ip_api") {
233                    jQuery.get("https://ipapi.co/json", function (location) {
234
235                        jQuery('.chosen-single').addClass('remove-margin');
236                        jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
237
238                        if (location.city == null) {
239                        } else {
240                            jQuery('#select2-searchlocation-container').text(location.city);
241                            // jQuery('#searchlocation').find('#def_location').text(location.city);
242                            jQuery('#searchlocation').find('#def_location').val(location.city).text(location.city);
243                            jQuery('#cities').val(location.city);
244                            jQuery('input[name=lp_s_loc]').val(location.city);
245                        }
246
247                        // jQuery(".select2-selection__rendered").attr("title",location.city).text(location.city);
248                        jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
249                        jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
250                        jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
251
252                    }, "json");
253                } else {
254                    lpGetGpsLocName(function (lpgetcurrentcityvalue) {
255                        lpgpsclocation = lpgetcurrentcityvalue;
256                        jQuery('.chosen-single').addClass('remove-margin');
257                        jQuery("#searchlocation").prop('disabled', true).trigger('chosen:updated');
258                        jQuery('#select2-searchlocation-container').text(lpgpsclocation);
259                        jQuery('#searchlocation').find('#def_location').val(lpgpsclocation).text(lpgpsclocation);
260                        jQuery('#cities').val(lpgpsclocation);
261                        jQuery('input[name=lp_s_loc]').val(lpgpsclocation);
262                        // jQuery(".select2-selection__rendered").attr("title",lpgpsclocation).text(lpgpsclocation);
263                        jQuery("#searchlocation").prop('disabled', false).trigger('chosen:updated');
264                        jQuery('.select2-selection__rendered').parent('.select2-selection').addClass('slide-right');
265                        jQuery('.lp-location-search .ui-widget > i').fadeOut('slow');
266                    });
267                }
268                jQuery('.chosen-select2').chosen({
269                    disable_search: true
270                });
271                jQuery('.chosen-select1').chosen({
272                    disable_search: true
273                });
274                jQuery('.chosen-select7').chosen({
275                    disable_search: true
276                });
277                jQuery('.chosen-select5').chosen({
278                    disable_search: true
279                });
280            }
281        });
282    }
283
284
285    jQuery('#lp-new-ad-compaignForm').on('submit', function (e) {
286        var $this = jQuery(this);
287        if ($this.data('type') == "adsperclick") {
288            totalPrice = jQuery('input[name="ads_price"]').val();
289            var spotlight = 0,
290                topos = 0,
291                sidebar = 0;
292            if ($this.find('#spotlightcmp').is(':checked')) {
293                spotlight = $this.find('#spotlightcmp').data('price');
294            }
295            if ($this.find('#camp-for-search').is(':checked')) {
296                topos = $this.find('#camp-for-search').data('price');
297            }
298            if ($this.find('#for-sidebar-camp').is(':checked')) {
299                sidebar = $this.find('#for-sidebar-camp').data('price');
300            }
301            var minbujet = spotlight + topos + sidebar;
302            if (totalPrice < minbujet) {
303                e.preventDefault();
304                e.stopPropagation();
305                alert($this.data('string') + ' ' + minbujet);
306                return false;
307            }
308        } else {
309            totalPrice = jQuery('input[name="ads_price"]').val();
310        }
311
312        method = jQuery('input[name="method"]:checked').val();
313        currency = $this.find('input[name="currency"]').val();
314        listing_id = jQuery('input[name=lp_ads_for_listing]').val();
315        listing_name = jQuery('input[name=lp_ads_title]').val();
316        taxRate = $this.find('input[name="taxprice"]').val();
317
318        if (listing_id === '' || method === '') {
319            alert(jQuery('input#ad-blank-errorMsg').val());
320            e.preventDefault();
321        } else if (method === 'stripe') {
322            currency = $this.data('paid_currency');
323            totalPrice = parseFloat(totalPrice) * 100;
324            totalPrice = parseFloat(totalPrice).toFixed();
325
326            handler.open({
327                name: listing_name,
328                description: "",
329                zipCode: true,
330                amount: totalPrice,
331                currency: currency
332            });
333            e.preventDefault();
334        } else if (method === '2checkout') {
335            var packages = [];
336            jQuery('input.checked_class[type="checkbox"]:checked').each(function () {
337                packages.push($this.data('package'));
338            });
339            jQuery('#myCCForm #tprice').val(totalPrice);
340            jQuery('#myCCForm #listing_id_2check').val(listing_id);
341            jQuery('#myCCForm #packages').val(packages);
342            jQuery('#myCCForm #taxprice').val($this.find('input[name="taxprice"]').val());
343            jQuery("button.lp-2checkout-modal2").trigger('click');
344            e.preventDefault();
345        }
346
347    });
348});
349/* end by zaheer on 30 march */
350
351jQuery(window).on('load', function () {
352
353
354    jQuery('.lp-suggested-search').on('click', function (event) {
355
356        jQuery("#input-dropdown").niceScroll({
357            cursorcolor: "#363F48",
358            cursoropacitymax: 1,
359            boxzoom: false,
360            cursorwidth: "10px",
361            cursorborderradius: "0px",
362            cursorborder: "0px solid #fff",
363            touchbehavior: true,
364            preventmultitouchscrolling: false,
365            cursordragontouch: true,
366            background: "#f7f7f7",
367            horizrailenabled: false,
368            autohidemode: false,
369            zindex: "999999",
370        });
371
372    });
373
374
375    // Notices Box Script
376    jQuery('.notice a.close').on('click', function (event) {
377        event.preventDefault();
378        jQuery(this).parent('.notice').fadeOut('slow');
379    });
380
381    jQuery('.lp-header-full-width .lp-menu-bar .header-filter, .lp-menu-bar .header-filter.pos-relative.form-group').css('display', 'block');
382
383    var logoH = jQuery('.lp-logo').outerHeight();
384    var acHgt = jQuery('.header-right-panel.clearfix');
385    var a = parseInt(logoH + 10);
386    var b = jQuery('.header-right-panel').height();
387    var c = a - b;
388    var d = c / 2;
389    //alert(b);
390    acHgt.css({'padding-top': d + 'px'});
391
392    jQuery('.rating-symbol:nth-child(1)').hover(function () {
393        jQuery('.review.angry').css({
394            'opacity': '1',
395            'visibility': 'visible',
396        });
397    }, function () {
398        jQuery('.review.angry').css({
399            'opacity': '0',
400            'visibility': 'hidden',
401        });
402    });
403    jQuery('.rating-symbol:nth-child(2)').hover(function () {
404        jQuery('.review.cry').css({
405            'opacity': '1',
406            'visibility': 'visible',
407        });
408    }, function () {
409        jQuery('.review.cry').css({
410            'opacity': '0',
411            'visibility': 'hidden',
412        });
413    });
414    jQuery('.rating-symbol:nth-child(3)').hover(function () {
415        jQuery('.review.sleeping').css({
416            'opacity': '1',
417            'visibility': 'visible',
418        });
419    }, function () {
420        jQuery('.review.sleeping').css({
421            'opacity': '0',
422            'visibility': 'hidden',
423        });
424    });
425    jQuery('.rating-symbol:nth-child(4)').hover(function () {
426        jQuery('.review.smily').css({
427            'opacity': '1',
428            'visibility': 'visible',
429        });
430    }, function () {
431        jQuery('.review.smily').css({
432            'opacity': '0',
433            'visibility': 'hidden',
434        });
435    });
436    jQuery('.rating-symbol:nth-child(5)').hover(function () {
437        jQuery('.review.cool').css({
438            'opacity': '1',
439            'visibility': 'visible',
440        });
441    }, function () {
442        jQuery('.review.cool').css({
443            'opacity': '0',
444            'visibility': 'hidden',
445        });
446    });
447
448
449    var rtngSym = jQuery('.rating-symbol');
450    var rtngTip = jQuery('input.rating-tooltip');
451
452
453    jQuery('.rating-symbol:first-of-type').hover(function () {
454        jQuery(this).closest('span').addClass('active-stars-wrap');
455        jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#de9147');
456    }, function () {
457        jQuery('.active-stars-wrap').removeClass('active-stars-wrap');
458    });
459    jQuery('.rating-symbol:nth-of-type(2)').hover(function () {
460        jQuery(this).closest('span').addClass('active-stars-wrap');
461        jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#de9147');
462        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#de9147');
463    }, function () {
464        jQuery('.active-stars-wrap').removeClass('active-stars-wrap');
465    });
466    jQuery('.rating-symbol:nth-of-type(3)').hover(function () {
467        jQuery(this).closest('span').addClass('active-stars-wrap');
468        jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#dec435');
469        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#dec435');
470        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#dec435');
471    }, function () {
472        jQuery('.active-stars-wrap').removeClass('active-stars-wrap');
473    });
474    jQuery('.rating-symbol:nth-of-type(4)').hover(function () {
475        jQuery(this).closest('span').addClass('active-stars-wrap');
476        jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#c5de35');
477        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#c5de35');
478        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#c5de35');
479        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(4) .rating-symbol-foreground span').css('color', '#c5de35');
480    }, function () {
481        jQuery('.active-stars-wrap').removeClass('active-stars-wrap');
482    });
483    jQuery('.rating-symbol:nth-of-type(5)').hover(function () {
484        jQuery(this).closest('span').addClass('active-stars-wrap');
485        jQuery('.active-stars-wrap .rating-symbol:first-of-type .rating-symbol-foreground span').css('color', '#73cf42');
486        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(2) .rating-symbol-foreground span').css('color', '#73cf42');
487        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(3) .rating-symbol-foreground span').css('color', '#73cf42');
488        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(4) .rating-symbol-foreground span').css('color', '#73cf42');
489        jQuery('.active-stars-wrap .rating-symbol:nth-of-type(5) .rating-symbol-foreground span').css('color', '#73cf42');
490    }, function () {
491        jQuery('.active-stars-wrap').removeClass('active-stars-wrap');
492    });
493
494
495    rtngSym.on('click', function (event) {
496        event.preventDefault();
497        var thsVal = jQuery('input.rating-tooltip').val();
498
499        //alert(thsVal);
500        if (thsVal == 1) {
501            jQuery('.review.angry').addClass('visible');
502            jQuery('.rating-symbol:first-of-type').addClass('angry');
503            jQuery('.rating-symbol').removeClass('cry');
504            jQuery('.rating-symbol').removeClass('sleeping');
505            jQuery('.rating-symbol').removeClass('smily');
506            jQuery('.rating-symbol').removeClass('cool');
507        } else {
508            jQuery('.review.angry').removeClass('visible');
509        }
510
511
512        if (thsVal == 2) {
513            jQuery('.review.cry').addClass('visible');
514            jQuery('.rating-symbol:first-of-type').addClass('cry');
515            jQuery('.rating-symbol:nth-of-type(2)').addClass('cry');
516            jQuery('.rating-symbol').removeClass('angry');
517            jQuery('.rating-symbol').removeClass('sleeping');
518            jQuery('.rating-symbol').removeClass('smily');
519            jQuery('.rating-symbol').removeClass('cool');
520        } else {
521            jQuery('.review.cry').removeClass('visible');
522        }
523
524
525        if (thsVal == 3) {
526            jQuery('.review.sleeping').addClass('visible');
527            jQuery('.rating-symbol:first-of-type').addClass('sleeping');
528            jQuery('.rating-symbol:nth-of-type(2)').addClass('sleeping');
529            jQuery('.rating-symbol:nth-of-type(3)').addClass('sleeping');
530            jQuery('.rating-symbol').removeClass('angry');
531            jQuery('.rating-symbol').removeClass('cry');
532            jQuery('.rating-symbol').removeClass('smily');
533            jQuery('.rating-symbol').removeClass('cool');
534        } else {
535            jQuery('.review.sleeping').removeClass('visible');
536        }
537
538
539        if (thsVal == 4) {
540            jQuery('.review.smily').addClass('visible');
541            jQuery('.rating-symbol:first-of-type').addClass('smily');
542            jQuery('.rating-symbol:nth-of-type(2)').addClass('smily');
543            jQuery('.rating-symbol:nth-of-type(3)').addClass('smily');
544            jQuery('.rating-symbol:nth-of-type(4)').addClass('smily');
545            jQuery('.rating-symbol').removeClass('angry');
546            jQuery('.rating-symbol').removeClass('cry');
547            jQuery('.rating-symbol').removeClass('sleeping');
548            jQuery('.rating-symbol').removeClass('cool');
549        } else {
550            jQuery('.review.smily').removeClass('visible');
551        }
552
553
554        if (thsVal == 5) {
555            jQuery('.review.cool').addClass('visible');
556            jQuery('.rating-symbol:first-of-type').addClass('cool');
557            jQuery('.rating-symbol:nth-of-type(2)').addClass('cool');
558            jQuery('.rating-symbol:nth-of-type(3)').addClass('cool');
559            jQuery('.rating-symbol:nth-of-type(4)').addClass('cool');
560            jQuery('.rating-symbol:nth-of-type(5)').addClass('cool');
561            jQuery('.rating-symbol').removeClass('angry');
562            jQuery('.rating-symbol').removeClass('cry');
563            jQuery('.rating-symbol').removeClass('sleeping');
564            jQuery('.rating-symbol').removeClass('smily');
565        } else {
566            jQuery('.review.cool').removeClass('visible');
567        }
568
569
570        var CheckMultiRatingState = jQuery('#rewies_form').data('multi-rating');
571        var ratingSumTotal = 0;
572        if (CheckMultiRatingState == 1) {
573            var activeRatingLength = jQuery('.lp-multi-rating-val').length;
574            jQuery('.lp-multi-rating-val').each(function (index) {
575                ratingSumTotal += Number(jQuery(this).val());
576            })
577            var activeRatingClass = Math.round(ratingSumTotal / activeRatingLength);
578
579            jQuery('.lp-review-stars').removeClass(function (index, css) {
580                return (css.match(/\bactive-rating-avg\S+/g) || []).join(' ');
581            });
582            jQuery('.lp-review-stars').addClass('active-rating-avg' + activeRatingClass);
583
584            jQuery('.lp-review-stars i.fa:nth-child(' + Number(activeRatingClass + 1) + ')').removeClass('fa-star-o').addClass('fa-star');
585            jQuery('.lp-review-stars i.fa:nth-child(' + Number(activeRatingClass + 1) + ')').prevAll('.fa-star-o').removeClass('fa-star-o').addClass('fa-star');
586            jQuery('.lp-review-stars i.fa:nth-child(' + Number(activeRatingClass + 1) + ')').nextAll('.fa-star').removeClass('fa-star-o').addClass('fa-star-o');
587
588        }
589    });
590});
591
592var siteurl = jQuery('#page').data('site-url');
593var sitelogo = jQuery('#page').data('sitelogo');
594var $menu = jQuery("#menu");
595if ($menu.length > 0) {
596    $menu.css('visibility', 'visible');
597    $menu.mmenu({
598        "extensions": [
599            "pagedim-black"
600        ],
601        "iconPanels": true,
602        navbar: {
603            title: ""
604        },
605        navbars: {
606            height: 3,
607            content: [
608                '<a href="' + siteurl + '" class="userimage"><img class="icon icons8-Contacts" src="' + sitelogo + '" alt="user"></a>',
609            ]
610        }
611    });
612    jQuery('div#menu').removeClass('menu-height-0');
613    var API = $menu.data("mmenu");
614    jQuery(".lpl-button.md-trigger, .sign-login-wrap .md-trigger,.lpl-button.app-view-popup-style").click(function () {
615        API.close();
616    });
617}
618
619jQuery(document).on('click', '.footer-btn-right.map-view-btn, .v2-map-load .v2mapwrap, .listing-app-view-bar .right-icons a, .sidemap-fixed .sidemarpInside', function (e) {
620    if (jQuery('#map').is('.mapSidebar')) {
621
622        var defmaplat = jQuery('body').data('defaultmaplat');
623        var defmaplong = jQuery('body').data('defaultmaplot');
624        jQuery('.map-pop').empty();
625        jQuery('.map-pop').html('<div class="mapSidebar" id="map"></div>');
626        var map = null;
627        $mtoken = jQuery('#page').data("mtoken");
628        $mtype = jQuery('#page').data("mtype");
629        $mapboxDesign = jQuery('#page').data("mstyle");
630
631        if ($mtoken !== '' && $mtype === 'mapbox') {
632
633            L.mapbox.accessToken = $mtoken;
634            map = L.mapbox.map('map')
635                .setView([defmaplat, defmaplong], 2);
636            L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
637                maxZoom: 18,
638                id: jQuery('#page').data("mstyle"),
639                accessToken: jQuery('#page').data("mtoken")
640            }).addTo(map);
641
642            var markers = new L.MarkerClusterGroup();
643            initializeMap(markers);
644            map.fitBounds(markers.getBounds(), {padding: [50, 50]});
645            jQuery(document).on('click', '.open-map-view', function () {
646                L.Util.requestAnimFrame(map.invalidateSize, map, !1, map._container);
647            });
648
649        } else {
650
651            var map = new L.Map('map', {
652                minZoom: 3,
653            }).setView(new L.LatLng(defmaplat, defmaplong), 6);
654            if ($mtype == 'google') {
655                L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}', {
656                    maxZoom: 6,
657                    subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
658                    noWrap: true,
659                });
660                var googleLayer = new L.Google('ROADMAP');
661                map.addLayer(googleLayer);
662
663            } else {
664                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
665            }
666
667            var markers = new L.MarkerClusterGroup();
668            var resmarkers = initializeMap(markers);
669            if (typeof resmarkers === 'undefined') {
670            } else {
671                map.fitBounds(markers.getBounds(), {padding: [50, 50]});
672                map.scrollWheelZoom.enable();
673                map.invalidateSize();
674                map.dragging.enable();
675                jQuery(document).on('click', '.open-map-view', function () {
676                    L.Util.requestAnimFrame(map.invalidateSize, map, !1, map._container);
677                });
678            }
679
680
681        }
682
683        function initializeMap(markers) {
684
685            if (jQuery('.lp-grid-box-contianer').length != 0) {
686                markers.clearLayers();
687                jQuery(".lp-grid-box-contianer").each(function (i) {
688
689                    var LPtitle = jQuery(this).data("title");
690                    var LPposturl = jQuery(this).data("posturl");
691                    var LPlattitue = jQuery(this).data("lattitue");
692                    var LPlongitute = jQuery(this).data("longitute");
693                    var LPpostid = jQuery(this).data("postid");
694                    var LPiconSrc = '';
695
696                    if (jQuery('.v2-map-load').length == 1) {
697                        if (jQuery('.v2-map-load').hasClass('v2_map_load_old')) {
698                            var LPaddress = jQuery(this).find('.gaddress').text();
699                            var LPimageSrc = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
700                            if (typeof jQuery("body").data('deficon') !== 'undefined') {
701                                // your code here
702                                LPiconSrc = jQuery("body").data('deficon');
703                            } else {
704                                LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
705                            }
706                        } else {
707                            var LPaddress = jQuery(this).find('.lp-listing-location').find('a').text();
708                            var LPimageSrc = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
709
710                            if (typeof jQuery("body").data('deficon') !== 'undefined') {
711                                // your code here
712                                LPiconSrc = jQuery("body").data('deficon');
713                            } else {
714                                LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
715                            }
716                        }
717                    } else if (jQuery('.lp-compact-view-outer').length > 0) {
718                        var LPaddress = jQuery(this).find('.lp_list_address').text();
719                        var LPimageSrc = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
720                        var LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
721                        if (typeof jQuery("body").data('deficon') !== 'undefined') {
722                            LPiconSrc = jQuery("body").data('deficon');
723                        }
724                    } else {
725                        var LPaddress = jQuery(this).find('.gaddress').text();
726                        var LPimageSrc = jQuery(this).find('.listing-app-view-new-wrap').find('img').attr('src');
727                        if (LPimageSrc === undefined) {
728                            LPimageSrc = jQuery(this).data('feaimg');
729                        }
730                        if (LPimageSrc === undefined) {
731                            if (jQuery('.lp-grid-box-thumb .show-img').length > 0) {
732                                LPimageSrc = jQuery(this).find('.lp-grid-box-thumb .show-img img').attr('src');
733                            } else {
734                                LPimageSrc = jQuery(this).find('.lp-grid-box-thumb .show img').attr('src');
735                            }
736                        }
737                        if (typeof jQuery("body").data('deficon') !== 'undefined') {
738                            // your code here
739                            LPiconSrc = jQuery("body").data('deficon');
740                        } else {
741                            LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
742                        }
743                    }
744                    if (LPlattitue != '' && LPlongitute != '') {
745
746                        var LPimage = '';
747                        if (LPimageSrc != '') {
748                            LPimage = LPimageSrc;
749                        }
750
751                        var LPicon = '';
752                        if (LPiconSrc != '') {
753                            LPicon = LPiconSrc;
754                        }
755
756                        var markerLocation = new L.LatLng(LPlattitue, LPlongitute); // London
757
758                        var CustomHtmlIcon = L.divIcon({
759                            html: "<div class='lpmap-icon-shape pin card" + LPpostid + "'><div class='lpmap-icon-contianer'><img alt='image' src='" + LPicon + "' /></div></div>",
760                        });
761
762                        var marker = new L.Marker(markerLocation, {icon: CustomHtmlIcon}).bindPopup('<div class="map-post"><div class="map-post-thumb"><a target="_blank" href="' + LPposturl + '"><img alt="image" src="' + LPimage + '" ></a></div><div class="map-post-des"><div class="map-post-title"><h5><a target="_blank" href="' + LPposturl + '">' + LPtitle + '</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> ' + LPaddress + '</p></div></div></div>').addTo(map);
763                        markers.addLayer(marker);
764                        map.addLayer(markers);
765
766                    }
767
768                });
769                return true;
770            }
771        }
772
773    }
774});
775jQuery(document).ready(function () {
776    'use-strict';
777    // Disable next button
778    var checkdInput = jQuery('.checkboxx input.checked_class');
779    checkdInput.on('change', function (event) {
780        event.preventDefault();
781        if (checkdInput.is(':checked')) {
782            jQuery('a#lp-next').css('display', 'block');
783            jQuery('a#lp-next').removeClass('hide');
784            jQuery('span.show').removeClass('show');
785            jQuery('.promotional-section > .lp-face.lp-pay-options.lp-dash-sec > span').addClass('hide');
786        } else {
787            jQuery('a#lp-next').addClass('hide');
788            jQuery('.promotional-section > .lp-face.lp-pay-options.lp-dash-sec > span').addClass('show');
789        }
790
791    });
792
793    var rdoInput = jQuery('.lp-method-wrap input.radio_checked');
794    rdoInput.on('change', function (event) {
795        event.preventDefault();
796        if (rdoInput.is(':checked')) {
797            jQuery('input.lp-next2.promotebtn').css('display', 'block');
798            jQuery('input.lp-next2.promotebtn').removeClass('hide');
799            jQuery('.promotional-section span.proceed-btn').removeClass('show');
800            jQuery('.promotional-section span.proceed-btn').addClass('hide');
801        } else {
802            jQuery('input.lp-next2.promotebtn').addClass('hide');
803            jQuery('.promotional-section span.proceed-btn').addClass('show');
804        }
805
806
807    });
808
809    //Dashboard promotional script
810    jQuery('.promotional-section a.lp-submit-btn').on('click', function (event) {
811        event.preventDefault();
812        jQuery(this).parent('.promotional-section').slideUp(500);
813        jQuery(this).parent('.promotional-section').next('.lp-card > form#ads_promotion').slideDown(1000);
814    });
815
816    // Dashboard Left Panel Script
817
818    var dash = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown > a');
819
820    var dashli = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown');
821
822    var dashul = jQuery('.dashboard-tabs.lp-main-tabs.text-center > ul > li.dropdown > ul');
823
824
825    dash.on('click', function (event) {
826
827        event.preventDefault();
828
829        if (dashli.hasClass('opened')) {
830
831            jQuery(dashli).removeClass('opened');
832
833            jQuery(dashul).removeClass('opened');
834
835            jQuery(this).parent('li').addClass('opened');
836
837            jQuery(this).next('ul').addClass('opened');
838
839        } else {
840
841            //if(dashli.hasClass('dropdown'))
842
843            jQuery(dashul).removeClass('opened');
844
845            jQuery(dashli).removeClass('opened');
846
847            jQuery(this).parent('li').addClass('opened');
848
849            jQuery(this).next('ul').addClass('opened');
850
851
852        }
853
854
855    });
856
857
858    // Review Script
859    jQuery('h3#reply-title').on('click', function (event) {
860        event.preventDefault();
861        var thiss = jQuery(this);
862        if (thiss.hasClass('active')) {
863            jQuery(this).removeClass('active');
864            jQuery(this).next('#rewies_form').slideUp();
865            jQuery(this).next('#rewies_formm').slideUp();
866        } else {
867            jQuery(this).addClass('active');
868            jQuery(this).next('#rewies_form').slideDown();
869            jQuery(this).next('#rewies_formm').slideDown();
870        }
871
872        //jQuery(this).next('#rewies_form').toggleClass('open_review_form');
873    });
874    jQuery('#clicktoreview').on('click', function (event) {
875        event.preventDefault();
876
877        var thiss = jQuery('#reply-title');
878        thiss.addClass('active');
879        thiss.next('#rewies_form').slideDown();
880        thiss.next('#rewies_formm').slideDown();
881        jQuery('html, body').animate({
882            scrollTop: jQuery('#reply-title').offset().top
883        }, 2000);
884    });
885
886    jQuery('.leadformtrigger').on('click', function (e) {
887        e.preventDefault();
888        jQuery('.app-view-lead-form').slideToggle(500);
889
890    });
891    jQuery('.open-lead-form-app-view').on('click', function (e) {
892        if (jQuery('.app-view-lead-form')[0]) {
893            jQuery('.app-view-lead-form').slideToggle(500);
894            jQuery('html, body').animate({
895                scrollTop: jQuery('.leadformtrigger').offset().top
896            }, 2000);
897        }
898
899    })
900
901    jQuery('#rewies_form input[type=file]').change(function (e) {
902        $in = jQuery(this);
903        $in.prev().prev().text($in.val());
904
905    });
906    // listing layout
907    //jQuery('.listing-simple').addClass('listing_list_view');
908    jQuery('a.grid').on('click', function (event) {
909        event.preventDefault();
910        jQuery('a.list').removeClass('active');
911        jQuery(this).addClass('active');
912        jQuery('.listing-simple').removeClass('listing_list_view');
913
914        if (jQuery('#list-grid-view-v2').length != 0 && jQuery('#list-grid-view-v2').hasClass('swtch-ll')) {
915            jQuery('#list-grid-view-v2').attr('data-layout-class', 'grid');
916        }
917
918        if (jQuery('#content-grids').hasClass('v2-toggle')) {
919            jQuery('.loop-switch-class').removeClass('col-md-12');
920            jQuery('.loop-switch-class').addClass('col-md-6');
921            jQuery('.lp-listings.active-view').removeClass('list-style');
922            jQuery('.lp-listings.active-view').addClass('grid-style');
923        } else {
924            jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
925            jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
926
927            // Listing Simple
928            if (jQuery('#content-grids').hasClass('listing-with-header-filters-wrap')) {
929                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
930                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
931            } else {
932                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
933                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-4 col-sm-12 grid_view2');
934            }
935
936            // Listing Sidebar
937            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-sm-12 list_view');
938            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-md-6 col-sm-12 grid_view2');
939
940        }
941
942        // Listing with Map
943    });
944    jQuery('a.list').on('click', function (event) {
945        event.preventDefault();
946        jQuery('a.grid').removeClass('active');
947        jQuery(this).addClass('active');
948        jQuery('.listing-simple').addClass('listing_list_view');
949
950        if (jQuery('#list-grid-view-v2').length != 0 && jQuery('#list-grid-view-v2').hasClass('swtch-ll')) {
951            jQuery('#list-grid-view-v2').attr('data-layout-class', 'list');
952        }
953
954        if (jQuery('#content-grids').hasClass('v2-toggle')) {
955            jQuery('.loop-switch-class').removeClass('col-md-6');
956            jQuery('.loop-switch-class').addClass('col-md-12');
957            jQuery('.lp-listings.active-view').addClass('list-style');
958            jQuery('.lp-listings.active-view').removeClass('grid-style');
959        } else {
960            // Listing with Map
961            jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view2');
962            jQuery('.post-with-map-container').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
963
964            // Listing Simple
965            if (jQuery('#content-grids').hasClass('listing-with-header-filters-wrap')) {
966                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view2');
967                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
968            } else {
969                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-4 col-sm-6 grid_view2');
970                jQuery('.listing-simple').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
971            }
972
973            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').removeClass('col-md-6 col-sm-6 grid_view3');
974            jQuery('.listing-with-sidebar').find('.lp-grid-box-contianer.card1.lp-grid-box-contianer1').addClass('col-sm-12 list_view');
975        }
976
977    });
978
979    //============================================ Harry Code ==================================================//
980    // Open Hours Script
981    jQuery('a.show-all-timings').on('click', function (event) {
982        event.preventDefault();
983        jQuery(this).toggleClass('opened');
984        jQuery(this).next('ul.hidding-timings').slideToggle(400);
985    });
986
987    // shebi Script
988    jQuery(".detail-page2-tab-content .review-form h3").removeAttr("id");
989
990    jQuery('.listing-app-view .listing-app-view-bar .pricy-form-group #lp-find-near-me-outer ul > li > a').click(function () {
991        jQuery(this).toggleClass('margin-right-0 lp-remove-border');
992    });
993
994
995    var inputs = document.querySelectorAll('.inputfile');
996    Array.prototype.forEach.call(inputs, function (input) {
997        var label = input.nextElementSibling,
998            labelVal = label.innerHTML;
999
1000        input.addEventListener('change', function (e) {
1001            var fileName = '';
1002            if (this.files && this.files.length > 1)
1003                fileName = (this.getAttribute('data-multiple-caption') || '').replace('{count}', this.files.length);
1004            else
1005                fileName = e.target.value.split('\\').pop();
1006
1007            if (fileName)
1008                label.querySelector('span').innerHTML = fileName;
1009            else
1010                label.innerHTML = labelVal;
1011        });
1012
1013        // Firefox bug fix
1014        input.addEventListener('focus', function () {
1015            input.classList.add('has-focus');
1016        });
1017        input.addEventListener('blur', function () {
1018            input.classList.remove('has-focus');
1019        });
1020    });
1021
1022    /* from sheibi */
1023
1024    if (jQuery('body').hasClass('home') || jQuery('body').hasClass('app-view-home')) {
1025        jQuery('.listing-app-view.home .map-view-list-container2,.listing-app-view.app-view-home .map-view-list-container2').slick({
1026            centerMode: false,
1027            centerPadding: '0px',
1028            infinite: true,
1029            accesibility: false,
1030            draggable: true,
1031            swipe: true,
1032            touchMove: false,
1033            autoplaySpeed: 1400,
1034            speed: 100,
1035            slidesToShow: 2,
1036            dots: true,
1037            arrows: false
1038        });
1039
1040        jQuery('.listing-app-view.home .lp-location-slider,.listing-app-view.app-view-home .lp-location-slider').slick({
1041            centerMode: false,
1042            centerPadding: '0px',
1043            infinite: true,
1044            accesibility: false,
1045            draggable: true,
1046            swipe: true,
1047            touchMove: false,
1048            autoplaySpeed: 1400,
1049            speed: 100,
1050            slidesToShow: 3,
1051            dots: true,
1052            arrows: false
1053        });
1054    }
1055    if (jQuery('.listing-category-slider4').length > 0) {
1056        jQuery('.listing-category-slider4').slick({
1057            centerMode: false,
1058            centerPadding: '0px',
1059            infinite: true,
1060            accesibility: false,
1061            draggable: true,
1062            swipe: true,
1063            touchMove: false,
1064            autoplaySpeed: 1400,
1065            speed: 100,
1066            slidesToShow: 4,
1067            dots: false,
1068            arrows: true,
1069            responsive: [{
1070                breakpoint: 768,
1071                settings: {
1072                    arrows: false,
1073                    centerMode: false,
1074                    centerPadding: '0px',
1075                    slidesToShow: 4
1076                }
1077            },
1078                {
1079                    breakpoint: 480,
1080                    settings: {
1081                        arrows: false,
1082                        centerMode: false,
1083                        centerPadding: '0px',
1084                        slidesToShow: 1
1085                    }
1086                }
1087            ]
1088        });
1089    }
1090
1091
1092    jQuery('#map-view-icon2').click(function () {
1093        jQuery("#search-filter-attr-filter").animate({width: "toggle"}, 5);
1094    });
1095
1096    jQuery('.listing-app-view .lp-search-toggle .user-menu').click(function (e) {
1097
1098        jQuery(".lp-user-menu").toggleClass("main");
1099
1100    });
1101
1102    jQuery(document).mouseup(function (e) {
1103        var container = jQuery(".lp-user-menu");
1104        if (!container.is(e.target) && container.has(e.target).length === 0) {
1105            jQuery('.lp-user-menu').removeClass('main');
1106        }
1107    });
1108    jQuery('.lp-detail-page-template-3 #clicktoreview2').on('click', function (event) {
1109        event.preventDefault();
1110        jQuery(".single-tabber2 ul li").removeClass('active');
1111        jQuery(".detail-page2-tab-content .tab-content .tab-pane").removeClass('active');
1112        jQuery('.single-tabber2 ul .lpreviews').addClass('active');
1113        jQuery('.detail-page2-tab-content .tab-content .lpreviews').addClass('active');
1114
1115        jQuery('html, body').animate({
1116            scrollTop: jQuery('#review-section').offset().top
1117        }, 200);
1118
1119
1120    });
1121    // end shoaib Script
1122
1123    jQuery('[data-toggle="tooltip"]').tooltip();
1124
1125    // Open review reply
1126    jQuery('a.see_more_btn').on('click', function (event) {
1127        event.preventDefault();
1128        var $this = jQuery(this);
1129        if ($this.hasClass('closedd')) {
1130            $this.removeClass('closedd');
1131            $this.addClass('openedd');
1132            jQuery(this).find('i').removeClass('fa-arrow-down');
1133            jQuery(this).find('i').addClass('fa-arrow-up');
1134
1135        } else {
1136            $this.removeClass('openedd');
1137            $this.addClass('closedd');
1138            jQuery(this).find('i').removeClass('fa-arrow-up');
1139            jQuery(this).find('i').addClass('fa-arrow-down');
1140
1141        }
1142        jQuery(this).next('.review-content').slideToggle(200);
1143    });
1144
1145
1146    jQuery('a.open-reply').on('click', function (event) {
1147        event.preventDefault();
1148        var $this = jQuery(this);
1149        if ($this.hasClass('closeddd')) {
1150            $this.removeClass('closeddd');
1151            $this.addClass('openeddd');
1152            jQuery(this).find('i').removeClass('fa-arrow-down');
1153            jQuery(this).find('i').addClass('fa-arrow-up');
1154
1155        } else {
1156            $this.removeClass('openeddd');
1157            $this.addClass('closeddd');
1158            jQuery(this).find('i').removeClass('fa-arrow-up');
1159            jQuery(this).find('i').addClass('fa-arrow-down');
1160
1161        }
1162        jQuery(this).next('.post_response').slideToggle(200);
1163    });
1164
1165
1166    jQuery(document).ready(function () {
1167        jQuery('select.hours-start2').prop("disabled", true);
1168        jQuery('select.hours-end2').prop("disabled", true);
1169        jQuery(".lp-check-doubletime .enable2ndday").change(function () {
1170            if (this.checked) {
1171                jQuery('select.hours-start2').prop("disabled", false);
1172                jQuery('select.hours-end2').prop("disabled", false);
1173                jQuery('.hours-select.lp-slot2-time').slideToggle(300);
1174            } else {
1175                jQuery('select.hours-start2').prop("disabled", true);
1176                jQuery('select.hours-end2').prop("disabled", true);
1177                jQuery('.hours-select.lp-slot2-time').slideToggle(300);
1178            }
1179        });
1180    });
1181
1182
1183    // Remove Hours Script
1184
1185    jQuery(document).on('click', 'a.remove-hours', function (event) {
1186        event.preventDefault();
1187        jQuery(this).parent('.hours').remove();
1188    });
1189    // Toggle Script for Currency area
1190    jQuery('a.toggle-currencey-area').on('click', function (event) {
1191        event.preventDefault();
1192        jQuery(this).next('.currency-area').slideToggle(400);
1193        jQuery(this).toggleClass('active');
1194    });
1195    // Magnific Popup
1196    jQuery('.review-img-slider').magnificPopup({
1197        delegate: 'a',
1198        type: 'image',
1199        tLoading: 'Loading image #%curr%...',
1200        mainClass: 'mfp-img-mobile',
1201        gallery: {
1202            enabled: true,
1203            navigateByImgClick: true,
1204            preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
1205        },
1206        image: {
1207            tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
1208            titleSrc: function (item) {
1209                return item.el.attr('title') + '<small>by Listingpro team</small>';
1210            }
1211        }
1212
1213
1214    });
1215
1216    jQuery(document).ready(function () {
1217        jQuery(".fulldayopen").change(function () {
1218            if (this.checked) {
1219                jQuery('select.hours-start').prop("disabled", true);
1220                jQuery('select.hours-end').prop("disabled", true);
1221                jQuery('select.hours-start2').prop("disabled", true);
1222                jQuery('select.hours-end2').prop("disabled", true);
1223            } else {
1224                jQuery('select.hours-start').prop("disabled", false);
1225                jQuery('select.hours-end').prop("disabled", false);
1226                jQuery('select.hours-start2').prop("disabled", false);
1227                jQuery('select.hours-end2').prop("disabled", false);
1228            }
1229        });
1230    });
1231
1232    jQuery(document).ready(function () {
1233        jQuery(".add-more").click(function () {
1234            jQuery("#lp_feature_panel").slideToggle("slow");
1235        });
1236
1237
1238    });
1239    var hdrHeight = jQuery('header.header-normal').outerHeight();
1240
1241    jQuery('.top-section .absolute').css('top', hdrHeight);
1242
1243
1244    if (jQuery('body').is('.single-listing')) {
1245        if (jQuery(window).width() >= 768) {
1246            // Listing Detail Gallery
1247            jQuery("a[rel^='prettyPhoto']").prettyPhoto({
1248                animation_speed: 'fast',
1249                theme: 'dark_rounded',
1250                slideshow: 7000,
1251                autoplay_slideshow: true,
1252                social_tools: '',
1253                deeplinking: false,
1254                show_title: false,
1255            });
1256        } else {
1257            jQuery("a[rel^='prettyPhoto']").prettyPhoto({
1258                animation_speed: 'fast',
1259                theme: 'dark_rounded',
1260                slideshow: 7000,
1261                autoplay_slideshow: true,
1262                social_tools: '',
1263                deeplinking: false,
1264                show_title: false,
1265            });
1266        }
1267    }
1268
1269
1270    jQuery('a.onlineform').on('click', function (event) {
1271        event.preventDefault();
1272        jQuery(this).next('.booking-form').slideToggle(400);
1273        jQuery(this).toggleClass('active');
1274    });
1275
1276    jQuery('.listing-second-view .ask-question-area > a.ask_question_popup').on('click', function (event) {
1277        event.preventDefault();
1278        jQuery(this).next('.faq-form').slideToggle(400);
1279    });
1280
1281    if (jQuery('body').is('.single-listing')) {
1282        var sliderstyle = jQuery('body').data('sliderstyle');
1283
1284        if (sliderstyle == "style1") {
1285            var images = jQuery(".listing-slide").data('images-num');
1286            var center_mode = true;
1287            if (images > 5) {
1288                images = 5;
1289                center_mode = true;
1290            } else {
1291                center_mode = false;
1292            }
1293            // Listing Detail Slider
1294            jQuery('.listing-slide').slick({
1295                centerPadding: '10px',
1296                slidesToShow: images,
1297                autoplay: true,
1298                draggable: false,
1299                autoplaySpeed: 5000,
1300                centerMode: center_mode,
1301                focusOnSelect: true,
1302                arrows: true,
1303                responsive: [{
1304                    breakpoint: 768,
1305                    settings: {
1306                        arrows: false,
1307                        centerMode: false,
1308                        centerPadding: '0px',
1309                        slidesToShow: 5
1310                    }
1311                },
1312                    {
1313                        breakpoint: 480,
1314                        settings: {
1315                            arrows: true,
1316                            centerMode: false,
1317                            centerPadding: '0px',
1318                            slidesToShow: 1
1319                        }
1320                    }
1321                ]
1322            });
1323        } else if (sliderstyle == "style2") {
1324
1325            var images = jQuery(".listing-slide").data('images-num');
1326            //alert(images);
1327            var center_mode = true;
1328            var variable = true;
1329            if (images > 3) {
1330                center_mode = false;
1331            } else if (images = 3) {
1332                //jQuery('.listing-slide img').css('height','auto');
1333                jQuery('.single-page-slider-container').addClass('three-imgs');
1334                variable = false;
1335            } else if (images = 2) {
1336                jQuery('.single-page-slider-container').addClass('new-cls');
1337            } else if (images = 1) {
1338                jQuery('.single-page-slider-container').addClass('one-img');
1339            } else {
1340                center_mode = false;
1341                variable = false;
1342            }
1343
1344            // Listing Detail Slider
1345            jQuery('.listing-slide').slick({
1346                slidesToShow: 2,
1347                autoplay: true,
1348                draggable: false,
1349                autoplaySpeed: 5000,
1350                centerMode: true,
1351                focusOnSelect: true,
1352                variableWidth: variable,
1353                adaptiveHeight: true,
1354                responsive: [{
1355                    breakpoint: 768,
1356                    settings: {
1357                        arrows: true,
1358                        centerMode: false,
1359                        centerPadding: '0px',
1360                        //slidesToShow: 5
1361                    }
1362                },
1363                    {
1364                        breakpoint: 480,
1365                        settings: {
1366                            arrows: true,
1367                            centerMode: false,
1368                            centerPadding: '0px',
1369                            slidesToShow: 1
1370                        }
1371                    }
1372                ]
1373            });
1374
1375        } else if (sliderstyle == "style3") {
1376
1377            var images = jQuery(".listing-slide").data('images-num');
1378            var slidestoshow = 2;
1379            if (images == 1) {
1380                jQuery('.listing-slide img').css('width', '100%');
1381                slidestoshow = 1;
1382            } else if (images == 2) {
1383                slidestoshow = 2;
1384            } else if (images == 3) {
1385                slidestoshow = 2;
1386            } else if (images == 4) {
1387                slidestoshow = 3;
1388            } else if (images == 6) {
1389                slidestoshow = 4;
1390            } else if (images == 8) {
1391                slidestoshow = 6;
1392            } else if (images == 10) {
1393                slidestoshow = 8;
1394            } else if (images >= 12) {
1395                slidestoshow = 10;
1396            }
1397
1398            // Listing Detail Slider
1399            jQuery('.listing-slide').slick({
1400                slidesToShow: 2,
1401                autoplay: true,
1402                draggable: false,
1403                autoplaySpeed: 5000,
1404                centerMode: true,
1405                focusOnSelect: true,
1406                variableWidth: true,
1407                adaptiveHeight: true,
1408                responsive: [{
1409                    breakpoint: 9999,
1410                    settings: {
1411                        slidesToShow: slidestoshow,
1412                    }
1413                },
1414                    {
1415                        breakpoint: 768,
1416                        settings: {
1417                            arrows: true,
1418                            centerMode: false,
1419                            centerPadding: '0px',
1420                            //slidesToShow: 5
1421                        }
1422                    },
1423                    {
1424                        breakpoint: 480,
1425                        settings: {
1426                            arrows: true,
1427                            centerMode: false,
1428                            centerPadding: '0px',
1429                            slidesToShow: 1
1430                        }
1431                    }
1432                ]
1433            });
1434        }
1435    }
1436
1437    // Listing Detail Slider
1438    if (jQuery('.listing-slide2').length != 0) {
1439        jQuery('.listing-slide2').slick({
1440            slidesToShow: 1,
1441            autoplay: false,
1442            draggable: false,
1443            autoplaySpeed: 5000,
1444            centerMode: true,
1445            centerPadding: '0px',
1446            focusOnSelect: true,
1447            variableWidth: variable,
1448            adaptiveHeight: true,
1449            responsive: [{
1450                breakpoint: 768,
1451                settings: {
1452                    arrows: true,
1453                    centerMode: false,
1454                    centerPadding: '0px',
1455                    //slidesToShow: 5
1456                }
1457            },
1458                {
1459                    breakpoint: 480,
1460                    settings: {
1461                        arrows: false,
1462                        centerMode: false,
1463                        centerPadding: '0px',
1464                        slidesToShow: 1
1465                    }
1466                }
1467            ]
1468        })
1469    }
1470
1471    jQuery(".select2").select2();
1472
1473    if (jQuery('body').is('.single-listing')) {
1474        jQuery('.review-img-slider').slick({
1475            infinite: true,
1476            slidesToShow: 3,
1477            slidesToScroll: 1,
1478            autoplay: false,
1479            autoplaySpeed: 5000,
1480            arrows: true,
1481            dots: false,
1482            responsive: [{
1483                breakpoint: 790,
1484                settings: {
1485                    arrows: false,
1486                    centerMode: true,
1487                    centerPadding: '40px',
1488                    slidesToShow: 2
1489                }
1490            },
1491                {
1492                    breakpoint: 480,
1493                    settings: {
1494                        slidesToShow: 1
1495                    }
1496                }
1497            ]
1498        });
1499        /* end  by haroon */
1500
1501        jQuery('.post-slide').slick({
1502            infinite: true,
1503            slidesToShow: 2,
1504            slidesToScroll: 1,
1505            arrows: false,
1506            dots: true,
1507            responsive: [{
1508                breakpoint: 2,
1509                settings: {
1510                    arrows: false,
1511                    centerMode: true,
1512                    centerPadding: '40px',
1513                    slidesToShow: 3
1514                }
1515            },
1516                {
1517                    breakpoint: 480,
1518                    settings: {
1519                        slidesToShow: 1
1520                    }
1521                }
1522            ]
1523        });
1524
1525        //Slick One Per Slide Testimonials
1526        jQuery('.testimonial-slider').slick({
1527            dots: true,
1528            infinite: true,
1529            autoplay: true,
1530            autoplaySpeed: 1000,
1531            speed: 1000,
1532            arrows: false,
1533            slidesToShow: 1
1534        });
1535    }
1536    // Accordion
1537    var icons = {
1538        header: "fa fa-plus",
1539        activeHeader: "fa fa-minus"
1540    };
1541    jQuery("#accordion").accordion({
1542        icons: icons,
1543        heightStyle: "content",
1544    });
1545    jQuery("#toggle").button().on('click', function () {
1546        if (jQuery("#accordion").accordion("option", "icons")) {
1547            jQuery("#accordion").accordion("option", "icons", null);
1548        } else {
1549            jQuery("#accordion").accordion("option", "icons", icons);
1550        }
1551    });
1552    // Popup Gallery
1553    jQuery('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
1554        disableOn: 319,
1555        type: 'iframe',
1556        iframe: {
1557            markup: '<div class="mfp-iframe-scaler">' +
1558                '<div class="mfp-close"></div>' +
1559                '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
1560                '</div>',
1561            patterns: {
1562                youtube: {
1563                    index: 'youtube.com/',
1564                    id: 'v=',
1565                    src: '//www.youtube.com/embed/%id%?rel=0&autoplay=1'
1566                }
1567            },
1568            srcAction: 'iframe_src',
1569        },
1570        mainClass: 'mfp-fade',
1571        removalDelay: 160,
1572        preloader: false,
1573        fixedContentPos: false
1574    });
1575
1576    jQuery('.popup-gallery').magnificPopup({
1577        delegate: '.image-popup',
1578        type: 'image',
1579        tLoading: 'Loading image #%curr%...',
1580        mainClass: 'mfp-img-mobile',
1581        gallery: {
1582            enabled: true,
1583            navigateByImgClick: true,
1584            preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
1585        }
1586    });
1587    //Boostrap Rating
1588    //http://dreyescat.github.io/bootstrap-rating/
1589    jQuery('input.check').on('change', function () {
1590        alert('Rating: ' + jQuery(this).val());
1591    });
1592    if (jQuery('body').is('.single-listing')) {
1593        jQuery('#programmatically-set').on('click', function () {
1594            jQuery('#programmatically-rating').rating('rate', jQuery('#programmatically-value').val());
1595        });
1596        jQuery('#programmatically-get').on('click', function () {
1597            alert(jQuery('#programmatically-rating').rating('rate'));
1598        });
1599
1600        jQuery('.rating-tooltip-manual').rating({
1601            extendSymbol: function () {
1602                var title;
1603                jQuery(this).tooltip({
1604                    container: 'body',
1605                    placement: 'bottom',
1606                    trigger: 'manual',
1607                    title: function () {
1608                        return title;
1609                    }
1610                });
1611                jQuery(this).on('rating.rateenter', function (e, rate) {
1612                    title = rate;
1613                    jQuery(this).tooltip('show');
1614                })
1615                    .on('rating.rateleave', function () {
1616                        jQuery(this).tooltip('hide');
1617                    });
1618            }
1619        });
1620        jQuery('.rating').each(function () {
1621            jQuery('<span class="label label-default"></span>')
1622                .text(jQuery(this).val() || ' ')
1623                .insertAfter(this);
1624        });
1625        jQuery('.rating').on('change', function () {
1626            jQuery(this).next('.label').text(jQuery(this).val());
1627        });
1628    }
1629    // Mapbox
1630
1631})
1632jQuery(window).on('load', function () {
1633
1634    if (jQuery(this).width() < 981) {
1635        jQuery(".claimformtrigger").on('click', function () {
1636            if (jQuery('.claimform').hasClass('claimform-open')) {
1637                jQuery('.claimform').removeClass("claimform-open");
1638                jQuery('.claimform').hide();
1639            } else {
1640                jQuery(this).closest('.post-row').addClass('rowopen');
1641                jQuery('.claimform').addClass("claimform-open");
1642                jQuery('.claimform').show();
1643            }
1644        });
1645    }
1646
1647    jQuery(window).resize(function () {
1648
1649        if (jQuery(this).width() < 781) {
1650            jQuery('.mobilemap').removeAttr('id');
1651            jQuery('.mobilemap').removeClass('md-modal');
1652            jQuery('.mobilemap').removeClass('md-effect-3');
1653            jQuery('.mobilelink').removeClass('md-trigger');
1654            jQuery('.mobile-map-space .md-overlayi').removeClass('md-overlay');
1655            jQuery('.listing-container-right .md-overlayi').removeClass('md-overlay');
1656            jQuery(".mobilelink").on('click', function () {
1657                if (jQuery('.mobilemap').hasClass('map-open')) {
1658                    jQuery('.mobilemap').removeClass("map-open");
1659                    jQuery('.mobilemap .mapbilemap-content').css({"opacity": "0", "margin-top": "-520px"});
1660                    jQuery("a.mobilelink").text("View on map");
1661                } else {
1662                    jQuery('.mobilemap').addClass("map-open");
1663                    jQuery('.mobilemap .mapbilemap-content').css({"opacity": "1", "margin-top": "0p
1663x"});
1664                    jQuery("a.mobilelink").text("Close map");
1665                }
1666            });
1667            jQuery(".quickformtrigger").on('click', function () {
1668                if (jQuery('.quickform').hasClass('quickform-open')) {
1669                    jQuery('.quickform').removeClass("quickform-open");
1670                    jQuery('.quickform').slideUp(600);
1671
1672                } else {
1673                    jQuery('.quickform').addClass("quickform-open");
1674                    jQuery('.quickform').slideDown(600);
1675                }
1676            });
1677        } else {
1678            var headertop = jQuery('header').height();
1679            jQuery('.section-fixed').css('padding-top', headertop + 'px');
1680
1681        }
1682
1683    }).resize(); //triggcurrentColorer the event manually when the page is loaded
1684
1685    jQuery('.listing-sidebar-left .form-inline').fadeTo(600, 1);
1686    jQuery('.post-with-map-container .form-inline').fadeTo(600, 1);
1687    jQuery('.spinner').css("display", "none");
1688    //jQuery('.single-page-slider-container').css("opacity","1");
1689
1690
1691    /*
1692     * L.TileLayer is used for standard xyz-numbered tile layers.
1693     */
1694
1695
1696    L.Google = L.Class.extend({
1697        includes: L.Mixin.Events,
1698
1699        options: {
1700            minZoom: 0,
1701            maxZoom: 18,
1702            tileSize: 256,
1703            subdomains: 'abc',
1704            errorTileUrl: '',
1705            attribution: '',
1706            opacity: 1,
1707            continuousWorld: false,
1708            noWrap: false,
1709            mapOptions: {
1710                backgroundColor: '#dddddd'
1711            }
1712        },
1713
1714        // Possible types: SATELLITE, ROADMAP, HYBRID, TERRAIN
1715        initialize: function (type, options) {
1716            L.Util.setOptions(this, options);
1717
1718            this._ready = google.maps.Map != undefined;
1719            if (!this._ready)
1720                L.Google.asyncWait.push(this);
1721
1722            this._type = type || 'SATELLITE';
1723        },
1724
1725        onAdd: function (map, insertAtTheBottom) {
1726            this._map = map;
1727            this._insertAtTheBottom = insertAtTheBottom;
1728
1729            // create a container div for tiles
1730            this._initContainer();
1731            this._initMapObject();
1732
1733            // set up events
1734            map.on('viewreset', this._resetCallback, this);
1735
1736            this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
1737            map.on('move', this._update, this);
1738
1739            map.on('zoomanim', this._handleZoomAnim, this);
1740
1741            //20px instead of 1em to avoid a slight overlap with google's attribution
1742            map._controlCorners['bottomright'].style.marginBottom = "20px";
1743
1744            this._reset();
1745            this._update();
1746        },
1747
1748        onRemove: function (map) {
1749            this._map._container.removeChild(this._container);
1750            //this._container = null;
1751
1752            this._map.off('viewreset', this._resetCallback, this);
1753
1754            this._map.off('move', this._update, this);
1755
1756            this._map.off('zoomanim', this._handleZoomAnim, this);
1757
1758            map._controlCorners['bottomright'].style.marginBottom = "0em";
1759            //this._map.off('moveend', this._update, this);
1760        },
1761
1762        getAttribution: function () {
1763            return this.options.attribution;
1764        },
1765
1766        setOpacity: function (opacity) {
1767            this.options.opacity = opacity;
1768            if (opacity < 1) {
1769                L.DomUtil.setOpacity(this._container, opacity);
1770            }
1771        },
1772
1773        setElementSize: function (e, size) {
1774            e.style.width = size.x + "px";
1775            e.style.height = size.y + "px";
1776        },
1777
1778        _initContainer: function () {
1779            var tilePane = this._map._container,
1780                first = tilePane.firstChild;
1781
1782            if (!this._container) {
1783                this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
1784                this._container.id = "_GMapContainer_" + L.Util.stamp(this);
1785                this._container.style.zIndex = "auto";
1786            }
1787
1788            tilePane.insertBefore(this._container, first);
1789
1790            this.setOpacity(this.options.opacity);
1791            this.setElementSize(this._container, this._map.getSize());
1792        },
1793
1794        _initMapObject: function () {
1795            if (!this._ready)
1796                return;
1797            this._google_center = new google.maps.LatLng(0, 0);
1798            var map = new google.maps.Map(this._container, {
1799                center: this._google_center,
1800                zoom: 0,
1801                tilt: 0,
1802                mapTypeId: google.maps.MapTypeId[this._type],
1803                disableDefaultUI: false,
1804                keyboardShortcuts: false,
1805                draggable: false,
1806                disableDoubleClickZoom: true,
1807                scrollwheel: false,
1808                streetViewControl: true,
1809                styles: this.options.mapOptions.styles,
1810                backgroundColor: this.options.mapOptions.backgroundColor
1811            });
1812
1813            var _this = this;
1814            this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
1815                function () {
1816                    _this.onReposition();
1817                });
1818            this._google = map;
1819
1820            google.maps.event.addListenerOnce(map, "idle",
1821                function () {
1822                    _this._checkZoomLevels();
1823                });
1824        },
1825
1826        _checkZoomLevels: function () {
1827            //setting the zoom level on the Google map may result in a different zoom level than the one requested
1828            //(it won't go beyond the level for which they have data).
1829            // verify and make sure the zoom levels on both Leaflet and Google maps are consistent
1830            if (this._google.getZoom() !== this._map.getZoom()) {
1831                //zoom levels are out of sync. Set the leaflet zoom level to match the google one
1832                this._map.setZoom(this._google.getZoom());
1833            }
1834        },
1835
1836        _resetCallback: function (e) {
1837            this._reset(e.hard);
1838        },
1839
1840        _reset: function (clearOldContainer) {
1841            this._initContainer();
1842        },
1843
1844        _update: function (e) {
1845            if (!this._google)
1846                return;
1847            this._resize();
1848
1849            var center = e && e.latlng ? e.latlng : this._map.getCenter();
1850            var _center = new google.maps.LatLng(center.lat, center.lng);
1851
1852            this._google.setCenter(_center);
1853            this._google.setZoom(this._map.getZoom());
1854
1855            this._checkZoomLevels();
1856            //this._google.fitBounds(google_bounds);
1857        },
1858
1859        _resize: function () {
1860            var size = this._map.getSize();
1861            if (this._container.style.width == size.x &&
1862                this._container.style.height == size.y)
1863                return;
1864            this.setElementSize(this._container, size);
1865            this.onReposition();
1866        },
1867
1868        _handleZoomAnim: function (e) {
1869            var center = e.center;
1870            var _center = new google.maps.LatLng(center.lat, center.lng);
1871
1872            this._google.setCenter(_center);
1873            this._google.setZoom(e.zoom);
1874        },
1875
1876        onReposition: function () {
1877            if (!this._google)
1878                return;
1879            google.maps.event.trigger(this._google, "resize");
1880        }
1881    });
1882
1883    L.Google.asyncWait = [];
1884    L.Google.asyncInitialize = function () {
1885        var i;
1886        for (i = 0; i < L.Google.asyncWait.length; i++) {
1887            var o = L.Google.asyncWait[i];
1888            o._ready = true;
1889            if (o._container) {
1890                o._initMapObject();
1891                o._update();
1892            }
1893        }
1894        L.Google.asyncWait = [];
1895    };
1896
1897
1898    L.HtmlIcon = L.Icon.extend({
1899        options: {
1900            /*
1901             html: (String) (required)
1902             iconAnchor: (Point)
1903             popupAnchor: (Point)
1904             */
1905        },
1906
1907        initialize: function (options) {
1908            L.Util.setOptions(this, options);
1909        },
1910
1911        createIcon: function () {
1912            var div = document.createElement('div');
1913            div.innerHTML = this.options.html;
1914            if (div.classList)
1915                div.classList.add('leaflet-marker-icon');
1916            else
1917                div.className += ' ' + 'leaflet-marker-icon';
1918            return div;
1919        },
1920
1921        createShadow: function () {
1922            return null;
1923        }
1924    });
1925
1926
1927    jQuery(".all-list-map").on('click', function () {
1928        var defmaplat = jQuery('body').data('defaultmaplat');
1929        var defmaplong = jQuery('body').data('defaultmaplot');
1930        jQuery('.map-pop').empty();
1931        if (jQuery('#map-section').is('.map-container3')) {
1932            jQuery('.map-pop').html('<div class="mapSidebar" id="map"></div>');
1933        } else {
1934            jQuery('.map-pop').html('<div class="listingmap" id="map"></div>');
1935        }
1936        var map = null
1937        $mtoken = jQuery('#page').data("mtoken");
1938        $mtype = jQuery('#page').data("mtype");
1939        $mapboxDesign = jQuery('#page').data("mstyle");
1940
1941        if ($mtoken != '' && $mtype == 'mapbox') {
1942
1943            L.mapbox.accessToken = $mtoken;
1944            map = L.mapbox.map('map');
1945            L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
1946                maxZoom: 18,
1947                attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
1948                    '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
1949                    'Imagery © <a href="http://mapbox.com">Mapbox</a>',
1950                id: jQuery('#page').data("mstyle"),
1951                accessToken: $mtoken
1952            }).addTo(map);
1953
1954            var markers = new L.MarkerClusterGroup();
1955            initializeMap(markers);
1956            if (markers === undefined) {
1957            } else {
1958                map.fitBounds(markers.getBounds());
1959                map.scrollWheelZoom.disable();
1960            }
1961        } else {
1962
1963            var map = new L.Map('map', {
1964                minZoom: 3,
1965            }
1965).setView(new L.LatLng(defmaplat, defmaplong), 18);
1966            if ($mtype == 'google') {
1967                L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}', {
1968                    maxZoom: 6,
1969                    subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
1970                    noWrap: true,
1971                });
1972                var googleLayer = new L.Google('ROADMAP');
1973                map.addLayer(googleLayer);
1974            } else {
1975                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
1976            }
1977            var markers = new L.MarkerClusterGroup();
1978            initializeMap(markers);
1979            if (markers === undefined) {
1980            } else {
1981
1982                map.fitBounds(markers.getBounds(), {padding: [50, 50]});
1983
1984            }
1985        }
1986
1987
1988        function initializeMap(markers) {
1989            markers.clearLayers();
1990
1991            jQuery(".lp-grid-box-contianer").each(function (i) {
1992
1993                var LPtitle = jQuery(this).data("title");
1994                var LPposturl = jQuery(this).data("posturl");
1995                var LPlattitue = jQuery(this).data("lattitue");
1996                var LPlongitute = jQuery(this).data("longitute");
1997                var LPpostid = jQuery(this).data("postid");
1998                if (jQuery('.v2-map-load').length == 1) {
1999                    var LPaddress = jQuery(this).find('.gaddress').text();
2000                    var LPimageSrc = jQuery(this).find('.lp-listing-top-thumb').find('img').attr('src');
2001                    var LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
2002                    if (typeof jQuery("body").data('deficon') !== 'undefined') {
2003                        LPiconSrc = jQuery("body").data('deficon');
2004                    }
2005
2006                } else {
2007                    var LPaddress = jQuery(this).find('.gaddress').text();
2008                    var LPimageSrc = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
2009                    var LPiconSrc = jQuery(this).find('.cat-icon').find('img').attr('src');
2010                    if (typeof jQuery("body").data('deficon') !== 'undefined') {
2011                        LPiconSrc = jQuery("body").data('deficon');
2012                    }
2013                }
2014
2015                if (LPlattitue != '' && LPlongitute != '') {
2016                    var LPimage = '';
2017                    if (LPimageSrc != '') {
2018                        LPimage = LPimageSrc;
2019                    }
2020
2021                    var LPicon = '';
2022                    if (LPiconSrc != '') {
2023                        LPicon = LPiconSrc;
2024                    }
2025
2026                    var markerLocation = new L.LatLng(LPlattitue, LPlongitute); // London
2027
2028                    var CustomHtmlIcon = L.HtmlIcon.extend({
2029                        options: {
2030                            html: "<div class='lpmap-icon-shape pin card" + LPpostid + "'><div class='lpmap-icon-contianer'><img alt='image' src='" + LPicon + "' /></div></div>",
2031                        }
2032                    });
2033
2034                    if (LPimage == 'undefined') {
2035                        LPimage = jQuery(this).find('.lp-grid-box-thumb').find('img').attr('src');
2036                    }
2037
2038                    var customHtmlIcon = new CustomHtmlIcon();
2039
2040                    var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('<div class="map-post"><div class="map-post-thumb"><a href="' + LPposturl + '"><img alt="image" src="' + LPimage + '" ></a></div><div class="map-post-des"><div class="map-post-title"><h5><a href="' + LPposturl + '">' + LPtitle + '</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> ' + LPaddress + '</p></div></div></div>').addTo(map);
2041                    markers.addLayer(marker);
2042                    map.addLayer(markers);
2043
2044                }
2045
2046            });
2047        }
2048
2049
2050    });
2051
2052
2053    if (jQuery('#cpmap').is('.contactmap')) {
2054
2055        jQuery('#cpmap').empty();
2056        var map = null;
2057        $mtoken = jQuery('#page').data("mtoken");
2058        $mtype = jQuery('#page').data("mtype");
2059        $siteURL = jQuery('#page').data("site-url");
2060        $lat = jQuery('.cp-lat').data("lat");
2061        $lan = jQuery('.cp-lan').data("lan");
2062        if ($mtoken != '' && $mtype == 'mapbox') {
2063            L.mapbox.accessToken = $mtoken;
2064
2065            $mapboxDesign = jQuery('#page').data("mstyle");
2066            var map = L.mapbox.map('cpmap')
2067                .setView([$lat, $lan], 14);
2068            L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2069                id: jQuery('#page').data("mstyle"),
2070                accessToken: jQuery('#page').data("mtoken")
2071            }).addTo(map);
2072            map.scrollWheelZoom.disable();
2073
2074        } else {
2075
2076            var map = new L.Map('cpmap', '').setView(new L.LatLng($lat, $lan), 16);
2077            if ($mtype == 'google') {
2078                var googleLayer = new L.Google('ROADMAP');
2079                map.addLayer(googleLayer);
2080            } else {
2081                L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2082            }
2083
2084            map.scrollWheelZoom.disable();
2085        }
2086
2087        var markers = new L.MarkerClusterGroup();
2088        var $pinicon = jQuery('#cpmap').data('pinicon');
2089        if ($pinicon === "") {
2090            $pinicon = "<div class='lpmap-icon-shape pin'><div class='lpmap-icon-contianer'><img alt='image' src='" + $siteURL + "wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>";
2091        } else {
2092            $pinicon = "<div style='width:50px; height:50px; margin: -50px 0 0 -20px;'><img alt='image' src='" + $pinicon + "'  /></div>";
2093        }
2094
2095        var markerLocation = new L.LatLng($lat, $lan); // London
2096
2097        var CustomHtmlIcon = L.HtmlIcon.extend({
2098            options: {
2099                html: $pinicon,
2100            }
2101        });
2102
2103        var customHtmlIcon = new CustomHtmlIcon();
2104
2105        var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2106        markers.addLayer(marker);
2107
2108
2109    } else if (jQuery('#map').is('.singlebigpost')) {
2110        jQuery(".singlebigmaptrigger").click(function () {
2111
2112            $mtoken = jQuery('#page').data("mtoken");
2113            $siteURL = jQuery('#page').data("site-url");
2114            $mtype = jQuery('#page').data("mtype");
2115            $lat = jQuery('.singlebigmaptrigger').data("lat");
2116            $lan = jQuery('.singlebigmaptrigger').data("lan");
2117            if ($mtoken != '' && $mtype == 'mapbox') {
2118
2119                L.mapbox.accessToken = $mtoken;
2120                var map = L.mapbox.map('map')
2121                    .setView([$lat, $lan], 14);
2122                L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2123                    id: jQuery('#page').data("mstyle"),
2124                    accessToken: jQuery('#page').data("mtoken")
2125                }).addTo(map);
2126
2127                var markers = new L.MarkerClusterGroup();
2128
2129                var markerLocation = new L.LatLng($lat, $lan); // London
2130
2131                var CustomHtmlIcon = L.HtmlIcon.extend({
2132                    options: {
2133                        html: "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img alt='image' src='" + $siteURL + "wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>",
2134                    }
2135                });
2136
2137                var customHtmlIcon = new CustomHtmlIcon();
2138
2139                var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2140                markers.addLayer(marker);
2141                map.fitBounds(markers.getBounds());
2142
2143                map.scrollWheelZoom.disable();
2144                map.invalidateSize();
2145
2146
2147            } else {
2148                var map = new L.Map('map', {center: new L.LatLng($lat, $lan), zoom: 14});
2149                if ($mtype == 'google') {
2150                    var googleLayer = new L.Google('ROADMAP');
2151                    map.addLayer(googleLayer);
2152                } else {
2153                    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2154                }
2155                var markers = new L.MarkerClusterGroup();
2156                var markerLocation = new L.LatLng($lat, $lan); // London
2157                var CustomHtmlIcon = L.HtmlIcon.extend({
2158                    options: {
2159                        html: "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img alt='image' src='" + $siteURL + "wp-content/themes/listingpro/assets/images/pins/lp-logo.png'  /></div></div>",
2160                    }
2161                });
2162
2163                var customHtmlIcon = new CustomHtmlIcon();
2164
2165                var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2166                markers.addLayer(marker);
2167                map.fitBounds(markers.getBounds());
2168
2169                map.scrollWheelZoom.disable();
2170                map.invalidateSize();
2171            }
2172
2173        });
2174    }
2175
2176});
2177jQuery(document).ready(function () {
2178
2179    // Autocomplete
2180
2181    jQuery.widget("custom.combobox", {
2182        _create: function () {
2183            this.wrapper = jQuery("<span>")
2184                .addClass("custom-combobox")
2185                .insertAfter(this.element);
2186
2187            this.element.hide();
2188            this._createAutocomplete();
2189            this._createShowAllButton();
2190        },
2191        _createAutocomplete: function () {
2192            var selected = this.element.children(":selected"),
2193                value = selected.val() ? selected.text() : "";
2194
2195            this.input = jQuery("<input>")
2196                .appendTo(this.wrapper)
2197                .val(value)
2198                .attr("title", "")
2199                .addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left lp-search-input location_input lp-home-locaton-input")
2200                .autocomplete({
2201                    delay: 0,
2202                    minLength: 0,
2203                    source: $.proxy(this, "_source")
2204                })
2205                .tooltip({
2206                    tooltipClass: "ui-state-highlight"
2207                });
2208
2209        },
2210
2211        _createShowAllButton: function () {
2212            var input = this.input,
2213                wasOpen = false;
2214
2215            jQuery("<a>")
2216                .attr("tabIndex", -1)
2217                .attr("title", "Show All Items")
2218                .tooltip()
2219                .appendTo(this.wrapper)
2220                .button({
2221                    icons: {
2222                        primary: "ui-icon-triangle-1-s"
2223                    },
2224                    text: false
2225                })
2226                .removeClass("ui-corner-all")
2227                .addClass("custom-combobox-toggle ui-corner-right")
2228                .mousedown(function () {
2229                    wasOpen = input.autocomplete("widget").is(":visible");
2230                })
2231                .on('click', function () {
2232                    input.focus();
2233
2234                    // Close if already visible
2235                    if (wasOpen) {
2236                        return;
2237                    }
2238
2239                    // Pass empty string as value to search for, displaying all results
2240                    input.autocomplete("search", "");
2241                });
2242        },
2243
2244        _source: function (request, response) {
2245            var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
2246            response(this.element.children("option").map(function () {
2247                var text = jQuery(this).text();
2248                if (this.value && (!request.term || matcher.test(text)))
2249                    return {
2250                        label: text,
2251                        value: text,
2252                        option: this
2253                    };
2254            }));
2255        },
2256
2257        _removeIfInvalid: function (event, ui) {
2258
2259            // Selected an item, nothing to do
2260            if (ui.item) {
2261                return;
2262            }
2263
2264            // Search for a match (case-insensitive)
2265            var value = this.input.val(),
2266                valueLowerCase = value.toLowerCase(),
2267                valid = false;
2268            this.element.children("option").each(function () {
2269                if (jQuery(this).text().toLowerCase() === valueLowerCase) {
2270                    this.selected = valid = true;
2271                    return false;
2272                }
2273            });
2274
2275            // Found a match, nothing to do
2276            if (valid) {
2277                return;
2278            }
2279
2280            // Remove invalid value
2281            this.input
2282                .val("")
2283                .attr("title", value + " didn't match any item")
2284                .tooltip("open");
2285            this.element.val("");
2286            this._delay(function () {
2287                this.input.tooltip("close").attr("title", "");
2288            }, 2500);
2289            this.input.autocomplete("instance").term = "";
2290        },
2291
2292        _destroy: function () {
2293            this.wrapper.remove();
2294            this.element.show();
2295        }
2296    });
2297
2298    jQuery(".comboboxs").combobox();
2299    jQuery("#toggle").on('click', function () {
2300        jQuery(".comboboxs").toggle();
2301    });
2302    // jQuery( "#searchcategory" ).combobox();
2303    jQuery("#toggle").on('click', function () {
2304        jQuery("#searchcategory").toggle();
2305    });
2306    jQuery(".ui-autocomplete").autocomplete({
2307        appendTo: ".input-group"
2308    });
2309    jQuery('.custom-combobox-input').autocomplete({minLength: 0});
2310    jQuery('.custom-combobox-input').on("click", function () {
2311        jQuery(this).autocomplete("search", "");
2312    });
2313
2314
2315    // Location Placeholder
2316    jQuery(".location_input").attr("placeholder", "Your Location");
2317    jQuery(".comboboxCategory .location_input").attr("placeholder", "Food");
2318    jQuery(".postSubmitCat .location_input").attr("placeholder", "Chose one or more than one categories");
2319
2320
2321    jQuery(document).on('click', '.md-close', function () {
2322        jQuery('.md-modal').modal('hide');
2323        jQuery('.md-modal').removeClass('md-show');
2324        jQuery('.modal-backdrop').remove();
2325    });
2326
2327    // Popup Data
2328    jQuery(document).on('click', '.qickpopup', function () {
2329        // variables
2330        jQuery('.content-loading').removeAttr('style');
2331        var LPtitle = jQuery(this).closest('.lp-grid-box-contianer').data("title");
2332        var LPlattitue = jQuery(this).closest('.lp-grid-box-contianer').data("lattitue");
2333        var LPlongitute = jQuery(this).closest('.lp-grid-box-contianer').data("longitute");
2334        var LPpostID = jQuery(this).closest('.lp-grid-box-contianer').data("postid");
2335        var feaImg = jQuery(this).closest('.lp-grid-box-contianer').data("feaimg");
2336        var mapPin = jQuery(this).data('mappin');
2337        jQuery('#listing-preview-popup .md-close').hide();
2338        var docHeight = jQuery(document).height();
2339        jQuery('#listing-preview-popup .popup-inner-left-padding').html('').css('min-hegiht', '300px');
2340        if (jQuery('#listing-preview-popup').is('.md-show')) {
2341        } else {
2342            jQuery('#listing-preview-popup').modal({
2343                show: 'true'
2344            });
2345            jQuery('#listing-preview-popup').addClass('md-show');
2346        }
2347        jQuery.ajax({
2348            url: ajax_search_term_object.ajaxurl,
2349            dataType: "json",
2350            data: {
2351                'action': 'quick_preivew_cb',
2352                'LPpostID': LPpostID,
2353                'lpNonce': jQuery('#lpNonce').val()
2354            },
2355            success: function (data) {
2356                jQuery('#listing-preview-popup .md-close').show().children('i').css('right', '20px');
2357                jQuery('#listing-preview-popup .popup-inner-left-padding').html(data);
2358                var mapinSrc = '';
2359
2360
2361                mapinSrc = jQuery(data).find('span.cat-icon').find('img').attr('src');
2362                if (mapinSrc != '') {
2363                    mapPin = mapinSrc;
2364                }
2365
2366                var markers = false;
2367                $mtoken = jQuery('#page').data("mtoken");
2368                $siteURL = jQuery('#page').data("site-url");
2369                $lat = LPlattitue;
2370                $lan = LPlongitute;
2371                $mapboxDesign = jQuery('#page').data("mstyle");
2372                $mtype = jQuery('#page').data("mtype");
2373                if ($mtoken != '' && $mtype == 'mapbox') {
2374                    L.mapbox.accessToken = $mtoken;
2375                    map = L.mapbox.map('quickmap' + LPpostID);
2376                    L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
2377                        id: jQuery('#page').data("mstyle"),
2378                        accessToken: jQuery('#page').data("mtoken")
2379                    }).addTo(map);
2380                } else {
2381
2382                    var map = new L.Map('quickmap' + LPpostID, {center: new L.LatLng($lat, $lan), zoom: 14});
2383                    if ($mtype == 'google') {
2384                        var googleLayer = new L.Google('ROADMAP');
2385                        map.addLayer(googleLayer);
2386                    } else {
2387                        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
2388                    }
2389
2390                }
2391                map.setView([$lat, $lan], 14);
2392                markers = new L.MarkerClusterGroup();
2393                var markerLocation = new L.LatLng($lat, $lan); // London
2394                var CustomHtmlIcon = L.HtmlIcon.extend({
2395                    options: {
2396                        html: '<div class="lpmap-icon-shape pin"><div class="lpmap-icon-contianer"><img alt="image" src="' + mapPin + '" /></div></div>',
2397                    }
2398                });
2399                var customHtmlIcon = new CustomHtmlIcon();
2400                var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
2401                markers.addLayer(marker);
2402                //alert(data.cats_markup);
2403                jQuery('.content-loading').css('background-image', 'none');
2404            },
2405            error: function (errorThrown) {
2406                alert(errorThrown);
2407            }
2408        });
2409    });
2410
2411    //href Smooth Scroll
2412
2413    // handle links with @href started with '#' only
2414    jQuery('.post-meta-right-box a.secondary-btn[href^="#"]').on('click', function (e) {
2415        e.preventDefault();
2416
2417        var target = this.hash;
2418        var $target = jQuery(target);
2419
2420        jQuery('html, body').stop().animate({
2421            'scrollTop': $target.offset().top
2422        }, 900, 'swing', function () {
2423            window.location.hash = target;
2424        });
2425    });
2426    //Tags Container
2427    jQuery('.chosen-select2').chosen({
2428        disable_search: true
2429    });
2430    jQuery('.chosen-select1').chosen({
2431        disable_search: true
2432    });
2433    jQuery('.chosen-select7').chosen({
2434        disable_search: true
2435    });
2436    jQuery('.chosen-select5').chosen({
2437        disable_search: true
2438    });
2439    // jQuery( ".chosen-select.chosen-select5" ).select2({minimumResultsForSearch: -1});
2440
2441    var $tags = jQuery('#searchtags').chosen(),
2442        LPnewTags = function () {
2443            jQuery('.LPtagsContainer').empty();
2444            $tags.find(':selected').each(function (i, obj) {
2445                jQuery('<div class="active-tag">' + obj.value + '<div class="remove-tag"><i class="fa fa-times"></i></div></div>').appendTo('.LPtagsContainer').on('click', function () {
2446                    jQuery(this).remove();
2447                    jQuery(obj).attr('selected', false);
2448                    $tags.trigger("chosen:updated");
2449                    jQuery('.LPtagsContainer input[value="' + obj.value + '"]').remove();
2450                });
2451
2452                jQuery('<input type="hidden" name="select_tag" value="' + obj.value + '" />').appendTo('.LPtagsContainer');
2453            });
2454        };
2455
2456    $tags.on('change', LPnewTags);
2457
2458    /* Social Share */
2459    var social = jQuery('.post-stat li ul.social-icons.post-socials');
2460    var socialOvrly = jQuery('.reviews.sbutton .md-overlay');
2461
2462    jQuery('.sbutton a.reviews-quantity').on('click', function (event) {
2463        event.preventDefault();
2464        social.fadeIn(400);
2465
2466        if (socialOvrly.hasClass('hide')) {
2467            jQuery(socialOvrly).removeClass('hide');
2468            jQuery(socialOvrly).addClass('show');
2469        } else {
2470            jQuery(socialOvrly).removeClass('show');
2471            jQuery(socialOvrly).addClass('hide');
2472        }
2473    });
2474
2475    socialOvrly.on('click', function (event) {
2476        event.preventDefault();
2477        social.fadeOut(400);
2478
2479        if (socialOvrly.hasClass('show')) {
2480            jQuery(socialOvrly).removeClass('show');
2481            jQuery(socialOvrly).addClass('hide');
2482        } else {
2483            jQuery(socialOvrly).removeClass('hide');
2484            jQuery(socialOvrly).addClass('show');
2485        }
2486    });
2487
2488    // Reserwa Popup
2489    jQuery('a.make-reservation').on('click', function (event) {
2490        event.preventDefault();
2491        jQuery('.ifram-reservation').fadeIn(400);
2492    });
2493    jQuery('a.close-btn').on('click', function (event) {
2494        event.preventDefault();
2495        jQuery('.ifram-reservation').fadeOut(400);
2496    });
2497
2498    //Menu Popup
2499    if (jQuery(window).width() > 767) {
2500        //Menu Popup
2501        jQuery('.widget-box a.open-modal, .menu-hotel a.open-modal').on('click', function (event) {
2502            event.preventDefault();
2503            jQuery('.hotel-menu').fadeIn(400);
2504        });
2505        jQuery('a.close-menu-popup').on('click', function (event) {
2506            event.preventDefault();
2507            jQuery('.hotel-menu').fadeOut(400);
2508        });
2509    } else if (jQuery(window).width() < 767) {
2510        //Menu Popup
2511        jQuery('.widget-box a.open-modal, .menu-hotel a.open-modal').on('click', function (event) {
2512            event.preventDefault();
2513            jQuery('.hotel-menu').slideToggle(400);
2514        });
2515
2516        jQuery('.listing-app-view .hotel-menu a.close-menu-popup').on('click', function (event) {
2517            event.preventDefault();
2518            jQuery('.hotel-menu').slideToggle(400);
2519        });
2520    }
2521
2522
2523    // Resurva Booking Switcher
2524    jQuery('a.switch-fields').on('click', function (event) {
2525        event.preventDefault();
2526        jQuery(this).toggleClass('active');
2527        jQuery('.hidden-items').fadeToggle(400);
2528    });
2529
2530    // Dashboard Notices
2531    jQuery('a.dismiss').on('click', function (event) {
2532        event.preventDefault();
2533        jQuery(this).parent('.panel-dash-dismiss').slideUp(400);
2534    });
2535
2536
2537    /* Pins Hover */
2538
2539    jQuery(document).on('mouseenter', '.lp-grid-box-contianer', function () {
2540        var cardID = jQuery(this).data("postid");
2541        var cardclass = '.lpmap-icon-shape.card' + cardID;
2542        if (jQuery(cardclass).hasClass('cardHighlight')) {
2543            jQuery(cardclass).removeClass("cardHighlight");
2544        } else {
2545            jQuery(cardclass).addClass("cardHighlight");
2546        }
2547    });
2548    jQuery(document).on('mouseleave', '.lp-grid-box-contianer', function () {
2549        var cardID = jQuery(this).data("postid");
2550        var cardclass = '.lpmap-icon-shape.card' + cardID;
2551        jQuery(cardclass).removeClass("cardHighlight");
2552    });
2553
2554
2555    /* Select Category */
2556    jQuery('.postsubmitSelect').on('change', function () {
2557        jQuery('.feature-fields-error-container').remove();
2558        jQuery('.featuresDataRow').show();
2559        var cvalue = jQuery(this).val();
2560        jQuery('.featuresData').css({'opacity': '0', 'visibility': 'hidden', 'display': 'none'});
2561        jQuery('.featuresDataContainer').find('.featuresData' + cvalue).css({
2562            'opacity': '1',
2563            'visibility': 'visible',
2564            'display': 'block'
2565        });
2566    });
2567
2568});
2569jQuery(document).on('change', '.btn-file :file', function () {
2570    var input = jQuery(this),
2571        numFiles = input.get(0).files ? input.get(0).files.length : 1,
2572        label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
2573    input.trigger('fileselect', [numFiles, label]);
2574});
2575
2576
2577jQuery(document).ready(function () {
2578    if (jQuery('form').is('#lp-submit-formdf')) {
2579        var validator = new FormValidator('lp-submit-form', [{
2580            name: 'postTitle',
2581            display: 'Title',
2582            rules: 'required'
2583        }, {
2584            name: 'category',
2585            display: 'Category',
2586            rules: 'required'
2587        }, {
2588            name: 'postContent',
2589            display: 'Description',
2590            rules: 'required'
2591        }, {
2592            name: 'location',
2593            display: 'Location',
2594            rules: 'required'
2595        }, {
2596            name: 'gAddress',
2597            display: 'Google Address',
2598            rules: 'required'
2599        }, {
2600            name: 'email',
2601            rules: 'valid_email',
2602
2603        }, {
2604            name: 'username',
2605            display: 'UserName',
2606            rules: 'required'
2607
2608        }, {
2609            name: 'policycheck',
2610            display: 'Terms and Conditions Check',
2611            rules: 'required'
2612
2613        }], function (errors, evt) {
2614
2615
2616            var SELECTOR_ERRORS = jQuery('.error_box'),
2617                SELECTOR_SUCCESS = jQuery('.success_box');
2618
2619            if (errors.length > 0) {
2620                SELECTOR_ERRORS.empty();
2621
2622                for (var i = 0, errorLength = errors.length; i < errorLength; i++) {
2623                    SELECTOR_ERRORS.append(errors[i].message + '<br />');
2624                }
2625
2626                SELECTOR_SUCCESS.css({display: 'none'});
2627                SELECTOR_ERRORS.fadeIn(200);
2628            } else {
2629                SELECTOR_ERRORS.css({display: 'none'});
2630                SELECTOR_SUCCESS.fadeIn(200);
2631            }
2632
2633
2634        });
2635    }
2636});
2637var image_custom_uploader;
2638var $thisItem = '';
2639
2640jQuery(document).on('click', '.upload-author-image', function (e) {
2641    e.preventDefault();
2642
2643    $thisItem = jQuery(this);
2644    $form = jQuery('#profileupdate');
2645
2646    //If the uploader object has already been created, reopen the dialog
2647    if (image_custom_uploader) {
2648        image_custom_uploader.open();
2649        return;
2650    }
2651
2652    //Extend the wp.media object
2653    image_custom_uploader = wp.media.frames.file_frame = wp.media({
2654        title: 'Choose Image',
2655        button: {
2656            text: 'Choose Image'
2657        },
2658        multiple: false
2659    });
2660
2661    //When a file is selected, grab the URL and set it as the text field's value
2662    image_custom_uploader.on('select', function () {
2663        attachment = image_custom_uploader.state().get('selection').first().toJSON();
2664        var url = '';
2665        url = attachment['url'];
2666        var attachId = '';
2667        attachId = attachment['id'];
2668
2669        jQuery("img.author-avatar").attr({
2670            src: url
2671        });
2672        $form.parent().parent().find(".criteria-image-url").attr({
2673            value: url
2674        });
2675        $form.parent().parent().find(".criteria-image-id").attr({
2676            value: attachId
2677        });
2678    });
2679
2680    //Open the uploader dialog
2681    image_custom_uploader.open();
2682});
2683
2684
2685/* update by zaheer on 25 feb  */
2686jQuery(document).ready(function ($) {
2687    jQuery('#listings_checkout input[name=listing_id]').on('change', function () {
2688        jQuery('#listings_checkout input[name=post_id]').val(jQuery(this, '#listings_checkout').val());
2689    });
2690    jQuery('#listings_checkout input[name=plan]').on('change', function () {
2691        jQuery('#listings_checkout input[name=method]').val(jQuery(this, '#listings_checkout').val());
2692    });
2693
2694
2695    jQuery('.lp-promotebtn').on('click', function () {
2696        var $this = jQuery(this);
2697        jQuery('#ads_promotion input[name=listing_id]').val($this.data('listingnid'));
2698        var listtitle = $this.data('listingtitle');
2699        jQuery('input[name=cur_listing_title]').val(listtitle);
2700    });
2701    jQuery('#ads_promotion input[name=plan]').on('change', function () {
2702        jQuery('#ads_promotion input[name=method]').val(jQuery(this, '#listings_checkout').val());
2703    });
2704
2705
2706});
2707/* by zaheer on 25 feb */
2708jQuery('.availableprice_options input').change(function ($) {
2709    var $total, taxrate = '',
2710        taxprice, taxTotal;
2711    if (jQuery('span').hasClass('pricetax')) {
2712        taxrate = jQuery('span.pricetax').data('taxprice');
2713    }
2714    $oldtotal = jQuery('#totalprice').val();
2715    oldTax = jQuery('input[name="taxprice"]').val();
2716    if (jQuery(this).is(":checked")) {
2717        var $val = jQuery(this).val();
2718        $total = parseFloat($val) + parseFloat($oldtotal);
2719        taxprice = parseFloat((taxrate / 100) * $val);
2720        taxTotal = parseFloat(oldTax) + parseFloat(taxprice);
2721        $total = $total + taxprice;
2722        $total = $total.toFixed(2);
2723        taxTotal = taxTotal.toFixed(2);
2724        jQuery('#totalprice').val($total);
2725        jQuery('.pricetotal #price').html($total);
2726        jQuery('input[name="lp_total_price"]').val($total);
2727        jQuery('input[name="taxprice"]').val(taxTotal);
2728    } else {
2729        var $val = jQuery(this).val();
2730        $total = parseFloat($oldtotal) - parseFloat($val);
2731        taxprice = parseFloat((taxrate / 100) * $val);
2732        taxTotal = parseFloat(oldTax) - parseFloat(taxprice);
2733        $total = $total - taxprice;
2734        $total = $total.toFixed(2);
2735        taxTotal = taxTotal.toFixed(2);
2736        if ($total > 0) {
2737            jQuery('#totalprice').val($total);
2738            jQuery('.pricetotal #price').html($total);
2739            jQuery('input[name="lp_total_price"]').val($total);
2740            jQuery('input[name="taxprice"]').val(taxTotal);
2741        } else {
2742            $total = 0.00;
2743            jQuery('#totalprice').val($total);
2744            jQuery('.pricetotal #price').html($total);
2745            jQuery('input[name="lp_total_price"]').val($total);
2746            jQuery('input[name="taxprice"]').val(taxTotal);
2747        }
2748
2749    }
2750
2751});
2752
2753
2754/* update by zaheer on 25 feb  */
2755jQuery('.lp-front').on('click', '.lp-frontBtn', function (e) {
2756    e.preventDefault();
2757    //jQuery('.lp-front').hide(200);
2758    jQuery('.lp-front').slideUp(500);
2759    jQuery('.lp-back1').slideDown(1000);
2760    //jQuery('.lp-back').show(500);
2761});
2762jQuery('.lp-back1').on('click', '#lp-back1', function (e) {
2763    e.preventDefault();
2764    jQuery('.lp-back1').slideUp(500);
2765    jQuery('.lp-front').slideDown(1000);
2766});
2767jQuery('.lp-back1').on('click', '#lp-next', function (e) {
2768    e.preventDefault();
2769    jQuery('.lp-back1').slideUp(500);
2770    jQuery('.lp-back2').slideDown(1000);
2771});
2772jQuery('.lp-back2').on('click', '#lp-back2', function (e) {
2773    e.preventDefault();
2774    jQuery('.lp-back2').slideUp(500);
2775    jQuery('.lp-back1').slideDown(1000);
2776});
2777/* end update by zaheer on 25 feb  */
2778
2779//dynamic model for invoices by zaheer
2780jQuery(document).ready(function ($) {
2781
2782    jQuery('.invoice-section a.showme').click(function (ev) {
2783        var $this = jQuery(this);
2784        $this.after('<i class="lp-modal-spinn fa-li fa fa-spinner fa-spin"></i>');
2785        ev.preventDefault();
2786        var rowid = jQuery(this).data('id');
2787        reqlink = jQuery(this).data('url');
2788        var invoiceFor = '';
2789        invoiceFor = jQuery(this).data('lpinvoice');
2790        //invoiceFor = 'dddf';
2791
2792        jQuery.get(reqlink + '?lp_p_id=' + rowid + '&lp_invoice=' + invoiceFor, function (html) {
2793            jQuery('#modal-invoice .modal-body').html('');
2794            jQuery('#modal-invoice .modal-body').html(html);
2795            jQuery('#modal-invoice').modal('show', {backdrop: 'static'});
2796            $this.next('.lp-modal-spinn').hide('');
2797            $this.next('.lp-modal-spinn').remove('');
2798        });
2799    });
2800
2801});
2802
2803
2804/* print preview */
2805jQuery(function ($) {
2806    'use strict';
2807    jQuery("#modal-invoice").find('.lp-print-list').on('click', function () {
2808        //jQuery.print("#modal-invoice");
2809        /* jQuery("#modal-invoice").print({
2810         noPrintSelector : ".modal-footer",
2811         }); */
2812
2813        var divToPrint = document.getElementById('modal-invoice');
2814
2815        var newWin = window.open('', 'Print-Window');
2816
2817        newWin.document.open();
2818
2819        newWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</body></html>');
2820
2821        newWin.document.close();
2822
2823        setTimeout(function () {
2824            newWin.close();
2825        }, 10);
2826
2827    });
2828});
2829
2830jQuery(document).ready(function ($) {
2831    jQuery('.googleAddressbtn').on('click', function (e) {
2832        var dtype = jQuery(this).data('type');
2833        if (dtype == "gaddress") {
2834            if (jQuery(this).hasClass('events-dash')) {
2835                jQuery('.events-map-wrap #inputAddresss').slideUp(300);
2836                jQuery('.lp-custom-lat').slideUp(300);
2837                jQuery('.events-map-wrap #inputAddress').slideDown();
2838                jQuery('.events-map-wrap .googlefulladdress').slideDown(300);
2839                jQuery('.events-map-wrap #latitude').attr('type', 'hidden');
2840                jQuery('.events-map-wrap #longitude').attr('type', 'hidden');
2841                jQuery(this).next('.googleAddressbtn').removeClass('active');
2842                jQuery(this).addClass('active');
2843            } else {
2844                jQuery('.post-submit #inputAddresss').slideUp(300);
2845                jQuery('.lp-custom-lat').slideUp(300);
2846                jQuery('.post-submit #inputAddress').slideDown();
2847                jQuery('.post-submit .googlefulladdress').slideDown(300);
2848                jQuery('.post-submit #latitude').attr('type', 'hidden');
2849                jQuery('.post-submit #longitude').attr('type', 'hidden');
2850                jQuery(this).next('.googleAddressbtn').removeClass('active');
2851                jQuery(this).addClass('active');
2852            }
2853        } else {
2854            if (jQuery(this).hasClass('events-dash')) {
2855                jQuery('.events-map-wrap #inputAddress').slideUp();
2856                jQuery('.events-map-wrap .googlefulladdress').slideUp(300);
2857                jQuery('.events-map-wrap #inputAddresss').slideDown(300);
2858                jQuery('.lp-custom-lat').slideDown(300);
2859                jQuery('.events-map-wrap #latitude').attr('type', 'text');
2860                jQuery('.events-map-wrap #longitude').attr('type', 'text');
2861                jQuery(this).prev('.googleAddressbtn').removeClass('active');
2862                jQuery(this).addClass('active');
2863            } else {
2864                jQuery('.post-submit #inputAddress').slideUp();
2865                jQuery('.post-submit .googlefulladdress').slideUp(300);
2866                jQuery('.post-submit #inputAddresss').slideDown(300);
2867                jQuery('.lp-custom-lat').slideDown(300);
2868                jQuery('.post-submit #latitude').attr('type', 'text');
2869                jQuery('.post-submit #longitude').attr('type', 'text');
2870                jQuery(this).prev('.googleAddressbtn').removeClass('active');
2871                jQuery(this).addClass('active');
2872            }
2873        }
2874        e.preventDefault();
2875    });
2876});
2877
2878
2879/* ======27 may mm=========== */
2880jQuery(document).ready(function ($) {
2881    jQuery('#slide-nav.navbar-inverse').after(jQuery('<div class="inverse" id="navbar-height-col"></div>'));
2882    jQuery('#slide-nav.navbar-default').after(jQuery('<div id="navbar-height-col"></div>'));
2883    var toggler = '.navbar-toggle';
2884    var pagewrapper = '#page-content';
2885    var navigationwrapper = '.navbar-header';
2886    var menuwidth = '100%';
2887    var slidewidth = '80%';
2888    var menuneg = '-100%';
2889    var slideneg = '-80%';
2890    jQuery("#slide-nav").on("click", toggler, function (e) {
2891        var selected = $(this).hasClass('slide-active');
2892        jQuery('#slidemenu').stop().animate({
2893            left: selected ? menuneg : '0px'
2894        });
2895        jQuery('#navbar-height-col').stop().animate({
2896            left: selected ? slideneg : '0px'
2897        });
2898        jQuery(pagewrapper).stop().animate({
2899            left: selected ? '0px' : slidewidth
2900        });
2901        jQuery(navigationwrapper).stop().animate({
2902            left: selected ? '0px' : slidewidth
2903        });
2904        jQuery(this).toggleClass('slide-active', !selected);
2905        jQuery('#slidemenu').toggleClass('slide-active');
2906        jQuery('#page-content, .navbar, body, .navbar-header').toggleClass('slide-active');
2907    });
2908    var selected = '#slidemenu, #page-content, body, .navbar, .navbar-header';
2909    jQuery(window).on("resize", function () {
2910        if (jQuery(window).width() > 767 && $('.navbar-toggle').is(':hidden')) {
2911            jQuery(selected).removeClass('slide-active');
2912        }
2913    });
2914
2915    jQuery('.lp_price_trigger_checkout input').on('click', function ($) {
2916        var taxEnable = jQuery(this).data('taxenable');
2917        plantitle = jQuery(this).data('title');
2918        planprice = jQuery(this).data('planprice');
2919        taxprice = '';
2920        totalprice = '';
2921        if (taxEnable == "1") {
2922            taxrate = jQuery('.lp_price_trigger_checkout input').data('taxrate');
2923            taxprice = (taxrate / 100) * planprice;
2924            taxprice = taxprice.toFixed(2);
2925            jQuery('input[name="listings_tax_price"]').attr('value', taxprice);
2926            totalprice = parseFloat(planprice) + parseFloat(taxprice);
2927            totalprice = totalprice.toFixed(2);
2928            jQuery('span#lp_price_plan').text(plantitle);
2929            jQuery('span#lp_price_plan_price').text(planprice);
2930            jQuery('span#lp_tax_price').text(taxprice);
2931            jQuery('span#lp_price_subtotal').text(totalprice);
2932            jQuery('input#lp_paypal_price').val(totalprice);
2933            jQuery('.lp_section_inner .lp_billing_total').show(400);
2934        } else {
2935            totalprice = parseFloat(planprice);
2936            jQuery('span#lp_price_plan').text(plantitle);
2937            jQuery('span#lp_price_plan_price').text(planprice);
2938            jQuery('span#lp_price_subtotal').text(totalprice);
2939            jQuery('input#lp_paypal_price').val(totalprice);
2940        }
2941
2942    });
2943
2944    if (jQuery('form#register .check_policy').is('.termpolicy')) {
2945        jQuery("input#lp_usr_reg_btn").prop('disabled', true);
2946        jQuery('.check_policy').on('click', function () {
2947            if (jQuery('#check_policy').is(':checked')) {
2948                jQuery("input#lp_usr_reg_btn").prop('disabled', false);
2949            } else {
2950                jQuery("input#lp_usr_reg_btn").prop('disabled', true);
2951            }
2952        });
2953    }
2954
2955    if (jQuery('.blue-section .check_policy').is('.termpolicy')) {
2956        jQuery("#listingsubmitBTN").prop('disabled', true);
2957        jQuery("#listingsubmitBTN").addClass('dissablebutton');
2958        jQuery('.check_policy').on('click', function () {
2959            if (jQuery('#policycheck').is(':checked')) {
2960                jQuery("#listingsubmitBTN").prop('disabled', false);
2961                jQuery("#listingsubmitBTN").removeClass('dissablebutton');
2962            } else {
2963                jQuery("#listingsubmitBTN").prop('disabled', true);
2964                jQuery("#listingsubmitBTN").addClass('dissablebutton');
2965            }
2966        });
2967    }
2968    if (jQuery('.white-section .check_policy').is('.termpolicy')) {
2969        jQuery("#listingsubmitBTN").prop('disabled', true);
2970        jQuery("#listingsubmitBTN").addClass('dissablebutton');
2971        jQuery('.check_policy').on('click', function () {
2972            if (jQuery('#policycheck').is(':checked')) {
2973                jQuery("#listingsubmitBTN").prop('disabled', false);
2974                jQuery("#listingsubmitBTN").removeClass('dissablebutton');
2975            } else {
2976                jQuery("#listingsubmitBTN").prop('disabled', true);
2977                jQuery("#listingsubmitBTN").addClass('dissablebutton');
2978            }
2979        });
2980    }
2981});
2982
2983jQuery(window).ready(function () {
2984
2985    if (jQuery('.header-container').hasClass('.lp-vedio-bg')) {
2986        jQuery('#lp_vedio').play();
2987    }
2988    if (jQuery('input').is('.rating-tooltip')) {
2989
2990        jQuery('.rating-tooltip').rating({
2991            extendSymbol: function (rate) {
2992                jQuery(this).tooltip({
2993                    container: 'body',
2994                    placement: 'bottom',
2995                    title: 'Rate ' + rate
2996                });
2997            }
2998        });
2999
3000    }
3001
3002});
3003
3004jQuery(document).ready(function ($) {
3005
3006
3007    if (jQuery('.lp-home-banner-contianer').is('.lp-home-banner-with-loc')) {
3008
3009        var locType = jQuery('.lp_auto_loc_container h1,p.lp-app-view2-des').data('locnmethod');
3010
3011        var currentlocationswitch = '1';
3012        var currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
3013        if (currentlocationswitch == "0") {
3014            locType = 'locationifoff';
3015        }
3016
3017
3018        var apiType = jQuery('#page').data('ipapi');
3019
3020        if (locType == "withip") {
3021            if (apiType === "geo_ip_db") {
3022                $.getJSON('https://geolocation-db.com/json/geoip.php?jsonp=?')
3023                    .done(function (location) {
3024                        var locc = location.city;
3025                        if (locc == null) {
3026
3027                        } else {
3028                            jQuery('.lp-dyn-city').text(location.city);
3029                        }
3030
3031                    });
3032            } else if (apiType === "ip_api") {
3033                jQuery.get("https://ipapi.co/json", function (location) {
3034                    var locc = location.city;
3035                    if (locc == null) {
3036
3037                    } else {
3038                        jQuery('.lp-dyn-city').text(location.city);
3039                    }
3040                }, "json");
3041            } else {
3042                lpGetGpsLocName(function (lpgetcurrentcityvalue) {
3043                    lpgpsclocation = lpgetcurrentcityvalue;
3044                    jQuery('.lp-dyn-city').text(lpgpsclocation);
3045                });
3046            }
3047
3048        }
3049
3050    }
3051
3052
3053    if (jQuery('.lp-header-search-tagline').length != 0) {
3054
3055
3056        var locType = jQuery('.lp_auto_loc_container .lp-header-search-tagline').data('locnmethod');
3057        var currentlocationswitch = '1';
3058        var currentlocationswitch = jQuery('#page').data('lpcurrentloconhome');
3059        if (currentlocationswitch == "0") {
3060            locType = 'locationifoff';
3061        }
3062
3063
3064        var apiType = jQuery('#page').data('ipapi');
3065
3066        if (locType == "withip") {
3067            if (apiType === "geo_ip_db") {
3068                $.getJSON('https://geolocation-db.com/json/geoip.php?jsonp=?')
3069                    .done(function (location) {
3070                        var locc = location.city;
3071                        if (locc == null) {
3072
3073                        } else {
3074                            jQuery('.lp-dyn-city').text(location.city);
3075                        }
3076
3077                    });
3078            } else if (apiType === "ip_api") {
3079                jQuery.get("https://ipapi.co/json", function (location) {
3080                    var locc = location.city;
3081                    if (locc == null) {
3082
3083                    } else {
3084                        jQuery('.lp-dyn-city').text(location.city);
3085                    }
3086                }, "json");
3087            } else {
3088                lpGetGpsLocName(function (lpgetcurrentcityvalue) {
3089                    lpgpsclocation = lpgetcurrentcityvalue;
3090                    jQuery('.lp-dyn-city').text(lpgpsclocation);
3091                });
3092            }
3093
3094        }
3095
3096    }
3097
3098    // lp-header-search-tagline
3099
3100});
3101
3102function hexToRGB(hexStr) {
3103    var col = {};
3104    col.r = parseInt(hexStr.substr(1, 2), 16);
3105    col.g = parseInt(hexStr.substr(3, 2), 16);
3106    col.b = parseInt(hexStr.substr(5, 2), 16);
3107    return col;
3108}
3109
3110/* for recurring stripe */
3111jQuery(document).ready(function () {
3112    var plantype = '';
3113    var recurringtext = '';
3114    var recurringhtml = '';
3115    var $thislisting = '';
3116    var $thisplan = '';
3117    var $recurringon = '';
3118    $recurringon = jQuery('form#listings_checkout').data('recurring');
3119    if ($recurringon === "yes") {
3120        jQuery('#listings_checkout input[type=radio]').on('change', function ($) {
3121            if (jQuery('#listings_checkout input[name=listing_id]').is(':checked') && jQuery('#listings_checkout input[name=plan]').is(':checked')) {
3122
3123                $thislisting = jQuery('#listings_checkout input[name=listing_id]:checked');
3124                $thisplan = jQuery('#listings_checkout input[name=plan]:checked').val();
3125                plantype = $thislisting.closest('.lp-user-listings').data('plantype');
3126                if (plantype === "Pay Per Listing") {
3127
3128                    recurringtext = $thislisting.closest('.lp-user-listings').data('recurringtext');
3129                    recurringhtml = '<div class="checkbox"><input type="checkbox" id="listing-recurring-recurrsive" name="lp-recurring-option" value="yes"><label for="listing-recurring-recurrsive">' + recurringtext + '</label></div>';
3130                    if ($thisplan === "stripe") {
3131                        jQuery('div.lp-recurring-button-wrap').html(recurringhtml);
3132                    } else {
3133                        jQuery('div.lp-recurring-button-wrap').html('');
3134                    }
3135                } else {
3136                    jQuery('div.lp-recurring-button-wrap').html('');
3137                }
3138            } else {
3139                jQuery('div.lp-recurring-button-wrap').html('');
3140            }
3141
3142
3143        });
3144    }
3145
3146    /* for dynamic location */
3147    if (jQuery('input#cities').length) {
3148        jQuery('input#cities').cityAutocomplete();
3149    }
3150    if (jQuery('input#citiess').length) {
3151        jQuery('input#citiess').cityAutocomplete();
3152    }
3153
3154    if (jQuery('input#cities').length) {
3155        jQuery(document).on('click', '#cities', function (e) {
3156            jQuery('input#cities').cityAutocomplete();
3157        });
3158    }
3159    if (jQuery('input#citiess').length) {
3160        jQuery(document).on('click', '#citiess', function (e) {
3161            jQuery('input#citiess').cityAutocomplete();
3162        });
3163    }
3164
3165
3166    jQuery(document).on('click', '#citiess', function (e) {
3167        var target = e.target;
3168        if (!jQuery(target).is('.help')) {
3169            if (jQuery('input#citiess').length) {
3170                var isseleted = jQuery('input#citiess').data('isseleted');
3171                if (isseleted == false) {
3172                    jQuery('input#citiess').val('');
3173                }
3174            }
3175        }
3176    });
3177
3178    if (jQuery('input#citiess').length) {
3179        jQuery('#citiess').on('input', function () {
3180            jQuery(this).data('isseleted', false);
3181        });
3182    }
3183
3184})
3185/* for recurring stripe */
3186jQuery(document).ready(function ($) {
3187    jQuery('#select-plan-form .select-plan-form input[name=plans-posts]').on('click', function () {
3188        jQuery("a.lp_change_plan_action").hide('');
3189        jQuery("div.lp-action-div form").hide('');
3190    });
3191});
3192
3193/* for range slider */
3194var nearmeunit = jQuery("#lp-find-near-me").data('nearmeunit');
3195if (jQuery('#distance_range').length != 0) {
3196    jQuery('#distance_range').bootstrapSlider({
3197
3198        formatter: function (value) {
3199            return value + ' ' + nearmeunit;
3200        },
3201        tooltip: 'always'
3202    });
3203
3204}
3205
3206/* for show click on div radius */
3207jQuery('li.lp-tooltip-outer').on('click', function () {
3208    var $this = jQuery(this);
3209    jQuery('.lp-tooltip-div').removeClass('active');
3210    $this.find('.lp-tooltip-div').addClass('active');
3211
3212});
3213
3214/* for hide div on outer click to divs */
3215jQuery(document).mouseup(function (e) {
3216    var container = jQuery(".lp-tooltip-div");
3217    // if the target of the click isn't the container nor a descendant of the container
3218    if (!container.is(e.target) && container.has(e.target).length === 0) {
3219        jQuery('.lp-tooltip-div').removeClass('active');
3220    }
3221
3222    var containerr = jQuery(".lp-tooltip-div-hidden");
3223    if (!containerr.is(e.target) && containerr.has(e.target).length === 0) {
3224        jQuery('.lp-tooltip-div-hidden').removeClass('active');
3225    }
3226
3227    var foodmenucontainer = jQuery(".hotel-menu .inner-menu");
3228    if (!foodmenucontainer.is(e.target) && foodmenucontainer.has(e.target).length === 0) {
3229        jQuery(".hotel-menu").fadeOut();
3230    }
3231
3232
3233});
3234
3235jQuery("li.lp-tooltip-outer").hover(function () {
3236    var $this = jQuery(this);
3237    jQuery('.lp-tooltip-div').removeClass('active');
3238    jQuery('.lp-tooltip-div-hidden').removeClass('active');
3239    $this.find('.lp-tooltip-div').addClass('active');
3240    if ($this.find('a.near-me-btn, a.near-me-btn-style-3').hasClass('active')) {
3241        jQuery('.lp-tooltip-div-hidden').addClass('active');
3242    }
3243});
3244
3245/* for first tab auto active on listing detail page style 2 */
3246jQuery(document).ready(function ($) {
3247    jQuery('.lp-detail-page-template-3 #reply-title2 ul li').first().addClass('active');
3248    jQuery('.lp-detail-page-template-3 .detail-page2-tab-content .tab-pane').first().addClass('active');
3249
3250    /* app view search dumm loader */
3251    jQuery(document).on('click', '.listing-app-view .app-view-filters .close', function () {
3252
3253        var docHeight = jQuery(document).height();
3254        jQuery("body").prepend('<div id="full-overlay"></div>');
3255        jQuery('#full-overlay').css('height', docHeight + 'px');
3256        jQuery('#full-overlay').addClass('content-loading');
3257        var timer = '';
3258
3259        function lpcloseloadnow() {
3260            jQuery('#full-overlay').remove();
3261            jQuery('#full-overlay').removeClass('content-loading');
3262            clearTimeout(timer);
3263        }
3264
3265        timer = setTimeout(lpcloseloadnow, 2000);
3266        if (jQuery('div.promoted-listings div.app-view-new-ads-sli
3266der').length) {
3267            jQuery('div.app-view-new-ads-slider').slick({
3268                arrows: false,
3269            });
3270        }
3271        if (jQuery('div.promoted-listings div.app-view-new-ads-slider').length) {
3272            jQuery('div.app-view-new-ads-slider').slick({
3273                arrows: false,
3274            });
3275        }
3276    });
3277
3278    /* multiselect for google location  */
3279    jQuery(document).on('click', '.city-autocomplete .help', function () {
3280        var $thisSelected = jQuery(this).text();
3281        var $thisSelecteds = $thisSelected.split(",")[0];
3282        var $selectLocationData = '<div class="lpsinglelocselected ' + $thisSelected + '">' + $thisSelected + '<i class="fa fa-times lp-removethisloc"></i><input type="hidden" name="location[]" value="' + $thisSelecteds + '"></div>';
3283        jQuery($selectLocationData).appendTo(".lp-selected-locs");
3284
3285        if (jQuery('div').hasClass('lp-selected-locs')) {
3286            jQuery("input#citiess").val('');
3287        }
3288
3289    });
3290
3291    jQuery(document).on('click', '.lp-removethisloc', function () {
3292        jQuery(this).closest('.lpsinglelocselected').remove();
3293    });
3294
3295    jQuery('.top-search-form .lp-search-btn-header .lp-search-btn').on('click', function () {
3296        var locvals = $.trim($("input#cities").val());
3297        if (locvals.length > 0) {
3298        } else {
3299            jQuery('input[name="lp_s_loc"]').val('');
3300        }
3301    });
3302
3303
3304    /* when google location and user don't select the suggestions and hit enters */
3305    jQuery('input#cities').on('change', function () {
3306        jQuery('input[name=lp_s_loc]').val(jQuery(this).val());
3307    });
3308
3309    jQuery(document).on('click', '.city-autocomplete .help', function () {
3310        //New update 2.7.0
3311        substrr = $(this).text();
3312        substrr = substrr.split(",");
3313        if (substrr[1] == 'undefined' || substrr[1] == '' || substrr[1] == null) {
3314            substrr = substrr[0];
3315        } else {
3316            substrr = substrr[0] + ',' + substrr[1];
3317        }
3318        //End New update 2.7.0
3319        jQuery('input[name=lp_s_loc]').val(substrr);
3320    });
3321
3322
3323    /* overlay close on cross click */
3324    jQuery('.md-close.widget-map-click').on('click', function (e) {
3325        jQuery('#full-overlay').css('height', '0px');
3326    });
3327
3328
3329});
3330
3331
3332function lpshowsidemap() {
3333    if (jQuery('#map').is('.mapSidebar')) {
3334        if (jQuery('.v2-map-load').length == 1) {
3335            jQuery("<div class='v2mapwrap'></div>").appendTo(jQuery(".v2-map-load"));
3336            jQuery(".v2-map-load .v2mapwrap").trigger('click');
3337        }
3338        jQuery("<div class='sidemarpInside'></div>").appendTo(jQuery(".sidemap-fixed"));
3339        jQuery(".sidemap-fixed .sidemarpInside").trigger('click');
3340    }
3341}
3342
3343if (window.attachEvent) {
3344    window.attachEvent('onload', lpshowsidemap);
3345} else if (window.addEventListener) {
3346    window.addEventListener('load', lpshowsidemap, false);
3347} else {
3348    document.addEventListener('load', lpshowsidemap, false);
3349}
3350
3351/* for 1.2.7 */
3352jQuery(document).ready(function ($) {
3353    if (jQuery('form#registertmp .check_policyy').is('.termpolicy')) {
3354        jQuery("input#lp-template-registerbtn").prop('disabled', true);
3355        jQuery('.check_policyy').on('click', function () {
3356            if (jQuery('#check_policyy').is(':checked')) {
3357                jQuery("input#lp-template-registerbtn").prop('disabled', false);
3358            } else {
3359                jQuery("input#lp-template-registerbtn").prop('disabled', true);
3360            }
3361        });
3362    }
3363
3364    jQuery('.lp-qoute-butn a#freeQuoteForm').click(function (e) {
3365        e.preventDefault();
3366        jQuery('html, body').animate({
3367            scrollTop: jQuery('#freeQuoteFormWrap').offset().top
3368        }, 1000);
3369    });
3370    jQuery('.contact-right #contactMSGForm').submit(function (e) {
3371        var uname = jQuery(this).find('input[name=uname]').val();
3372        var uemail = jQuery(this).find('input[name=uemail]').val();
3373        var umessage = jQuery(this).find('textarea[name=umessage]').val();
3374
3375        if (uname == '' || uname == null) {
3376            jQuery(this).find('input[name=uname]').addClass('lp-required-field');
3377            e.preventDefault();
3378        }
3379
3380
3381        if (uemail == '' || uemail == null) {
3382            jQuery(this).find('input[name=uemail]').addClass('lp-required-field');
3383            e.preventDefault();
3384        }
3385
3386        if (lpisValidEmailAddress(uemail)) {
3387        } else {
3388            jQuery(this).find('input[name=uemail]').addClass('lp-required-field');
3389            e.preventDefault();
3390        }
3391
3392
3393        if (umessage == '' || umessage == null) {
3394            jQuery(this).find('textarea[name=umessage]').addClass('lp-required-field');
3395            e.preventDefault();
3396        }
3397
3398
3399    });
3400
3401
3402    jQuery("input#lp-featuredimage").change(function () {
3403        lp_change_curerntImgUrl(this);
3404    });
3405
3406    /* end preview image*/
3407
3408
3409    jQuery('.app-view-header .lp-search-toggle .user-menu i, .app-view-popup-style, .event-by-going-wrap .app-view-popup-style').click(function () {
3410        jQuery('#app-view-login-popup').fadeIn(function () {
3411            jQuery('#app-view-login-popup').css({
3412                'top': '20%',
3413                'transform': 'translateY(0%)',
3414                //'opacity': 1,
3415                'overflow': 'visible'
3416            });
3417        });
3418    });
3419    jQuery('.style2-popup-login .md-close').click(function (e) {
3420        jQuery('#app-view-login-popup').fadeOut(function () {
3421            jQuery('#app-view-login-popup').css({
3422                //'opacity': 1,
3423                'display': 'none'
3424            });
3425        });
3426    });
3427
3428});
3429
3430/* preview image on listing edit change url of current image */
3431
3432function lp_change_curerntImgUrl(input) {
3433    if (input.files && input.files[0]) {
3434        jQuery('.submit_new_style-outer .lp-listing-featuredimage label').css({"max-width": "189px"});
3435        var reader = new FileReader();
3436
3437        reader.onload = function (e) {
3438            jQuery('.lpchangeinstantimg').attr('src', e.target.result);
3439            jQuery('.lpchangeinstantimg').css({"width": "63px", "height": "63px"});
3440        }
3441
3442        reader.readAsDataURL(input.files[0]);
3443    }
3444}
3445
3446jQuery(window).scroll(function () {
3447    //if you hard code, then use console
3448    //.log to determine when you want the
3449    //nav bar to stick.
3450
3451    if (jQuery(window).scrollTop() > 790) {
3452        jQuery('.profile-sticky-bar').addClass('navbar-fixed');
3453        jQuery('.profile-sticky-bar').fadeIn(500);
3454    }
3455    if (jQuery(window).scrollTop() < 790) {
3456        jQuery('.profile-sticky-bar').removeClass('navbar-fixed');
3457        jQuery('.profile-sticky-bar').fadeOut(500);
3458    }
3459});
3460jQuery(document).on('click', '.stickynavbar ul li a', function (e) {
3461    e.preventDefault();
3462    var targetID = jQuery(this).attr('href');
3463    jQuery('html,body').animate({
3464            scrollTop: jQuery(targetID).offset().top - 125
3465        },
3466        500);
3467});
3468
3469/* for email address */
3470function lpisValidEmailAddress(emailAddress) {
3471    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
3472    return pattern.test(emailAddress);
3473}
3474
3475/* for 1.2.15 */
3476jQuery(document).ready(function () {
3477    jQuery('#lp_delete_accountpopup input.lp_assign_data').on('click', function () {
3478        jQuery('.lp_delte_user_confirm').removeAttr("disabled")
3479    });
3480
3481    jQuery('.lp_privacy_policy_Wrap input.lpprivacycheckboxopt').on('click', function () {
3482        if (jQuery(this).closest('#claimform').hasClass('lp-form-planclaim-st')) {
3483            var claimuserlogin = false,
3484                ppolicy = false;
3485            if (jQuery('body').hasClass('logged-in')) {
3486                claimuserlogin = true;
3487            }
3488            if (jQuery('#claimform .lpprivacycheckboxopt').length > 0) {
3489                ppolicy = true;
3490            }
3491            claimformvalidation(claimuserlogin, ppolicy);
3492        } else {
3493            if (jQuery(this).is(':checked')) {
3494                jQuery(this).closest('form').find('input[type=submit]').removeAttr("disabled");
3495            } else {
3496                jQuery(this).closest('form').find('input[type=submit]').attr("disabled", "disabled");
3497            }
3498        }
3499    });
3500
3501
3502});
3503/* end for 1.2.15 */
3504
3505
3506/* for version 2.0 */
3507
3508jQuery(document).ready(function () {
3509
3510    /* for claim submit checkout form  */
3511    jQuery('#claim_payment_checkout').on('submit', function (e) {
3512        var $this = jQuery(this);
3513        claimerID = $this.find('input[name=claimerID]').val();
3514        claimPost = $this.find('input[name=claimPost]').val();
3515        claimPrice = $this.find('input[name=claimPrice]').val();
3516        currency = $this.find('input[name=currency]').val();
3517        claimPrice = parseFloat(claimPrice) * 100;
3518        claimPrice = parseFloat(claimPrice).toFixed();
3519        handler.open({
3520            name: "For Claim",
3521            description: "",
3522            zipCode: true,
3523            amount: claimPrice,
3524            currency: currency,
3525        });
3526        e.preventDefault();
3527    })
3528
3529});
3530
3531
3532/* FOR ADDITIONAL FILTER */
3533/*-------------------------------------------------------------------------------------------------*/
3534
3535// More Filter Tooltip
3536
3537jQuery(document).ready(function () {
3538
3539
3540    jQuery('.lp_add_more_filter a').on('mouseover', function () {
3541
3542        jQuery('.lp_more_filter_tooltip_outer').css("visibility", "visible");
3543
3544    });
3545
3546    jQuery('.lp_add_more_filter a').on('mouseout', function () {
3547
3548        jQuery('.lp_more_filter_tooltip_outer').css("visibility", "hidden");
3549
3550    });
3551
3552});
3553
3554
3555// More Filter Button click and over lay on map
3556
3557jQuery(document).ready(function () {
3558
3559    jQuery('.lp_add_more_filter a').click(function (e) {
3560        e.preventDefault();
3561        e.stopPropagation();
3562
3563        jQuery('.outer_all_page_overflow').toggle();
3564
3565        // Map over lay display block
3566        if (jQuery('.overlay_on_map_for_filter').is(':hidden')) {
3567
3568            jQuery('.overlay_on_map_for_filter').css('display', 'block');
3569        } else {
3570
3571            jQuery('.overlay_on_map_for_filter').css('display', 'none');
3572        }
3573
3574    });
3575
3576    jQuery('.outer_all_page_overflow').click(function (e) {
3577        //e.stopPropagation();
3578    });
3579
3580    // Hide on click out side div
3581    jQuery('body').click(function () {
3582        //jQuery('.outer_all_page_overflow').hide();
3583        // Map over lay display none
3584        jQuery('.overlay_on_map_for_filter').css('display', 'none');
3585    });
3586
3587    jQuery('#filter_cancel_all').on('click', function () {
3588        jQuery('.outer_all_page_overflow').slideUp();
3589        jQuery('.overlay_on_map_for_filter').css('display', 'none');
3590        // Map overlay display none
3591
3592    });
3593
3594});
3595
3596jQuery(document).on('click', '#filter_cancel_all', function () {
3597    jQuery('.outer_all_page_overflow').slideUp();
3598    jQuery('.overlay_on_map_for_filter').css('display', 'none');
3599    jQuery('.outer_all_page_overflow').hide(500);
3600    // Map overlay display none
3601
3602});
3603
3604
3605/* **************************For payment checkout script******************************* */
3606
3607jQuery(document).ready(function () {
3608    jQuery('#listings_checkout_form input[name=listing_id]').click(function () {
3609        if (jQuery('#listings_checkout_form input[name=listing_id]').is(':checked')) {
3610            if (jQuery('#listings_checkout_form input[name=plan]').is(':checked')) {
3611                //both are checked
3612                jQuery('.lp_payment_step_next.firstStep').addClass('active');
3613                lp_make_checkout_step_active('firstStep');
3614                jQuery('.lp_payment_step_next.firstStep').prop('disabled', false);
3615            } else {
3616                jQuery('.lp-checkout-steps .firstStep').removeClass('current');
3617                jQuery('.lp_payment_step_next.firstStep').removeClass('active');
3618                jQuery('.lp_payment_step_next.firstStep').prop('disabled', true);
3619            }
3620        }
3621
3622    });
3623
3624
3625    jQuery('#listings_checkout_form input[name=plan]').click(function () {
3626        if (jQuery('#listings_checkout_form input[name=plan]').is(':checked')) {
3627            jQuery('input[name=method]').val(jQuery(this).val());
3628            if (jQuery('#listings_checkout_form input[name=listing_id]').is(':checked')) {
3629                //both are checked
3630                jQuery('.lp_payment_step_next.firstStep').addClass('active');
3631                lp_make_checkout_step_active('firstStep');
3632                jQuery('.lp_payment_step_next.firstStep').prop('disabled', false);
3633            } else {
3634                jQuery('.lp-checkout-steps .firstStep').removeClass('current');
3635                jQuery('.lp_payment_step_next.firstStep').removeClass('active');
3636                jQuery('.lp_payment_step_next.firstStep').prop('disabled', true);
3637            }
3638        }
3639    });
3640
3641
3642    // add class for change border and background color lisitng section.
3643    jQuery('.lp-user-listings .radio-danger').click(function () {
3644        $this = jQuery(this);
3645        jQuery('.lp-user-listings').removeClass('active-checkout-listing');
3646        $this.closest('.lp-user-listings').addClass('active-checkout-listing');
3647    });
3648
3649    /* first step */
3650    jQuery(document).on('click', 'button.firstStep', function () {
3651        if (jQuery('.inactive-payment-mode').length) {
3652            jQuery('.inactive-payment-mode').hide();
3653        }
3654        jQuery('#listings_checkout_form input[name=listing_id]').not(':checked').closest('.lp-user-listings').css('display', 'none');
3655        jQuery('#listings_checkout_form input[name=plan]').not(':checked').closest('.lp-method-wrap').css('display', 'none');
3656        lp_show_mini_subtotal();
3657        //update values in hidden fields
3658        lp_reset_mincart_checkout_form_data();
3659        //display block selected lisiting details.
3660        lp_show_recurring_switch();
3661        // display terms and conditions
3662        jQuery('.lp-new-term-style').css('display', 'block');
3663        jQuery('button.lp_payment_step_next.secondStep').css("display", "block");
3664        jQuery(this).addClass('secondStep');
3665        jQuery(this).removeClass('firstStep');
3666        if (jQuery(".terms-checkbox-container input[type=checkbox]").length) {
3667            jQuery('.lp_payment_step_next.secondStep').prop('disabled', true);
3668        } else {
3669            lp_make_checkout_step_active('secondStep');
3670        }
3671
3672
3673    });
3674
3675    /* checkbox of terms and conditions */
3676    jQuery(".terms-checkbox-container input[type=checkbox]").on('click', function () {
3677        if (jQuery(this).is(':checked')) {
3678            jQuery('.lp_payment_step_next.secondStep').prop('disabled', false);
3679            lp_make_checkout_step_active('secondStep');
3680            var urloftermcond = jQuery(".lpcheckouttac").attr('href');
3681            //window.open(urloftermcond, '_blank');
3682        } else {
3683            jQuery('.lp_payment_step_next.secondStep').prop('disabled', true);
3684            lp_make_checkout_step_passive('secondStep');
3685        }
3686    });
3687    /* second step */
3688    jQuery(document).on('click', 'button.lp_payment_step_next.secondStep', function () {
3689        jQuery('.lp-checkout-steps .firstStep').addClass('completed');
3690        jQuery('button.lp_payment_step_next.thirdStep').css("display", "block");
3691        jQuery(this).addClass('thirdStep');
3692        jQuery(this).removeClass('secondStep');
3693        $planprice = jQuery('input[name=plan_price]').val();
3694
3695        if (jQuery('input[name="lp-recurring-option"]').is(':checked')) {
3696            jQuery(this).prop("type", "submit");
3697        } else {
3698            if (parseFloat($planprice) == 0) {
3699                /* price zero or 100% discount */
3700                $listings_id = jQuery('input[name=listings_id]').val();
3701                lp_make_this_listing_publish_withdiscount($listings_id);
3702            } else {
3703                jQuery(this).prop("type", "submit");
3704            }
3705        }
3706    });
3707
3708    /* third step */
3709    jQuery(document).on('click', 'button.lp_payment_step_next.thirdStep', function () {
3710        jQuery('.lp-checkout-steps .secondStep').addClass('completed');
3711    });
3712
3713
3714    // script on click to open print section print specific div
3715    jQuery('#print-section-receipt').click(function () {
3716
3717        var printContents = document.getElementById('printarea').innerHTML;
3718        var originalContents = document.body.innerHTML;
3719        document.body.innerHTML = printContents;
3720        window.print();
3721        document.body.innerHTML = originalContents;
3722        location.reload();
3723
3724    });
3725
3726    /* script for coupon switch on checkout page*/
3727    jQuery('input[name=lp_checkbox_coupon]').on('click', function () {
3728        jQuery(this).toggleClass('active');
3729        if (jQuery(this).hasClass('active')) {
3730            lp_make_couponsfields_active();
3731        } else {
3732            lp_make_couponsfields_passive();
3733            /* reset the minicart and checkout form data */
3734            lp_reset_mincart_checkout_form_data();
3735            jQuery('li.checkout_discount_val').remove();
3736        }
3737    });
3738
3739
3740    /* script for notification div */
3741    var $currHeight = jQuery(window).height();
3742    var $currDivHeight = jQuery('.lp_notification_wrapper').height();
3743    $currHeight = $currHeight - $currDivHeight;
3744    var $currHeight = $currHeight + 'px';
3745    jQuery('.lp_notification_wrapper').css({"top": $currHeight});
3746
3747    /* script for on resize */
3748    jQuery(window).resize(function () {
3749        var $currHeight = jQuery(window).height();
3750        var $currDivHeight = jQuery('.lp_notification_wrapper').height();
3751        $currHeight = $currHeight - $currDivHeight;
3752        var $currHeight = $currHeight + 'px';
3753        jQuery('.lp_notification_wrapper').css({"top": $currHeight});
3754    });
3755    /* cancel notice */
3756
3757
3758    /* new dashborad menu */
3759    jQuery("#menu-toggle").click(function (e) {
3760        e.preventDefault();
3761        if (jQuery(window).width() > 767) {
3762            jQuery("#wrapper").toggleClass("active");
3763        }
3764    });
3765
3766    jQuery('p#reply-title').on('click', function (event) {
3767        event.preventDefault();
3768        var thiss = jQuery(this);
3769        if (thiss.hasClass('active')) {
3770            jQuery(this).removeClass('active');
3771            jQuery(this).next('#lp-ad-click-inner').slideUp();
3772            jQuery(this).next('#lp-ad-click-innerm').slideUp();
3773        } else {
3774            jQuery(this).addClass('active');
3775            jQuery(this).next('#lp-ad-click-inner').slideDown();
3776            jQuery(this).next('#lp-ad-click-innerm').slideDown();
3777        }
3778
3779        //jQuery(this).next('#rewies_form').toggleClass('open_review_form');
3780    });
3781    var TargetHeight = jQuery('.lp-inbox-outer').height();
3782    //jQuery('.user-recent-listings-inner .padding-0:last').height(TargetHeight+'px');
3783    jQuery('.user-recent-listings-inner .padding-0:first').height(TargetHeight + 'px');
3784    var TargetHeight = jQuery('.lp-left-panel-height').height(),
3785        TargetHeight = TargetHeight + 100;
3786
3787
3788    /* for header search new*/
3789    jQuery('#click-search-view').on('click', function () {
3790        $this = jQuery(this);
3791        jQuery('.lp-search-section-header-view').toggleClass('active-section-header-view');
3792        if (!$this.hasClass('alreadyInIt')) {
3793            $this.addClass('alreadyInIt');
3794            setTimeout(function () {
3795                jQuery('input#cities').cityAutocomplete();
3796            }, 3500);
3797        }
3798    });
3799
3800
3801    /* see more and see less activiey on user dashboard */
3802    jQuery('button.lp_see_more_activities').on('click', function () {
3803        $this = jQuery(this);
3804        $thisval = $this.text();
3805        $thisReplace = $this.data('replacetext');
3806        $this.toggleClass('active');
3807        jQuery('div.lp_hid_this_activity').slideToggle();
3808        $this.text($thisReplace);
3809        $this.data('replacetext', $thisval);
3810    });
3811
3812    /* invoices preview */
3813    var foldSettings = {
3814        easing: 'linear',
3815        duration: 1000,
3816        size: 5,
3817        horizFirst: false,
3818        /* complete: function () {
3819         $(this).toggleClass("active");
3820         } */
3821    }
3822    jQuery('a.lp_preview_this_invoice, .lp_right_preview_this_invoice').on('click', function (e) {
3823        var $this = jQuery(this);
3824        $inoviceno = $this.closest('.lp-listing-outer-container').data('inoviceno');
3825        $date = $this.closest('.lp-listing-outer-container').data('date');
3826        $amount = $this.closest('.lp-listing-outer-container').data('amount');
3827        $amountOnly = $this.closest('.lp-listing-outer-container').data('orprice');
3828        $tax = $this.closest('.lp-listing-outer-container').data('tax');
3829        $method = $this.closest('.lp-listing-outer-container').data('method');
3830        $plan = $this.closest('.lp-listing-outer-container').data('plan');
3831        $duration = $this.closest('.lp-listing-outer-container').data('duration');
3832        $status = $this.closest('.lp-listing-outer-container').data('status');
3833        $listTitle = $this.closest('.lp-listing-outer-container').data('listtitle');
3834        $fullAmount = $amount;
3835        if ($this.hasClass('lp_preview_this_invoice')) {
3836            jQuery('div.lp_popup_preview_invoice .lppopinvoice').text($inoviceno);
3837            jQuery('div.lp_popup_preview_invoice .lppopdate').text($date);
3838            jQuery('div.lp_popup_preview_invoice .lppopsubamount').text($amount);
3839            jQuery('div.lp_popup_preview_invoice .lppopamount').text($amount);
3840            jQuery('div.lp_popup_preview_invoice .lppoptaxprice').text($tax);
3841            jQuery('div.lp_popup_preview_invoice .lppopplanprice').text($amountOnly);
3842            jQuery('div.lp_popup_preview_invoice .lppoplist').text($listTitle);
3843
3844            jQuery('#lpinvoiceforpdf .lppopinvoice').text($inoviceno);
3845            jQuery('#lpinvoiceforpdf .lppopdate').text($date);
3846            jQuery('#lpinvoiceforpdf .lppopamount').text($amount);
3847            jQuery('#lpinvoiceforpdf .lllistname').text($listTitle);
3848
3849            jQuery('#lpinvoiceforpdf .lppopamountqqq').text($tax);
3850            jQuery('#lpinvoiceforpdf .lppopamountwww').text($fullAmount);
3851
3852            if ($method == "wire") {
3853                $imgSrc = jQuery('p.lp-pay-with img').data('srcwire');
3854                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3855            } else if ($method == "stripe") {
3856                $imgSrc = jQuery('p.lp-pay-with img').data('srcstripe');
3857                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3858            } else if ($method == "paypal") {
3859                $imgSrc = jQuery('p.lp-pay-with img').data('srcpaypal');
3860                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3861            } else if ($method == 'paystack') {
3862                $imgSrc = jQuery('p.lp-pay-with img').data('srcpaystack');
3863                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3864            } else if ($method == 'razorpay') {
3865                $imgSrc = jQuery('p.lp-pay-with img').data('srcrazorpay');
3866                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3867            } else if ($method == 'payfast') {
3868                $imgSrc = jQuery('p.lp-pay-with img').data('srcpayfast');
3869                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3870            } else if ($method == 'payu') {
3871                $imgSrc = jQuery('p.lp-pay-with img').data('srcpayu');
3872                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3873            } else if ($method == 'eway') {
3874                $imgSrc = jQuery('p.lp-pay-with img').data('srceway');
3875                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3876            } else if ($method == 'mollie') {
3877                $imgSrc = jQuery('p.lp-pay-with img').data('srcmollie');
3878                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3879            } else if ($method == 'mercadopago') {
3880                $imgSrc = jQuery('p.lp-pay-with img').data('srcmercadopago');
3881                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3882            } else if ($method == 'stripe_ideal') {
3883                $imgSrc = jQuery('p.lp-pay-with img').data('srcstripeideal');
3884                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3885            } else if ($method == 'flutterwave') {
3886                $imgSrc = jQuery('p.lp-pay-with img').data('srcflutterwave');
3887                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3888            } else if ($method == 'mtn_momo') {
3889                $imgSrc = jQuery('p.lp-pay-with img').data('srcmtn_momo');
3890                jQuery('p.lp-pay-with img').attr('src', $imgSrc);
3891            }
3892            jQuery('div.lp_popup_preview_invoice .lppopmethod').text($method);
3893            jQuery('div.lp_popup_preview_invoice .lppopplan').text($plan);
3894            jQuery('div.lp_popup_preview_invoice .lppopduration').text($duration);
3895
3896            jQuery('#lpinvoiceforpdf .lppopmethod').text($method);
3897            jQuery('#lpinvoiceforpdf .lppopplan').text($plan);
3898            jQuery('#lpinvoiceforpdf .lppopduration').text($duration);
3899
3900
3901            jQuery("div.lp_popup_preview_invoice").toggle("fold", foldSettings);
3902            $this.closest('.lp-listing-outer-container').find('.lp_right_preview_this_invoice input').prop('checked', true);
3903            e.preventDefault();
3904        }
3905        if ($this.hasClass('lp_right_preview_this_invoice') || $this.hasClass('lp_preview_this_invoice')) {
3906            jQuery('div.lp_right_preview_invoice .lppopinvoice').text($inoviceno);
3907            jQuery('div.lp_right_preview_invoice .lppopdate').text($date);
3908            jQuery('div.lp_right_preview_invoice .lppopamount').text($amount);
3909            jQuery('div.lp_right_preview_invoice .lppopplanprice').text($amountOnly);
3910            jQuery('div.lp_right_preview_invoice .lppoptaxprice').text($tax);
3911            jQuery('div.lp_right_preview_invoice .lppopmethod').text($method);
3912            jQuery('div.lp_right_preview_invoice .lppopplan').text($plan);
3913            jQuery('div.lp_right_preview_invoice .lppopduration').text($duration);
3914            jQuery('div.lp_right_preview_invoice .lppopstatus').text($status);
3915
3916
3917            jQuery('#lpinvoiceforpdf .lppopinvoice').text($inoviceno);
3918            jQuery('#lpinvoiceforpdf .lppopdate').text($date);
3919            jQuery('#lpinvoiceforpdf .lppopamount').text($amountOnly);
3920
3921
3922            jQuery('#lpinvoiceforpdf .lppopmethod').text($method);
3923            jQuery('#lpinvoiceforpdf .lppopplan').text($plan);
3924            jQuery('#lpinvoiceforpdf .lppopduration').text($duration);
3925
3926        }
3927
3928        //e.preventDefault();
3929    });
3930
3931    /* close invoices preview */
3932    jQuery(document).on('click', '.close_invoice_prev', function (e) {
3933        $this = jQuery(this);
3934        jQuery("div.lp_popup_preview_invoice").toggle("fold", foldSettings);
3935        e.preventDefault();
3936    });
3937
3938
3939    jQuery('button.lp-cancle-btn').on('click', function (e) {
3940        e.preventDefault();
3941        jQuery('.lp-ad-step-two').fadeOut(function () {
3942            jQuery('.lp_camp_invoice_wrp').fadeIn();
3943        });
3944    });
3945
3946
3947    /* show preview of currnt ad place */
3948    jQuery('input[name="lpadsoftype[]"]').on('click', function () {
3949        $this = jQuery(this);
3950        adsduration_pd = '';
3951        lp_make_campaign_paybutton_active();
3952        $newprice = 0;
3953        $campType = lp_get_camp_type();
3954        if ($campType == 'adsperduration') {
3955            lp_set_camp_duration_price_in_preview(jQuery('input[name=adsduration_pd]').val());
3956
3957        } else if ($campType == 'adsperclick') {
3958            lp_set_camp_budget_price_in_preview(jQuery('input[name=adsprice_pc]').val());
3959        }
3960
3961        if ($this.is(":checked")) {
3962
3963
3964            if ($this.val() == "lp_random_ads") {
3965                jQuery('.lp-invoices-all-stats li.spotlight span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3966                jQuery('.lpcampain-spotlight .greencheck').removeClass('graycheck');
3967            }
3968            if ($this.val() == "lp_top_in_search_page_ads") {
3969                jQuery('.lp-invoices-all-stats li.searchpage span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3970                jQuery('.lpcampain-topsearch .greencheck').removeClass('graycheck');
3971            }
3972            if ($this.val() == "lp_detail_page_ads") {
3973                jQuery('.lp-invoices-all-stats li.detailpage span i.fa-check-circle').removeClass('lp-gray-this-ccircle');
3974                jQuery('.lpcampain-sidebar .greencheck').removeClass('graycheck');
3975            }
3976
3977        } else {
3978
3979
3980            if ($this.val() == "lp_random_ads") {
3981                jQuery('.lp-invoices-all-stats li.spotlight span i.fa-check-circle').addClass('lp-gray-this-ccircle');
3982                jQuery('.lpcampain-spotlight .greencheck').addClass('graycheck');
3983            }
3984            if ($this.val() == "lp_top_in_search_page_ads") {
3985                jQuery('.lp-invoices-all-stats li.searchpage span i.fa-check-circle').addClass('lp-gray-this-ccircle');
3986                jQuery('.lpcampain-topsearch .greencheck').addClass('graycheck');
3987            }
3988            if ($this.val() == "lp_detail_page_ads") {
3989                jQuery('.lp-invoices-all-stats li.detailpage span i.fa-check-circle').addClass('lp-gray-this-ccircle');
3990                jQuery('.lpcampain-sidebar .greencheck').addClass('graycheck');
3991            }
3992
3993        }
3994
3995
3996    });
3997
3998    /* on type in days */
3999    jQuery(document).on('input', "input[name=adsduration_pd]", function () {
4000        jQuery(this).val(jQuery(this).val().replace(/[^\d].+/, ""));
4001        $thisval = jQuery(this).val();
4002        lp_set_camp_duration_price_in_preview($thisval);
4003        lp_make_campaign_paybutton_active();
4004
4005
4006    });
4007
4008    jQuery(document).on('click', ".lp-view-all-btn", function () {
4009        location.reload();
4010    });
4011
4012
4013    /* exit preview */
4014    jQuery('button.lp-exist-preview').on('click', function () {
4015        jQuery('.lp_campaign_preview').hide(300);
4016        jQuery('.lp_selected_active_ad').hide(300);
4017        jQuery('.lp_campaign_invoice_pmethod').show(300);
4018    });
4019
4020    /* click on pay now btn */
4021    jQuery('button.lp_campaign_paynow').on('click', function () {
4022        //jQuery(this).attr('type', 'submit');
4023        jQuery('.lp_campaign_preview').hide(300);
4024        //jQuery('.lp_selected_active_ad').show(300);
4025        jQuery('.lp_campaign_invoice_pmethod').show(300);
4026        jQuery(this).addClass('startpayforcampaignsss');
4027    });
4028
4029    /* campaign popup code ends */
4030
4031
4032    /* on type on ads price input */
4033    jQuery("input[name=adsprice_pc]").keyup(function () {
4034        $thisval = jQuery(this).val();
4035        lp_set_camp_budget_price_in_preview($thisval);
4036        lp_make_campaign_paybutton_active();
4037
4038    });
4039
4040    jQuery("input[name=adsduration_pd]").keyup(function () {
4041        lp_make_campaign_paybutton_active();
4042    });
4043
4044
4045    jQuery('.lp-search-listing-camp').on('change', function () {
4046        lp_make_campaign_paybutton_active();
4047    });
4048
4049    jQuery('.lpadspreview').on('click', function () {
4050        packeg = '';
4051        jQuery('.lploading').fadeIn();
4052        clicks = jQuery(this).attr('data-clicks');
4053        mode = jQuery(this).attr('data-mode');
4054        budget = jQuery(this).attr('data-budget');
4055        credit = jQuery(this).attr('data-credit');
4056        duration = jQuery(this).attr('data-duration');
4057        method = jQuery(this).attr('data-method');
4058        currency = jQuery(this).attr('data-currency');
4059        transid = jQuery(this).attr('data-transid');
4060        packeg = jQuery(this).attr('data-packeg0');
4061        packeg1 = jQuery(this).attr('data-packeg1');
4062        if (packeg1) {
4063            packeg += packeg1;
4064        }
4065        packeg2 = jQuery(this).attr('data-packeg2');
4066        if (packeg2) {
4067            packeg += packeg2;
4068        }
4069        if (mode == 'perclick') {
4070            jQuery('#lp-ad-click-inner').show();
4071            jQuery('.adsremaining').html(credit);
4072            jQuery('#lp-ad-click-inner').find('.lp-total-clicks-inner').find('h4').text(clicks);
4073
4074            taxPrice = jQuery(this).attr('data-taxPrice');
4075            budgetwithTax = jQuery(this).attr('data-budgetwithTax');
4076            jQuery('.lp-ad-payment-tax-price').html(taxPrice).show();
4077            jQuery('.lp-ad-payment-with-tax').html(budgetwithTax).show();
4078        } else {
4079            jQuery('.lp-ad-payment-tax-price').hide();
4080            jQuery('.lp-ad-payment-with-tax').hide();
4081            jQuery('#lp-ad-click-inner').hide();
4082            jQuery('.adsremaining').html(duration);
4083        }
4084
4085        jQuery('.lp-ad-all-attached-packages').html(packeg);
4086        jQuery('.lp-ad-payment-price').html(budget);
4087        jQuery('.lp-ad-payment-method').html(method);
4088        jQuery('.adstransid').html(transid);
4089
4090        jQuery('.lploading').fadeOut();
4091
4092
4093    });
4094
4095});
4096
4097
4098jQuery(document).ready(function () {
4099    jQuery('.lp-claim-plan-btn').click(function () {
4100        $sPlanID = jQuery('input[name=plan_id]:checked').val();
4101        if (typeof $sPlanID !== 'undefined' && typeof $sPlanID !== undefined && $sPlanID !== '') {
4102            jQuery('input[name=lp_claimed_plan]').val($sPlanID);
4103            jQuery('.lp-claim-plan-container').addClass('active');
4104            jQuery('.lp-claim-plans').addClass('active');
4105        }
4106    });
4107});
4108
4109jQuery(document).ready(function () {
4110    jQuery('.lp-confi-bottom-bar').click(function () {
4111        jQuery('.lp_confirmation').slideToggle(700);
4112        jQuery('.unhidebar-section').slideToggle(700);
4113    });
4114
4115    jQuery('.unhidebar-section').click(function () {
4116        jQuery('.lp_confirmation').slideToggle(700);
4117        jQuery('.unhidebar-section').slideToggle(700);
4118    });
4119    // dashboard search bar click to show
4120    jQuery('.lp-filter-search-listing').click(function () {
4121        jQuery('.lp-dash-search-stats-inner').slideToggle(400);
4122    });
4123});
4124
4125// remove class dashboard menu width less then 768
4126jQuery(window).resize(function () {
4127    if (jQuery(window).width() < 768) {
4128        jQuery('.lp-dashboard-new').removeClass('active');
4129    }
4130});
4131/* aq on 31-7 */
4132
4133/*----------------lead form customizer---*/
4134jQuery(document).ready(function () {
4135    /*-------Lead form success area remove------*/
4136    jQuery('.lp-cross-suces-layout').click(function () {
4137        jQuery('.lp-lead-success-msg-outer').fadeOut('700');
4138    });
4139
4140    //lead form label color change on radio checked and unchecked
4141    jQuery('.lp-lead-radio-container input[type=radio]').click(function () {
4142        jQuery('.lp-lead-radio-container input[type=radio]:not(:checked)').parent().removeClass("active-radio");
4143        jQuery('.lp-lead-radio-container input[type=radio]:checked').parent().addClass("active-radio");
4144    });
4145    //lead form label color change on checkbox checked and unchecked
4146    jQuery('.lp-lead-check-container input[type=checkbox]').click(function () {
4147        jQuery('.lp-lead-check-container input[type=checkbox]:not(:checked)').parent().removeClass("active-checkbox");
4148        jQuery('.lp-lead-check-container input[type=checkbox]:checked').parent().addClass("active-checkbox");
4149    });
4150    // range slide color fill on move
4151    jQuery('input[type="range"].lp-range-slide').change(function () {
4152        var val = (jQuery(this).val() - jQuery(this).attr('min')) / (jQuery(this).attr('max') - jQuery(this).attr('min'));
4153        jQuery(this).css('background-image',
4154            '-webkit-gradient(linear, left top, right top, ' +
4155            'color-stop(' + val + ', #b3c0ce), ' +
4156            'color-stop(' + val + ', #eef2f4)' +
4157            ')'
4158        );
4159    });
4160    // time picker
4161    if (jQuery('.datetimepicker1').length != 0) {
4162        var timeFormat = 'LT';
4163        if (jQuery('#wp-timeformat').val() == 'H:i') {
4164            timeFormat = 'HH:mm';
4165        }
4166
4167        jQuery('.datetimepicker1').datetimepicker({
4168            format: timeFormat,
4169        });
4170    }
4171
4172    // calender picker
4173    if (jQuery('.datetimepicker2').length != 0) {
4174        jQuery('.datetimepicker2').datetimepicker({
4175            format: 'L'
4176        });
4177    }
4178
4179    // calender and time picker
4180    if (jQuery('.datetimepicker3').length != 0) {
4181        jQuery('.datetimepicker3').datetimepicker();
4182    }
4183
4184});
4185/* on 4auguest by z */
4186jQuery(document).ready(function () {
4187    jQuery('#listings_checkout_form').on('submit', function (e) {
4188        var $this = jQuery(this);
4189        var method = $this.find('input[name="plan"]:checked').val();
4190        if (method === 'paypal') {
4191            if (jQuery('input[name="lp-recurring-option"]:checked').length > 0 && jQuery('input[name="plan_time"]').val() == '') {
4192                alert('Sorry! A plan should have a duration for recurring payment');
4193                return false;
4194            }
4195        }
4196    });
4197
4198    /* for checkout stripe and 2checkout */
4199    jQuery('#listings_checkout_form').on('submit', function (e) {
4200        var $this = jQuery(this);
4201
4202        method = $this.find('input[name="plan"]:checked').val();
4203        listing_id = $this.find('input[name="listing_id"]:checked').val();
4204        post_title = $this.find('input[name="listing_id"]:checked').data('title');
4205        errormsg = jQuery('input[name="errormsg"]').val();
4206        plan_price = jQuery('span.lp-subtotal-total-price').data('subtotal');
4207        currency = jQuery('input[name=currency]').val();
4208        if (method === 'stripe') {
4209            if (jQuery('input[name="lp-recurring-option"]:checked').length > 0 && jQuery('input[name="plan_time"]').val() == '') {
4210                alert('Sorry! A plan should have a duration for recurring payment');
4211                return false;
4212            } else {
4213                plan_price = plan_price * 100;
4214                //jQuery('#stripe-submit').trigger( "click" );
4215                handler.open({
4216                    name: post_title,
4217                    description: "",
4218                    zipCode: true,
4219                    amount: plan_price,
4220                    currency: currency,
4221                });
4222                e.preventDefault();
4223            }
4224        } else if (method === '2checkout') {
4225            plan_price = jQuery('span.lp-subtotal-total-price').data('subtotal');
4226            listing_id = $this.find('input[name="listing_id"]:checked').val();
4227            jQuery('#myCCForm input#tprice').val(plan_price);
4228            jQuery('#myCCForm input#listing_id').val(listing_id);
4229            jQuery("button.lp-2checkout-modal").trigger('click');
4230            e.preventDefault();
4231        }
4232
4233    });
4234
4235    jQuery('.lp_payment_methods_ads .lp-payement-images').on('click', function (e) {
4236
4237        $this = jQuery(this);
4238        lp_make_campaign_paybutton_active();
4239
4240    });
4241
4242    jQuery('button.lp-add-new-btn').on('click', function () {
4243        jQuery('.lp_camp_invoice_wrp').fadeOut(function () {
4244            jQuery('.lp-ad-step-two').fadeIn();
4245        });
4246    });
4247
4248    jQuery('a.lp-all-camp-bck').on('click', function (e) {
4249        jQuery('.lp-ad-step-two').hide(300);
4250        jQuery('.lp_camp_invoice_wrp').show(300);
4251        e.preventDefault();
4252    });
4253
4254});
4255/* on 4auguest by z ends */
4256/* ends here */
4257
4258/* =====================for mini sub-total================== */
4259function lp_show_mini_subtotal() {
4260
4261    var $tax = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxenable');
4262    var $taxRate = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxrate');
4263    var $method = jQuery('#listings_checkout_form input[name=plan]:checked').val();
4264    var $price = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('planprice');
4265    var $orgPrice = $price;
4266    var $orgPrice = parseFloat($orgPrice).toFixed(2);
4267    var $planID = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('planid');
4268    var $planTime = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('plantime');
4269    var $listingID = jQuery('#listings_checkout_form input[name=listing_id]:checked').val();
4270    var $lpRecurring = jQuery('#listings_checkout_form .lp-onoff-switch-checkbox .switch-checkbox-label .switch-checkbox-label input:checked').val();
4271    var $taxPrice = '';
4272    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4273    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4274    if ($tax == "1") {
4275        $taxPrice = ($taxRate / 100) * $price;
4276        $price = parseFloat($price) + parseFloat($taxPrice);
4277
4278        $taxPrice = parseFloat($taxPrice).toFixed(2);
4279    }
4280    $price = parseFloat($price).toFixed(2);
4281    jQuery('span.lp-subtotal-plan').text('');
4282    jQuery('span.lp-subtotal-price').text('');
4283    jQuery('span.lp-subtotal-taxamount').text('');
4284    jQuery('span.lp-subtotal-price').text('');
4285    jQuery('span.lp-subtotal-p-price').text('');
4286    jQuery('span.lp-subtotal-total-price').text('');
4287    jQuery('span.lp-subtotal-plan').text(jQuery('#listings_checkout_form input[name=listing_id]:checked').data('title'));
4288    //setting values in form
4289    lp_add_checkout_data_fields($listingID, $planID, $price, $lpRecurring, $method, $planTime);
4290    switch ($currencyPos) {
4291        case ('left'):
4292            jQuery('span.lp-subtotal-p-price').text($currencySym + $orgPrice);
4293            jQuery('span.lp-subtotal-price').text($currencySym + $price);
4294            jQuery('span.lp-subtotal-taxamount').text($currencySym + $taxPrice);
4295            jQuery('span.lp-subtotal-total-price').text($currencySym + $price);
4296            jQuery('span.lp-subtotal-total-price').attr('data-subtotal', $price);
4297            break;
4298        case ('right'):
4299            jQuery('span.lp-subtotal-p-price').text($orgPrice + $currencySym);
4300            jQuery('span.lp-subtotal-price').text($price + $currencySym);
4301            jQuery('span.lp-subtotal-taxamount').text($taxPrice + $currencySym);
4302            jQuery('span.lp-subtotal-total-price').text($price + $currencySym);
4303            jQuery('span.lp-subtotal-total-price').attr('subtotal', $price);
4304            break;
4305        default:
4306            jQuery('span.lp-subtotal-p-price').text($currencySym + $orgPrice);
4307            jQuery('span.lp-subtotal-price').text($currencySym + $price);
4308            jQuery('span.lp-subtotal-taxamount').text($currencySym + $taxPrice);
4309            jQuery('span.lp-subtotal-total-price').text($currencySym + $price);
4310            jQuery('span.lp-subtotal-total-price').attr('datasubtotal', $price);
4311
4312    }
4313
4314
4315    jQuery('.lp-checkout-coupon-outer').css('display', 'block');
4316    jQuery('.active-checkout-listing').addClass('lp-checkout-wrapper-new-without-radius');
4317}
4318
4319/* ====================function for recurring option====================== */
4320
4321function lp_show_recurring_switch() {
4322    var $sPlan = jQuery('input[name=plan]:checked').val();
4323    if ($sPlan == "stripe" || $sPlan == "paypal") {
4324        jQuery('.lp-checkout-recurring-wrap').css('display', 'block');
4325    } else if ($sPlan == "wire") {
4326        jQuery('.lp-checkout-recurring-wrap input[name="lp-recurring-option"]').prop("checked", false);
4327        jQuery('.lp-checkout-recurring-wrap').css('display', 'none');
4328    }
4329}
4330
4331/* ====================function for recurring option====================== */
4332
4333function lp_add_checkout_data_fields(listingID, planID, price, recurring, method, $planTime) {
4334    var $tax = jQuery('#listings_checkout_form input[name=listing_id]:checked').data('taxenable');
4335    jQuery('input[name=post_id]').val(listingID);
4336    jQuery('input[name=method]').val(method);
4337    if ($tax == '1') {
4338        jQuery('input[name=listings_tax_price]').val(price);
4339    }
4340    jQuery('input[name=prc_plan]').val(planID);
4341    jQuery('input[name=lprecurring]').val(recurring);
4342    jQuery('input[name=plan_time]').val($planTime);
4343}
4344
4345/* ==================== function to show active fields of coupons============ */
4346function lp_make_couponsfields_active() {
4347    jQuery('input.coupon-text-field').prop('disabled', false);
4348    jQuery('button.coupon-apply-bt').prop('disabled', false);
4349}
4350
4351/* ==================== function to show disable fields of coupons============ */
4352function lp_make_couponsfields_passive() {
4353    jQuery('input.coupon-text-field').prop('disabled', true);
4354    jQuery('button.coupon-apply-bt').prop('disabled', true);
4355}
4356
4357/* ====================function for adding data in input hidden fields=========*/
4358
4359function lp_add_checkout_data_fields_in_form(listingID, post_title, planID, price, $tax, $taxRate) {
4360    jQuery('input[name=plan_price]').val(price);
4361    jQuery('input[name=post_title]').val(post_title);
4362    jQuery('input[name=listings_id]').val(listingID);
4363    jQuery('input[name=post_id]').val(listingID);
4364    jQuery('input[name=plan_id]').val(planID);
4365    if ($tax) {
4366        taxprice = ($taxRate / 100) * price;
4367        taxprice = taxprice.toFixed(2);
4368        jQuery('input[name="listings_tax_price"]').val(taxprice);
4369    }
4370    lp_update_date_in_mini_cart(price, $tax, $taxRate);
4371}
4372
4373/* ====================function for update data in mini cart====================*/
4374function lp_update_date_in_mini_cart($price, $tax, $taxRate) {
4375
4376    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4377    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4378    var $orgPrice = $price;
4379    var $orgPrice = parseFloat($orgPrice).toFixed(2);
4380    var $taxPrice = '';
4381    var $currencyPos = jQuery('#listings_checkout_form').data('currencypos');
4382    var $currencySym = jQuery('#listings_checkout_form').data('currencysymbol');
4383    if ($tax == "1") {
4384        $taxPrice = ($taxRate / 100) * $price;
4385        $price = parseFloat($price) + parseFloat($taxPrice);
4386        $price = parseFloat($price).toFixed(2);
4387
4388        $taxPrice = parseFloat($taxPrice).toFixed(2);
4389    }
4390
4391    switch ($currencyPos) {
4392        case ('left'):
4393            //jQuery('span.lp-subtotal-p-price').text($currencySym+$orgPrice);
4394            jQuery('span.lp-subtotal-price').text($currencySym + $price);
4395            jQuery('span.lp-subtotal-taxamount').text($currencySym + $taxPrice);
4396            jQuery('span.lp-subtotal-total-price').text($currencySym + $price);
4397            jQuery('span.lp-subtotal-total-price').attr('data-subtotal', $price);
4398            break;
4399        case ('right'):
4400            //jQuery('span.lp-subtotal-p-price').text($orgPrice+$currencySym);
4401            jQuery('span.lp-subtotal-price').text($price + $currencySym);
4402            jQuery('span.lp-subtotal-taxamount').text($taxPrice + $currencySym);
4403            jQuery('span.lp-subtotal-total-price').text($price + $currencySym);
4404            jQuery('span.lp-subtotal-total-price').attr('data-subtotal', $price);
4405            break;
4406        default:
4407            jQuery('span.lp-subtotal-p-price').text($currencySym + $orgPrice);
4408            jQuery('span.lp-subtotal-price').text($currencySym + $price);
4409            jQuery('span.lp-subtotal-taxamount').text($currencySym + $taxPrice);
4410            jQuery('span.lp-subtotal-total-price').text($currencySym + $price);
4411            jQuery('span.lp-subtotal-total-price').attr('data-subtotal', $price);
4412
4413    }
4414}
4415
4416/* =====================reset mincart and checkout data  ======================== */
4417function lp_reset_mincart_checkout_form_data() {
4418    var $price = jQuery('input[name=listing_id]:checked').data('planprice');
4419    var $listingID = jQuery('input[name=listing_id]:checked').val();
4420    var $post_title = jQuery('input[name=listing_id]:checked').data('title');
4421    var $planID = jQuery('input[name=listing_id]:checked').data('planid');
4422    var $tax = jQuery('input[name=listing_id]:checked').data('taxenable');
4423    var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate');
4424    lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $price, $tax, $taxRate);
4425}
4426
4427/* =====================active checkout steps bar  ======================== */
4428function lp_make_checkout_step_active($stepname) {
4429    jQuery('.lp_payment_steps_area li.' + $stepname + '').addClass('current');
4430}
4431
4432/* =====================active checkout steps bar  ======================== */
4433function lp_make_checkout_step_passive($stepname) {
4434    jQuery('.lp_payment_steps_area li.' + $stepname + '').removeClass('current');
4435}
4436
4437/* =====================active checkout steps button on all selections ======================== */
4438function lp_make_campaign_paybutton_active() {
4439    var selected_option = jQuery('.lp-search-listing-camp').val();
4440    var atLeastOnePlaceAd = jQuery('input[name="lpadsoftype[]"]:checked').length > 0;
4441    var atLeastOneMethodAd = jQuery('input[name="method"]:checked').length > 0;
4442    var adsterms = jQuery('#lp-campaignTerms:checked').length > 0;
4443
4444    var adPriceField = 1;
4445    var adDurationField = 1;
4446
4447    if (jQuery('input[name="adsduration_pd"]').length > 0) {
4448        adDurationField = jQuery('input[name="adsduration_pd"]').val();
4449    }
4450
4451    if (jQuery('input[name="adsprice_pc"]').length > 0) {
4452        adPriceField = jQuery('input[name="adsprice_pc"]').val();
4453    }
4454
4455    if (selected_option != '' && selected_option != '0' && atLeastOnePlaceAd != '' && adsterms != '' && adsterms != '0' && atLeastOnePlaceAd != '0' && atLeastOneMethodAd != '' && atLeastOneMethodAd != '0' && adDurationField != '' && adDurationField != '0' && adPriceField != '' && adPriceField != '0') {
4456        jQuery('button.lp_campaign_paynow').attr('disabled', false);
4457        jQuery('button.lp_campaign_paynow').attr('type', 'submit');
4458    } else {
4459        jQuery('button.lp_campaign_paynow').attr('disabled', true);
4460        jQuery('button.lp_campaign_paynow').attr('type', 'button');
4461    }
4462}
4463
4464jQuery(document).on('click', '#lp-campaignTerms', function () {
4465    lp_make_campaign_paybutton_active();
4466});
4467
4468jQuery(document).on('click', '.show-loop-map-popup', function (e) {
4469    e.preventDefault();
4470    if (jQuery('#grid-show-popup').is('.md-show')) {
4471    } else {
4472        jQuery('#grid-show-popup').modal({
4473            show: 'true'
4474        });
4475        jQuery('#grid-show-popup').addClass('md-show');
4476    }
4477    var $this = jQuery(this),
4478        LAT = $this.data('lat'),
4479        LNG = $this.data('lng'),
4480        LPpostID = $this.data('lid');
4481
4482    jQuery.ajax({
4483        url: ajax_search_term_object.ajaxurl,
4484        data: {
4485            'action': 'show_map_pop_cb',
4486            'LPpostID': LPpostID,
4487            'lpNonce': jQuery('#lpNonce').val()
4488        },
4489        success: function (data) {
4490
4491            jQuery('#grid-show-popup .grid-show-popup').html(data);
4492            var markerSrc = jQuery('#grid-show-popup .grid-show-popup .quickmap').attr('data-marker-src');
4493            var markers = false;
4494            $mtoken = jQuery('#page').data("mtoken");
4495            $mtype = jQuery('#page').data("mtype");
4496            $siteURL = jQuery('#page').data("site-url");
4497            $lat = LAT;
4498            $lan = LNG;
4499            if ($mtoken != '' && $mtype == 'mapbox') {
4500                L.mapbox.accessToken = $mtoken;
4501                map = L.mapbox.map('quickmap' + LPpostID);
4502                L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
4503                    id: jQuery('#page').data("mstyle"),
4504                    accessToken: jQuery('#page').data("mtoken")
4505                }).addTo(map);
4506            } else {
4507                var map = new L.Map('quickmap' + LPpostID, {center: new L.LatLng($lat, $lan), zoom: 14});
4508                if ($mtype == 'google') {
4509                    var googleLayer = new L.Google('ROADMAP');
4510                    map.addLayer(googleLayer);
4511                } else {
4512                    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
4513                }
4514            }
4515            map.setView([$lat, $lan], 14);
4516            markers = new L.MarkerClusterGroup();
4517            var markerLocation = new L.LatLng($lat, $lan); // London
4518            var CustomHtmlIcon = L.HtmlIcon.extend({
4519                options: {
4520                    html: "<div class='lpmap-icon-shape pin '><div class='lpmap-icon-contianer'><img alt='image' src='" + markerSrc + "'  /></div></div>",
4521                }
4522            });
4523            var customHtmlIcon = new CustomHtmlIcon();
4524            var marker = new L.Marker(markerLocation, {icon: customHtmlIcon}).bindPopup('').addTo(map);
4525            markers.addLayer(marker);
4526            jQuery('.md-close.widget-map-click').click(function (e) {
4527                var loaderImg = jQuery('#grid-show-popup .grid-show-popup').data('loader');
4528                jQuery('#full-overlay').remove();
4529                jQuery('#grid-show-popup .grid-show-popup').html('<img alt="image" src="' + loaderImg + '" />');
4530            });
4531            //alert(data.cats_markup);
4532        },
4533        error: function (errorThrown) {
4534            alert(errorThrown);
4535        }
4536    });
4537});
4538
4539jQuery(document).on('click', '.open-multi-rate-box', function (e) {
4540    e.preventDefault();
4541    var $this = jQuery(this),
4542        targetBox = '#' + $this.data('rate-box');
4543    jQuery(targetBox).slideToggle(500);
4544});
4545
4546jQuery('button.printthisinvoice').click(function (e) {
4547
4548    var printContents = document.querySelector('#listing-invoices-popup .modal-body').innerHTML;
4549    var originalContents = document.body.innerHTML;
4550    document.body.innerHTML = printContents;
4551    window.print();
4552    document.body.innerHTML = originalContents;
4553    location.reload();
4554    e.preventDefault();
4555
4556});
4557
4558jQuery(document).ready(function () {
4559    if (jQuery('.lp-user-listings.active-checkout-listing').length) {
4560        jQuery(".lp-user-listings").each(function (index) {
4561            if (jQuery(this).hasClass('active-checkout-listing')) {
4562            } else {
4563                jQuery(this).remove();
4564            }
4565
4566        });
4567    }
4568
4569});
4570
4571// App view menu in tabs
4572jQuery(document).ready(function () {
4573    jQuery('.lp-menu-type-heading').on('click', function () {
4574        //jQuery('.lp-menu-type-heading').removeClass('active');
4575        jQuery(this).toggleClass('active');
4576        jQuery('.active-menu-toggle').slideUp('slow', function () {
4577            jQuery('.active-menu-toggle').removeClass('active-menu-toggle')
4578        });
4579        var getmenutype = '.' + jQuery(this).attr("data-target");
4580        jQuery(getmenutype).slideToggle('slow');
4581    });
4582    jQuery('.lp-appview-group-heading').on('click', function () {
4583        //jQuery('.lp-appview-group-heading').removeClass('active');
4584        jQuery(this).toggleClass('active');
4585        var getmenugroup = '.' + jQuery(this).attr("data-target");
4586        //jQuery('.lp-appview-menu-items-bygroup').slideUp('slow');
4587        jQuery(this).next(getmenugroup).slideToggle('slow');
4588    })
4589});
4590
4591
4592jQuery(document).ready(function () {
4593
4594    //dashboard weekly monthly active
4595    jQuery('.lp_stats_duration_filter li button').on('click', function () {
4596
4597        jQuery('.lp_stats_duratonBtn').removeClass('active');
4598
4599        jQuery(this).addClass('active');
4600
4601    });
4602
4603
4604    //If width is less than 640
4605    if (jQuery(window).width() < 641) {
4606        jQuery('#main_icon').on('click', function () {
4607            jQuery('#main_icon').toggleClass('fa fa-times');
4608            jQuery('#sidebar').toggle(300);
4609        });
4610    }
4611
4612
4613    //New archive style grid switcher
4614    jQuery('.lp-grid-two').on('click', function () {
4615
4616
4617        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width1');
4618        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width3');
4619
4620        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width2');
4621        jQuery('.lp-grid-two').addClass('active');
4622        jQuery('.lp-grid-one').removeClass('active');
4623        jQuery('.lp-grid-three').removeClass('active');
4624
4625    });
4626    jQuery('.lp-grid-one').on('click', function () {
4627
4628        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width2');
4629        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width3');
4630
4631        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width1');
4632        jQuery('.lp-grid-one').addClass('active');
4633        jQuery('.lp-grid-two').removeClass('active');
4634        jQuery('.lp-grid-three').removeClass('active');
4635
4636    });
4637    jQuery('.lp-grid-three').on('click', function () {
4638
4639        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width1');
4640        jQuery('.lp-sidebar-filters-style').removeClass('lp-grid-width2');
4641
4642        jQuery('.lp-sidebar-filters-style').addClass('lp-grid-width3');
4643        jQuery('.lp-grid-three').addClass('active');
4644        jQuery('.lp-grid-two').removeClass('active');
4645        jQuery('.lp-grid-one').removeClass('active');
4646    });
4647
4648
4649});
4650
4651
4652jQuery(document).on('click', '.app-view-popup-style', function () {
4653    jQuery('<div id="full-overlay-lp"></div>').insertBefore("#app-view-login-popup");
4654    jQuery("#full-overlay-lp").css({
4655        "width": "100vw",
4656        "height": "100vh",
4657        "position": "fixed",
4658        "background": "#000000c7",
4659        "z-index": 3,
4660        "top": 0,
4661        "left": 0
4662    });
4663    jQuery(".md-close i").click(function () {
4664        jQuery('#full-overlay-lp').remove();
4665        jQuery('#app-view-login-popup').fadeOut(function () {
4666            jQuery('#app-view-login-popup').css({
4667                //'opacity': 0,
4668                'display': 'none'
4669            });
4670        });
4671    });
4672});
4673
4674/* ======function to get currency symbol===== */
4675
4676function lp_get_currency_sysmbol() {
4677    $code = jQuery('#lp-new-ad-compaignForm').data('camp-currency');
4678    return $code;
4679}
4680
4681/* ======function to get tax percent===== */
4682
4683function lp_get_tax_percent() {
4684    $code = jQuery('#lp-new-ad-compaignForm').data('tax-percent');
4685    return $code;
4686}
4687
4688/* ======function to get selected campaigns org price===== */
4689
4690function lp_get_selected_camp_price() {
4691    $totalCamPrice = 0;
4692    jQuery('input[name="lpadsoftype[]"]:checked').each(function () {
4693        $thisAd = jQuery(this).data('orgprice');
4694        $totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4695    });
4696    //console.log($totalCamPrice);
4697    return $totalCamPrice;
4698
4699}
4700
4701/* ======function to get selected campaigns with tax price===== */
4702function lp_get_selected_camp_withtax_price() {
4703    $totalCamPrice = 0;
4704    jQuery('input[name="lpadsoftype[]"]:checked').each(function () {
4705        $thisAd = jQuery(this).data('price');
4706        $totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4707    });
4708    //console.log($totalCamPrice);
4709    return $totalCamPrice;
4710
4711}
4712
4713/* ======function to get tax price of campaigns===== */
4714function lp_get_selected_camp_onlytax_price() {
4715    $totalCamPrice = 0;
4716    jQuery('input[name="lpadsoftype[]"]:checked').each(function () {
4717        $thisAd = jQuery(this).data('taxprice');
4718        $totalCamPrice = parseFloat($totalCamPrice) + parseFloat($thisAd);
4719    });
4720    //console.log($totalCamPrice);
4721    return $totalCamPrice;
4722
4723}
4724
4725/* ======function to set camp duration price in preview===== */
4726function lp_set_camp_duration_price_in_preview($thisval) {
4727    $daysString = jQuery('.lp-cmp-duration').data('days-text');
4728    $taxPercent = lp_get_tax_percent();
4729    $taxtotalPrice = lp_get_selected_camp_onlytax_price();
4730    $taxtotalPrice = $thisval * $taxtotalPrice;
4731    $taxtotalPrice = $taxtotalPrice.toFixed(2);
4732    jQuery('input[name=taxprice]').val($taxtotalPrice);
4733    jQuery('input[name=ads_days]').val($thisval);
4734    $thisvalWithDays = $thisval + ' ' + $daysString;
4735    jQuery('.lp-cmp-duration h6').text($thisvalWithDays);
4736    $totalCamPrice = lp_get_selected_camp_price();
4737    $totalCamPrice = parseFloat($thisval) * parseFloat($totalCamPrice);
4738    console.log($totalCamPrice);
4739    $totalCamPrice = $totalCamPrice.toFixed(2);
4740    jQuery('.lp-cmp-subtotal h6').text(lp_get_currency_sysmbol() + '' + $totalCamPrice);
4741    $totalCamPriceWithTax = lp_get_selected_camp_withtax_price();
4742    $totalCamPriceWithTax = parseFloat($thisval) * parseFloat($totalCamPriceWithTax);
4743    $totalCamPriceWithTax = $totalCamPriceWithTax.toFixed(2);
4744    console.log($totalCamPriceWithTax);
4745    jQuery('.lp-cmp-alltotal h5').text(lp_get_currency_sysmbol() + '' + $totalCamPriceWithTax);
4746    jQuery('input[name=ads_price]').val($totalCamPriceWithTax);
4747
4748    jQuery('.lp-cmp-taxtotal h6').text($taxtotalPrice);
4749
4750}
4751
4752/* ======function to set camp price in preview===== */
4753function lp_set_camp_budget_price_in_preview($thisval) {
4754    $taxPercent = lp_get_tax_percent();
4755    $thisvalWithCurr = lp_get_currency_sysmbol() + '' + $thisval;
4756    jQuery('.lp-cmp-budget h6').text($thisvalWithCurr);
4757    jQuery('.lp-cmp-subtotal h6').text($thisvalWithCurr);
4758    $taxPrice = 0;
4759    if ($taxPercent) {
4760        $taxPrice = ($taxPercent / 100) * $thisval;
4761        $taxPrice = $taxPrice.toFixed(2);
4762        jQuery('input[name=taxprice]').val($taxPrice);
4763        $taxPriceWithCurr = lp_get_currency_sysmbol() + '' + $taxPrice;
4764        jQuery('.lp-cmp-taxtotal h6').text($taxPriceWithCurr);
4765
4766    }
4767
4768    $totalAmount = parseFloat($thisval) + parseFloat($taxPrice);
4769    jQuery('input[name=ads_price]').val($totalAmount);
4770    jQuery('.lp-cmp-alltotal h5').text(lp_get_currency_sysmbol() + '' + $totalAmount);
4771}
4772
4773/* ======function to set camp type===== */
4774function lp_get_camp_type() {
4775    $camptype = jQuery('#lp-new-ad-compaignForm').data('type');
4776    return $camptype;
4777}
4778
4779
4780// Add hours
4781jQuery(document).on('click', 'button.add-hours', function (event) {
4782    event.preventDefault();
4783    var $this = jQuery(this);
4784    var lp2times = $this.closest('#day-hours-BusinessHours').data('lpenabletwotimes');
4785    var sorryMsg = jQuery(this).data('sorrymsg');
4786    var alreadyadded = jQuery(this).data('alreadyadded');
4787    var error = false;
4788    var fullday = '';
4789    var fullhoursclass = '';
4790
4791    var lpdash = "~";
4792
4793    if (lp2times == "disable") {
4794
4795        var weekday = jQuery('select.weekday').val();
4796        if (jQuery(".fulldayopen").is(":checked")) {
4797            jQuery('.fulldayopen').attr('checked', false);
4798            jQuery('select.hours-start').prop("disabled", false);
4799            jQuery('select.hours-end').prop("disabled", false);
4800            var startVal = '';
4801            var endVal = '';
4802            var hrstart = '';
4803            var hrend = '';
4804            fullday = $this.data('fullday');
4805            fullhoursclass = 'fullhours';
4806            lpdash = "";
4807        } else {
4808            var startVal = jQuery('select.hours-start').val();
4809            var endVal = jQuery('select.hours-end').val();
4810            var hrstart = jQuery('select.hours-start').find('option:selected').val();
4811            var hrend = jQuery('select.hours-end').find('option:selected').val();
4812
4813            var startVal_digit = hrstart.replace(':', '');
4814            var endVal_digit = hrend.replace(':', '');
4815
4816            if (startVal_digit.indexOf('am') > -1) {
4817                startVal_digit = startVal_digit.replace('am', '');
4818            } else if (startVal_digit.indexOf('pm') > -1) {
4819                startVal_digit = startVal_digit.replace('pm', '');
4820                if (startVal_digit != '1200' && startVal_digit != '1230') {
4821                    startVal_digit = parseInt(startVal_digit) + 1200;
4822                }
4823            }
4824            if (endVal_digit.indexOf('am') > -1) {
4825                endVal_digit = endVal_digit.replace('am', '');
4826                endVal_digit = parseInt(endVal_digit);
4827                if (endVal_digit >= 1200) {
4828                    endVal_digit = parseInt(endVal_digit) - 1200;
4829                }
4830
4831            } else if (endVal_digit.indexOf('pm') > -1) {
4832                endVal_digit = endVal_digit.replace('pm', '');
4833                endVal_digit = parseInt(endVal_digit) + 1200;
4834            }
4835
4836            if (startVal_digit > endVal_digit) {
4837                nextWeekday = jQuery("select.weekday option:selected+option").val();
4838                if (typeof nextWeekday === "undefined") {
4839                    nextWeekday = jQuery("select.weekday").find("option:first-child").val();
4840                }
4841
4842                weekday = weekday + "~" + nextWeekday;
4843            }
4844
4845
4846        }
4847
4848
4849        if ($this.hasClass('lp-add-hours-st')) {
4850            var remove = '<i class="fa fa-times"></i>';
4851        } else {
4852            var remove = jQuery(this).data('remove');
4853        }
4854        jQuery('.hours-display .hours').each(function (index, element) {
4855            var weekdayTExt = jQuery(element).children('.weekday').text();
4856            if (weekdayTExt == weekday) {
4857                alert(sorryMsg + '! ' + weekday + ' ' + alreadyadded);
4858                error = true;
4859            }
4860        });
4861        if (error != true) {
4862            jQuery('.hours-display').append("<div class='hours " + fullhoursclass + "'><span class='weekday'>" + weekday + "</span><span class='start-end fullday'>" + fullday + "</span><span class='start'>" + hrstart + "</span><span>" + lpdash + "</span><span class='end'>" + hrend + "</span><a class='remove-hours' href='#'>" + remove + "</a><input name='business_hours[" + weekday + "][open]' value='" + startVal + "' type='hidden'><input name='business_hours[" + weekday + "][close]' value='" + endVal + "' type='hidden'></div>");
4863            var current = jQuery('select.weekday').find('option:selected');
4864            var nextval = current.next();
4865            current.removeAttr('selected');
4866            nextval.attr('selected', 'selected');
4867            jQuery('select.weekday').trigger('change.select2');
4868        }
4869    } else {
4870        var lptwentlyfourisopen = '';
4871        /* 2times */
4872        var weekday = jQuery('select.weekday').val();
4873        var weekday1 = weekday;
4874        var weekday2 = weekday;
4875
4876        if (jQuery(".fulldayopen").is(":checked")) {
4877
4878            lptwentlyfourisopen = 'yes';
4879
4880            jQuery('.fulldayopen').attr('checked', false);
4881            jQuery('select.hours-start').prop("disabled", false);
4882            jQuery('select.hours-end').prop("disabled", false);
4883
4884            jQuery('select.hours-start2').prop("disabled", false);
4885            jQuery('select.hours-end2').prop("disabled", false);
4886
4887            var startVal1 = '';
4888            var endVal1 = '';
4889            var hrstart1 = '';
4890            var hrend1 = '';
4891
4892            var startVal2 = '';
4893            var endVal2 = '';
4894            var hrstart2 = '';
4895            var hrend2 = '';
4896
4897
4898            fullday = $this.data('fullday');
4899            fullhoursclass = 'fullhours';
4900
4901            lpdash = "";
4902        } else {
4903            var startVal1 = jQuery('select.hours-start').val();
4904            var endVal1 = jQuery('select.hours-end').val();
4905            var hrstart1 = jQuery('select.hours-start').find('option:selected').val();
4906            var hrend1 = jQuery('select.hours-end').find('option:selected').val();
4907
4908            var startVal1_digit = hrstart1.replace(':', '');
4909            var endVal1_digit = hrend1.replace(':', '');
4910
4911            if (startVal1_digit.indexOf('am') > -1) {
4912                startVal1_digit = startVal1_digit.replace('am', '');
4913            } else if (startVal1_digit.indexOf('pm') > -1) {
4914                startVal1_digit = startVal1_digit.replace('pm', '');
4915                if (startVal1_digit != '1200' && startVal1_digit != '1230') {
4916                    startVal1_digit = parseInt(startVal1_digit) + 1200;
4917                }
4918            }
4919            if (endVal1_digit.indexOf('am') > -1) {
4920                endVal1_digit = endVal1_digit.replace('am', '');
4921                endVal1_digit = parseInt(endVal1_digit);
4922                if (endVal1_digit >= 1200) {
4923                    endVal1_digit = parseInt(endVal1_digit) - 1200;
4924                }
4925            } else if (endVal1_digit.indexOf('pm') > -1) {
4926                endVal1_digit = endVal1_digit.replace('pm', '');
4927                endVal1_digit = parseInt(endVal1_digit) + 1200;
4928            }
4929
4930
4931            if (startVal1_digit > endVal1_digit) {
4932
4933                nextWeekday = jQuery("select.weekday option:selected+option").val();
4934                if (typeof nextWeekday === "undefined") {
4935                    nextWeekday = jQuery("select.weekday").find("option:first-child").val();
4936
4937                }
4938
4939                weekday1 = weekday + "~" + nextWeekday;
4940                jQuery('.hours-display .hours').each(function (e) {
4941                    var $this = jQuery(this);
4942                    if ($this.find('span.weekday:contains("' + weekday1 + '")').length > 0) {
4943                        alert(sorryMsg + '! ' + weekday1 + ' ' + alreadyadded);
4944                        error = true;
4945                    }
4946                });
4947
4948            }
4949
4950
4951            var startVal2 = jQuery('select.hours-start2').val();
4952            var endVal2 = jQuery('select.hours-end2').val();
4953            var hrstart2 = jQuery('select.hours-start2').find('option:selected').text();
4954            var hrend2 = jQuery('select.hours-end2').find('option:selected').text();
4955
4956            var startVal2_digit = hrstart2.replace(':', '');
4957            var endVal2_digit = hrend2.replace(':', '');
4958
4959            if (startVal2_digit.indexOf(' AM') > -1) {
4960                startVal2_digit = parseInt(startVal2_digit.replace(' AM', ''));
4961            } else if (startVal2_digit.indexOf(' PM') > -1) {
4962                startVal2_digit = parseInt(startVal2_digit.replace(' PM', ''));
4963                if (startVal2_digit != '1200' && startVal2_digit != '1230') {
4964                    startVal2_digit = parseInt(startVal2_digit) + 1200;
4965                }
4966            }
4967            if (endVal2_digit.indexOf(' AM') > -1) {
4968                endVal2_digit = endVal2_digit.replace(' AM', '');
4969                endVal2_digit = parseInt(endVal2_digit);
4970                if (endVal2_digit >= 1200) {
4971                    endVal2_digit = parseInt(endVal2_digit) - 1200;
4972                }
4973            } else if (endVal2_digit.indexOf(' PM') > -1) {
4974                endVal2_digit = endVal2_digit.replace(' PM', '');
4975                endVal2_digit = parseInt(endVal2_digit) + 1200;
4976            }
4977            nextWeekday = jQuery("select.weekday option:selected+option").val();
4978            if (typeof nextWeekday === "undefined") {
4979                nextWeekday = jQuery("select.weekday").find("option:first-child").val();
4980            }
4981            weekday2 = weekday;
4982            jQuery('.hours-display .hours').each(function (e) {
4983                var $this = jQuery(this);
4984                if ($this.find('span.weekday:contains("' + weekday2 + '")').length > 0) {
4985                    alert(sorryMsg + '! ' + weekday2 + ' ' + alreadyadded);
4986                    error = true;
4987                }
4988            });
4989        }
4990
4991
4992        if ($this.hasClass('lp-add-hours-st')) {
4993            var remove = '<i class="fa fa-times"></i>';
4994        } else {
4995            var remove = jQuery(this).data('remove');
4996        }
4997        jQuery('.hours-display .hours').each(function (index, element) {
4998            var weekdayTExt = jQuery(element).children('.weekday').text();
4999            if (weekdayTExt == weekday) {
5000                alert(sorryMsg + '! ' + weekday + ' ' + alreadyadded);
5001                error = true;
5002            }
5003        });
5004        if (error != true) {
5005
5006            if ((jQuery(".lp-check-doubletime .enable2ndday").is(":checked")) && (lptwentlyfourisopen === "")) {
5007
5008                jQuery('.hours-display').append("<div class='hours " + fullhoursclass + "'><span class='weekday'>" + weekday + "</span><span class='start-end fullday'>" + fullday + "</span><span class='start'>" + hrstart1 + "</span><span>" + lpdash + "</span><span class='end'>" + hrend1 + "</span><a class='remove-hours' href='#'>" + remove + "</a><br><span class='weekday'>&nbsp;</span><span class='start'>" + hrstart2 + "</span><span>" + lpdash + "</span><span class='end'>" + hrend2 + "</span><input name='business_hours[" + weekday1 + "][open][0]' value='" + startVal1 + "' type='hidden'><input name='business_hours[" + weekday1 + "][close][0]' value='" + endVal1 + "' type='hidden'><input name='business_hours[" + weekday2 + "][open][1]' value='" + startVal2 + "' type='hidden'><input name='business_hours[" + weekday2 + "][close][1]' value='" + endVal2 + "' type='hidden'></div>");
5009            } else {
5010
5011                jQuery('.hours-display').append("<div class='hours " + fullhoursclass + "'><span class='weekday'>" + weekday1 + "</span><span class='start-end fullday'>" + fullday + "</span><span class='start'>" + hrstart1 + "</span><span>" + lpdash + "</span><span class='end'>" + hrend1 + "</span><a class='remove-hours' href='#'>" + remove + "</a><input name='business_hours[" + weekday1 + "][open]' value='" + startVal1 + "' type='hidden'><input name='business_hours[" + weekday1 + "][close]' value='" + endVal1 + "' type='hidden'></div>");
5012            }
5013            var current = jQuery('select.weekday').find('option:selected');
5014            var nextval = current.next();
5015            current.removeAttr('selected');
5016            nextval.attr('selected', 'selected');
5017            jQuery('select.weekday').trigger('change.select2');
5018        }
5019
5020        /* 2times */
5021    }
5022});
5023
5024
5025jQuery(document).on('click', '.lp-dot-extra-buttons', function (e) {
5026    jQuery(this).find(".lp-user-menu").toggleClass("main");
5027});
5028
5029
5030jQuery(document).ready(function () {
5031    jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5032    jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5033    if (jQuery('.form-group.lp-claim-form-check-circle input').is(':checked')) {
5034        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", false);
5035        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").removeClass("LPdisabled");
5036
5037    } else {
5038        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5039
5040        jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5041
5042    }
5043    jQuery('.form-group.lp-claim-form-check-circle input').click(function () {
5044        if (jQuery('.form-group.lp-claim-form-check-circle input').is(':checked')) {
5045            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", false);
5046            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").removeClass("LPdisabled");
5047
5048
5049        } else {
5050            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").attr("disabled", true);
5051            jQuery(".lp-secondary-btn.btn-second-hover.lp-secondary-choose.lp-claim-plan-btn").addClass("LPdisabled");
5052        }
5053    });
5054});
5055jQuery("#pop").on("click", function (e) {
5056    e.preventDefault();
5057    jQuery('#imagemodal').modal('show'); // imagemodal is the id attribute assigned to the bootstrap modal, then i use the show function
5058    var img_src = jQuery(this).data('imgsrc');
5059    jQuery('#imagemodal').find('img').attr('src', img_src);
5060});
5061jQuery('#my_file').change(function () {
5062    var i = jQuery(this).prev('label').clone();
5063    var file = jQuery('#my_file')[0].files[0].name;
5064    jQuery(this).prev('label').text(file);
5065});
5066jQuery(document).ready(function () {
5067    if (jQuery('.payment-recurring-message').length > 0) {
5068        jQuery(document).on('change', '.lp-checkout-recurring-wrap', function () {
5069            var checkboxVal = jQuery('.lp-checkout-recurring-wrap input[name="lp-recurring-option"]').is(':checked');
5070            if (checkboxVal === false) {
5071                jQuery('.payment-recurring-message').fadeOut('slow');
5072            }
5073        });
5074        jQuery('.rec_alert_remove').click(function () {
5075            jQuery('.payment-recurring-message').fadeOut('slow');
5076        });
5077    }
5078});
5079jQuery(document).on('click', '.sidebar-filters-map-pop', function (e) {
5080    if (jQuery('.sidemap-container').hasClass('sidebar-filters-map-full')) {
5081        jQuery('.sidemap-container').removeClass('sidebar-filters-map-full');
5082        jQuery(this).text(jQuery(this).attr('data-full-map'));
5083    } else {
5084        jQuery('.sidemap-container').addClass('sidebar-filters-map-full');
5085        jQuery(this).text(jQuery(this).attr('data-close-map'));
5086        setTimeout(function () {
5087            jQuery(".all-list-map").trigger('click');
5088        }, 1000);
5089    }
5090});

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.