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