1jQuery( document ).ready( function($) { 2 $(document).on( 'click', '.delete-card', function() { 3 var id = $(this).data('id'); 4 var nonce = $(this).data('nonce'); 5 var post = $(this).parents('tr:first'); 6 $.ajax({ 7 type: 'post', 8 url: MyAjax.ajaxurl, 9 data: { 10 action: 'delete_card', 11 nonce: nonce, 12 id: id 13 }, 14 success: function( result ) { 15 if ( result == 'error' ) { 16 $('.authnet-success-message').hide(); 17 $('.authnet-error-message').show(); 18 } else { 19 post.fadeOut( function() { 20 post.remove(); 21 }); 22 $('.authnet-error-message').hide(); 23 $('.authnet-success-message').show(); 24 } 25 } 26 }); 27 return false; 28 }); 29 30 $(document).on( 'submit', '#authnet-cc-form', function(e) { 31 e.preventDefault(); 32 var authnetCcForm = $(this).serialize(); 33 $.ajax({ 34 type: 'post', 35 url: MyAjax.ajaxurl+'?action=add_update_card', 36 data: authnetCcForm, 37 success: function( result ) { 38 if ( result == 'error' ) { 39 $('html, body').animate({ 40 scrollTop: $('#credit-cards').offset().top 41 }, 500); 42 $('.authnet-success-message').hide(); 43 $('.authnet-error-message').show(); 44 } else { 45 $('#credit-cards-table').replaceWith(result); 46 $('.add-card-heading').hide(); 47 $('.edit-card-heading').hide(); 48 $('.make-default').hide(); 49 $('.authnet-credit-card').hide(); 50 $('#authnet-card-number').val(''); 51 $('#authnet-card-expiry').val(''); 52 $('#authnet-card-cvc').val(''); 53 $('#authnet-card-id').val(''); 54 $('#authnet-make-default').prop('checked', false); 55 $('.add-card').show(); 56 $('html, body').animate({ 57 scrollTop: $('#credit-cards').offset().top 58 }, 500); 59 $('.authnet-error-message').hide(); 60 $('.authnet-success-message').show(); 61 } 62 } 63 }); 64 return false; 65 }); 66 67 $(document).on( 'click', '.add-card', function(e) { 68 e.preventDefault(); 69 $('.edit-card-heading').hide(); 70 $('.add-card-heading').show(); 71 $('.authnet-credit-card').show(); 72 $('.make-default').show(); 73 $('.add-card').hide(); 74 $('#authnet-card-id').val(''); 75 $('html, body').animate({ 76 scrollTop: $('.add-card-heading').offset().top 77 }, 500); 78 }); 79 80 $(document).on( 'click', '.edit-card', function(e) { 81 e.preventDefault(); 82 var id = $(this).data('id'); 83 var title = $(this).data('title'); 84 var exp = $(this).data('exp'); 85 var is_default = $(this).data('default'); 86 var address = $(this).data('address'); 87 var fname = $(this).data('fname'); 88 var lname = $(this).data('lname'); 89 var state = $(this).data('state'); 90 var phone = $(this).data('phone'); 91 var company = $(this).data('company'); 92 var city = $(this).data('city'); 93 var zip = $(this).data('zip'); 94 $('.edit-card-heading').show(); 95 $('.add-card-heading').hide(); 96 $('.authnet-credit-card').show(); 97 $('.add-card').hide(); 98 $('.edit-card-heading').html(title); 99 $('#authnet-cust-address').val(address); 100 $('#authnet-cust-fname').val(fname); 101 $('#authnet-cust-lname').val(lname); 102 $('#authnet-cust-company').val(company); 103 $('#authnet-cust-state').val(state); 104 $('#authnet-cust-phone').val(phone); 105 $('#authnet-cust-city').val(city); 106 $('#authnet-cust-zip').val(zip); 107 $('#authnet-card-expiry').val(exp); 108 $('#authnet-card-id').val(id); 109 if (is_default == 'no') { 110 $('.make-default').show(); 111 } else { 112 $('.make-default').hide(); 113 } 114 $('html, body').animate({ 115 scrollTop: $('.edit-card-heading').offset().top 116 }, 500); 117 }); 118 119 $(document).on( 'click', '.cc-form-cancel', function(e) { 120 e.preventDefault(); 121 $('.add-card-heading').hide(); 122 $('.edit-card-heading').hide(); 123 $('.make-default').hide(); 124 $('.authnet-credit-card').hide(); 125 $('#authnet-card-number').val(''); 126 $('#authnet-card-expiry').val(''); 127 $('#authnet-card-cvc').val(''); 128 $('#authnet-card-id').val(''); 129 $('#authnet-make-default').prop('checked', false); 130 $('.add-card').show(); 131 $('html, body').animate({ 132 scrollTop: $('#credit-cards').offset().top 133 }, 500); 134 }); 135 136 $(document).ajaxStart(function() { 137 $( '.authnet-credit-card' ).block({ 138 message: null, 139 overlayCSS: { 140 background: '#fff', 141 opacity: 0.6 142 } 143 }); 144 }); 145 146 $(document).ajaxComplete(function() { 147 $( '.authnet-credit-card' ).unblock(); 148 }); 149}); 150 151 152
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.