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.extensions.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*!
  2. * jquery.inputmask.extensions.js
  3. * http://github.com/RobinHerbots/jquery.inputmask
  4. * Copyright (c) 2010 - 2015 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 3.1.61
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);
  10. }(function($) {
  11. return $.extend($.inputmask.defaults.definitions, {
  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. }), $.extend($.inputmask.defaults.aliases, {
  23. url: {
  24. mask: "ir",
  25. placeholder: "",
  26. separator: "",
  27. defaultPrefix: "http://",
  28. regex: {
  29. urlpre1: new RegExp("[fh]"),
  30. urlpre2: new RegExp("(ft|ht)"),
  31. urlpre3: new RegExp("(ftp|htt)"),
  32. urlpre4: new RegExp("(ftp:|http|ftps)"),
  33. urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
  34. urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
  35. urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
  36. urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
  37. },
  38. definitions: {
  39. i: {
  40. validator: function() {
  41. return !0;
  42. },
  43. cardinality: 8,
  44. prevalidator: function() {
  45. for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
  46. var j = i;
  47. return {
  48. validator: function(chrs, maskset, pos, strict, opts) {
  49. if (opts.regex["urlpre" + (j + 1)]) {
  50. var k, tmp = chrs;
  51. j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
  52. var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
  53. if (!strict && !isValid) {
  54. for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
  55. pos++;
  56. for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
  57. return {
  58. pos: pos
  59. };
  60. }
  61. return isValid;
  62. }
  63. return !1;
  64. },
  65. cardinality: j
  66. };
  67. }();
  68. return result;
  69. }()
  70. },
  71. r: {
  72. validator: ".",
  73. cardinality: 50
  74. }
  75. },
  76. insertMode: !1,
  77. autoUnmask: !1
  78. },
  79. ip: {
  80. mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
  81. definitions: {
  82. i: {
  83. validator: function(chrs, maskset, pos) {
  84. return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
  85. chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
  86. new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
  87. },
  88. cardinality: 1
  89. }
  90. }
  91. },
  92. email: {
  93. mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
  94. greedy: !1,
  95. onBeforePaste: function(pastedValue) {
  96. return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
  97. },
  98. definitions: {
  99. "*": {
  100. validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
  101. cardinality: 1,
  102. casing: "lower"
  103. }
  104. }
  105. }
  106. }), $.fn.inputmask;
  107. });