PK!cC%aajquery.inputmask.jsnu[/** * @license 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: 0.0.0 */ (function ($) { if ($.fn.inputmask === undefined) { //helper functions function isInputEventSupported(eventName) { var el = document.createElement('input'), eventName = 'on' + eventName, isSupported = (eventName in el); if (!isSupported) { el.setAttribute(eventName, 'return;'); isSupported = typeof el[eventName] == 'function'; } el = null; return isSupported; } function resolveAlias(aliasStr, options, opts) { var aliasDefinition = opts.aliases[aliasStr]; if (aliasDefinition) { if (aliasDefinition.alias) resolveAlias(aliasDefinition.alias, undefined, opts); //alias is another alias $.extend(true, opts, aliasDefinition); //merge alias definition in the options $.extend(true, opts, options); //reapply extra given options return true; } return false; } function generateMaskSets(opts) { var ms = []; var genmasks = []; //used to keep track of the masks that where processed, to avoid duplicates function getMaskTemplate(mask) { if (opts.numericInput) { mask = mask.split('').reverse().join(''); } var escaped = false, outCount = 0, greedy = opts.greedy, repeat = opts.repeat; if (repeat == "*") greedy = false; //if (greedy == true && opts.placeholder == "") opts.placeholder = " "; if (mask.length == 1 && greedy == false && repeat != 0) { opts.placeholder = ""; } //hide placeholder with single non-greedy mask var singleMask = $.map(mask.split(""), function (element, index) { var outElem = []; if (element == opts.escapeChar) { escaped = true; } else if ((element != opts.optionalmarker.start && element != opts.optionalmarker.end) || escaped) { var maskdef = opts.definitions[element]; if (maskdef && !escaped) { for (var i = 0; i < maskdef.cardinality; i++) { outElem.push(opts.placeholder.charAt((outCount + i) % opts.placeholder.length)); } } else { outElem.push(element); escaped = false; } outCount += outElem.length; return outElem; } }); //allocate repetitions var repeatedMask = singleMask.slice(); for (var i = 1; i < repeat && greedy; i++) { repeatedMask = repeatedMask.concat(singleMask.slice()); } return { "mask": repeatedMask, "repeat": repeat, "greedy": greedy }; } //test definition => {fn: RegExp/function, cardinality: int, optionality: bool, newBlockMarker: bool, offset: int, casing: null/upper/lower, def: definitionSymbol} function getTestingChain(mask) { if (opts.numericInput) { mask = mask.split('').reverse().join(''); } var isOptional = false, escaped = false; var newBlockMarker = false; //indicates wheter the begin/ending of a block should be indicated return $.map(mask.split(""), function (element, index) { var outElem = []; if (element == opts.escapeChar) { escaped = true; } else if (element == opts.optionalmarker.start && !escaped) { isOptional = true; newBlockMarker = true; } else if (element == opts.optionalmarker.end && !escaped) { isOptional = false; newBlockMarker = true; } else { var maskdef = opts.definitions[element]; if (maskdef && !escaped) { var prevalidators = maskdef["prevalidator"], prevalidatorsL = prevalidators ? prevalidators.length : 0; for (var i = 1; i < maskdef.cardinality; i++) { var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator["validator"], cardinality = prevalidator["cardinality"]; outElem.push({ fn: validator ? typeof validator == 'string' ? new RegExp(validator) : new function () { this.test = validator; } : new RegExp("."), cardinality: cardinality ? cardinality : 1, optionality: isOptional, newBlockMarker: isOptional == true ? newBlockMarker : false, offset: 0, casing: maskdef["casing"], def: maskdef["definitionSymbol"] || element }); if (isOptional == true) //reset newBlockMarker newBlockMarker = false; } outElem.push({ fn: maskdef.validator ? typeof maskdef.validator == 'string' ? new RegExp(maskdef.validator) : new function () { this.test = maskdef.validator; } : new RegExp("."), cardinality: maskdef.cardinality, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: maskdef["casing"], def: maskdef["definitionSymbol"] || element }); } else { outElem.push({ fn: null, cardinality: 0, optionality: isOptional, newBlockMarker: newBlockMarker, offset: 0, casing: null, def: element }); escaped = false; } //reset newBlockMarker newBlockMarker = false; return outElem; } }); } function markOptional(maskPart) { //needed for the clearOptionalTail functionality return opts.optionalmarker.start + maskPart + opts.optionalmarker.end; } function splitFirstOptionalEndPart(maskPart) { var optionalStartMarkers = 0, optionalEndMarkers = 0, mpl = maskPart.length; for (var i = 0; i < mpl; i++) { if (maskPart.charAt(i) == opts.optionalmarker.start) { optionalStartMarkers++; } if (maskPart.charAt(i) == opts.optionalmarker.end) { optionalEndMarkers++; } if (optionalStartMarkers > 0 && optionalStartMarkers == optionalEndMarkers) break; } var maskParts = [maskPart.substring(0, i)]; if (i < mpl) { maskParts.push(maskPart.substring(i + 1, mpl)); } return maskParts; } function splitFirstOptionalStartPart(maskPart) { var mpl = maskPart.length; for (var i = 0; i < mpl; i++) { if (maskPart.charAt(i) == opts.optionalmarker.start) { break; } } var maskParts = [maskPart.substring(0, i)]; if (i < mpl) { maskParts.push(maskPart.substring(i + 1, mpl)); } return maskParts; } function generateMask(maskPrefix, maskPart, metadata) { var maskParts = splitFirstOptionalEndPart(maskPart); var newMask, maskTemplate; var masks = splitFirstOptionalStartPart(maskParts[0]); if (masks.length > 1) { newMask = maskPrefix + masks[0] + markOptional(masks[1]) + (maskParts.length > 1 ? maskParts[1] : ""); if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } newMask = maskPrefix + masks[0] + (maskParts.length > 1 ? maskParts[1] : ""); if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } if (splitFirstOptionalStartPart(masks[1]).length > 1) { //optional contains another optional generateMask(maskPrefix + masks[0], masks[1] + maskParts[1], metadata); } if (maskParts.length > 1 && splitFirstOptionalStartPart(maskParts[1]).length > 1) { generateMask(maskPrefix + masks[0] + markOptional(masks[1]), maskParts[1], metadata); generateMask(maskPrefix + masks[0], maskParts[1], metadata); } } else { newMask = maskPrefix + maskParts; if ($.inArray(newMask, genmasks) == -1 && newMask != "") { genmasks.push(newMask); maskTemplate = getMaskTemplate(newMask); ms.push({ "mask": newMask, "_buffer": maskTemplate["mask"], "buffer": maskTemplate["mask"].slice(), "tests": getTestingChain(newMask), "lastValidPosition": -1, "greedy": maskTemplate["greedy"], "repeat": maskTemplate["repeat"], "metadata": metadata }); } } } if ($.isFunction(opts.mask)) { //allow mask to be a preprocessing fn - should return a valid mask opts.mask = opts.mask.call(this, opts); } if ($.isArray(opts.mask)) { $.each(opts.mask, function (ndx, msk) { if (msk["mask"] != undefined) { generateMask("", msk["mask"].toString(), msk); } else generateMask("", msk.toString()); }); } else generateMask("", opts.mask.toString()); return opts.greedy ? ms : ms.sort(function (a, b) { return a["mask"].length - b["mask"].length; }); } var msie10 = navigator.userAgent.match(new RegExp("msie 10", "i")) !== null, iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null, android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null, androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null, pasteEvent = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange"; //masking scope //actionObj definition see below function maskScope(masksets, activeMasksetIndex, opts, actionObj) { var isRTL = false, valueOnFocus = getActiveBuffer().join(''), $el, chromeValueOnInput, skipKeyPressEvent = false, //Safari 5.1.x - modal dialog fires keypress twice workaround skipInputEvent = false, //skip when triggered from within inputmask ignorable = false; //maskset helperfunctions function getActiveMaskSet() { return masksets[activeMasksetIndex]; } function getActiveTests() { return getActiveMaskSet()['tests']; } function getActiveBufferTemplate() { return getActiveMaskSet()['_buffer']; } function getActiveBuffer() { return getActiveMaskSet()['buffer']; } function isValid(pos, c, strict) { //strict true ~ no correction or autofill strict = strict === true; //always set a value to strict to prevent possible strange behavior in the extensions function _isValid(position, activeMaskset, c, strict) { var testPos = determineTestPosition(position), loopend = c ? 1 : 0, chrs = '', buffer = activeMaskset["buffer"]; for (var i = activeMaskset['tests'][testPos].cardinality; i > loopend; i--) { chrs += getBufferElement(buffer, testPos - (i - 1)); } if (c) { chrs += c; } //return is false or a json object => { pos: ??, c: ??} or true return activeMaskset['tests'][testPos].fn != null ? activeMaskset['tests'][testPos].fn.test(chrs, buffer, position, strict, opts) : (c == getBufferElement(activeMaskset['_buffer'], position, true) || c == opts.skipOptionalPartCharacter) ? { "refresh": true, c: getBufferElement(activeMaskset['_buffer'], position, true), pos: position } : false; } function PostProcessResults(maskForwards, results) { var hasValidActual = false; $.each(results, function (ndx, rslt) { hasValidActual = $.inArray(rslt["activeMasksetIndex"], maskForwards) == -1 && rslt["result"] !== false; if (hasValidActual) return false; }); if (hasValidActual) { //strip maskforwards results = $.map(results, function (rslt, ndx) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) == -1) { return rslt; } else { masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = actualLVP; } }); } else { //keep maskforwards with the least forward var lowestPos = -1, lowestIndex = -1, rsltValid; $.each(results, function (ndx, rslt) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) != -1 && rslt["result"] !== false & (lowestPos == -1 || lowestPos > rslt["result"]["pos"])) { lowestPos = rslt["result"]["pos"]; lowestIndex = rslt["activeMasksetIndex"]; } }); results = $.map(results, function (rslt, ndx) { if ($.inArray(rslt["activeMasksetIndex"], maskForwards) != -1) { if (rslt["result"]["pos"] == lowestPos) { return rslt; } else if (rslt["result"] !== false) { for (var i = pos; i < lowestPos; i++) { rsltValid = _isValid(i, masksets[rslt["activeMasksetIndex"]], masksets[lowestIndex]["buffer"][i], true); if (rsltValid === false) { masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = lowestPos - 1; break; } else { setBufferElement(masksets[rslt["activeMasksetIndex"]]["buffer"], i, masksets[lowestIndex]["buffer"][i], true); masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = i; } } //also check check for the lowestpos with the new input rsltValid = _isValid(lowestPos, masksets[rslt["activeMasksetIndex"]], c, true); if (rsltValid !== false) { setBufferElement(masksets[rslt["activeMasksetIndex"]]["buffer"], lowestPos, c, true); masksets[rslt["activeMasksetIndex"]]["lastValidPosition"] = lowestPos; } //console.log("ndx " + rslt["activeMasksetIndex"] + " validate " + masksets[rslt["activeMasksetIndex"]]["buffer"].join('') + " lv " + masksets[rslt["activeMasksetIndex"]]['lastValidPosition']); return rslt; } } }); } return results; } if (strict) { var result = _isValid(pos, getActiveMaskSet(), c, strict); //only check validity in current mask when validating strict if (result === true) { result = { "pos": pos }; //always take a possible corrected maskposition into account } return result; } var results = [], result = false, currentActiveMasksetIndex = activeMasksetIndex, actualBuffer = getActiveBuffer().slice(), actualLVP = getActiveMaskSet()["lastValidPosition"], actualPrevious = seekPrevious(pos), maskForwards = []; $.each(masksets, function (index, value) { if (typeof (value) == "object") { activeMasksetIndex = index; var maskPos = pos; var lvp = getActiveMaskSet()['lastValidPosition'], rsltValid; if (lvp == actualLVP) { if ((maskPos - actualLVP) > 1) { for (var i = lvp == -1 ? 0 : lvp; i < maskPos; i++) { rsltValid = _isValid(i, getActiveMaskSet(), actualBuffer[i], true); if (rsltValid === false) { break; } else { setBufferElement(getActiveBuffer(), i, actualBuffer[i], true); if (rsltValid === true) { rsltValid = { "pos": i }; //always take a possible corrected maskposition into account } var newValidPosition = rsltValid.pos || i; if (getActiveMaskSet()['lastValidPosition'] < newValidPosition) getActiveMaskSet()['lastValidPosition'] = newValidPosition; //set new position from isValid } } } //does the input match on a further position? if (!isMask(maskPos) && !_isValid(maskPos, getActiveMaskSet(), c, strict)) { var maxForward = seekNext(maskPos) - maskPos; for (var fw = 0; fw < maxForward; fw++) { if (_isValid(++maskPos, getActiveMaskSet(), c, strict) !== false) break; } maskForwards.push(activeMasksetIndex); //console.log('maskforward ' + activeMasksetIndex + " pos " + pos + " maskPos " + maskPos); } } if (getActiveMaskSet()['lastValidPosition'] >= actualLVP || activeMasksetIndex == currentActiveMasksetIndex) { if (maskPos >= 0 && maskPos < getMaskLength()) { result = _isValid(maskPos, getActiveMaskSet(), c, strict); if (result !== false) { if (result === true) { result = { "pos": maskPos }; //always take a possible corrected maskposition into account } var newValidPosition = result.pos || maskPos; if (getActiveMaskSet()['lastValidPosition'] < newValidPosition) getActiveMaskSet()['lastValidPosition'] = newValidPosition; //set new position from isValid } //console.log("pos " + pos + " ndx " + activeMasksetIndex + " validate " + getActiveBuffer().join('') + " lv " + getActiveMaskSet()['lastValidPosition']); results.push({ "activeMasksetIndex": index, "result": result }); } } } }); activeMasksetIndex = currentActiveMasksetIndex; //reset activeMasksetIndex return PostProcessResults(maskForwards, results); //return results of the multiple mask validations } function determineActiveMasksetIndex() { var currentMasksetIndex = activeMasksetIndex, highestValid = { "activeMasksetIndex": 0, "lastValidPosition": -1, "next": -1 }; $.each(masksets, function (index, value) { if (typeof (value) == "object") { activeMasksetIndex = index; if (getActiveMaskSet()['lastValidPosition'] > highestValid['lastValidPosition']) { highestValid["activeMasksetIndex"] = index; highestValid["lastValidPosition"] = getActiveMaskSet()['lastValidPosition']; highestValid["next"] = seekNext(getActiveMaskSet()['lastValidPosition']); } else if (getActiveMaskSet()['lastValidPosition'] == highestValid['lastValidPosition'] && (highestValid['next'] == -1 || highestValid['next'] > seekNext(getActiveMaskSet()['lastValidPosition']))) { highestValid["activeMasksetIndex"] = index; highestValid["lastValidPosition"] = getActiveMaskSet()['lastValidPosition']; highestValid["next"] = seekNext(getActiveMaskSet()['lastValidPosition']); } } }); activeMasksetIndex = highestValid["lastValidPosition"] != -1 && masksets[currentMasksetIndex]["lastValidPosition"] == highestValid["lastValidPosition"] ? currentMasksetIndex : highestValid["activeMasksetIndex"]; if (currentMasksetIndex != activeMasksetIndex) { clearBuffer(getActiveBuffer(), seekNext(highestValid["lastValidPosition"]), getMaskLength()); getActiveMaskSet()["writeOutBuffer"] = true; } $el.data('_inputmask')['activeMasksetIndex'] = activeMasksetIndex; //store the activeMasksetIndex } function isMask(pos) { var testPos = determineTestPosition(pos); var test = getActiveTests()[testPos]; return test != undefined ? test.fn : false; } function determineTestPosition(pos) { return pos % getActiveTests().length; } function getMaskLength() { return opts.getMaskLength(getActiveBufferTemplate(), getActiveMaskSet()['greedy'], getActiveMaskSet()['repeat'], getActiveBuffer(), opts); } //pos: from position function seekNext(pos) { var maskL = getMaskLength(); if (pos >= maskL) return maskL; var position = pos; while (++position < maskL && !isMask(position)) { } return position; } //pos: from position function seekPrevious(pos) { var position = pos; if (position <= 0) return 0; while (--position > 0 && !isMask(position)) { } return position; } function setBufferElement(buffer, position, element, autoPrepare) { if (autoPrepare) position = prepareBuffer(buffer, position); var test = getActiveTests()[determineTestPosition(position)]; var elem = element; if (elem != undefined && test != undefined) { switch (test.casing) { case "upper": elem = element.toUpperCase(); break; case "lower": elem = element.toLowerCase(); break; } } buffer[position] = elem; } function getBufferElement(buffer, position, autoPrepare) { if (autoPrepare) position = prepareBuffer(buffer, position); return buffer[position]; } //needed to handle the non-greedy mask repetitions function prepareBuffer(buffer, position) { var j; while (buffer[position] == undefined && buffer.length < getMaskLength()) { j = 0; while (getActiveBufferTemplate()[j] !== undefined) { //add a new buffer buffer.push(getActiveBufferTemplate()[j++]); } } return position; } function writeBuffer(input, buffer, caretPos) { input._valueSet(buffer.join('')); if (caretPos != undefined) { caret(input, caretPos); } } function clearBuffer(buffer, start, end, stripNomasks) { for (var i = start, maskL = getMaskLength() ; i < end && i < maskL; i++) { if (stripNomasks === true) { if (!isMask(i)) setBufferElement(buffer, i, ""); } else setBufferElement(buffer, i, getBufferElement(getActiveBufferTemplate().slice(), i, true)); } } function setReTargetPlaceHolder(buffer, pos) { var testPos = determineTestPosition(pos); setBufferElement(buffer, pos, getBufferElement(getActiveBufferTemplate(), testPos)); } function getPlaceHolder(pos) { return opts.placeholder.charAt(pos % opts.placeholder.length); } function checkVal(input, writeOut, strict, nptvl, intelliCheck) { var inputValue = nptvl != undefined ? nptvl.slice() : truncateInput(input._valueGet()).split(''); $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { ms["buffer"] = ms["_buffer"].slice(); ms["lastValidPosition"] = -1; ms["p"] = -1; } }); if (strict !== true) activeMasksetIndex = 0; if (writeOut) input._valueSet(""); //initial clear var ml = getMaskLength(); $.each(inputValue, function (ndx, charCode) { if (intelliCheck === true) { var p = getActiveMaskSet()["p"], lvp = p == -1 ? p : seekPrevious(p), pos = lvp == -1 ? ndx : seekNext(lvp); if ($.inArray(charCode, getActiveBufferTemplate().slice(lvp + 1, pos)) == -1) { keypressEvent.call(input, undefined, true, charCode.charCodeAt(0), writeOut, strict, ndx); } } else { keypressEvent.call(input, undefined, true, charCode.charCodeAt(0), writeOut, strict, ndx); } }); if (strict === true && getActiveMaskSet()["p"] != -1) { getActiveMaskSet()["lastValidPosition"] = seekPrevious(getActiveMaskSet()["p"]); } } function escapeRegex(str) { return $.inputmask.escapeRegex.call(this, str); } function truncateInput(inputValue) { return inputValue.replace(new RegExp("(" + escapeRegex(getActiveBufferTemplate().join('')) + ")*$"), ""); } function clearOptionalTail(input) { var buffer = getActiveBuffer(), tmpBuffer = buffer.slice(), testPos, pos; for (var pos = tmpBuffer.length - 1; pos >= 0; pos--) { var testPos = determineTestPosition(pos); if (getActiveTests()[testPos].optionality) { if (!isMask(pos) || !isValid(pos, buffer[pos], true)) tmpBuffer.pop(); else break; } else break; } writeBuffer(input, tmpBuffer); } function unmaskedvalue($input, skipDatepickerCheck) { if (getActiveTests() && (skipDatepickerCheck === true || !$input.hasClass('hasDatepicker'))) { //checkVal(input, false, true); var umValue = $.map(getActiveBuffer(), function (element, index) { return isMask(index) && isValid(index, element, true) ? element : null; }); var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(''); return opts.onUnMask != undefined ? opts.onUnMask.call(this, getActiveBuffer().join(''), unmaskedValue) : unmaskedValue; } else { return $input[0]._valueGet(); } } function TranslatePosition(pos) { if (isRTL && typeof pos == 'number' && (!opts.greedy || opts.placeholder != "")) { var bffrLght = getActiveBuffer().length; pos = bffrLght - pos; } return pos; } function caret(input, begin, end) { var npt = input.jquery && input.length > 0 ? input[0] : input, range; if (typeof begin == 'number') { begin = TranslatePosition(begin); end = TranslatePosition(end); if (!$(input).is(':visible')) { return; } end = (typeof end == 'number') ? end : begin; npt.scrollLeft = npt.scrollWidth; if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode if (npt.setSelectionRange) { npt.selectionStart = begin; npt.selectionEnd = android ? begin : end; } else if (npt.createTextRange) { range = npt.createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', begin); range.select(); } } else { if (!$(input).is(':visible')) { return { "begin": 0, "end": 0 }; } if (npt.setSelectionRange) { begin = npt.selectionStart; end = npt.selectionEnd; } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); begin = 0 - range.duplicate().moveStart('character', -100000); end = begin + range.text.length; } begin = TranslatePosition(begin); end = TranslatePosition(end); return { "begin": begin, "end": end }; } } function isComplete(buffer) { //return true / false / undefined (repeat *) if (opts.repeat == "*") return undefined; var complete = false, highestValidPosition = 0, currentActiveMasksetIndex = activeMasksetIndex; $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { activeMasksetIndex = ndx; var aml = seekPrevious(getMaskLength()); if (ms["lastValidPosition"] >= highestValidPosition && ms["lastValidPosition"] == aml) { var msComplete = true; for (var i = 0; i <= aml; i++) { var mask = isMask(i), testPos = determineTestPosition(i); if ((mask && (buffer[i] == undefined || buffer[i] == getPlaceHolder(i))) || (!mask && buffer[i] != getActiveBufferTemplate()[testPos])) { msComplete = false; break; } } complete = complete || msComplete; if (complete) //break loop return false; } highestValidPosition = ms["lastValidPosition"]; } }); activeMasksetIndex = currentActiveMasksetIndex; //reset activeMaskset return complete; } function isSelection(begin, end) { return isRTL ? (begin - end) > 1 || ((begin - end) == 1 && opts.insertMode) : (end - begin) > 1 || ((end - begin) == 1 && opts.insertMode); } //private functions function installEventRuler(npt) { var events = $._data(npt).events; $.each(events, function (eventType, eventHandlers) { $.each(eventHandlers, function (ndx, eventHandler) { if (eventHandler.namespace == "inputmask") { if (eventHandler.type != "setvalue") { var handler = eventHandler.handler; eventHandler.handler = function (e) { if (this.readOnly || this.disabled) e.preventDefault; else return handler.apply(this, arguments); }; } } }); }); } function patchValueProperty(npt) { var valueProperty; if (Object.getOwnPropertyDescriptor) valueProperty = Object.getOwnPropertyDescriptor(npt, "value"); if (valueProperty && valueProperty.get) { if (!npt._valueGet) { var valueGet = valueProperty.get; var valueSet = valueProperty.set; npt._valueGet = function () { return isRTL ? valueGet.call(this).split('').reverse().join('') : valueGet.call(this); }; npt._valueSet = function (value) { valueSet.call(this, isRTL ? value.split('').reverse().join('') : value); }; Object.defineProperty(npt, "value", { get: function () { var $self = $(this), inputData = $(this).data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return inputData && inputData['opts'].autoUnmask ? $self.inputmask('unmaskedvalue') : valueGet.call(this) != masksets[activeMasksetIndex]['_buffer'].join('') ? valueGet.call(this) : ''; }, set: function (value) { valueSet.call(this, value); $(this).triggerHandler('setvalue.inputmask'); } }); } } else if (document.__lookupGetter__ && npt.__lookupGetter__("value")) { if (!npt._valueGet) { var valueGet = npt.__lookupGetter__("value"); var valueSet = npt.__lookupSetter__("value"); npt._valueGet = function () { return isRTL ? valueGet.call(this).split('').reverse().join('') : valueGet.call(this); }; npt._valueSet = function (value) { valueSet.call(this, isRTL ? value.split('').reverse().join('') : value); }; npt.__defineGetter__("value", function () { var $self = $(this), inputData = $(this).data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return inputData && inputData['opts'].autoUnmask ? $self.inputmask('unmaskedvalue') : valueGet.call(this) != masksets[activeMasksetIndex]['_buffer'].join('') ? valueGet.call(this) : ''; }); npt.__defineSetter__("value", function (value) { valueSet.call(this, value); $(this).triggerHandler('setvalue.inputmask'); }); } } else { if (!npt._valueGet) { npt._valueGet = function () { return isRTL ? this.value.split('').reverse().join('') : this.value; }; npt._valueSet = function (value) { this.value = isRTL ? value.split('').reverse().join('') : value; }; } if ($.valHooks.text == undefined || $.valHooks.text.inputmaskpatch != true) { var valueGet = $.valHooks.text && $.valHooks.text.get ? $.valHooks.text.get : function (elem) { return elem.value; }; var valueSet = $.valHooks.text && $.valHooks.text.set ? $.valHooks.text.set : function (elem, value) { elem.value = value; return elem; }; jQuery.extend($.valHooks, { text: { get: function (elem) { var $elem = $(elem); if ($elem.data('_inputmask')) { if ($elem.data('_inputmask')['opts'].autoUnmask) return $elem.inputmask('unmaskedvalue'); else { var result = valueGet(elem), inputData = $elem.data('_inputmask'), masksets = inputData['masksets'], activeMasksetIndex = inputData['activeMasksetIndex']; return result != masksets[activeMasksetIndex]['_buffer'].join('') ? result : ''; } } else return valueGet(elem); }, set: function (elem, value) { var $elem = $(elem); var result = valueSet(elem, value); if ($elem.data('_inputmask')) $elem.triggerHandler('setvalue.inputmask'); return result; }, inputmaskpatch: true } }); } } } //shift chars to left from start to end and put c at end position if defined function shiftL(start, end, c, maskJumps) { var buffer = getActiveBuffer(); if (maskJumps !== false) //jumping over nonmask position while (!isMask(start) && start - 1 >= 0) start--; for (var i = start; i < end && i < getMaskLength() ; i++) { if (isMask(i)) { setReTargetPlaceHolder(buffer, i); var j = seekNext(i); var p = getBufferElement(buffer, j); if (p != getPlaceHolder(j)) { if (j < getMaskLength() && isValid(i, p, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) { setBufferElement(buffer, i, p, true); } else { if (isMask(i)) break; } } } else { setReTargetPlaceHolder(buffer, i); } } if (c != undefined) setBufferElement(buffer, seekPrevious(end), c); if (getActiveMaskSet()["greedy"] == false) { var trbuffer = truncateInput(buffer.join('')).split(''); buffer.length = trbuffer.length; for (var i = 0, bl = buffer.length; i < bl; i++) { buffer[i] = trbuffer[i]; } if (buffer.length == 0) getActiveMaskSet()["buffer"] = getActiveBufferTemplate().slice(); } return start; //return the used start position } function shiftR(start, end, c) { var buffer = getActiveBuffer(); if (getBufferElement(buffer, start, true) != getPlaceHolder(start)) { for (var i = seekPrevious(end) ; i > start && i >= 0; i--) { if (isMask(i)) { var j = seekPrevious(i); var t = getBufferElement(buffer, j); if (t != getPlaceHolder(j)) { if (isValid(j, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) { setBufferElement(buffer, i, t, true); setReTargetPlaceHolder(buffer, j); } //else break; } } else setReTargetPlaceHolder(buffer, i); } } if (c != undefined && getBufferElement(buffer, start) == getPlaceHolder(start)) setBufferElement(buffer, start, c); var lengthBefore = buffer.length; if (getActiveMaskSet()["greedy"] == false) { var trbuffer = truncateInput(buffer.join('')).split(''); buffer.length = trbuffer.length; for (var i = 0, bl = buffer.length; i < bl; i++) { buffer[i] = trbuffer[i]; } if (buffer.length == 0) getActiveMaskSet()["buffer"] = getActiveBufferTemplate().slice(); } return end - (lengthBefore - buffer.length); //return new start position } function HandleRemove(input, k, pos) { if (opts.numericInput || isRTL) { switch (k) { case opts.keyCode.BACKSPACE: k = opts.keyCode.DELETE; break; case opts.keyCode.DELETE: k = opts.keyCode.BACKSPACE; break; } if (isRTL) { var pend = pos.end; pos.end = pos.begin; pos.begin = pend; } } var isSelection = true; if (pos.begin == pos.end) { var posBegin = k == opts.keyCode.BACKSPACE ? pos.begin - 1 : pos.begin; if (opts.isNumeric && opts.radixPoint != "" && getActiveBuffer()[posBegin] == opts.radixPoint) { pos.begin = (getActiveBuffer().length - 1 == posBegin) /* radixPoint is latest? delete it */ ? pos.begin : k == opts.keyCode.BACKSPACE ? posBegin : seekNext(posBegin); pos.end = pos.begin; } isSelection = false; if (k == opts.keyCode.BACKSPACE) pos.begin--; else if (k == opts.keyCode.DELETE) pos.end++; } else if (pos.end - pos.begin == 1 && !opts.insertMode) { isSelection = false; if (k == opts.keyCode.BACKSPACE) pos.begin--; } clearBuffer(getActiveBuffer(), pos.begin, pos.end); var ml = getMaskLength(); if (opts.greedy == false) { shiftL(pos.begin, ml, undefined, !isRTL && (k == opts.keyCode.BACKSPACE && !isSelection)); } else { var newpos = pos.begin; for (var i = pos.begin; i < pos.end; i++) { //seeknext to skip placeholders at start in selection if (isMask(i) || !isSelection) newpos = shiftL(pos.begin, ml, undefined, !isRTL && (k == opts.keyCode.BACKSPACE && !isSelection)); } if (!isSelection) pos.begin = newpos; } var firstMaskPos = seekNext(-1); clearBuffer(getActiveBuffer(), pos.begin, pos.end, true); checkVal(input, false, masksets[1] == undefined || firstMaskPos >= pos.end, getActiveBuffer()); if (getActiveMaskSet()['lastValidPosition'] < firstMaskPos) { getActiveMaskSet()["lastValidPosition"] = -1; getActiveMaskSet()["p"] = firstMaskPos; } else { getActiveMaskSet()["p"] = pos.begin; } } function keydownEvent(e) { //Safari 5.1.x - modal dialog fires keypress twice workaround skipKeyPressEvent = false; var input = this, $input = $(input), k = e.keyCode, pos = caret(input); //backspace, delete, and escape get special treatment if (k == opts.keyCode.BACKSPACE || k == opts.keyCode.DELETE || (iphone && k == 127) || e.ctrlKey && k == 88) { //backspace/delete e.preventDefault(); //stop default action but allow propagation if (k == 88) valueOnFocus = getActiveBuffer().join(''); HandleRemove(input, k, pos); determineActiveMasksetIndex(); writeBuffer(input, getActiveBuffer(), getActiveMaskSet()["p"]); if (input._valueGet() == getActiveBufferTemplate().join('')) $input.trigger('cleared'); if (opts.showTooltip) { //update tooltip $input.prop("title", getActiveMaskSet()["mask"]); } } else if (k == opts.keyCode.END || k == opts.keyCode.PAGE_DOWN) { //when END or PAGE_DOWN pressed set position at lastmatch setTimeout(function () { var caretPos = seekNext(getActiveMaskSet()["lastValidPosition"]); if (!opts.insertMode && caretPos == getMaskLength() && !e.shiftKey) caretPos--; caret(input, e.shiftKey ? pos.begin : caretPos, caretPos); }, 0); } else if ((k == opts.keyCode.HOME && !e.shiftKey) || k == opts.keyCode.PAGE_UP) { //Home or page_up caret(input, 0, e.shiftKey ? pos.begin : 0); } else if (k == opts.keyCode.ESCAPE || (k == 90 && e.ctrlKey)) { //escape && undo checkVal(input, true, false, valueOnFocus.split('')); $input.click(); } else if (k == opts.keyCode.INSERT && !(e.shiftKey || e.ctrlKey)) { //insert opts.insertMode = !opts.insertMode; caret(input, !opts.insertMode && pos.begin == getMaskLength() ? pos.begin - 1 : pos.begin); } else if (opts.insertMode == false && !e.shiftKey) { if (k == opts.keyCode.RIGHT) { setTimeout(function () { var caretPos = caret(input); caret(input, caretPos.begin); }, 0); } else if (k == opts.keyCode.LEFT) { setTimeout(function () { var caretPos = caret(input); caret(input, caretPos.begin - 1); }, 0); } } var currentCaretPos = caret(input); if (opts.onKeyDown.call(this, e, getActiveBuffer(), opts) === true) //extra stuff to execute on keydown caret(input, currentCaretPos.begin, currentCaretPos.end); ignorable = $.inArray(k, opts.ignorables) != -1; } function keypressEvent(e, checkval, k, writeOut, strict, ndx) { //Safari 5.1.x - modal dialog fires keypress twice workaround if (k == undefined && skipKeyPressEvent) return false; skipKeyPressEvent = true; var input = this, $input = $(input); e = e || window.event; var k = checkval ? k : (e.which || e.charCode || e.keyCode); if (checkval !== true && (!(e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable))) { return true; } else { if (k) { //special treat the decimal separator if (checkval !== true && k == 46 && e.shiftKey == false && opts.radixPoint == ",") k = 44; var pos, results, result, c = String.fromCharCode(k); if (checkval) { var pcaret = strict ? ndx : getActiveMaskSet()["lastValidPosition"] + 1; pos = { begin: pcaret, end: pcaret }; } else { pos = caret(input); } //should we clear a possible selection?? var isSlctn = isSelection(pos.begin, pos.end), redetermineLVP = false, initialIndex = activeMasksetIndex; if (isSlctn) { activeMasksetIndex = initialIndex; $.each(masksets, function (ndx, lmnt) { //init undobuffer for recovery when not valid if (typeof (lmnt) == "object") { activeMasksetIndex = ndx; getActiveMaskSet()["undoBuffer"] = getActiveBuffer().join(''); } }); HandleRemove(input, opts.keyCode.DELETE, pos); if (!opts.insertMode) { //preserve some space $.each(masksets, function (ndx, lmnt) { if (typeof (lmnt) == "object") { activeMasksetIndex = ndx; shiftR(pos.begin, getMaskLength()); getActiveMaskSet()["lastValidPosition"] = seekNext(getActiveMaskSet()["lastValidPosition"]); } }); } activeMasksetIndex = initialIndex; //restore index } var radixPosition = getActiveBuffer().join('').indexOf(opts.radixPoint); if (opts.isNumeric && checkval !== true && radixPosition != -1) { if (opts.greedy && pos.begin <= radixPosition) { pos.begin = seekPrevious(pos.begin); pos.end = pos.begin; } else if (c == opts.radixPoint) { pos.begin = radixPosition; pos.end = pos.begin; } } var p = pos.begin; results = isValid(p, c, strict); if (strict === true) results = [{ "activeMasksetIndex": activeMasksetIndex, "result": results }]; var minimalForwardPosition = -1; $.each(results, function (index, result) { activeMasksetIndex = result["activeMasksetIndex"]; getActiveMaskSet()["writeOutBuffer"] = true; var np = result["result"]; if (np !== false) { var refresh = false, buffer = getActiveBuffer(); if (np !== true) { refresh = np["refresh"]; //only rewrite buffer from isValid p = np.pos != undefined ? np.pos : p; //set new position from isValid c = np.c != undefined ? np.c : c; //set new char from isValid } if (refresh !== true) { if (opts.insertMode == true) { var lastUnmaskedPosition = getMaskLength(); var bfrClone = buffer.slice(); while (getBufferElement(bfrClone, lastUnmaskedPosition, true) != getPlaceHolder(lastUnmaskedPosition) && lastUnmaskedPosition >= p) { lastUnmaskedPosition = lastUnmaskedPosition == 0 ? -1 : seekPrevious(lastUnmaskedPosition); } if (lastUnmaskedPosition >= p) { shiftR(p, getMaskLength(), c); //shift the lvp if needed var lvp = getActiveMaskSet()["lastValidPosition"], nlvp = seekNext(lvp); if (nlvp != getMaskLength() && lvp >= p && (getBufferElement(getActiveBuffer(), nlvp, true) != getPlaceHolder(nlvp))) { getActiveMaskSet()["lastValidPosition"] = nlvp; } } else getActiveMaskSet()["writeOutBuffer"] = false; } else setBufferElement(buffer, p, c, true); if (minimalForwardPosition == -1 || minimalForwardPosition > seekNext(p)) { minimalForwardPosition = seekNext(p); } } else if (!strict) { var nextPos = p < getMaskLength() ? p + 1 : p; if (minimalForwardPosition == -1 || minimalForwardPosition > nextPos) { minimalForwardPosition = nextPos; } } if (minimalForwardPosition > getActiveMaskSet()["p"]) getActiveMaskSet()["p"] = minimalForwardPosition; //needed for checkval strict } }); if (strict !== true) { activeMasksetIndex = initialIndex; determineActiveMasksetIndex(); } if (writeOut !== false) { $.each(results, function (ndx, rslt) { if (rslt["activeMasksetIndex"] == activeMasksetIndex) { result = rslt; return false; } }); if (result != undefined) { var self = this; setTimeout(function () { opts.onKeyValidation.call(self, result["result"], opts); }, 0); if (getActiveMaskSet()["writeOutBuffer"] && result["result"] !== false) { var buffer = getActiveBuffer(); var newCaretPosition; if (checkval) { newCaretPosition = undefined; } else if (opts.numericInput) { if (p > radixPosition) { newCaretPosition = seekPrevious(minimalForwardPosition); } else if (c == opts.radixPoint) { newCaretPosition = minimalForwardPosition - 1; } else newCaretPosition = seekPrevious(minimalForwardPosition - 1); } else { newCaretPosition = minimalForwardPosition; } writeBuffer(input, buffer, newCaretPosition); if (checkval !== true) { setTimeout(function () { //timeout needed for IE if (isComplete(buffer) === true) $input.trigger("complete"); skipInputEvent = true; $input.trigger("input"); }, 0); } } else if (isSlctn) { getActiveMaskSet()["buffer"] = getActiveMaskSet()["undoBuffer"].split(''); } } } if (opts.showTooltip) { //update tooltip $input.prop("title", getActiveMaskSet()["mask"]); } //needed for IE8 and below if (e) e.preventDefault ? e.preventDefault() : e.returnValue = false; } } } function keyupEvent(e) { var $input = $(this), input = this, k = e.keyCode, buffer = getActiveBuffer(); if (androidchrome && k == opts.keyCode.BACKSPACE) { if (chromeValueOnInput == input._valueGet()) keydownEvent.call(this, e); } opts.onKeyUp.call(this, e, buffer, opts); //extra stuff to execute on keyup if (k == opts.keyCode.TAB && opts.showMaskOnFocus) { if ($input.hasClass('focus.inputmask') && input._valueGet().length == 0) { buffer = getActiveBufferTemplate().slice(); writeBuffer(input, buffer); caret(input, 0); valueOnFocus = getActiveBuffer().join(''); } else { writeBuffer(input, buffer); if (buffer.join('') == getActiveBufferTemplate().join('') && $.inArray(opts.radixPoint, buffer) != -1) { caret(input, TranslatePosition(0)); $input.click(); } else caret(input, TranslatePosition(0), TranslatePosition(getMaskLength())); } } } function inputEvent(e) { if (skipInputEvent === true) { skipInputEvent = false; return true; } var input = this, $input = $(input); chromeValueOnInput = getActiveBuffer().join(''); checkVal(input, false, false); writeBuffer(input, getActiveBuffer()); if (isComplete(getActiveBuffer()) === true) $input.trigger("complete"); $input.click(); } function mask(el) { $el = $(el); if ($el.is(":input")) { //store tests & original buffer in the input element - used to get the unmasked value $el.data('_inputmask', { 'masksets': masksets, 'activeMasksetIndex': activeMasksetIndex, 'opts': opts, 'isRTL': false }); //show tooltip if (opts.showTooltip) { $el.prop("title", getActiveMaskSet()["mask"]); } //correct greedy setting if needed getActiveMaskSet()['greedy'] = getActiveMaskSet()['greedy'] ? getActiveMaskSet()['greedy'] : getActiveMaskSet()['repeat'] == 0; //handle maxlength attribute if ($el.attr("maxLength") != null) //only when the attribute is set { var maxLength = $el.prop('maxLength'); if (maxLength > -1) { //handle *-repeat $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { if (ms["repeat"] == "*") { ms["repeat"] = maxLength; } } }); } if (getMaskLength() >= maxLength && maxLength > -1) { //FF sets no defined max length to -1 if (maxLength < getActiveBufferTemplate().length) getActiveBufferTemplate().length = maxLength; if (getActiveMaskSet()['greedy'] == false) { getActiveMaskSet()['repeat'] = Math.round(maxLength / getActiveBufferTemplate().length); } $el.prop('maxLength', getMaskLength() * 2); } } patchValueProperty(el); if (opts.numericInput) opts.isNumeric = opts.numericInput; if (el.dir == "rtl" || (opts.numericInput && opts.rightAlignNumerics) || (opts.isNumeric && opts.rightAlignNumerics)) $el.css("text-align", "right"); if (el.dir == "rtl" || opts.numericInput) { el.dir = "ltr"; $el.removeAttr("dir"); var inputData = $el.data('_inputmask'); inputData['isRTL'] = true; $el.data('_inputmask', inputData); isRTL = true; } //unbind all events - to make sure that no other mask will interfere when re-masking $el.unbind(".inputmask"); $el.removeClass('focus.inputmask'); //bind events $el.closest('form').bind("submit", function () { //trigger change on submit if any if (valueOnFocus != getActiveBuffer().join('')) { $el.change(); } }).bind('reset', function () { setTimeout(function () { $el.trigger("setvalue"); }, 0); }); $el.bind("mouseenter.inputmask", function () { var $input = $(this), input = this; if (!$input.hasClass('focus.inputmask') && opts.showMaskOnHover) { if (input._valueGet() != getActiveBuffer().join('')) { writeBuffer(input, getActiveBuffer()); } } }).bind("blur.inputmask", function () { var $input = $(this), input = this, nptValue = input._valueGet(), buffer = getActiveBuffer(); $input.removeClass('focus.inputmask'); if (valueOnFocus != getActiveBuffer().join('')) { $input.change(); } if (opts.clearMaskOnLostFocus && nptValue != '') { if (nptValue == getActiveBufferTemplate().join('')) input._valueSet(''); else { //clearout optional tail of the mask clearOptionalTail(input); } } if (isComplete(buffer) === false) { $input.trigger("incomplete"); if (opts.clearIncomplete) { $.each(masksets, function (ndx, ms) { if (typeof (ms) == "object") { ms["buffer"] = ms["_buffer"].slice(); ms["lastValidPosition"] = -1; } }); activeMasksetIndex = 0; if (opts.clearMaskOnLostFocus) input._valueSet(''); else { buffer = getActiveBufferTemplate().slice(); writeBuffer(input, buffer); } } } }).bind("focus.inputmask", function () { var $input = $(this), input = this, nptValue = input._valueGet(); if (opts.showMaskOnFocus && !$input.hasClass('focus.inputmask') && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) { if (input._valueGet() != getActiveBuffer().join('')) { writeBuffer(input, getActiveBuffer(), seekNext(getActiveMaskSet()["lastValidPosition"])); } } $input.addClass('focus.inputmask'); valueOnFocus = getActiveBuffer().join(''); }).bind("mouseleave.inputmask", function () { var $input = $(this), input = this; if (opts.clearMaskOnLostFocus) { if (!$input.hasClass('focus.inputmask') && input._valueGet() != $input.attr("placeholder")) { if (input._valueGet() == getActiveBufferTemplate().join('') || input._valueGet() == '') input._valueSet(''); else { //clearout optional tail of the mask clearOptionalTail(input); } } } }).bind("click.inputmask", function () { var input = this; setTimeout(function () { var selectedCaret = caret(input), buffer = getActiveBuffer(); if (selectedCaret.begin == selectedCaret.end) { var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin, lvp = getActiveMaskSet()["lastValidPosition"], lastPosition; if (opts.isNumeric) { lastPosition = opts.skipRadixDance === false && opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 ? (opts.numericInput ? seekNext($.inArray(opts.radixPoint, buffer)) : $.inArray(opts.radixPoint, buffer)) : seekNext(lvp); } else { lastPosition = seekNext(lvp); } if (clickPosition < lastPosition) { if (isMask(clickPosition)) caret(input, clickPosition); else caret(input, seekNext(clickPosition)); } else caret(input, lastPosition); } }, 0); }).bind('dblclick.inputmask', function () { var input = this; setTimeout(function () { caret(input, 0, seekNext(getActiveMaskSet()["lastValidPosition"])); }, 0); }).bind(pasteEvent + ".inputmask dragdrop.inputmask drop.inputmask", function (e) { if (skipInputEvent === true) { skipInputEvent = false; return true; } var input = this, $input = $(input); //paste event for IE8 and lower I guess ;-) if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) { return true; } setTimeout(function () { var pasteValue = opts.onBeforePaste != undefined ? opts.onBeforePaste.call(this, input._valueGet()) : input._valueGet(); checkVal(input, true, false, pasteValue.split(''), true); if (isComplete(getActiveBuffer()) === true) $input.trigger("complete"); $input.click(); }, 0); }).bind('setvalue.inputmask', function () { var input = this; checkVal(input, true); valueOnFocus = getActiveBuffer().join(''); if (input._valueGet() == getActiveBufferTemplate().join('')) input._valueSet(''); }).bind('complete.inputmask', opts.oncomplete ).bind('incomplete.inputmask', opts.onincomplete ).bind('cleared.inputmask', opts.oncleared ).bind("keyup.inputmask", keyupEvent); if (androidchrome) { $el.bind("input.inputmask", inputEvent); } else { $el.bind("keydown.inputmask", keydownEvent ).bind("keypress.inputmask", keypressEvent); } if (msie10) $el.bind("input.inputmask", inputEvent); //apply mask checkVal(el, true, false); valueOnFocus = getActiveBuffer().join(''); // Wrap document.activeElement in a try/catch block since IE9 throw "Unspecified error" if document.activeElement is undefined when we are in an IFrame. var activeElement; try { activeElement = document.activeElement; } catch (e) { } if (activeElement === el) { //position the caret when in focus $el.addClass('focus.inputmask'); caret(el, seekNext(getActiveMaskSet()["lastValidPosition"])); } else if (opts.clearMaskOnLostFocus) { if (getActiveBuffer().join('') == getActiveBufferTemplate().join('')) { el._valueSet(''); } else { clearOptionalTail(el); } } else { writeBuffer(el, getActiveBuffer()); } installEventRuler(el); } } //action object if (actionObj != undefined) { switch (actionObj["action"]) { case "isComplete": return isComplete(actionObj["buffer"]); case "unmaskedvalue": isRTL = actionObj["$input"].data('_inputmask')['isRTL']; return unmaskedvalue(actionObj["$input"], actionObj["skipDatepickerCheck"]); case "mask": mask(actionObj["el"]); break; case "format": $el = $({}); $el.data('_inputmask', { 'masksets': masksets, 'activeMasksetIndex': activeMasksetIndex, 'opts': opts, 'isRTL': opts.numericInput }); if (opts.numericInput) { opts.isNumeric = opts.numericInput; isRTL = true; } checkVal($el, false, false, actionObj["value"].split(''), true); return getActiveBuffer().join(''); } } } $.inputmask = { //options default defaults: { placeholder: "_", optionalmarker: { start: "[", end: "]" }, quantifiermarker: { start: "{", end: "}" }, groupmarker: { start: "(", end: ")" }, escapeChar: "\\", mask: null, oncomplete: $.noop, //executes when the mask is complete onincomplete: $.noop, //executes when the mask is incomplete and focus is lost oncleared: $.noop, //executes when the mask is cleared repeat: 0, //repetitions of the mask: * ~ forever, otherwise specify an integer greedy: true, //true: allocated buffer for the mask and repetitions - false: allocate only if needed autoUnmask: false, //automatically unmask when retrieving the value with $.fn.val or value if the browser supports __lookupGetter__ or getOwnPropertyDescriptor clearMaskOnLostFocus: true, insertMode: true, //insert the input or overwrite the input clearIncomplete: false, //clear the incomplete input on blur aliases: {}, //aliases definitions => see jquery.inputmask.extensions.js onKeyUp: $.noop, //override to implement autocomplete on certain keys for example onKeyDown: $.noop, //override to implement autocomplete on certain keys for example onBeforePaste: undefined, //executes before masking the pasted value to allow preprocessing of the pasted value. args => pastedValue => return processedValue onUnMask: undefined, //executes after unmasking to allow postprocessing of the unmaskedvalue. args => maskedValue, unmaskedValue showMaskOnFocus: true, //show the mask-placeholder when the input has focus showMaskOnHover: true, //show the mask-placeholder when hovering the empty input onKeyValidation: $.noop, //executes on every key-press with the result of isValid. Params: result, opts skipOptionalPartCharacter: " ", //a character which can be used to skip an optional part of a mask showTooltip: false, //show the activemask as tooltip numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position) //numeric basic properties isNumeric: false, //enable numeric features radixPoint: "", //".", // | "," skipRadixDance: false, //disable radixpoint caret positioning rightAlignNumerics: true, //align numerics to the right //numeric basic properties definitions: { '9': { validator: "[0-9]", cardinality: 1 }, 'a': { validator: "[A-Za-z\u0410-\u044F\u0401\u0451]", cardinality: 1 }, '*': { validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]", 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 }, //specify keycodes which should not be considered in the keypress event, otherwise the preventDefault will stop their default behavior especially in FF 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], getMaskLength: function (buffer, greedy, repeat, currentBuffer, opts) { var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } return calculatedLength; } }, escapeRegex: function (str) { var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\']; return str.replace(new RegExp('(\\' + specials.join('|\\') + ')', 'gim'), '\\$1'); }, format: function (value, options) { var opts = $.extend(true, {}, $.inputmask.defaults, options); resolveAlias(opts.alias, options, opts); return maskScope(generateMaskSets(opts), 0, opts, { "action": "format", "value": value }); } }; $.fn.inputmask = function (fn, options) { var opts = $.extend(true, {}, $.inputmask.defaults, options), masksets, activeMasksetIndex = 0; if (typeof fn === "string") { switch (fn) { case "mask": //resolve possible aliases given by options resolveAlias(opts.alias, options, opts); masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), 0, opts, { "action": "mask", "el": this }); }); case "unmaskedvalue": var $input = $(this), input = this; if ($input.data('_inputmask')) { masksets = $input.data('_inputmask')['masksets']; activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; opts = $input.data('_inputmask')['opts']; return maskScope(masksets, activeMasksetIndex, opts, { "action": "unmaskedvalue", "$input": $input }); } else return $input.val(); case "remove": return this.each(function () { var $input = $(this), input = this; if ($input.data('_inputmask')) { masksets = $input.data('_inputmask')['masksets']; activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; opts = $input.data('_inputmask')['opts']; //writeout the unmaskedvalue input._valueSet(maskScope(masksets, activeMasksetIndex, opts, { "action": "unmaskedvalue", "$input": $input, "skipDatepickerCheck": true })); //clear data $input.removeData('_inputmask'); //unbind all events $input.unbind(".inputmask"); $input.removeClass('focus.inputmask'); //restore the value property var valueProperty; if (Object.getOwnPropertyDescriptor) valueProperty = Object.getOwnPropertyDescriptor(input, "value"); if (valueProperty && valueProperty.get) { if (input._valueGet) { Object.defineProperty(input, "value", { get: input._valueGet, set: input._valueSet }); } } else if (document.__lookupGetter__ && input.__lookupGetter__("value")) { if (input._valueGet) { input.__defineGetter__("value", input._valueGet); input.__defineSetter__("value", input._valueSet); } } try { //try catch needed for IE7 as it does not supports deleting fns delete input._valueGet; delete input._valueSet; } catch (e) { input._valueGet = undefined; input._valueSet = undefined; } } }); break; case "getemptymask": //return the default (empty) mask value, usefull for setting the default value in validation if (this.data('_inputmask')) { masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; return masksets[activeMasksetIndex]['_buffer'].join(''); } else return ""; case "hasMaskedValue": //check wheter the returned value is masked or not; currently only works reliable when using jquery.val fn to retrieve the value return this.data('_inputmask') ? !this.data('_inputmask')['opts'].autoUnmask : false; case "isComplete": masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; opts = this.data('_inputmask')['opts']; return maskScope(masksets, activeMasksetIndex, opts, { "action": "isComplete", "buffer": this[0]._valueGet().split('') }); case "getmetadata": //return mask metadata if exists if (this.data('_inputmask')) { masksets = this.data('_inputmask')['masksets']; activeMasksetIndex = this.data('_inputmask')['activeMasksetIndex']; return masksets[activeMasksetIndex]['metadata']; } else return undefined; default: //check if the fn is an alias if (!resolveAlias(fn, options, opts)) { //maybe fn is a mask so we try //set mask opts.mask = fn; } masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), activeMasksetIndex, opts, { "action": "mask", "el": this }); }); break; } } else if (typeof fn == "object") { opts = $.extend(true, {}, $.inputmask.defaults, fn); resolveAlias(opts.alias, fn, opts); //resolve aliases masksets = generateMaskSets(opts); if (masksets.length == 0) { return this; } return this.each(function () { maskScope($.extend(true, {}, masksets), activeMasksetIndex, opts, { "action": "mask", "el": this }); }); } else if (fn == undefined) { //look for data-inputmask atribute - the attribute should only contain optipns return this.each(function () { var attrOptions = $(this).attr("data-inputmask"); if (attrOptions && attrOptions != "") { try { attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'); var dataoptions = $.parseJSON("{" + attrOptions + "}"); $.extend(true, dataoptions, options); opts = $.extend(true, {}, $.inputmask.defaults, dataoptions); resolveAlias(opts.alias, dataoptions, opts); opts.alias = undefined; $(this).inputmask(opts); } catch (ex) { } //need a more relax parseJSON } }); } }; } })(jQuery); PK!lGLLphone-codes/readme.txtnu[more phone masks can be found at https://github.com/andr-04/inputmask-multi PK!h//phone-codes/phone-be.jsonnu[[ { "mask": "+32(53)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Aalst (Alost)" }, { "mask": "+32(3)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Antwerpen (Anvers)" }, { "mask": "+32(63)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Arlon" }, { "mask": "+32(67)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ath" }, { "mask": "+32(50)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Brugge (Bruges)" }, { "mask": "+32(2)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Brussel/Bruxelles (Brussels)" }, { "mask": "+32(71)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Charleroi" }, { "mask": "+32(60)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Chimay" }, { "mask": "+32(83)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ciney" }, { "mask": "+32(52)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Dendermonde" }, { "mask": "+32(13)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Diest" }, { "mask": "+32(82)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Dinant" }, { "mask": "+32(86)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Durbuy" }, { "mask": "+32(89)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Genk" }, { "mask": "+32(9)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Gent (Gand)" }, { "mask": "+32(11)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Hasselt" }, { "mask": "+32(14)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Herentals" }, { "mask": "+32(85)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Huy (Hoei)" }, { "mask": "+32(64)##-##-##", "cc": "BE", "cd": "Belgium", "city": "La Louvière" }, { "mask": "+32(16)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Leuven (Louvain)" }, { "mask": "+32(61)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Libramont" }, { "mask": "+32(4)###-##-##", "cc": "BE", "cd": "Belgium", "city": "Liège (Luik)" }, { "mask": "+32(15)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mechelen (Malines)" }, { "mask": "+32(47#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" }, { "mask": "+32(48#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" }, { "mask": "+32(49#)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mobile Phones" }, { "mask": "+32(65)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Mons (Bergen)" }, { "mask": "+32(81)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Namur (Namen)" }, { "mask": "+32(58)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Nieuwpoort (Nieuport)" }, { "mask": "+32(54)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ninove" }, { "mask": "+32(67)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Nivelles (Nijvel)" }, { "mask": "+32(59)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Oostende (Ostende)" }, { "mask": "+32(51)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Roeselare (Roulers)" }, { "mask": "+32(55)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Ronse" }, { "mask": "+32(80)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Stavelot" }, { "mask": "+32(12)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Tongeren (Tongres)" }, { "mask": "+32(69)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Tounai" }, { "mask": "+32(14)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Turnhout" }, { "mask": "+32(87)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Verviers" }, { "mask": "+32(58)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Veurne" }, { "mask": "+32(19)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Wareme" }, { "mask": "+32(10)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Wavre (Waver)" }, { "mask": "+32(50)##-##-##", "cc": "BE", "cd": "Belgium", "city": "Zeebrugge" } ]PK!aDDphone-codes/phone-codes.jsonnu[[ { "mask": "+247-####", "cc": "AC", "name_en": "Ascension", "desc_en": "", "name_ru": "Остров Вознесения", "desc_ru": "" }, { "mask": "+376-###-###", "cc": "AD", "name_en": "Andorra", "desc_en": "", "name_ru": "Андорра", "desc_ru": "" }, { "mask": "+971-5#-###-####", "cc": "AE", "name_en": "United Arab Emirates", "desc_en": "mobile", "name_ru": "Объединенные Арабские Эмираты", "desc_ru": "мобильные" }, { "mask": "+971-#-###-####", "cc": "AE", "name_en": "United Arab Emirates", "desc_en": "", "name_ru": "Объединенные Арабские Эмираты", "desc_ru": "" }, { "mask": "+93-##-###-####", "cc": "AF", "name_en": "Afghanistan", "desc_en": "", "name_ru": "Афганистан", "desc_ru": "" }, { "mask": "+1(268)###-####", "cc": "AG", "name_en": "Antigua & Barbuda", "desc_en": "", "name_ru": "Антигуа и Барбуда", "desc_ru": "" }, { "mask": "+1(264)###-####", "cc": "AI", "name_en": "Anguilla", "desc_en": "", "name_ru": "Ангилья", "desc_ru": "" }, { "mask": "+355(###)###-###", "cc": "AL", "name_en": "Albania", "desc_en": "", "name_ru": "Албания", "desc_ru": "" }, { "mask": "+374-##-###-###", "cc": "AM", "name_en": "Armenia", "desc_en": "", "name_ru": "Армения", "desc_ru": "" }, { "mask": "+599-###-####", "cc": "AN", "name_en": "Caribbean Netherlands", "desc_en": "", "name_ru": "Карибские Нидерланды", "desc_ru": "" }, { "mask": "+599-###-####", "cc": "AN", "name_en": "Netherlands Antilles", "desc_en": "", "name_ru": "Нидерландские Антильские острова", "desc_ru": "" }, { "mask": "+599-9###-####", "cc": "AN", "name_en": "Netherlands Antilles", "desc_en": "Curacao", "name_ru": "Нидерландские Антильские острова", "desc_ru": "Кюрасао" }, { "mask": "+244(###)###-###", "cc": "AO", "name_en": "Angola", "desc_en": "", "name_ru": "Ангола", "desc_ru": "" }, { "mask": "+672-1##-###", "cc": "AQ", "name_en": "Australian bases in Antarctica", "desc_en": "", "name_ru": "Австралийская антарктическая база", "desc_ru": "" }, { "mask": "+54(###)###-####", "cc": "AR", "name_en": "Argentina", "desc_en": "", "name_ru": "Аргентина", "desc_ru": "" }, { "mask": "+1(684)###-####", "cc": "AS", "name_en": "American Samoa", "desc_en": "", "name_ru": "Американское Самоа", "desc_ru": "" }, { "mask": "+43(###)###-####", "cc": "AT", "name_en": "Austria", "desc_en": "", "name_ru": "Австрия", "desc_ru": "" }, { "mask": "+61-#-####-####", "cc": "AU", "name_en": "Australia", "desc_en": "", "name_ru": "Австралия", "desc_ru": "" }, { "mask": "+297-###-####", "cc": "AW", "name_en": "Aruba", "desc_en": "", "name_ru": "Аруба", "desc_ru": "" }, { "mask": "+994-##-###-##-##", "cc": "AZ", "name_en": "Azerbaijan", "desc_en": "", "name_ru": "Азербайджан", "desc_ru": "" }, { "mask": "+387-##-#####", "cc": "BA", "name_en": "Bosnia and Herzegovina", "desc_en": "", "name_ru": "Босния и Герцеговина", "desc_ru": "" }, { "mask": "+387-##-####", "cc": "BA", "name_en": "Bosnia and Herzegovina", "desc_en": "", "name_ru": "Босния и Герцеговина", "desc_ru": "" }, { "mask": "+1(246)###-####", "cc": "BB", "name_en": "Barbados", "desc_en": "", "name_ru": "Барбадос", "desc_ru": "" }, { "mask": "+880-##-###-###", "cc": "BD", "name_en": "Bangladesh", "desc_en": "", "name_ru": "Бангладеш", "desc_ru": "" }, { "mask": "+32(###)###-###", "cc": "BE", "name_en": "Belgium", "desc_en": "", "name_ru": "Бельгия", "desc_ru": "" }, { "mask": "+226-##-##-####", "cc": "BF", "name_en": "Burkina Faso", "desc_en": "", "name_ru": "Буркина Фасо", "desc_ru": "" }, { "mask": "+359(###)###-###", "cc": "BG", "name_en": "Bulgaria", "desc_en": "", "name_ru": "Болгария", "desc_ru": "" }, { "mask": "+973-####-####", "cc": "BH", "name_en": "Bahrain", "desc_en": "", "name_ru": "Бахрейн", "desc_ru": "" }, { "mask": "+257-##-##-####", "cc": "BI", "name_en": "Burundi", "desc_en": "", "name_ru": "Бурунди", "desc_ru": "" }, { "mask": "+229-##-##-####", "cc": "BJ", "name_en": "Benin", "desc_en": "", "name_ru": "Бенин", "desc_ru": "" }, { "mask": "+1(441)###-####", "cc": "BM", "name_en": "Bermuda", "desc_en": "", "name_ru": "Бермудские острова", "desc_ru": "" }, { "mask": "+673-###-####", "cc": "BN", "name_en": "Brunei Darussalam", "desc_en": "", "name_ru": "Бруней-Даруссалам", "desc_ru": "" }, { "mask": "+591-#-###-####", "cc": "BO", "name_en": "Bolivia", "desc_en": "", "name_ru": "Боливия", "desc_ru": "" }, { "mask": "+55-##-####[#]-####", "cc": "BR", "name_en": "Brazil", "desc_en": "", "name_ru": "Бразилия", "desc_ru": "" }, { "mask": "+1(242)###-####", "cc": "BS", "name_en": "Bahamas", "desc_en": "", "name_ru": "Багамские Острова", "desc_ru": "" }, { "mask": "+975-17-###-###", "cc": "BT", "name_en": "Bhutan", "desc_en": "", "name_ru": "Бутан", "desc_ru": "" }, { "mask": "+975-#-###-###", "cc": "BT", "name_en": "Bhutan", "desc_en": "", "name_ru": "Бутан", "desc_ru": "" }, { "mask": "+267-##-###-###", "cc": "BW", "name_en": "Botswana", "desc_en": "", "name_ru": "Ботсвана", "desc_ru": "" }, { "mask": "+375(##)###-##-##", "cc": "BY", "name_en": "Belarus", "desc_en": "", "name_ru": "Беларусь (Белоруссия)", "desc_ru": "" }, { "mask": "+501-###-####", "cc": "BZ", "name_en": "Belize", "desc_en": "", "name_ru": "Белиз", "desc_ru": "" }, { "mask": "+243(###)###-###", "cc": "CD", "name_en": "Dem. Rep. Congo", "desc_en": "", "name_ru": "Дем. Респ. Конго (Киншаса)", "desc_ru": "" }, { "mask": "+236-##-##-####", "cc": "CF", "name_en": "Central African Republic", "desc_en": "", "name_ru": "Центральноафриканская Республика", "desc_ru": "" }, { "mask": "+242-##-###-####", "cc": "CG", "name_en": "Congo (Brazzaville)", "desc_en": "", "name_ru": "Конго (Браззавиль)", "desc_ru": "" }, { "mask": "+41-##-###-####", "cc": "CH", "name_en": "Switzerland", "desc_en": "", "name_ru": "Швейцария", "desc_ru": "" }, { "mask": "+225-##-###-###", "cc": "CI", "name_en": "Cote d’Ivoire (Ivory Coast)", "desc_en": "", "name_ru": "Кот-д’Ивуар", "desc_ru": "" }, { "mask": "+682-##-###", "cc": "CK", "name_en": "Cook Islands", "desc_en": "", "name_ru": "Острова Кука", "desc_ru": "" }, { "mask": "+56-#-####-####", "cc": "CL", "name_en": "Chile", "desc_en": "", "name_ru": "Чили", "desc_ru": "" }, { "mask": "+237-####-####", "cc": "CM", "name_en": "Cameroon", "desc_en": "", "name_ru": "Камерун", "desc_ru": "" }, { "mask": "+86(###)####-####", "cc": "CN", "name_en": "China (PRC)", "desc_en": "", "name_ru": "Китайская Н.Р.", "desc_ru": "" }, { "mask": "+86(###)####-###", "cc": "CN", "name_en": "China (PRC)", "desc_en": "", "name_ru": "Китайская Н.Р.", "desc_ru": "" }, { "mask": "+86-##-#####-#####", "cc": "CN", "name_en": "China (PRC)", "desc_en": "", "name_ru": "Китайская Н.Р.", "desc_ru": "" }, { "mask": "+57(###)###-####", "cc": "CO", "name_en": "Colombia", "desc_en": "", "name_ru": "Колумбия", "desc_ru": "" }, { "mask": "+506-####-####", "cc": "CR", "name_en": "Costa Rica", "desc_en": "", "name_ru": "Коста-Рика", "desc_ru": "" }, { "mask": "+53-#-###-####", "cc": "CU", "name_en": "Cuba", "desc_en": "", "name_ru": "Куба", "desc_ru": "" }, { "mask": "+238(###)##-##", "cc": "CV", "name_en": "Cape Verde", "desc_en": "", "name_ru": "Кабо-Верде", "desc_ru": "" }, { "mask": "+599-###-####", "cc": "CW", "name_en": "Curacao", "desc_en": "", "name_ru": "Кюрасао", "desc_ru": "" }, { "mask": "+357-##-###-###", "cc": "CY", "name_en": "Cyprus", "desc_en": "", "name_ru": "Кипр", "desc_ru": "" }, { "mask": "+420(###)###-###", "cc": "CZ", "name_en": "Czech Republic", "desc_en": "", "name_ru": "Чехия", "desc_ru": "" }, { "mask": "+49(####)###-####", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+49(###)###-####", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+49(###)##-####", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+49(###)##-###", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+49(###)##-##", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+49-###-###", "cc": "DE", "name_en": "Germany", "desc_en": "", "name_ru": "Германия", "desc_ru": "" }, { "mask": "+253-##-##-##-##", "cc": "DJ", "name_en": "Djibouti", "desc_en": "", "name_ru": "Джибути", "desc_ru": "" }, { "mask": "+45-##-##-##-##", "cc": "DK", "name_en": "Denmark", "desc_en": "", "name_ru": "Дания", "desc_ru": "" }, { "mask": "+1(767)###-####", "cc": "DM", "name_en": "Dominica", "desc_en": "", "name_ru": "Доминика", "desc_ru": "" }, { "mask": "+1(809)###-####", "cc": "DO", "name_en": "Dominican Republic", "desc_en": "", "name_ru": "Доминиканская Республика", "desc_ru": "" }, { "mask": "+1(829)###-####", "cc": "DO", "name_en": "Dominican Republic", "desc_en": "", "name_ru": "Доминиканская Республика", "desc_ru": "" }, { "mask": "+1(849)###-####", "cc": "DO", "name_en": "Dominican Republic", "desc_en": "", "name_ru": "Доминиканская Республика", "desc_ru": "" }, { "mask": "+213-##-###-####", "cc": "DZ", "name_en": "Algeria", "desc_en": "", "name_ru": "Алжир", "desc_ru": "" }, { "mask": "+593-##-###-####", "cc": "EC", "name_en": "Ecuador ", "desc_en": "mobile", "name_ru": "Эквадор ", "desc_ru": "мобильные" }, { "mask": "+593-#-###-####", "cc": "EC", "name_en": "Ecuador", "desc_en": "", "name_ru": "Эквадор", "desc_ru": "" }, { "mask": "+372-####-####", "cc": "EE", "name_en": "Estonia ", "desc_en": "mobile", "name_ru": "Эстония ", "desc_ru": "мобильные" }, { "mask": "+372-###-####", "cc": "EE", "name_en": "Estonia", "desc_en": "", "name_ru": "Эстония", "desc_ru": "" }, { "mask": "+20(###)###-####", "cc": "EG", "name_en": "Egypt", "desc_en": "", "name_ru": "Египет", "desc_ru": "" }, { "mask": "+291-#-###-###", "cc": "ER", "name_en": "Eritrea", "desc_en": "", "name_ru": "Эритрея", "desc_ru": "" }, { "mask": "+34(###)###-###", "cc": "ES", "name_en": "Spain", "desc_en": "", "name_ru": "Испания", "desc_ru": "" }, { "mask": "+251-##-###-####", "cc": "ET", "name_en": "Ethiopia", "desc_en": "", "name_ru": "Эфиопия", "desc_ru": "" }, { "mask": "+358(###)###-##-##", "cc": "FI", "name_en": "Finland", "desc_en": "", "name_ru": "Финляндия", "desc_ru": "" }, { "mask": "+679-##-#####", "cc": "FJ", "name_en": "Fiji", "desc_en": "", "name_ru": "Фиджи", "desc_ru": "" }, { "mask": "+500-#####", "cc": "FK", "name_en": "Falkland Islands", "desc_en": "", "name_ru": "Фолклендские острова", "desc_ru": "" }, { "mask": "+691-###-####", "cc": "FM", "name_en": "F.S. Micronesia", "desc_en": "", "name_ru": "Ф.Ш. Микронезии", "desc_ru": "" }, { "mask": "+298-###-###", "cc": "FO", "name_en": "Faroe Islands", "desc_en": "", "name_ru": "Фарерские острова", "desc_ru": "" }, { "mask": "+262-#####-####", "cc": "FR", "name_en": "Mayotte", "desc_en": "", "name_ru": "Майотта", "desc_ru": "" }, { "mask": "+33(###)###-###", "cc": "FR", "name_en": "France", "desc_en": "", "name_ru": "Франция", "desc_ru": "" }, { "mask": "+508-##-####", "cc": "FR", "name_en": "St Pierre & Miquelon", "desc_en": "", "name_ru": "Сен-Пьер и Микелон", "desc_ru": "" }, { "mask": "+590(###)###-###", "cc": "FR", "name_en": "Guadeloupe", "desc_en": "", "name_ru": "Гваделупа", "desc_ru": "" }, { "mask": "+241-#-##-##-##", "cc": "GA", "name_en": "Gabon", "desc_en": "", "name_ru": "Габон", "desc_ru": "" }, { "mask": "+1(473)###-####", "cc": "GD", "name_en": "Grenada", "desc_en": "", "name_ru": "Гренада", "desc_ru": "" }, { "mask": "+995(###)###-###", "cc": "GE", "name_en": "Rep. of Georgia", "desc_en": "", "name_ru": "Грузия", "desc_ru": "" }, { "mask": "+594-#####-####", "cc": "GF", "name_en": "Guiana (French)", "desc_en": "", "name_ru": "Фр. Гвиана", "desc_ru": "" }, { "mask": "+233(###)###-###", "cc": "GH", "name_en": "Ghana", "desc_en": "", "name_ru": "Гана", "desc_ru": "" }, { "mask": "+350-###-#####", "cc": "GI", "name_en": "Gibraltar", "desc_en": "", "name_ru": "Гибралтар", "desc_ru": "" }, { "mask": "+299-##-##-##", "cc": "GL", "name_en": "Greenland", "desc_en": "", "name_ru": "Гренландия", "desc_ru": "" }, { "mask": "+220(###)##-##", "cc": "GM", "name_en": "Gambia", "desc_en": "", "name_ru": "Гамбия", "desc_ru": "" }, { "mask": "+224-##-###-###", "cc": "GN", "name_en": "Guinea", "desc_en": "", "name_ru": "Гвинея", "desc_ru": "" }, { "mask": "+240-##-###-####", "cc": "GQ", "name_en": "Equatorial Guinea", "desc_en": "", "name_ru": "Экваториальная Гвинея", "desc_ru": "" }, { "mask": "+30(###)###-####", "cc": "GR", "name_en": "Greece", "desc_en": "", "name_ru": "Греция", "desc_ru": "" }, { "mask": "+502-#-###-####", "cc": "GT", "name_en": "Guatemala", "desc_en": "", "name_ru": "Гватемала", "desc_ru": "" }, { "mask": "+1(671)###-####", "cc": "GU", "name_en": "Guam", "desc_en": "", "name_ru": "Гуам", "desc_ru": "" }, { "mask": "+245-#-######", "cc": "GW", "name_en": "Guinea-Bissau", "desc_en": "", "name_ru": "Гвинея-Бисау", "desc_ru": "" }, { "mask": "+592-###-####", "cc": "GY", "name_en": "Guyana", "desc_en": "", "name_ru": "Гайана", "desc_ru": "" }, { "mask": "+852-####-####", "cc": "HK", "name_en": "Hong Kong", "desc_en": "", "name_ru": "Гонконг", "desc_ru": "" }, { "mask": "+504-####-####", "cc": "HN", "name_en": "Honduras", "desc_en": "", "name_ru": "Гондурас", "desc_ru": "" }, { "mask": "+385-##-###-###", "cc": "HR", "name_en": "Croatia", "desc_en": "", "name_ru": "Хорватия", "desc_ru": "" }, { "mask": "+509-##-##-####", "cc": "HT", "name_en": "Haiti", "desc_en": "", "name_ru": "Гаити", "desc_ru": "" }, { "mask": "+36(###)###-###", "cc": "HU", "name_en": "Hungary", "desc_en": "", "name_ru": "Венгрия", "desc_ru": "" }, { "mask": "+62(8##)###-####", "cc": "ID", "name_en": "Indonesia ", "desc_en": "mobile", "name_ru": "Индонезия ", "desc_ru": "мобильные" }, { "mask": "+62-##-###-##", "cc": "ID", "name_en": "Indonesia", "desc_en": "", "name_ru": "Индонезия", "desc_ru": "" }, { "mask": "+62-##-###-###", "cc": "ID", "name_en": "Indonesia", "desc_en": "", "name_ru": "Индонезия", "desc_ru": "" }, { "mask": "+62-##-###-####", "cc": "ID", "name_en": "Indonesia", "desc_en": "", "name_ru": "Индонезия", "desc_ru": "" }, { "mask": "+62(8##)###-###", "cc": "ID", "name_en": "Indonesia ", "desc_en": "mobile", "name_ru": "Индонезия ", "desc_ru": "мобильные" }, { "mask": "+62(8##)###-##-###", "cc": "ID", "name_en": "Indonesia ", "desc_en": "mobile", "name_ru": "Индонезия ", "desc_ru": "мобильные" }, { "mask": "+353(###)###-###", "cc": "IE", "name_en": "Ireland", "desc_en": "", "name_ru": "Ирландия", "desc_ru": "" }, { "mask": "+972-5#-###-####", "cc": "IL", "name_en": "Israel ", "desc_en": "mobile", "name_ru": "Израиль ", "desc_ru": "мобильные" }, { "mask": "+972-#-###-####", "cc": "IL", "name_en": "Israel", "desc_en": "", "name_ru": "Израиль", "desc_ru": "" }, { "mask": "+91(####)###-###", "cc": "IN", "name_en": "India", "desc_en": "", "name_ru": "Индия", "desc_ru": "" }, { "mask": "+246-###-####", "cc": "IO", "name_en": "Diego Garcia", "desc_en": "", "name_ru": "Диего-Гарсия", "desc_ru": "" }, { "mask": "+964(###)###-####", "cc": "IQ", "name_en": "Iraq", "desc_en": "", "name_ru": "Ирак", "desc_ru": "" }, { "mask": "+98(###)###-####", "cc": "IR", "name_en": "Iran", "desc_en": "", "name_ru": "Иран", "desc_ru": "" }, { "mask": "+354-###-####", "cc": "IS", "name_en": "Iceland", "desc_en": "", "name_ru": "Исландия", "desc_ru": "" }, { "mask": "+39(###)####-###", "cc": "IT", "name_en": "Italy", "desc_en": "", "name_ru": "Италия", "desc_ru": "" }, { "mask": "+1(876)###-####", "cc": "JM", "name_en": "Jamaica", "desc_en": "", "name_ru": "Ямайка", "desc_ru": "" }, { "mask": "+962-#-####-####", "cc": "JO", "name_en": "Jordan", "desc_en": "", "name_ru": "Иордания", "desc_ru": "" }, { "mask": "+81-##-####-####", "cc": "JP", "name_en": "Japan ", "desc_en": "mobile", "name_ru": "Япония ", "desc_ru": "мобильные" }, { "mask": "+81(###)###-###", "cc": "JP", "name_en": "Japan", "desc_en": "", "name_ru": "Япония", "desc_ru": "" }, { "mask": "+254-###-######", "cc": "KE", "name_en": "Kenya", "desc_en": "", "name_ru": "Кения", "desc_ru": "" }, { "mask": "+996(###)###-###", "cc": "KG", "name_en": "Kyrgyzstan", "desc_en": "", "name_ru": "Киргизия", "desc_ru": "" }, { "mask": "+855-##-###-###", "cc": "KH", "name_en": "Cambodia", "desc_en": "", "name_ru": "Камбоджа", "desc_ru": "" }, { "mask": "+686-##-###", "cc": "KI", "name_en": "Kiribati", "desc_en": "", "name_ru": "Кирибати", "desc_ru": "" }, { "mask": "+269-##-#####", "cc": "KM", "name_en": "Comoros", "desc_en": "", "name_ru": "Коморы", "desc_ru": "" }, { "mask": "+1(869)###-####", "cc": "KN", "name_en": "Saint Kitts & Nevis", "desc_en": "", "name_ru": "Сент-Китс и Невис", "desc_ru": "" }, { "mask": "+850-191-###-####", "cc": "KP", "name_en": "DPR Korea (North) ", "desc_en": "mobile", "name_ru": "Корейская НДР ", "desc_ru": "мобильные" }, { "mask": "+850-##-###-###", "cc": "KP", "name_en": "DPR Korea (North)", "desc_en": "", "name_ru": "Корейская НДР", "desc_ru": "" }, { "mask": "+850-###-####-###", "cc": "KP", "name_en": "DPR Korea (North)", "desc_en": "", "name_ru": "Корейская НДР", "desc_ru": "" }, { "mask": "+850-###-###", "cc": "KP", "name_en": "DPR Korea (North)", "desc_en": "", "name_ru": "Корейская НДР", "desc_ru": "" }, { "mask": "+850-####-####", "cc": "KP", "name_en": "DPR Korea (North)", "desc_en": "", "name_ru": "Корейская НДР", "desc_ru": "" }, { "mask": "+850-####-#############", "cc": "KP", "name_en": "DPR Korea (North)", "desc_en": "", "name_ru": "Корейская НДР", "desc_ru": "" }, { "mask": "+82-##-###-####", "cc": "KR", "name_en": "Korea (South)", "desc_en": "", "name_ru": "Респ. Корея", "desc_ru": "" }, { "mask": "+965-####-####", "cc": "KW", "name_en": "Kuwait", "desc_en": "", "name_ru": "Кувейт", "desc_ru": "" }, { "mask": "+1(345)###-####", "cc": "KY", "name_en": "Cayman Islands", "desc_en": "", "name_ru": "Каймановы острова", "desc_ru": "" }, { "mask": "+7(6##)###-##-##", "cc": "KZ", "name_en": "Kazakhstan", "desc_en": "", "name_ru": "Казахстан", "desc_ru": "" }, { "mask": "+7(7##)###-##-##", "cc": "KZ", "name_en": "Kazakhstan", "desc_en": "", "name_ru": "Казахстан", "desc_ru": "" }, { "mask": "+856(20##)###-###", "cc": "LA", "name_en": "Laos ", "desc_en": "mobile", "name_ru": "Лаос ", "desc_ru": "мобильные" }, { "mask": "+856-##-###-###", "cc": "LA", "name_en": "Laos", "desc_en": "", "name_ru": "Лаос", "desc_ru": "" }, { "mask": "+961-##-###-###", "cc": "LB", "name_en": "Lebanon ", "desc_en": "mobile", "name_ru": "Ливан ", "desc_ru": "мобильные" }, { "mask": "+961-#-###-###", "cc": "LB", "name_en": "Lebanon", "desc_en": "", "name_ru": "Ливан", "desc_ru": "" }, { "mask": "+1(758)###-####", "cc": "LC", "name_en": "Saint Lucia", "desc_en": "", "name_ru": "Сент-Люсия", "desc_ru": "" }, { "mask": "+423(###)###-####", "cc": "LI", "name_en": "Liechtenstein", "desc_en": "", "name_ru": "Лихтенштейн", "desc_ru": "" }, { "mask": "+94-##-###-####", "cc": "LK", "name_en": "Sri Lanka", "desc_en": "", "name_ru": "Шри-Ланка", "desc_ru": "" }, { "mask": "+231-##-###-###", "cc": "LR", "name_en": "Liberia", "desc_en": "", "name_ru": "Либерия", "desc_ru": "" }, { "mask": "+266-#-###-####", "cc": "LS", "name_en": "Lesotho", "desc_en": "", "name_ru": "Лесото", "desc_ru": "" }, { "mask": "+370(###)##-###", "cc": "LT", "name_en": "Lithuania", "desc_en": "", "name_ru": "Литва", "desc_ru": "" }, { "mask": "+352(###)###-###", "cc": "LU", "name_en": "Luxembourg", "desc_en": "", "name_ru": "Люксембург", "desc_ru": "" }, { "mask": "+371-##-###-###", "cc": "LV", "name_en": "Latvia", "desc_en": "", "name_ru": "Латвия", "desc_ru": "" }, { "mask": "+218-##-###-###", "cc": "LY", "name_en": "Libya", "desc_en": "", "name_ru": "Ливия", "desc_ru": "" }, { "mask": "+218-21-###-####", "cc": "LY", "name_en": "Libya", "desc_en": "Tripoli", "name_ru": "Ливия", "desc_ru": "Триполи" }, { "mask": "+212-##-####-###", "cc": "MA", "name_en": "Morocco", "desc_en": "", "name_ru": "Марокко", "desc_ru": "" }, { "mask": "+377(###)###-###", "cc": "MC", "name_en": "Monaco", "desc_en": "", "name_ru": "Монако", "desc_ru": "" }, { "mask": "+377-##-###-###", "cc": "MC", "name_en": "Monaco", "desc_en": "", "name_ru": "Монако", "desc_ru": "" }, { "mask": "+373-####-####", "cc": "MD", "name_en": "Moldova", "desc_en": "", "name_ru": "Молдова", "desc_ru": "" }, { "mask": "+382-##-###-###", "cc": "ME", "name_en": "Montenegro", "desc_en": "", "name_ru": "Черногория", "desc_ru": "" }, { "mask": "+261-##-##-#####", "cc": "MG", "name_en": "Madagascar", "desc_en": "", "name_ru": "Мадагаскар", "desc_ru": "" }, { "mask": "+692-###-####", "cc": "MH", "name_en": "Marshall Islands", "desc_en": "", "name_ru": "Маршалловы Острова", "desc_ru": "" }, { "mask": "+389-##-###-###", "cc": "MK", "name_en": "Republic of Macedonia", "desc_en": "", "name_ru": "Респ. Македония", "desc_ru": "" }, { "mask": "+223-##-##-####", "cc": "ML", "name_en": "Mali", "desc_en": "", "name_ru": "Мали", "desc_ru": "" }, { "mask": "+95-##-###-###", "cc": "MM", "name_en": "Burma (Myanmar)", "desc_en": "", "name_ru": "Бирма (Мьянма)", "desc_ru": "" }, { "mask": "+95-#-###-###", "cc": "MM", "name_en": "Burma (Myanmar)", "desc_en": "", "name_ru": "Бирма (Мьянма)", "desc_ru": "" }, { "mask": "+95-###-###", "cc": "MM", "name_en": "Burma (Myanmar)", "desc_en": "", "name_ru": "Бирма (Мьянма)", "desc_ru": "" }, { "mask": "+976-##-##-####", "cc": "MN", "name_en": "Mongolia", "desc_en": "", "name_ru": "Монголия", "desc_ru": "" }, { "mask": "+853-####-####", "cc": "MO", "name_en": "Macau", "desc_en": "", "name_ru": "Макао", "desc_ru": "" }, { "mask": "+1(670)###-####", "cc": "MP", "name_en": "Northern Mariana Islands", "desc_en": "", "name_ru": "Северные Марианские острова Сайпан", "desc_ru": "" }, { "mask": "+596(###)##-##-##", "cc": "MQ", "name_en": "Martinique", "desc_en": "", "name_ru": "Мартиника", "desc_ru": "" }, { "mask": "+222-##-##-####", "cc": "MR", "name_en": "Mauritania", "desc_en": "", "name_ru": "Мавритания", "desc_ru": "" }, { "mask": "+1(664)###-####", "cc": "MS", "name_en": "Montserrat", "desc_en": "", "name_ru": "Монтсеррат", "desc_ru": "" }, { "mask": "+356-####-####", "cc": "MT", "name_en": "Malta", "desc_en": "", "name_ru": "Мальта", "desc_ru": "" }, { "mask": "+230-###-####", "cc": "MU", "name_en": "Mauritius", "desc_en": "", "name_ru": "Маврикий", "desc_ru": "" }, { "mask": "+960-###-####", "cc": "MV", "name_en": "Maldives", "desc_en": "", "name_ru": "Мальдивские острова", "desc_ru": "" }, { "mask": "+265-1-###-###", "cc": "MW", "name_en": "Malawi", "desc_en": "Telecom Ltd", "name_ru": "Малави", "desc_ru": "Telecom Ltd" }, { "mask": "+265-#-####-####", "cc": "MW", "name_en": "Malawi", "desc_en": "", "name_ru": "Малави", "desc_ru": "" }, { "mask": "+52(###)###-####", "cc": "MX", "name_en": "Mexico", "desc_en": "", "name_ru": "Мексика", "desc_ru": "" }, { "mask": "+52-##-##-####", "cc": "MX", "name_en": "Mexico", "desc_en": "", "name_ru": "Мексика", "desc_ru": "" }, { "mask": "+60-##-###-####", "cc": "MY", "name_en": "Malaysia ", "desc_en": "mobile", "name_ru": "Малайзия ", "desc_ru": "мобильные" }, { "mask": "+60(###)###-###", "cc": "MY", "name_en": "Malaysia", "desc_en": "", "name_ru": "Малайзия", "desc_ru": "" }, { "mask": "+60-##-###-###", "cc": "MY", "name_en": "Malaysia", "desc_en": "", "name_ru": "Малайзия", "desc_ru": "" }, { "mask": "+60-#-###-###", "cc": "MY", "name_en": "Malaysia", "desc_en": "", "name_ru": "Малайзия", "desc_ru": "" }, { "mask": "+258-##-###-###", "cc": "MZ", "name_en": "Mozambique", "desc_en": "", "name_ru": "Мозамбик", "desc_ru": "" }, { "mask": "+264-##-###-####", "cc": "NA", "name_en": "Namibia", "desc_en": "", "name_ru": "Намибия", "desc_ru": "" }, { "mask": "+687-##-####", "cc": "NC", "name_en": "New Caledonia", "desc_en": "", "name_ru": "Новая Каледония", "desc_ru": "" }, { "mask": "+227-##-##-####", "cc": "NE", "name_en": "Niger", "desc_en": "", "name_ru": "Нигер", "desc_ru": "" }, { "mask": "+672-3##-###", "cc": "NF", "name_en": "Norfolk Island", "desc_en": "", "name_ru": "Норфолк (остров)", "desc_ru": "" }, { "mask": "+234(###)###-####", "cc": "NG", "name_en": "Nigeria", "desc_en": "", "name_ru": "Нигерия", "desc_ru": "" }, { "mask": "+234-##-###-###", "cc": "NG", "name_en": "Nigeria", "desc_en": "", "name_ru": "Нигерия", "desc_ru": "" }, { "mask": "+234-##-###-##", "cc": "NG", "name_en": "Nigeria", "desc_en": "", "name_ru": "Нигерия", "desc_ru": "" }, { "mask": "+234(###)###-####", "cc": "NG", "name_en": "Nigeria ", "desc_en": "mobile", "name_ru": "Нигерия ", "desc_ru": "мобильные" }, { "mask": "+505-####-####", "cc": "NI", "name_en": "Nicaragua", "desc_en": "", "name_ru": "Никарагуа", "desc_ru": "" }, { "mask": "+31-##-###-####", "cc": "NL", "name_en": "Netherlands", "desc_en": "", "name_ru": "Нидерланды", "desc_ru": "" }, { "mask": "+47(###)##-###", "cc": "NO", "name_en": "Norway", "desc_en": "", "name_ru": "Норвегия", "desc_ru": "" }, { "mask": "+977-##-###-###", "cc": "NP", "name_en": "Nepal", "desc_en": "", "name_ru": "Непал", "desc_ru": "" }, { "mask": "+674-###-####", "cc": "NR", "name_en": "Nauru", "desc_en": "", "name_ru": "Науру", "desc_ru": "" }, { "mask": "+683-####", "cc": "NU", "name_en": "Niue", "desc_en": "", "name_ru": "Ниуэ", "desc_ru": "" }, { "mask": "+64(###)###-###", "cc": "NZ", "name_en": "New Zealand", "desc_en": "", "name_ru": "Новая Зеландия", "desc_ru": "" }, { "mask": "+64-##-###-###", "cc": "NZ", "name_en": "New Zealand", "desc_en": "", "name_ru": "Новая Зеландия", "desc_ru": "" }, { "mask": "+64(###)###-####", "cc": "NZ", "name_en": "New Zealand", "desc_en": "", "name_ru": "Новая Зеландия", "desc_ru": "" }, { "mask": "+968-##-###-###", "cc": "OM", "name_en": "Oman", "desc_en": "", "name_ru": "Оман", "desc_ru": "" }, { "mask": "+507-###-####", "cc": "PA", "name_en": "Panama", "desc_en": "", "name_ru": "Панама", "desc_ru": "" }, { "mask": "+51(###)###-###", "cc": "PE", "name_en": "Peru", "desc_en": "", "name_ru": "Перу", "desc_ru": "" }, { "mask": "+689-##-##-##", "cc": "PF", "name_en": "French Polynesia", "desc_en": "", "name_ru": "Французская Полинезия (Таити)", "desc_ru": "" }, { "mask": "+675(###)##-###", "cc": "PG", "name_en": "Papua New Guinea", "desc_en": "", "name_ru": "Папуа-Новая Гвинея", "desc_ru": "" }, { "mask": "+63(###)###-####", "cc": "PH", "name_en": "Philippines", "desc_en": "", "name_ru": "Филиппины", "desc_ru": "" }, { "mask": "+92(###)###-####", "cc": "PK", "name_en": "Pakistan", "desc_en": "", "name_ru": "Пакистан", "desc_ru": "" }, { "mask": "+48(###)###-###", "cc": "PL", "name_en": "Poland", "desc_en": "", "name_ru": "Польша", "desc_ru": "" }, { "mask": "+970-##-###-####", "cc": "PS", "name_en": "Palestine", "desc_en": "", "name_ru": "Палестина", "desc_ru": "" }, { "mask": "+351-##-###-####", "cc": "PT", "name_en": "Portugal", "desc_en": "", "name_ru": "Португалия", "desc_ru": "" }, { "mask": "+680-###-####", "cc": "PW", "name_en": "Palau", "desc_en": "", "name_ru": "Палау", "desc_ru": "" }, { "mask": "+595(###)###-###", "cc": "PY", "name_en": "Paraguay", "desc_en": "", "name_ru": "Парагвай", "desc_ru": "" }, { "mask": "+974-####-####", "cc": "QA", "name_en": "Qatar", "desc_en": "", "name_ru": "Катар", "desc_ru": "" }, { "mask": "+262-#####-####", "cc": "RE", "name_en": "Reunion", "desc_en": "", "name_ru": "Реюньон", "desc_ru": "" }, { "mask": "+40-##-###-####", "cc": "RO", "name_en": "Romania", "desc_en": "", "name_ru": "Румыния", "desc_ru": "" }, { "mask": "+381-##-###-####", "cc": "RS", "name_en": "Serbia", "desc_en": "", "name_ru": "Сербия", "desc_ru": "" }, { "mask": "+7(###)###-##-##", "cc": "RU", "name_en": "Russia", "desc_en": "", "name_ru": "Россия", "desc_ru": "" }, { "mask": "+250(###)###-###", "cc": "RW", "name_en": "Rwanda", "desc_en": "", "name_ru": "Руанда", "desc_ru": "" }, { "mask": "+966-5-####-####", "cc": "SA", "name_en": "Saudi Arabia ", "desc_en": "mobile", "name_ru": "Саудовская Аравия ", "desc_ru": "мобильные" }, { "mask": "+966-#-###-####", "cc": "SA", "name_en": "Saudi Arabia", "desc_en": "", "name_ru": "Саудовская Аравия", "desc_ru": "" }, { "mask": "+677-###-####", "cc": "SB", "name_en": "Solomon Islands ", "desc_en": "mobile", "name_ru": "Соломоновы Острова ", "desc_ru": "мобильные" }, { "mask": "+677-#####", "cc": "SB", "name_en": "Solomon Islands", "desc_en": "", "name_ru": "Соломоновы Острова", "desc_ru": "" }, { "mask": "+248-#-###-###", "cc": "SC", "name_en": "Seychelles", "desc_en": "", "name_ru": "Сейшелы", "desc_ru": "" }, { "mask": "+249-##-###-####", "cc": "SD", "name_en": "Sudan", "desc_en": "", "name_ru": "Судан", "desc_ru": "" }, { "mask": "+46-##-###-####", "cc": "SE", "name_en": "Sweden", "desc_en": "", "name_ru": "Швеция", "desc_ru": "" }, { "mask": "+65-####-####", "cc": "SG", "name_en": "Singapore", "desc_en": "", "name_ru": "Сингапур", "desc_ru": "" }, { "mask": "+290-####", "cc": "SH", "name_en": "Saint Helena", "desc_en": "", "name_ru": "Остров Святой Елены", "desc_ru": "" }, { "mask": "+290-####", "cc": "SH", "name_en": "Tristan da Cunha", "desc_en": "", "name_ru": "Тристан-да-Кунья", "desc_ru": "" }, { "mask": "+386-##-###-###", "cc": "SI", "name_en": "Slovenia", "desc_en": "", "name_ru": "Словения", "desc_ru": "" }, { "mask": "+421(###)###-###", "cc": "SK", "name_en": "Slovakia", "desc_en": "", "name_ru": "Словакия", "desc_ru": "" }, { "mask": "+232-##-######", "cc": "SL", "name_en": "Sierra Leone", "desc_en": "", "name_ru": "Сьерра-Леоне", "desc_ru": "" }, { "mask": "+378-####-######", "cc": "SM", "name_en": "San Marino", "desc_en": "", "name_ru": "Сан-Марино", "desc_ru": "" }, { "mask": "+221-##-###-####", "cc": "SN", "name_en": "Senegal", "desc_en": "", "name_ru": "Сенегал", "desc_ru": "" }, { "mask": "+252-##-###-###", "cc": "SO", "name_en": "Somalia", "desc_en": "", "name_ru": "Сомали", "desc_ru": "" }, { "mask": "+252-#-###-###", "cc": "SO", "name_en": "Somalia", "desc_en": "", "name_ru": "Сомали", "desc_ru": "" }, { "mask": "+252-#-###-###", "cc": "SO", "name_en": "Somalia ", "desc_en": "mobile", "name_ru": "Сомали ", "desc_ru": "мобильные" }, { "mask": "+597-###-####", "cc": "SR", "name_en": "Suriname ", "desc_en": "mobile", "name_ru": "Суринам ", "desc_ru": "мобильные" }, { "mask": "+597-###-###", "cc": "SR", "name_en": "Suriname", "desc_en": "", "name_ru": "Суринам", "desc_ru": "" }, { "mask": "+211-##-###-####", "cc": "SS", "name_en": "South Sudan", "desc_en": "", "name_ru": "Южный Судан", "desc_ru": "" }, { "mask": "+239-##-#####", "cc": "ST", "name_en": "Sao Tome and Principe", "desc_en": "", "name_ru": "Сан-Томе и Принсипи", "desc_ru": "" }, { "mask": "+503-##-##-####", "cc": "SV", "name_en": "El Salvador", "desc_en": "", "name_ru": "Сальвадор", "desc_ru": "" }, { "mask": "+1(721)###-####", "cc": "SX", "name_en": "Sint Maarten", "desc_en": "", "name_ru": "Синт-Маартен", "desc_ru": "" }, { "mask": "+963-##-####-###", "cc": "SY", "name_en": "Syrian Arab Republic", "desc_en": "", "name_ru": "Сирийская арабская республика", "desc_ru": "" }, { "mask": "+268-##-##-####", "cc": "SZ", "name_en": "Swaziland", "desc_en": "", "name_ru": "Свазиленд", "desc_ru": "" }, { "mask": "+1(649)###-####", "cc": "TC", "name_en": "Turks & Caicos", "desc_en": "", "name_ru": "Тёркс и Кайкос", "desc_ru": "" }, { "mask": "+235-##-##-##-##", "cc": "TD", "name_en": "Chad", "desc_en": "", "name_ru": "Чад", "desc_ru": "" }, { "mask": "+228-##-###-###", "cc": "TG", "name_en": "Togo", "desc_en": "", "name_ru": "Того", "desc_ru": "" }, { "mask": "+66-##-###-####", "cc": "TH", "name_en": "Thailand ", "desc_en": "mobile", "name_ru": "Таиланд ", "desc_ru": "мобильные" }, { "mask": "+66-##-###-###", "cc": "TH", "name_en": "Thailand", "desc_en": "", "name_ru": "Таиланд", "desc_ru": "" }, { "mask": "+992-##-###-####", "cc": "TJ", "name_en": "Tajikistan", "desc_en": "", "name_ru": "Таджикистан", "desc_ru": "" }, { "mask": "+690-####", "cc": "TK", "name_en": "Tokelau", "desc_en": "", "name_ru": "Токелау", "desc_ru": "" }, { "mask": "+670-###-####", "cc": "TL", "name_en": "East Timor", "desc_en": "", "name_ru": "Восточный Тимор", "desc_ru": "" }, { "mask": "+670-77#-#####", "cc": "TL", "name_en": "East Timor", "desc_en": "Timor Telecom", "name_ru": "Восточный Тимор", "desc_ru": "Timor Telecom" }, { "mask": "+670-78#-#####", "cc": "TL", "name_en": "East Timor", "desc_en": "Timor Telecom", "name_ru": "Восточный Тимор", "desc_ru": "Timor Telecom" }, { "mask": "+993-#-###-####", "cc": "TM", "name_en": "Turkmenistan", "desc_en": "", "name_ru": "Туркменистан", "desc_ru": "" }, { "mask": "+216-##-###-###", "cc": "TN", "name_en": "Tunisia", "desc_en": "", "name_ru": "Тунис", "desc_ru": "" }, { "mask": "+676-#####", "cc": "TO", "name_en": "Tonga", "desc_en": "", "name_ru": "Тонга", "desc_ru": "" }, { "mask": "+90(###)###-####", "cc": "TR", "name_en": "Turkey", "desc_en": "", "name_ru": "Турция", "desc_ru": "" }, { "mask": "+1(868)###-####", "cc": "TT", "name_en": "Trinidad & Tobago", "desc_en": "", "name_ru": "Тринидад и Тобаго", "desc_ru": "" }, { "mask": "+688-90####", "cc": "TV", "name_en": "Tuvalu ", "desc_en": "mobile", "name_ru": "Тувалу ", "desc_ru": "мобильные" }, { "mask": "+688-2####", "cc": "TV", "name_en": "Tuvalu", "desc_en": "", "name_ru": "Тувалу", "desc_ru": "" }, { "mask": "+886-#-####-####", "cc": "TW", "name_en": "Taiwan", "desc_en": "", "name_ru": "Тайвань", "desc_ru": "" }, { "mask": "+886-####-####", "cc": "TW", "name_en": "Taiwan", "desc_en": "", "name_ru": "Тайвань", "desc_ru": "" }, { "mask": "+255-##-###-####", "cc": "TZ", "name_en": "Tanzania", "desc_en": "", "name_ru": "Танзания", "desc_ru": "" }, { "mask": "+380(##)###-##-##", "cc": "UA", "name_en": "Ukraine", "desc_en": "", "name_ru": "Украина", "desc_ru": "" }, { "mask": "+256(###)###-###", "cc": "UG", "name_en": "Uganda", "desc_en": "", "name_ru": "Уганда", "desc_ru": "" }, { "mask": "+44-##-####-####", "cc": "UK", "name_en": "United Kingdom", "desc_en": "", "name_ru": "Великобритания", "desc_ru": "" }, { "mask": "+598-#-###-##-##", "cc": "UY", "name_en": "Uruguay", "desc_en": "", "name_ru": "Уругвай", "desc_ru": "" }, { "mask": "+998-##-###-####", "cc": "UZ", "name_en": "Uzbekistan", "desc_en": "", "name_ru": "Узбекистан", "desc_ru": "" }, { "mask": "+39-6-698-#####", "cc": "VA", "name_en": "Vatican City", "desc_en": "", "name_ru": "Ватикан", "desc_ru": "" }, { "mask": "+1(784)###-####", "cc": "VC", "name_en": "Saint Vincent & the Grenadines", "desc_en": "", "name_ru": "Сент-Винсент и Гренадины", "desc_ru": "" }, { "mask": "+58(###)###-####", "cc": "VE", "name_en": "Venezuela", "desc_en": "", "name_ru": "Венесуэла", "desc_ru": "" }, { "mask": "+1(284)###-####", "cc": "VG", "name_en": "British Virgin Islands", "desc_en": "", "name_ru": "Британские Виргинские острова", "desc_ru": "" }, { "mask": "+1(340)###-####", "cc": "VI", "name_en": "US Virgin Islands", "desc_en": "", "name_ru": "Американские Виргинские острова", "desc_ru": "" }, { "mask": "+84-##-####-###", "cc": "VN", "name_en": "Vietnam", "desc_en": "", "name_ru": "Вьетнам", "desc_ru": "" }, { "mask": "+84(###)####-###", "cc": "VN", "name_en": "Vietnam", "desc_en": "", "name_ru": "Вьетнам", "desc_ru": "" }, { "mask": "+678-##-#####", "cc": "VU", "name_en": "Vanuatu ", "desc_en": "mobile", "name_ru": "Вануату ", "desc_ru": "мобильные" }, { "mask": "+678-#####", "cc": "VU", "name_en": "Vanuatu", "desc_en": "", "name_ru": "Вануату", "desc_ru": "" }, { "mask": "+681-##-####", "cc": "WF", "name_en": "Wallis and Futuna", "desc_en": "", "name_ru": "Уоллис и Футуна", "desc_ru": "" }, { "mask": "+685-##-####", "cc": "WS", "name_en": "Samoa", "desc_en": "", "name_ru": "Самоа", "desc_ru": "" }, { "mask": "+967-###-###-###", "cc": "YE", "name_en": "Yemen ", "desc_en": "mobile", "name_ru": "Йемен ", "desc_ru": "мобильные" }, { "mask": "+967-#-###-###", "cc": "YE", "name_en": "Yemen", "desc_en": "", "name_ru": "Йемен", "desc_ru": "" }, { "mask": "+967-##-###-###", "cc": "YE", "name_en": "Yemen", "desc_en": "", "name_ru": "Йемен", "desc_ru": "" }, { "mask": "+27-##-###-####", "cc": "ZA", "name_en": "South Africa", "desc_en": "", "name_ru": "Южно-Африканская Респ.", "desc_ru": "" }, { "mask": "+260-##-###-####", "cc": "ZM", "name_en": "Zambia", "desc_en": "", "name_ru": "Замбия", "desc_ru": "" }, { "mask": "+263-#-######", "cc": "ZW", "name_en": "Zimbabwe", "desc_en": "", "name_ru": "Зимбабве", "desc_ru": "" }, { "mask": "+1(###)###-####", "cc": ["US", "CA"], "name_en": "USA and Canada", "desc_en": "", "name_ru": "США и Канада", "desc_ru": "" } ] PK!{\ٰ$$$jquery.inputmask.regex.extensions.jsnu[/* Input Mask plugin extensions 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: 0.0.0 Regex extensions on the jquery.inputmask base Allows for using regular expressions as a mask */ (function ($) { $.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"} 'Regex': { mask: "r", greedy: false, repeat: "*", regex: null, regexTokens: null, //Thx to https://github.com/slevithan/regex-colorizer for the tokenizer regex 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 (chrs, buffer, pos, strict, opts) { function regexToken() { this.matches = []; this.isGroup = false; this.isQuantifier = false; this.isLiteral = false; } function analyseRegex() { var currentToken = new regexToken(), match, m, opengroups = []; opts.regexTokens = []; // The tokenizer regex does most of the tokenization grunt work while (match = opts.tokenizer.exec(opts.regex)) { m = match[0]; switch (m.charAt(0)) { case "[": // Character class case "\\": // Escape or backreference if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(m); } else { currentToken.matches.push(m); } break; case "(": // Group opening if (!currentToken.isGroup && currentToken.matches.length > 0) opts.regexTokens.push(currentToken); currentToken = new regexToken(); currentToken.isGroup = true; opengroups.push(currentToken); break; case ")": // Group closing var groupToken = opengroups.pop(); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(groupToken); } else { opts.regexTokens.push(groupToken); currentToken = new regexToken(); } break; case "{": //Quantifier var quantifier = new regexToken(); quantifier.isQuantifier = true; quantifier.matches.push(m); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(quantifier); } else { currentToken.matches.push(quantifier); } break; default: // Vertical bar (alternator) // ^ or $ anchor // Dot (.) // Literal character sequence var literal = new regexToken(); literal.isLiteral = true; literal.matches.push(m); if (opengroups.length > 0) { opengroups[opengroups.length - 1]["matches"].push(literal); } else { currentToken.matches.push(literal); } } } if (currentToken.matches.length > 0) opts.regexTokens.push(currentToken); } function validateRegexToken(token, fromGroup) { var isvalid = false; if (fromGroup) { regexPart += "("; openGroupCount++; } for (var mndx = 0; mndx < token["matches"].length; mndx++) { var matchToken = token["matches"][mndx]; if (matchToken["isGroup"] == true) { isvalid = validateRegexToken(matchToken, true); } else if (matchToken["isQuantifier"] == true) { matchToken = matchToken["matches"][0]; var quantifierMax = opts.quantifierFilter.exec(matchToken)[0].replace("}", ""); var testExp = regexPart + "{1," + quantifierMax + "}"; //relax quantifier validation for (var j = 0; j < openGroupCount; j++) { testExp += ")"; } var exp = new RegExp("^(" + testExp + ")$"); isvalid = exp.test(bufferStr); regexPart += matchToken; } else if (matchToken["isLiteral"] == true) { matchToken = matchToken["matches"][0]; var testExp = regexPart, openGroupCloser = ""; for (var j = 0; j < openGroupCount; j++) { openGroupCloser += ")"; } for (var k = 0; k < matchToken.length; k++) { //relax literal validation testExp = (testExp + matchToken[k]).replace(/\|$/, ""); var exp = new RegExp("^(" + testExp + openGroupCloser + ")$"); isvalid = exp.test(bufferStr); if (isvalid) break; } regexPart += matchToken; //console.log(bufferStr + " " + exp + " " + isvalid); } else { regexPart += matchToken; var testExp = regexPart.replace(/\|$/, ""); for (var j = 0; j < openGroupCount; j++) { testExp += ")"; } var exp = new RegExp("^(" + testExp + ")$"); isvalid = exp.test(bufferStr); //console.log(bufferStr + " " + exp + " " + isvalid); } if (isvalid) break; } if (fromGroup) { regexPart += ")"; openGroupCount--; } return isvalid; } if (opts.regexTokens == null) { analyseRegex(); } var cbuffer = buffer.slice(), regexPart = "", isValid = false, openGroupCount = 0; cbuffer.splice(pos, 0, chrs); var bufferStr = cbuffer.join(''); for (var i = 0; i < opts.regexTokens.length; i++) { var regexToken = opts.regexTokens[i]; isValid = validateRegexToken(regexToken, regexToken["isGroup"]); if (isValid) break; } return isValid; }, cardinality: 1 } } } }); })(jQuery); PK!yb(($jquery.inputmask.phone.extensions.jsnu[/* Input Mask plugin extensions 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: 0.0.0 Phone extension. When using this extension make sure you specify the correct url to get the masks $(selector).inputmask("phone", { url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json", onKeyValidation: function () { //show some metadata in the console console.log($(this).inputmask("getmetadata")["name_en"]); } }); */ (function ($) { $.extend($.inputmask.defaults.aliases, { 'phone': { url: "phone-codes/phone-codes.json", mask: function (opts) { opts.definitions = { 'p': { validator: function () { return false; }, cardinality: 1 }, '#': { validator: "[0-9]", cardinality: 1 } }; var maskList = []; $.ajax({ url: opts.url, async: false, dataType: 'json', success: function (response) { maskList = response; } }); maskList.splice(0, 0, "+p(ppp)ppp-pppp"); return maskList; } } }); })(jQuery); PK!o##&jquery.inputmask.numeric.extensions.jsnu[/* Input Mask plugin extensions 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: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //number aliases $.extend($.inputmask.defaults.aliases, { 'decimal': { mask: "~", placeholder: "", repeat: "*", greedy: false, numericInput: false, isNumeric: true, digits: "*", //number of fractionalDigits groupSeparator: "",//",", // | "." radixPoint: ".", groupSize: 3, autoGroup: false, allowPlus: true, allowMinus: true, //todo integerDigits: "*", //number of integerDigits defaultValue: "", prefix: "", suffix: "", //todo getMaskLength: function (buffer, greedy, repeat, currentBuffer, opts) { //custom getMaskLength to take the groupSeparator into account var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var currentBufferStr = currentBuffer.join(''), strippedBufferStr = currentBufferStr.replace(new RegExp(escapedGroupSeparator, "g"), "").replace(new RegExp(escapedRadixPoint), ""), groupOffset = currentBufferStr.length - strippedBufferStr.length; return calculatedLength + groupOffset; }, postFormat: function (buffer, pos, reformatOnly, opts) { if (opts.groupSeparator == "") return pos; var cbuf = buffer.slice(), radixPos = $.inArray(opts.radixPoint, buffer); if (!reformatOnly) { cbuf.splice(pos, 0, "?"); //set position indicator } var bufVal = cbuf.join(''); if (opts.autoGroup || (reformatOnly && bufVal.indexOf(opts.groupSeparator) != -1)) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), ''); var radixSplit = bufVal.split(opts.radixPoint); bufVal = radixSplit[0]; var reg = new RegExp('([-\+]?[\\d\?]+)([\\d\?]{' + opts.groupSize + '})'); while (reg.test(bufVal)) { bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2'); bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator); } if (radixSplit.length > 1) bufVal += opts.radixPoint + radixSplit[1]; } buffer.length = bufVal.length; //align the length for (var i = 0, l = bufVal.length; i < l; i++) { buffer[i] = bufVal.charAt(i); } var newPos = $.inArray("?", buffer); if (!reformatOnly) buffer.splice(newPos, 1); return reformatOnly ? pos : newPos; }, regex: { number: function (opts) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var digitExpression = isNaN(opts.digits) ? opts.digits : '{0,' + opts.digits + '}'; var signedExpression = opts.allowPlus || opts.allowMinus ? "[" + (opts.allowPlus ? "\+" : "") + (opts.allowMinus ? "-" : "") + "]?" : ""; return new RegExp("^" + signedExpression + "(\\d+|\\d{1," + opts.groupSize + "}((" + escapedGroupSeparator + "\\d{" + opts.groupSize + "})?)+)(" + escapedRadixPoint + "\\d" + digitExpression + ")?$"); } }, onKeyDown: function (e, buffer, opts) { var $input = $(this), input = this; if (e.keyCode == opts.keyCode.TAB) { var radixPosition = $.inArray(opts.radixPoint, buffer); if (radixPosition != -1) { var masksets = $input.data('_inputmask')['masksets']; var activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex']; for (var i = 1; i <= opts.digits && i < opts.getMaskLength(masksets[activeMasksetIndex]["_buffer"], masksets[activeMasksetIndex]["greedy"], masksets[activeMasksetIndex]["repeat"], buffer, opts) ; i++) { if (buffer[radixPosition + i] == undefined || buffer[radixPosition + i] == "") buffer[radixPosition + i] = "0"; } input._valueSet(buffer.join('')); } } else if (e.keyCode == opts.keyCode.DELETE || e.keyCode == opts.keyCode.BACKSPACE) { opts.postFormat(buffer, 0, true, opts); input._valueSet(buffer.join('')); return true; } }, definitions: { '~': { //real number validator: function (chrs, buffer, pos, strict, opts) { if (chrs == "") return false; if (!strict && pos <= 1 && buffer[0] === '0' && new RegExp("[\\d-]").test(chrs) && buffer.join('').length == 1) { //handle first char buffer[0] = ""; return { "pos": 0 }; } var cbuf = strict ? buffer.slice(0, pos) : buffer.slice(); cbuf.splice(pos, 0, chrs); var bufferStr = cbuf.join(''); //strip groupseparator var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); bufferStr = bufferStr.replace(new RegExp(escapedGroupSeparator, "g"), ''); var isValid = opts.regex.number(opts).test(bufferStr); if (!isValid) { //let's help the regex a bit bufferStr += "0"; isValid = opts.regex.number(opts).test(bufferStr); if (!isValid) { //make a valid group var lastGroupSeparator = bufferStr.lastIndexOf(opts.groupSeparator); for (var i = bufferStr.length - lastGroupSeparator; i <= 3; i++) { bufferStr += "0"; } isValid = opts.regex.number(opts).test(bufferStr); if (!isValid && !strict) { if (chrs == opts.radixPoint) { isValid = opts.regex.number(opts).test("0" + bufferStr + "0"); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } } } } if (isValid != false && !strict && chrs != opts.radixPoint) { var newPos = opts.postFormat(buffer, pos, false, opts); return { "pos": newPos }; } return isValid; }, cardinality: 1, prevalidator: null } }, insertMode: true, autoUnmask: false }, 'integer': { regex: { number: function (opts) { var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var signedExpression = opts.allowPlus || opts.allowMinus ? "[" + (opts.allowPlus ? "\+" : "") + (opts.allowMinus ? "-" : "") + "]?" : ""; return new RegExp("^" + signedExpression + "(\\d+|\\d{1," + opts.groupSize + "}((" + escapedGroupSeparator + "\\d{" + opts.groupSize + "})?)+)$"); } }, alias: "decimal" } }); })(jQuery); PK!,,YY#jquery.inputmask.date.extensions.jsnu[/* Input Mask plugin extensions 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: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //date & time aliases $.extend($.inputmask.defaults.definitions, { 'h': { //hours validator: "[01][0-9]|2[0-3]", cardinality: 2, prevalidator: [{ validator: "[0-2]", cardinality: 1 }] }, 's': { //seconds || minutes validator: "[0-5][0-9]", cardinality: 2, prevalidator: [{ validator: "[0-5]", cardinality: 1 }] }, 'd': { //basic day validator: "0[1-9]|[12][0-9]|3[01]", cardinality: 2, prevalidator: [{ validator: "[0-3]", cardinality: 1 }] }, 'm': { //basic month validator: "0[1-9]|1[012]", cardinality: 2, prevalidator: [{ validator: "[01]", cardinality: 1 }] }, 'y': { //basic year validator: "(19|20)\\d{2}", cardinality: 4, prevalidator: [ { validator: "[12]", cardinality: 1 }, { validator: "(19|20)", cardinality: 2 }, { validator: "(19|20)\\d", cardinality: 3 } ] } }); $.extend($.inputmask.defaults.aliases, { 'dd/mm/yyyy': { mask: "1/2/y", placeholder: "dd/mm/yyyy", regex: { val1pre: new RegExp("[0-3]"), //daypre val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), //day val2pre: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])"); }, //monthpre val2: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))"); }//month }, leapday: "29/02/", separator: '/', yearrange: { minyear: 1900, maxyear: 2099 }, isInYearRange: function (chrs, minyear, maxyear) { var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))); var enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length))); return (enteredyear != NaN ? minyear <= enteredyear && enteredyear <= maxyear : false) || (enteredyear2 != NaN ? minyear <= enteredyear2 && enteredyear2 <= maxyear : false); }, determinebaseyear: function (minyear, maxyear, hint) { var currentyear = (new Date()).getFullYear(); if (minyear > currentyear) return minyear; if (maxyear < currentyear) { var maxYearPrefix = maxyear.toString().slice(0, 2); var maxYearPostfix = maxyear.toString().slice(2, 4); while (maxyear < maxYearPrefix + hint) { maxYearPrefix--; } var maxxYear = maxYearPrefix + maxYearPostfix; return minyear > maxxYear ? minyear : maxxYear; } return currentyear; }, onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()); } }, definitions: { '1': { //val1 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.val1.test(chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val1.test("0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.val1pre.test(chrs); if (!strict && !isValid) { isValid = opts.regex.val1.test("0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, '2': { //val2 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(0, 3); if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(0, 3); if (frontValue.indexOf(opts.placeholder[0]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2pre(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, 'y': { //year validator: function (chrs, buffer, pos, strict, opts) { if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { var dayMonthValue = buffer.join('').substr(0, 6); if (dayMonthValue != opts.leapday) return true; else { var year = parseInt(chrs, 10);//detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) return true; else return false; else return true; else return false; } } else return false; }, cardinality: 4, prevalidator: [ { validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (!strict && !isValid) { var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1); isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[0]; return { "pos": pos }; } yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2); isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[0]; buffer[pos++] = yearPrefix[1]; return { "pos": pos }; } } return isValid; }, cardinality: 1 }, { validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); if (!strict && !isValid) { var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear); if (isValid) { buffer[pos++] = yearPrefix[1]; return { "pos": pos }; } yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); if (opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { var dayMonthValue = buffer.join('').substr(0, 6); if (dayMonthValue != opts.leapday) isValid = true; else { var year = parseInt(chrs, 10);//detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) isValid = true; else isValid = false; else isValid = true; else isValid = false; } } else isValid = false; if (isValid) { buffer[pos - 1] = yearPrefix[0]; buffer[pos++] = yearPrefix[1]; buffer[pos++] = chrs[0]; return { "pos": pos }; } } return isValid; }, cardinality: 2 }, { validator: function (chrs, buffer, pos, strict, opts) { return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); }, cardinality: 3 } ] } }, insertMode: false, autoUnmask: false }, 'mm/dd/yyyy': { placeholder: "mm/dd/yyyy", alias: "dd/mm/yyyy", //reuse functionality of dd/mm/yyyy alias regex: { val2pre: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); }, //daypre val2: function (separator) { var escapedSeparator = $.inputmask.escapeRegex.call(this, separator); return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); }, //day val1pre: new RegExp("[01]"), //monthpre val1: new RegExp("0[1-9]|1[012]") //month }, leapday: "02/29/", onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()); } } }, 'yyyy/mm/dd': { mask: "y/1/2", placeholder: "yyyy/mm/dd", alias: "mm/dd/yyyy", leapday: "/02/29", onKeyUp: function (e, buffer, opts) { var $input = $(this); if (e.ctrlKey && e.keyCode == opts.keyCode.RIGHT) { var today = new Date(); $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()); } }, definitions: { '2': { //val2 ~ day or month validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(5, 3); if (frontValue.indexOf(opts.placeholder[5]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; return { "pos": pos, "c": chrs.charAt(0) }; } } } //check leap yeap if (isValid) { var dayMonthValue = buffer.join('').substr(4, 4) + chrs; if (dayMonthValue != opts.leapday) return true; else { var year = parseInt(buffer.join('').substr(0, 4), 10); //detect leap year if (year % 4 === 0) if (year % 100 === 0) if (year % 400 === 0) return true; else return false; else return true; else return false; } } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var frontValue = buffer.join('').substr(5, 3); if (frontValue.indexOf(opts.placeholder[5]) != -1) frontValue = "01" + opts.separator; var isValid = opts.regex.val2pre(opts.separator).test(frontValue + chrs); if (!strict && !isValid) { isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] } } }, '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: new RegExp("[012]"), //hours pre hrs24: new RegExp("2[0-9]|1[3-9]"), hrs: new RegExp("[01][0-9]|2[0-3]"), //hours ampm: new RegExp("^[a|p|A|P][m|M]") }, timeseparator: ':', hourFormat: "24", // or 12 definitions: { 'h': { //hours validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.hrs.test(chrs); if (!strict && !isValid) { if (chrs.charAt(1) == opts.timeseparator || "-.:".indexOf(chrs.charAt(1)) != -1) { isValid = opts.regex.hrs.test("0" + chrs.charAt(0)); if (isValid) { buffer[pos - 1] = "0"; buffer[pos] = chrs.charAt(0); pos++; return { "pos": pos }; } } } if (isValid && opts.hourFormat !== "24" && opts.regex.hrs24.test(chrs)) { var tmp = parseInt(chrs, 10); if (tmp == 24) { buffer[pos + 5] = "a"; buffer[pos + 6] = "m"; } else { buffer[pos + 5] = "p"; buffer[pos + 6] = "m"; } tmp = tmp - 12; if (tmp < 10) { buffer[pos] = tmp.toString(); buffer[pos - 1] = "0"; } else { buffer[pos] = tmp.toString().charAt(1); buffer[pos - 1] = tmp.toString().charAt(0); } return { "pos": pos, "c": buffer[pos] }; } return isValid; }, cardinality: 2, prevalidator: [{ validator: function (chrs, buffer, pos, strict, opts) { var isValid = opts.regex.hrspre.test(chrs); if (!strict && !isValid) { isValid = opts.regex.hrs.test("0" + chrs); if (isValid) { buffer[pos] = "0"; pos++; return { "pos": pos }; } } return isValid; }, cardinality: 1 }] }, 't': { //am/pm validator: function (chrs, buffer, pos, strict, opts) { return opts.regex.ampm.test(chrs + "m"); }, casing: "lower", cardinality: 1 } }, insertMode: false, autoUnmask: false }, '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", autoUnmask: false }, 'hh:mm': { mask: "h:s", autoUnmask: false }, 'date': { alias: "dd/mm/yyyy" // "mm/dd/yyyy" }, 'mm/yyyy': { mask: "1/y", placeholder: "mm/yyyy", leapday: "donotuse", separator: '/', alias: "mm/dd/yyyy" } }); })(jQuery); PK!I%jquery.inputmask.extensions.jsnu[/* Input Mask plugin extensions 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: 0.0.0 Optional extensions on the jquery.inputmask base */ (function ($) { //extra definitions $.extend($.inputmask.defaults.definitions, { 'A': { validator: "[A-Za-z]", cardinality: 1, casing: "upper" //auto uppercasing }, '#': { validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]", cardinality: 1, casing: "upper" } }); $.extend($.inputmask.defaults.aliases, { 'url': { mask: "ir", placeholder: "", separator: "", defaultPrefix: "http://", regex: { urlpre1: new RegExp("[fh]"), urlpre2: new RegExp("(ft|ht)"), urlpre3: new RegExp("(ftp|htt)"), urlpre4: new RegExp("(ftp:|http|ftps)"), urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"), urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"), urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"), urlpre8: new RegExp("(ftp://|ftps://|http://|https://)") }, definitions: { 'i': { validator: function (chrs, buffer, pos, strict, opts) { return true; }, cardinality: 8, prevalidator: (function () { var result = [], prefixLimit = 8; for (var i = 0; i < prefixLimit; i++) { result[i] = (function () { var j = i; return { validator: function (chrs, buffer, pos, strict, opts) { if (opts.regex["urlpre" + (j + 1)]) { var tmp = chrs, k; if (((j + 1) - chrs.length) > 0) { tmp = buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp; } var isValid = opts.regex["urlpre" + (j + 1)].test(tmp); if (!strict && !isValid) { pos = pos - j; for (k = 0; k < opts.defaultPrefix.length; k++) { buffer[pos] = opts.defaultPrefix[k]; pos++; } for (k = 0; k < tmp.length - 1; k++) { buffer[pos] = tmp[k]; pos++; } return { "pos": pos }; } return isValid; } else { return false; } }, cardinality: j }; })(); } return result; })() }, "r": { validator: ".", cardinality: 50 } }, insertMode: false, autoUnmask: false }, "ip": { //ip-address mask mask: ["[[x]y]z.[[x]y]z.[[x]y]z.x[yz]", "[[x]y]z.[[x]y]z.[[x]y]z.[[x]y][z]"], definitions: { 'x': { validator: "[012]", cardinality: 1, definitionSymbol: "i" }, 'y': { validator: function (chrs, buffer, pos, strict, opts) { if (pos - 1 > -1 && buffer[pos - 1] != ".") chrs = buffer[pos - 1] + chrs; else chrs = "0" + chrs; return new RegExp("2[0-5]|[01][0-9]").test(chrs); }, cardinality: 1, definitionSymbol: "i" }, 'z': { validator: function (chrs, buffer, pos, strict, opts) { if (pos - 1 > -1 && buffer[pos - 1] != ".") { chrs = buffer[pos - 1] + chrs; if (pos - 2 > -1 && buffer[pos - 2] != ".") { chrs = buffer[pos - 2] + chrs; } else chrs = "0" + chrs; } else chrs = "00" + chrs; return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs); }, cardinality: 1, definitionSymbol: "i" } } } }); })(jQuery); PK!cC%aajquery.inputmask.jsnu[PK!lGLLaphone-codes/readme.txtnu[PK!h//bphone-codes/phone-be.jsonnu[PK!aDDpphone-codes/phone-codes.jsonnu[PK!{\ٰ$$$ jquery.inputmask.regex.extensions.jsnu[PK!yb(($0jquery.inputmask.phone.extensions.jsnu[PK!o##&7jquery.inputmask.numeric.extensions.jsnu[PK!,,YY#Zjquery.inputmask.date.extensions.jsnu[PK!I%mjquery.inputmask.extensions.jsnu[PK M~