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.

inputmask.extensions.js 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*!
  2. * inputmask.extensions.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([ "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,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
  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. onUnMask: function(maskedValue, unmaskedValue, opts) {
  69. return maskedValue;
  70. }
  71. },
  72. mac: {
  73. mask: "##:##:##:##:##:##"
  74. }
  75. }), Inputmask;
  76. });