Qiang Xue
10 years ago
27 changed files with 80 additions and 2623 deletions
@ -0,0 +1,8 @@ |
|||||||
|
{ |
||||||
|
"name": "yii2-advanced-backend", |
||||||
|
"version": "1.0.0", |
||||||
|
"dependencies": { |
||||||
|
}, |
||||||
|
"devDependencies": { |
||||||
|
} |
||||||
|
} |
@ -1,2 +0,0 @@ |
|||||||
* |
|
||||||
!.gitignore |
|
@ -0,0 +1,8 @@ |
|||||||
|
{ |
||||||
|
"name": "yii2-advanced-frontend", |
||||||
|
"version": "1.0.0", |
||||||
|
"dependencies": { |
||||||
|
}, |
||||||
|
"devDependencies": { |
||||||
|
} |
||||||
|
} |
@ -1,2 +0,0 @@ |
|||||||
* |
|
||||||
!.gitignore |
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +0,0 @@ |
|||||||
/* always keep this link here when updating this file: https://github.com/jharding/typeahead.js-bootstrap.css */ |
|
||||||
|
|
||||||
.twitter-typeahead .tt-query, |
|
||||||
.twitter-typeahead .tt-hint { |
|
||||||
margin-bottom: 0; |
|
||||||
} |
|
||||||
|
|
||||||
.tt-dropdown-menu { |
|
||||||
min-width: 160px; |
|
||||||
margin-top: 2px; |
|
||||||
padding: 5px 0; |
|
||||||
background-color: #fff; |
|
||||||
border: 1px solid #ccc; |
|
||||||
border: 1px solid rgba(0,0,0,.2); |
|
||||||
*border-right-width: 2px; |
|
||||||
*border-bottom-width: 2px; |
|
||||||
-webkit-border-radius: 6px; |
|
||||||
-moz-border-radius: 6px; |
|
||||||
border-radius: 6px; |
|
||||||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); |
|
||||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2); |
|
||||||
box-shadow: 0 5px 10px rgba(0,0,0,.2); |
|
||||||
-webkit-background-clip: padding-box; |
|
||||||
-moz-background-clip: padding; |
|
||||||
background-clip: padding-box; |
|
||||||
} |
|
||||||
|
|
||||||
.tt-suggestion { |
|
||||||
display: block; |
|
||||||
padding: 3px 20px; |
|
||||||
} |
|
||||||
|
|
||||||
.tt-suggestion.tt-is-under-cursor { |
|
||||||
color: #fff; |
|
||||||
background-color: #0081c2; |
|
||||||
background-image: -moz-linear-gradient(top, #0088cc, #0077b3); |
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); |
|
||||||
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); |
|
||||||
background-image: -o-linear-gradient(top, #0088cc, #0077b3); |
|
||||||
background-image: linear-gradient(to bottom, #0088cc, #0077b3); |
|
||||||
background-repeat: repeat-x; |
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0) |
|
||||||
} |
|
||||||
|
|
||||||
.tt-suggestion.tt-is-under-cursor a { |
|
||||||
color: #fff; |
|
||||||
} |
|
||||||
|
|
||||||
.tt-suggestion p { |
|
||||||
margin: 0; |
|
||||||
} |
|
@ -1,106 +0,0 @@ |
|||||||
/* |
|
||||||
Input Mask plugin for jquery |
|
||||||
http://github.com/RobinHerbots/jquery.inputmask
|
|
||||||
Copyright (c) 2010 - 2014 Robin Herbots |
|
||||||
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
||||||
Version: 3.1.1 |
|
||||||
*/ |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){if(void 0===e.fn.inputmask){var a=function(a){var b=document.createElement("input");a="on"+a;var f=a in b;f||(b.setAttribute(a,"return;"),f="function"==typeof b[a]);return f},b=function(a,c,f){return(a=f.aliases[a])?(a.alias&&b(a.alias,void 0,f),e.extend(!0,f,a),e.extend(!0,f,c),!0):!1},c=function(a,b){function f(b){function f(a,b,e,u){this.matches=[];this.isGroup=a||!1;this.isOptional=b||!1;this.isQuantifier= |
|
||||||
e||!1;this.isAlternator=u||!1;this.quantifier={min:1,max:1}}function e(b,f,u){var c=a.definitions[f],d=0==b.matches.length;u=void 0!=u?u:b.matches.length;if(c&&!g){for(var h=c.prevalidator,k=h?h.length:0,s=1;s<c.cardinality;s++){var n=k>=s?h[s-1]:[],D=n.validator,n=n.cardinality;b.matches.splice(u++,0,{fn:D?"string"==typeof D?RegExp(D):new function(){this.test=D}:/./,cardinality:n?n:1,optionality:b.isOptional,newBlockMarker:d,casing:c.casing,def:c.definitionSymbol||f,placeholder:c.placeholder,mask:f})}b.matches.splice(u++, |
|
||||||
0,{fn:c.validator?"string"==typeof c.validator?RegExp(c.validator):new function(){this.test=c.validator}:/./,cardinality:c.cardinality,optionality:b.isOptional,newBlockMarker:d,casing:c.casing,def:c.definitionSymbol||f,placeholder:c.placeholder,mask:f})}else b.matches.splice(u++,0,{fn:null,cardinality:0,optionality:b.isOptional,newBlockMarker:d,casing:null,def:f,placeholder:void 0,mask:f}),g=!1}for(var c=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,g=!1,d=new f,u,h=[],l=[], |
|
||||||
k,n;u=c.exec(b);)switch(u=u[0],u.charAt(0)){case a.optionalmarker.end:case a.groupmarker.end:u=h.pop();if(0<h.length){if(k=h[h.length-1],k.matches.push(u),k.isAlternator){u=h.pop();for(k=0;k<u.matches.length;k++)u.matches[k].isGroup=!1;0<h.length?(k=h[h.length-1],k.matches.push(u)):d.matches.push(u)}}else d.matches.push(u);break;case a.optionalmarker.start:h.push(new f(!1,!0));break;case a.groupmarker.start:h.push(new f(!0));break;case a.quantifiermarker.start:k=new f(!1,!1,!0);u=u.replace(/[{}]/g, |
|
||||||
"");n=u.split(",");u=isNaN(n[0])?n[0]:parseInt(n[0]);n=1==n.length?u:isNaN(n[1])?n[1]:parseInt(n[1]);if("*"==n||"+"==n)u="*"==n?0:1;k.quantifier={min:u,max:n};if(0<h.length){n=h[h.length-1].matches;u=n.pop();if(!u.isGroup){var D=new f(!0);D.matches.push(u);u=D}n.push(u);n.push(k)}else u=d.matches.pop(),u.isGroup||(D=new f(!0),D.matches.push(u),u=D),d.matches.push(u),d.matches.push(k);break;case a.escapeChar:g=!0;break;case a.alternatormarker:0<h.length?(k=h[h.length-1],n=k.matches.pop()):n=d.matches.pop(); |
|
||||||
n.isAlternator?h.push(n):(u=new f(!1,!1,!1,!0),u.matches.push(n),h.push(u));break;default:if(0<h.length){if(k=h[h.length-1],0<k.matches.length&&(n=k.matches[k.matches.length-1],n.isGroup&&(n.isGroup=!1,e(n,a.groupmarker.start,0),e(n,a.groupmarker.end))),e(k,u),k.isAlternator){u=h.pop();for(k=0;k<u.matches.length;k++)u.matches[k].isGroup=!1;0<h.length?(k=h[h.length-1],k.matches.push(u)):d.matches.push(u)}}else 0<d.matches.length&&(n=d.matches[d.matches.length-1],n.isGroup&&(n.isGroup=!1,e(n,a.groupmarker.start, |
|
||||||
0),e(n,a.groupmarker.end))),e(d,u)}0<d.matches.length&&(n=d.matches[d.matches.length-1],n.isGroup&&(n.isGroup=!1,e(n,a.groupmarker.start,0),e(n,a.groupmarker.end)),l.push(d));return l}function c(b,u){if(a.numericInput&&!0!==a.multi){b=b.split("").reverse();for(var d=0;d<b.length;d++)b[d]==a.optionalmarker.start?b[d]=a.optionalmarker.end:b[d]==a.optionalmarker.end?b[d]=a.optionalmarker.start:b[d]==a.groupmarker.start?b[d]=a.groupmarker.end:b[d]==a.groupmarker.end&&(b[d]=a.groupmarker.start);b=b.join("")}if(void 0!= |
|
||||||
b&&""!=b){if(0<a.repeat||"*"==a.repeat||"+"==a.repeat)b=a.groupmarker.start+b+a.groupmarker.end+a.quantifiermarker.start+("*"==a.repeat?0:"+"==a.repeat?1:a.repeat)+","+a.repeat+a.quantifiermarker.end;void 0==e.inputmask.masksCache[b]&&(e.inputmask.masksCache[b]={mask:b,maskToken:f(b),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:u});return e.extend(!0,{},e.inputmask.masksCache[b])}}var g=[];e.isFunction(a.mask)&&(a.mask=a.mask.call(this,a));if(e.isArray(a.mask))if(b)e.each(a.mask, |
|
||||||
function(a,b){void 0!=b.mask?g.push(c(b.mask.toString(),b)):g.push(c(b.toString()))});else{a.keepStatic=void 0==a.keepStatic?!0:a.keepStatic;var d=!1,h="(";e.each(a.mask,function(a,b){1<h.length&&(h+=")|(");void 0!=b.mask?(d=!0,h+=b.mask.toString()):h+=b.toString()});h+=")";g=c(h,d?a.mask:void 0)}else 1==a.mask.length&&!1==a.greedy&&0!=a.repeat&&(a.placeholder=""),g=void 0!=a.mask.mask?c(a.mask.mask.toString(),a.mask):c(a.mask.toString());return g},d="function"===typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion(): |
|
||||||
10<=(new Function("/*@cc_on return @_jscript_version; @*/"))(),g=navigator.userAgent,h=null!==g.match(/iphone/i),l=null!==g.match(/android.*safari.*/i),C=null!==g.match(/android.*chrome.*/i),v=null!==g.match(/android.*firefox.*/i),W=/Kindle/i.test(g)||/Silk/i.test(g)||/KFTT/i.test(g)||/KFOT/i.test(g)||/KFJWA/i.test(g)||/KFJWI/i.test(g)||/KFSOWI/i.test(g)||/KFTHWA/i.test(g)||/KFTHWI/i.test(g)||/KFAPWA/i.test(g)||/KFAPWI/i.test(g),T=a("paste")?"paste":a("input")?"input":"propertychange",F=function(a, |
|
||||||
b,f){function c(a,q,e){q=q||0;var d=[],g,h=0,r;do{if(!0===a&&b.validPositions[h]){var p=b.validPositions[h];r=p.match;g=p.locator.slice();d.push(null==r.fn?r.def:!0===e?p.input:r.placeholder||f.placeholder.charAt(h%f.placeholder.length))}else g=q>h?M(h,g,h-1)[0]:da(h,g,h-1),r=g.match,g=g.locator.slice(),d.push(null==r.fn?r.def:void 0!=r.placeholder?r.placeholder:f.placeholder.charAt(h%f.placeholder.length));h++}while((void 0==P||h-1<P)&&null!=r.fn||null==r.fn&&""!=r.def||q>=h);d.pop();return d}function g(a){var q= |
|
||||||
b;q.buffer=void 0;q.tests={};!0!==a&&(q._buffer=void 0,q.validPositions={},q.p=-1)}function x(a){var q=-1,f=b.validPositions;void 0==a&&(a=-1);var e=q,c;for(c in f){var d=parseInt(c);if(-1==a||null!=f[d].match.fn)d<a&&(e=d),d>=a&&(q=d)}return 1<a-e||q<a?e:q}function k(a,q,c){if(f.insertMode&&void 0!=b.validPositions[a]&&void 0==c){c=e.extend(!0,{},b.validPositions);var d=x(),g;for(g=a;g<=d;g++)delete b.validPositions[g];b.validPositions[a]=q;q=!0;for(g=a;g<=d;g++){a=c[g];if(void 0!=a){var h=null== |
|
||||||
a.match.fn?g+1:E(g);q=la(h,a.match.def)?q&&!1!==N(h,a.input,!0,!0):!1}if(!q)break}if(!q)return b.validPositions=e.extend(!0,{},c),!1}else b.validPositions[a]=q;return!0}function F(a,q){var f,e=a;for(f=a;f<q;f++)delete b.validPositions[f];for(f=q;f<=x();){var c=b.validPositions[f],d=b.validPositions[e];void 0!=c&&void 0==d?(la(e,c.match.def)&&!1!==N(e,c.input,!0)&&(delete b.validPositions[f],f++),e++):f++}for(f=x();0<f&&(void 0==b.validPositions[f]||null==b.validPositions[f].match.fn);)delete b.validPositions[f], |
|
||||||
f--;g(!0)}function da(a,q,c){a=M(a,q,c);var d;q=x();q=b.validPositions[q]||M(0)[0];c=void 0!=q.alternation?q.locator[q.alternation].split(","):[];for(var g=0;g<a.length&&(d=a[g],!f.greedy&&(!d.match||!1!==d.match.optionality&&!1!==d.match.newBlockMarker||!0===d.match.optionalQuantifier||void 0!=q.alternation&&(void 0==d.locator[q.alternation]||-1!=e.inArray(d.locator[q.alternation].toString(),c))));g++);return d}function ia(a){return b.validPositions[a]?b.validPositions[a].match:M(a)[0].match}function la(a, |
|
||||||
b){for(var f=!1,c=M(a),e=0;e<c.length;e++)if(c[e].match&&c[e].match.def==b){f=!0;break}return f}function M(a,c,d){function g(c,d,q,B){function h(q,B,t){if(1E4<k)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+b.mask),!0;if(k==a&&void 0==q.matches)return r.push({match:q,locator:B.reverse()}),!0;if(void 0!=q.matches)if(q.isGroup&&!0!==t){if(q=h(c.matches[m+1],B))return!0}else if(q.isOptional){var s= |
|
||||||
q;if(q=g(q,d,B,t))q=r[r.length-1].match,(q=0==e.inArray(q,s.matches))&&(p=!0),k=a}else if(q.isAlternator){var s=q,n=[],R,D=r.slice(),l=B.length,x=0<d.length?d.shift():-1;if(-1==x||"string"==typeof x){var sa=k,w=d.slice(),fa;"string"==typeof x&&(fa=x.split(","));for(var F=0;F<s.matches.length;F++){r=[];q=h(s.matches[F],[F].concat(B),t)||q;R=r.slice();k=sa;r=[];for(var K=0;K<w.length;K++)d[K]=w[K];for(K=0;K<R.length;K++)for(var v=R[K],A=0;A<n.length;A++){var z=n[A];if(v.match.mask==z.match.mask&&("string"!= |
|
||||||
typeof x||-1!=e.inArray(v.locator[l].toString(),fa))){R.splice(K,1);z.locator[l]=z.locator[l]+","+v.locator[l];z.alternation=l;break}}n=n.concat(R)}"string"==typeof x&&(n=e.map(n,function(a,b){if(isFinite(b)){var c=a.locator[l].toString().split(","),f;a.locator[l]=void 0;a.alternation=void 0;for(var d=0;d<c.length;d++)if(f=-1!=e.inArray(c[d],fa))void 0!=a.locator[l]?(a.locator[l]+=",",a.alternation=l,a.locator[l]+=c[d]):a.locator[l]=parseInt(c[d]);if(void 0!=a.locator[l])return a}}));r=D.concat(n); |
|
||||||
p=!0}else q=h(s.matches[x],[x].concat(B),t);if(q)return!0}else if(q.isQuantifier&&!0!==t)for(s=q,f.greedy=f.greedy&&isFinite(s.quantifier.max),t=0<d.length&&!0!==t?d.shift():0;t<(isNaN(s.quantifier.max)?t+1:s.quantifier.max)&&k<=a;t++){if(n=c.matches[e.inArray(s,c.matches)-1],q=h(n,[t].concat(B),!0))if(q=r[r.length-1].match,q.optionalQuantifier=t>s.quantifier.min-1,q=0==e.inArray(q,n.matches))if(t>s.quantifier.min-1){p=!0;k=a;break}else return!0;else return!0}else{if(q=g(q,d,B,t))return!0}else k++} |
|
||||||
for(var m=0<d.length?d.shift():0;m<c.matches.length;m++)if(!0!==c.matches[m].isQuantifier){var t=h(c.matches[m],[m].concat(q),B);if(t&&k==a)return t;if(k>a)break}}var h=b.maskToken,k=c?d:0;d=c||[0];var r=[],p=!1;if(void 0==c){c=a-1;for(var m;void 0==(m=b.validPositions[c])&&-1<c;)c--;if(void 0!=m&&-1<c)k=c,d=m.locator.slice();else{for(c=a-1;void 0==(m=b.tests[c])&&-1<c;)c--;void 0!=m&&-1<c&&(k=c,d=m[0].locator.slice())}}for(c=d.shift();c<h.length&&!(g(h[c],d,[c])&&k==a||k>a);c++);(0==r.length||p)&& |
|
||||||
r.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]});b.tests[a]=e.extend(!0,[],r);return b.tests[a]}function I(){void 0==b._buffer&&(b._buffer=c(!1,1));return b._buffer}function s(){void 0==b.buffer&&(b.buffer=c(!0,x(),!0));return b.buffer}function ea(a,c){var d=s().slice();if(!0===a)g(),a=0,c=d.length;else for(var e=a;e<c;e++)delete b.validPositions[e],delete b.tests[e];for(e=a;e<c;e++)d[e]!=f.skipOptionalPartCharacter&&N(e,d[e],!0,!0)}function ra(a,b){switch(b.casing){case "upper":a= |
|
||||||
a.toUpperCase();break;case "lower":a=a.toLowerCase()}return a}function N(a,c,d,h){function t(a,c,d,q){var y=!1;e.each(M(a),function(h,B){var p=B.match,r=c?1:0,t="";s();for(var O=p.cardinality;O>r;O--)t+=void 0==b.validPositions[a-(O-1)]?Z(a-(O-1)):b.validPositions[a-(O-1)].input;c&&(t+=c);y=null!=p.fn?p.fn.test(t,b,a,d,f):c!=p.def&&c!=f.skipOptionalPartCharacter||""==p.def?!1:{c:p.def,pos:a};if(!1!==y){r=void 0!=y.c?y.c:c;r=r==f.skipOptionalPartCharacter&&null===p.fn?p.def:r;t=a;void 0!=y.remove&& |
|
||||||
F(y.remove,y.remove+1);if(y.refreshFromBuffer){t=y.refreshFromBuffer;d=!0;ea(!0===t?t:t.start,t.end);if(void 0==y.pos&&void 0==y.c)return y.pos=x(),!1;t=void 0!=y.pos?y.pos:a;if(t!=a)return y=e.extend(y,N(t,r,!0)),!1}else if(!0!==y&&void 0!=y.pos&&y.pos!=a&&(t=y.pos,ea(a,t),t!=a))return y=e.extend(y,N(t,r,!0)),!1;if(!0!=y&&void 0==y.pos&&void 0==y.c)return!1;0<h&&g(!0);k(t,e.extend({},B,{input:ra(r,p)}),q)||(y=!1);return!1}});return y}function m(a,c,d,y){if(f.keepStatic){var q=e.extend(!0,{},b.validPositions), |
|
||||||
h,B;for(h=x();0<=h;h--)if(b.validPositions[h]&&void 0!=b.validPositions[h].alternation){B=b.validPositions[h].alternation;break}if(void 0!=B)for(var p in b.validPositions)if(parseInt(p)>parseInt(h)&&void 0===b.validPositions[p].alternation){var r=b.validPositions[p].locator[B];h=b.validPositions[h].locator[B].split(",");for(var t=0;t<h.length;t++)if(r<h[t]){for(var k,O,l=p-1;0<=l;l--)if(k=b.validPositions[l],void 0!=k){O=k.locator[B];k.locator[B]=h[t];break}if(r!=k.locator[B]){for(var l=s().slice(), |
|
||||||
n=p;n<x()+1;n++)delete b.validPositions[n],delete b.tests[n];g(!0);f.keepStatic=!f.keepStatic;for(n=p;n<l.length;n++)l[n]!=f.skipOptionalPartCharacter&&N(x()+1,l[n],!1,!0);k.locator[B]=O;l=x()+1==a&&N(a,c,d,y);f.keepStatic=!f.keepStatic;if(l)return l;g();b.validPositions=e.extend(!0,{},q)}}break}}return!1}d=!0===d;for(var r=s(),p=a-1;-1<p&&(!b.validPositions[p]||null!=b.validPositions[p].match.fn);p--)void 0==b.validPositions[p]&&(!n(p)||r[p]!=Z(p))&&1<M(p).length&&t(p,r[p],!0);r=a;if(r>=V())return m(a, |
|
||||||
c,d,h);a=t(r,c,d,h);if(!d&&!1===a)if((p=b.validPositions[r])&&null==p.match.fn&&(p.match.def==c||c==f.skipOptionalPartCharacter))a={caret:E(r)};else if((f.insertMode||void 0==b.validPositions[E(r)])&&!n(r))for(var p=r+1,l=E(r);p<=l;p++)if(a=t(p,c,d,h),!1!==a){r=p;break}!0===a&&(a={pos:r});return a}function n(a){a=ia(a);return null!=a.fn?a.fn:!1}function V(){var a;P=m.prop("maxLength");-1==P&&(P=void 0);if(!1==f.greedy){var c;c=x();a=b.validPositions[c];var d=void 0!=a?a.locator.slice():void 0;for(c+= |
|
||||||
1;void 0==a||null!=a.match.fn||null==a.match.fn&&""!=a.match.def;c++)a=da(c,d,c-1),d=a.locator.slice();a=c}else a=s().length;return void 0==P||a<P?a:P}function E(a){var b=V();if(a>=b)return b;for(;++a<b&&!n(a)&&(!0!==f.nojumps||f.nojumpsThreshold>a););return a}function Y(a){if(0>=a)return 0;for(;0<--a&&!n(a););return a}function G(a,b,c){a._valueSet(b.join(""));void 0!=c&&w(a,c)}function Z(a,b){b=b||ia(a);return b.placeholder||(null==b.fn?b.def:f.placeholder.charAt(a%f.placeholder.length))}function U(a, |
|
||||||
c,d,h,t){h=void 0!=h?h.slice():qa(a._valueGet()).split("");g();c&&a._valueSet("");e.each(h,function(c,f){if(!0===t){var g=x(),q=-1==g?c:E(g);-1==e.inArray(f,I().slice(g+1,q))&&$.call(a,void 0,!0,f.charCodeAt(0),!1,d,c)}else $.call(a,void 0,!0,f.charCodeAt(0),!1,d,c),d=d||0<c&&c>b.p});c&&(c=f.onKeyPress.call(this,void 0,s(),0,f),ba(a,c),G(a,s(),e(a).is(":focus")?E(x(0)):void 0))}function ja(a){return e.inputmask.escapeRegex.call(this,a)}function qa(a){return a.replace(RegExp("("+ja(I().join(""))+")*$"), |
|
||||||
"")}function ka(a){if(a.data("_inputmask")&&!a.hasClass("hasDatepicker")){var c=[],d=b.validPositions,g;for(g in d)d[g].match&&null!=d[g].match.fn&&c.push(d[g].input);c=(z?c.reverse():c).join("");d=(z?s().slice().reverse():s()).join("");e.isFunction(f.onUnMask)&&(c=f.onUnMask.call(a,d,c,f));return c}return a[0]._valueGet()}function S(a){!z||"number"!=typeof a||f.greedy&&""==f.placeholder||(a=s().length-a);return a}function w(a,b,c){a=a.jquery&&0<a.length?a[0]:a;if("number"==typeof b){b=S(b);c=S(c); |
|
||||||
c="number"==typeof c?c:b;var d=e(a).data("_inputmask")||{};d.caret={begin:b,end:c};e(a).data("_inputmask",d);e(a).is(":visible")&&(a.scrollLeft=a.scrollWidth,!1==f.insertMode&&b==c&&c++,a.setSelectionRange?(a.selectionStart=b,a.selectionEnd=c):a.createTextRange&&(a=a.createTextRange(),a.collapse(!0),a.moveEnd("character",c),a.moveStart("character",b),a.select()))}else return d=e(a).data("_inputmask"),!e(a).is(":visible")&&d&&void 0!=d.caret?(b=d.caret.begin,c=d.caret.end):a.setSelectionRange?(b=a.selectionStart, |
|
||||||
c=a.selectionEnd):document.selection&&document.selection.createRange&&(a=document.selection.createRange(),b=0-a.duplicate().moveStart("character",-1E5),c=b+a.text.length),b=S(b),c=S(c),{begin:b,end:c}}function ga(a){var c=s(),d=c.length,f,g=x(),h={},r=b.validPositions[g],p=void 0!=r?r.locator.slice():void 0,k;for(f=g+1;f<c.length;f++)k=da(f,p,f-1),p=k.locator.slice(),h[f]=e.extend(!0,{},k);p=r&&void 0!=r.alternation?r.locator[r.alternation].split(","):[];for(f=d-1;f>g;f--)if(k=h[f].match,(k.optionality|| |
|
||||||
k.optionalQuantifier||r&&void 0!=r.alternation&&void 0!=h[f].locator[r.alternation]&&-1!=e.inArray(h[f].locator[r.alternation].toString(),p))&&c[f]==Z(f,k))d--;else break;return a?{l:d,def:h[d]?h[d].match:void 0}:d}function ha(a){var b=s().slice(),c=ga();b.length=c;G(a,b)}function X(a){if(e.isFunction(f.isComplete))return f.isComplete.call(m,a,f);if("*"!=f.repeat){var b=!1,c=ga(!0),d=Y(c.l);if(x()==d&&(void 0==c.def||c.def.newBlockMarker||c.def.optionalQuantifier))for(b=!0,c=0;c<=d;c++){var g=n(c); |
|
||||||
if(g&&(void 0==a[c]||a[c]==Z(c))||!g&&a[c]!=Z(c)){b=!1;break}}return b}}function ta(a){a=e._data(a).events;e.each(a,function(a,b){e.each(b,function(a,b){if("inputmask"==b.namespace&&"setvalue"!=b.type){var c=b.handler;b.handler=function(a){if(this.readOnly||this.disabled)a.preventDefault;else return c.apply(this,arguments)}}})})}function ua(a){function b(a){if(void 0==e.valHooks[a]||!0!=e.valHooks[a].inputmaskpatch){var c=e.valHooks[a]&&e.valHooks[a].get?e.valHooks[a].get:function(a){return a.value}, |
|
||||||
d=e.valHooks[a]&&e.valHooks[a].set?e.valHooks[a].set:function(a,b){a.value=b;return a};e.valHooks[a]={get:function(a){var b=e(a);if(b.data("_inputmask")){if(b.data("_inputmask").opts.autoUnmask)return b.inputmask("unmaskedvalue");a=c(a);b=(b=b.data("_inputmask").maskset._buffer)?b.join(""):"";return a!=b?a:""}return c(a)},set:function(a,b){var c=e(a),f=c.data("_inputmask");f?(f=d(a,e.isFunction(f.opts.onBeforeMask)?f.opts.onBeforeMask.call(A,b,f.opts):b),c.triggerHandler("setvalue.inputmask")):f= |
|
||||||
d(a,b);return f},inputmaskpatch:!0}}}function c(){var a=e(this),b=e(this).data("_inputmask");return b?b.opts.autoUnmask?a.inputmask("unmaskedvalue"):g.call(this)!=I().join("")?g.call(this):"":g.call(this)}function d(a){var b=e(this).data("_inputmask");b?(h.call(this,e.isFunction(b.opts.onBeforeMask)?b.opts.onBeforeMask.call(A,a,b.opts):a),e(this).triggerHandler("setvalue.inputmask")):h.call(this,a)}function f(a){e(a).bind("mouseenter.inputmask",function(a){a=e(this);var b=this._valueGet();""!=b&& |
|
||||||
b!=s().join("")&&a.trigger("setvalue")});if(a=e._data(a).events.mouseover){for(var b=a[a.length-1],c=a.length-1;0<c;c--)a[c]=a[c-1];a[0]=b}}var g,h;a._valueGet||(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(a,"value"),document.__lookupGetter__&&a.__lookupGetter__("value")?(g=a.__lookupGetter__("value"),h=a.__lookupSetter__("value"),a.__defineGetter__("value",c),a.__defineSetter__("value",d)):(g=function(){return a.value},h=function(b){a.value=b},b(a.type),f(a)),a._valueGet=function(){return z? |
|
||||||
g.call(this).split("").reverse().join(""):g.call(this)},a._valueSet=function(a){h.call(this,z?a.split("").reverse().join(""):a)})}function ma(a,c,d){if(f.numericInput||z)c==f.keyCode.BACKSPACE?c=f.keyCode.DELETE:c==f.keyCode.DELETE&&(c=f.keyCode.BACKSPACE),z&&(a=d.end,d.end=d.begin,d.begin=a);c==f.keyCode.BACKSPACE&&1>=d.end-d.begin?d.begin=Y(d.begin):c==f.keyCode.DELETE&&d.begin==d.end&&d.end++;F(d.begin,d.end);c=x(d.begin);b.p=c<d.begin?E(c):d.begin}function ba(a,b,c){if(b&&b.refreshFromBuffer){var d= |
|
||||||
b.refreshFromBuffer;ea(!0===d?d:d.start,d.end);g(!0);void 0!=c&&(G(a,s()),w(a,b.caret||c.begin,b.caret||c.end))}}function na(a){aa=!1;var c=this,d=e(c),g=a.keyCode,k=w(c);g==f.keyCode.BACKSPACE||g==f.keyCode.DELETE||h&&127==g||a.ctrlKey&&88==g?(a.preventDefault(),88==g&&(L=s().join("")),ma(c,g,k),G(c,s(),b.p),c._valueGet()==I().join("")&&d.trigger("cleared"),f.showTooltip&&d.prop("title",b.mask)):g==f.keyCode.END||g==f.keyCode.PAGE_DOWN?setTimeout(function(){var b=E(x());f.insertMode||b!=V()||a.shiftKey|| |
|
||||||
b--;w(c,a.shiftKey?k.begin:b,b)},0):g==f.keyCode.HOME&&!a.shiftKey||g==f.keyCode.PAGE_UP?w(c,0,a.shiftKey?k.begin:0):g==f.keyCode.ESCAPE||90==g&&a.ctrlKey?(U(c,!0,!1,L.split("")),d.click()):g!=f.keyCode.INSERT||a.shiftKey||a.ctrlKey?!1!=f.insertMode||a.shiftKey||(g==f.keyCode.RIGHT?setTimeout(function(){var a=w(c);w(c,a.begin)},0):g==f.keyCode.LEFT&&setTimeout(function(){var a=w(c);w(c,z?a.begin+1:a.begin-1)},0)):(f.insertMode=!f.insertMode,w(c,f.insertMode||k.begin!=V()?k.begin:k.begin-1));var d= |
|
||||||
w(c),l=f.onKeyDown.call(this,a,s(),d.begin,f);ba(c,l,d);ca=-1!=e.inArray(g,f.ignorables)}function $(a,c,d,h,t,l){if(void 0==d&&aa)return!1;aa=!0;var r=e(this);a=a||window.event;d=c?d:a.which||a.charCode||a.keyCode;if(!(!0===c||a.ctrlKey&&a.altKey)&&(a.ctrlKey||a.metaKey||ca))return!0;if(d){!0!==c&&46==d&&!1==a.shiftKey&&","==f.radixPoint&&(d=44);var p,n;d=String.fromCharCode(d);c?(l=t?l:x()+1,p={begin:l,end:l}):p=w(this);if(l=z?1<p.begin-p.end||1==p.begin-p.end&&f.insertMode:1<p.end-p.begin||1==p.end- |
|
||||||
p.begin&&f.insertMode)b.undoPositions=e.extend(!0,{},b.validPositions),ma(this,f.keyCode.DELETE,p),f.insertMode||(f.insertMode=!f.insertMode,k(p.begin,t),f.insertMode=!f.insertMode),l=!f.multi;b.writeOutBuffer=!0;p=z&&!l?p.end:p.begin;var m=N(p,d,t);!1!==m&&(!0!==m&&(p=void 0!=m.pos?m.pos:p,d=void 0!=m.c?m.c:d),g(!0),void 0!=m.caret?n=m.caret:(t=b.validPositions,n=!f.keepStatic&&(void 0!=t[p+1]&&1<M(p+1,t[p].locator.slice(),p).length||void 0!=t[p].alternation)?p+1:E(p)),b.p=n);if(!1!==h){var R=this; |
|
||||||
setTimeout(function(){f.onKeyValidation.call(R,m,f)},0);if(b.writeOutBuffer&&!1!==m){var D=s();G(this,D,c?void 0:f.numericInput?Y(n):n);!0!==c&&setTimeout(function(){!0===X(D)&&r.trigger("complete");Q=!0;r.trigger("input")},0)}else l&&(b.buffer=void 0,b.validPositions=b.undoPositions)}else l&&(b.buffer=void 0,b.validPositions=b.undoPositions);f.showTooltip&&r.prop("title",b.mask);a&&!0!=c&&(a.preventDefault?a.preventDefault():a.returnValue=!1,c=w(this),a=f.onKeyPress.call(this,a,s(),c.begin,f),ba(this, |
|
||||||
a,c))}}function va(a){var b=e(this),c=a.keyCode,d=s(),h=w(this);a=f.onKeyUp.call(this,a,d,h.begin,f);ba(this,a,h);c==f.keyCode.TAB&&f.showMaskOnFocus&&(b.hasClass("focus-inputmask")&&0==this._valueGet().length?(g(),d=s(),G(this,d),w(this,0),L=s().join("")):(G(this,d),w(this,S(0),S(V()))))}function oa(a){if(!0===Q&&"input"==a.type)return Q=!1,!0;var b=e(this),c=this._valueGet();if("propertychange"==a.type&&this._valueGet().length<=V())return!0;"paste"==a.type&&(window.clipboardData&&window.clipboardData.getData? |
|
||||||
c=window.clipboardData.getData("Text"):a.originalEvent&&a.originalEvent.clipboardData&&a.originalEvent.clipboardData.getData&&(c=a.originalEvent.clipboardData.getData("text/plain")));a=e.isFunction(f.onBeforePaste)?f.onBeforePaste.call(this,c,f):c;U(this,!0,!1,a.split(""),!0);b.click();!0===X(s())&&b.trigger("complete");return!1}function wa(a){if(!0===Q&&"input"==a.type)return Q=!1,!0;var b=w(this),c=this._valueGet(),c=c.replace(RegExp("("+ja(I().join(""))+")*"),"");b.begin>c.length&&(w(this,c.length), |
|
||||||
b=w(this));1!=s().length-c.length||c.charAt(b.begin)==s()[b.begin]||c.charAt(b.begin+1)==s()[b.begin]||n(b.begin)||(a.keyCode=f.keyCode.BACKSPACE,na.call(this,a));a.preventDefault()}function xa(a){if(!0===Q&&"input"==a.type)return Q=!1,!0;var c=w(this),d=this._valueGet();w(this,c.begin-1);var g=e.Event("keypress");g.which=d.charCodeAt(c.begin-1);ca=aa=!1;$.call(this,g,void 0,void 0,!1);c=b.p;G(this,s(),f.numericInput?Y(c):c);a.preventDefault()}function ya(a){Q=!0;var c=this;setTimeout(function(){w(c, |
|
||||||
w(c).begin-1);var d=e.Event("keypress");d.which=a.originalEvent.data.charCodeAt(0);ca=aa=!1;$.call(c,d,void 0,void 0,!1);d=b.p;G(c,s(),f.numericInput?Y(d):d)},0);return!1}function za(a){m=e(a);if(m.is(":input")&&"number"!=m.attr("type")){m.data("_inputmask",{maskset:b,opts:f,isRTL:!1});f.showTooltip&&m.prop("title",b.mask);("rtl"==a.dir||f.rightAlign)&&m.css("text-align","right");if("rtl"==a.dir||f.numericInput){a.dir="ltr";m.removeAttr("dir");var c=m.data("_inputmask");c.isRTL=!0;m.data("_inputmask", |
|
||||||
c);z=!0}m.unbind(".inputmask");m.removeClass("focus-inputmask");m.closest("form").bind("submit",function(){L!=s().join("")?m.change():m[0]._valueGet()==I().join("")&&m[0]._valueSet("");f.autoUnmask&&f.removeMaskOnSubmit&&m.inputmask("remove")}).bind("reset",function(){setTimeout(function(){m.trigger("setvalue")},0)});m.bind("mouseenter.inputmask",function(){!e(this).hasClass("focus-inputmask")&&f.showMaskOnHover&&this._valueGet()!=s().join("")&&G(this,s())}).bind("blur.inputmask",function(){var a= |
|
||||||
e(this);if(a.data("_inputmask")){var b=this._valueGet(),c=s();a.removeClass("focus-inputmask");L!=s().join("")&&a.change();f.clearMaskOnLostFocus&&""!=b&&(b==I().join("")?this._valueSet(""):ha(this));!1===X(c)&&(a.trigger("incomplete"),f.clearIncomplete&&(g(),f.clearMaskOnLostFocus?this._valueSet(""):(c=I().slice(),G(this,c))))}}).bind("focus.inputmask",function(){var a=e(this),b=this._valueGet();f.showMaskOnFocus&&!a.hasClass("focus-inputmask")&&(!f.showMaskOnHover||f.showMaskOnHover&&""==b)&&this._valueGet()!= |
|
||||||
s().join("")&&G(this,s(),E(x()));a.addClass("focus-inputmask");L=s().join("")}).bind("mouseleave.inputmask",function(){var a=e(this);f.clearMaskOnLostFocus&&(a.hasClass("focus-inputmask")||this._valueGet()==a.attr("placeholder")||(this._valueGet()==I().join("")||""==this._valueGet()?this._valueSet(""):ha(this)))}).bind("click.inputmask",function(){var a=this;e(a).is(":focus")&&setTimeout(function(){var b=w(a);if(b.begin==b.end){var b=z?S(b.begin):b.begin,c=x(b),c=E(c);b<c?n(b)?w(a,b):w(a,E(b)):w(a, |
|
||||||
c)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){w(a,0,E(x()))},0)}).bind(T+".inputmask dragdrop.inputmask drop.inputmask",oa).bind("setvalue.inputmask",function(){U(this,!0,!1,void 0,!0);L=s().join("")}).bind("complete.inputmask",f.oncomplete).bind("incomplete.inputmask",f.onincomplete).bind("cleared.inputmask",f.oncleared);m.bind("keydown.inputmask",na).bind("keypress.inputmask",$).bind("keyup.inputmask",va).bind("compositionupdate.inputmask",ya);"paste"===T&&m.bind("input.inputmask", |
|
||||||
xa);if(l||v||C||W)"input"==T&&m.unbind(T+".inputmask"),m.bind("input.inputmask",wa);d&&m.bind("input.inputmask",oa);ua(a);c=e.isFunction(f.onBeforeMask)?f.onBeforeMask.call(a,a._valueGet(),f):a._valueGet();U(a,!0,!1,c.split(""),!0);L=s().join("");var h;try{h=document.activeElement}catch(k){}!1===X(s())&&f.clearIncomplete&&g();f.clearMaskOnLostFocus?s().join("")==I().join("")?a._valueSet(""):ha(a):G(a,s());h===a&&(m.addClass("focus-inputmask"),w(a,E(x())));ta(a)}}var z=!1,L,m,aa=!1,Q=!1,ca=!1,P;if(void 0!= |
|
||||||
a)switch(a.action){case "isComplete":return m=e(a.el),b=m.data("_inputmask").maskset,f=m.data("_inputmask").opts,X(a.buffer);case "unmaskedvalue":return m=a.$input,b=m.data("_inputmask").maskset,f=m.data("_inputmask").opts,z=a.$input.data("_inputmask").isRTL,ka(a.$input);case "mask":L=s().join("");za(a.el);break;case "format":m=e({});m.data("_inputmask",{maskset:b,opts:f,isRTL:f.numericInput});f.numericInput&&(z=!0);var H=(e.isFunction(f.onBeforeMask)?f.onBeforeMask.call(m,a.value,f):a.value).split(""); |
|
||||||
U(m,!1,!1,z?H.reverse():H,!0);f.onKeyPress.call(this,void 0,s(),0,f);return z?s().slice().reverse().join(""):s().join("");case "isValid":m=e({});m.data("_inputmask",{maskset:b,opts:f,isRTL:f.numericInput});f.numericInput&&(z=!0);H=a.value.split("");U(m,!1,!0,z?H.reverse():H);var H=s(),J=ga();H.length=J;return X(H)&&a.value==H.join("");case "getemptymask":return m=e(a.el),b=m.data("_inputmask").maskset,f=m.data("_inputmask").opts,I();case "remove":var A=a.el;m=e(A);b=m.data("_inputmask").maskset;f= |
|
||||||
m.data("_inputmask").opts;A._valueSet(ka(m));m.unbind(".inputmask");m.removeClass("focus-inputmask");m.removeData("_inputmask");Object.getOwnPropertyDescriptor&&(J=Object.getOwnPropertyDescriptor(A,"value"));J&&J.get?A._valueGet&&Object.defineProperty(A,"value",{get:A._valueGet,set:A._valueSet}):document.__lookupGetter__&&A.__lookupGetter__("value")&&A._valueGet&&(A.__defineGetter__("value",A._valueGet),A.__defineSetter__("value",A._valueSet));try{delete A._valueGet,delete A._valueSet}catch(Aa){A._valueGet= |
|
||||||
void 0,A._valueSet=void 0}break;case "getmetadata":m=e(a.el);b=m.data("_inputmask").maskset;f=m.data("_inputmask").opts;if(e.isArray(b.metadata)){for(J=a=x();0<=J;J--)if(b.validPositions[J]&&void 0!=b.validPositions[J].alternation){H=b.validPositions[J].alternation;break}return void 0!=H?b.metadata[b.validPositions[a].locator[H]]:b.metadata[0]}return b.metadata}};e.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"}, |
|
||||||
alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!0,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyUp:e.noop,onKeyPress:e.noop,onKeyDown:e.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,radixPoint:"",nojumps:!1, |
|
||||||
nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\u00c0-\u00ff\u00b5]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\u00c0-\u00ff\u00b5]",cardinality:1}},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110, |
|
||||||
NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0},masksCache:{},escapeRegex:function(a){return a.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","gim"),"\\$1")},format:function(a,d){var f=e.extend(!0,{},e.inputmask.defaults,d);b(f.alias,d,f); |
|
||||||
return F({action:"format",value:a},c(f),f)},isValid:function(a,d){var f=e.extend(!0,{},e.inputmask.defaults,d);b(f.alias,d,f);return F({action:"isValid",value:a},c(f),f)}};e.fn.inputmask=function(a,d,f,g,h){function l(a,b){var c=e(a),d;for(d in b){var f=c.data("inputmask-"+d.toLowerCase());void 0!=f&&(b[d]=f)}return b}f=f||F;g=g||"_inputmask";var k=e.extend(!0,{},e.inputmask.defaults,d),v;if("string"===typeof a)switch(a){case "mask":return b(k.alias,d,k),v=c(k,f!==F),0==v.length?this:this.each(function(){f({action:"mask", |
|
||||||
el:this},e.extend(!0,{},v),l(this,k))});case "unmaskedvalue":return a=e(this),a.data(g)?f({action:"unmaskedvalue",$input:a}):a.val();case "remove":return this.each(function(){e(this).data(g)&&f({action:"remove",el:this})});case "getemptymask":return this.data(g)?f({action:"getemptymask",el:this}):"";case "hasMaskedValue":return this.data(g)?!this.data(g).opts.autoUnmask:!1;case "isComplete":return this.data(g)?f({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case "getmetadata":if(this.data(g))return f({action:"getmetadata", |
|
||||||
el:this});break;case "_detectScope":return b(k.alias,d,k),void 0==h||b(h,d,k)||-1!=e.inArray(h,"mask unmaskedvalue remove getemptymask hasMaskedValue isComplete getmetadata _detectScope".split(" "))||(k.mask=h),e.isFunction(k.mask)&&(k.mask=k.mask.call(this,k)),e.isArray(k.mask);default:return b(k.alias,d,k),b(a,d,k)||(k.mask=a),v=c(k,f!==F),void 0==v?this:this.each(function(){f({action:"mask",el:this},e.extend(!0,{},v),l(this,k))})}else{if("object"==typeof a)return k=e.extend(!0,{},e.inputmask.defaults, |
|
||||||
a),b(k.alias,a,k),v=c(k,f!==F),void 0==v?this:this.each(function(){f({action:"mask",el:this},e.extend(!0,{},v),l(this,k))});if(void 0==a)return this.each(function(){var a=e(this).attr("data-inputmask");if(a&&""!=a)try{var a=a.replace(RegExp("'","g"),'"'),c=e.parseJSON("{"+a+"}");e.extend(!0,c,d);k=e.extend(!0,{},e.inputmask.defaults,c);b(k.alias,c,k);k.alias=void 0;e(this).inputmask("mask",k,f)}catch(g){}})}}}return e.fn.inputmask}); |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","./jquery.inputmask"],e):e(jQuery)})(function(e){e.extend(e.inputmask.defaults.definitions,{A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\u00c0-\u00ff\u00b5]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\u00c0-\u00ff\u00b5]",cardinality:1,casing:"upper"}});e.extend(e.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:/[fh]/,urlpre2:/(ft|ht)/, |
|
||||||
urlpre3:/(ftp|htt)/,urlpre4:/(ftp:|http|ftps)/,urlpre5:/(ftp:\/|ftps:|http:|https)/,urlpre6:/(ftp:\/\/|ftps:\/|http:\/|https:)/,urlpre7:/(ftp:\/\/|ftps:\/\/|http:\/\/|https:\/)/,urlpre8:/(ftp:\/\/|ftps:\/\/|http:\/\/|https:\/\/)/},definitions:{i:{validator:function(a,b,c,d,g){return!0},cardinality:8,prevalidator:function(){for(var a=[],b=0;8>b;b++)a[b]=function(){var a=b;return{validator:function(b,g,e,l,C){if(C.regex["urlpre"+(a+1)]){var v=b;0<a+1-b.length&&(v=g.buffer.join("").substring(0,a+1-b.length)+ |
|
||||||
""+v);b=C.regex["urlpre"+(a+1)].test(v);if(!l&&!b){e-=a;for(l=0;l<C.defaultPrefix.length;l++)g.buffer[e]=C.defaultPrefix[l],e++;for(l=0;l<v.length-1;l++)g.buffer[e]=v[l],e++;return{pos:e}}return b}return!1},cardinality:a}}();return a}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(a,b,c,d,g){-1<c-1&&"."!=b.buffer[c-1]?(a=b.buffer[c-1]+a,a=-1<c-2&&"."!=b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a;return/25[0-5]|2[0-4][0-9]|[01][0-9][0-9]/.test(a)}, |
|
||||||
cardinality:1}}},email:{mask:"*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(a,b){a=a.toLowerCase();return a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}});return e.fn.inputmask}); |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","./jquery.inputmask"],e):e(jQuery)})(function(e){e.extend(e.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]", |
|
||||||
cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}});e.extend(e.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:/[0-3]/,val1:/0[1-9]|[12][0-9]|3[01]/,val2pre:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9]|3[01])"+a+"[01])")},val2:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9])"+ |
|
||||||
a+"(0[1-9]|1[012]))|(30"+a+"(0[13-9]|1[012]))|(31"+a+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length)));a=parseInt(a.concat(c.toString().slice(a.length)));return(isNaN(d)?!1:b<=d&&d<=c)||(isNaN(a)?!1:b<=a&&a<=c)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(b<d){for(var d=b.toString().slice(0,2),g=b.toString().slice(2, |
|
||||||
4);b<d+c;)d--;b=d+g;return a>b?a:b}return d},onKeyUp:function(a,b,c,d){b=e(this);a.ctrlKey&&a.keyCode==d.keyCode.RIGHT&&(a=new Date,b.val(a.getDate().toString()+(a.getMonth()+1).toString()+a.getFullYear().toString()))},definitions:{1:{validator:function(a,b,c,d,g){var e=g.regex.val1.test(a);return d||e||a.charAt(1)!=g.separator&&-1=="-./".indexOf(a.charAt(1))||!(e=g.regex.val1.test("0"+a.charAt(0)))?e:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a, |
|
||||||
b,c,d,g){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var e=1==a.length?g.regex.val1pre.test(a):g.regex.val1.test(a);return d||e||!(e=g.regex.val1.test("0"+a))?e:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},2:{validator:function(a,b,c,d,g){var e=g.mask.indexOf("2")==g.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=e.indexOf(g.placeholder[0])&&(e="01"+g.separator);var l=g.regex.val2(g.separator).test(e+a);if(!(d||l||a.charAt(1)!=g.separator&&-1=="-./".indexOf(a.charAt(1)))&& |
|
||||||
(l=g.regex.val2(g.separator).test(e+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(g.mask.indexOf("2")==g.mask.length-1&&l){if(b.buffer.join("").substr(4,4)+a!=g.leapday)return!0;a=parseInt(b.buffer.join("").substr(0,4),10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return l},cardinality:2,prevalidator:[{validator:function(a,b,c,d,g){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var e=g.mask.indexOf("2")==g.mask.length-1?b.buffer.join("").substr(5, |
|
||||||
3):b.buffer.join("").substr(0,3);-1!=e.indexOf(g.placeholder[0])&&(e="01"+g.separator);var l=1==a.length?g.regex.val2pre(g.separator).test(e+a):g.regex.val2(g.separator).test(e+a);return d||l||!(l=g.regex.val2(g.separator).test(e+"0"+a))?l:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,g){if(g.isInYearRange(a,g.yearrange.minyear,g.yearrange.maxyear)){if(b.buffer.join("").substr(0,6)!=g.leapday)return!0;a=parseInt(a,10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return!1}, |
|
||||||
cardinality:4,prevalidator:[{validator:function(a,b,c,d,g){var e=g.isInYearRange(a,g.yearrange.minyear,g.yearrange.maxyear);if(!d&&!e){d=g.determinebaseyear(g.yearrange.minyear,g.yearrange.maxyear,a+"0").toString().slice(0,1);if(e=g.isInYearRange(d+a,g.yearrange.minyear,g.yearrange.maxyear))return b.buffer[c++]=d.charAt(0),{pos:c};d=g.determinebaseyear(g.yearrange.minyear,g.yearrange.maxyear,a+"0").toString().slice(0,2);if(e=g.isInYearRange(d+a,g.yearrange.minyear,g.yearrange.maxyear))return b.buffer[c++]= |
|
||||||
d.charAt(0),b.buffer[c++]=d.charAt(1),{pos:c}}return e},cardinality:1},{validator:function(a,b,c,d,e){var h=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!h){d=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(h=e.isInYearRange(a[0]+d[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=d.charAt(1),{pos:c};d=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);e.isInYearRange(d+a,e.yearrange.minyear, |
|
||||||
e.yearrange.maxyear)?b.buffer.join("").substr(0,6)!=e.leapday?h=!0:(e=parseInt(a,10),h=0===e%4?0===e%100?0===e%400?!0:!1:!0:!1):h=!1;if(h)return b.buffer[c-1]=d.charAt(0),b.buffer[c++]=d.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return h},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(a){a= |
|
||||||
e.inputmask.escapeRegex.call(this,a);return RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:/[01]/,val1:/0[1-9]|1[012]/},leapday:"02/29/",onKeyUp:function(a,b,c,d){b=e(this);a.ctrlKey&&a.keyCode==d.keyCode.RIGHT&&(a=new Date,b.val((a.getMonth()+1).toString()+a.getDate().toString()+a.getFullYear().toString()))}},"yyyy/mm/dd":{mask:"y/1/2", |
|
||||||
placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(a,b,c,d){b=e(this);a.ctrlKey&&a.keyCode==d.keyCode.RIGHT&&(a=new Date,b.val(a.getFullYear().toString()+(a.getMonth()+1).toString()+a.getDate().toString()))}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.", |
|
||||||
separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:/[012]/,hrs24:/2[0-4]|1[3-9]/,hrs:/[01][0-9]|2[0-4]/,ampm:/^[a|p|A|P][m|M]/, |
|
||||||
mspre:/[0-5]/,ms:/[0-5][0-9]/},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,b,c,d,e){if("24"==e.hourFormat&&24==parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var h=e.regex.hrs.test(a);return d||h||a.charAt(1)!=e.timeseparator&&-1=="-.:".indexOf(a.charAt(1))||!(h=e.regex.hrs.test("0"+a.charAt(0)))?h&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)?(a=parseInt(a,10),b.buffer[c+5]=24==a?"a":"p",b.buffer[c+6]="m",a-=12,10>a?(b.buffer[c]= |
|
||||||
a.toString(),b.buffer[c-1]="0"):(b.buffer[c]=a.toString().charAt(1),b.buffer[c-1]=a.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}):h:(b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator})},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var h=e.regex.hrspre.test(a);return d||h||!(h=e.regex.hrs.test("0"+a))?h:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(a, |
|
||||||
b,c,d,e){var h=e.regex.mspre.test(a);return d||h||!(h=e.regex.ms.test("0"+a))?h:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime", |
|
||||||
hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}});return e.fn.inputmask}); |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","./jquery.inputmask"],e):e(jQuery)})(function(e){e.extend(e.inputmask.defaults.aliases,{numeric:{mask:function(a){0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat);a.repeat=0;a.autoGroup=a.autoGroup&&""!=a.groupSeparator;if(a.autoGroup&&isFinite(a.integerDigits)){var b=Math.floor(a.integerDigits/a.groupSize);a.integerDigits+=0==a.integerDigits%a.groupSize?b-1:b}a.definitions[":"].placeholder=a.radixPoint;b=a.prefix; |
|
||||||
b=b+"[+]"+("~{1,"+a.integerDigits+"}");void 0!=a.digits&&(isNaN(a.digits)||0<parseInt(a.digits))&&(b=a.digitsOptional?b+("[:~{"+a.digits+"}]"):b+(":~{"+a.digits+"}"));return b+=a.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,postFormat:function(a,b,c,d){var g=!1,h=a[b];if(""==d.groupSeparator||-1!=e.inArray(d.radixPoint,a)&&b>=e.inArray(d.radixPoint, |
|
||||||
a)||/[-+]/.test(h))return{pos:b};var l=a.slice();h==d.groupSeparator&&(l.splice(b--,1),h=l[b]);c?l[b]="?":l.splice(b,0,"?");b=l.join("");if(d.autoGroup||c&&-1!=b.indexOf(d.groupSeparator)){l=e.inputmask.escapeRegex.call(this,d.groupSeparator);g=0==b.indexOf(d.groupSeparator);b=b.replace(RegExp(l,"g"),"");l=b.split(d.radixPoint);b=l[0];if(b!=d.prefix+"?0"&&b.length>=d.groupSize+d.prefix.length)for(var g=!0,C=RegExp("([-+]?[\\d?]+)([\\d?]{"+d.groupSize+"})");C.test(b);)b=b.replace(C,"$1"+d.groupSeparator+ |
|
||||||
"$2"),b=b.replace(d.groupSeparator+d.groupSeparator,d.groupSeparator);1<l.length&&(b+=d.radixPoint+l[1])}a.length=b.length;d=0;for(l=b.length;d<l;d++)a[d]=b.charAt(d);d=e.inArray("?",a);c?a[d]=h:a.splice(d,1);return{pos:d,refreshFromBuffer:g}},onKeyDown:function(a,b,c,d){if(a.keyCode==d.keyCode.TAB&&"0"!=d.placeholder.charAt(0)){if(a=e.inArray(d.radixPoint,b),-1!=a&&isFinite(d.digits)){for(c=1;c<=d.digits;c++)if(void 0==b[a+c]||b[a+c]==d.placeholder.charAt(0))b[a+c]="0";return{refreshFromBuffer:{start:++a, |
|
||||||
end:a+d.digits}}}}else if(d.autoGroup&&(a.keyCode==d.keyCode.DELETE||a.keyCode==d.keyCode.BACKSPACE))return b=d.postFormat(b,c-1,!0,d),b.caret=b.pos+1,b},onKeyPress:function(a,b,c,d){if(d.autoGroup)return a=d.postFormat(b,c-1,!0,d),a.caret=a.pos+1,a},regex:{integerPart:function(a){return/[-+]?\d+/}},negationhandler:function(a,b,c,d,e){return!d&&e.allowMinus&&"-"===a&&(a=b.join("").match(e.regex.integerPart(e)),0<a.length)?"+"==b[a.index]?{pos:a.index,c:"-",remove:a.index,caret:c}:"-"==b[a.index]? |
|
||||||
{remove:a.index,caret:c-1}:{pos:a.index,c:"-",caret:c+1}:!1},definitions:{"~":{validator:function(a,b,c,d,g){var h=g.negationhandler(a,b.buffer,c,d,g);if(!h&&(h=d?RegExp("[0-9"+e.inputmask.escapeRegex.call(this,g.groupSeparator)+"]").test(a):/[0-9]/.test(a),!0===h&&(h={pos:c}),!1!=h&&!d)){d=b.buffer.join("").match(g.regex.integerPart(g));var l=e.inArray(g.radixPoint,b.buffer);if(d)if(0==d["0"].indexOf("0")&&c>=g.prefix.length)-1==l||c<=l&&void 0==b.validPositions[l]?(b.buffer.splice(d.index,1),c= |
|
||||||
c>d.index?c-1:d.index,e.extend(h,{pos:c,remove:d.index})):c>d.index&&c<=l&&(b.buffer.splice(d.index,1),c=c>d.index?c-1:d.index,e.extend(h,{pos:c,remove:d.index}));else if("0"==a&&c<=d.index)return!1;if(!1===g.digitsOptional&&c>l)return{pos:c,remove:c}}return h},cardinality:1,prevalidator:null},"+":{validator:function(a,b,c,d,e){b="[";!0===e.allowMinus&&(b+="-");!0===e.allowPlus&&(b+="+");return RegExp(b+"]").test(a)},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(a,b,c,d, |
|
||||||
g){d=g.negationhandler(a,b.buffer,c,d,g);d||(d="["+e.inputmask.escapeRegex.call(this,g.radixPoint)+"]",(d=RegExp(d).test(a))&&b.validPositions[c]&&b.validPositions[c].match.placeholder==g.radixPoint&&(d={pos:c,remove:c}));return d},cardinality:1,prevalidator:null,placeholder:""}},insertMode:!0,autoUnmask:!1,onUnMask:function(a,b,c){a=a.replace(c.prefix,"");a=a.replace(c.suffix,"");return a=a.replace(RegExp(e.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),"")},isComplete:function(a,b){var c= |
|
||||||
a.join(""),d=a.slice();b.postFormat(d,0,!0,b);if(d.join("")!=c)return!1;c=c.replace(b.prefix,"");c=c.replace(b.suffix,"");c=c.replace(RegExp(e.inputmask.escapeRegex.call(this,b.groupSeparator),"g"),"");c=c.replace(e.inputmask.escapeRegex.call(this,b.radixPoint),".");return isFinite(c)},onBeforeMask:function(a,b){if(isFinite(a))return a.toString().replace(".",b.radixPoint);var c=a.match(/,/g),d=a.match(/\./g);d&&c?d.length>c.length?(a=a.replace(/\./g,""),a=a.replace(",",b.radixPoint)):c.length>d.length&& |
|
||||||
(a=a.replace(/,/g,""),a=a.replace(".",b.radixPoint)):a=a.replace(RegExp(e.inputmask.escapeRegex.call(this,b.groupSeparator),"g"),"");return a}},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}});return e.fn.inputmask}); |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","./jquery.inputmask"],e):e(jQuery)})(function(e){e.extend(e.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,b){return RegExp(b.regex).test(a.join(""))}, |
|
||||||
definitions:{r:{validator:function(a,b,c,d,g){function h(a,b){this.matches=[];this.isGroup=a||!1;this.isQuantifier=b||!1;this.quantifier={min:1,max:1};this.repeaterPart=void 0}function l(){var a=new h,b,c=[];for(g.regexTokens=[];b=g.tokenizer.exec(g.regex);)switch(b=b[0],b.charAt(0)){case "(":c.push(new h(!0));break;case ")":var d=c.pop();0<c.length?c[c.length-1].matches.push(d):a.matches.push(d);break;case "{":case "+":case "*":var e=new h(!1,!0);b=b.replace(/[{}]/g,"");d=b.split(",");b=isNaN(d[0])? |
|
||||||
d[0]:parseInt(d[0]);d=1==d.length?b:isNaN(d[1])?d[1]:parseInt(d[1]);e.quantifier={min:b,max:d};if(0<c.length){var l=c[c.length-1].matches;b=l.pop();b.isGroup||(d=new h(!0),d.matches.push(b),b=d);l.push(b);l.push(e)}else b=a.matches.pop(),b.isGroup||(d=new h(!0),d.matches.push(b),b=d),a.matches.push(b),a.matches.push(e);break;default:0<c.length?c[c.length-1].matches.push(b):a.matches.push(b)}0<a.matches.length&&g.regexTokens.push(a)}function C(a,b){var c=!1;b&&(v+="(",W++);for(var d=0;d<a.matches.length;d++){var g= |
|
||||||
a.matches[d];if(!0==g.isGroup)c=C(g,!0);else if(!0==g.isQuantifier){var h=e.inArray(g,a.matches),h=a.matches[h-1],l=v;if(isNaN(g.quantifier.max)){for(;g.repeaterPart&&g.repeaterPart!=v&&g.repeaterPart.length>v.length&&!(c=C(h,!0)););(c=c||C(h,!0))&&(g.repeaterPart=v);v=l+g.quantifier.max}else{for(var k=0,pa=g.quantifier.max-1;k<pa&&!(c=C(h,!0));k++);v=l+"{"+g.quantifier.min+","+g.quantifier.max+"}"}}else if(void 0!=g.matches)for(h=0;h<g.length&&!(c=C(g[h],b));h++);else{if("["==g.charAt(0)){c=v;c+= |
|
||||||
g;for(k=0;k<W;k++)c+=")";c=RegExp("^("+c+")$");c=c.test(T)}else for(h=0,l=g.length;h<l;h++)if("\\"!=g.charAt(h)){c=v;c+=g.substr(0,h+1);c=c.replace(/\|$/,"");for(k=0;k<W;k++)c+=")";c=RegExp("^("+c+")$");if(c=c.test(T))break}v+=g}if(c)break}b&&(v+=")",W--);return c}null==g.regexTokens&&l();d=b.buffer.slice();var v="";b=!1;var W=0;d.splice(c,0,a);var T=d.join("");for(a=0;a<g.regexTokens.length&&!(h=g.regexTokens[a],b=C(h,h.isGroup));a++);return b},cardinality:1}}}});return e.fn.inputmask}); |
|
||||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","./jquery.inputmask"],e):e(jQuery)})(function(e){e.extend(e.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.json",mask:function(a){a.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var b=[];e.ajax({url:a.url,async:!1,dataType:"json",success:function(a){b=a}});b.splice(0,0,"+pp(pp)pppppppp");return b},nojumps:!0,nojumpsThreshold:1},phonebe:{url:"phone-codes/phone-be.json", |
|
||||||
mask:function(a){a.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var b=[];e.ajax({url:a.url,async:!1,dataType:"json",success:function(a){b=a}});b.splice(0,0,"+32(pp)pppppppp");return b},nojumps:!0,nojumpsThreshold:4}});return e.fn.inputmask}); |
|
@ -1,278 +0,0 @@ |
|||||||
GNU GENERAL PUBLIC LICENSE |
|
||||||
Version 2, June 1991 |
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
Everyone is permitted to copy and distribute verbatim copies |
|
||||||
of this license document, but changing it is not allowed. |
|
||||||
|
|
||||||
Preamble |
|
||||||
|
|
||||||
The licenses for most software are designed to take away your |
|
||||||
freedom to share and change it. By contrast, the GNU General Public |
|
||||||
License is intended to guarantee your freedom to share and change free |
|
||||||
software--to make sure the software is free for all its users. This |
|
||||||
General Public License applies to most of the Free Software |
|
||||||
Foundation's software and to any other program whose authors commit to |
|
||||||
using it. (Some other Free Software Foundation software is covered by |
|
||||||
the GNU Lesser General Public License instead.) You can apply it to |
|
||||||
your programs, too. |
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not |
|
||||||
price. Our General Public Licenses are designed to make sure that you |
|
||||||
have the freedom to distribute copies of free software (and charge for |
|
||||||
this service if you wish), that you receive source code or can get it |
|
||||||
if you want it, that you can change the software or use pieces of it |
|
||||||
in new free programs; and that you know you can do these things. |
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid |
|
||||||
anyone to deny you these rights or to ask you to surrender the rights. |
|
||||||
These restrictions translate to certain responsibilities for you if you |
|
||||||
distribute copies of the software, or if you modify it. |
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether |
|
||||||
gratis or for a fee, you must give the recipients all the rights that |
|
||||||
you have. You must make sure that they, too, receive or can get the |
|
||||||
source code. And you must show them these terms so they know their |
|
||||||
rights. |
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and |
|
||||||
(2) offer you this license which gives you legal permission to copy, |
|
||||||
distribute and/or modify the software. |
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain |
|
||||||
that everyone understands that there is no warranty for this free |
|
||||||
software. If the software is modified by someone else and passed on, we |
|
||||||
want its recipients to know that what they have is not the original, so |
|
||||||
that any problems introduced by others will not reflect on the original |
|
||||||
authors' reputations. |
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software |
|
||||||
patents. We wish to avoid the danger that redistributors of a free |
|
||||||
program will individually obtain patent licenses, in effect making the |
|
||||||
program proprietary. To prevent this, we have made it clear that any |
|
||||||
patent must be licensed for everyone's free use or not licensed at all. |
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and |
|
||||||
modification follow. |
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE |
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains |
|
||||||
a notice placed by the copyright holder saying it may be distributed |
|
||||||
under the terms of this General Public License. The "Program", below, |
|
||||||
refers to any such program or work, and a "work based on the Program" |
|
||||||
means either the Program or any derivative work under copyright law: |
|
||||||
that is to say, a work containing the Program or a portion of it, |
|
||||||
either verbatim or with modifications and/or translated into another |
|
||||||
language. (Hereinafter, translation is included without limitation in |
|
||||||
the term "modification".) Each licensee is addressed as "you". |
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not |
|
||||||
covered by this License; they are outside its scope. The act of |
|
||||||
running the Program is not restricted, and the output from the Program |
|
||||||
is covered only if its contents constitute a work based on the |
|
||||||
Program (independent of having been made by running the Program). |
|
||||||
Whether that is true depends on what the Program does. |
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's |
|
||||||
source code as you receive it, in any medium, provided that you |
|
||||||
conspicuously and appropriately publish on each copy an appropriate |
|
||||||
copyright notice and disclaimer of warranty; keep intact all the |
|
||||||
notices that refer to this License and to the absence of any warranty; |
|
||||||
and give any other recipients of the Program a copy of this License |
|
||||||
along with the Program. |
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and |
|
||||||
you may at your option offer warranty protection in exchange for a fee. |
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion |
|
||||||
of it, thus forming a work based on the Program, and copy and |
|
||||||
distribute such modifications or work under the terms of Section 1 |
|
||||||
above, provided that you also meet all of these conditions: |
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices |
|
||||||
stating that you changed the files and the date of any change. |
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in |
|
||||||
whole or in part contains or is derived from the Program or any |
|
||||||
part thereof, to be licensed as a whole at no charge to all third |
|
||||||
parties under the terms of this License. |
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively |
|
||||||
when run, you must cause it, when started running for such |
|
||||||
interactive use in the most ordinary way, to print or display an |
|
||||||
announcement including an appropriate copyright notice and a |
|
||||||
notice that there is no warranty (or else, saying that you provide |
|
||||||
a warranty) and that users may redistribute the program under |
|
||||||
these conditions, and telling the user how to view a copy of this |
|
||||||
License. (Exception: if the Program itself is interactive but |
|
||||||
does not normally print such an announcement, your work based on |
|
||||||
the Program is not required to print an announcement.) |
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If |
|
||||||
identifiable sections of that work are not derived from the Program, |
|
||||||
and can be reasonably considered independent and separate works in |
|
||||||
themselves, then this License, and its terms, do not apply to those |
|
||||||
sections when you distribute them as separate works. But when you |
|
||||||
distribute the same sections as part of a whole which is a work based |
|
||||||
on the Program, the distribution of the whole must be on the terms of |
|
||||||
this License, whose permissions for other licensees extend to the |
|
||||||
entire whole, and thus to each and every part regardless of who wrote it. |
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest |
|
||||||
your rights to work written entirely by you; rather, the intent is to |
|
||||||
exercise the right to control the distribution of derivative or |
|
||||||
collective works based on the Program. |
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program |
|
||||||
with the Program (or with a work based on the Program) on a volume of |
|
||||||
a storage or distribution medium does not bring the other work under |
|
||||||
the scope of this License. |
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it, |
|
||||||
under Section 2) in object code or executable form under the terms of |
|
||||||
Sections 1 and 2 above provided that you also do one of the following: |
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable |
|
||||||
source code, which must be distributed under the terms of Sections |
|
||||||
1 and 2 above on a medium customarily used for software interchange; or, |
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three |
|
||||||
years, to give any third party, for a charge no more than your |
|
||||||
cost of physically performing source distribution, a complete |
|
||||||
machine-readable copy of the corresponding source code, to be |
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium |
|
||||||
customarily used for software interchange; or, |
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer |
|
||||||
to distribute corresponding source code. (This alternative is |
|
||||||
allowed only for noncommercial distribution and only if you |
|
||||||
received the program in object code or executable form with such |
|
||||||
an offer, in accord with Subsection b above.) |
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for |
|
||||||
making modifications to it. For an executable work, complete source |
|
||||||
code means all the source code for all modules it contains, plus any |
|
||||||
associated interface definition files, plus the scripts used to |
|
||||||
control compilation and installation of the executable. However, as a |
|
||||||
special exception, the source code distributed need not include |
|
||||||
anything that is normally distributed (in either source or binary |
|
||||||
form) with the major components (compiler, kernel, and so on) of the |
|
||||||
operating system on which the executable runs, unless that component |
|
||||||
itself accompanies the executable. |
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering |
|
||||||
access to copy from a designated place, then offering equivalent |
|
||||||
access to copy the source code from the same place counts as |
|
||||||
distribution of the source code, even though third parties are not |
|
||||||
compelled to copy the source along with the object code. |
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program |
|
||||||
except as expressly provided under this License. Any attempt |
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is |
|
||||||
void, and will automatically terminate your rights under this License. |
|
||||||
However, parties who have received copies, or rights, from you under |
|
||||||
this License will not have their licenses terminated so long as such |
|
||||||
parties remain in full compliance. |
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not |
|
||||||
signed it. However, nothing else grants you permission to modify or |
|
||||||
distribute the Program or its derivative works. These actions are |
|
||||||
prohibited by law if you do not accept this License. Therefore, by |
|
||||||
modifying or distributing the Program (or any work based on the |
|
||||||
Program), you indicate your acceptance of this License to do so, and |
|
||||||
all its terms and conditions for copying, distributing or modifying |
|
||||||
the Program or works based on it. |
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the |
|
||||||
Program), the recipient automatically receives a license from the |
|
||||||
original licensor to copy, distribute or modify the Program subject to |
|
||||||
these terms and conditions. You may not impose any further |
|
||||||
restrictions on the recipients' exercise of the rights granted herein. |
|
||||||
You are not responsible for enforcing compliance by third parties to |
|
||||||
this License. |
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent |
|
||||||
infringement or for any other reason (not limited to patent issues), |
|
||||||
conditions are imposed on you (whether by court order, agreement or |
|
||||||
otherwise) that contradict the conditions of this License, they do not |
|
||||||
excuse you from the conditions of this License. If you cannot |
|
||||||
distribute so as to satisfy simultaneously your obligations under this |
|
||||||
License and any other pertinent obligations, then as a consequence you |
|
||||||
may not distribute the Program at all. For example, if a patent |
|
||||||
license would not permit royalty-free redistribution of the Program by |
|
||||||
all those who receive copies directly or indirectly through you, then |
|
||||||
the only way you could satisfy both it and this License would be to |
|
||||||
refrain entirely from distribution of the Program. |
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under |
|
||||||
any particular circumstance, the balance of the section is intended to |
|
||||||
apply and the section as a whole is intended to apply in other |
|
||||||
circumstances. |
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any |
|
||||||
patents or other property right claims or to contest validity of any |
|
||||||
such claims; this section has the sole purpose of protecting the |
|
||||||
integrity of the free software distribution system, which is |
|
||||||
implemented by public license practices. Many people have made |
|
||||||
generous contributions to the wide range of software distributed |
|
||||||
through that system in reliance on consistent application of that |
|
||||||
system; it is up to the author/donor to decide if he or she is willing |
|
||||||
to distribute software through any other system and a licensee cannot |
|
||||||
impose that choice. |
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to |
|
||||||
be a consequence of the rest of this License. |
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in |
|
||||||
certain countries either by patents or by copyrighted interfaces, the |
|
||||||
original copyright holder who places the Program under this License |
|
||||||
may add an explicit geographical distribution limitation excluding |
|
||||||
those countries, so that distribution is permitted only in or among |
|
||||||
countries not thus excluded. In such case, this License incorporates |
|
||||||
the limitation as if written in the body of this License. |
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions |
|
||||||
of the General Public License from time to time. Such new versions will |
|
||||||
be similar in spirit to the present version, but may differ in detail to |
|
||||||
address new problems or concerns. |
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program |
|
||||||
specifies a version number of this License which applies to it and "any |
|
||||||
later version", you have the option of following the terms and conditions |
|
||||||
either of that version or of any later version published by the Free |
|
||||||
Software Foundation. If the Program does not specify a version number of |
|
||||||
this License, you may choose any version ever published by the Free Software |
|
||||||
Foundation. |
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free |
|
||||||
programs whose distribution conditions are different, write to the author |
|
||||||
to ask for permission. For software which is copyrighted by the Free |
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes |
|
||||||
make exceptions for this. Our decision will be guided by the two goals |
|
||||||
of preserving the free status of all derivatives of our free software and |
|
||||||
of promoting the sharing and reuse of software generally. |
|
||||||
|
|
||||||
NO WARRANTY |
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
|
||||||
REPAIR OR CORRECTION. |
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
|
||||||
POSSIBILITY OF SUCH DAMAGES. |
|
@ -1,20 +0,0 @@ |
|||||||
Copyright Mathias Bynens <http://mathiasbynens.be/> |
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining |
|
||||||
a copy of this software and associated documentation files (the |
|
||||||
"Software"), to deal in the Software without restriction, including |
|
||||||
without limitation the rights to use, copy, modify, merge, publish, |
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to |
|
||||||
permit persons to whom the Software is furnished to do so, subject to |
|
||||||
the following conditions: |
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be |
|
||||||
included in all copies or substantial portions of the Software. |
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
@ -1,502 +0,0 @@ |
|||||||
/*! http://mths.be/punycode v1.2.1 by @mathias */ |
|
||||||
;(function(root) { |
|
||||||
|
|
||||||
/** Detect free variables */ |
|
||||||
var freeExports = typeof exports == 'object' && exports; |
|
||||||
var freeModule = typeof module == 'object' && module && |
|
||||||
module.exports == freeExports && module; |
|
||||||
var freeGlobal = typeof global == 'object' && global; |
|
||||||
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { |
|
||||||
root = freeGlobal; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* The `punycode` object. |
|
||||||
* @name punycode |
|
||||||
* @type Object |
|
||||||
*/ |
|
||||||
var punycode, |
|
||||||
|
|
||||||
/** Highest positive signed 32-bit float value */ |
|
||||||
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
|
||||||
|
|
||||||
/** Bootstring parameters */ |
|
||||||
base = 36, |
|
||||||
tMin = 1, |
|
||||||
tMax = 26, |
|
||||||
skew = 38, |
|
||||||
damp = 700, |
|
||||||
initialBias = 72, |
|
||||||
initialN = 128, // 0x80
|
|
||||||
delimiter = '-', // '\x2D'
|
|
||||||
|
|
||||||
/** Regular expressions */ |
|
||||||
regexPunycode = /^xn--/, |
|
||||||
regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
|
|
||||||
regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators
|
|
||||||
|
|
||||||
/** Error messages */ |
|
||||||
errors = { |
|
||||||
'overflow': 'Overflow: input needs wider integers to process', |
|
||||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)', |
|
||||||
'invalid-input': 'Invalid input' |
|
||||||
}, |
|
||||||
|
|
||||||
/** Convenience shortcuts */ |
|
||||||
baseMinusTMin = base - tMin, |
|
||||||
floor = Math.floor, |
|
||||||
stringFromCharCode = String.fromCharCode, |
|
||||||
|
|
||||||
/** Temporary variable */ |
|
||||||
key; |
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/** |
|
||||||
* A generic error utility function. |
|
||||||
* @private |
|
||||||
* @param {String} type The error type. |
|
||||||
* @returns {Error} Throws a `RangeError` with the applicable error message. |
|
||||||
*/ |
|
||||||
function error(type) { |
|
||||||
throw RangeError(errors[type]); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* A generic `Array#map` utility function. |
|
||||||
* @private |
|
||||||
* @param {Array} array The array to iterate over. |
|
||||||
* @param {Function} callback The function that gets called for every array |
|
||||||
* item. |
|
||||||
* @returns {Array} A new array of values returned by the callback function. |
|
||||||
*/ |
|
||||||
function map(array, fn) { |
|
||||||
var length = array.length; |
|
||||||
while (length--) { |
|
||||||
array[length] = fn(array[length]); |
|
||||||
} |
|
||||||
return array; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* A simple `Array#map`-like wrapper to work with domain name strings. |
|
||||||
* @private |
|
||||||
* @param {String} domain The domain name. |
|
||||||
* @param {Function} callback The function that gets called for every |
|
||||||
* character. |
|
||||||
* @returns {Array} A new string of characters returned by the callback |
|
||||||
* function. |
|
||||||
*/ |
|
||||||
function mapDomain(string, fn) { |
|
||||||
return map(string.split(regexSeparators), fn).join('.'); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Creates an array containing the decimal code points of each Unicode |
|
||||||
* character in the string. While JavaScript uses UCS-2 internally, |
|
||||||
* this function will convert a pair of surrogate halves (each of which |
|
||||||
* UCS-2 exposes as separate characters) into a single code point, |
|
||||||
* matching UTF-16. |
|
||||||
* @see `punycode.ucs2.encode` |
|
||||||
* @see <http://mathiasbynens.be/notes/javascript-encoding>
|
|
||||||
* @memberOf punycode.ucs2 |
|
||||||
* @name decode |
|
||||||
* @param {String} string The Unicode input string (UCS-2). |
|
||||||
* @returns {Array} The new array of code points. |
|
||||||
*/ |
|
||||||
function ucs2decode(string) { |
|
||||||
var output = [], |
|
||||||
counter = 0, |
|
||||||
length = string.length, |
|
||||||
value, |
|
||||||
extra; |
|
||||||
while (counter < length) { |
|
||||||
value = string.charCodeAt(counter++); |
|
||||||
if ((value & 0xF800) == 0xD800 && counter < length) { |
|
||||||
// high surrogate, and there is a next character
|
|
||||||
extra = string.charCodeAt(counter++); |
|
||||||
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
||||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); |
|
||||||
} else { |
|
||||||
output.push(value, extra); |
|
||||||
} |
|
||||||
} else { |
|
||||||
output.push(value); |
|
||||||
} |
|
||||||
} |
|
||||||
return output; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Creates a string based on an array of decimal code points. |
|
||||||
* @see `punycode.ucs2.decode` |
|
||||||
* @memberOf punycode.ucs2 |
|
||||||
* @name encode |
|
||||||
* @param {Array} codePoints The array of decimal code points. |
|
||||||
* @returns {String} The new Unicode string (UCS-2). |
|
||||||
*/ |
|
||||||
function ucs2encode(array) { |
|
||||||
return map(array, function(value) { |
|
||||||
var output = ''; |
|
||||||
if (value > 0xFFFF) { |
|
||||||
value -= 0x10000; |
|
||||||
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); |
|
||||||
value = 0xDC00 | value & 0x3FF; |
|
||||||
} |
|
||||||
output += stringFromCharCode(value); |
|
||||||
return output; |
|
||||||
}).join(''); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a basic code point into a digit/integer. |
|
||||||
* @see `digitToBasic()` |
|
||||||
* @private |
|
||||||
* @param {Number} codePoint The basic (decimal) code point. |
|
||||||
* @returns {Number} The numeric value of a basic code point (for use in |
|
||||||
* representing integers) in the range `0` to `base - 1`, or `base` if |
|
||||||
* the code point does not represent a value. |
|
||||||
*/ |
|
||||||
function basicToDigit(codePoint) { |
|
||||||
return codePoint - 48 < 10 |
|
||||||
? codePoint - 22 |
|
||||||
: codePoint - 65 < 26 |
|
||||||
? codePoint - 65 |
|
||||||
: codePoint - 97 < 26 |
|
||||||
? codePoint - 97 |
|
||||||
: base; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a digit/integer into a basic code point. |
|
||||||
* @see `basicToDigit()` |
|
||||||
* @private |
|
||||||
* @param {Number} digit The numeric value of a basic code point. |
|
||||||
* @returns {Number} The basic code point whose value (when used for |
|
||||||
* representing integers) is `digit`, which needs to be in the range |
|
||||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is |
|
||||||
* used; else, the lowercase form is used. The behavior is undefined |
|
||||||
* if flag is non-zero and `digit` has no uppercase form. |
|
||||||
*/ |
|
||||||
function digitToBasic(digit, flag) { |
|
||||||
// 0..25 map to ASCII a..z or A..Z
|
|
||||||
// 26..35 map to ASCII 0..9
|
|
||||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Bias adaptation function as per section 3.4 of RFC 3492. |
|
||||||
* http://tools.ietf.org/html/rfc3492#section-3.4
|
|
||||||
* @private |
|
||||||
*/ |
|
||||||
function adapt(delta, numPoints, firstTime) { |
|
||||||
var k = 0; |
|
||||||
delta = firstTime ? floor(delta / damp) : delta >> 1; |
|
||||||
delta += floor(delta / numPoints); |
|
||||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { |
|
||||||
delta = floor(delta / baseMinusTMin); |
|
||||||
} |
|
||||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a Punycode string of ASCII code points to a string of Unicode |
|
||||||
* code points. |
|
||||||
* @memberOf punycode |
|
||||||
* @param {String} input The Punycode string of ASCII code points. |
|
||||||
* @returns {String} The resulting string of Unicode code points. |
|
||||||
*/ |
|
||||||
function decode(input) { |
|
||||||
// Don't use UCS-2
|
|
||||||
var output = [], |
|
||||||
inputLength = input.length, |
|
||||||
out, |
|
||||||
i = 0, |
|
||||||
n = initialN, |
|
||||||
bias = initialBias, |
|
||||||
basic, |
|
||||||
j, |
|
||||||
index, |
|
||||||
oldi, |
|
||||||
w, |
|
||||||
k, |
|
||||||
digit, |
|
||||||
t, |
|
||||||
length, |
|
||||||
/** Cached calculation results */ |
|
||||||
baseMinusT; |
|
||||||
|
|
||||||
// Handle the basic code points: let `basic` be the number of input code
|
|
||||||
// points before the last delimiter, or `0` if there is none, then copy
|
|
||||||
// the first basic code points to the output.
|
|
||||||
|
|
||||||
basic = input.lastIndexOf(delimiter); |
|
||||||
if (basic < 0) { |
|
||||||
basic = 0; |
|
||||||
} |
|
||||||
|
|
||||||
for (j = 0; j < basic; ++j) { |
|
||||||
// if it's not a basic code point
|
|
||||||
if (input.charCodeAt(j) >= 0x80) { |
|
||||||
error('not-basic'); |
|
||||||
} |
|
||||||
output.push(input.charCodeAt(j)); |
|
||||||
} |
|
||||||
|
|
||||||
// Main decoding loop: start just after the last delimiter if any basic code
|
|
||||||
// points were copied; start at the beginning otherwise.
|
|
||||||
|
|
||||||
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { |
|
||||||
|
|
||||||
// `index` is the index of the next character to be consumed.
|
|
||||||
// Decode a generalized variable-length integer into `delta`,
|
|
||||||
// which gets added to `i`. The overflow checking is easier
|
|
||||||
// if we increase `i` as we go, then subtract off its starting
|
|
||||||
// value at the end to obtain `delta`.
|
|
||||||
for (oldi = i, w = 1, k = base; /* no condition */; k += base) { |
|
||||||
|
|
||||||
if (index >= inputLength) { |
|
||||||
error('invalid-input'); |
|
||||||
} |
|
||||||
|
|
||||||
digit = basicToDigit(input.charCodeAt(index++)); |
|
||||||
|
|
||||||
if (digit >= base || digit > floor((maxInt - i) / w)) { |
|
||||||
error('overflow'); |
|
||||||
} |
|
||||||
|
|
||||||
i += digit * w; |
|
||||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); |
|
||||||
|
|
||||||
if (digit < t) { |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
baseMinusT = base - t; |
|
||||||
if (w > floor(maxInt / baseMinusT)) { |
|
||||||
error('overflow'); |
|
||||||
} |
|
||||||
|
|
||||||
w *= baseMinusT; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
out = output.length + 1; |
|
||||||
bias = adapt(i - oldi, out, oldi == 0); |
|
||||||
|
|
||||||
// `i` was supposed to wrap around from `out` to `0`,
|
|
||||||
// incrementing `n` each time, so we'll fix that now:
|
|
||||||
if (floor(i / out) > maxInt - n) { |
|
||||||
error('overflow'); |
|
||||||
} |
|
||||||
|
|
||||||
n += floor(i / out); |
|
||||||
i %= out; |
|
||||||
|
|
||||||
// Insert `n` at position `i` of the output
|
|
||||||
output.splice(i++, 0, n); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
return ucs2encode(output); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a string of Unicode code points to a Punycode string of ASCII |
|
||||||
* code points. |
|
||||||
* @memberOf punycode |
|
||||||
* @param {String} input The string of Unicode code points. |
|
||||||
* @returns {String} The resulting Punycode string of ASCII code points. |
|
||||||
*/ |
|
||||||
function encode(input) { |
|
||||||
var n, |
|
||||||
delta, |
|
||||||
handledCPCount, |
|
||||||
basicLength, |
|
||||||
bias, |
|
||||||
j, |
|
||||||
m, |
|
||||||
q, |
|
||||||
k, |
|
||||||
t, |
|
||||||
currentValue, |
|
||||||
output = [], |
|
||||||
/** `inputLength` will hold the number of code points in `input`. */ |
|
||||||
inputLength, |
|
||||||
/** Cached calculation results */ |
|
||||||
handledCPCountPlusOne, |
|
||||||
baseMinusT, |
|
||||||
qMinusT; |
|
||||||
|
|
||||||
// Convert the input in UCS-2 to Unicode
|
|
||||||
input = ucs2decode(input); |
|
||||||
|
|
||||||
// Cache the length
|
|
||||||
inputLength = input.length; |
|
||||||
|
|
||||||
// Initialize the state
|
|
||||||
n = initialN; |
|
||||||
delta = 0; |
|
||||||
bias = initialBias; |
|
||||||
|
|
||||||
// Handle the basic code points
|
|
||||||
for (j = 0; j < inputLength; ++j) { |
|
||||||
currentValue = input[j]; |
|
||||||
if (currentValue < 0x80) { |
|
||||||
output.push(stringFromCharCode(currentValue)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
handledCPCount = basicLength = output.length; |
|
||||||
|
|
||||||
// `handledCPCount` is the number of code points that have been handled;
|
|
||||||
// `basicLength` is the number of basic code points.
|
|
||||||
|
|
||||||
// Finish the basic string - if it is not empty - with a delimiter
|
|
||||||
if (basicLength) { |
|
||||||
output.push(delimiter); |
|
||||||
} |
|
||||||
|
|
||||||
// Main encoding loop:
|
|
||||||
while (handledCPCount < inputLength) { |
|
||||||
|
|
||||||
// All non-basic code points < n have been handled already. Find the next
|
|
||||||
// larger one:
|
|
||||||
for (m = maxInt, j = 0; j < inputLength; ++j) { |
|
||||||
currentValue = input[j]; |
|
||||||
if (currentValue >= n && currentValue < m) { |
|
||||||
m = currentValue; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
||||||
// but guard against overflow
|
|
||||||
handledCPCountPlusOne = handledCPCount + 1; |
|
||||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { |
|
||||||
error('overflow'); |
|
||||||
} |
|
||||||
|
|
||||||
delta += (m - n) * handledCPCountPlusOne; |
|
||||||
n = m; |
|
||||||
|
|
||||||
for (j = 0; j < inputLength; ++j) { |
|
||||||
currentValue = input[j]; |
|
||||||
|
|
||||||
if (currentValue < n && ++delta > maxInt) { |
|
||||||
error('overflow'); |
|
||||||
} |
|
||||||
|
|
||||||
if (currentValue == n) { |
|
||||||
// Represent delta as a generalized variable-length integer
|
|
||||||
for (q = delta, k = base; /* no condition */; k += base) { |
|
||||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); |
|
||||||
if (q < t) { |
|
||||||
break; |
|
||||||
} |
|
||||||
qMinusT = q - t; |
|
||||||
baseMinusT = base - t; |
|
||||||
output.push( |
|
||||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) |
|
||||||
); |
|
||||||
q = floor(qMinusT / baseMinusT); |
|
||||||
} |
|
||||||
|
|
||||||
output.push(stringFromCharCode(digitToBasic(q, 0))); |
|
||||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); |
|
||||||
delta = 0; |
|
||||||
++handledCPCount; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
++delta; |
|
||||||
++n; |
|
||||||
|
|
||||||
} |
|
||||||
return output.join(''); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a Punycode string representing a domain name to Unicode. Only the |
|
||||||
* Punycoded parts of the domain name will be converted, i.e. it doesn't |
|
||||||
* matter if you call it on a string that has already been converted to |
|
||||||
* Unicode. |
|
||||||
* @memberOf punycode |
|
||||||
* @param {String} domain The Punycode domain name to convert to Unicode. |
|
||||||
* @returns {String} The Unicode representation of the given Punycode |
|
||||||
* string. |
|
||||||
*/ |
|
||||||
function toUnicode(domain) { |
|
||||||
return mapDomain(domain, function(string) { |
|
||||||
return regexPunycode.test(string) |
|
||||||
? decode(string.slice(4).toLowerCase()) |
|
||||||
: string; |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Converts a Unicode string representing a domain name to Punycode. Only the |
|
||||||
* non-ASCII parts of the domain name will be converted, i.e. it doesn't |
|
||||||
* matter if you call it with a domain that's already in ASCII. |
|
||||||
* @memberOf punycode |
|
||||||
* @param {String} domain The domain name to convert, as a Unicode string. |
|
||||||
* @returns {String} The Punycode representation of the given domain name. |
|
||||||
*/ |
|
||||||
function toASCII(domain) { |
|
||||||
return mapDomain(domain, function(string) { |
|
||||||
return regexNonASCII.test(string) |
|
||||||
? 'xn--' + encode(string) |
|
||||||
: string; |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/** Define the public API */ |
|
||||||
punycode = { |
|
||||||
/** |
|
||||||
* A string representing the current Punycode.js version number. |
|
||||||
* @memberOf punycode |
|
||||||
* @type String |
|
||||||
*/ |
|
||||||
'version': '1.2.1', |
|
||||||
/** |
|
||||||
* An object of methods to convert from JavaScript's internal character |
|
||||||
* representation (UCS-2) to decimal Unicode code points, and back. |
|
||||||
* @see <http://mathiasbynens.be/notes/javascript-encoding>
|
|
||||||
* @memberOf punycode |
|
||||||
* @type Object |
|
||||||
*/ |
|
||||||
'ucs2': { |
|
||||||
'decode': ucs2decode, |
|
||||||
'encode': ucs2encode |
|
||||||
}, |
|
||||||
'decode': decode, |
|
||||||
'encode': encode, |
|
||||||
'toASCII': toASCII, |
|
||||||
'toUnicode': toUnicode |
|
||||||
}; |
|
||||||
|
|
||||||
/** Expose `punycode` */ |
|
||||||
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
||||||
// like the following:
|
|
||||||
if ( |
|
||||||
typeof define == 'function' && |
|
||||||
typeof define.amd == 'object' && |
|
||||||
define.amd |
|
||||||
) { |
|
||||||
define(function() { |
|
||||||
return punycode; |
|
||||||
}); |
|
||||||
} else if (freeExports && !freeExports.nodeType) { |
|
||||||
if (freeModule) { // in Node.js or RingoJS v0.8.0+
|
|
||||||
freeModule.exports = punycode; |
|
||||||
} else { // in Narwhal or RingoJS v0.7.0-
|
|
||||||
for (key in punycode) { |
|
||||||
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); |
|
||||||
} |
|
||||||
} |
|
||||||
} else { // in Rhino or a web browser
|
|
||||||
root.punycode = punycode; |
|
||||||
} |
|
||||||
|
|
||||||
}(this)); |
|
@ -1,2 +0,0 @@ |
|||||||
/*! http://mths.be/punycode v1.2.1 by @mathias */ |
|
||||||
(function(o){function e(o){throw RangeError(L[o])}function n(o,e){for(var n=o.length;n--;)o[n]=e(o[n]);return o}function t(o,e){return n(o.split(S),e).join(".")}function r(o){for(var e,n,t=[],r=0,u=o.length;u>r;)e=o.charCodeAt(r++),55296==(63488&e)&&u>r?(n=o.charCodeAt(r++),56320==(64512&n)?t.push(((1023&e)<<10)+(1023&n)+65536):t.push(e,n)):t.push(e);return t}function u(o){return n(o,function(o){var e="";return o>65535&&(o-=65536,e+=R(55296|1023&o>>>10),o=56320|1023&o),e+=R(o)}).join("")}function i(o){return 10>o-48?o-22:26>o-65?o-65:26>o-97?o-97:x}function f(o,e){return o+22+75*(26>o)-((0!=e)<<5)}function c(o,e,n){var t=0;for(o=n?P(o/m):o>>1,o+=P(o/e);o>M*y>>1;t+=x)o=P(o/M);return P(t+(M+1)*o/(o+j))}function l(o){var n,t,r,f,l,d,s,a,p,h,v=[],g=o.length,w=0,j=I,m=A;for(t=o.lastIndexOf(F),0>t&&(t=0),r=0;t>r;++r)o.charCodeAt(r)>=128&&e("not-basic"),v.push(o.charCodeAt(r));for(f=t>0?t+1:0;g>f;){for(l=w,d=1,s=x;f>=g&&e("invalid-input"),a=i(o.charCodeAt(f++)),(a>=x||a>P((b-w)/d))&&e("overflow"),w+=a*d,p=m>=s?C:s>=m+y?y:s-m,!(p>a);s+=x)h=x-p,d>P(b/h)&&e("overflow"),d*=h;n=v.length+1,m=c(w-l,n,0==l),P(w/n)>b-j&&e("overflow"),j+=P(w/n),w%=n,v.splice(w++,0,j)}return u(v)}function d(o){var n,t,u,i,l,d,s,a,p,h,v,g,w,j,m,E=[];for(o=r(o),g=o.length,n=I,t=0,l=A,d=0;g>d;++d)v=o[d],128>v&&E.push(R(v));for(u=i=E.length,i&&E.push(F);g>u;){for(s=b,d=0;g>d;++d)v=o[d],v>=n&&s>v&&(s=v);for(w=u+1,s-n>P((b-t)/w)&&e("overflow"),t+=(s-n)*w,n=s,d=0;g>d;++d)if(v=o[d],n>v&&++t>b&&e("overflow"),v==n){for(a=t,p=x;h=l>=p?C:p>=l+y?y:p-l,!(h>a);p+=x)m=a-h,j=x-h,E.push(R(f(h+m%j,0))),a=P(m/j);E.push(R(f(a,0))),l=c(t,w,u==i),t=0,++u}++t,++n}return E.join("")}function s(o){return t(o,function(o){return E.test(o)?l(o.slice(4).toLowerCase()):o})}function a(o){return t(o,function(o){return O.test(o)?"xn--"+d(o):o})}var p="object"==typeof exports&&exports,h="object"==typeof module&&module&&module.exports==p&&module,v="object"==typeof global&&global;(v.global===v||v.window===v)&&(o=v);var g,w,b=2147483647,x=36,C=1,y=26,j=38,m=700,A=72,I=128,F="-",E=/^xn--/,O=/[^ -~]/,S=/\x2E|\u3002|\uFF0E|\uFF61/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=x-C,P=Math.floor,R=String.fromCharCode;if(g={version:"1.2.1",ucs2:{decode:r,encode:u},decode:l,encode:d,toASCII:a,toUnicode:s},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return g});else if(p&&!p.nodeType)if(h)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else o.punycode=g})(this); |
|
Loading…
Reference in new issue