]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - Plugson/www/static/js/jquery.validate.vtoymethods.js
2 if (typeof define
=== "function" && define
.amd
) {
3 define(["jquery", "../jquery.validate"], factory
);
10 $.validator
.setDefaults({
11 highlight: function(element
) {
12 $(element
).closest('.form-group').addClass('has-error');
14 success: function(label
) {
15 label
.closest('.form-group').removeClass('has-error');
22 $.validator
.addMethod('password', function(value
, element
, params
) {
23 if (this.optional(element
)) {
26 var re
= /^[^\u4e00-\u9fa5]{1,64}$/;
27 return re
.test(value
);
30 $.validator
.addMethod('utfmaxlen', function(value
, element
, params
) {
31 if (this.optional(element
)) {
35 if (ventoy_get_ulen(value
) > 250) {
42 $.validator
.addMethod('start_slash', function(value
, element
, params
) {
43 if (this.optional(element
)) {
47 if (value
.length
> 0 && value
.charCodeAt(0) != 47) {
52 }, 'Must start with /');
54 $.validator
.addMethod('noquotes', function(value
, element
, params
) {
55 if (this.optional(element
)) {
59 if (value
.length
> 0 && value
.indexOf('"') >= 0) {
64 }, 'Can not contain double quotes');
67 $.validator
.addMethod('printascii', function(value
, element
, params
) {
68 if (this.optional(element
)) {
72 for (var i
= 0; i
< value
.length
; i
++) {
73 if (value
.charCodeAt(i
) > 127) {
78 if (value
.length
> 0 && value
.indexOf('"') >= 0) {
83 }, 'Can only use printable ascii code');