jquery.inputmask.js 2.6 KB

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