From bec950357bb887025a8b2b41e8ebb113b026aee9 Mon Sep 17 00:00:00 2001 From: Arsen Bespalov Date: Thu, 6 Aug 2015 10:27:13 +0800 Subject: [PATCH] recompress jquery.number.js and add map file --- jquery.number.min.js | 4 ++-- jquery.number.min.js.map | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 jquery.number.min.js.map diff --git a/jquery.number.min.js b/jquery.number.min.js index ce5a3cc..330d490 100644 --- a/jquery.number.min.js +++ b/jquery.number.min.js @@ -1,2 +1,2 @@ -(function(n){"use strict";function i(n,t){if(this.createTextRange){var i=this.createTextRange();i.collapse(!0);i.moveStart("character",n);i.moveEnd("character",t-n);i.select()}else this.setSelectionRange&&(this.focus(),this.setSelectionRange(n,t))}function r(n){var u=this.value.length,t,i,r,f;return(n=n.toLowerCase()=="start"?"Start":"End",document.selection)?(t=document.selection.createRange(),i=t.duplicate(),i.expand("textedit"),i.setEndPoint("EndToEnd",t),r=i.text.length-t.text.length,f=r+t.text.length,n=="Start"?r:f):(typeof this["selection"+n]!="undefined"&&(u=this["selection"+n]),u)}var u={codes:{46:127,188:44,109:45,190:46,191:47,192:96,220:92,222:39,221:93,219:91,173:45,187:61,186:59,189:45,110:46},shifts:{96:"~",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",48:")",45:"_",61:"+",91:"{",93:"}",92:"|",59:":",39:'"',44:"<",46:">",47:"?"}},f,t;n.fn.number=function(t,f,e,o){o=typeof o=="undefined"?",":o;e=typeof e=="undefined"?".":e;f=typeof f=="undefined"?0:f;var s="\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4),h=new RegExp("[^"+s+"0-9]","g"),c=new RegExp(s,"g");return t===!0?this.is("input:text")?this.on({"keydown.format":function(t){var w=n(this),c=w.data("numFormat"),l=t.keyCode?t.keyCode:t.which,a="",s=r.apply(this,["start"]),y=r.apply(this,["end"]),p="",v=!1,h;if(u.codes.hasOwnProperty(l)&&(l=u.codes[l]),!t.shiftKey&&l>=65&&l<=90?l+=32:!t.shiftKey&&l>=69&&l<=105?l-=48:t.shiftKey&&u.shifts.hasOwnProperty(l)&&(a=u.shifts[l]),a==""&&(a=String.fromCharCode(l)),l!=8&&l!=45&&l!=127&&a!=e&&!a.match(/[0-9]/))return(h=t.keyCode?t.keyCode:t.which,h==46||h==8||h==127||h==9||h==27||h==13||(h==65||h==82||h==80||h==83||h==70||h==72||h==66||h==74||h==84||h==90||h==61||h==173||h==48)&&(t.ctrlKey||t.metaKey)===!0||(h==86||h==67||h==88)&&(t.ctrlKey||t.metaKey)===!0||h>=35&&h<=39||h>=112&&h<=123)?void 0:(t.preventDefault(),!1);if(s==0&&y==this.value.length||w.val()==0?l==8?(s=y=1,this.value="",c.init=f>0?-1:0,c.c=f>0?-(f+1):0,i.apply(this,[0,0])):a==e?(s=y=1,this.value="0"+e+new Array(f+1).join("0"),c.init=f>0?1:0,c.c=f>0?-(f+1):0):l==45?(s=y=2,this.value="-0"+e+new Array(f+1).join("0"),c.init=f>0?1:0,c.c=f>0?-(f+1):0,i.apply(this,[2,2])):(c.init=f>0?-1:0,c.c=f>0?-f:0):c.c=y-this.value.length,c.isPartialSelection=s==y?!1:!0,f>0&&a==e&&s==this.value.length-f-1)c.c++,c.init=Math.max(0,c.init),t.preventDefault(),v=this.value.length+c.c;else if(l==45&&(s!=0||this.value.indexOf("-")==0))t.preventDefault();else if(a==e)c.init=Math.max(0,c.init),t.preventDefault();else if(f>0&&l==127&&s==this.value.length-f-1)t.preventDefault();else if(f>0&&l==8&&s==this.value.length-f)t.preventDefault(),c.c--,v=this.value.length+c.c;else if(f>0&&l==127&&s>this.value.length-f-1){if(this.value==="")return;this.value.slice(s,s+1)!="0"&&(p=this.value.slice(0,s)+"0"+this.value.slice(s+1),w.val(p));t.preventDefault();v=this.value.length+c.c}else if(f>0&&l==8&&s>this.value.length-f){if(this.value==="")return;this.value.slice(s-1,s)!="0"&&(p=this.value.slice(0,s-1)+"0"+this.value.slice(s),w.val(p));t.preventDefault();c.c--;v=this.value.length+c.c}else l==127&&this.value.slice(s,s+1)==o?t.preventDefault():l==8&&this.value.slice(s-1,s)==o?(t.preventDefault(),c.c--,v=this.value.length+c.c):f>0&&s==y&&this.value.length>f+1&&s>this.value.length-f-1&&isFinite(+a)&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&a.length===1&&(p=y===this.value.length?this.value.slice(0,s-1):this.value.slice(0,s)+this.value.slice(s+1),this.value=p,v=s);v!==!1&&i.apply(this,[v,v]);w.data("numFormat",c)},"keyup.format":function(t){var o=n(this),u=o.data("numFormat"),e=t.keyCode?t.keyCode:t.which,h=r.apply(this,["start"]),c=r.apply(this,["end"]),s;(h===0&&c===0&&(e===189||e===109)&&(o.val("-"+o.val()),h=1,u.c=1-this.value.length,u.init=1,o.data("numFormat",u),s=this.value.length+u.c,i.apply(this,[s,s])),this.value===""||(e<48||e>57)&&(e<96||e>105)&&e!==8&&e!==46&&e!==110)||(o.val(o.val()),f>0&&(u.init<1?(h=this.value.length-f-(u.init<0?1:0),u.c=h-this.value.length,u.init=1,o.data("numFormat",u)):h>this.value.length-f&&e!=8&&(u.c++,o.data("numFormat",u))),e!=46||u.isPartialSelection||(u.c++,o.data("numFormat",u)),s=this.value.length+u.c,i.apply(this,[s,s]))},"paste.format":function(t){var u=n(this),i=t.originalEvent,r=null;return window.clipboardData&&window.clipboardData.getData?r=window.clipboardData.getData("Text"):i.clipboardData&&i.clipboardData.getData&&(r=i.clipboardData.getData("text/plain")),u.val(r),t.preventDefault(),!1}}).each(function(){var t=n(this).data("numFormat",{c:-(f+1),decimals:f,thousands_sep:o,dec_point:e,regex_dec_num:h,regex_dec:c,init:this.value.indexOf(".")?!0:!1});this.value!==""&&t.val(t.val())}):this.each(function(){var t=n(this),i=+t.text().replace(h,"").replace(c,".");t.number(isFinite(i)?+i:0,f,e,o)}):this.text(n.number.apply(window,arguments))};f=null;t=null;n.isPlainObject(n.valHooks.text)?(n.isFunction(n.valHooks.text.get)&&(f=n.valHooks.text.get),n.isFunction(n.valHooks.text.set)&&(t=n.valHooks.text.set)):n.valHooks.text={};n.valHooks.text.get=function(t){var u=n(t),i,r=u.data("numFormat");return r?t.value===""?"":(i=+t.value.replace(r.regex_dec_num,"").replace(r.regex_dec,"."),(t.value.indexOf("-")===0?"-":"")+(isFinite(i)?i:0)):n.isFunction(f)?f(t):undefined};n.valHooks.text.set=function(i,r){var e=n(i),u=e.data("numFormat"),f;return u?(f=n.number(r,u.decimals,u.dec_point,u.thousands_sep),n.isFunction(t)?t(i,f):i.value=f):n.isFunction(t)?t(i,r):undefined};n.number=function(n,t,i,r){var f,e;r=typeof r=="undefined"?",":r;i=typeof i=="undefined"?".":i;t=isFinite(+t)?Math.abs(t):0;f="\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4);e="\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4);n=(n+"").replace(".",i).replace(new RegExp(e,"g"),"").replace(new RegExp(f,"g"),".").replace(new RegExp("[^0-9+-Ee.]","g"),"");var o=isFinite(+n)?+n:0,u="",s=function(n,t){return""+(+(Math.round((""+ n).indexOf("e")>0?n:n+"e+"+t)+"e-"+t))};return u=(t?s(o,t):""+Math.round(o)).split("."),u[0].length>3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,r)),(u[1]||"").length",47:"?"}};e.fn.number=function(n,l,s,r){r="undefined"==typeof r?",":r,s="undefined"==typeof s?".":s,l="undefined"==typeof l?0:l;var u="\\u"+("0000"+s.charCodeAt(0).toString(16)).slice(-4),h=new RegExp("[^"+u+"0-9]","g"),o=new RegExp(u,"g");return n===!0?this.is("input:text")?this.on({"keydown.format":function(n){var u=e(this),h=u.data("numFormat"),o=n.keyCode?n.keyCode:n.which,c="",v=a.apply(this,["start"]),d=a.apply(this,["end"]),p="",f=!1;if(i.codes.hasOwnProperty(o)&&(o=i.codes[o]),!n.shiftKey&&o>=65&&90>=o?o+=32:!n.shiftKey&&o>=69&&105>=o?o-=48:n.shiftKey&&i.shifts.hasOwnProperty(o)&&(c=i.shifts[o]),""==c&&(c=String.fromCharCode(o)),8!=o&&45!=o&&127!=o&&c!=s&&!c.match(/[0-9]/)){var g=n.keyCode?n.keyCode:n.which;if(46==g||8==g||127==g||9==g||27==g||13==g||(65==g||82==g||80==g||83==g||70==g||72==g||66==g||74==g||84==g||90==g||61==g||173==g||48==g)&&(n.ctrlKey||n.metaKey)===!0||(86==g||67==g||88==g)&&(n.ctrlKey||n.metaKey)===!0||g>=35&&39>=g||g>=112&&123>=g)return;return n.preventDefault(),!1}if(0==v&&d==this.value.length?8==o?(v=d=1,this.value="",h.init=l>0?-1:0,h.c=l>0?-(l+1):0,t.apply(this,[0,0])):c==s?(v=d=1,this.value="0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0):45==o?(v=d=2,this.value="-0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0,t.apply(this,[2,2])):(h.init=l>0?-1:0,h.c=l>0?-l:0):h.c=d-this.value.length,h.isPartialSelection=v==d?!1:!0,l>0&&c==s&&v==this.value.length-l-1)h.c++,h.init=Math.max(0,h.init),n.preventDefault(),f=this.value.length+h.c;else if(45!=o||0==v&&0!=this.value.indexOf("-"))if(c==s)h.init=Math.max(0,h.init),n.preventDefault();else if(l>0&&127==o&&v==this.value.length-l-1)n.preventDefault();else if(l>0&&8==o&&v==this.value.length-l)n.preventDefault(),h.c--,f=this.value.length+h.c;else if(l>0&&127==o&&v>this.value.length-l-1){if(""===this.value)return;"0"!=this.value.slice(v,v+1)&&(p=this.value.slice(0,v)+"0"+this.value.slice(v+1),u.val(p)),n.preventDefault(),f=this.value.length+h.c}else if(l>0&&8==o&&v>this.value.length-l){if(""===this.value)return;"0"!=this.value.slice(v-1,v)&&(p=this.value.slice(0,v-1)+"0"+this.value.slice(v),u.val(p)),n.preventDefault(),h.c--,f=this.value.length+h.c}else 127==o&&this.value.slice(v,v+1)==r?n.preventDefault():8==o&&this.value.slice(v-1,v)==r?(n.preventDefault(),h.c--,f=this.value.length+h.c):l>0&&v==d&&this.value.length>l+1&&v>this.value.length-l-1&&isFinite(+c)&&!n.metaKey&&!n.ctrlKey&&!n.altKey&&1===c.length&&(p=d===this.value.length?this.value.slice(0,v-1):this.value.slice(0,v)+this.value.slice(v+1),this.value=p,f=v);else n.preventDefault();f!==!1&&t.apply(this,[f,f]),u.data("numFormat",h)},"keyup.format":function(i){var n,s=e(this),r=s.data("numFormat"),u=i.keyCode?i.keyCode:i.which,h=a.apply(this,["start"]),o=a.apply(this,["end"]);0!==h||0!==o||189!==u&&109!==u||(s.val("-"+s.val()),h=1,r.c=1-this.value.length,r.init=1,s.data("numFormat",r),n=this.value.length+r.c,t.apply(this,[n,n])),""===this.value||(48>u||u>57)&&(96>u||u>105)&&8!==u&&46!==u&&110!==u||(s.val(s.val()),l>0&&(r.init<1?(h=this.value.length-l-(r.init<0?1:0),r.c=h-this.value.length,r.init=1,s.data("numFormat",r)):h>this.value.length-l&&8!=u&&(r.c++,s.data("numFormat",r))),46!=u||r.isPartialSelection||(r.c++,s.data("numFormat",r)),n=this.value.length+r.c,t.apply(this,[n,n]))},"paste.format":function(t){var a=e(this),i=t.originalEvent,n=null;return window.clipboardData&&window.clipboardData.getData?n=window.clipboardData.getData("Text"):i.clipboardData&&i.clipboardData.getData&&(n=i.clipboardData.getData("text/plain")),a.val(n),t.preventDefault(),!1}}).each(function(){var t=e(this).data("numFormat",{c:-(l+1),decimals:l,thousands_sep:r,dec_point:s,regex_dec_num:h,regex_dec:o,init:this.value.indexOf(".")?!0:!1});""!==this.value&&t.val(t.val())}):this.each(function(){var t=e(this),a=+t.text().replace(h,"").replace(o,".");t.number(isFinite(a)?+a:0,l,s,r)}):this.text(e.number.apply(window,arguments))};var n=null,l=null;e.isPlainObject(e.valHooks.text)?(e.isFunction(e.valHooks.text.get)&&(n=e.valHooks.text.get),e.isFunction(e.valHooks.text.set)&&(l=e.valHooks.text.set)):e.valHooks.text={},e.valHooks.text.get=function(t){var a,i=e(t),l=i.data("numFormat");return l?""===t.value?"":(a=+t.value.replace(l.regex_dec_num,"").replace(l.regex_dec,"."),(0===t.value.indexOf("-")?"-":"")+(isFinite(a)?a:0)):e.isFunction(n)?n(t):void 0},e.valHooks.text.set=function(t,a){var i=e(t),n=i.data("numFormat");if(n){var s=e.number(a,n.decimals,n.dec_point,n.thousands_sep);return e.isFunction(l)?l(t,s):t.value=s}return e.isFunction(l)?l(t,a):void 0},e.number=function(e,t,a,i){i="undefined"==typeof i?"1000"!==new Number(1e3).toLocaleString()?new Number(1e3).toLocaleString().charAt(1):"":i,a="undefined"==typeof a?new Number(.1).toLocaleString().charAt(1):a,t=isFinite(+t)?Math.abs(t):0;var n="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4),l="\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4);e=(e+"").replace(".",a).replace(new RegExp(l,"g"),"").replace(new RegExp(n,"g"),".").replace(new RegExp("[^0-9+-Ee.]","g"),"");var s=isFinite(+e)?+e:0,r="",u=function(e,t){return""+ +(Math.round((""+e).indexOf("e")>0?e:e+"e+"+t)+"e-"+t)};return r=(t?u(s,t):""+Math.round(s)).split("."),r[0].length>3&&(r[0]=r[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(r[1]||"").length