inputmask.extensions.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*!
  2. * inputmask.extensions.js
  3. * https://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.3.1
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
  10. }(function($, Inputmask) {
  11. return Inputmask.extendDefinitions({
  12. A: {
  13. validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  14. cardinality: 1,
  15. casing: "upper"
  16. },
  17. "&": {
  18. validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
  19. cardinality: 1,
  20. casing: "upper"
  21. },
  22. "#": {
  23. validator: "[0-9A-Fa-f]",
  24. cardinality: 1,
  25. casing: "upper"
  26. }
  27. }), Inputmask.extendAliases({
  28. url: {
  29. definitions: {
  30. i: {
  31. validator: ".",
  32. cardinality: 1
  33. }
  34. },
  35. mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
  36. insertMode: !1,
  37. autoUnmask: !1
  38. },
  39. ip: {
  40. mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
  41. definitions: {
  42. i: {
  43. validator: function(chrs, maskset, pos, strict, opts) {
  44. return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
  45. chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
  46. new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
  47. },
  48. cardinality: 1
  49. }
  50. },
  51. onUnMask: function(maskedValue, unmaskedValue, opts) {
  52. return maskedValue;
  53. }
  54. },
  55. email: {
  56. mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
  57. greedy: !1,
  58. onBeforePaste: function(pastedValue, opts) {
  59. return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
  60. },
  61. definitions: {
  62. "*": {
  63. validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
  64. cardinality: 1,
  65. casing: "lower"
  66. },
  67. "-": {
  68. validator: "[0-9A-Za-z-]",
  69. cardinality: 1,
  70. casing: "lower"
  71. }
  72. },
  73. onUnMask: function(maskedValue, unmaskedValue, opts) {
  74. return maskedValue;
  75. }
  76. },
  77. mac: {
  78. mask: "##:##:##:##:##:##"
  79. },
  80. vin: {
  81. mask: "V{13}9{4}",
  82. definitions: {
  83. V: {
  84. validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
  85. cardinality: 1,
  86. casing: "upper"
  87. }
  88. },
  89. clearIncomplete: !0,
  90. autoUnmask: !0
  91. }
  92. }), Inputmask;
  93. });