From 096a487c9dae5b74395efdec5740203317fb5fa4 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Mon, 27 Oct 2014 22:08:35 -0500
Subject: [PATCH 01/21] Moving nuspec
---
dist/jquery.maskedinput.nuspec => jquery.maskedinput.nuspec | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename dist/jquery.maskedinput.nuspec => jquery.maskedinput.nuspec (100%)
diff --git a/dist/jquery.maskedinput.nuspec b/jquery.maskedinput.nuspec
similarity index 100%
rename from dist/jquery.maskedinput.nuspec
rename to jquery.maskedinput.nuspec
From 305e9af609ee5bdd650d703fe53f0c093f77a4ee Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Mon, 27 Oct 2014 22:11:16 -0500
Subject: [PATCH 02/21] 1.4.0
---
README.md | 2 +-
bower.json | 2 +-
dist/jquery.maskedinput.js | 2 +-
dist/jquery.maskedinput.min.js | 2 +-
jquery.maskedinput.nuspec | 2 +-
maskedinput.jquery.json | 4 ++--
package.json | 2 +-
plugin.json | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 322c1f9..97c7745 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ By design, this plugin will reject input which doesn't complete the mask. You ca
Getting the bits
----------------
-We generally recommend that you use [bower](http://bower.io) to install jquery.maskedinput plugin, however you can download a copy of the latest release by clicking [this link right here.](https://github.com/digitalBush/jquery.maskedinput/archive/1.3.1.zip)
+We generally recommend that you use [bower](http://bower.io) to install jquery.maskedinput plugin.
$ bower install --save jquery.maskedinput
diff --git a/bower.json b/bower.json
index e8d3bcd..2c31c8b 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.maskedinput",
- "version": "1.3.1",
+ "version": "1.4.0",
"homepage": "http://digitalbush.com/projects/masked-input-plugin/",
"authors": [
"Josh Bush (digitalbush.com)"
diff --git a/dist/jquery.maskedinput.js b/dist/jquery.maskedinput.js
index 31f384e..fc70dc6 100644
--- a/dist/jquery.maskedinput.js
+++ b/dist/jquery.maskedinput.js
@@ -2,7 +2,7 @@
jQuery Masked Input Plugin
Copyright (c) 2007 - 2014 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
- Version: 1.3.1
+ Version: 1.4.0
*/
!function(factory) {
"function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
diff --git a/dist/jquery.maskedinput.min.js b/dist/jquery.maskedinput.min.js
index 98f08cc..cc2e9f2 100644
--- a/dist/jquery.maskedinput.min.js
+++ b/dist/jquery.maskedinput.min.js
@@ -2,6 +2,6 @@
jQuery Masked Input Plugin
Copyright (c) 2007 - 2014 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
- Version: 1.3.1
+ Version: 1.4.0
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(a.length0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a)},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
\ No newline at end of file
diff --git a/jquery.maskedinput.nuspec b/jquery.maskedinput.nuspec
index eb59bb1..d8cc7dd 100644
--- a/jquery.maskedinput.nuspec
+++ b/jquery.maskedinput.nuspec
@@ -2,7 +2,7 @@
jQuery.MaskedInput
- 1.3.1.0
+ 1.4.0.0
digitalBush
stimms
https://github.com/digitalBush/jquery.maskedinput/blob/master/LICENSE
diff --git a/maskedinput.jquery.json b/maskedinput.jquery.json
index c44ab46..0796252 100644
--- a/maskedinput.jquery.json
+++ b/maskedinput.jquery.json
@@ -3,7 +3,7 @@
"title": "jQuery Masked Input",
"description": "jQuery plugin for forcing fixed width inputs to follow a certain patern.",
"keywords": ["input", "form", "mask"],
- "version": "1.3.1",
+ "version": "1.4.0",
"author": {
"name": "Josh Bush",
"url": "http://digitalbush.com"
@@ -20,4 +20,4 @@
"dependencies": {
"jquery": ">=1.5"
}
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index 2f8f240..9684b7d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.maskedinput",
- "version": "1.3.1",
+ "version": "1.4.0",
"author": "Josh Bush (digitalbush.com)",
"description": "jQuery Masked Input Plugin",
diff --git a/plugin.json b/plugin.json
index e2aa63d..004a204 100644
--- a/plugin.json
+++ b/plugin.json
@@ -1,5 +1,5 @@
{
"name" : "jquery.maskedinput",
"author" : "Josh Bush (digitalbush.com)",
- "version" : "1.3.1"
+ "version" : "1.4.0"
}
From 91f5f63d8e47fe49f2b4033681d89db55deb1a8b Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Wed, 29 Oct 2014 21:17:14 -0500
Subject: [PATCH 03/21] Automating nuget packaging
---
gruntfile.js | 9 ++++++++-
jquery.maskedinput.nuspec | 4 ++++
package.json | 4 ++--
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/gruntfile.js b/gruntfile.js
index 5896f86..c207f87 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -43,12 +43,19 @@ module.exports = function( grunt ) {
]
}
}
+ },
+ nugetpack: {
+ dist: {
+ src: 'jquery.maskedinput.nuspec',
+ dest: 'dist/'
+ }
}
});
grunt.loadNpmTasks("grunt-contrib-jasmine");
grunt.loadNpmTasks("grunt-contrib-uglify");
+ grunt.loadNpmTasks('grunt-nuget');
grunt.registerTask('test', ['jasmine']);
- grunt.registerTask('default', ['test', 'uglify']);
+ grunt.registerTask('default', ['test', 'uglify', 'nugetpack']);
};
diff --git a/jquery.maskedinput.nuspec b/jquery.maskedinput.nuspec
index d8cc7dd..0271931 100644
--- a/jquery.maskedinput.nuspec
+++ b/jquery.maskedinput.nuspec
@@ -14,4 +14,8 @@
+
+
+
+
diff --git a/package.json b/package.json
index 9684b7d..8bd604c 100644
--- a/package.json
+++ b/package.json
@@ -3,12 +3,12 @@
"version": "1.4.0",
"author": "Josh Bush (digitalbush.com)",
"description": "jQuery Masked Input Plugin",
-
"devDependencies": {
"grunt": "0.4.x",
"grunt-contrib-jasmine": "0.5.x",
+ "grunt-contrib-uglify": "0.2.x",
"grunt-contrib-watch": "0.5.x",
- "grunt-contrib-uglify": "0.2.x"
+ "grunt-nuget": "^0.1.4"
},
"scripts": {
"test": "grunt test"
From 8c9007bf44b1849d7411d2b18b51fad0402cdef6 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Wed, 29 Oct 2014 21:30:23 -0500
Subject: [PATCH 04/21] Removing dist/
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We’ll only push `dist` folder on tagged commits.
Closes #265
---
.gitignore | 1 +
dist/jquery.maskedinput.js | 182 ---------------------------------
dist/jquery.maskedinput.min.js | 7 --
3 files changed, 1 insertion(+), 189 deletions(-)
delete mode 100644 dist/jquery.maskedinput.js
delete mode 100644 dist/jquery.maskedinput.min.js
diff --git a/.gitignore b/.gitignore
index ae2f59e..9bbba37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
node_modules/
bower_components/
+dist/
diff --git a/dist/jquery.maskedinput.js b/dist/jquery.maskedinput.js
deleted file mode 100644
index fc70dc6..0000000
--- a/dist/jquery.maskedinput.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- jQuery Masked Input Plugin
- Copyright (c) 2007 - 2014 Josh Bush (digitalbush.com)
- Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
- Version: 1.4.0
-*/
-!function(factory) {
- "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
-}(function($) {
- var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
- $.mask = {
- definitions: {
- "9": "[0-9]",
- a: "[A-Za-z]",
- "*": "[A-Za-z0-9]"
- },
- autoclear: !0,
- dataName: "rawMaskFn",
- placeholder: "_"
- }, $.fn.extend({
- caret: function(begin, end) {
- var range;
- if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin,
- this.each(function() {
- this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(),
- range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
- range.select());
- })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
- begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
- {
- begin: begin,
- end: end
- });
- },
- unmask: function() {
- return this.trigger("unmask");
- },
- mask: function(mask, settings) {
- var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal;
- if (!mask && this.length > 0) {
- input = $(this[0]);
- var fn = input.data($.mask.dataName);
- return fn ? fn() : void 0;
- }
- return settings = $.extend({
- autoclear: $.mask.autoclear,
- placeholder: $.mask.placeholder,
- completed: null
- }, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length,
- firstNonMaskPos = null, $.each(mask.split(""), function(i, c) {
- "?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])),
- null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null);
- }), this.trigger("unmask").each(function() {
- function tryFireCompleted() {
- if (settings.completed) {
- for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return;
- settings.completed.call(input);
- }
- }
- function getPlaceholder(i) {
- return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0);
- }
- function seekNext(pos) {
- for (;++pos < len && !tests[pos]; ) ;
- return pos;
- }
- function seekPrev(pos) {
- for (;--pos >= 0 && !tests[pos]; ) ;
- return pos;
- }
- function shiftL(begin, end) {
- var i, j;
- if (!(0 > begin)) {
- for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) {
- if (!(len > j && tests[i].test(buffer[j]))) break;
- buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j);
- }
- writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin));
- }
- }
- function shiftR(pos) {
- var i, c, j, t;
- for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) {
- if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break;
- c = t;
- }
- }
- function androidInputEvent() {
- var curVal = input.val(), pos = input.caret();
- if (curVal.length < oldVal.length) {
- for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--;
- if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++;
- input.caret(pos.begin, pos.begin);
- } else {
- for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++;
- input.caret(pos.begin, pos.begin);
- }
- tryFireCompleted();
- }
- function blurEvent() {
- checkVal(), input.val() != focusText && input.change();
- }
- function keydownEvent(e) {
- if (!input.prop("readonly")) {
- var pos, begin, end, k = e.which || e.keyCode;
- oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(),
- begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1),
- end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1),
- e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText),
- input.caret(0, checkVal()), e.preventDefault());
- }
- }
- function keypressEvent(e) {
- if (!input.prop("readonly")) {
- var p, c, next, k = e.which || e.keyCode, pos = input.caret();
- if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) {
- if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)),
- p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) {
- if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) {
- var proxy = function() {
- $.proxy($.fn.caret, input, next)();
- };
- setTimeout(proxy, 0);
- } else input.caret(next);
- pos.begin <= lastRequiredNonMaskPos && tryFireCompleted();
- }
- e.preventDefault();
- }
- }
- }
- function clearBuffer(start, end) {
- var i;
- for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i));
- }
- function writeBuffer() {
- input.val(buffer.join(""));
- }
- function checkVal(allow) {
- var i, c, pos, test = input.val(), lastMatch = -1;
- for (i = 0, pos = 0; len > i; i++) if (tests[i]) {
- for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1),
- tests[i].test(c)) {
- buffer[i] = c, lastMatch = i;
- break;
- }
- if (pos > test.length) {
- clearBuffer(i + 1, len);
- break;
- }
- } else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i);
- return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""),
- clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))),
- partialPosition ? i : firstNonMaskPos;
- }
- var input = $(this), buffer = $.map(mask.split(""), function(c, i) {
- return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0;
- }), defaultBuffer = buffer.join(""), focusText = input.val();
- input.data($.mask.dataName, function() {
- return $.map(buffer, function(c, i) {
- return tests[i] && c != getPlaceholder(i) ? c : null;
- }).join("");
- }), input.one("unmask", function() {
- input.off(".mask").removeData($.mask.dataName);
- }).on("focus.mask", function() {
- if (!input.prop("readonly")) {
- clearTimeout(caretTimeoutId);
- var pos;
- focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() {
- writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos);
- }, 10);
- }
- }).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() {
- input.prop("readonly") || setTimeout(function() {
- var pos = checkVal(!0);
- input.caret(pos), tryFireCompleted();
- }, 0);
- }), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent),
- checkVal();
- });
- }
- });
-});
\ No newline at end of file
diff --git a/dist/jquery.maskedinput.min.js b/dist/jquery.maskedinput.min.js
deleted file mode 100644
index cc2e9f2..0000000
--- a/dist/jquery.maskedinput.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- jQuery Masked Input Plugin
- Copyright (c) 2007 - 2014 Josh Bush (digitalbush.com)
- Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
- Version: 1.4.0
-*/
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(a.length0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a)},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
\ No newline at end of file
From 9cea0d0f1cc89775d54a8b00bb750965ea75671a Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Wed, 29 Oct 2014 21:33:10 -0500
Subject: [PATCH 05/21] Removing unnecessary json files.
Closes #264
---
maskedinput.jquery.json | 23 -----------------------
plugin.json | 5 -----
2 files changed, 28 deletions(-)
delete mode 100644 maskedinput.jquery.json
delete mode 100644 plugin.json
diff --git a/maskedinput.jquery.json b/maskedinput.jquery.json
deleted file mode 100644
index 0796252..0000000
--- a/maskedinput.jquery.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "maskedinput",
- "title": "jQuery Masked Input",
- "description": "jQuery plugin for forcing fixed width inputs to follow a certain patern.",
- "keywords": ["input", "form", "mask"],
- "version": "1.4.0",
- "author": {
- "name": "Josh Bush",
- "url": "http://digitalbush.com"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "https://raw.github.com/digitalBush/jquery.maskedinput/master/LICENSE"
- }
- ],
- "bugs": "https://github.com/digitalBush/jquery.maskedinput/issues",
- "homepage": "http://digitalbush.com/projects/masked-input-plugin/",
- "docs": "http://digitalbush.com/projects/masked-input-plugin/#usage",
- "dependencies": {
- "jquery": ">=1.5"
- }
-}
diff --git a/plugin.json b/plugin.json
deleted file mode 100644
index 004a204..0000000
--- a/plugin.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name" : "jquery.maskedinput",
- "author" : "Josh Bush (digitalbush.com)",
- "version" : "1.4.0"
-}
From 3e9ed59f34f003c0139f5f3b0052e24ec1654b71 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Sun, 2 Nov 2014 19:45:58 -0600
Subject: [PATCH 06/21] Adding contribution guidelines.
Closes #266
---
CONTRIBUTING.md | 127 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 CONTRIBUTING.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..9e4605b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,127 @@
+# Contributing
+
+Please take a moment to review this document in order to make the contribution
+process easy and effective for everyone involved!
+
+## Using the issue tracker
+
+The issue tracker is for:
+* [Bug Reports](#bug-reports)
+* [Feature Requests](#feature-requests)
+* [Submitting Pull Requests](#pull-requests)
+
+Please **do not** use the issue tracker for personal support requests.
+
+## Bug Reports
+
+A bug is a _demonstrable problem_ that is caused by the code in the repository.
+
+Guidelines for bug reports:
+
+1. **Use the GitHub issue search** — check if the issue has already been
+ reported.
+
+2. **Check if the issue has been fixed** — try to reproduce it using the
+ `master` branch in the repository.
+
+3. **Isolate and report the problem** — ideally create a reduced test
+ case or a small [jsfiddle](http://jsfiddle.net) showing the issue.
+
+Please try to be as detailed as possible in your report. Include information about
+your operating system, browser, jQuery version, and masked input plugin version.
+Please provide steps to reproduce the issue as well as the outcome you were expecting.
+
+## Feature Requests
+
+Feature requests are welcome. It's up to *you* to make a strong case of the merits of
+this feature. Please provide as much detail and context as possible.
+
+Features that have a very narrow use case are unlikely to be accepted unless we
+can come up with a way to come to a more general solution. Please don't let
+that stop you from sharing your ideas, just keep that in mind.
+
+## Pull Requests
+
+Good pull requests are very helpful. They should remain focused
+in scope and avoid containing unrelated commits.
+
+**IMPORTANT**: By submitting a patch, you agree that your work will be
+licensed under the license used by the project.
+
+If you have any large pull request in mind (e.g. implementing features,
+refactoring code, etc), **please ask first** otherwise you risk spending
+a lot of time working on something that the project's developers might
+not want to merge into the project.
+
+Please adhere to the coding conventions in the project (indentation,
+accurate comments, etc.) and don't forget to add your own tests and
+documentation. When working with git, we recommend the following process
+in order to craft an excellent pull request:
+
+1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
+ and configure the remotes:
+
+ ```bash
+ # Clone your fork of the repo into the current directory
+ git clone https://github.com//jquery.maskedinput
+ # Navigate to the newly cloned directory
+ cd jquery.maskedinput
+ # Assign the original repo to a remote called "upstream"
+ git remote add upstream https://github.com/digitalBush/jquery.maskedinput
+ ```
+
+2. If you cloned a while ago, get the latest changes from upstream:
+
+ ```bash
+ git checkout master
+ git pull upstream master
+ ```
+
+3. Create a new topic branch (off of `master`) to contain your feature, change,
+ or fix.
+
+ **IMPORTANT**: Making changes in `master` is discouraged. You should always
+ keep your local `master` in sync with upstream `master` and make your
+ changes in topic branches.
+
+ ```bash
+ git checkout -b
+ ```
+
+4. Commit your changes in logical chunks. Keep your commit messages organized,
+ with a short description in the first line and more detailed information on
+ the following lines.
+
+ Please use git's
+ [interactive rebase](https://help.github.com/articles/interactive-rebase)
+ feature to tidy up your commits before making them public. Ideally when you
+ are finished you'll have a single commit.
+
+5. Make sure all the tests are still passing.
+
+ ```bash
+ npm test
+ ```
+
+6. Push your topic branch up to your fork:
+
+ ```bash
+ git push origin
+ ```
+
+7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
+ with a clear title and description.
+
+8. If you haven't updated your pull request for a while, you should consider
+ rebasing on master and resolving any conflicts.
+
+ **IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
+ should always `git rebase` on `master` to bring your changes up to date when
+ necessary.
+
+ ```bash
+ git checkout master
+ git pull upstream master
+ git checkout
+ git rebase master
+ ```
From 6efbf8a84eb4dc96421a0662d5a8b53c311a65b8 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Sun, 2 Nov 2014 19:47:31 -0600
Subject: [PATCH 07/21] Adding separate task for nuget packaging.
---
gruntfile.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gruntfile.js b/gruntfile.js
index c207f87..5b22eac 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -57,5 +57,6 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks('grunt-nuget');
grunt.registerTask('test', ['jasmine']);
- grunt.registerTask('default', ['test', 'uglify', 'nugetpack']);
+ grunt.registerTask('pack', ['default','nugetpack']);
+ grunt.registerTask('default', ['test', 'uglify']);
};
From f80b31e33b79a30d1be2d1d2bfba8f1a6248bc03 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Wed, 5 Nov 2014 21:43:49 -0600
Subject: [PATCH 08/21] Handle case where focus is quickly removed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Couldn’t use `:focus` because of some issues with phantomjs. :(
Closes #232
---
src/jquery.maskedinput.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 7ff6b16..9b38bd9 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -398,6 +398,9 @@ $.fn.extend({
pos = checkVal();
caretTimeoutId = setTimeout(function(){
+ if(input.get(0) !== document.activeElement){
+ return;
+ }
writeBuffer();
if (pos == mask.replace("?","").length) {
input.caret(0, pos);
From ba41c9525d205b16df891a144102fd65f8ddba7e Mon Sep 17 00:00:00 2001
From: stevemao
Date: Fri, 12 Dec 2014 10:48:15 +1100
Subject: [PATCH 09/21] Adding main field to bower.json
Tools like wiredep can inject the script automatically
---
bower.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/bower.json b/bower.json
index 2c31c8b..6f0399b 100644
--- a/bower.json
+++ b/bower.json
@@ -6,6 +6,7 @@
"Josh Bush (digitalbush.com)"
],
"description": "jQuery Masked Input Plugin",
+ "main": "./dist/jquery.maskedinput.js",
"moduleType": [
"es6"
],
From 4d544207cc4cb443b258c72f4a5804fbe21de0da Mon Sep 17 00:00:00 2001
From: mark van tilburg
Date: Tue, 13 Jan 2015 13:35:49 +0100
Subject: [PATCH 10/21] Update LICENSE
..2015
---
LICENSE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index d66f9f9..e6114e8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2014 Josh Bush (digitalbush.com)
+Copyright (c) 2007-2015 Josh Bush (digitalbush.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
From 1a2e98642bcd34ca90498120c597e8777ce9240e Mon Sep 17 00:00:00 2001
From: Danny Ouellet
Date: Fri, 23 Jan 2015 11:21:22 -0500
Subject: [PATCH 11/21] Correcting javascript path on demo
---
demo/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/demo/index.html b/demo/index.html
index eafcc82..9788fc2 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -2,7 +2,7 @@
jQuery Mask Test
-
+
$(function() {
$.mask.definitions['~'] = "[+-]";
From 9333fdce00ec2422b1a0a5aa8872f5a99b7b6033 Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Sat, 31 Jan 2015 20:32:04 -0600
Subject: [PATCH 12/21] Removing upper jQuery limit.
Closes #291
---
bower.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bower.json b/bower.json
index 6f0399b..346209a 100644
--- a/bower.json
+++ b/bower.json
@@ -25,6 +25,6 @@
"lib"
],
"dependencies": {
- "jquery": ">=1.8.3 <2.0"
+ "jquery": ">=1.8.3"
}
}
From 24c3bfaec10c043b408f4f2bc94e5926c0059927 Mon Sep 17 00:00:00 2001
From: Dimitrios Kanellopoulos
Date: Mon, 9 Feb 2015 23:50:02 +0100
Subject: [PATCH 13/21] Fix oldVal not beeing set
---
src/jquery.maskedinput.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 9b38bd9..8adcc4f 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -199,7 +199,7 @@ $.fn.extend({
function androidInputEvent(e) {
var curVal = input.val();
var pos = input.caret();
- if (curVal.length < oldVal.length) {
+ if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
// a deletion or backspace happened
checkVal(true);
while (pos.begin > 0 && !tests[pos.begin-1])
From f19728180c604c1b0c62d6aa97af262c0c04d71c Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Tue, 10 Feb 2015 21:17:34 -0600
Subject: [PATCH 14/21] 1.4.1
---
bower.json | 2 +-
dist/jquery.maskedinput.js | 182 +++++++++++++++++++++++++++++++++
dist/jquery.maskedinput.min.js | 7 ++
jquery.maskedinput.nuspec | 2 +-
package.json | 2 +-
5 files changed, 192 insertions(+), 3 deletions(-)
create mode 100644 dist/jquery.maskedinput.js
create mode 100644 dist/jquery.maskedinput.min.js
diff --git a/bower.json b/bower.json
index 346209a..63e7ab7 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.maskedinput",
- "version": "1.4.0",
+ "version": "1.4.1",
"homepage": "http://digitalbush.com/projects/masked-input-plugin/",
"authors": [
"Josh Bush (digitalbush.com)"
diff --git a/dist/jquery.maskedinput.js b/dist/jquery.maskedinput.js
new file mode 100644
index 0000000..4ac3cfc
--- /dev/null
+++ b/dist/jquery.maskedinput.js
@@ -0,0 +1,182 @@
+/*
+ jQuery Masked Input Plugin
+ Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
+ Version: 1.4.1
+*/
+!function(factory) {
+ "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
+}(function($) {
+ var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
+ $.mask = {
+ definitions: {
+ "9": "[0-9]",
+ a: "[A-Za-z]",
+ "*": "[A-Za-z0-9]"
+ },
+ autoclear: !0,
+ dataName: "rawMaskFn",
+ placeholder: "_"
+ }, $.fn.extend({
+ caret: function(begin, end) {
+ var range;
+ if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin,
+ this.each(function() {
+ this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(),
+ range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
+ range.select());
+ })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
+ begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
+ {
+ begin: begin,
+ end: end
+ });
+ },
+ unmask: function() {
+ return this.trigger("unmask");
+ },
+ mask: function(mask, settings) {
+ var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal;
+ if (!mask && this.length > 0) {
+ input = $(this[0]);
+ var fn = input.data($.mask.dataName);
+ return fn ? fn() : void 0;
+ }
+ return settings = $.extend({
+ autoclear: $.mask.autoclear,
+ placeholder: $.mask.placeholder,
+ completed: null
+ }, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length,
+ firstNonMaskPos = null, $.each(mask.split(""), function(i, c) {
+ "?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])),
+ null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null);
+ }), this.trigger("unmask").each(function() {
+ function tryFireCompleted() {
+ if (settings.completed) {
+ for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return;
+ settings.completed.call(input);
+ }
+ }
+ function getPlaceholder(i) {
+ return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0);
+ }
+ function seekNext(pos) {
+ for (;++pos < len && !tests[pos]; ) ;
+ return pos;
+ }
+ function seekPrev(pos) {
+ for (;--pos >= 0 && !tests[pos]; ) ;
+ return pos;
+ }
+ function shiftL(begin, end) {
+ var i, j;
+ if (!(0 > begin)) {
+ for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) {
+ if (!(len > j && tests[i].test(buffer[j]))) break;
+ buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j);
+ }
+ writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin));
+ }
+ }
+ function shiftR(pos) {
+ var i, c, j, t;
+ for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) {
+ if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break;
+ c = t;
+ }
+ }
+ function androidInputEvent() {
+ var curVal = input.val(), pos = input.caret();
+ if (oldVal && oldVal.length && oldVal.length > curVal.length) {
+ for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--;
+ if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++;
+ input.caret(pos.begin, pos.begin);
+ } else {
+ for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++;
+ input.caret(pos.begin, pos.begin);
+ }
+ tryFireCompleted();
+ }
+ function blurEvent() {
+ checkVal(), input.val() != focusText && input.change();
+ }
+ function keydownEvent(e) {
+ if (!input.prop("readonly")) {
+ var pos, begin, end, k = e.which || e.keyCode;
+ oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(),
+ begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1),
+ end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1),
+ e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText),
+ input.caret(0, checkVal()), e.preventDefault());
+ }
+ }
+ function keypressEvent(e) {
+ if (!input.prop("readonly")) {
+ var p, c, next, k = e.which || e.keyCode, pos = input.caret();
+ if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) {
+ if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)),
+ p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) {
+ if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) {
+ var proxy = function() {
+ $.proxy($.fn.caret, input, next)();
+ };
+ setTimeout(proxy, 0);
+ } else input.caret(next);
+ pos.begin <= lastRequiredNonMaskPos && tryFireCompleted();
+ }
+ e.preventDefault();
+ }
+ }
+ }
+ function clearBuffer(start, end) {
+ var i;
+ for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i));
+ }
+ function writeBuffer() {
+ input.val(buffer.join(""));
+ }
+ function checkVal(allow) {
+ var i, c, pos, test = input.val(), lastMatch = -1;
+ for (i = 0, pos = 0; len > i; i++) if (tests[i]) {
+ for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1),
+ tests[i].test(c)) {
+ buffer[i] = c, lastMatch = i;
+ break;
+ }
+ if (pos > test.length) {
+ clearBuffer(i + 1, len);
+ break;
+ }
+ } else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i);
+ return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""),
+ clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))),
+ partialPosition ? i : firstNonMaskPos;
+ }
+ var input = $(this), buffer = $.map(mask.split(""), function(c, i) {
+ return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0;
+ }), defaultBuffer = buffer.join(""), focusText = input.val();
+ input.data($.mask.dataName, function() {
+ return $.map(buffer, function(c, i) {
+ return tests[i] && c != getPlaceholder(i) ? c : null;
+ }).join("");
+ }), input.one("unmask", function() {
+ input.off(".mask").removeData($.mask.dataName);
+ }).on("focus.mask", function() {
+ if (!input.prop("readonly")) {
+ clearTimeout(caretTimeoutId);
+ var pos;
+ focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() {
+ input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos));
+ }, 10);
+ }
+ }).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() {
+ input.prop("readonly") || setTimeout(function() {
+ var pos = checkVal(!0);
+ input.caret(pos), tryFireCompleted();
+ }, 0);
+ }), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent),
+ checkVal();
+ });
+ }
+ });
+});
\ No newline at end of file
diff --git a/dist/jquery.maskedinput.min.js b/dist/jquery.maskedinput.min.js
new file mode 100644
index 0000000..d4dfd01
--- /dev/null
+++ b/dist/jquery.maskedinput.min.js
@@ -0,0 +1,7 @@
+/*
+ jQuery Masked Input Plugin
+ Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
+ Version: 1.4.1
+*/
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
\ No newline at end of file
diff --git a/jquery.maskedinput.nuspec b/jquery.maskedinput.nuspec
index 0271931..9e88140 100644
--- a/jquery.maskedinput.nuspec
+++ b/jquery.maskedinput.nuspec
@@ -2,7 +2,7 @@
jQuery.MaskedInput
- 1.4.0.0
+ 1.4.1.0
digitalBush
stimms
https://github.com/digitalBush/jquery.maskedinput/blob/master/LICENSE
diff --git a/package.json b/package.json
index 8bd604c..8c65c9b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.maskedinput",
- "version": "1.4.0",
+ "version": "1.4.1",
"author": "Josh Bush (digitalbush.com)",
"description": "jQuery Masked Input Plugin",
"devDependencies": {
From 0d017f402fefac2dae427654f9ba74b23d2b93a3 Mon Sep 17 00:00:00 2001
From: Ben Cooley
Date: Mon, 11 May 2015 10:39:55 -0400
Subject: [PATCH 15/21] Ensuring caret does not execute if the element does not
have focus. This fixes an issue in IE11 where the user may not be able to
move to another input element
---
src/jquery.maskedinput.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 8adcc4f..ee6d1ab 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -34,7 +34,7 @@ $.fn.extend({
caret: function(begin, end) {
var range;
- if (this.length === 0 || this.is(":hidden")) {
+ if (this.length === 0 || this.is(":hidden") || this.get(0) !== document.activeElement) {
return;
}
From 7ae3485fccf9b408f81b4f7f0645a6b74dbe66b8 Mon Sep 17 00:00:00 2001
From: Mike Bobrov
Date: Tue, 12 May 2015 11:10:55 +0300
Subject: [PATCH 16/21] A little update to the documentation
Of course it can be easily found from the source code, but it would be very convenient to see it in the documentation
---
README.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/README.md b/README.md
index 97c7745..825533a 100644
--- a/README.md
+++ b/README.md
@@ -44,6 +44,13 @@ jQuery(function($){
});
```
+Optionally, if you would like to disable the automatic discarding of the uncomplete input, you may pass an optional argument to the maskedinput method
+```html
+jQuery(function($){
+ $("#product").mask("99/99/9999",{autoclear: false});
+});
+```
+
You can now supply your own mask definitions.
```html
jQuery(function($){
From b21979c52c3146cc3e9e33f8d93ee8e49e1f8617 Mon Sep 17 00:00:00 2001
From: Allan Maia Fernandes
Date: Mon, 18 May 2015 16:07:48 -0300
Subject: [PATCH 17/21] Forcing mask to string
This code:
$('[data-masked]').each(function() {
$(this).mask($(this).data('masked'));
});
Will give an error, when data-masked="99999" ... the $(this).data returns a number object, not string.
---
src/jquery.maskedinput.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 8adcc4f..9106d5e 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -94,6 +94,8 @@ $.fn.extend({
partialPosition = len = mask.length;
firstNonMaskPos = null;
+ mask = String(mask);
+
$.each(mask.split(""), function(i, c) {
if (c == '?') {
len--;
From 89aa9d33d41f2cbcc27ab6afe3c8c9fa4d5df99a Mon Sep 17 00:00:00 2001
From: Matt Sich
Date: Thu, 11 Jun 2015 11:48:47 -0400
Subject: [PATCH 18/21] fixed android issue where cursor would not move and
input would be typed backwards
---
src/jquery.maskedinput.js | 59 +++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 8adcc4f..64f961d 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -196,32 +196,43 @@ $.fn.extend({
}
}
- function androidInputEvent(e) {
- var curVal = input.val();
- var pos = input.caret();
- if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
- // a deletion or backspace happened
- checkVal(true);
- while (pos.begin > 0 && !tests[pos.begin-1])
- pos.begin--;
- if (pos.begin === 0)
- {
- while (pos.begin < firstNonMaskPos && !tests[pos.begin])
- pos.begin++;
- }
- input.caret(pos.begin,pos.begin);
- } else {
- var pos2 = checkVal(true);
- while (pos.begin < len && !tests[pos.begin])
- pos.begin++;
-
- input.caret(pos.begin,pos.begin);
- }
+ function androidInputEvent(e) {
+ console.log(input);
+ var curVal = input.val();
+ var pos = input.caret();
+ if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
+ // a deletion or backspace happened
+ checkVal(true);
+ while (pos.begin > 0 && !tests[pos.begin-1])
+ pos.begin--;
+ if (pos.begin === 0)
+ {
+ while (pos.begin < firstNonMaskPos && !tests[pos.begin])
+ pos.begin++;
+ }
+ input.caret(pos.begin,pos.begin);
+ } else {
+ var pos2 = checkVal(true);
+ var lastEnteredValue = curVal.charAt(pos.begin);
+ if (pos.begin < len){
+ if(!tests[pos.begin]){
+ pos.begin++;
+ if(tests[pos.begin].test(lastEnteredValue)){
+ pos.begin++;
+ }
+ }else{
+ if(tests[pos.begin].test(lastEnteredValue)){
+ pos.begin++;
+ }
+ }
+ }
+ input.caret(pos.begin,pos.begin);
+ }
+ tryFireCompleted();
+ }
- tryFireCompleted();
- }
- function blurEvent(e) {
+ function blurEvent(e) {
checkVal();
if (input.val() != focusText)
From e0708d76794a26b2516dc615cc0b7307001172f2 Mon Sep 17 00:00:00 2001
From: Kevin Kirsche
Date: Thu, 11 Jun 2015 22:53:23 -0400
Subject: [PATCH 19/21] Remove moot `version` property from bower.json
Per bower/bower.json-spec@a325da3
Also their maintainer says they probably won't ever use it: http://stackoverflow.com/questions/24844901/bowers-bower-json-file-version-property
---
bower.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/bower.json b/bower.json
index 63e7ab7..e6368cb 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,5 @@
{
"name": "jquery.maskedinput",
- "version": "1.4.1",
"homepage": "http://digitalbush.com/projects/masked-input-plugin/",
"authors": [
"Josh Bush (digitalbush.com)"
From 2d5e1e2827aeed48c4fd6a680191e8b89e94c4b1 Mon Sep 17 00:00:00 2001
From: MattSich
Date: Thu, 18 Jun 2015 20:58:57 -0400
Subject: [PATCH 20/21] Update jquery.maskedinput.js
Removed log
---
src/jquery.maskedinput.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js
index 64f961d..df85c09 100644
--- a/src/jquery.maskedinput.js
+++ b/src/jquery.maskedinput.js
@@ -197,7 +197,6 @@ $.fn.extend({
}
function androidInputEvent(e) {
- console.log(input);
var curVal = input.val();
var pos = input.caret();
if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
From 4a146e61b83e756446ce17f67f934abd644dafbb Mon Sep 17 00:00:00 2001
From: Josh Bush
Date: Sun, 10 Dec 2017 13:57:16 -0600
Subject: [PATCH 21/21] =?UTF-8?q?=F0=9F=91=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 825533a..87889b9 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,12 @@
Masked Input Plugin for jQuery
==============================
-[](https://travis-ci.org/digitalBush/jquery.maskedinput)
+**Notice: This project is no longer being maintained.**
+
+I started this project [over 10 years ago](https://forum.jquery.com/topic/jquery-introduction-and-masked-input-plugin) to fill a need for a side project I was working on at the time. Nothing ever became of that side project, but this little plugin lived on. Over the years it brought me joy to stumble on sites using this thing. It was super encouraging to hear from people using it in their own products. I tried for a while to maintain it, even after I had moved away from front end web development.
+
+The time has come to officially call it quits. The web has changed(**A LOT**) and there are better things out there like [Cleave.js](https://nosir.github.io/cleave.js/). I'll leave this repo up for posterity in an archived state. Thank you to everyone who contributed to or used this plugin over the years.
+
+
Overview
--------
This is a masked input plugin for the jQuery javascript library. It allows a user to more easily enter fixed width input where you would like them to enter the data in a certain format (dates,phone numbers, etc). It has been tested on Internet Explorer, Firefox, Safari, Opera, and Chrome. A mask is defined by a format made up of mask literals and mask definitions. Any character not in the definitions list below is considered a mask literal. Mask literals will be automatically entered for the user as they type and will not be able to be removed by the user.The following mask definitions are predefined: