File "jquery.payment.min.js"

Full Path: /home/warrior1/public_html/wp-content/plugins/woocommerce/assets/js/jquery-payment/jquery.payment.min.js
File size: 8.08 KB
MIME-type: text/plain
Charset: utf-8

jQuery(function(k){!function(){var l,r,u,t,e,n,a,i,o,s,c,h,p,f,g,d,v,m,y,C,T,w,$,S=[].slice,D=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1};(k=window.jQuery||window.Zepto||window.$).payment={},k.payment.fn={},k.fn.payment=function(){var t=arguments[0],e=2<=arguments.length?S.call(arguments,1):[];return k.payment.fn[t].apply(this,e)},k.payment.cards=u=[{type:"maestro",patterns:[5018,502,503,506,56,58,639,6220,67],format:t=/(\d{1,4})/g,length:[12,13,14,15,16,17,18,19],cvcLength:[3],luhn:!0},{type:"forbrugsforeningen",patterns:[600],format:t,length:[16],cvcLength:[3],luhn:!0},{type:"dankort",patterns:[5019],format:t,length:[16],cvcLength:[3],luhn:!0},{type:"visa",patterns:[4],format:t,length:[13,16],cvcLength:[3],luhn:!0},{type:"mastercard",patterns:[51,52,53,54,55,22,23,24,25,26,27],format:t,length:[16],cvcLength:[3],luhn:!0},{type:"amex",patterns:[34,37],format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,length:[15],cvcLength:[3,4],luhn:!0},{type:"dinersclub",patterns:[30,36,38,39],format:/(\d{1,4})(\d{1,6})?(\d{1,4})?/,length:[14],cvcLength:[3],luhn:!0},{type:"discover",patterns:[60,64,65,622],format:t,length:[16],cvcLength:[3],luhn:!0},{type:"unionpay",patterns:[62,88],format:t,length:[16,17,18,19],cvcLength:[3],luhn:!1},{type:"jcb",patterns:[35],format:t,length:[16],cvcLength:[3],luhn:!0}],l=function(t){var e,n,r,a,i,o,l;for(t=(t+"").replace(/\D/g,""),r=0,i=u.length;r<i;r++)for(a=0,o=(l=(e=u[r]).patterns).length;a<o;a++)if(n=l[a],t.substr(0,(n=n+"").length)===n)return e},r=function(t){for(var e,n=0,r=u.length;n<r;n++)if((e=u[n]).type===t)return e},h=function(t){for(var e,n=!0,r=0,a=(t+"").split("").reverse(),i=0,o=a.length;i<o;i++)e=a[i],e=parseInt(e,10),(n=!n)&&(e*=2),9<e&&(e-=9),r+=e;return r%10==0},c=function(t){return null!=t.prop("selectionStart")&&t.prop("selectionStart")!==t.prop("selectionEnd")||!(null==("undefined"!=typeof document&&null!==document&&null!=(t=document.selection)?t.createRange:void 0)||!document.selection.createRange().text)},w=function(t,e){var n,r,a;try{r=e.prop("selectionStart")}catch(i){r=null}if(a=e.val(),e.val(t),null!==r&&e.is(":focus"))return r===a.length&&(r=t.length),a!==t&&(a=a.slice(r-1,+r+1||9e9),n=t.slice(r-1,+r+1||9e9),t=t[r],/\d/.test(t)&&a===t+" "&&n===" "+t&&(r+=1)),e.prop("selectionStart",r),e.prop("selectionEnd",r)},v=function(t){for(var e,n,r,a,i=0,o=(e=(t=null==t?"":t).split(a="")).length;i<o;i++)n=e[i],a+=n=-1<(r="0123456789".indexOf(n))?"0123456789"[r]:n;return a},d=function(t){var e=k(t.currentTarget);return setTimeout(function(){var t=e.val();return t=(t=v(t)).replace(/\D/g,""),w(t,e)})},f=function(t){var e=k(t.currentTarget);return setTimeout(function(){var t=e.val();return t=v(t),t=k.payment.formatCardNumber(t),w(t,e)})},a=function(t){var e,n,r,a,i,o=String.fromCharCode(t.which);if(/^\d+$/.test(o)&&(e=k(t.currentTarget),i=e.val(),n=l(i+o),r=(i.replace(/\D/g,"")+o).length,a=16,!((a=n?n.length[n.length.length-1]:a)<=r||null!=e.prop("selectionStart")&&e.prop("selectionStart")!==i.length)))return(a=n&&"amex"===n.type?/^(\d{4}|\d{4}\s\d{6})$/:/(?:^|\s)(\d{4})$/).test(i)?(t.preventDefault(),setTimeout(function(){return e.val(i+" "+o)})):a.test(i+o)?(t.preventDefault(),setTimeout(function(){return e.val(i+o+" ")})):void 0},e=function(t){var e=k(t.currentTarget),n=e.val();if(8===t.which&&(null==e.prop("selectionStart")||e.prop("selectionStart")===n.length))return/\d\s$/.test(n)?(t.preventDefault(),setTimeout(function(){return e.val(n.replace(/\d\s$/,""))})):/\s\d?$/.test(n)?(t.preventDefault(),setTimeout(function(){return e.val(n.replace(/\d$/,""))})):void 0},g=function(t){var e=k(t.currentTarget);return setTimeout(function(){var t=e.val();return t=v(t),t=k.payment.formatExpiry(t),w(t,e)})},i=function(t){var n,r,e=String.fromCharCode(t.which);if(/^\d+$/.test(e))return n=k(t.currentTarget),r=n.val()+e,/^\d$/.test(r)&&"0"!==r&&"1"!==r?(t.preventDefault(),setTimeout(function(){return n.val("0"+r+" / ")})):/^\d\d$/.test(r)?(t.preventDefault(),setTimeout(function(){var t=parseInt(r[0],10),e=parseInt(r[1],10);return 2<e&&0!==t?n.val("0"+t+" / "+e):n.val(r+" / ")})):void 0},o=function(t){var e=String.fromCharCode(t.which);if(/^\d+$/.test(e))return t=(e=k(t.currentTarget)).val(),/^\d\d$/.test(t)?e.val(t+" / "):void 0},s=function(t){var e=String.fromCharCode(t.which);if("/"===e||" "===e)return t=(e=k(t.currentTarget)).val(),/^\d$/.test(t)&&"0"!==t?e.val("0"+t+" / "):void 0},n=function(t){var e=k(t.currentTarget),n=e.val();if(8===t.which&&(null==e.prop("selectionStart")||e.prop("selectionStart")===n.length))return/\d\s\/\s$/.test(n)?(t.preventDefault(),setTimeout(function(){return e.val(n.replace(/\d\s\/\s$/,""))})):void 0},p=function(t){var e=k(t.currentTarget);return setTimeout(function(){var t=e.val();return t=(t=v(t)).replace(/\D/g,"").slice(0,4),w(t,e)})},T=function(t){return!(!t.metaKey&&!t.ctrlKey)||32!==t.which&&(0===t.which||(t.which<33||(t=String.fromCharCode(t.which),!!/[\d\s]/.test(t))))},y=function(t){var e=k(t.currentTarget),t=String.fromCharCode(t.which);if(/^\d+$/.test(t)&&!c(e))return e=(e.val()+t).replace(/\D/g,""),(t=l(e))?e.length<=t.length[t.length.length-1]:e.length<=16},C=function(t){var e=k(t.currentTarget),t=String.fromCharCode(t.which);if(/^\d+$/.test(t)&&!c(e))return!(6<(e.val()+t).replace(/\D/g,"").length)&&void 0},m=function(t){var e=k(t.currentTarget),t=String.fromCharCode(t.which);if(/^\d+$/.test(t)&&!c(e))return(e.val()+t).length<=4},$=function(t){var e,r,t=k(t.currentTarget),n=t.val(),n=k.payment.cardType(n)||"unknown";if(!t.hasClass(n))return e=function(){for(var t=[],e=0,n=u.length;e<n;e++)r=u[e],t.push(r.type);return t}(),t.removeClass("unknown"),t.removeClass(e.join(" ")),t.addClass(n),t.toggleClass("identified","unknown"!==n),t.trigger("payment.cardType",n)},k.payment.fn.formatCardCVC=function(){return this.on("keypress",T),this.on("keypress",m),this.on("paste",p),this.on("change",p),this.on("input",p),this},k.payment.fn.formatCardExpiry=function(){return this.on("keypress",T),this.on("keypress",C),this.on("keypress",i),this.on("keypress",s),this.on("keypress",o),this.on("keydown",n),this.on("change",g),this.on("input",g),this},k.payment.fn.formatCardNumber=function(){return this.on("keypress",T),this.on("keypress",y),this.on("keypress",a),this.on("keydown",e),this.on("keyup",$),this.on("paste",f),this.on("change",f),this.on("input",f),this.on("input",$),this},k.payment.fn.restrictNumeric=function(){return this.on("keypress",T),this.on("paste",d),this.on("change",d),this.on("input",d),this},k.payment.fn.cardExpiryVal=function(){return k.payment.cardExpiryVal(k(this).val())},k.payment.cardExpiryVal=function(t){var t=t.split(/[\s\/]+/,2),e=t[0],t=t[1];return 2===(null!=t?t.length:void 0)&&/^\d+$/.test(t)&&(t=(new Date).getFullYear().toString().slice(0,2)+t),{month:parseInt(e,10),year:t=parseInt(t,10)}},k.payment.validateCardNumber=function(t){var e,n;return t=(t+"").replace(/\s+|-/g,""),!!/^\d+$/.test(t)&&(!!(e=l(t))&&(n=t.length,0<=D.call(e.length,n)&&(!1===e.luhn||h(t))))},k.payment.validateCardExpiry=function(t,e){var n;return"object"==typeof t&&"month"in t&&(t=(n=t).month,e=n.year),!(!t||!e)&&(t=t||0==t?t.toString().trim():"",e=e||0==e?e.toString().trim():"",!!/^\d+$/.test(t)&&(!!/^\d+$/.test(e)&&(1<=t&&t<=12&&(4===(e=2===e.length?e<70?"20"+e:"19"+e:e).length&&(n=new Date(e,t),e=new Date,n.setMonth(n.getMonth()-1),n.setMonth(n.getMonth()+1,1),e<n)))))},k.payment.validateCardCVC=function(t,e){var n;return t=t||0==t?t.toString().trim():"",!!/^\d+$/.test(t)&&(null!=(e=r(e))?(n=t.length,0<=D.call(e.cvcLength,n)):3<=t.length&&t.length<=4)},k.payment.cardType=function(t){return t&&(null!=(t=l(t))?t.type:void 0)||null},k.payment.formatCardNumber=function(t){var e,n;return t=t.replace(/\D/g,""),(e=l(t))?(n=e.length[e.length.length-1],t=t.slice(0,n),e.format.global?null!=(n=t.match(e.format))?n.join(" "):void 0:null!=(n=e.format.exec(t))?(n.shift(),(n=k.grep(n,function(t){return t})).join(" ")):void 0):t},k.payment.formatExpiry=function(t){var e,n,t=t.match(/^\D*(\d{1,2})(\D+)?(\d{1,4})?/);return t?(e=t[1]||"",n=t[2]||"",0<(t=t[3]||"").length?n=" / ":" /"===n?(e=e.substring(0,1),n=""):2===e.length||0<n.length?n=" / ":1===e.length&&"0"!==e&&"1"!==e&&(e="0"+e,n=" / "),e+n+t):""}}.call(this)});