jquery-inputmask-rails 2.0.1 → 2.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,128 +1,7 @@
1
- /*
2
- Input Mask plugin extensions
3
- http://github.com/RobinHerbots/jquery.inputmask
4
- Copyright (c) 2010 - 2012 Robin Herbots
5
- Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6
- Version: 1.3.3a
7
-
8
- Optional extensions on the jquery.inputmask base
9
- */
10
- (function ($) {
11
- //number aliases
12
- $.extend($.inputmask.defaults.aliases, {
13
- 'decimal': {
14
- mask: "~",
15
- placeholder: "",
16
- repeat: 10,
17
- greedy: false,
18
- numericInput: true,
19
- digits: "*", //numer of digits
20
- groupSeparator: ",", // | "."
21
- groupSize: 3,
22
- autoGroup: false,
23
- regex: {
24
- number: function (groupSeparator, groupSize, radixPoint, digits) {
25
- var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, groupSeparator);
26
- var escapedRadixPoint = $.inputmask.escapeRegex.call(this, radixPoint);
27
- var digitExpression = isNaN(digits) ? digits : '{0,' + digits + '}';
28
- return new RegExp("^[\+-]?(\\d+|\\d{1," + groupSize + "}((" + escapedGroupSeparator + "\\d{" + groupSize + "})?)+)(" + escapedRadixPoint + "\\d" + digitExpression + ")?$");
29
- }
30
- },
31
- onKeyDown: function (e, opts) {
32
- var $input = $(this), input = this;
33
- if (e.keyCode == opts.keyCode.TAB) {
34
- var nptStr = input._valueGet();
35
- var radixPosition = nptStr.indexOf(opts.radixPoint);
36
- if (radixPosition != -1) {
37
- for (var i = 1; i < opts.digits; i++) {
38
- if (nptStr[radixPosition + i]) nptStr = nptStr + "0";
39
- }
40
- if (nptStr !== $input.val()) {
41
- $input.val(nptStr);
42
- }
43
- }
44
- }
45
- },
46
- definitions: {
47
- '~': { //real number
48
- validator: function (chrs, buffer, pos, strict, opts) {
49
- if (chrs == "") return false;
50
- var cbuf = strict ? buffer.slice(0, pos) : buffer.slice();
51
- cbuf.splice(pos, 0, chrs);
52
- var bufferStr = cbuf.join('');
53
- if (opts.autoGroup) //strip groupseparator
54
- bufferStr = bufferStr.replace(new RegExp("\\" + opts.groupSeparator, "g"), '');
55
- var isValid = opts.regex.number(opts.groupSeparator, opts.groupSize, opts.radixPoint, opts.digits).test(bufferStr);
56
- if (!isValid) {
57
- //let's help the regex a bit
58
- bufferStr += "0";
59
- isValid = opts.regex.number(opts.groupSeparator, opts.groupSize, opts.radixPoint, opts.digits).test(bufferStr);
60
- if (!isValid) {
61
- //make a valid group
62
- var lastGroupSeparator = bufferStr.lastIndexOf(opts.groupSeparator);
63
- for (i = bufferStr.length - lastGroupSeparator; i <= 3; i++) {
64
- bufferStr += "0";
65
- }
66
-
67
- isValid = opts.regex.number(opts.groupSeparator, opts.groupSize, opts.radixPoint, opts.digits).test(bufferStr);
68
- if (!isValid && !strict) {
69
- if (chrs == opts.radixPoint) {
70
- isValid = opts.regex.number(opts.groupSeparator, opts.groupSize, opts.radixPoint, opts.digits).test("0" + bufferStr + "0");
71
- if (isValid) {
72
- buffer[pos] = "0";
73
- pos++;
74
- return { "pos": pos };
75
- }
76
- }
77
- }
78
- }
79
- }
80
-
81
- if (isValid != false && !strict) {
82
- var cbuf = buffer.slice();
83
- cbuf.splice(pos, 0, "?"); //set position indicator
84
- var bufVal = cbuf.join('');
85
- if (opts.autoGroup || bufVal.indexOf(opts.groupSeparator) != -1) {
86
- bufVal = bufVal.replace(new RegExp("\\" + opts.groupSeparator, "g"), '');
87
- var reg = new RegExp('(-?[\\d?]+)([\\d?]{' + opts.groupSize + '})');
88
- while (reg.test(bufVal)) {
89
- bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2');
90
- }
91
- }
92
- buffer.length = bufVal.length; //align the length
93
- for (var i = 0, l = bufVal.length; i < l; i++) {
94
- buffer[i] = bufVal.charAt(i);
95
- }
96
- var newPos = buffer.indexOf("?");
97
- buffer.splice(newPos, 1);
98
-
99
- return { "pos": newPos };
100
- }
101
- return isValid;
102
- },
103
- cardinality: 1,
104
- prevalidator: null
105
- }
106
- },
107
- insertMode: true,
108
- autoUnmask: false
109
- },
110
- 'non-negative-decimal': {
111
- regex: {
112
- number: function (groupSeparator, groupSize, radixPoint, digits) {
113
- var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, groupSeparator);
114
- var escapedRadixPoint = $.inputmask.escapeRegex.call(this, radixPoint);
115
- var digitExpression = isNaN(digits) ? digits : '{0,' + digits + '}'
116
- return new RegExp("^[\+]?(\\d+|\\d{1," + groupSize + "}((" + escapedGroupSeparator + "\\d{" + groupSize + "})?)+)(" + escapedRadixPoint + "\\d" + digitExpression + ")?$");
117
- }
118
- },
119
- alias: "decimal"
120
- },
121
- 'integer': {
122
- regex: {
123
- number: function (groupSeparator, groupSize) { return new RegExp("^([\+\-]?\\d*)$"); }
124
- },
125
- alias: "decimal"
126
- }
127
- });
128
- })(jQuery);
1
+ (function(k){k.extend(k.inputmask.defaults.aliases,{decimal:{mask:"~",placeholder:"",repeat:"*",greedy:!1,numericInput:!1,isNumeric:!0,digits:"*",groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"*",defaultValue:"",prefix:"",suffix:"",getMaskLength:function(a,e,d,c,b){var f=a.length;e||("*"==d?f=c.length+1:1<d&&(f+=a.length*(d-1)));a=k.inputmask.escapeRegex.call(this,b.groupSeparator);b=k.inputmask.escapeRegex.call(this,b.radixPoint);c=c.join("");
2
+ b=c.replace(RegExp(a,"g"),"").replace(RegExp(b),"");return f+(c.length-b.length)},postFormat:function(a,e,d,c){if(""==c.groupSeparator)return e;var b=a.slice();k.inArray(c.radixPoint,a);d||b.splice(e,0,"?");b=b.join("");if(c.autoGroup||d&&-1!=b.indexOf(c.groupSeparator)){for(var f=k.inputmask.escapeRegex.call(this,c.groupSeparator),b=b.replace(RegExp(f,"g"),""),f=b.split(c.radixPoint),b=f[0],g=RegExp("([-+]?[\\d?]+)([\\d?]{"+c.groupSize+"})");g.test(b);)b=b.replace(g,"$1"+c.groupSeparator+"$2"),b=
3
+ b.replace(c.groupSeparator+c.groupSeparator,c.groupSeparator);1<f.length&&(b+=c.radixPoint+f[1])}a.length=b.length;c=0;for(f=b.length;c<f;c++)a[c]=b.charAt(c);b=k.inArray("?",a);d||a.splice(b,1);return d?e:b},regex:{number:function(a){var e=k.inputmask.escapeRegex.call(this,a.groupSeparator),d=k.inputmask.escapeRegex.call(this,a.radixPoint),c=isNaN(a.digits)?a.digits:"{0,"+a.digits+"}";return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+(a.allowMinus?"-":"")+"]?":"")+"(\\d+|\\d{1,"+
4
+ a.groupSize+"}(("+e+"\\d{"+a.groupSize+"})?)+)("+d+"\\d"+c+")?$")}},onKeyDown:function(a,e,d){var c=k(this);if(a.keyCode==d.keyCode.TAB){if(a=k.inArray(d.radixPoint,e),-1!=a){for(var b=c.data("_inputmask").masksets,c=c.data("_inputmask").activeMasksetIndex,f=1;f<=d.digits&&f<d.getMaskLength(b[c]._buffer,b[c].greedy,b[c].repeat,e,d);f++)if(void 0==e[a+f]||""==e[a+f])e[a+f]="0";this._valueSet(e.join(""))}}else if(a.keyCode==d.keyCode.DELETE||a.keyCode==d.keyCode.BACKSPACE)return d.postFormat(e,0,!0,
5
+ d),this._valueSet(e.join("")),!0},definitions:{"~":{validator:function(a,e,d,c,b){var f=k.extend({},b,{digits:c?"*":b.digits});if(""==a)return!1;if(!c&&1>=d&&"0"===e[0]&&/[\d-]/.test(a)&&1==e.join("").length)return e[0]="",{pos:0};var g=c?e.slice(0,d):e.slice();g.splice(d,0,a);var g=g.join(""),h=k.inputmask.escapeRegex.call(this,b.groupSeparator),g=g.replace(RegExp(h,"g"),"");c&&g.lastIndexOf(b.radixPoint)==g.length-1&&(h=k.inputmask.escapeRegex.call(this,b.radixPoint),g=g.replace(RegExp(h,"g"),""));
6
+ if(!c&&""==g)return!1;h=b.regex.number(f).test(g);if(!h&&(g+="0",h=b.regex.number(f).test(g),!h)){h=g.lastIndexOf(b.groupSeparator);for(h=g.length-h;3>=h;h++)g+="0";h=b.regex.number(f).test(g);if(!h&&!c&&a==b.radixPoint&&(h=b.regex.number(f).test("0"+g+"0")))return e[d]="0",d++,{pos:d}}return!1==h||c||a==b.radixPoint?h:{pos:b.postFormat(e,d,"-"==a||"+"==a?!0:!1,b)}},cardinality:1,prevalidator:null}},insertMode:!0,autoUnmask:!1},integer:{regex:{number:function(a){var e=k.inputmask.escapeRegex.call(this,
7
+ a.groupSeparator);return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+(a.allowMinus?"-":"")+"]?":"")+"(\\d+|\\d{1,"+a.groupSize+"}(("+e+"\\d{"+a.groupSize+"})?)+)$")}},alias:"decimal"}})})(jQuery);
@@ -0,0 +1 @@
1
+ (function(a){a.extend(a.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.json",mask:function(c){c.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var b=[];a.ajax({url:c.url,async:!1,dataType:"json",success:function(a){b=a}});b.splice(0,0,"+p(ppp)ppp-pppp");return b}}})})(jQuery);
@@ -0,0 +1,5 @@
1
+ (function(n){n.extend(n.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]+[^,]/,definitions:{r:{validator:function(l,p,n,r,h){function g(d,b){this.matches=[];this.isGroup=d||!1;this.isQuantifier=b||!1;this.quantifier=
2
+ {min:1,max:1};this.repeaterPart=void 0}function t(){var d=new g,b,a=[];for(h.regexTokens=[];b=h.tokenizer.exec(h.regex);)switch(b=b[0],b.charAt(0)){case "(":a.push(new g(!0));break;case ")":var e=a.pop();0<a.length?a[a.length-1].matches.push(e):d.matches.push(e);break;case "{":case "+":case "*":var c=new g(!1,!0);b=b.replace(/[{}]/g,"");e=b.split(",");b=isNaN(e[0])?e[0]:parseInt(e[0]);e=1==e.length?b:isNaN(e[1])?e[1]:parseInt(e[1]);c.quantifier={min:b,max:e};if(0<a.length){var f=a[a.length-1].matches;
3
+ b=f.pop();b.isGroup||(e=new g(!0),e.matches.push(b),b=e);f.push(b);f.push(c)}else b=d.matches.pop(),b.isGroup||(e=new g(!0),e.matches.push(b),b=e),d.matches.push(b),d.matches.push(c);break;default:0<a.length?a[a.length-1].matches.push(b):d.matches.push(b)}0<d.matches.length&&h.regexTokens.push(d)}function m(g,b){var a=!1;b&&(d+="(",q++);for(var e=0;e<g.matches.length;e++){var c=g.matches[e];if(!0==c.isGroup)a=m(c,!0);else if(!0==c.isQuantifier){var f=g.matches.indexOf(c),f=g.matches[f-1],h=d;if(isNaN(c.quantifier.max)){for(;c.repeaterPart&&
4
+ c.repeaterPart!=d&&c.repeaterPart.length>d.length&&!(a=m(f,!0)););(a=a||m(f,!0))&&(c.repeaterPart=d);d=h+c.quantifier.max}else{for(var k=0,l=c.quantifier.max-1;k<l&&!(a=m(f,!0));k++);d=h+"{"+c.quantifier.min+","+c.quantifier.max+"}"}}else if(void 0!=c.matches)for(f=0;f<c.length&&!(a=m(c[f],b));f++);else{if("["==c[0]){a=d;a+=c;for(k=0;k<q;k++)a+=")";a=RegExp("^("+a+")$");a=a.test(s)}else for(f=0,h=c.length;f<h;f++)if("\\"!=c[f]){a=d;a+=c.substr(0,f+1);a=a.replace(/\|$/,"");for(k=0;k<q;k++)a+=")";a=
5
+ RegExp("^("+a+")$");if(a=a.test(s))break}d+=c}if(a)break}b&&(d+=")",q--);return a}null==h.regexTokens&&t();r=p.slice();var d="";p=!1;var q=0;r.splice(n,0,l);var s=r.join("");for(l=0;l<h.regexTokens.length&&!(g=h.regexTokens[l],p=m(g,g.isGroup));l++);return p},cardinality:1}}}})})(jQuery);
metadata CHANGED
@@ -1,35 +1,25 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jquery-inputmask-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 1
10
- version: 2.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.5.5
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Marcos Nogueira
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-02-19 00:00:00 Z
11
+ date: 2014-03-10 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: An inputmask helps the user with the input by ensuring a predefined format. This can be usefull for dates, numerics, phone numbers...
22
- email:
13
+ description: An inputmask helps the user with the input by ensuring a predefined format.
14
+ This can be usefull for dates, numerics, phone numbers...
15
+ email:
23
16
  - marcosnogueiraalves@gmail.com
24
17
  executables: []
25
-
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
31
- - .DS_Store
32
- - .gitignore
20
+ files:
21
+ - ".DS_Store"
22
+ - ".gitignore"
33
23
  - Gemfile
34
24
  - README.md
35
25
  - Rakefile
@@ -39,42 +29,35 @@ files:
39
29
  - lib/jquery-inputmask-rails/version.rb
40
30
  - vendor/.DS_Store
41
31
  - vendor/assets/.DS_Store
32
+ - vendor/assets/javascripts/jquery.inputmask.bundle.js
33
+ - vendor/assets/javascripts/jquery.inputmask.bundle.min.js
42
34
  - vendor/assets/javascripts/jquery.inputmask.date.extensions.js
43
35
  - vendor/assets/javascripts/jquery.inputmask.extensions.js
44
36
  - vendor/assets/javascripts/jquery.inputmask.js
45
37
  - vendor/assets/javascripts/jquery.inputmask.numeric.extensions.js
38
+ - vendor/assets/javascripts/jquery.inputmask.phone.extensions.js
39
+ - vendor/assets/javascripts/jquery.inputmask.regex.extensions.js
46
40
  homepage: http://github.com/marcosnogueira/jquery-inputmask-rails
47
41
  licenses: []
48
-
42
+ metadata: {}
49
43
  post_install_message:
50
44
  rdoc_options: []
51
-
52
- require_paths:
45
+ require_paths:
53
46
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
57
49
  - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
- required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
- requirements:
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
66
54
  - - ">="
67
- - !ruby/object:Gem::Version
68
- hash: 3
69
- segments:
70
- - 0
71
- version: "0"
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
72
57
  requirements: []
73
-
74
58
  rubyforge_project: jquery-inputmask-rails
75
- rubygems_version: 1.8.10
59
+ rubygems_version: 2.2.2
76
60
  signing_key:
77
- specification_version: 3
61
+ specification_version: 4
78
62
  summary: Integrate the jQuery InputMask plugin into the Rails asset pipeline
79
63
  test_files: []
80
-