|
|
@@ -3,7 +3,7 @@
|
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
|
* Copyright (c) 2010 - 2016 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 3.2.7-2
|
|
|
+* Version: 3.2.7-3
|
|
|
*/
|
|
|
!function($) {
|
|
|
function Inputmask(alias, options) {
|
|
|
@@ -762,7 +762,7 @@
|
|
|
};
|
|
|
begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin;
|
|
|
var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
|
|
|
- if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, androidchrome || opts.insertMode !== !1 || begin !== end || end++,
|
|
|
+ if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, mobile || opts.insertMode !== !1 || begin !== end || end++,
|
|
|
input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) {
|
|
|
if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) {
|
|
|
var textNode = document.createTextNode("");
|
|
|
@@ -1011,15 +1011,14 @@
|
|
|
undoValue = getBuffer().join(""), "" === compositionData || 0 !== ev.data.indexOf(compositionData);
|
|
|
}
|
|
|
function compositionUpdateEvent(e) {
|
|
|
- var input = this, ev = e.originalEvent || e;
|
|
|
- 0 === ev.data.indexOf(compositionData) && (resetMaskSet(), getMaskSet().p = seekNext(-1),
|
|
|
- skipInputEvent = !0);
|
|
|
+ var input = this, ev = e.originalEvent || e, inputBuffer = getBuffer().join("");
|
|
|
+ 0 === ev.data.indexOf(compositionData) && (resetMaskSet(), getMaskSet().p = seekNext(-1));
|
|
|
for (var newData = ev.data, i = 0; i < newData.length; i++) {
|
|
|
var keypress = new $.Event("keypress");
|
|
|
keypress.which = newData.charCodeAt(i), skipKeyPressEvent = !1, ignorable = !1,
|
|
|
keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p);
|
|
|
}
|
|
|
- setTimeout(function() {
|
|
|
+ inputBuffer !== getBuffer().join("") && setTimeout(function() {
|
|
|
var forwardPosition = getMaskSet().p;
|
|
|
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
|
|
|
}, 0), compositionData = ev.data;
|
|
|
@@ -1125,7 +1124,7 @@
|
|
|
EventRuler.on(el, "drop", pasteEvent), EventRuler.on(el, "cut", cutEvent), EventRuler.on(el, "complete", opts.oncomplete),
|
|
|
EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared),
|
|
|
EventRuler.on(el, "keydown", keydownEvent), EventRuler.on(el, "keypress", keypressEvent),
|
|
|
- EventRuler.on(el, "input", inputFallBackEvent), androidfirefox || (EventRuler.on(el, "compositionstart", compositionStartEvent),
|
|
|
+ EventRuler.on(el, "input", inputFallBackEvent), mobile || (EventRuler.on(el, "compositionstart", compositionStartEvent),
|
|
|
EventRuler.on(el, "compositionupdate", compositionUpdateEvent), EventRuler.on(el, "compositionend", compositionEndEvent))),
|
|
|
EventRuler.on(el, "setvalue", setValueEvent), "" !== el.inputmask._valueGet() || opts.clearMaskOnLostFocus === !1) {
|
|
|
var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(el.inputmask._valueGet(), opts) || el.inputmask._valueGet() : el.inputmask._valueGet();
|
|
|
@@ -1136,10 +1135,9 @@
|
|
|
writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
|
|
|
}
|
|
|
}
|
|
|
- var undoValue, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !0, EventRuler = {
|
|
|
+ var undoValue, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !0, inComposition = !1, EventRuler = {
|
|
|
on: function(input, eventName, eventHandler) {
|
|
|
var ev = function(e) {
|
|
|
- var inComposition = !1, keydownPressed = !1;
|
|
|
if (void 0 === this.inputmask && "FORM" !== this.nodeName) {
|
|
|
var imOpts = $.data(this, "_inputmask_opts");
|
|
|
imOpts ? new Inputmask(imOpts).mask(this) : EventRuler.off(this);
|
|
|
@@ -1147,12 +1145,12 @@
|
|
|
if ("setvalue" === e.type || !(this.disabled || this.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || opts.tabThrough === !1 && e.keyCode === Inputmask.keyCode.TAB))) {
|
|
|
switch (e.type) {
|
|
|
case "input":
|
|
|
- if (skipInputEvent === !0 || inComposition === !0) return skipInputEvent = !1, e.preventDefault();
|
|
|
- keydownPressed = !1;
|
|
|
+ if (skipInputEvent === !0 || inComposition === !0) return skipInputEvent = inComposition,
|
|
|
+ e.preventDefault();
|
|
|
break;
|
|
|
|
|
|
case "keydown":
|
|
|
- skipKeyPressEvent = !1, inComposition = !1, keydownPressed = !0;
|
|
|
+ skipKeyPressEvent = !1, skipInputEvent = !1, inComposition = !1;
|
|
|
break;
|
|
|
|
|
|
case "keypress":
|
|
|
@@ -1165,11 +1163,11 @@
|
|
|
break;
|
|
|
|
|
|
case "compositionupdate":
|
|
|
- skipInputEvent = keydownPressed;
|
|
|
+ skipInputEvent = !0;
|
|
|
break;
|
|
|
|
|
|
case "compositionend":
|
|
|
- inComposition = !1, keydownPressed = !1;
|
|
|
+ inComposition = !1;
|
|
|
break;
|
|
|
|
|
|
case "cut":
|
|
|
@@ -1465,8 +1463,8 @@
|
|
|
UP: 38,
|
|
|
WINDOWS: 91
|
|
|
};
|
|
|
- var ua = navigator.userAgent, iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile, androidchrome = (/android.*safari.*/i.test(ua) && !iemobile,
|
|
|
- /android.*chrome.*/i.test(ua)), androidfirefox = /android.*firefox.*/i.test(ua);
|
|
|
+ var ua = navigator.userAgent, mobile = /mobile/i.test(ua), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
|
|
|
+ /android.*safari.*/i.test(ua) && !iemobile;
|
|
|
return window.Inputmask = Inputmask, Inputmask;
|
|
|
}(jQuery), function($, Inputmask) {
|
|
|
return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
|