PageSourceSearch

https://guiamujereslideres.com/wp-content/themes/listingpro/assets…?ver=f359417dd20e1b37fed3b10e2a46bb1d

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

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.