1jQuery(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 */ 401jQuery(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 */ 428jQuery(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// new code 2.6.15 475 476jQuery(document).on('click', 'button#lp_close_reason', function (e) { 477 jQuery(this).closest('div#lp_report_listing').find('textarea#lp_report_reason').val(''); 478}); 479 480jQuery(document).on('click', '#lp-report-listing a#lp-report-this-listing-popup, #lp-report-review a#lp-report-this-review-popup, .lp-review-right-bottom a#lp-report-this-review-popup', function (e) { 481 var $this = jQuery(this); 482 var $posttype = $this.data('posttype'); 483 var $postid = $this.data('postid'); 484 var $reportedby = $this.data('reportedby'); 485 jQuery('div#lp_report_listing input#lp_posttype').val($posttype); 486 jQuery('div#lp_report_listing input#lp_postid').val($postid); 487 jQuery('div#lp_report_listing input#lp_reportedby').val($reportedby); 488 489}); 490 491/* Report listing or Report Review */ 492jQuery(document).on('click', '#lp_report_listing #lp-report-this-listing', function (e) { 493 var $this = jQuery(this); 494 var $posttype = $this.closest('div#lp_report_listing').find('input#lp_posttype').val(); 495 var $postid = $this.closest('div#lp_report_listing').find('input#lp_postid').val(); 496 var $reportedby = $this.closest('div#lp_report_listing').find('input#lp_reportedby').val(); 497 var $reportreson = $this.closest('div#lp_report_listing').find('textarea#lp_report_reason').val(); 498 499 if ($reportreson == '') { 500 alert('Please enter report reason'); 501 return false; 502 } 503 504 jQuery('body').addClass('listingpro-loading'); 505 506 jQuery.ajax({ 507 type: 'POST', 508 dataType: 'json', 509 url: single_ajax_object.ajaxurl, 510 data: { 511 'action': 'listingpro_report_this_post', 512 'posttype': $posttype, 513 'postid': $postid, 514 'reportreason': $reportreson, 515 'reportedby': $reportedby, 516 'lpNonce': jQuery('#lpNonce').val() 517 }, 518 success: function (data) { 519 jQuery('body').removeClass('listingpro-loading'); 520 jQuery('div.lp-top-notification-bar').html(''); 521 var alertmsgs = ''; 522 if (data.status === "success") { 523 alertmsgs = '<div class="lp-reporting-success">' + data.msg + '</div>'; 524 jQuery('button#lp_close_reason').trigger('click'); 525 jQuery('div.lp-top-notification-bar').html(alertmsgs); 526 } else { 527 alertmsgs = '<div class="lp-reporting-error">' + data.msg + '</div>'; 528 jQuery('div.lp-top-notification-bar').html(alertmsgs); 529 } 530 jQuery('div.lp-top-notification-bar').slideDown('slow').delay(2000).slideUp('slow'); 531 //alert(data.msg); 532 533 }, 534 error: function (jqXHR, textStatus, errorThrown) { 535 jQuery('body').removeClass('listingpro-loading'); 536 console.log(textStatus, errorThrown); 537 } 538 }); 539 540 e.preventDefault(); 541}) 542 543//end new code 2.6.15 544 545 546/* lp bar graph print options */ 547 548jQuery(document).on('click', 'div.lp_user_stats_btn, ul li .lp_stats_duratonBtn', function (e) { 549 $this = jQuery(this); 550 if ($this.hasClass('active') && ($this.hasClass('lp_user_stats_btn'))) { } else { 551 jQuery('div.lp_user_stats_btn').removeClass('active'); 552 jQuery("#lpgraph").empty(); 553 $duration = jQuery('ul li .lp_stats_duratonBtn.active').data('chartduration'); 554 $type = $this.data('type'); 555 $label = $this.data('label'); 556 jQuery('ul.lp_stats_duration_filter li button').data('label', $label); 557 jQuery('ul.lp_stats_duration_filter li button').data('type', $type); 558 jQuery('body').addClass('listingpro-loading'); 559 jQuery.ajax({ 560 type: 'POST', 561 dataType: 'json', 562 url: single_ajax_object.ajaxurl, 563 data: { 564 'action': 'listingpro_show_bar_chart', 565 'type': $label, 566 'duration': $duration, 567 'lpNonce': jQuery('#lpNonce').val() 568 }, 569 success: function (data) { 570 jQuery('body').removeClass('listingpro-loading'); 571 jQuery('ul.lp_stats_duration_filter').show(); 572 showthischart(data.data, $type, $label); 573 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(''); 574 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(data.counts); 575 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(''); 576 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(data.resp); 577 //alert(data.msg); 578 579 }, 580 error: function (jqXHR, textStatus, errorThrown) { 581 jQuery('body').removeClass('listingpro-loading'); 582 console.log(textStatus, errorThrown); 583 } 584 }); 585 } 586}); 587 588function showthischart($datarray, $type, $label) { 589 Morris.Bar({ 590 element: 'lpgraph', 591 data: $datarray, 592 xkey: 'x', 593 ykeys: ['y'], 594 labels: [$type] 595 }); 596 if ($label == "view") {
597 jQuery('div.lpviewchart').addClass('active'); 598 } else if ($label == "leads") { 599 jQuery('div.lpviewleads').addClass('active'); 600 } else if ($label == "reviews") { 601 jQuery('div.lpviewreviews').addClass('active'); 602 } 603} 604 605jQuery(document).on('click', '.lp_user_stats_btn', function(e) { 606 var $type = jQuery(this).data('type'); 607 jQuery('.lp_stats_duratonBtn').attr('data-type', $type); 608}); 609 610/* start for coupon button on checkout page */ 611jQuery(document).on('click', 'button.coupon-apply-bt', function () { 612 var couponcode = jQuery('input[name=coupon-text-field]').val(); 613 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 614 var $listingID = jQuery('input[name=listing_id]:checked').val(); 615 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 616 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 617 var $tax = jQuery('input[name=listing_id]:checked').data('taxenable'); 618 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 619 620 if (couponcode === '') { } else { 621 jQuery('body').addClass('listingpro-loading'); 622 jQuery.ajax({ 623 type: 'POST', 624 dataType: 'json', 625 url: single_ajax_object.ajaxurl, 626 data: { 627 'action': 'listingpro_apply_coupon_code', 628 'coupon': couponcode, 629 'listingid': $listingID, 630 'taxrate': $taxRate, 631 'price': $price, 632 'lpNonce': jQuery('#lpNonce').val() 633 }, 634 success: function (data) { 635 jQuery('body').removeClass('listingpro-loading'); 636 if (data.status == "success") { 637 $discount = data.discount; 638 $discounttype = data.coupontype; 639 $discountIn = '%'; 640 if ($discounttype == 'on') { 641 /* means it is fixed price coupon */ 642 $discountIn = ''; 643 } 644 $newprice = data.price; 645 $newprice = parseFloat($newprice).toFixed(2); 646 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 647 if (jQuery('li').hasClass('checkout_discount_val')) { } else { 648 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>'); 649 } 650 } else { 651 ajax_success_popup(data, '') 652 } 653 654 }, 655 error: function (jqXHR, textStatus, errorThrown) { 656 jQuery('body').removeClass('listingpro-loading'); 657 console.log(textStatus, errorThrown); 658 } 659 }); 660 } 661 662}); 663 664/* reset tax in database while switching offto discound */ 665jQuery(document).on('click', 'input[name="lp_checkbox_coupon"]', function () { 666 if (jQuery(this).hasClass('active')) { } else { 667 668 var couponcode = jQuery('input[name=coupon-text-field]').val(); 669 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 670 var $listingID = jQuery('input[name=listing_id]:checked').val(); 671 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 672 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 673 var $tax = jQuery('input[name=listing_id]:checked').data('taxenable'); 674 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 675 676 jQuery.ajax({ 677 type: 'POST', 678 dataType: 'json', 679 url: single_ajax_object.ajaxurl, 680 data: { 681 'action': 'listingpro_apply_coupon_code', 682 'coupon': couponcode, 683 'notusing': 'true', 684 'listingid': $listingID, 685 'taxrate': $taxRate, 686 'price': $price, 687 'lpNonce': jQuery('#lpNonce').val() 688 }, 689 success: function (data) { 690 jQuery('body').removeClass('listingpro-loading'); 691 if (data.status == "success") { 692 $discount = data.discount; 693 $discounttype = data.coupontype; 694 $discountIn = '%'; 695 if ($discounttype == 'on') { 696 /* means it is fixed price coupon */ 697 $discountIn = ''; 698 } 699 $newprice = data.price; 700 $newprice = parseFloat($newprice).toFixed(2); 701 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 702 if (jQuery('li').hasClass('checkout_discount_val')) { } else { 703 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>'); 704 } 705 } 706 707 }, 708 error: function (jqXHR, textStatus, errorThrown) { 709 jQuery('body').removeClass('listingpro-loading'); 710 console.log(textStatus, errorThrown); 711 } 712 }); 713 714 715 } 716 717}); 718 719 720 721/* ajax call to reply to leads message */ 722jQuery(document).on('submit', 'form[name=lp_leadReply]', function (e) { 723 724 $this = jQuery(this); 725 $this.find('.lpthisloading').show(); 726 var fd = new FormData(this); 727 fd.append('action', 'lp_reply_to_lead_msg'); 728 fd.append('lpNonce', jQuery('#lpNonce').val()); 729 jQuery.ajax({ 730 type: 'POST', 731 url: single_ajax_object.ajaxurl, 732 data: fd, 733 contentType: false, 734 processData: false, 735 success: function (res) { 736 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 737 $this.find('.lpthisloading').addClass('fa-check'); 738 window.location.href = window.location.href 739 $this[0].reset(); 740 }, 741 error: function (request, error) { 742 //alert(error); 743 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 744 $this.find('.lpthisloading').addClass('fa-check'); 745 window.location.href = window.location.href 746 } 747 }); 748 e.preventDefault(); 749 return false;
750}); 751 752/* ajax call read message thread on click */ 753jQuery(document).on('click', '.lp-read-messages .lp-read-message-inner', function (e) { 754 $this = jQuery(this); 755 $loaderImg = $this.data('loader'); 756 $listingid = $this.data('listingid'); 757 $useremail = $this.data('email'); 758 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('active'); 759 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('unread'); 760 $this.addClass('active'); 761 $this.addClass('read'); 762 if ($listingid) { 763 jQuery('.lpinboxmiddlepart').html(''); 764 jQuery('.lpinboxrightpart').html(''); 765 jQuery('.lpinboxmiddlepart').html('<div class="text-center loadercenterclass"><img alt="image" src="' + $loaderImg + '" width=35 height=35></div>'); 766 jQuery('.lpinboxrightpart').html('<div class="text-center loadercenterclass"><img alt="image" src="' + $loaderImg + '" width=35 height=35></div>'); 767 jQuery.ajax({ 768 type: 'POST', 769 dataType: 'json', 770 url: single_ajax_object.ajaxurl, 771 data: { 772 'action': 'lp_preview_this_message_thread', 773 'listindid': $listingid, 774 'useremail': $useremail, 775 'lpNonce': jQuery('#lpNonce').val() 776 }, 777 success: function (data) { 778 jQuery('.lpinboxmiddlepart').html(''); 779 jQuery('.lpinboxrightpart').html(''); 780 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 781 jQuery('.lpinboxrightpart').html(data.outputright); 782 if (data.notify_alert != true) { 783 jQuery('.unreadMsgDot').remove(); 784 } 785 786 }, 787 error: function (jqXHR, textStatus, errorThrown) { 788 jQuery('.lpinboxmiddlepart').html(''); 789 jQuery('.lpinboxrightpart').html(''); 790 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 791 jQuery('.lpinboxrightpart').html(data.outputright); 792 } 793 }); 794 } 795 796 797 798}); 799 800 801/* ==================for saving id in session for checkout============= */ 802 803jQuery(document).on('click', 'a.lp-pay-publish-btn, a.lp-listing-pay-button, input.lp-listing-pay-button', function (e) { 804 e.preventDefault(); 805 $listingID = jQuery(this).data('lpthisid'); 806 $href = jQuery(this).attr('href'); 807 808 jQuery(this).find('i').removeClass('fa-credit-card').addClass('fa-spinner fa-spin'); 809 810 jQuery.ajax({ 811 type: 'POST', 812 dataType: 'json', 813 url: single_ajax_object.ajaxurl, 814 data: { 815 'action': 'lp_save_thisid_in_session', 816 'listing_id': $listingID, 817 'lpNonce': jQuery('#lpNonce').val() 818 }, 819 success: function (data) { 820 location.href = $href; 821 }, 822 error: function (errorThrown) { 823 location.href = $href; 824 } 825 }); 826}); 827 828/* ==================delete converstaion inbox============= */ 829 830jQuery(document).on('click', 'button.lp-delte-conv', function () { 831 $this = jQuery(jQuery(this)); 832 $emailid = jQuery(this).data('emailid'); 833 $listingid = jQuery(this).data('listingid'); 834 $this.closest('#lp-ad-click-inner').find('.lpthisloading').show(); 835 jQuery.ajax({ 836 type: 'POST', 837 dataType: 'json', 838 url: single_ajax_object.ajaxurl, 839 data: { 840 'action': 'lp_delete_this_conversation', 841 'listingid': $listingid, 842 'emailid': $emailid, 843 'lpNonce': jQuery('#lpNonce').val() 844 }, 845 success: function (data) { 846 $this.closest('#lp-ad-click-inner').find('.lpthisloading').removeClass('fa-spinner fa-spin'); 847 $this.closest('#lp-ad-click-inner').find('.lpthisloading').addClass('fa-check'); 848 window.location.href = window.location.href 849 }, 850 error: function (jqXHR, textStatus, errorThrown) { 851 console.log(errorThrown); 852 } 853 }); 854}); 855 856 857/* ==================submit contact us form============= */ 858jQuery(document).ready(function ($) { 859 jQuery('#contactMSGForm').on('submit', function (e) { 860 jQuery('#contactMSGForm #error').hide(); 861 jQuery('#contactMSGForm #success').hide(); 862 jQuery('#contactMSGForm .statuss').show(); 863 e.preventDefault(); 864 $this = jQuery(this); 865 isCaptcha = jQuery(this).data('lp-recaptcha'); 866 siteKey = jQuery(this).data('lp-recaptcha-sitekey'); 867 token = ''; 868 var fd = new FormData(this); 869 fd.append('action', 'lp_ajax_contact_submit'); 870 fd.append('lpNonce', jQuery('#lpNonce').val()); 871 if ((isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null)) { 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 } else { 900 //for recpatcha 901 902 grecaptcha.ready(function () { 903 grecaptcha.execute(siteKey, { action: 'lp_contact' }).then(function (token) { 904 905 fd.append('recaptha-action', 'lp_contact'); 906 fd.append('token', token); 907 908 jQuery.ajax({ 909 type: 'POST', 910 url: single_ajax_object.ajaxurl, 911 data: fd, 912 contentType: false, 913 processData: false, 914 915 success: function (res) { 916 jQuery('#contactMSGForm .statuss').hide(); 917 var res = jQuery.parseJSON(res); 918 if (res.status == "error") { 919 jQuery('#contactMSGForm #error span p').html(''); 920 jQuery('#contactMSGForm #error span p').html(res.msg); 921 jQuery('#contactMSGForm #error').show(); 922 } else if (res.status == "success") { 923 jQuery('#contactMSGForm #success span p').html(''); 924 jQuery('#contactMSGForm #success span p').html(res.msg); 925 jQuery('#contactMSGForm #success').show(); 926 } 927 928 }, 929 error: function (request, error) { 930 jQuery('#contactMSGForm .statuss').hide(); 931 alert(error); 932 } 933 }); 934 935 }); 936 }) 937 } 938 939 }); 940}); 941 942/* ===============lp review filter=============== */ 943jQuery(document).ready(function ($) { 944 jQuery('#lp_reivew_drop_filter').on('change', function (e) { 945 e.preventDefault(); 946 jQuery('.reviews-section').html(''); 947 jQuery('.review-filter-loader').show(); 948 jQuery('.lp-listing-reviews .lp-listing-review').remove(); 949 $this = jQuery(this); 950 jQuery.ajax({ 951 type: 'POST', 952 dataType: 'json', 953 url: single_ajax_object.ajaxurl, 954 data: { 955 'action': 'lp_show_sorted_reivews', 956 'order_by': $this.val(), 957 'listing_id': jQuery('input[name=post_id]').val(), 958 'lpNonce': jQuery('#lpNonce').val() 959 }, 960 success: function (data) { 961 jQuery('.review-filter-loader').hide(); 962 jQuery('.reviews-section').html(data); 963 jQuery('.lp-listing-reviews').append(data); 964 }, 965 error: function (jqXHR, textStatus, errorThrown) { 966 jQuery('.review-filter-loader').hide(); 967 console.log(errorThrown); 968 } 969 }); 970 }); 971}); 972 973/* ===============lp make listing publish with 100% discount=============== */ 974function lp_make_this_listing_publish_withdiscount($listing_id) { 975 976 jQuery('body').addClass('listingpro-loading'); 977 jQuery.ajax({ 978 type: 'POST', 979 dataType: 'json', 980 url: single_ajax_object.ajaxurl, 981 data: { 982 'action': 'lp_make_listing_published', 983 'listing_id': $listing_id, 984 'plan_price': jQuery("#listings_checkout_form input[name=plan_price]").val(), 985 'taxrate': jQuery("#listings_checkout_form input[name=listings_tax_price]").val(), 986 'coupon': jQuery("#listings_checkout_form input[name=coupon-text-field]").val(), 987 'plan_id': jQuery("#listings_checkout_form input[name=plan_id]").val(), 988 'payment_method': jQuery("#listings_checkout_form input[name=plan]:checked").val(), 989 'currency': jQuery("#listings_checkout_form input[name=currency
989]").val(), 990 'lpNonce': jQuery('#lpNonce').val() 991 }, 992 success: function (data) { 993 jQuery('body').removeClass('listingpro-loading'); 994 if (data.status == "success") { 995 /* redirect to the listing page */ 996 document.location.href = data.url; 997 } else { 998 alert(data.url); 999 } 1000 }, 1001 error: function (jqXHR, textStatus, errorThrown) { 1002 jQuery('body').removeClass('listingpro-loading'); 1003 alert(errorThrown); 1004 console.log(errorThrown); 1005 } 1006 }); 1007} 1008 1009 1010/* =================lp save user analytics===================== */ 1011jQuery(document).on('submit', '#lp-user-g-analytics form', function (e) { 1012 e.preventDefault(); 1013 formData = jQuery(this); 1014 jQuery('#lp-user-g-analytics .analyticsspin').show(); 1015 1016 jQuery.ajax({ 1017 type: 'POST', 1018 dataType: 'json', 1019 url: single_ajax_object.ajaxurl, 1020 data: { 1021 'action': 'lp_save_user_analytics', 1022 'data': formData.serialize(), 1023 'lpNonce': jQuery('#lpNonce').val() 1024 }, 1025 success: function (data) { 1026 if (data == "success") { } else { 1027 1028 } 1029 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 1030 }, 1031 error: function (jqXHR, textStatus, errorThrown) { 1032 alert(errorThrown); 1033 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 1034 } 1035 }); 1036}); 1037 1038function claimformvalidation(login, policy) { 1039 if (login === true) { 1040 var name = jQuery('#claimform #fullname').val(), 1041 lname = jQuery('#claimform #lastname').val(), 1042 phone = jQuery('#claimform #phoneClaim').val(), 1043 email = jQuery('#claimform #bemail').val(), 1044 massage = jQuery('#claimform #message').val(), 1045 checkpandpcheck = true; 1046 if (policy === true) { 1047 checkpandpcheck = false; 1048 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1049 } 1050 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && checkpandpcheck === true) { 1051 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1052 } else { 1053 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1054 } 1055 } else { 1056 var name = jQuery('#claimform #fullname').val(), 1057 lname = jQuery('#claimform #lastname').val(), 1058 phone = jQuery('#claimform #phoneClaim').val(), 1059 email = jQuery('#claimform #bemail').val(), 1060 massage = jQuery('#claimform #message').val(), 1061 newuser = jQuery('#claimform #claim_new_user_email').val(), 1062 euser = jQuery('#claimform #claim_username').val(), 1063 epass = jQuery('#claimform #claim_userpass').val(), 1064 checkpandpcheck = true; 1065 if (policy === true) { 1066 checkpandpcheck = false; 1067 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1068 } 1069 if (jQuery('#lp-signin-on-claim').is(':checked')) { 1070 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && euser != '' && epass != '' && checkpandpcheck === true) { 1071 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1072 } else { 1073 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1074 } 1075 } else { 1076 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && newuser != '' && checkpandpcheck === true) { 1077 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1078 } else { 1079 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1080 } 1081 } 1082 } 1083} 1084jQuery(document).ready(function () { 1085 var claimuserlogin = false, 1086 ppolicy = false; 1087 if (jQuery('body').hasClass('logged-in')) { 1088 claimuserlogin = true; 1089 } 1090 if (jQuery('#claimform .lpprivacycheckboxopt').length > 0) { 1091 ppolicy = true; 1092 } 1093 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 () { 1094 claimformvalidation(claimuserlogin, ppolicy); 1095 }); 1096 jQuery('#lp-signin-on-claim').click(function () { 1097 jQuery(this).closest('form').find('input[type=submit]').attr("disabled", "disabled"); 1098 jQuery('#claim_username').val(""); 1099 jQuery('#claim_userpass').val(""); 1100 jQuery('#claim_new_user_email').val(""); 1101 }); 1102});
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.