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 109jQuery('#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 123 if( lEmail == '' ) 124 { 125 jQuery('#email7').addClass('error-msg'); 126 } 127 else 128 { 129 jQuery('#email7').removeClass('error-msg'); 130 } 131 if( lName == '' ) 132 { 133 jQuery('#name7').addClass('error-msg'); 134 } 135 else 136 { 137 jQuery('#name7').removeClass('error-msg'); 138 } 139 if( lMsg == '' ) 140 { 141 jQuery('#message7').addClass('error-msg'); 142 } 143 else 144 { 145 jQuery('#message7').removeClass('error-msg'); 146 } 147 148 proceedIt = false; 149 }
150 if( jQuery('input:checkbox.lp-required-field').length > 0 ) 151 { 152 if (jQuery('input:checkbox.lp-required-field', this).is(':checked')) 153 { 154 jQuery('input:checkbox.lp-required-field').closest('label' ).removeClass('error-msg'); 155 } 156 else 157 { 158 jQuery('input:checkbox.lp-required-field').closest('label' ).addClass('error-msg'); 159 proceedIt = false; 160 } 161 } 162 if( jQuery('input:radio.lp-required-field').length > 0 ) 163 { 164 if(jQuery('input:radio.lp-required-field', this).is(':checked') ) 165 { 166 jQuery('input:radio.lp-required-field').closest('label' ).removeClass('error-msg'); 167 } 168 else 169 { 170 jQuery('input:radio.lp-required-field').closest('label' ).addClass('error-msg'); 171 proceedIt = false; 172 173 } 174 } 175 176 if( jQuery('#contactOwner .lp-required-field').length > 0 ) 177 { 178 jQuery('#contactOwner .lp-required-field').each(function (index) { 179 var $this = jQuery(this), 180 $thisVal = $this.val(), 181 $thisType = $this.attr('type'); 182 183 if( $this.prop('tagName') == 'SELECT' ) 184 { 185 if( $thisVal == 0 ) 186 { 187 proceedIt = false; 188 $this.addClass('error-msg'); 189 } 190 else 191 { 192 $this.removeClass('error-msg'); 193 } 194 } 195 else 196 { 197 198 if( $thisVal == '' ) 199 { 200 proceedIt = false; 201 $this.addClass('error-msg'); 202 } 203 else 204 { 205 $this.removeClass('error-msg'); 206 } 207 } 208 209 }); 210 } 211 if( proceedIt === false ) 212 { 213 return proceedIt; 214 } 215 216 217 218 var formData = $(this).serialize(); 219 $this.find('.lp-search-icon').removeClass('fa-send'); 220 $this.find('.lp-search-icon').addClass('fa-spinner fa-spin'); 221 222 isCaptcha = jQuery(this).data('lp-recaptcha'); 223 siteKey = jQuery(this).data('lp-recaptcha-sitekey'); 224 token = ''; 225 if ( (isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null) ) { 226 227 jQuery.ajax({ 228 type: 'POST', 229 dataType: 'json', 230 url: single_ajax_object.ajaxurl, 231 data: { 232 'action': 'listingpro_contactowner', 233 'formData': formData, 234 'lpNonce' : jQuery('#lpNonce').val() 235 }, 236 success: function(res){ 237 238 if(res.result==="fail"){ 239 jQuery.each(res.errors, function (k, v) { 240 if(k==="email"){ 241 jQuery("input[name='email7']").addClass('error-msg'); 242 } 243 if(k==="message"){ 244 jQuery("textarea[name='message7']").addClass('error-msg'); 245 } 246 if(k==="name7"){ 247 jQuery("input[name='name7']").addClass('error-msg'); 248 } 249 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 250 $this.find('.lp-search-icon').addClass('fa-cross'); 251 //$this.append(res.state); 252 }); 253 } 254 else{ 255 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 256 $this.find('.lp-search-icon').addClass('fa-check'); 257 // success msg. 258 jQuery('.lp-lead-success-msg-outer').fadeIn('700'); 259 //$this.append(res.state); 260 $this[0].reset(); 261 } 262 } 263 }); 264 }else{ 265 266 grecaptcha.ready(function() { 267 grecaptcha.execute(siteKey, {action: 'lp_lead'}).then(function(token) { 268 269 jQuery.ajax({ 270 type: 'POST', 271 dataType: 'json', 272 url: single_ajax_object.ajaxurl, 273 data: { 274 'action': 'listingpro_contactowner', 275 'formData': formData, 276 'recaptha-action' : 'lp_lead', 277 'token' : token, 278 'lpNonce' : jQuery('#lpNonce').val() 279 }, 280 success: function(res){ 281 282 if(res.result==="fail"){ 283 jQuery.each(res.errors, function (k, v) { 284 if(k==="email"){ 285 jQuery("input[name='email7']").addClass('error-msg'); 286 } 287 if(k==="message"){ 288 jQuery("textarea[name='message7']").addClass('error-msg'); 289 } 290 if(k==="name7"){ 291 jQuery("input[name='name7']").addClass('error-msg'); 292 } 293 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 294 $this.find('.lp-search-icon').addClass('fa-cross'); 295 //$this.append(res.state); 296 }); 297 } 298 else{ 299 $this.find('.lp-search-icon').removeClass('fa-spinner fa-spin'); 300 $this.find('.lp-search-icon').addClass('fa-check'); 301 // success msg. 302 jQuery('.lp-lead-success-msg-outer').fadeIn('700'); 303 //$this.append(res.state); 304 $this[0].reset(); 305 } 306 } 307 }); 308 309 }); 310 }) 311 312 } 313 314 315 }); 316 317 318/* jquery ajax code for expired listing plan change */ 319 320 jQuery(document).on('click','.lp-change-proceed-link', function(e){ 321 jQuery('div.lp-existing-plane-container').slideToggle(700); 322 jQuery('div.lp-new-plane-container').slideToggle(700); 323 e.preventDefault(); 324 }); 325 326 jQuery(document).on('click','.lp-role-back-to-current-plan', function(e){ 327 jQuery('div.lp-existing-plane-container').slideToggle(700); 328 jQuery('div.lp-new-plane-container').slideToggle(700); 329 e.preventDefault(); 330 }); 331 332 jQuery(document).on('click','.lp-back-to-change-plan', function(e){ 333 jQuery('input[name="submit-change"]').show(); 334 jQuery('.change-plan-btn-holder').hide(); 335 jQuery('.lp-change-plane-status .lp-action-div').html(''); 336 e.preventDefault(); 337 }) 338 339 /* for recurring stripe */ 340 jQuery(document).on('click','#select-plan-form .select-plan-form input[name=plans-posts]', function(){ 341 jQuery('input[name="submit-change"]').show(); 342 jQuery('.change-plan-btn-holder').hide(); 343 jQuery("a.lp_change_plan_action").hide(''); 344 jQuery("div.lp-action-div form").hide(''); 345 }); 346 347 348 jQuery('.lp-change-plan-btn').on('click', function(e){ 349 var listing_id = ''; 350 var listing_status = ''; 351 var plan_title = ''; 352 var plan_price = ''; 353 var haveplan = ''; 354 jQuery('div.lp-loadingPlans').html(jQuery('div.lp-loadingPlans').data('default')); 355 listing_id = jQuery(this).data('listingid'); 356 plan_title = jQuery(this).data('plantitle'); 357 plan_price = jQuery(this).data('planprice'); 358 haveplan = jQuery(this).data('haveplan'); 359 listing_status = jQuery(this).data('listingstatus'); 360 jQuery('.lp-selected-plan-price h3' ).html(''); 361 jQuery('.lp-selected-plan-price h3' ).text(plan_title); 362 jQuery('.lp-selected-plan-price h4' ).html(''); 363 jQuery('.lp-selected-plan-price h4' ).html(plan_price); 364 jQuery('#select-plan-form input#listing_id' ).val(listing_id); 365 jQuery('#select-plan-form input#listing_statuss' ).val(listing_status); 366 jQuery.ajax({ 367 type: 'POST', 368 dataType: 'json', 369 url: single_ajax_object.ajaxurl, 370 data: { 371 'action': 'listingpro_change_plan_data', 372 'listing_id': listing_id, 373 'plan_title': plan_title, 374 'plan_price': plan_price, 375 'haveplan': haveplan, 376 'listing_status': listing_status, 377 'lpNonce' : jQuery('#lpNonce').val() 378 }, 379 success: function(data){ 380 jQuery('div.lp-loadingPlans').html(data); 381 } 382 }); 383 384 e.preventDefault(); 385 }); 386 jQuery(document).on('submit', '#select-plan-form',function(event){ 387 var plan_id = '';
388 $this = jQuery(this); 389 listing_idd = ''; 390 listing_status = ''; 391 listing_idd = jQuery("input[name='plans-posts']:checked").val(); 392 listing_id = jQuery("input[name='listing-id']").val(); 393 listing_status = jQuery("input[name='listing_status']").val(); 394 jQuery('.lp-change-plane-status .lp-action-div').html(''); 395 if( typeof(listing_idd) !== "undefined" ){ 396 jQuery("div.lp-expire-update-status").html('<i class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>'); 397 jQuery.ajax({ 398 type: 'POST', 399 dataType: 'json', 400 url: single_ajax_object.ajaxurl, 401 data: { 402 'action': 'listingpro_change_plan', 403 'ch_plan_id': listing_idd, 404 'ch_listing_id': listing_id, 405 'ch_listing_status': listing_status, 406 'lpNonce' : jQuery('#lpNonce').val() 407 }, 408 success: function(data){ 409 //jQuery('#select-plan-form')[0].reset(); 410 if( data.subscribed ){ 411 if(data.subscribed=="yes"){ 412 alert(data.alertmsg); 413 } 414 } 415 jQuery('input[name="submit-change"]').hide(); 416 jQuery('.change-plan-btn-holder').show(); 417 jQuery("div.lp-expire-update-status").html(''); 418 jQuery('.lp-change-plane-status .lp-action-div').html(''); 419 jQuery('.lp-change-plane-status .lp-action-div').html(data.action); 420 421 } 422 }); 423 424 } 425 event.preventDefault(); 426 }) 427 428 }); 429 430 431 /* change plan proceedings */ 432 jQuery(document).on('click', '.lp_change_plan_action', function(e){ 433 var planid = jQuery('.lp-action-div input[name="planid"]').val(); 434 var listingid = jQuery('.lp-action-div input[name="listingid"]').val(); 435 jQuery('.lp-action-div').html(''); 436 jQuery("div.lp-expire-update-status").html('<i class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>'); 437 jQuery.ajax({ 438 type: 'POST', 439 dataType: 'json', 440 url: single_ajax_object.ajaxurl, 441 data: { 442 'action': 'listingpro_change_plan_proceeding', 443 'plan_iddd': planid, 444 'listing_iddd': listingid, 445 'lpNonce' : jQuery('#lpNonce').val() 446 }, 447 success: function(data){ 448 //jQuery('#select-plan-form')[0].reset(); 449 jQuery("div.lp-expire-update-status").html(''); 450 jQuery("div.lp-expire-update-status").html(data.message); 451 } 452 }); 453 454 e.preventDefault(); 455 }) 456 /* end change plan proceedings */ 457 458 /* delete subscription proceedings */ 459jQuery(document).on('click', 'a.delete-subsc-btn', function(e){ 460 461 e.preventDefault(); 462 var $this = jQuery(this), 463 cMsg = $this.data('cmsg'); 464 465 466 var r = confirm(cMsg); 467 468 469 if( r == true ) 470 { 471 jQuery('body').addClass('listingpro-loading'); 472 var subscript_id = jQuery(this).attr('href'); 473 if($this.hasClass('paystack-unsub')) { 474 var mail_token = $this.attr('data-mailtoekn'); 475 unsubsribe_paystack(subscript_id, mail_token, $this); 476 477 }else if ($this.hasClass('razorpay-unsub')) { 478 unsubsribe_razorpay(subscript_id, $this); 479 } else { 480 jQuery.ajax({ 481 type: 'POST', 482 dataType: 'json', 483 url: single_ajax_object.ajaxurl, 484 data: { 485 'action': 'listingpro_cancel_subscription_proceeding', 486 'subscript_id': subscript_id, 487 'lpNonce' : jQuery('#lpNonce').val() 488 }, 489 success: function(data){ 490 jQuery('body').removeClass('listingpro-loading'); 491 alert(data.msg); 492 if(data.status=="success"){ 493 $this.closest('tr').slideToggle(); 494 } 495 496 }, 497 error: function(jqXHR, textStatus, errorThrown) { 498 jQuery('body').removeClass('listingpro-loading'); 499 console.log(textStatus, errorThrown); 500 } 501 }); 502 } 503 } 504 }); 505 506 /* Report listing or Report Review */ 507 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){ 508 var $this = jQuery(this); 509 var $posttype = $this.data('posttype'); 510 var $postid = $this.data('postid'); 511 var $reportedby = $this.data('reportedby'); 512 jQuery('body').addClass('listingpro-loading'); 513 jQuery.ajax({ 514 type: 'POST', 515 dataType: 'json', 516 url: single_ajax_object.ajaxurl, 517 data: { 518 'action': 'listingpro_report_this_post', 519 'posttype': $posttype, 520 'postid': $postid, 521 'reportedby': $reportedby, 522 'lpNonce' : jQuery('#lpNonce').val() 523 }, 524 success: function(data){ 525 jQuery('body').removeClass('listingpro-loading'); 526 jQuery('div.lp-top-notification-bar').html(''); 527 var alertmsgs = ''; 528 if(data.status==="success"){ 529 alertmsgs = '<div class="lp-reporting-success">
529'+data.msg+'</div>'; 530 jQuery('div.lp-top-notification-bar').html(alertmsgs); 531 } 532 else{ 533 alertmsgs = '<div class="lp-reporting-error">'+data.msg+'</div>'; 534 jQuery('div.lp-top-notification-bar').html(alertmsgs); 535 } 536 jQuery('div.lp-top-notification-bar').slideDown('slow').delay(2000).slideUp('slow'); 537 //alert(data.msg); 538 539 }, 540 error: function(jqXHR, textStatus, errorThrown) { 541 jQuery('body').removeClass('listingpro-loading'); 542 console.log(textStatus, errorThrown); 543 } 544 }); 545 546 e.preventDefault(); 547 }) 548 549 550 /* lp bar graph print options */ 551 552 jQuery(document).on('click', 'div.lp_user_stats_btn, ul li .lp_stats_duratonBtn', function(e){ 553 $this = jQuery(this); 554 if($this.hasClass('active') && ($this.hasClass('lp_user_stats_btn'))){}else{ 555 jQuery('div.lp_user_stats_btn').removeClass('active'); 556 jQuery( "#lpgraph" ).empty(); 557 $duration = jQuery('ul li .lp_stats_duratonBtn.active').data('chartduration'); 558 $type = $this.data('type'); 559 $label = $this.data('label'); 560 jQuery('ul.lp_stats_duration_filter li button').data('label', $label); 561 jQuery('body').addClass('listingpro-loading'); 562 jQuery.ajax({ 563 type: 'POST', 564 dataType: 'json', 565 url: single_ajax_object.ajaxurl, 566 data: { 567 'action': 'listingpro_show_bar_chart', 568 'type': $label, 569 'duration': $duration, 570 'lpNonce' : jQuery('#lpNonce').val() 571 }, 572 success: function(data){ 573 jQuery('body').removeClass('listingpro-loading'); 574 jQuery('ul.lp_stats_duration_filter').show(); 575 showthischart(data.data, $type, $label); 576 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(''); 577 jQuery('.lp_user_stats_btn.active p.lpstatsnumber').text(data.counts); 578 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(''); 579 jQuery('.lp_user_stats_btn.active').find('.lp_status_duration_counter').text(data.resp); 580 //alert(data.msg); 581 582 }, 583 error: function(jqXHR, textStatus, errorThrown) { 584 jQuery('body').removeClass('listingpro-loading'); 585 console.log(textStatus, errorThrown); 586 } 587 }); 588 } 589 }); 590 591function showthischart($datarray, $type, $label){ 592 Morris.Bar({ 593 element: 'lpgraph', 594 data : $datarray, 595 xkey: 'x', 596 ykeys: ['y'], 597 labels: [$type] 598 }); 599 if($label=="view"){ 600 jQuery('div.lpviewchart').addClass('active'); 601 }else if($label=="leads"){ 602 jQuery('div.lpviewleads').addClass('active'); 603 }else if($label=="reviews"){ 604 jQuery('div.lpviewreviews').addClass('active'); 605 } 606} 607 608/* start for coupon button on checkout page */ 609jQuery(document).on('click', 'button.coupon-apply-bt', function(){ 610 var couponcode = jQuery('input[name=coupon-text-field]').val(); 611 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 612 var $listingID = jQuery('input[name=listing_id]:checked').val(); 613 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 614 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 615 var $tax =jQuery('input[name=listing_id]:checked').data('taxenable'); 616 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 617 618 if(couponcode === ''){}else{ 619 jQuery('body').addClass('listingpro-loading'); 620 jQuery.ajax({ 621 type: 'POST', 622 dataType: 'json', 623 url: single_ajax_object.ajaxurl, 624 data: { 625 'action': 'listingpro_apply_coupon_code', 626 'coupon': couponcode, 627 'listingid': $listingID, 628 'taxrate': $taxRate, 629 'price': $price, 630 'lpNonce' : jQuery('#lpNonce').val() 631 }, 632 success: function(data){ 633 jQuery('body').removeClass('listingpro-loading'); 634 if(data.status=="success"){ 635 $discount = data.discount; 636 $discounttype = data.coupontype; 637 $discountIn = '%'; 638 if($discounttype=='on'){ 639 /* means it is fixed price coupon */ 640 $discountIn = ''; 641 } 642 $newprice = data.price; 643 $newprice = parseFloat($newprice).toFixed(2); 644 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 645 if(jQuery('li').hasClass('checkout_discount_val')){}else{ 646 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>'); 647 } 648 }else{ 649 ajax_success_popup( data, '' ) 650 } 651 652 }, 653 error: function(jqXHR, textStatus, errorThrown) { 654 jQuery('body').removeClass('listingpro-loading'); 655 console.log(textStatus, errorThrown); 656 } 657 }); 658 } 659 660 }); 661 662/* reset tax in database while switching offto discound */ 663jQuery(document).on('click', 'input[name="lp_checkbox_coupon"]', function(){ 664 if(jQuery(this).hasClass('active')){}else{ 665 666 var couponcode = jQuery('input[name=coupon-text-field]').val(); 667 var $price = jQuery('input[name=listing_id]:checked').data('planprice'); 668 var $listingID = jQuery('input[name=listing_id]:checked').val(); 669 var $post_title = jQuery('input[name=listing_id]:checked').data('title'); 670 var $planID = jQuery('input[name=listing_id]:checked').data('planid'); 671 var $tax =jQuery('input[name=listing_id]:checked').data('taxenable');
672 var $taxRate = jQuery('input[name=listing_id]:checked').data('taxrate'); 673 674 jQuery.ajax({ 675 type: 'POST', 676 dataType: 'json', 677 url: single_ajax_object.ajaxurl, 678 data: { 679 'action': 'listingpro_apply_coupon_code', 680 'coupon': couponcode, 681 'notusing': 'true', 682 'listingid': $listingID, 683 'taxrate': $taxRate, 684 'price': $price, 685 'lpNonce' : jQuery('#lpNonce').val() 686 }, 687 success: function(data){ 688 jQuery('body').removeClass('listingpro-loading'); 689 if(data.status=="success"){ 690 $discount = data.discount; 691 $discounttype = data.coupontype; 692 $discountIn = '%'; 693 if($discounttype=='on'){ 694 /* means it is fixed price coupon */ 695 $discountIn = ''; 696 } 697 $newprice = data.price; 698 $newprice = parseFloat($newprice).toFixed(2); 699 lp_add_checkout_data_fields_in_form($listingID, $post_title, $planID, $newprice, $tax, $taxRate); 700 if(jQuery('li').hasClass('checkout_discount_val')){}else{ 701 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>'); 702 } 703 } 704 705 }, 706 error: function(jqXHR, textStatus, errorThrown) { 707 jQuery('body').removeClass('listingpro-loading'); 708 console.log(textStatus, errorThrown); 709 } 710 }); 711 712 713 } 714 715 }); 716 717 718 719/* ajax call to reply to leads message */ 720jQuery(document).on('submit', 'form[name=lp_leadReply]', function(e){ 721 722 $this = jQuery(this); 723 $this.find('.lpthisloading').show(); 724 var fd = new FormData(this); 725 fd.append('action', 'lp_reply_to_lead_msg'); 726 fd.append('lpNonce', jQuery('#lpNonce').val()); 727 jQuery.ajax({ 728 type: 'POST', 729 url: single_ajax_object.ajaxurl, 730 data:fd, 731 contentType: false, 732 processData: false, 733 success: function(res){ 734 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 735 $this.find('.lpthisloading').addClass('fa-check'); 736 window.location.href=window.location.href 737 $this[0].reset(); 738 }, 739 error: function(request, error){ 740 //alert(error); 741 $this.find('.lpthisloading').removeClass('fa-spinner fa-spin'); 742 $this.find('.lpthisloading').addClass('fa-check'); 743 window.location.href=window.location.href 744 } 745 }); 746 e.preventDefault(); 747 return false; 748}); 749 750/* ajax call read message thread on click */ 751 jQuery(document).on('click', '.lp-read-messages .lp-read-message-inner', function(e){ 752 $this = jQuery(this); 753 $loaderImg = $this.data('loader'); 754 $listingid = $this.data('listingid'); 755 $useremail = $this.data('email'); 756 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('active'); 757 jQuery('.lp-read-messages .lp-read-message-inner').removeClass('unread'); 758 $this.addClass('active'); 759 $this.addClass('read'); 760 if($listingid){ 761 jQuery('.lpinboxmiddlepart').html(''); 762 jQuery('.lpinboxrightpart').html(''); 763 jQuery('.lpinboxmiddlepart').html('<div class="text-center loadercenterclass"><img src="'+$loaderImg+'" width=35 height=35></div>'); 764 jQuery('.lpinboxrightpart').html('<div class="text-center loadercenterclass"><img src="'+$loaderImg+'" width=35 height=35></div>'); 765 jQuery.ajax({ 766 type: 'POST', 767 dataType: 'json', 768 url: single_ajax_object.ajaxurl, 769 data: { 770 'action': 'lp_preview_this_message_thread', 771 'listindid': $listingid, 772 'useremail': $useremail, 773 'lpNonce' : jQuery('#lpNonce').val() 774 }, 775 success: function(data){ 776 jQuery('.lpinboxmiddlepart').html(''); 777 jQuery('.lpinboxrightpart').html('');
778 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 779 jQuery('.lpinboxrightpart').html(data.outputright); 780 if (data.notify_alert != true) { 781 jQuery('.unreadMsgDot').remove(); 782 } 783 784 }, 785 error: function(jqXHR, textStatus, errorThrown) { 786 jQuery('.lpinboxmiddlepart').html(''); 787 jQuery('.lpinboxrightpart').html(''); 788 jQuery('.lpinboxmiddlepart').html(data.outputcenter); 789 jQuery('.lpinboxrightpart').html(data.outputright); 790 } 791 }); 792 } 793 794 795 796 }); 797 798 799/* ==================for saving id in session for checkout============= */ 800 801 jQuery(document).on('click', 'a.lp-pay-publish-btn, a.lp-listing-pay-button, input.lp-listing-pay-button', function(e){ 802 e.preventDefault(); 803 $listingID = jQuery(this).data('lpthisid'); 804 $href = jQuery(this).attr('href'); 805 806 jQuery(this).find('i').removeClass('fa-credit-card').addClass('fa-spinner fa-spin'); 807 808 jQuery.ajax({ 809 type: 'POST', 810 dataType: 'json', 811 url: single_ajax_object.ajaxurl, 812 data: { 813 'action': 'lp_save_thisid_in_session', 814 'listing_id': $listingID, 815 'lpNonce' : jQuery('#lpNonce').val() 816 }, 817 success: function(data){ 818 location.href = $href; 819 }, 820 error: function(errorThrown) { 821 location.href = $href; 822 } 823 }); 824 }); 825 826/* ==================delete converstaion inbox============= */ 827 828 jQuery(document).on('click', 'button.lp-delte-conv', function(){ 829 $this = jQuery(jQuery(this)); 830 $emailid = jQuery(this).data('emailid'); 831 $listingid = jQuery(this).data('listingid'); 832 $this.closest('#lp-ad-click-inner').find('.lpthisloading').show(); 833 jQuery.ajax({ 834 type: 'POST', 835 dataType: 'json', 836 url: single_ajax_object.ajaxurl, 837 data: { 838 'action': 'lp_delete_this_conversation', 839 'listingid': $listingid, 840 'emailid': $emailid, 841 'lpNonce' : jQuery('#lpNonce').val() 842 }, 843 success: function(data){ 844 $this.closest('#lp-ad-click-inner').find('.lpthisloading').removeClass('fa-spinner fa-spin'); 845 $this.closest('#lp-ad-click-inner').find('.lpthisloading').addClass('fa-check'); 846 window.location.href=window.location.href 847 }, 848 error: function(jqXHR, textStatus, errorThrown) { 849 console.log(errorThrown); 850 } 851 }); 852 }); 853 854 855/* ==================submit contact us form============= */ 856jQuery(document).ready(function($){ 857 jQuery( '#contactMSGForm' ).on('submit', function(e){ 858 jQuery('#contactMSGForm #error').hide(); 859 jQuery('#contactMSGForm #success').hide(); 860 jQuery('#contactMSGForm .statuss').show(); 861 e.preventDefault(); 862 $this = jQuery(this); 863 isCaptcha = jQuery(this).data('lp-recaptcha'); 864 siteKey = jQuery(this).data('lp-recaptcha-sitekey'); 865 token = ''; 866 var fd = new FormData(this); 867 fd.append('action', 'lp_ajax_contact_submit'); 868 fd.append('lpNonce', jQuery('#lpNonce').val()); 869 if ( (isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null) ) { 870 871 jQuery.ajax({ 872 type: 'POST', 873 url: single_ajax_object.ajaxurl, 874 data:fd, 875 contentType: false, 876 processData: false, 877 878 success: function(res){ 879 jQuery('#contactMSGForm .statuss').hide(); 880 var res = jQuery.parseJSON(res); 881 if(res.status=="error"){ 882 jQuery('#contactMSGForm #error span p').html(''); 883 jQuery('#contactMSGForm #error span p').html(res.msg); 884 jQuery('#contactMSGForm #error').show(); 885 } 886 else if(res.status=="success"){ 887 jQuery('#contactMSGForm #success span p').html(''); 888 jQuery('#contactMSGForm #success span p').html(res.msg); 889 jQuery('#contactMSGForm #success').show(); 890 } 891 892 }, 893 error: function(request, error){ 894 jQuery('#contactMSGForm .statuss').hide(); 895 alert(error); 896 } 897 }); 898 }else{ 899 //for recpatcha 900 901 grecaptcha.ready(function() { 902 grecaptcha.execute(siteKey, {action: 'lp_contact'}).then(function(token) { 903 904 fd.append('recaptha-action', 'lp_contact'); 905 fd.append('token', token); 906 907 jQuery.ajax({ 908 type: 'POST', 909 url: single_ajax_object.ajaxurl, 910 data:fd, 911 contentType: false, 912 processData: false, 913 914 success: function(res){ 915 jQuery('#contactMSGForm .statuss').hide(); 916 var res = jQuery.parseJSON(res); 917 if(res.status=="error"){ 918 jQuery('#contactMSGForm #error span p').html(''); 919 jQuery('#contactMSGForm #error span p').html(res.msg); 920 jQuery('#contactMSGForm #error').show(); 921 } 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=============== */ 943 jQuery(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=============== */ 974 function 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]").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===================== */ 1011 jQuery(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"){ 1027 }else{ 1028 1029 } 1030 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 1031 }, 1032 error: function(jqXHR, textStatus, errorThrown) { 1033 alert(errorThrown); 1034 jQuery('#lp-user-g-analytics .analyticsspin').hide(); 1035 } 1036 }); 1037 }); 1038 1039 function claimformvalidation(login, policy) { 1040 if (login === true) { 1041 var name = jQuery('#claimform #fullname').val(), 1042 lname = jQuery('#claimform #lastname').val(), 1043 phone = jQuery('#claimform #phoneClaim').val(), 1044 email = jQuery('#claimform #bemail').val(), 1045 massage = jQuery('#claimform #message').val(), 1046 checkpandpcheck = true; 1047 if (policy === true){ 1048 checkpandpcheck = false; 1049 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1050 } 1051 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && checkpandpcheck === true) { 1052 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1053 } else { 1054 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1055 } 1056 } else { 1057 var name = jQuery('#claimform #fullname').val(), 1058 lname = jQuery('#claimform #lastname').val(), 1059 phone = jQuery('#claimform #phoneClaim').val(), 1060 email = jQuery('#claimform #bemail').val(), 1061 massage = jQuery('#claimform #message').val(), 1062 newuser = jQuery('#claimform #claim_new_user_email').val(), 1063 euser = jQuery('#claimform #claim_username').val(), 1064 epass = jQuery('#claimform #claim_userpass').val(), 1065 checkpandpcheck = true; 1066 if (policy === true){ 1067 checkpandpcheck = false;
1068 checkpandpcheck = jQuery('#claimform .lpprivacycheckboxopt').is(':checked'); 1069 } 1070 if (jQuery('#lp-signin-on-claim').is(':checked')) { 1071 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && euser != '' && epass != '' && checkpandpcheck === true) { 1072 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1073 } else { 1074 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1075 } 1076 } else { 1077 if (name != '' && lname != '' && phone != '' && email != '' && massage != '' && newuser != '' && checkpandpcheck === true) { 1078 jQuery('#claimform input[type=submit]').removeAttr('disabled'); 1079 } else { 1080 jQuery('#claimform input[type=submit]').attr('disabled', 'disabled'); 1081 } 1082 } 1083 } 1084 } 1085 jQuery(document).ready(function () { 1086 var claimuserlogin = false, 1087 ppolicy = false; 1088 if (jQuery('body').hasClass('logged-in')) { 1089 claimuserlogin = true; 1090 } 1091 if (jQuery('#claimform .lpprivacycheckboxopt').length > 0) { 1092 ppolicy = true; 1093 } 1094 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 () { 1095 claimformvalidation(claimuserlogin, ppolicy); 1096 }); 1097 jQuery('#lp-signin-on-claim').click(function () { 1098 jQuery(this).closest('form').find('input[type=submit]').attr("disabled", "disabled"); 1099 jQuery('#claim_username').val(""); 1100 jQuery('#claim_userpass').val(""); 1101 jQuery('#claim_new_user_email').val(""); 1102 }); 1103 });
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.