PageSourceSearch

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

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

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.