From 1a2e98642bcd34ca90498120c597e8777ce9240e Mon Sep 17 00:00:00 2001
From: Danny Ouellet
Date: Fri, 23 Jan 2015 11:21:22 -0500
Subject: [PATCH 1/8] 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 0d017f402fefac2dae427654f9ba74b23d2b93a3 Mon Sep 17 00:00:00 2001
From: Ben Cooley
Date: Mon, 11 May 2015 10:39:55 -0400
Subject: [PATCH 2/8] 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 3/8] 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 4/8] 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 5/8] 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 6/8] 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 7/8] 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 8/8] =?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: