101 lines
3.1 KiB
JavaScript
101 lines
3.1 KiB
JavaScript
/*!
|
|
* jquery.inputmask.js
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
* Copyright (c) 2010 - 2017 Robin Herbots
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
* Version: 3.3.11
|
|
*/
|
|
|
|
!(function (factory) {
|
|
"function" == typeof define && define.amd
|
|
? define(["jquery", "./inputmask"], factory)
|
|
: "object" == typeof exports
|
|
? (module.exports = factory(require("jquery"), require("./inputmask")))
|
|
: factory(jQuery, window.Inputmask);
|
|
})(function ($, Inputmask) {
|
|
return (
|
|
void 0 === $.fn.inputmask &&
|
|
($.fn.inputmask = function (fn, options) {
|
|
var nptmask,
|
|
input = this[0];
|
|
if ((void 0 === options && (options = {}), "string" == typeof fn))
|
|
switch (fn) {
|
|
case "unmaskedvalue":
|
|
return input && input.inputmask
|
|
? input.inputmask.unmaskedvalue()
|
|
: $(input).val();
|
|
|
|
case "remove":
|
|
return this.each(function () {
|
|
this.inputmask && this.inputmask.remove();
|
|
});
|
|
|
|
case "getemptymask":
|
|
return input && input.inputmask
|
|
? input.inputmask.getemptymask()
|
|
: "";
|
|
|
|
case "hasMaskedValue":
|
|
return (
|
|
!(!input || !input.inputmask) &&
|
|
input.inputmask.hasMaskedValue()
|
|
);
|
|
|
|
case "isComplete":
|
|
return !input || !input.inputmask || input.inputmask.isComplete();
|
|
|
|
case "getmetadata":
|
|
return input && input.inputmask
|
|
? input.inputmask.getmetadata()
|
|
: void 0;
|
|
|
|
case "setvalue":
|
|
$(input).val(options),
|
|
input &&
|
|
void 0 === input.inputmask &&
|
|
$(input).triggerHandler("setvalue");
|
|
break;
|
|
|
|
case "option":
|
|
if ("string" != typeof options)
|
|
return this.each(function () {
|
|
if (void 0 !== this.inputmask)
|
|
return this.inputmask.option(options);
|
|
});
|
|
if (input && void 0 !== input.inputmask)
|
|
return input.inputmask.option(options);
|
|
break;
|
|
|
|
default:
|
|
return (
|
|
(options.alias = fn),
|
|
(nptmask = new Inputmask(options)),
|
|
this.each(function () {
|
|
nptmask.mask(this);
|
|
})
|
|
);
|
|
}
|
|
else {
|
|
if ("object" == typeof fn)
|
|
return (
|
|
(nptmask = new Inputmask(fn)),
|
|
void 0 === fn.mask && void 0 === fn.alias
|
|
? this.each(function () {
|
|
if (void 0 !== this.inputmask)
|
|
return this.inputmask.option(fn);
|
|
nptmask.mask(this);
|
|
})
|
|
: this.each(function () {
|
|
nptmask.mask(this);
|
|
})
|
|
);
|
|
if (void 0 === fn)
|
|
return this.each(function () {
|
|
(nptmask = new Inputmask(options)).mask(this);
|
|
});
|
|
}
|
|
}),
|
|
$.fn.inputmask
|
|
);
|
|
});
|