1jQuery(function ($) { 2 3 function enable_mask(){ 4 const cardnumber = document.querySelectorAll('.cardnumber'); 5 const expirationdate = document.querySelectorAll('.expirationdate'); 6 const securitycode = document.querySelectorAll('.securitycode'); 7 8 //Mask the Credit Card Number Input 9 if (cardnumber) { 10 cardnumber.forEach(function (e) { 11 new IMask(e, { 12 mask: [ 13 { 14 mask: '0000 000000 00000', 15 regex: '^3[47]\\d{0,13}', 16 cardtype: 'american express' 17 }, 18 { 19 mask: '0000 0000 0000 0000', 20 regex: '^(?:6011|65\\d{0,2}|64[4-9]\\d?)\\d{0,12}', 21 cardtype: 'discover' 22 }, 23 { 24 mask: '0000 000000 0000', 25 regex: '^3(?:0([0-5]|9)|[689]\\d?)\\d{0,11}', 26 cardtype: 'diners' 27 }, 28 { 29 mask: '0000 0000 0000 0000', 30 regex: '^(5[1-5]\\d{0,2}|22[2-9]\\d{0,1}|2[3-7]\\d{0,2})\\d{0,12}', 31 cardtype: 'mastercard' 32 }, 33 // { 34 // mask: '0000-0000-0000-0000', 35 // regex: '^(5019|4175|4571)\\d{0,12}', 36 // cardtype: 'dankort' 37 // }, 38 // { 39 // mask: '0000-0000-0000-0000', 40 // regex: '^63[7-9]\\d{0,13}', 41 // cardtype: 'instapayment' 42 // }, 43 { 44 mask: '0000 000000 00000', 45 regex: '^(?:2131|1800)\\d{0,11}', 46 cardtype: 'jcb15' 47 }, 48 { 49 mask: '0000 0000 0000 0000', 50 regex: '^(?:35\\d{0,2})\\d{0,12}', 51 cardtype: 'jcb' 52 }, 53 { 54 mask: '0000 0000 0000 0000', 55 regex: '^(?:5[0678]\\d{0,2}|6304|67\\d{0,2})\\d{0,12}', 56 cardtype: 'maestro' 57 }, 58 // { 59 // mask: '0000-0000-0000-0000', 60 // regex: '^220[0-4]\\d{0,12}', 61 // cardtype: 'mir' 62 // }, 63 { 64 mask: '0000 0000 0000 0000', 65 regex: '^4\\d{0,15}', 66 cardtype: 'visa' 67 }, 68 { 69 mask: '0000 0000 0000 0000', 70 regex: '^62\\d{0,14}', 71 cardtype: 'unionpay' 72 }, 73 { 74 mask: '0000 0000 0000 0000', 75 cardtype: 'Unknown' 76 } 77 ], 78 dispatch: function (appended, dynamicMasked) { 79 var number = (dynamicMasked.value + appended).replace(/\D/g, ''); 80 81 for (var i = 0; i < dynamicMasked.compiledMasks.length; i++) { 82 let re = new RegExp(dynamicMasked.compiledMasks[i].regex); 83 if (number.match(re) != null) { 84 return dynamicMasked.compiledMasks[i]; 85 } 86 } 87 } 88 }); 89 }) 90 } 91 92 //Mask the Expiration Date 93 if (expirationdate) { 94 expirationdate.forEach(function (e) { 95 new IMask(e, { 96 mask: 'MM{/}YY', 97 groups: { 98 YY: new IMask.MaskedPattern.Group.Range([0, 99]), 99 MM: new IMask.MaskedPattern.Group.Range([1, 12]), 100 } 101 }); 102 }) 103 } 104 105 //Mask the security code 106 if (securitycode) { 107 securitycode.forEach(function (e) { 108 new IMask(e, { 109 mask: '000', 110 }); 111 }) 112 } 113 } 114 115 enable_mask() 116 117 $(document.body).on('updated_checkout', function () { 118 enable_mask() 119 }); 120 121 $(document.body).on('click', '.card-change', function (event) { 122 var data = { 123 action: "payuni_card_change", 124 nonce: card_params.ajax_nonce, 125 user_id: card_params.user_id, 126 method: $(this).attr('id') 127 }; 128 129 var change = confirm('確å®è¦æ´æä¿¡ç¨å¡åï¼') 130 131 if(change){ 132 $('body').trigger( 'update_checkout' ) 133 $.ajax({ 134 url: card_params.ajax_url, 135 data: data, 136 type: 'POST', 137 dataType: "json", 138 success: function (data) { 139 if(data){ 140 $('body').trigger( 'update_checkout' ) 141 } else { 142 alert('ç¼çé¯èª¤ï¼è«ç¨åå試') 143 } 144 } 145 }) 146 } 147 }); 148})
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.