1jQuery(document).ready(function () { 2 3 if(jQuery('.mercadopago-metho-wrap').length) { 4 jQuery('.lp-rightbnk-transfer-msg-new').html(jQuery('.lp-rightbnk-transfer-msg-new').html().replace('Sorry! You have not enable any payment method','')); 5 } 6 7 jQuery('.lp_payment_step_next.firstStep').click(function () { 8 jQuery('.lp-checkout-recurring-wrap').show(); 9 }); 10 11 jQuery(document).on('click', 'button.firstStep', function(){ 12 jQuery('#listings_checkout_form .inactive-license').closest('.lp-method-wrap').css('display', 'none'); 13 jQuery('#listings_checkout_form .invalid-currency').closest('.lp-method-wrap').css('display', 'none'); 14 }); 15 16 jQuery(document).on('click', 'button.firstStep, button.secondStep, button.thirdStep', function(){ 17 var payment_method = jQuery('input[name="plan"]:checked').val(); 18 if( payment_method == 'mercadopago' ){ 19 jQuery('.lp-checkout-recurring-wrap input[name="lp-recurring-option"]').prop("checked", false); 20 jQuery('.lp-checkout-recurring-wrap').css('display', 'none'); 21 } 22 }); 23 24 jQuery('#listings_checkout_form').on('submit', function(e){ 25 var $this = jQuery(this), 26 method = $this.find('input[name="plan"]:checked').val(), 27 listing_id = $this.find('input[name="listing_id"]:checked').val(), 28 plan_id = $this.find('input[name="listing_id"]:checked').data('planid'), 29 paid_amount = jQuery('span.lp-subtotal-total-price').data('subtotal'), 30 currency = jQuery('input[name=currency]').val(), 31 ajaxurl = ajax_search_term_object.ajaxurl; 32 33 var recurrText = 'no'; 34 if($this.find('input[name="lp-recurring-option"]').is(':checked')) { 35 recurrText = 'yes'; 36 } 37 38 var coupon_used = ''; 39 if($this.find('input[name=coupon-text-field]').length) { 40 coupon_used = $this.find('input[name=coupon-text-field]').val(); 41 } 42 43 var callFrom = 'listing'; 44 if(jQuery('#claimID').length) { 45 callFrom = 'claim'; 46 } 47 48 if(method === 'mercadopago'){ 49 jQuery("body").addClass("listingpro-loading"); 50 jQuery.ajax({ 51 type: "POST", 52 dataType: "json", 53 url: ajaxurl, 54 data: { 55 "action": "lp_mercadopago_submit_form", 56 "listing": listing_id, 57 "plan": plan_id, 58 "amount": paid_amount, 59 "taxrate": $this.find("input[name=listings_tax_price]").val(), 60 "coupon": coupon_used, 61 "currency": currency, 62 "recurring" : recurrText, 63 'callFrom' : callFrom 64 }, 65 success: function(res){ 66 jQuery("body").removeClass("listingpro-loading"); 67 if( res.status == 'error' ){ 68 alert(res.msg); 69 }else{ 70 window.location.href = res.msg; 71 } 72 }, 73 error: function(errorThrown){ 74 alert(errorThrown); 75 jQuery("body").removeClass("listingpro-loading"); 76 } 77 }); 78 return false; 79 } 80 }); 81 82 var packages = []; 83 jQuery(document).on('click', 'input[name="lpadsoftype[]"]', function() { 84 if(jQuery(this).is(':checked')){ 85 packages.push(jQuery(this).val()); 86 }else{ 87 var i = packages.indexOf(jQuery(this).val()); 88 if(i != -1) { 89 packages.splice(i, 1); 90 } 91 } 92 }); 93 94 jQuery('#lp-new-ad-compaignForm, .lp_campaign_paynow').on('submit', function(e){ 95 var $this = jQuery(this), 96 lpTotalPrice = jQuery('input[name="ads_price"]').val(), 97 adsTypeVal = jQuery('input[name="adsTypeval"]').val(), 98 adsDays = '', 99 taxPrice = jQuery('input[name="taxprice"]').val(), 100 listing_id = jQuery('select[name="lp_ads_for_listing"]').val(), 101 method = jQuery('input[name="method"]:checked').val(), 102 ajaxurl = ajax_search_term_object.ajaxurl; 103 104 var totalPrice = lpTotalPrice; 105 if($this.data('type') == 'adsperclick') { 106 totalPrice = jQuery('input[name="adsprice_pc"]').val(); 107 } 108 if(jQuery('input[name="ads_days"]').length) { 109 adsDays = jQuery('input[name="ads_days"]').val(); 110 } 111 112 if(method === 'mercadopago'){ 113 jQuery("body").addClass("listingpro-loading"); 114 115 jQuery.ajax({ 116 type: "POST", 117 dataType: "json", 118 url: ajaxurl, 119 data: { 120 "action": "lp_mercadopago_submit_campaign_form", 121 "listing": listing_id, 122 "packages": packages, 123 "lpTOtalprice":lpTotalPrice, 124 "adsTypeval":adsTypeVal, 125 "ads_days":adsDays, 126 "ads_price":totalPrice, 127 "taxprice":taxPrice, 128 }, 129 success: function(res){ 130 jQuery("body").removeClass("listingpro-loading"); 131 if( res.status == 'error' ){ 132 alert(res.msg); 133 }else{ 134 window.location.href = res.msg; 135 } 136 }, 137 error: function(errorThrown){ 138 alert(errorThrown); 139 jQuery("body").removeClass("listingpro-loading"); 140 } 141 }); 142 } 143 144 return false; 145 });
146 147}); 148 149 150jQuery(document).on('click', 'a.mercadopago-unsub', function(e){ 151 e.preventDefault(); 152 var $this = jQuery(this), 153 cMsg = $this.data('cmsg'); 154 var r = confirm(cMsg); 155 if( r == true ) { 156 jQuery('body').addClass('listingpro-loading'); 157 var subscript_id = jQuery(this).attr('href'); 158 var token = $this.attr('data-token'); 159 unsubsribe_mercadopago(subscript_id, token, $this); 160 } 161 }); 162 163function unsubsribe_mercadopago(subs_id, token, $this) { 164 165 var ajaxurl = ajax_search_term_object.ajaxurl; 166 jQuery.ajax({ 167 type: "POST", 168 dataType: "json", 169 url: ajaxurl, 170 data: { 171 "action": "lp_unsub_mercadopago", 172 "sub_id": subs_id, 173 "token": token, 174 'lpNonce' : jQuery('#lpNonce').val() 175 }, 176 success: function(res){ 177 jQuery("body").removeClass("listingpro-loading"); 178 alert(res.msg); 179 if(res.status=="success"){ 180 $this.closest('.lp-listing-outer-container').slideToggle(); 181 } 182 }, 183 error: function(errorThrown){ 184 alert(errorThrown); 185 jQuery("body").removeClass("listingpro-loading"); 186 } 187 }); 188}
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.