1 jQuery(document).ready(function($) { 2 3 4 /* for claim slider */ 5 if (jQuery('div.claim_slider').length > 0) { 6 $wol_claim = jQuery(".lp-form-planclaim-st .rightside").width(); 7 console.log($wol_claim); 8 jQuery('.lp-form-planclaim-st .claim-detailstext').css('width', $wol_claim + 'px'); 9 jQuery('.claim_slider').slick({ 10 dots: true, 11 infinite: true, 12 arrows: false, 13 slidesToShow: 1, 14 slidesToScroll: 1 15 }); 16 17 } 18 19 jQuery('.singincheckboxx input').on('click', function() { 20 var checked = jQuery(".singincheckboxx input").is(":checked"); 21 22 if (checked) { 23 jQuery('.lp-form-planclaim-st .claim_signup').hide(); 24 jQuery('.lp-form-planclaim-st .claim_signin').show(); 25 } else { 26 jQuery('.lp-form-planclaim-st .claim_signin').hide(); 27 jQuery('.lp-form-planclaim-st .claim_signup').show(); 28 } 29 }); 30 31 32 33 34 jQuery('#claimform').on('submit', function(e) { 35 36 $this = jQuery(this); 37 jQuery('.planclaim-page-popup-st .statuss').hide(); 38 jQuery('.planclaim-page-popup-st .statuss .lp-claim-cuccess').html(''); 39 jQuery(this).find('.formsubmitting').css('visibility', 'visible'); 40 e.preventDefault(); 41 42 43 var data = new FormData(this); 44 data.append('action', 'listingpro_claim_list'); 45 data.append('lpNonce', jQuery('#lpNonce').val()); 46 47 jQuery.ajax({ 48 type: 'POST', 49 url: single_ajax_object.ajaxurl, 50 data: data, 51 success: function(resp) { 52 var res = jQuery.parseJSON(resp); 53 console.log(res.result); 54 if (res.result > '0') { 55 $this.find('.formsubmitting').css('visibility', 'hidden'); 56 jQuery('.planclaim-page-popup-st .statuss .lp-claim-cuccess').html(res.state); 57 jQuery('.planclaim-page-popup-st .statuss').show(); 58 jQuery('.planclaim-page-popup-st .claim-details.insidewrp').hide(); 59 jQuery('.rightside').css("height", ""); 60 } else { 61 $this.find('.formsubmitting').css('visibility', 'hidden'); 62 jQuery('.planclaim-page-popup-st .lp-claim-cuccess-return').hide(); 63 jQuery('.planclaim-page-popup-st .statuss .lp-claim-cuccess').html(res.state); 64 jQuery('.planclaim-page-popup-st .statuss').show(); 65 jQuery('.planclaim-page-popup-st .claim-details.insidewrp').hide(); 66 jQuery('.rightside').css("height", ""); 67 68 } 69 70 $this[0].reset(); 71 }, 72 processData: false, 73 contentType: false, 74 }); 75 //return false; 76 //alert(formData); 77 }); 78 79 jQuery('#claimformmobile').on('submit', function(e) { 80 $this = jQuery(this); 81 $this.find('.statuss').html(''); 82 jQuery(this).find('.formsubmitting').css('visibility', 'visible'); 83 e.preventDefault(); 84 var data = new FormData(this); 85 data.append('action', 'listingpro_claim_list'); 86 data.append('lpNonce', jQuery('#lpNonce').val()); 87 88 jQuery.ajax({ 89 type: 'POST', 90 url: single_ajax_object.ajaxurl, 91 data: data, 92 success: function(resp) { 93 var res = jQuery.parseJSON(resp); 94 $this.find('.formsubmitting').css('visibility', 'hidden'); 95 //alert(res.state); 96 $this.find('.statuss').html(res.state); 97 98 $this[0].reset(); 99 }, 100 processData: false, 101 contentType: false, 102 }); 103 //return false; 104 //alert(formData); 105 }); 106 107 108 109 jQuery('#contactOwner').on('submit', function(e) { 110 111 $this = jQuery(this); 112 113 e.preventDefault(); 114 115 var lEmail = jQuery('#email7').val(), 116 lName = jQuery('#name7').val(), 117 lMsg = jQuery('#message7').val(), 118 proceedIt = true; 119 120 if (lEmail == '' || lName == '' || lMsg == '') { 121 122 if (lEmail == '') { 123 jQuery('#email7').addClass('error-msg'); 124 } else { 125 jQuery('#email7').removeClass('error-msg'); 126 } 127 if (lName == '') { 128 jQuery('#name7').addClass('error-msg'); 129 } else { 130 jQuery('#name7').removeClass('error-msg'); 131 } 132 if (lMsg == '') { 133 jQuery('#message7').addClass('error-msg'); 134 } else { 135 jQuery('#message7').removeClass('error-msg'); 136 } 137 138 proceedIt = false;
139 } 140 if (jQuery('input:checkbox.lp-required-field').length > 0) { 141 if (jQuery('input:checkbox.lp-required-field', this).is(':checked')) { 142 jQuery('input:checkbox.lp-required-field').closest('label').removeClass('error-msg'); 143 } else { 144 jQuery('input:checkbox.lp-required-field').closest('label').addClass('error-msg'); 145 proceedIt = false; 146 } 147 } 148 if (jQuery('input:radio.lp-required-field').length > 0) { 149 if (jQuery('input:radio.lp-required-field', this).is(':checked')) { 150 jQuery('input:radio.lp-required-field').closest('label').removeClass('error-msg'); 151 } else { 152 jQuery('input:radio.lp-required-field').closest('label').addClass('error-msg'); 153 proceedIt = false; 154 155 } 156 } 157 158 if (jQuery('#contactOwner .lp-required-field').length > 0) { 159 jQuery('#contactOwner .lp-required-field').each(function(index) { 160 var $this = jQuery(this), 161 $thisVal = $this.val(), 162 $thisType = $this.attr('type'); 163 164 if ($this.prop('tagName') == 'SELECT') { 165 if ($thisVal == 0) { 166 proceedIt = false; 167 $this.addClass('error-msg'); 168 } else { 169 $this.removeClass('error-msg'); 170 } 171 } else { 172 173 if ($thisVal == '') { 174 proceedIt = false; 175 $this.addClass('error-msg'); 176 } else { 177 $this.removeClass('error-msg'); 178 } 179 } 180 181 }); 182 } 183 if (proceedIt === false) { 184 return proceedIt; 185 } 186 187 188 189 var formData = $(this).serialize(); 190 $this.find('.lp-search-icon').removeClass('fa-send'); 191 $this.find('.lp-search-icon').addClass('fa-spinner fa-spin'); 192 193 isCaptcha = jQuery(this).data('lp-recaptcha'); 194 siteKey = jQuery(this).data('lp-recaptcha-sitekey'); 195 token = ''; 196 if ((isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null)) { 197 198 jQuery.ajax({ 199 type: 'POST', 200 dataType: 'json', 201 url: single_ajax_object.ajaxurl, 202 data: { 203 'action': 'listingpro_contactowner', 204 'formData': formData, 205 'lpNonce': jQuery('#lpNonce').val() 206 }, 207 success: function(res) { 208 209 if (res.result === "fail") { 210 jQuery.each(res.errors, function(k, v) { 211 if (k === "email") { 212 jQuery("input[name='email7']").addClass('error-msg'); 213 } 214 if (k === "message") { 215 jQuery("textarea[name='message7']").addClass('error-msg'); 216 } 217 if (k === "name7") { 218 jQuery("input[name='name7']").addClass('error-msg'); 219 } 220 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 221 $this.find('.lp-search-icon').addClass('fa-cross'); 222 //$this.append(res.state); 223 }); 224 } else { 225 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 226 $this.find('.lp-search-icon').addClass('fa-check'); 227 // success msg. 228 jQuery('.lp-lead-success-msg-outer').fadeIn('700'); 229 //$this.append(res.state); 230 $this[0].reset(); 231 } 232 } 233 }); 234 } else { 235 236 grecaptcha.ready(function() { 237 grecaptcha.execute(siteKey, { action: 'lp_lead' }).then(function(token) { 238 239 jQuery.ajax({ 240 type: 'POST', 241 dataType: 'json', 242 url: single_ajax_object.ajaxurl, 243 data: { 244 'action': 'listingpro_contactowner', 245 'formData': formData, 246 'recaptha-action': 'lp_lead', 247 'token': token, 248 'lpNonce': jQuery('#lpNonce').val() 249 }, 250 success: function(res) { 251 252 if (res.result === "fail") { 253 jQuery.each(res.errors, function(k, v) { 254 if (k === "email") { 255 jQuery("input[name='email7']").addClass('error-msg'); 256 } 257 if (k === "message") { 258 jQuery("textarea[name='message7']").addClass('error-msg'); 259 } 260 if (k === "name7") { 261 jQuery("input[name='name7']").addClass('error-msg'); 262 } 263 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 264 $this.find('.lp-search-icon').addClass('fa-cross'); 265 //$this.append(res.state); 266 }); 267 } else { 268 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 269 $this.find('.lp-search-icon').addClass('fa-check'); 270 // success msg. 271 jQuery('.lp-lead-success-msg-outer').fadeIn('700'); 272 //$this.append(res.state); 273 $this[0].reset(); 274 } 275 } 276 }); 277 278 }); 279 }) 280 281 } 282 283 284 }); 285 286 287 /* jquery ajax code for expired listing plan change */ 288 289 jQuery(document).on('click', '.lp-change-proceed-link', function(e) { 290 jQuery('div.lp-existing-plane-container').slideToggle(700); 291 jQuery('div.lp-new-plane-container').slideToggle(700); 292 e.preventDefault(); 293 }); 294 295 jQuery(document).on('click', '.lp-role-back-to-current-plan', function(e) { 296 jQuery('div.lp-existing-plane-container').slideToggle(700); 297 jQuery('div.lp-new-plane-container').slideToggle(700); 298 e.preventDefault(); 299 }); 300 301 jQuery(document).on('click', '.lp-back-to-change-plan', function(e) { 302 jQuery('input[name="submit-change"]').show(); 303 jQuery('.change-plan-btn-holder').hide(); 304 jQuery('.lp-change-plane-status .lp-action-div').html(''); 305 e.preventDefault(); 306 }) 307 308 /* for recurring stripe */ 309 jQuery(document).on('click', '#select-plan-form .select-plan-form input[name=plans-posts]', function() { 310 jQuery('input[name="submit-change"]').show(); 311 jQuery('.change-plan-btn-holder').hide(); 312 jQuery("a.lp_change_plan_action").hide(''); 313 jQuery("div.lp-action-div form").hide(''); 314 }); 315 316 317 jQuery('.lp-change-plan-btn').on('click', function(e) { 318 var listing_id = ''; 319 var listing_status = ''; 320 var plan_title = ''; 321 var plan_price = ''; 322 var haveplan = ''; 323 jQuery('div.lp-loadingPlans').html(jQuery('div.lp-loadingPlans').data('default')); 324 listing_id = jQuery(this).data('listingid'); 325 plan_title = jQuery(this).data('plantitle'); 326 plan_price = jQuery(this).data('planprice'); 327 haveplan = jQuery(this).data('haveplan'); 328 listing_status = jQuery(this).data('listingstatus'); 329 jQuery('.lp-selected-plan-price h3').html(''); 330 jQuery('.lp-selected-plan-price h3').text(plan_title); 331 jQuery('.lp-selected-plan-price h4').html(''); 332 jQuery('.lp-selected-plan-price h4').html(plan_price); 333 jQuery('#select-plan-form input#listing_id').val(listing_id); 334 jQuery('#select-plan-form input#listing_statuss').val(listing_status); 335 jQuery.ajax({ 336 type: 'POST', 337 dataType: 'json', 338 url: single_ajax_object.ajaxurl, 339 data: { 340 'action': 'listingpro_change_plan_data', 341 'listing_id': listing_id, 342 'plan_title': plan_title, 343 'plan_price': plan_price, 344 'haveplan': haveplan, 345 'listing_status': listing_status, 346 'lpNonce': jQuery('#lpNonce').val() 347 }, 348 success: function(data) { 349 jQuery('div.lp-loadingPlans').html(data); 350 } 351 }); 352 353 e.preventDefault(); 354 }); 355 jQuery(document).on('submit', '#select-plan-form', function(event) { 356 var plan_id = ''; 357 $this = jQuery(this); 358 listing_idd = ''; 359 listing_status = ''; 360 listing_idd = jQuery("input[name='plans-posts']:checked").val(); 361 listing_id = jQuery("input[name='listing-id']").val(); 362 listing_status = jQuery("input[name='listing_status']").val(); 363 jQuery('.lp-change-plane-status .lp-action-div').html(''); 364 if (typeof(listing_idd) !== "undefined") { 365 jQuery("div.lp-expire-update-status").html('<i class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>'); 366 jQuery.ajax({ 367 type: 'POST', 368 dataType: 'json', 369 url: single_ajax_object.ajaxurl, 370 data: { 371 'action': 'listingpro_change_plan', 372 'ch_plan_id': listing_idd, 373 'ch_listing_id': listing_id, 374 'ch_listing_status': listing_status, 375 'lpNonce': jQuery('#lpNonce').val() 376 }, 377 success: function(data) { 378 //jQuery('#select-plan-form')[0].reset(); 379 if (data.subscribed) { 380 if (data.subscribed == "yes") { 381 alert(data.alertmsg); 382 } 383 } 384 jQuery('input[name="submit-change"]').hide(); 385 jQuery('.change-plan-btn-holder').show(); 386 jQuery("div.lp-expire-update-status").html(''); 387 jQuery('.lp-change-plane-status .lp-action-div').html(''); 388 jQuery('.lp-change-plane-status .lp-action-div').html(data.action); 389 390 } 391 }); 392 393 } 394 event.preventDefault(); 395 }) 396 397 }); 398 399 400 /* change plan proceedings */ 401 jQuery(document).on('click', '.lp_change_plan_action', function(e) { 402 var planid = jQuery('.lp-action-div input[name="planid"]').val(); 403 var listingid = jQuery('.lp-action-div input[name="listingid"]').val(); 404 jQuery('.lp-action-div').html(''); 405 jQuery("div.lp-expire-update-status").html('<i class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>'); 406 jQuery.ajax({ 407 type: 'POST', 408 dataType: 'json', 409 url: single_ajax_object.ajaxurl, 410 data: { 411 'action': 'listingpro_change_plan_proceeding', 412 'plan_iddd': planid,
413 'listing_iddd': listingid, 414 'lpNonce': jQuery('#lpNonce').val() 415 }, 416 success: function(data) { 417 //jQuery('#select-plan-form')[0].reset(); 418 jQuery("div.lp-expire-update-status").html(''); 419 jQuery("div.lp-expire-update-status").html(data.message); 420 } 421 }); 422 423 e.preventDefault(); 424 }) 425 /* end change plan proceedings */ 426 427 /* delete subscription proceedings */ 428 jQuery(document).on('click', 'a.delete-subsc-btn', function(e) { 429 430 e.preventDefault(); 431 var $this = jQuery(this), 432 cMsg = $this.data('cmsg'); 433 434 435 var r = confirm(cMsg); 436 437 438 if (r == true) { 439 jQuery('body').addClass('listingpro-loading'); 440 var subscript_id = jQuery(this).attr('href'); 441 if ($this.hasClass('paystack-unsub')) { 442 var mail_token = $this.attr('data-mailtoekn'); 443 unsubsribe_paystack(subscript_id, mail_token, $this); 444 445 } else if ($this.hasClass('razorpay-unsub')) { 446 unsubsribe_razorpay(subscript_id, $this); 447 } else { 448 jQuery.ajax({ 449 type: 'POST', 450 dataType: 'json', 451 url: single_ajax_object.ajaxurl, 452 data: { 453 'action': 'listingpro_cancel_subscription_proceeding', 454 'subscript_id': subscript_id, 455 'lpNonce': jQuery('#lpNonce').val() 456 }, 457 success: function(data) { 458 jQuery('body').removeClass('listingpro-loading'); 459 alert(data.msg); 460 if (data.status == "success") { 461 $this.closest('tr').slideToggle(); 462 } 463 464 }, 465 error: function(jqXHR, textStatus, errorThrown) { 466 jQuery('body').removeClass('listingpro-loading'); 467 console.log(textStatus, errorThrown); 468 } 469 }); 470 } 471 } 472 }); 473 474 /* Report listing or Report Review */ 475 jQuery(document).on('click', '#lp-report-listing a#lp-report-this-listing, #lp-report-review a#lp-report-this-review, .lp-review-right-bottom a#lp-report-this-review', function(e) { 476 var $this = jQuery(this); 477 var $posttype = $this.data('posttype'); 478 var $postid = $this.data('postid'); 479 var $reportedby = $this.data('reportedby'); 480 jQuery('body').addClass('listingpro-loading'); 481 jQuery.ajax({ 482 type: 'POST', 483 dataType: 'json', 484 url: single_ajax_object.ajaxurl, 485 data: { 486 'action': 'listingpro_report_this_post', 487 'posttype': $posttype, 488 'postid': $postid, 489 'reportedby': $reportedby, 490 'lpNonce': jQuery('#lpNonce').val() 491 }, 492 success: function(data) { 493 jQuery('body').removeClass('listingpro-loading'); 494 jQuery('div.lp-top-notification-bar').html(''); 495 var alertmsgs = ''; 496 if (data.status === "success") { 497 alertmsgs = '<div class="lp-reporting-success">' + data.msg + '</div>'; 498 jQuery('div.lp-top-notification-bar').html(alertmsgs); 499 } else { 500 alertmsgs = '<div class="lp-reporting-error">' + data.msg + '</div>'; 501 jQuery('div.lp-top-notification-bar').html(alertmsgs); 502 } 503 jQuery('div.lp-top-notification-bar').slideDown('slow').delay(2000).slideUp('slow'); 504 //alert(data.msg); 505 506 }, 507 error: function(jqXHR, textStatus, errorThrown) { 508 jQuery('body').removeClass('listingpro-loading'); 509 console.log(textStatus, errorThrown); 510 } 511 }); 512 513 e.preventDefault(); 514 }) 515 516 517 /* lp bar graph print options */ 518 519 jQuery(document).on('click', 'div.lp_user_stats_btn, ul li .lp_stats_duratonBtn', function(e) { 520 $this = jQuery(this); 521 if ($this.hasClass('active') && ($this.hasClass('lp_user_stats_btn'))) {} else { 522 jQuery('div.lp_user_stats_btn').removeClass('active'); 523 jQuery("#lpgraph").empty(); 524 $duration = jQuery('ul li .lp_stats_duratonBtn.active').data('chartduration'); 525 $type = $this.data('type'); 526 $label = $this.data('label'); 527 jQuery('ul.lp_stats_duration_filter li button').data('label', $label); 528 jQuery('body').addClass('listingpro-loading'); 529 jQuery.ajax({ 530 type: 'POST', 531 dataType: 'json', 532 url: single_ajax_object.ajaxurl, 533 data: { 534 'action': 'listingpro_show_bar_chart', 535 'type': $label, 536 'duration': $duration, 537 'lpNonce': jQuery('#lpNonce').val() 538 }, 539 success: function(data) { 540 jQuery('body').removeClass('listingpro-loading'); 541 jQuery('ul.lp_stats_duration_filter').show(); 542 showthischart(data.data, $type, $label); 543 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(''); 544 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(data.counts); 545 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(''); 546 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(data.resp); 547 //alert(data.msg); 548 549 }, 550 error: function(jqXHR, textStatus, errorThrown) { 551 jQuery('body').removeClass('listingpro-loading'); 552 console.log(textStatus, errorThrown); 553 } 554 }); 555 } 556 }); 557 558 function showthischart($datarray, $type, $label) { 559 Morris.Bar({ 560 element: 'lpgraph', 561 data: $datarray, 562 xkey: 'x', 563 ykeys: ['y'], 564 labels: [$type] 565 }); 566 if ($label == "view") {
567 jQuery('div.lpviewchart').addClass('active'); 568 } else if ($label == "leads") { 569 jQuery('div.lpviewleads').addClass('active'); 570 } else if ($label == "reviews") { 571 jQuery('div.lpviewreviews').addClass('active'); 572 } 573 } 574 575 /* start for coupon button on checkout page */ 576 jQuery(document).on('click', 'button.coupon-apply-bt', function() { 577 var couponcode = jQuery('input[name=coupon-text-field]').val(); 578 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 579 var $listingID = jQuery('input[name=listing_id]:checked').val(); 580 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 581 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 582 var $tax = jQuery('input[name=listing_id]:checked').data('taxenable'); 583 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 584 585 if (couponcode === '') {} else { 586 jQuery('body').addClass('listingpro-loading'); 587 jQuery.ajax({ 588 type: 'POST', 589 dataType: 'json', 590 url: single_ajax_object.ajaxurl, 591 data: { 592 'action': 'listingpro_apply_coupon_code', 593 'coupon': couponcode, 594 'listingid': $listingID, 595 'taxrate': $taxRate, 596 'price': $price, 597 'lpNonce': jQuery('#lpNonce').val() 598 }, 599 success: function(data) { 600 jQuery('body').removeClass('listingpro-loading'); 601 if (data.status == "success") { 602 $discount = data.discount; 603 $discounttype = data.coupontype; 604 $discountIn = '%'; 605 if ($discounttype == 'on') { 606 /* means it is fixed price coupon */ 607 $discountIn = ''; 608 } 609 $newprice = data.price; 610 $newprice = parseFloat($newprice).toFixed(2); 611 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 612 if (jQuery('li').hasClass('checkout_discount_val')) {} else { 613 jQuery('span.lp-subtotal-p-price').parent().after('<li class="checkout_discount_val"><span class="item-price-total-left lp-subtotal-plan">Discounted</span><span class="item-price-total-right lp-subtotal-p-prasaice">' + $discount + $discountIn + '</span></li>'); 614 } 615 } else { 616 ajax_success_popup(data, '') 617 } 618 619 }, 620 error: function(jqXHR, textStatus, errorThrown) { 621 jQuery('body').removeClass('listingpro-loading'); 622 console.log(textStatus, errorThrown); 623 } 624 }); 625 } 626 627 }); 628 629 /* reset tax in database while switching offto discound */ 630 jQuery(document).on('click', 'input[name="lp_checkbox_coupon"]', function() { 631 if (jQuery(this).hasClass('active')) {} else { 632 633 var couponcode = jQuery('input[name=coupon-text-field]').val(); 634 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 635 var $listingID = jQuery('input[name=listing_id]:checked').val(); 636 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 637 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 638 var $tax = jQuery('input[name=listing_id]:checked').data('taxenable'); 639 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 640 641 jQuery.ajax({ 642 type: 'POST', 643 dataType: 'json', 644 url: single_ajax_object.ajaxurl, 645 data: { 646 'action': 'listingpro_apply_coupon_code', 647 'coupon': couponcode, 648 'notusing': 'true', 649 'listingid': $listingID, 650 'taxrate': $taxRate, 651 'price': $price, 652 'lpNonce': jQuery('#lpNonce').val() 653 }, 654 success: function(data) { 655 jQuery('body').removeClass('listingpro-loading'); 656 if (data.status == "success") { 657 $discount = data.discount; 658 $discounttype = data.coupontype; 659 $discountIn = '%'; 660 if ($discounttype == 'on') { 661 /* means it is fixed price coupon */ 662 $discountIn = ''; 663 } 664 $newprice = data.price; 665 $newprice = parseFloat($newprice).toFixed(2); 666 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 667 if (jQuery('li').hasClass('checkout_discount_val')) {} else { 668 jQuery('span.lp-subtotal-p-price').parent().after('<li class="checkout_discount_val"><span class="item-price-total-left lp-subtotal-plan">Discounted</span><span class="item-price-total-right lp-subtotal-p-prasaice">' + $discount + $discountIn + '</span></li>'); 669 } 670 } 671 672 }, 673 error: function(jqXHR, textStatus, errorThrown) { 674 jQuery('body').removeClass('listingpro-loading'); 675 console.log(textStatus, errorThrown); 676 } 677 }); 678 679 680 } 681 682 }); 683 684 685 686 /* ajax call to reply to leads message */ 687 jQuery(document).on('submit', 'form[name=lp_leadReply]', function(e) { 688 689 $this = jQuery(this); 690 $this.find('.lpthisloading').show(); 691 var fd = new FormData(this); 692 fd.append('action', 'lp_reply_to_lead_msg'); 693 fd.append('lpNonce', jQuery('#lpNonce').val()); 694 jQuery.ajax({ 695 type: 'POST', 696 url: single_ajax_object.ajaxurl, 697 data: fd, 698 contentType: false, 699 processData: false, 700 success: function(res) { 701 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 702 $this.find('.lpthisloading').addClass('fa-check'); 703 window.location.href = window.location.href 704 $this[0].reset(); 705 }, 706 error: function(request, error) { 707 //alert(error); 708 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 709 $this.find('.lpthisloading').addClass('fa-check'); 710 window.location.href = window.location.href 711 } 712 }); 713 e.preventDefault(); 714 return false;
715 }); 716 717 /* ajax call read message thread on click */ 718 jQuery(document).on('click', '.lp-read-messages .lp-read-message-inner', function(e) { 719 $this = jQuery(this); 720 $loaderImg = $this.data('loader'); 721 $listingid = $this.data('listingid'); 722 $useremail = $this.data('email'); 723 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('active'); 724 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('unread'); 725 $this.addClass('active'); 726 $this.addClass('read'); 727 if ($listingid) { 728 jQuery('.lpinboxmiddlepart').html(''); 729 jQuery('.lpinboxrightpart').html(''); 730 jQuery('.lpinboxmiddlepart').html('<div class="text-center loadercenterclass"><img alt="image" src="' + $loaderImg + '" width=35 height=35></div>'); 731 jQuery('.lpinboxrightpart').html('<div class="text-center loadercenterclass"><img alt="image" src="' + $loaderImg + '" width=35 height=35></div>'); 732 jQuery.ajax({ 733 type: 'POST', 734 dataType: 'json', 735 url: single_ajax_object.ajaxurl, 736 data: { 737 'action': 'lp_preview_this_message_thread', 738 'listindid': $listingid, 739 'useremail': $useremail, 740 'lpNonce': jQuery('#lpNonce').val() 741 }, 742 success: function(data) { 743 jQuery('.lpinboxmiddlepart').html(''); 744 jQuery('.lpinboxrightpart').html(''); 745 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 746 jQuery('.lpinboxrightpart').html(data.outputright); 747 if (data.notify_alert != true) { 748 jQuery('.unreadMsgDot').remove(); 749 } 750 751 }, 752 error: function(jqXHR, textStatus, errorThrown) { 753 jQuery('.lpinboxmiddlepart').html(''); 754 jQuery('.lpinboxrightpart').html(''); 755 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 756 jQuery('.lpinboxrightpart').html(data.outputright); 757 } 758 }); 759 } 760 761 762 763 }); 764 765 766 /* ==================for saving id in session for checkout============= */ 767 768 jQuery(document).on('click', 'a.lp-pay-publish-btn, a.lp-listing-pay-button, input.lp-listing-pay-button', function(e) { 769 e.preventDefault(); 770 $listingID = jQuery(this).data('lpthisid'); 771 $href = jQuery(this).attr('href'); 772 773 jQuery(this).find('i').removeClass('fa-credit-card').addClass('fa-spinner fa-spin'); 774 775 jQuery.ajax({ 776 type: 'POST', 777 dataType: 'json', 778 url: single_ajax_object.ajaxurl, 779 data: { 780 'action': 'lp_save_thisid_in_session', 781 'listing_id': $listingID, 782 'lpNonce': jQuery('#lpNonce').val() 783 }, 784 success: function(data) { 785 location.href = $href; 786 }, 787 error: function(errorThrown) { 788 location.href = $href; 789 } 790 }); 791 }); 792 793 /* ==================delete converstaion inbox============= */ 794 795 jQuery(document).on('click', 'button.lp-delte-conv', function() { 796 $this = jQuery(jQuery(this)); 797 $emailid = jQuery(this).data('emailid'); 798 $listingid = jQuery(this).data('listingid'); 799 $this.closest('#lp-ad-click-inner').find('.lpthisloading').show(); 800 jQuery.ajax({ 801 type: 'POST', 802 dataType: 'json', 803 url: single_ajax_object.ajaxurl, 804 data: { 805 'action': 'lp_delete_this_conversation', 806 'listingid': $listingid, 807 'emailid': $emailid, 808 'lpNonce': jQuery('#lpNonce').val() 809 }, 810 success: function(data) { 811 $this.closest('#lp-ad-click-inner').find('.lpthisloading').removeClass('fa-spinner fa-spin'); 812 $this.closest('#lp-ad-click-inner').find('.lpthisloading').addClass('fa-check'); 813 window.location.href = window.location.href 814 }, 815 error: function(jqXHR, textStatus, errorThrown) { 816 console.log(errorThrown); 817 } 818 }); 819 }); 820 821 822 /* ==================submit contact us form============= */ 823 jQuery(document).ready(function($) { 824 jQuery('#contactMSGForm').on('submit', function(e) { 825 jQuery('#contactMSGForm #error').hide(); 826 jQuery('#contactMSGForm #success').hide(); 827 jQuery('#contactMSGForm .statuss').show(); 828 e.preventDefault(); 829 $this = jQuery(this); 830 isCaptcha = jQuery(this).data('lp-recaptcha'); 831 siteKey = jQuery(this).data('lp-recaptcha-sitekey'); 832 token = ''; 833 var fd = new FormData(this); 834 fd.append('action', 'lp_ajax_contact_submit'); 835 fd.append('lpNonce', jQuery('#lpNonce').val()); 836 if ((isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null)) { 837 838 jQuery.ajax({ 839 type: 'POST', 840 url: single_ajax_object.ajaxurl, 841 data: fd, 842 contentType: false, 843 processData: false, 844 845 success: function(res) { 846 jQuery('#contactMSGForm .statuss').hide(); 847 var res = jQuery.parseJSON(res); 848 if (res.status == "error") { 849 jQuery('#contactMSGForm #error span p').html(''); 850 jQuery('#contactMSGForm #error span p').html(res.msg); 851 jQuery('#contactMSGForm #error').show(); 852 } else if (res.status == "success") { 853 jQuery('#contactMSGForm #success span p').html(''); 854 jQuery('#contactMSGForm #success span p').html(res.msg); 855 jQuery('#contactMSGForm #success').show(); 856 } 857 858 }, 859 error: function(request, error) { 860 jQuery('#contactMSGForm .statuss').hide(); 861 alert(error); 862 } 863 }); 864 } else { 865 //for recpatcha 866 867 grecaptcha.ready(function() { 868 grecaptcha.execute(siteKey, { action: 'lp_contact' }).then(function(token) { 869 870 fd.append('recaptha-action', 'lp_contact'); 871 fd.append('token', token); 872 873 jQuery.ajax({ 874 type: 'POST', 875 url: single_ajax_object.ajaxurl, 876 data: fd, 877 contentType: false, 878 processData: false, 879 880 success: function(res) { 881 jQuery('#contactMSGForm .statuss').hide(); 882 var res = jQuery.parseJSON(res); 883 if (res.status == "error") { 884 jQuery('#contactMSGForm #error span p').html(''); 885 jQuery('#contactMSGForm #error span p').html(res.msg); 886 jQuery('#contactMSGForm #error').show(); 887 } else if (res.status == "success") { 888 jQuery('#contactMSGForm #success span p').html(''); 889 jQuery('#contactMSGForm #success span p').html(res.msg); 890 jQuery('#contactMSGForm #success').show(); 891 } 892 893 }, 894 error: function(request, error) { 895 jQuery('#contactMSGForm .statuss').hide(); 896 alert(error); 897 } 898 }); 899 900 }); 901 }) 902 } 903 904 }); 905 }); 906 907 /* ===============lp review filter=============== */ 908 jQuery(document).ready(function($) { 909 jQuery('#lp_reivew_drop_filter').on('change', function(e) { 910 e.preventDefault(); 911 jQuery('.reviews-section').html(''); 912 jQuery('.review-filter-loader').show(); 913 jQuery('.lp-listing-reviews .lp-listing-review').remove(); 914 $this = jQuery(this); 915 jQuery.ajax({ 916 type: 'POST', 917 dataType: 'json', 918 url: single_ajax_object.ajaxurl, 919 data: { 920 'action': 'lp_show_sorted_reivews', 921 'order_by': $this.val(), 922 'listing_id': jQuery('input[name=post_id]').val(), 923 'lpNonce': jQuery('#lpNonce').val() 924 }, 925 success: function(data) { 926 jQuery('.review-filter-loader').hide(); 927 jQuery('.reviews-section').html(data); 928 jQuery('.lp-listing-reviews').append(data); 929 }, 930 error: function(jqXHR, textStatus, errorThrown) { 931 jQuery('.review-filter-loader').hide(); 932 console.log(errorThrown); 933 } 934 }); 935 }); 936 }); 937 938 /* ===============lp make listing publish with 100% discount=============== */ 939 function lp_make_this_listing_publish_withdiscount($listing_id) { 940 941 jQuery('body').addClass('listingpro-loading'); 942 jQuery.ajax({ 943 type: 'POST', 944 dataType: 'json', 945 url: single_ajax_object.ajaxurl, 946 data: { 947 'action': 'lp_make_listing_published', 948 'listing_id': $listing_id, 949 'plan_price': jQuery("#listings_checkout_form input[name=plan_price]").val(), 950 'taxrate': jQuery("#listings_checkout_form input[name=listings_tax_price]").val(), 951 'coupon': jQuery("#listings_checkout_form input[name=coupon-text-field]").val(), 952 'plan_id': jQuery("#listings_checkout_form input[name=plan_id]").val(), 953 'payment_method': jQuery("#listings_checkout_form input[name=plan]:checked").val(), 954 'currency': jQuery("#listings_checkout_form input[name=currency
954]").val(), 955 'lpNonce': jQuery('#lpNonce').val() 956 }, 957 success: function(data) { 958 jQuery('body').removeClass('listingpro-loading'); 959 if (data.status == "success") { 960 /* redirect to the listing page */ 961 document.location.href = data.url; 962 } else { 963 alert(data.url); 964 } 965 }, 966 error: function(jqXHR, textStatus, errorThrown) { 967 jQuery('body').removeClass('listingpro-loading'); 968 alert(errorThrown); 969 console.log(errorThrown); 970 } 971 }); 972 } 973 974 975 /* =================lp save user analytics===================== */ 976 jQuery(document).on('submit', '#lp-user-g-analytics form', function(e) { 977 e.preventDefault(); 978 formData = jQuery(this); 979 jQuery('#lp-user-g-analytics .analyticsspin').show(); 980 981 jQuery.ajax({ 982 type: 'POST', 983 dataType: 'json', 984 url: single_ajax_object.ajaxurl, 985 data: { 986 'action': 'lp_save_user_analytics', 987 'data': formData.serialize(), 988 'lpNonce': jQuery('#lpNonce').val() 989 }, 990 success: function(data) { 991 if (data == "success") {} else { 992 993 } 994 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 995 }, 996 error: function(jqXHR, textStatus, errorThrown) { 997 alert(errorThrown); 998 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 999 } 1000 }); 1001 }); 1002 1003 function claimformvalidation(login, policy) { 1004 if (login === true) { 1005 var name = jQuery('#claimform #fullname').val(), 1006 lname = jQuery('#claimform #lastname').val(), 1007 phone = jQuery('#claimform #phoneClaim').val(), 1008 email = jQuery('#claimform #bemail').val(), 1009 massage = jQuery('#claimform #message').val(), 1010 checkpandpcheck = true; 1011 if (policy === true) { 1012 checkpandpcheck = false; 1013 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1014 } 1015 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && checkpandpcheck === true) { 1016 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1017 } else { 1018 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1019 } 1020 } else { 1021 var name = jQuery('#claimform #fullname').val(), 1022 lname = jQuery('#claimform #lastname').val(), 1023 phone = jQuery('#claimform #phoneClaim').val(), 1024 email = jQuery('#claimform #bemail').val(), 1025 massage = jQuery('#claimform #message').val(), 1026 newuser = jQuery('#claimform #claim_new_user_email').val(), 1027 euser = jQuery('#claimform #claim_username').val(), 1028 epass = jQuery('#claimform #claim_userpass').val(), 1029 checkpandpcheck = true; 1030 if (policy === true) { 1031 checkpandpcheck = false; 1032 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1033 } 1034 if (jQuery('#lp-signin-on-claim').is(':checked')) { 1035 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && euser != '' && epass != '' && checkpandpcheck === true) { 1036 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1037 } else { 1038 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1039 } 1040 } else { 1041 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && newuser != '' && checkpandpcheck === true) { 1042 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1043 } else { 1044 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1045 } 1046 } 1047 } 1048 } 1049 jQuery(document).ready(function() { 1050 var claimuserlogin = false, 1051 ppolicy = false; 1052 if (jQuery('body').hasClass('logged-in')) { 1053 claimuserlogin = true; 1054 } 1055 if (jQuery('#claimform .lpprivacycheckboxopt').length > 0) { 1056 ppolicy = true; 1057 } 1058 jQuery(document).on('input', '#claimform #fullname,#claimform #lastname,#claimform #phoneClaim,#claimform #bemail,#claimform #message,#claimform #claim_new_user_email,#claimform #claim_username,#claimform #claim_userpass', function() { 1059 claimformvalidation(claimuserlogin, ppolicy); 1060 }); 1061 jQuery('#lp-signin-on-claim').click(function() { 1062 jQuery(this).closest('form').find('input[type=submit]').attr("disabled", "disabled"); 1063 jQuery('#claim_username').val(""); 1064 jQuery('#claim_userpass').val(""); 1065 jQuery('#claim_new_user_email').val(""); 1066 }); 1067 });
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.