You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jquery.inputmask.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. * jquery.inputmask.js
  3. * http://github.com/RobinHerbots/jquery.inputmask
  4. * Copyright (c) 2010 - 2016 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 3.2.7
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);
  10. }(function($, Inputmask) {
  11. return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
  12. var nptmask, input = this[0];
  13. if (options = options || {}, "string" == typeof fn) switch (fn) {
  14. case "unmaskedvalue":
  15. return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
  16. case "remove":
  17. return this.each(function() {
  18. this.inputmask && this.inputmask.remove();
  19. });
  20. case "getemptymask":
  21. return input && input.inputmask ? input.inputmask.getemptymask() : "";
  22. case "hasMaskedValue":
  23. return input && input.inputmask ? input.inputmask.hasMaskedValue() : !1;
  24. case "isComplete":
  25. return input && input.inputmask ? input.inputmask.isComplete() : !0;
  26. case "getmetadata":
  27. return input && input.inputmask ? input.inputmask.getmetadata() : void 0;
  28. case "setvalue":
  29. $(input).val(options), input && void 0 !== input.inputmask && $(input).triggerHandler("setvalue");
  30. break;
  31. case "option":
  32. if ("string" != typeof options) return this.each(function() {
  33. return void 0 !== this.inputmask ? this.inputmask.option(options) : void 0;
  34. });
  35. if (input && void 0 !== input.inputmask) return input.inputmask.option(options);
  36. break;
  37. default:
  38. return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
  39. nptmask.mask(this);
  40. });
  41. } else {
  42. if ("object" == typeof fn) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
  43. return void 0 !== this.inputmask ? this.inputmask.option(fn) : void nptmask.mask(this);
  44. }) : this.each(function() {
  45. nptmask.mask(this);
  46. });
  47. if (void 0 === fn) return this.each(function() {
  48. nptmask = new Inputmask(options), nptmask.mask(this);
  49. });
  50. }
  51. }), $.fn.inputmask;
  52. });