PageSourceSearch

https://hochzeitsportal.nrw/wp-content/themes/listingpro/assets/js/main.js?ver=7.1.2

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

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.