OAuth OK!
This commit is contained in:
parent
494a840f70
commit
567e4a6635
382 changed files with 52478 additions and 7572 deletions
24
testOauthClient/wwwroot/lib/jquery-validation/src/additional/additional.js
vendored
Normal file
24
testOauthClient/wwwroot/lib/jquery-validation/src/additional/additional.js
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(function() {
|
||||
|
||||
function stripHtml(value) {
|
||||
// remove html tags and space chars
|
||||
return value.replace(/<.[^<>]*?>/g, " ").replace(/ | /gi, " ")
|
||||
// remove punctuation
|
||||
.replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "");
|
||||
}
|
||||
|
||||
$.validator.addMethod("maxWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length <= params;
|
||||
}, $.validator.format("Please enter {0} words or less."));
|
||||
|
||||
$.validator.addMethod("minWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
|
||||
}, $.validator.format("Please enter at least {0} words."));
|
||||
|
||||
$.validator.addMethod("rangeWords", function(value, element, params) {
|
||||
var valueStripped = stripHtml(value),
|
||||
regex = /\b\w+\b/g;
|
||||
return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
|
||||
}, $.validator.format("Please enter between {0} and {1} words."));
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue