Commit 4c373a79da362f87957608cbee703e2ae6513cf3
1 parent
f6e211e4
ашкые
Showing
146 changed files
with
11568 additions
and
251 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 146 files are displayed.
1 | +{ | |
2 | + "name": "jquery-validation", | |
3 | + "homepage": "http://jqueryvalidation.org/", | |
4 | + "repository": { | |
5 | + "type": "git", | |
6 | + "url": "git://github.com/jzaefferer/jquery-validation.git" | |
7 | + }, | |
8 | + "authors": [ | |
9 | + "Jörn Zaefferer <joern.zaefferer@gmail.com>" | |
10 | + ], | |
11 | + "description": "Form validation made easy", | |
12 | + "main": "dist/jquery.validate.js", | |
13 | + "keywords": [ | |
14 | + "forms", | |
15 | + "validation", | |
16 | + "validate" | |
17 | + ], | |
18 | + "license": "MIT", | |
19 | + "ignore": [ | |
20 | + "**/.*", | |
21 | + "node_modules", | |
22 | + "bower_components", | |
23 | + "test", | |
24 | + "demo", | |
25 | + "lib" | |
26 | + ], | |
27 | + "dependencies": { | |
28 | + "jquery": ">= 1.7.2" | |
29 | + }, | |
30 | + "version": "1.15.0", | |
31 | + "_release": "1.15.0", | |
32 | + "_resolution": { | |
33 | + "type": "version", | |
34 | + "tag": "1.15.0", | |
35 | + "commit": "1621cadc940900a4a7809fe29f2b568328be4340" | |
36 | + }, | |
37 | + "_source": "git://github.com/jzaefferer/jquery-validation.git", | |
38 | + "_target": "^1.15.0", | |
39 | + "_originalSource": "jquery-validation", | |
40 | + "_direct": true | |
41 | +} | |
0 | 42 | \ No newline at end of file | ... | ... |
1 | +# Contributing to the jQuery Validation Plugin | |
2 | + | |
3 | +## Reporting an Issue | |
4 | + | |
5 | +1. Make sure the problem you're addressing is reproducible. | |
6 | +2. Use http://jsbin.com or http://jsfiddle.net to provide a test page. | |
7 | +3. Indicate what browsers the issue can be reproduced in. **Note: IE Compatibilty mode issues will not be addressed. Make sure you test in a real browser!** | |
8 | +4. What version of the plug-in is the issue reproducible in. Is it reproducible after updating to the latest version. | |
9 | + | |
10 | +Documentation issues are also tracked at the [jQuery Validation](https://github.com/jzaefferer/jquery-validation/issues) issue tracker. | |
11 | +Pull Requests to improve the docs are welcome at the [jQuery Validation docs](https://github.com/jzaefferer/validation-content) repository, though. | |
12 | + | |
13 | +**IMPORTANT NOTE ABOUT EMAIL VALIDATION**. As of version 1.12.0 this plugin is using the same regular expression that the [HTML5 specification suggests for browsers to use](https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address). We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider [using a custom method](http://jqueryvalidation.org/jQuery.validator.addMethod/). | |
14 | +In case you need to adjust the built-in validation regular expression patterns, please [follow the documentation](http://jqueryvalidation.org/jQuery.validator.methods/). | |
15 | + | |
16 | +## Contributing code | |
17 | + | |
18 | +Thanks for contributing! Here's a few guidelines to help your contribution get landed. | |
19 | + | |
20 | +1. Make sure the problem you're addressing is reproducible. Use jsbin.com or jsfiddle.net to provide a test page. | |
21 | +2. Follow the [jQuery style guide](http://contribute.jquery.com/style-guides/js) | |
22 | +3. Add or update unit tests along with your patch. Run the unit tests in at least one browser (see below). | |
23 | +4. Run `grunt` (see below) to check for linting and a few other issues. | |
24 | +5. Describe the change in your commit message and reference the ticket, like this: "Demos: Fixed delegate bug for dynamic-totals demo. Fixes #51". If you're adding a new localization file, use something like this: "Localization: Added croatian (HR) localization" | |
25 | + | |
26 | +## Build setup | |
27 | + | |
28 | +1. Install [NodeJS](http://nodejs.org). | |
29 | +2. Install the Grunt CLI To install by running `npm install -g grunt-cli`. More details are available on their website http://gruntjs.com/getting-started. | |
30 | +3. Install the NPM dependencies by running `npm install`. | |
31 | +4. The build can now be called by running `grunt`. | |
32 | + | |
33 | +## Creating a new Additional Method | |
34 | + | |
35 | +If you've wrote custom methods that you'd like to contribute to additional-methods.js: | |
36 | + | |
37 | +1. Create a branch | |
38 | +2. Add the method as a new file in `src/additional` | |
39 | +3. (Optional) Add translations to `src/localization` | |
40 | +4. Send a pull request to the master branch. | |
41 | + | |
42 | +## Unit Tests | |
43 | + | |
44 | +To run unit tests, just open `test/index.html` within your browser. Make sure you ran `npm install` before so all required dependencies are available. | |
45 | +Start with one browser while developing the fix, then run against others before committing. Usually latest Chrome, Firefox, Safari and Opera and a few IEs. | |
46 | + | |
47 | +## Documentation | |
48 | + | |
49 | +Please report documentation issues at the [jQuery Validation](https://github.com/jzaefferer/jquery-validation/issues) issue tracker. | |
50 | +In case your pull request implements or changes public API it would be a plus you would provide a pull request against the [jQuery Validation docs](https://github.com/jzaefferer/validation-content) repository. | |
51 | + | |
52 | +## Linting | |
53 | + | |
54 | +To run JSHint and other tools, use `grunt`. | ... | ... |
1 | +/*jshint node:true*/ | |
2 | +module.exports = function( grunt ) { | |
3 | + | |
4 | +"use strict"; | |
5 | + | |
6 | +var banner, | |
7 | + umdStart, | |
8 | + umdMiddle, | |
9 | + umdEnd, | |
10 | + umdStandardDefine, | |
11 | + umdAdditionalDefine, | |
12 | + umdLocalizationDefine; | |
13 | + | |
14 | +banner = "/*!\n" + | |
15 | + " * jQuery Validation Plugin v<%= pkg.version %>\n" + | |
16 | + " *\n" + | |
17 | + " * <%= pkg.homepage %>\n" + | |
18 | + " *\n" + | |
19 | + " * Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n" + | |
20 | + " * Released under the <%= _.pluck(pkg.licenses, 'type').join(', ') %> license\n" + | |
21 | + " */\n"; | |
22 | + | |
23 | +// Define UMD wrapper variables | |
24 | + | |
25 | +umdStart = "(function( factory ) {\n" + | |
26 | + "\tif ( typeof define === \"function\" && define.amd ) {\n"; | |
27 | + | |
28 | +umdMiddle = "\t} else if (typeof module === \"object\" && module.exports) {\n" + | |
29 | + "\t\tmodule.exports = factory( require( \"jquery\" ) );\n" + | |
30 | + "\t} else {\n" + | |
31 | + "\t\tfactory( jQuery );\n" + | |
32 | + "\t}\n" + | |
33 | + "}(function( $ ) {\n\n"; | |
34 | + | |
35 | +umdEnd = "\n}));"; | |
36 | + | |
37 | +umdStandardDefine = "\t\tdefine( [\"jquery\"], factory );\n"; | |
38 | +umdAdditionalDefine = "\t\tdefine( [\"jquery\", \"./jquery.validate\"], factory );\n"; | |
39 | +umdLocalizationDefine = "\t\tdefine( [\"jquery\", \"../jquery.validate\"], factory );\n"; | |
40 | + | |
41 | +grunt.initConfig( { | |
42 | + pkg: grunt.file.readJSON( "package.json" ), | |
43 | + concat: { | |
44 | + | |
45 | + // Used to copy to dist folder | |
46 | + dist: { | |
47 | + options: { | |
48 | + banner: banner + | |
49 | + umdStart + | |
50 | + umdStandardDefine + | |
51 | + umdMiddle, | |
52 | + footer: umdEnd | |
53 | + }, | |
54 | + files: { | |
55 | + "dist/jquery.validate.js": [ "src/core.js", "src/*.js" ] | |
56 | + } | |
57 | + }, | |
58 | + extra: { | |
59 | + options: { | |
60 | + banner: banner + | |
61 | + umdStart + | |
62 | + umdAdditionalDefine + | |
63 | + umdMiddle, | |
64 | + footer: umdEnd | |
65 | + }, | |
66 | + files: { | |
67 | + "dist/additional-methods.js": [ "src/additional/additional.js", "src/additional/*.js" ] | |
68 | + } | |
69 | + } | |
70 | + }, | |
71 | + uglify: { | |
72 | + options: { | |
73 | + preserveComments: false, | |
74 | + banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + | |
75 | + "<%= grunt.template.today('m/d/yyyy') %>\n" + | |
76 | + " * <%= pkg.homepage %>\n" + | |
77 | + " * Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + | |
78 | + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n" | |
79 | + }, | |
80 | + dist: { | |
81 | + files: { | |
82 | + "dist/additional-methods.min.js": "dist/additional-methods.js", | |
83 | + "dist/jquery.validate.min.js": "dist/jquery.validate.js" | |
84 | + } | |
85 | + }, | |
86 | + all: { | |
87 | + expand: true, | |
88 | + cwd: "dist/localization", | |
89 | + src: "**/*.js", | |
90 | + dest: "dist/localization", | |
91 | + ext: ".min.js" | |
92 | + } | |
93 | + }, | |
94 | + compress: { | |
95 | + dist: { | |
96 | + options: { | |
97 | + mode: "zip", | |
98 | + level: 1, | |
99 | + archive: "dist/<%= pkg.name %>-<%= pkg.version %>.zip", | |
100 | + pretty: true | |
101 | + }, | |
102 | + src: [ | |
103 | + "changelog.txt", | |
104 | + "demo/**/*.*", | |
105 | + "dist/**/*.js", | |
106 | + "Gruntfile.js", | |
107 | + "lib/**/*.*", | |
108 | + "package.json", | |
109 | + "README.md", | |
110 | + "src/**/*.*", | |
111 | + "test/**/*.*" | |
112 | + ] | |
113 | + } | |
114 | + }, | |
115 | + qunit: { | |
116 | + files: "test/index.html" | |
117 | + }, | |
118 | + jshint: { | |
119 | + options: { | |
120 | + jshintrc: true | |
121 | + }, | |
122 | + core: { | |
123 | + src: "src/**/*.js" | |
124 | + }, | |
125 | + test: { | |
126 | + src: [ "test/*.js", "test/additional/*.js" ] | |
127 | + }, | |
128 | + grunt: { | |
129 | + src: "Gruntfile.js" | |
130 | + } | |
131 | + }, | |
132 | + watch: { | |
133 | + options: { | |
134 | + atBegin: true | |
135 | + }, | |
136 | + src: { | |
137 | + files: "<%= jshint.core.src %>", | |
138 | + tasks: [ | |
139 | + "concat" | |
140 | + ] | |
141 | + } | |
142 | + }, | |
143 | + jscs: { | |
144 | + all: [ "<%= jshint.core.src %>", "<%= jshint.test.src %>", "<%= jshint.grunt.src %>" ] | |
145 | + }, | |
146 | + copy: { | |
147 | + dist: { | |
148 | + options: { | |
149 | + | |
150 | + // Append UMD wrapper | |
151 | + process: function( content ) { | |
152 | + return umdStart + umdLocalizationDefine + umdMiddle + content + umdEnd; | |
153 | + } | |
154 | + }, | |
155 | + src: "src/localization/*", | |
156 | + dest: "dist/localization", | |
157 | + expand: true, | |
158 | + flatten: true, | |
159 | + filter: "isFile" | |
160 | + } | |
161 | + }, | |
162 | + replace: { | |
163 | + dist: { | |
164 | + src: "dist/**/*.min.js", | |
165 | + overwrite: true, | |
166 | + replacements: [ | |
167 | + { | |
168 | + from: "./jquery.validate", | |
169 | + to: "./jquery.validate.min" | |
170 | + } | |
171 | + ] | |
172 | + } | |
173 | + } | |
174 | +} ); | |
175 | + | |
176 | +grunt.loadNpmTasks( "grunt-contrib-jshint" ); | |
177 | +grunt.loadNpmTasks( "grunt-contrib-qunit" ); | |
178 | +grunt.loadNpmTasks( "grunt-contrib-uglify" ); | |
179 | +grunt.loadNpmTasks( "grunt-contrib-concat" ); | |
180 | +grunt.loadNpmTasks( "grunt-contrib-compress" ); | |
181 | +grunt.loadNpmTasks( "grunt-contrib-watch" ); | |
182 | +grunt.loadNpmTasks( "grunt-jscs" ); | |
183 | +grunt.loadNpmTasks( "grunt-contrib-copy" ); | |
184 | +grunt.loadNpmTasks( "grunt-text-replace" ); | |
185 | + | |
186 | +grunt.registerTask( "default", [ "concat", "copy", "jscs", "jshint", "qunit" ] ); | |
187 | +grunt.registerTask( "release", [ "default", "uglify", "replace", "compress" ] ); | |
188 | +grunt.registerTask( "start", [ "concat", "watch" ] ); | |
189 | + | |
190 | +}; | ... | ... |
1 | +The MIT License (MIT) | |
2 | +===================== | |
3 | + | |
4 | +Copyright Jörn Zaefferer | |
5 | + | |
6 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | +of this software and associated documentation files (the "Software"), to deal | |
8 | +in the Software without restriction, including without limitation the rights | |
9 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | +copies of the Software, and to permit persons to whom the Software is | |
11 | +furnished to do so, subject to the following conditions: | |
12 | + | |
13 | +The above copyright notice and this permission notice shall be included in | |
14 | +all copies or substantial portions of the Software. | |
15 | + | |
16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | +THE SOFTWARE. | ... | ... |
1 | +[jQuery Validation Plugin](http://jqueryvalidation.org/) - Form validation made easy | |
2 | +================================ | |
3 | + | |
4 | +[](http://travis-ci.org/jzaefferer/jquery-validation) | |
5 | +[](https://david-dm.org/jzaefferer/jquery-validation#info=devDependencies) | |
6 | +[](https://gitter.im/jzaefferer/jquery-validation) | |
7 | + | |
8 | +The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy. | |
9 | + | |
10 | +## [⚠️ Looking for maintainers ⚠️](https://github.com/jzaefferer/jquery-validation/issues/1569) | |
11 | + | |
12 | +This project is looking for one or more maintainers. This mostly involves triaging issues, reviewing pull requests, and occasionally fixing bugs or finishing a feature implementation. If you're interested, [please get in touch](https://github.com/jzaefferer/jquery-validation/issues/1569). | |
13 | + | |
14 | + | |
15 | +## Getting Started | |
16 | + | |
17 | +### Downloading the prebuilt files | |
18 | + | |
19 | +Prebuilt files can be downloaded from http://jqueryvalidation.org/ | |
20 | + | |
21 | +### Downloading the latest changes | |
22 | + | |
23 | +The unreleased development files can be obtained by: | |
24 | + | |
25 | + 1. [Downloading](https://github.com/jzaefferer/jquery-validation/archive/master.zip) or Forking this repository | |
26 | + 2. [Setup the build](CONTRIBUTING.md#build-setup) | |
27 | + 3. Run `grunt` to create the built files in the "dist" directory | |
28 | + | |
29 | +### Including it on your page | |
30 | + | |
31 | +Include jQuery and the plugin on a page. Then select a form to validate and call the `validate` method. | |
32 | + | |
33 | +```html | |
34 | +<form> | |
35 | + <input required> | |
36 | +</form> | |
37 | +<script src="jquery.js"></script> | |
38 | +<script src="jquery.validate.js"></script> | |
39 | +<script> | |
40 | +$("form").validate(); | |
41 | +</script> | |
42 | +``` | |
43 | + | |
44 | +Alternatively include jQuery and the plugin via requirejs in your module. | |
45 | + | |
46 | +```js | |
47 | +define(["jquery", "jquery.validate"], function( $ ) { | |
48 | + $("form").validate(); | |
49 | +}); | |
50 | +``` | |
51 | + | |
52 | +For more information on how to setup a rules and customizations, [check the documentation](http://jqueryvalidation.org/documentation/). | |
53 | + | |
54 | +## Reporting issues and contributing code | |
55 | + | |
56 | +See the [Contributing Guidelines](CONTRIBUTING.md) for details. | |
57 | + | |
58 | +**IMPORTANT NOTE ABOUT EMAIL VALIDATION**. As of version 1.12.0 this plugin is using the same regular expression that the [HTML5 specification suggests for browsers to use](https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address). We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider [using a custom method](http://jqueryvalidation.org/jQuery.validator.addMethod/). | |
59 | +In case you need to adjust the built-in validation regular expression patterns, please [follow the documentation](http://jqueryvalidation.org/jQuery.validator.methods/). | |
60 | + | |
61 | +## License | |
62 | +Copyright © Jörn Zaefferer<br> | |
63 | +Licensed under the MIT license. | ... | ... |
1 | +{ | |
2 | + "name": "jquery-validation", | |
3 | + "homepage": "http://jqueryvalidation.org/", | |
4 | + "repository": { | |
5 | + "type": "git", | |
6 | + "url": "git://github.com/jzaefferer/jquery-validation.git" | |
7 | + }, | |
8 | + "authors": [ | |
9 | + "Jörn Zaefferer <joern.zaefferer@gmail.com>" | |
10 | + ], | |
11 | + "description": "Form validation made easy", | |
12 | + "main": "dist/jquery.validate.js", | |
13 | + "keywords": [ | |
14 | + "forms", | |
15 | + "validation", | |
16 | + "validate" | |
17 | + ], | |
18 | + "license": "MIT", | |
19 | + "ignore": [ | |
20 | + "**/.*", | |
21 | + "node_modules", | |
22 | + "bower_components", | |
23 | + "test", | |
24 | + "demo", | |
25 | + "lib" | |
26 | + ], | |
27 | + "dependencies": { | |
28 | + "jquery": ">= 1.7.2" | |
29 | + }, | |
30 | + "version": "1.15.0" | |
31 | +} | ... | ... |
bower_components/jquery-validation/build/release.js
0 → 100644
1 | +/* Release checklist | |
2 | +- Run `git changelog` and edit to match previous output (this should make use of jquey-release instead) | |
3 | +- pull latest https://github.com/jquery/jquery-release | |
4 | +- disable _generateChangelog task in release.js (BOOOO) | |
5 | +- adjust commit message in jquery-release/lib/repo.js to prepand "Release:", to make the commit hook happy | |
6 | +- run | |
7 | + node release.js --remote=jzaefferer/jquery-validation | |
8 | +- Wait a while, verify and confirm each step | |
9 | +- Create GitHub release: Pick the new tag, add changelog, upload zip | |
10 | +- Update MS CDN (see 1password for url and credentials) | |
11 | +- Check jsdelivr CDN | |
12 | +- Update validation-content/pages/index.html (may have to hold off on CDN updates until available) | |
13 | +- Write blog post: Some highlights, changelog, download links | |
14 | +*/ | |
15 | + | |
16 | +/*jshint node:true */ | |
17 | +module.exports = function( Release ) { | |
18 | + | |
19 | +function today() { | |
20 | + return new Date().toISOString().replace(/T.+/, ""); | |
21 | +} | |
22 | + | |
23 | +// also add version property to this | |
24 | +Release._jsonFiles.push( "validation.jquery.json" ); | |
25 | + | |
26 | +Release.define({ | |
27 | + issueTracker: "github", | |
28 | + changelogShell: function() { | |
29 | + return Release.newVersion + " / " + today() + "\n==================\n\n"; | |
30 | + }, | |
31 | + | |
32 | + generateArtifacts: function( done ) { | |
33 | + Release.exec( "grunt release", "Grunt command failed" ); | |
34 | + done([ | |
35 | + "dist/additional-methods.js", | |
36 | + "dist/additional-methods.min.js", | |
37 | + "dist/jquery.validate.js", | |
38 | + "dist/jquery.validate.min.js" | |
39 | + ]); | |
40 | + }, | |
41 | + | |
42 | + cdnPublish: false, | |
43 | + npmPublish: true, | |
44 | + | |
45 | + // disable authors check | |
46 | + _checkAuthorsTxt: function() {} | |
47 | +}); | |
48 | + | |
49 | +}; | ... | ... |
1 | +1.14.0 / 2015-06-30 | |
2 | +================== | |
3 | + | |
4 | +## Core | |
5 | + * Remove unused removeAttrs method | |
6 | + * Replace regex for url method | |
7 | + * Remove bad url param in $.ajax, overwritten by $.extend | |
8 | + * Properly handle nested cancel submit button | |
9 | + * Fix indent | |
10 | + * Refactor attributeRules and dataRules to share noramlizer | |
11 | + * dataRules method to convert value to number for number inputs | |
12 | + * Update url method to allow for protocol-relative URLs | |
13 | + * Remove deprecated $.format placeholder | |
14 | + * Use jQuery 1.7+ on/off, add destroy method | |
15 | + * IE8 compatibility changed .indexOf to $.inArray | |
16 | + * Cast NaN value attributes to undefined for Opera Mini | |
17 | + * Stop trimming value inside required method | |
18 | + * Use :disabled selector to match disabled elements | |
19 | + * Exclude some keyboard keys to prevent revalidating the field | |
20 | + * Do not search the whole DOM for radio/checkbox elements | |
21 | + * Throw better errors for bad rule methods | |
22 | + * Fixed number validation error | |
23 | + * Fix reference to whatwg spec | |
24 | + * Focus invalid element when validating a custom set of inputs | |
25 | + * Reset element styles when using custom highlight methods | |
26 | + * Escape dollar sign in error id | |
27 | + * Revert "Ignore readonly as well as disabled fields." | |
28 | + * Update link in comment for Luhn algorithm | |
29 | + | |
30 | +## Additionals | |
31 | + * Update dateITA to address timezone issue | |
32 | + * Fix extension method to only method period | |
33 | + * Fix accept method to match period only | |
34 | + * Update time method to allow single digit hour | |
35 | + * Drop bad test for notEqualTo method | |
36 | + * Add notEqualTo method | |
37 | + * Use correct jQuery reference via `$` | |
38 | + * Remove useless regex check in iban method | |
39 | + * Brazilian CPF number | |
40 | + | |
41 | +## Localization | |
42 | + * Update messages_tr.js | |
43 | + * Update messages_sr_lat.js | |
44 | + * Adding Perú Spanish (ES PE) | |
45 | + * Adding Georgian (ქართული, ge) | |
46 | + * Fixed typo in catalan translation | |
47 | + * Improve Finnish (fi) translation | |
48 | + * Add armenian (hy_AM) locale | |
49 | + * Extend italian (it) translation with currency method | |
50 | + * Add bn_BD locale | |
51 | + * Update zh locale | |
52 | + * Remove full stop at the end of italian messages | |
53 | + | |
54 | +1.13.1 / 2014-10-14 | |
55 | +================== | |
56 | + | |
57 | +## Core | |
58 | + * Allow 0 as value for autoCreateRanges | |
59 | + * Apply ignore setting to all validationTargetFor elements | |
60 | + * Don't trim value in min/max/rangelength methods | |
61 | + * Escape id/name before using it as a selector in errorsFor | |
62 | + * Explicit default for focusCleanup option | |
63 | + * Fix incorrect regexp for describedby matcher | |
64 | + * Ignore readonly as well as disabled fields | |
65 | + * Improve id escaping, store escaped id in describedby | |
66 | + * Use return value of submitHandler to allow or prevent form submit | |
67 | + | |
68 | +## Additionals | |
69 | + * Add postalcodeBR method | |
70 | + * Fix pattern method when parameter is a string | |
71 | + | |
72 | + | |
73 | +1.13.0 / 2014-07-01 | |
74 | +================== | |
75 | + | |
76 | +## All | |
77 | +* Add plugin UMD wrapper | |
78 | + | |
79 | +## Core | |
80 | +* Respect non-error aria-describedby and empty hidden errors | |
81 | +* Improve dateISO RegExp | |
82 | +* Added radio/checkbox to delegate click-event | |
83 | +* Use aria-describedby for non-label elements | |
84 | +* Register focusin, focusout and keyup also on radio/checkbox | |
85 | +* Fix normalization for rangelength attribute value | |
86 | +* Update elementValue method to deal with type="number" fields | |
87 | +* Use charAt instead of array notation on strings, to support IE8(?) | |
88 | + | |
89 | +## Localization | |
90 | +* Fix sk translation of rangelength method | |
91 | +* Add Finnish methods | |
92 | +* Fixed GL number validation message | |
93 | +* Fixed ES number method validation message | |
94 | +* Added galician (GL) | |
95 | +* Fixed French messages for min and max methods | |
96 | + | |
97 | +## Additionals | |
98 | +* Add statesUS method | |
99 | +* Fix dateITA method to deal with DST bug | |
100 | +* Add persian date method | |
101 | +* Add postalCodeCA method | |
102 | +* Add postalcodeIT method | |
103 | + | |
104 | +1.12.0 / 2014-04-01 | |
105 | +================== | |
106 | + | |
107 | +* Add ARIA testing ([3d5658e](https://github.com/jzaefferer/jquery-validation/commit/3d5658e9e4825fab27198c256beed86f0bd12577)) | |
108 | +* Add es-AR localization messages. ([7b30beb](https://github.com/jzaefferer/jquery-validation/commit/7b30beb8ebd218c38a55d26a63d529e16035c7a2)) | |
109 | +* Add missing dots to 'es' and 'es_AR' messages. ([a2a653c](https://github.com/jzaefferer/jquery-validation/commit/a2a653cb68926ca034b4b09d742d275db934d040)) | |
110 | +* Added Indonesian (ID) localization ([1d348bd](https://github.com/jzaefferer/jquery-validation/commit/1d348bdcb65807c71da8d0bfc13a97663631cd3a)) | |
111 | +* Added NIF, NIE and CIF Spanish documents numbers validation ([#830](https://github.com/jzaefferer/jquery-validation/issues/830), [317c20f](https://github.com/jzaefferer/jquery-validation/commit/317c20fa9bb772770bb9b70d46c7081d7cfc6545)) | |
112 | +* Added the current form to the context of the remote ajax request ([0a18ae6](https://github.com/jzaefferer/jquery-validation/commit/0a18ae65b9b6d877e3d15650a5c2617a9d2b11d5)) | |
113 | +* Additionals: Update IBAN method, trim trailing whitespaces ([#970](https://github.com/jzaefferer/jquery-validation/issues/970), [347b04a](https://github.com/jzaefferer/jquery-validation/commit/347b04a7d4e798227405246a5de3fc57451d52e1)) | |
114 | +* BIC method: Improve RegEx, {1} is always redundant. Closes gh-744 ([5cad6b4](https://github.com/jzaefferer/jquery-validation/commit/5cad6b493575e8a9a82470d17e0900c881130873)) | |
115 | +* Bower: Add Bower.json for package registration ([e86ccb0](https://github.com/jzaefferer/jquery-validation/commit/e86ccb06e301613172d472cf15dd4011ff71b398)) | |
116 | +* Changes dollar references to 'jQuery', for compability with jQuery.noConflict. Closes gh-754 ([2049afe](https://github.com/jzaefferer/jquery-validation/commit/2049afe46c1be7b3b89b1d9f0690f5bebf4fbf68)) | |
117 | +* Core: Add "method" field to error list entry ([89a15c7](https://github.com/jzaefferer/jquery-validation/commit/89a15c7a4b17fa2caaf4ff817f09b04c094c3884)) | |
118 | +* Core: Added support for generic messages via data-msg attribute ([5bebaa5](https://github.com/jzaefferer/jquery-validation/commit/5bebaa5c55c73f457c0e0181ec4e3b0c409e2a9d)) | |
119 | +* Core: Allow attributes to have a value of zero (eg min='0') ([#854](https://github.com/jzaefferer/jquery-validation/issues/854), [9dc0d1d](https://github.com/jzaefferer/jquery-validation/commit/9dc0d1dd946b2c6178991fb16df0223c76162579)) | |
120 | +* Core: Disable deprecated $.format ([#755](https://github.com/jzaefferer/jquery-validation/issues/755), [bf3b350](https://github.com/jzaefferer/jquery-validation/commit/bf3b3509140ea8ab5d83d3ec58fd9f1d7822efc5)) | |
121 | +* Core: Fix support for multiple error classes ([c1f0baf](https://github.com/jzaefferer/jquery-validation/commit/c1f0baf36c21ca175bbc05fb9345e5b44b094821)) | |
122 | +* Core: Ignore events on ignored elements ([#700](https://github.com/jzaefferer/jquery-validation/issues/700), [a864211](https://github.com/jzaefferer/jquery-validation/commit/a86421131ea69786ee9e0d23a68a54a7658ccdbf)) | |
123 | +* Core: Improve elementValue method ([6c041ed](https://github.com/jzaefferer/jquery-validation/commit/6c041edd21af1425d12d06cdd1e6e32a78263e82)) | |
124 | +* Core: Make element() handle ignored elements properly. ([3f464a8](https://github.com/jzaefferer/jquery-validation/commit/3f464a8da49dbb0e4881ada04165668e4a63cecb)) | |
125 | +* Core: Switch dataRules parsing to W3C HTML5 spec style ([460fd22](https://github.com/jzaefferer/jquery-validation/commit/460fd22b6c84a74c825ce1fa860c0a9da20b56bb)) | |
126 | +* Core: Trigger success on optional but have other successful validators ([#851](https://github.com/jzaefferer/jquery-validation/issues/851), [f93e1de](https://github.com/jzaefferer/jquery-validation/commit/f93e1deb48ec8b3a8a54e946a37db2de42d3aa2a)) | |
127 | +* Core: Use plain element instead of un-wrapping the element again ([03cd4c9](https://github.com/jzaefferer/jquery-validation/commit/03cd4c93069674db5415a0bf174a5870da47e5d2)) | |
128 | +* Core: make sure remote is executed last ([#711](https://github.com/jzaefferer/jquery-validation/issues/711), [ad91b6f](https://github.com/jzaefferer/jquery-validation/commit/ad91b6f388b7fdfb03b74e78554cbab9fd8fca6f)) | |
129 | +* Demo: Use correct option in multipart demo. ([#1025](https://github.com/jzaefferer/jquery-validation/issues/1025), [070edc7](https://github.com/jzaefferer/jquery-validation/commit/070edc7be4de564cb74cfa9ee4e3f40b6b70b76f)) | |
130 | +* Fix $/jQuery usage in additional methods. Fixes #839 ([#839](https://github.com/jzaefferer/jquery-validation/issues/839), [59bc899](https://github.com/jzaefferer/jquery-validation/commit/59bc899e4586255a4251903712e813c21d25b3e1)) | |
131 | +* Improve Chinese translations ([1a0bfe3](https://github.com/jzaefferer/jquery-validation/commit/1a0bfe32b16f8912ddb57388882aa880fab04ffe)) | |
132 | +* Initial ARIA-Required implementation ([bf3cfb2](https://github.com/jzaefferer/jquery-validation/commit/bf3cfb234ede2891d3f7e19df02894797dd7ba5e)) | |
133 | +* Localization: change accept values to extension. Fixes #771, closes gh-793. ([#771](https://github.com/jzaefferer/jquery-validation/issues/771), [12edec6](https://github.com/jzaefferer/jquery-validation/commit/12edec66eb30dc7e86756222d455d49b34016f65)) | |
134 | +* Messages: Add icelandic localization ([dc88575](https://github.com/jzaefferer/jquery-validation/commit/dc885753c8872044b0eaa1713cecd94c19d4c73d)) | |
135 | +* Messages: Add missing dots to 'bg', 'fr' and 'sr' messages. ([adbc636](https://github.com/jzaefferer/jquery-validation/commit/adbc6361c377bf6b74c35df9782479b1115fbad7)) | |
136 | +* Messages: Create messages_sr_lat.js ([f2f9007](https://github.com/jzaefferer/jquery-validation/commit/f2f90076518014d98495c2a9afb9a35d45d184e6)) | |
137 | +* Messages: Create messages_tj.js ([de830b3](https://github.com/jzaefferer/jquery-validation/commit/de830b3fd8689a7384656c17565ee92c2878d8a5)) | |
138 | +* Messages: Fix sr_lat translation, add missing space ([880ba1c](https://github.com/jzaefferer/jquery-validation/commit/880ba1ca545903a41d8c5332fc4038a7e9a580bd)) | |
139 | +* Messages: Update messages_sr.js, fix missing space ([10313f4](https://github.com/jzaefferer/jquery-validation/commit/10313f418c18ea75f385248468c2d3600f136cfb)) | |
140 | +* Methods: Add additional method for currency ([1a981b4](https://github.com/jzaefferer/jquery-validation/commit/1a981b440346620964c87ebdd0fa03246348390e)) | |
141 | +* Methods: Adding Smart Quotes to stripHTML's punctuation removal ([aa0d624](https://github.com/jzaefferer/jquery-validation/commit/aa0d6241c3ea04663edc1e45ed6e6134630bdd2f)) | |
142 | +* Methods: Fix dateITA method, avoiding summertime errors ([279b932](https://github.com/jzaefferer/jquery-validation/commit/279b932c1267b7238e6652880b7846ba3bbd2084)) | |
143 | +* Methods: Localized methods for chilean culture (es-CL) ([cf36b93](https://github.com/jzaefferer/jquery-validation/commit/cf36b933499e435196d951401221d533a4811810)) | |
144 | +* Methods: Update email to use HTML5 regex, remove email2 method ([#828](https://github.com/jzaefferer/jquery-validation/issues/828), [dd162ae](https://github.com/jzaefferer/jquery-validation/commit/dd162ae360639f73edd2dcf7a256710b2f5a4e64)) | |
145 | +* Pattern method: Remove delimiters, since HTML5 implementations don't include those either. ([37992c1](https://github.com/jzaefferer/jquery-validation/commit/37992c1c9e2e0be8b315ccccc2acb74863439d3e)) | |
146 | +* Restricting credit card validator to include length check. Closes gh-772 ([f5f47c5](https://github.com/jzaefferer/jquery-validation/commit/f5f47c5c661da5b0c0c6d59d169e82230928a804)) | |
147 | +* Update messages_ko.js - closes gh-715 ([5da3085](https://github.com/jzaefferer/jquery-validation/commit/5da3085ff02e0e6ecc955a8bfc3bb9a8d220581b)) | |
148 | +* Update messages_pt_BR.js. Closes gh-782 ([4bf813b](https://github.com/jzaefferer/jquery-validation/commit/4bf813b751ce34fac3c04eaa2e80f75da3461124)) | |
149 | +* Update phonesUK and mobileUK to accept new prefixes. Closes gh-750 ([d447b41](https://github.com/jzaefferer/jquery-validation/commit/d447b41b830dee984be21d8281ec7b87a852001d)) | |
150 | +* Verify nine-digit zip codes. Closes gh-726 ([165005d](https://github.com/jzaefferer/jquery-validation/commit/165005d4b5780e22d13d13189d107940c622a76f)) | |
151 | +* phoneUS: Add N11 exclusions. Closes gh-861 ([519bbc6](https://github.com/jzaefferer/jquery-validation/commit/519bbc656bcb26e8aae5166d7b2e000014e0d12a)) | |
152 | +* resetForm should clear any aria-invalid values ([4f8a631](https://github.com/jzaefferer/jquery-validation/commit/4f8a631cbe84f496ec66260ada52db2aa0bb3733)) | |
153 | +* valid(): Check all elements. Fixes #791 - valid() validates only the first (invalid) element ([#791](https://github.com/jzaefferer/jquery-validation/issues/791), [6f26803](https://github.com/jzaefferer/jquery-validation/commit/6f268031afaf4e155424ee74dd11f6c47fbb8553)) | |
154 | + | |
155 | +1.11.1 / 2013-03-22 | |
156 | +================== | |
157 | + | |
158 | + * Revert to also converting parameters of range method to numbers. Closes gh-702 | |
159 | + * Replace most usage of PHP with mockjax handlers. Do some demo cleanup as well, update to newer masked-input plugin. Keep captcha demo in PHP. Fixes #662 | |
160 | + * Remove inline code highlighting from milk demo. View source works fine. | |
161 | + * Fix dynamic-totals demo by trimming whitespace from template content before passing to jQuery constructor | |
162 | + * Fix min/max validation. Closes gh-666. Fixes #648 | |
163 | + * Fixed 'messages' coming up as a rule and causing an exception after being updated through rules("add"). Closes gh-670, fixes #624 | |
164 | + * Add Korean (ko) localization. Closes gh-671 | |
165 | + * Improved the UK postcode method to filter out more invalid postcodes. Closes #682 | |
166 | + * Update messages_sv.js. Closes #683 | |
167 | + * Change grunt link to the project website. Closes #684 | |
168 | + * Move remote method down the list to run last, after all other methods applied to a field. Fixes #679 | |
169 | + * Update plugin.json description, should include the word 'validate' | |
170 | + * Fix typos | |
171 | + * Fix jQuery loader to use path of itself. Fixes nested demos. | |
172 | + * Update grunt-contrib-qunit to make use of PhantomJS 1.8, when installed through node module 'phantomjs' | |
173 | + * Make valid() return a boolean instead of 0 or 1. Fixes #109 - valid() does not return boolean value | |
174 | + | |
175 | +1.11.0 / 2013-02-04 | |
176 | +================== | |
177 | + | |
178 | + * Remove clearing as numbers of `min`, `max` and `range` rules. Fixes #455. Closes gh-528. | |
179 | + * Update pre-existing labels - fixes #430 closes gh-436 | |
180 | + * Fix $.validator.format to avoid group interpolation, where at least IE8/9 replaces -bash with the match. Fixes #614 | |
181 | + * Fix mimetype regex | |
182 | + * Add plugin manifest and update headers to just MIT license, drop unnecessary dual-licensing (like jQuery). | |
183 | + * Hebrew messages: Removed dots at end of sentences - Fixes gh-568 | |
184 | + * French translation for require_from_group validation. Fixes gh-573. | |
185 | + * Allow groups to be an array or a string - Fixes #479 | |
186 | + * Removed spaces with multiple MIME types | |
187 | + * Fix some date validations, JS syntax errors. | |
188 | + * Remove support for metadata plugin, replace with data-rule- and data-msg- (added in 907467e8) properties. | |
189 | + * Added sftp as a valid url-pattern | |
190 | + * Add Malay (my) localization | |
191 | + * Update localization/messages_hu.js | |
192 | + * Remove focusin/focusout polyfill. Fixes #542 - Inclusion of jquery.validate interfers with focusin and focusout events in IE9 | |
193 | + * Localization: Fixed typo in finnish translation | |
194 | + * Fix RTM demo to show invalid icon when going from valid back to invalid | |
195 | + * Fixed premature return in remote function which prevented ajax call from being made in case an input was entered too quickly. Ensures remote validation always validates the newest value. | |
196 | + * Undo fix for #244. Fixes #521 - E-mail validation fires immediately when text is in the field. | |
197 | + | |
198 | +1.10.0 / 2012-09-07 | |
199 | +=================== | |
200 | + | |
201 | + * Corrected French strings for nowhitespace, phoneUS, phoneUK and mobileUK based upon community feedback. | |
202 | + * rename files for language_REGION according to the standard ISO_3166-1 (http://en.wikipedia.org/wiki/ISO_3166-1), for Taiwan tha language is Chinese (zh) and the region is Taiwan (TW) | |
203 | + * Optimise RegEx patterns, especially for UK phone numbers. | |
204 | + * Add Language Name for each file, rename the language code according to the standard ISO 639 for Estonian, Georgian, Ukrainian and Chinese (http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) | |
205 | + * Added croatian (HR) localization | |
206 | + * Existing French translations were edited and French translations for the additional methods were added. | |
207 | + * Merged in changes for specifying custom error messages in data attributes | |
208 | + * Updated UK Mobile phone number regex for new numbers. Fixes #154 | |
209 | + * Add element to success call with test. Fixes #60 | |
210 | + * Fixed regex for time additional method. Fixes #131 | |
211 | + * resetForm now clears old previousValue on form elements. Fixes #312 | |
212 | + * Added checkbox test to require_from_group and changed require_from_group to use elementValue. Fixes #359 | |
213 | + * Fixed dataFilter response issues in jQuery 1.5.2+. Fixes #405 | |
214 | + * Added jQuery Mobile demo. Fixes #249 | |
215 | + * Deoptimize findByName for correctness. Fixes #82 - $.validator.prototype.findByName breaks in IE7 | |
216 | + * Added US zip code support and test. Fixes #90 | |
217 | + * Changed lastElement to lastActive in keyup, skip validation on tab or empty element. Fixes #244 | |
218 | + * Removed number stripping from stripHtml. Fixes #2 | |
219 | + * Fixed invalid count on invalid to valid remote validation. Fixes #286 | |
220 | + * Add link to file_input to demo index | |
221 | + * Moved old accept method to extension additional-method, added new accept method to handle standard browser mimetype filtering. Fixes #287 and supersedes #369 | |
222 | + * Disables blur event when onfocusout is set to false. Test added. | |
223 | + * Fixed value issue for radio buttons and checkboxes. Fixes #363 | |
224 | + * Added test for rangeWords and fixed regex and bounds in method. Fixes #308 | |
225 | + * Fixed TinyMCE Demo and added link on demo page. Fixes #382 | |
226 | + * Changed localization message for min/max. Fixes #273 | |
227 | + * Added pseudo selector for text input types to fix issue with default empty type attribute. Added tests and some test markup. Fixes #217 | |
228 | + * Fixed delegate bug for dynamic-totals demo. Fixes #51 | |
229 | + * Fix incorrect message for alphanumeric validator | |
230 | + * Removed incorrect false check on required attribute | |
231 | + * required attribute fix for non-html5 browsers. Fixes #301 | |
232 | + * Added methods "require_from_group" and "skip_or_fill_minimum" | |
233 | + * Use correct iso code for swedish | |
234 | + * Updated demo HTML files to use HTML5 doctype | |
235 | + * Fixed regex issue for decimals without leading zeroes. Added new methods test. Fixes #41 | |
236 | + * Introduce a elementValue method that normalizes only string values (don't touch array value of multi-select). Fixes #116 | |
237 | + * Support for dynamically added submit buttons, and updated test case. Uses validateDelegate. Code from PR #9 | |
238 | + * Fix bad double quote in test fixtures | |
239 | + * Fix maxWords method to include the upper bound, not exclude it. Fixes #284 | |
240 | + * Fixed grammar error in german range validator message. Fixes #315 | |
241 | + * Fixed handling of multiple class names for errorClass option. Test by Max Lynch. Fixes #280 | |
242 | + * Fix jQuery.format usage, should be $.validator.format. Fixes #329 | |
243 | + * Methods for 'all' UK phone numbers + UK postcodes | |
244 | + * Pattern method: Convert string param to RegExp. Fixes issue #223 | |
245 | + * grammar error in german localization file | |
246 | + * Added Estonian localization for messages | |
247 | + * Improve tooltip handling on themerollered demo | |
248 | + * Add type="text" to input fields without type attribute to please qSA | |
249 | + * Update themerollered demo to use tooltip to show errors as overlay. | |
250 | + * Update themerollered demo to use latest jQuery UI (along with newer jQuery version). Move code around to speed up page load. | |
251 | + * Fixed min error message broken in Japanese. | |
252 | + * Update form plugin to latest version. Enhance the ajaxSubmit demo. | |
253 | + * Drop dateDE and numberDE methods from classRuleSettings, leftover from moving those to localized methods | |
254 | + * Passing submit event to submitHandler callback | |
255 | + * Fixed #219 - Fix valid() on elements with dependency-callback or dependency-expression. | |
256 | + * Improve build to remove dist dir to ensure only the current release gets zipped up | |
257 | + | |
258 | +1.9.0 | |
259 | +--- | |
260 | +* Added Basque (EU) localization | |
261 | +* Added Slovenian (SL) localization | |
262 | +* Fixed issue #127 - Finnish translations has one : instead of ; | |
263 | +* Fixed Russian localization, minor syntax issue | |
264 | +* Added in support for HTML5 input types, fixes #97 | |
265 | +* Improved HTML5 support by setting novalidate attribute on the form, and reading the type attribute. | |
266 | +* Fixed showLabel() removing all classes from error element. Remove only settings.validClass. Fixes #151. | |
267 | +* Added 'pattern' to additional-methods to validate against arbitrary regular expressions. | |
268 | +* Improved email method to not allow the dot at the end (valid by RFC, but unwanted here). Fixes #143 | |
269 | +* Fixed swedish and norwegian translations, min/max messages got switched. Fixes #181 | |
270 | +* Fixed #184 - resetForm: should unset lastElement | |
271 | +* Fixed #71 - improve existing time method and add time12h method for 12h am/pm time format | |
272 | +* Fixed #177 - Fix validation of a single radio or checkbox input | |
273 | +* Fixed #189 - :hidden elements are now ignored by default | |
274 | +* Fixed #194 - Required as attribute fails if jQuery>=1.6 - Use .prop instead of .attr | |
275 | +* Fixed #47, #39, #32 - Allowed credit card numbers to contain spaces as well as dashes (spaces are commonly input by users). | |
276 | + | |
277 | +1.8.1 | |
278 | +--- | |
279 | +* Added Thai (TH) localization, fixes #85 | |
280 | +* Added Vietnamese (VI) localization, thanks Ngoc | |
281 | +* Fixed issue #78. Error/Valid styling applies to all radio buttons of same group for required validation. | |
282 | +* Don't use form.elements as that isn't supported in jQuery 1.6 anymore. Its buggy as hell anyway (IE6-8: form.elements === form). | |
283 | + | |
284 | +1.8.0 | |
285 | +--- | |
286 | +* Improved NL localization (http://plugins.jquery.com/node/14120) | |
287 | +* Added Georgian (GE) localization, thanks Avtandil Kikabidze | |
288 | +* Added Serbian (SR) localization, thanks Aleksandar Milovac | |
289 | +* Added ipv4 and ipv6 to additional methods, thanks Natal Ngétal | |
290 | +* Added Japanese (JA) localization, thanks Bryan Meyerovich | |
291 | +* Added Catalan (CA) localization, thanks Xavier de Pedro | |
292 | +* Fixed missing var statements within for-in loops | |
293 | +* Fix for remote validation, where a formatted message got messed up (https://github.com/jzaefferer/jquery-validation/issues/11) | |
294 | +* Bugfixes for compatibility with jQuery 1.5.1, while maintaining backwards-compatibility | |
295 | + | |
296 | +1.7 | |
297 | +--- | |
298 | +* Added Lithuanian (LT) localization | |
299 | +* Added Greek (EL) localization (http://plugins.jquery.com/node/12319) | |
300 | +* Added Latvian (LV) localization (http://plugins.jquery.com/node/12349) | |
301 | +* Added Hebrew (HE) localization (http://plugins.jquery.com/node/12039) | |
302 | +* Fixed Spanish (ES) localization (http://plugins.jquery.com/node/12696) | |
303 | +* Added jQuery UI themerolled demo | |
304 | +* Removed cmxform.js | |
305 | +* Fixed four missing semicolons (http://plugins.jquery.com/node/12639) | |
306 | +* Renamed phone-method in additional-methods.js to phoneUS | |
307 | +* Added phoneUK and mobileUK methods to additional-methods.js (http://plugins.jquery.com/node/12359) | |
308 | +* Deep extend options to avoid modifying multiple forms when using the rules-method on a single element (http://plugins.jquery.com/node/12411) | |
309 | +* Bugfixes for compatibility with jQuery 1.4.2, while maintaining backwards-compatibility | |
310 | + | |
311 | +1.6 | |
312 | +--- | |
313 | +* Added Arabic (AR), Portuguese (PTPT), Persian (FA), Finnish (FI) and Bulgarian (BR) localization | |
314 | +* Updated Swedish (SE) localization (some missing html iso characters) | |
315 | +* Fixed $.validator.addMethod to properly handle empty string vs. undefined for the message argument | |
316 | +* Fixed two accidental global variables | |
317 | +* Enhanced min/max/rangeWords (in additional-methods.js) to strip html before counting; good when counting words in a richtext editor | |
318 | +* Added localized methods for DE, NL and PT, removing the dateDE and numberDE methods (use messages_de.js and methods_de.js with date and number methods instead) | |
319 | +* Fixed remote form submit synchronization, kudos to Matas Petrikas | |
320 | +* Improved interactive select validation, now validating also on click (via option or select, inconsistent across browsers); doesn't work in Safari, which doesn't trigger a click event at all on select elements; fixes http://plugins.jquery.com/node/11520 | |
321 | +* Updated to latest form plugin (2.36), fixing http://plugins.jquery.com/node/11487 | |
322 | +* Bind to blur event for equalTo target to revalidate when that target changes, fixes http://plugins.jquery.com/node/11450 | |
323 | +* Simplified select validation, delegating to jQuery's val() method to get the select value; should fix http://plugins.jquery.com/node/11239 | |
324 | +* Fixed default message for digits (http://plugins.jquery.com/node/9853) | |
325 | +* Fixed issue with cached remote message (http://plugins.jquery.com/node/11029 and http://plugins.jquery.com/node/9351) | |
326 | +* Fixed a missing semicolon in additional-methods.js (http://plugins.jquery.com/node/9233) | |
327 | +* Added automatic detection of substitution parameters in messages, removing the need to provide format functions (http://plugins.jquery.com/node/11195) | |
328 | +* Fixed an issue with :filled/:blank somewhat caused by Sizzle (http://plugins.jquery.com/node/11144) | |
329 | +* Added an integer method to additional-methods.js (http://plugins.jquery.com/node/9612) | |
330 | +* Fixed errorsFor method where the for-attribute contains characters that need escaping to be valid inside a selector (http://plugins.jquery.com/node/9611) | |
331 | + | |
332 | +1.5.5 | |
333 | +--- | |
334 | +* Fix for http://plugins.jquery.com/node/8659 | |
335 | +* Fixed trailing comma in messages_cs.js | |
336 | + | |
337 | +1.5.4 | |
338 | +--- | |
339 | +* Fixed remote method bug (http://plugins.jquery.com/node/8658) | |
340 | + | |
341 | +1.5.3 | |
342 | +--- | |
343 | +* Fixed a bug related to the wrapper-option, where all ancestor-elements that matched the wrapper-option where selected (http://plugins.jquery.com/node/7624) | |
344 | +* Updated multipart demo to use latest jQuery UI accordion | |
345 | +* Added dateNL and time methods to additionalMethods.js | |
346 | +* Added Traditional Chinese (Taiwan, tw) and Kazakhstan (KK) localization | |
347 | +* Moved jQuery.format (formerly String.format) to jQuery.validator.format, jQuery.format is deprecated and will be removed in 1.6 (see http://code.google.com/p/jquery-utils/issues/detail?id=15 for details) | |
348 | +* Cleaned up messages_pl.js and messages_ptbr.js (still defined messages for max/min/rangeValue, which were removed in 1.4) | |
349 | +* Fixed flawed boolean logic in valid-plugin-method for multiple elements; now all elements need to be valid for a boolean-true result (http://plugins.jquery.com/node/8481) | |
350 | +* Enhancement $.validator.addMethod: An undefined third message-argument won't overwrite an existing message (http://plugins.jquery.com/node/8443) | |
351 | +* Enhancement to submitHandler option: When used, click events on submit buttons are captured and the submitting button is inserted into the form before calling submitHandler, and removed afterwards; keeps submit buttons intact (http://plugins.jquery.com/node/7183#comment-3585) | |
352 | +* Added option validClass, default "valid", which adds that class to all valid elements, after validation (http://dev.jquery.com/ticket/2205) | |
353 | +* Added creditcardtypes method to additionalMethods.js, including tests (via http://dev.jquery.com/ticket/3635) | |
354 | +* Improved remote method to allow serverside message as a string, or true for valid, or false for invalid using the clientside defined message (http://dev.jquery.com/ticket/3807) | |
355 | +* Improved accept method to also accept a Drupal-style comma-separated list of values (http://plugins.jquery.com/node/8580) | |
356 | + | |
357 | +1.5.2 | |
358 | +--- | |
359 | +* Fixed messages in additional-methods.js for maxWords, minWords, and rangeWords to include call to $.format | |
360 | +* Fixed value passed to methods to exclude carriage return (\r), same as jQuery's val() does | |
361 | +* Added slovak (sk) localization | |
362 | +* Added demo for integration with jQuery UI tabs | |
363 | +* Added selects-grouping example to tabs demo (see second tab, birthdate field) | |
364 | + | |
365 | +1.5.1 | |
366 | +--- | |
367 | +* Updated marketo demo to use invalidHandler option instead of binding invalid-form event | |
368 | +* Added TinyMCE integration example | |
369 | +* Added ukrainian (ua) localization | |
370 | +* Fixed length validation to work with trimmed value (regression from 1.5 where general trimming before validation was removed) | |
371 | +* Various small fixes for compatibility with both 1.2.6 and 1.3 | |
372 | + | |
373 | +1.5 | |
374 | +--- | |
375 | +* Improved basic demo, validating confirm-password field after password changed | |
376 | +* Fixed basic validation to pass the untrimmed input value as the first parameter to validation methods, changed required accordingly; breaks existing custom method that rely on the trimming | |
377 | +* Added norwegian (no), italian (it), hungarian (hu) and romanian (ro) localization | |
378 | +* Fixed #3195: Two flaws in swedish localization | |
379 | +* Fixed #3503: Extended rules("add") to accept messages property: use to specify add custom messages to an element via rules("add", { messages: { required: "Required! " } }); | |
380 | +* Fixed #3356: Regression from #2908 when using meta-option | |
381 | +* Fixed #3370: Added ignoreTitle option, set to skip reading messages from the title attribute, helps to avoid issues with Google Toolbar; default is false for compatibility | |
382 | +* Fixed #3516: Trigger invalid-form event even when remote validation is involved | |
383 | +* Added invalidHandler option as a shortcut to bind("invalid-form", function() {}) | |
384 | +* Fixed Safari issue for loading indicator in ajaxSubmit-integration-demo (append to body first, then hide) | |
385 | +* Added test for creditcard validation and improved default message | |
386 | +* Enhanced remote validation, accepting options to passthrough to $.ajax as parameter (either url string or options, including url property plus everything else that $.ajax supports) | |
387 | + | |
388 | +1.4 | |
389 | +--- | |
390 | +* Fixed #2931, validate elements in document order and ignore type=image inputs | |
391 | +* Fixed usage of $ and jQuery variables, now fully compatible with all variations of noConflict usage | |
392 | +* Implemented #2908, enabling custom messages via metadata ala class="{required:true,messages:{required:'required field'}}", added demo/custom-messages-metadata-demo.html | |
393 | +* Removed deprecated methods minValue (min), maxValue (max), rangeValue (rangevalue), minLength (minlength), maxLength (maxlength), rangeLength (rangelength) | |
394 | +* Fixed #2215 regression: Call unhighlight only for current elements, not everything | |
395 | +* Implemented #2989, enabling image button to cancel validation | |
396 | +* Fixed issue where IE incorrectly validates against maxlength=0 | |
397 | +* Added czech (cs) localization | |
398 | +* Reset validator.submitted on validator.resetForm(), enabling a full reset when necessary | |
399 | +* Fixed #3035, skipping all falsy attributes when reading rules (0, undefined, empty string), removed part of the maxlength workaround (for 0) | |
400 | +* Added dutch (nl) localization (#3201) | |
401 | + | |
402 | +1.3 | |
403 | +--- | |
404 | +* Fixed invalid-form event, now only triggered when form is invalid | |
405 | +* Added spanish (es), russian (ru), portuguese brazilian (ptbr), turkish (tr), and polish (pl) localization | |
406 | +* Added removeAttrs plugin to facilitate adding and removing multiple attributes | |
407 | +* Added groups option to display a single message for multiple elements, via groups: { arbitraryGroupName: "fieldName1 fieldName2[, fieldNameN" } | |
408 | +* Enhanced rules() for adding and removing (static) rules: rules("add", "method1[, methodN]"/{method1:param[, method_n:param]}) and rules("remove"[, "method1[, method_n]") | |
409 | +* Enhanced rules-option, accepts space-separated string-list of methods, eg. {birthdate: "required date"} | |
410 | +* Fixed checkbox group validation with inline rules: As long as the rules are specified on the first element, the group is now properly validated on click | |
411 | +* Fixed #2473, ignoring all rules with an explicit parameter of boolean-false, eg. required:false is the same as not specifying required at all (it was handled as required:true so far) | |
412 | +* Fixed #2424, with a modified patch from #2473: Methods returning a dependency-mismatch don't stop other rules from being evaluated anymore; still, success isn't applied for optional fields | |
413 | +* Fixed url and email validation to not use trimmed values | |
414 | +* Fixed creditcard validation to accept only digits and dashes ("asdf" is not a valid creditcard number) | |
415 | +* Allow both button and input elements for cancel buttons (via class="cancel") | |
416 | +* Fixed #2215: Fixed message display to call unhighlight as part of showing and hiding messages, no more visual side-effects while checking an element and extracted validator.checkForm to validate a form without UI sideeffects | |
417 | +* Rewrote custom selectors (:blank, :filled, :unchecked) with functions for compatibility with AIR | |
418 | + | |
419 | +1.2.1 | |
420 | +----- | |
421 | + | |
422 | +* Bundled delegate plugin with validate plugin - its always required anyway | |
423 | +* Improved remote validation to include parts from the ajaxQueue plugin for proper synchronization (no additional plugin necessary) | |
424 | +* Fixed stopRequest to prevent pendingRequest < 0 | |
425 | +* Added jQuery.validator.autoCreateRanges property, defaults to false, enable to convert min/max to range and minlength/maxlength to rangelength; this basically fixes the issue introduced by automatically creating ranges in 1.2 | |
426 | +* Fixed optional-methods to not highlight anything at all if the field is blank, that is, don't trigger success | |
427 | +* Allow false/null for highlight/unhighlight options instead of forcing a do-nothing-callback even when nothing needs to be highlighted | |
428 | +* Fixed validate() call with no elements selected, returning undefined instead of throwing an error | |
429 | +* Improved demo, replacing metadata with classes/attributes for specifying rules | |
430 | +* Fixed error when no custom message is used for remote validation | |
431 | +* Modified email and url validation to require domain label and top label | |
432 | +* Fixed url and email validation to require TLD (actually to require domain label); 1.2 version (TLD is optional) is moved to additions as url2 and email2 | |
433 | +* Fixed dynamic-totals demo in IE6/7 and improved templating, using textarea to store multiline template and string interpolation | |
434 | +* Added login form example with "Email password" link that makes the password field optional | |
435 | +* Enhanced dynamic-totals demo with an example of a single message for two fields | |
436 | + | |
437 | +1.2 | |
438 | +--- | |
439 | + | |
440 | +* Added AJAX-captcha validation example (based on http://psyrens.com/captcha/) | |
441 | +* Added remember-the-milk-demo (thanks RTM team for the permission!) | |
442 | +* Added marketo-demo (thanks Glen Lipka!) | |
443 | +* Added support for ajax-validation, see method "remote"; serverside returns JSON, true for valid elements, false or a String for invalid, String is used as message | |
444 | +* Added highlight and unhighlight options, by default toggles errorClass on element, allows custom highlighting | |
445 | +* Added valid() plugin method for easy programmatic checking of forms and fields without the need to use the validator API | |
446 | +* Added rules() plugin method to read and write rules for an element (currently read only) | |
447 | +* Replaced regex for email method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/email_address_validation/ | |
448 | +* Restructured event architecture to rely solely on delegation, both improving performance, and ease-of-use for the developer (requires jquery.delegate.js) | |
449 | +* Moved documentation from inline to http://docs.jquery.com/Plugins/Validation - including interactive examples for all methods | |
450 | +* Removed validator.refresh(), validation is now completely dynamic | |
451 | +* Renamed minValue to min, maxValue to max and rangeValue to range, deprecating the previous names (to be removed in 1.3) | |
452 | +* Renamed minLength to minlength, maxLength to maxlength and rangeLength to rangelength, deprecating the previous names (to be removed in 1.3) | |
453 | +* Added feature to merge min + max into and range and minlength + maxlength into rangelength | |
454 | +* Added support for dynamic rule parameters, allowing to specify a function as a parameter eg. for minlength, called when validating the element | |
455 | +* Allow to specify null or an empty string as a message to display nothing (see marketo demo) | |
456 | +* Rules overhaul: Now supports combination of rules-option, metadata, classes (new) and attributes (new), see rules() for details | |
457 | + | |
458 | +1.1.2 | |
459 | +--- | |
460 | + | |
461 | +* Replaced regex for URL method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/iri/ | |
462 | +* Improved email method to better handle unicode characters | |
463 | +* Fixed error container to hide when all elements are valid, not only on form submit | |
464 | +* Fixed String.format to jQuery.format (moving into jQuery namespace) | |
465 | +* Fixed accept method to accept both upper and lowercase extensions | |
466 | +* Fixed validate() plugin method to create only one validator instance for a given form and always return that one instance (avoids binding events multiple times) | |
467 | +* Changed debug-mode console log from "error" to "warn" level | |
468 | + | |
469 | +1.1.1 | |
470 | +----- | |
471 | + | |
472 | +* Fixed invalid XHTML, preventing error label creation in IE since jQuery 1.1.4 | |
473 | +* Fixed and improved String.format: Global search & replace, better handling of array arguments | |
474 | +* Fixed cancel-button handling to use validator-object for storing state instead of form element | |
475 | +* Fixed name selectors to handle "complex" names, eg. containing brackets ("list[]") | |
476 | +* Added button and disabled elements to exclude from validation | |
477 | +* Moved element event handlers to refresh to be able to add handlers to new elements | |
478 | +* Fixed email validation to allow long top level domains (eg. ".travel") | |
479 | +* Moved showErrors() from valid() to form() | |
480 | +* Added validator.size(): returns the number of current errors | |
481 | +* Call submitHandler with validator as scope for easier access of it's methods, eg. to find error labels using errorsFor(Element) | |
482 | +* Compatible with jQuery 1.1.x and 1.2.x | |
483 | + | |
484 | +1.1 | |
485 | +--- | |
486 | + | |
487 | +* Added validation on blur, keyup and click (for checkboxes and radiobutton). Replaces event-option. | |
488 | +* Fixed resetForm | |
489 | +* Fixed custom-methods-demo | |
490 | + | |
491 | +1.0 | |
492 | +--- | |
493 | + | |
494 | +* Improved number and numberDE methods to check for correct decimal numbers with delimiters | |
495 | +* Only elements that have rules are checked (otherwise success-option is applied to all elements) | |
496 | +* Added creditcard number method (thanks to Brian Klug) | |
497 | +* Added ignore-option, eg. ignore: "[@type=hidden]", using that expression to exclude elements to validate. Default: none, though submit and reset buttons are always ignored | |
498 | +* Heavily enhanced Functions-as-messages by providing a flexible String.format helper | |
499 | +* Accept Functions as messages, providing runtime-custom-messages | |
500 | +* Fixed exclusion of elements without rules from successList | |
501 | +* Fixed custom-method-demo, replaced the alert with message displaying the number of errors | |
502 | +* Fixed form-submit-prevention when using submitHandler | |
503 | +* Completely removed dependency on element IDs, though they are still used (when present) to link error labels to inputs. Achieved by using | |
504 | + an array with {name, message, element} instead of an object with id:message pairs for the internal errorList. | |
505 | +* Added support for specifying simple rules as simple strings, eg. "required" is equivalent to {required: true} | |
506 | +* Added feature: Add errorClass to invalid field�s parent element, making it easy to style the label/field container or the label for the field. | |
507 | +* Added feature: focusCleanup - If enabled, removes the errorClass from the invalid elements and hides all errors messages whenever the element is focused. | |
508 | +* Added success option to show the a field was validated successfully | |
509 | +* Fixed Opera select-issue (avoiding a attribute-collision) | |
510 | +* Fixed problems with focussing hidden elements in IE | |
511 | +* Added feature to skip validation for submit buttons with class "cancel" | |
512 | +* Fixed potential issues with Google Toolbar by preferring plugin option messages over title attribute | |
513 | +* submitHandler is only called when an actual submit event was handled, validator.form() returns false only for invalid forms | |
514 | +* Invalid elements are now focused only on submit or via validator.focusInvalid(), avoiding all trouble with focus-on-blur | |
515 | +* IE6 error container layout issue is solved | |
516 | +* Customize error element via errorElement option | |
517 | +* Added validator.refresh() to find new inputs in the form | |
518 | +* Added accept validation method, checks file extensions | |
519 | +* Improved dependency feature by adding two custom expressions: ":blank" to select elements with an empty value and �:filled� to select elements with a value, both excluding whitespace | |
520 | +* Added a resetForm() method to the validator: Resets each form element (using the form plugin, if available), removes classes on invalid elements and hides all error messages | |
521 | +* Fixed docs for validator.showErrors() | |
522 | +* Fixed error label creation to always use html() instead of text(), allowing arbitrary HTML passed in as messages | |
523 | +* Fixed error label creation to use specified error class | |
524 | +* Added dependency feature: The requires method accepts both String (jQuery expressions) and Functions as the argument | |
525 | +* Heavily improved customizing of error message display: Use normal messages and show/hide an additional container; Completely replace message display with own mechanism (while being able to delegate to the default handler; Customize placing of generated labels (instead of default below-element) | |
526 | +* Fixed two major bugs in IE (error containers) and Opera (metadata) | |
527 | +* Modified validation methods to accept empty fields as valid (exception: of course �required� and also �equalTo� methods) | |
528 | +* Renamed "min" to "minLength", "max" to "maxLength", "length" to "rangeLength" | |
529 | +* Added "minValue", "maxValue" and "rangeValue" | |
530 | +* Streamlined API for support of different events. The default, submit, can be disabled. If any event is specified, that is applied to each element (instead of the entire form). Combining keyup-validation with submit-validation is now extremely easy to setup | |
531 | +* Added support for one-message-per-rule when defining messages via plugin settings | |
532 | +* Added support to wrap metadata in some parent element. Useful when metadata is used for other plugins, too. | |
533 | +* Refactored tests and demos: Less files, better demos | |
534 | +* Improved documentation: More examples for methods, more reference texts explaining some basics | ... | ... |
bower_components/jquery-validation/dist/additional-methods.js
0 → 100644
1 | +/*! | |
2 | + * jQuery Validation Plugin v1.15.0 | |
3 | + * | |
4 | + * http://jqueryvalidation.org/ | |
5 | + * | |
6 | + * Copyright (c) 2016 Jörn Zaefferer | |
7 | + * Released under the MIT license | |
8 | + */ | |
9 | +(function( factory ) { | |
10 | + if ( typeof define === "function" && define.amd ) { | |
11 | + define( ["jquery", "./jquery.validate"], factory ); | |
12 | + } else if (typeof module === "object" && module.exports) { | |
13 | + module.exports = factory( require( "jquery" ) ); | |
14 | + } else { | |
15 | + factory( jQuery ); | |
16 | + } | |
17 | +}(function( $ ) { | |
18 | + | |
19 | +( function() { | |
20 | + | |
21 | + function stripHtml( value ) { | |
22 | + | |
23 | + // Remove html tags and space chars | |
24 | + return value.replace( /<.[^<>]*?>/g, " " ).replace( / | /gi, " " ) | |
25 | + | |
26 | + // Remove punctuation | |
27 | + .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" ); | |
28 | + } | |
29 | + | |
30 | + $.validator.addMethod( "maxWords", function( value, element, params ) { | |
31 | + return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length <= params; | |
32 | + }, $.validator.format( "Please enter {0} words or less." ) ); | |
33 | + | |
34 | + $.validator.addMethod( "minWords", function( value, element, params ) { | |
35 | + return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length >= params; | |
36 | + }, $.validator.format( "Please enter at least {0} words." ) ); | |
37 | + | |
38 | + $.validator.addMethod( "rangeWords", function( value, element, params ) { | |
39 | + var valueStripped = stripHtml( value ), | |
40 | + regex = /\b\w+\b/g; | |
41 | + return this.optional( element ) || valueStripped.match( regex ).length >= params[ 0 ] && valueStripped.match( regex ).length <= params[ 1 ]; | |
42 | + }, $.validator.format( "Please enter between {0} and {1} words." ) ); | |
43 | + | |
44 | +}() ); | |
45 | + | |
46 | +// Accept a value from a file input based on a required mimetype | |
47 | +$.validator.addMethod( "accept", function( value, element, param ) { | |
48 | + | |
49 | + // Split mime on commas in case we have multiple types we can accept | |
50 | + var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*", | |
51 | + optionalValue = this.optional( element ), | |
52 | + i, file, regex; | |
53 | + | |
54 | + // Element is optional | |
55 | + if ( optionalValue ) { | |
56 | + return optionalValue; | |
57 | + } | |
58 | + | |
59 | + if ( $( element ).attr( "type" ) === "file" ) { | |
60 | + | |
61 | + // Escape string to be used in the regex | |
62 | + // see: http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex | |
63 | + // Escape also "/*" as "/.*" as a wildcard | |
64 | + typeParam = typeParam.replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" ).replace( /,/g, "|" ).replace( "\/*", "/.*" ); | |
65 | + | |
66 | + // Check if the element has a FileList before checking each file | |
67 | + if ( element.files && element.files.length ) { | |
68 | + regex = new RegExp( ".?(" + typeParam + ")$", "i" ); | |
69 | + for ( i = 0; i < element.files.length; i++ ) { | |
70 | + file = element.files[ i ]; | |
71 | + | |
72 | + // Grab the mimetype from the loaded file, verify it matches | |
73 | + if ( !file.type.match( regex ) ) { | |
74 | + return false; | |
75 | + } | |
76 | + } | |
77 | + } | |
78 | + } | |
79 | + | |
80 | + // Either return true because we've validated each file, or because the | |
81 | + // browser does not support element.files and the FileList feature | |
82 | + return true; | |
83 | +}, $.validator.format( "Please enter a value with a valid mimetype." ) ); | |
84 | + | |
85 | +$.validator.addMethod( "alphanumeric", function( value, element ) { | |
86 | + return this.optional( element ) || /^\w+$/i.test( value ); | |
87 | +}, "Letters, numbers, and underscores only please" ); | |
88 | + | |
89 | +/* | |
90 | + * Dutch bank account numbers (not 'giro' numbers) have 9 digits | |
91 | + * and pass the '11 check'. | |
92 | + * We accept the notation with spaces, as that is common. | |
93 | + * acceptable: 123456789 or 12 34 56 789 | |
94 | + */ | |
95 | +$.validator.addMethod( "bankaccountNL", function( value, element ) { | |
96 | + if ( this.optional( element ) ) { | |
97 | + return true; | |
98 | + } | |
99 | + if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) { | |
100 | + return false; | |
101 | + } | |
102 | + | |
103 | + // Now '11 check' | |
104 | + var account = value.replace( / /g, "" ), // Remove spaces | |
105 | + sum = 0, | |
106 | + len = account.length, | |
107 | + pos, factor, digit; | |
108 | + for ( pos = 0; pos < len; pos++ ) { | |
109 | + factor = len - pos; | |
110 | + digit = account.substring( pos, pos + 1 ); | |
111 | + sum = sum + factor * digit; | |
112 | + } | |
113 | + return sum % 11 === 0; | |
114 | +}, "Please specify a valid bank account number" ); | |
115 | + | |
116 | +$.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { | |
117 | + return this.optional( element ) || | |
118 | + ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || | |
119 | + ( $.validator.methods.giroaccountNL.call( this, value, element ) ); | |
120 | +}, "Please specify a valid bank or giro account number" ); | |
121 | + | |
122 | +/** | |
123 | + * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity. | |
124 | + * | |
125 | + * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional) | |
126 | + * | |
127 | + * Validation is case-insensitive. Please make sure to normalize input yourself. | |
128 | + * | |
129 | + * BIC definition in detail: | |
130 | + * - First 4 characters - bank code (only letters) | |
131 | + * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters) | |
132 | + * - Next 2 characters - location code (letters and digits) | |
133 | + * a. shall not start with '0' or '1' | |
134 | + * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing) | |
135 | + * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits) | |
136 | + */ | |
137 | +$.validator.addMethod( "bic", function( value, element ) { | |
138 | + return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); | |
139 | +}, "Please specify a valid BIC code" ); | |
140 | + | |
141 | +/* | |
142 | + * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities | |
143 | + * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal | |
144 | + */ | |
145 | +$.validator.addMethod( "cifES", function( value ) { | |
146 | + "use strict"; | |
147 | + | |
148 | + var num = [], | |
149 | + controlDigit, sum, i, count, tmp, secondDigit; | |
150 | + | |
151 | + value = value.toUpperCase(); | |
152 | + | |
153 | + // Quick format test | |
154 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
155 | + return false; | |
156 | + } | |
157 | + | |
158 | + for ( i = 0; i < 9; i++ ) { | |
159 | + num[ i ] = parseInt( value.charAt( i ), 10 ); | |
160 | + } | |
161 | + | |
162 | + // Algorithm for checking CIF codes | |
163 | + sum = num[ 2 ] + num[ 4 ] + num[ 6 ]; | |
164 | + for ( count = 1; count < 8; count += 2 ) { | |
165 | + tmp = ( 2 * num[ count ] ).toString(); | |
166 | + secondDigit = tmp.charAt( 1 ); | |
167 | + | |
168 | + sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) ); | |
169 | + } | |
170 | + | |
171 | + /* The first (position 1) is a letter following the following criteria: | |
172 | + * A. Corporations | |
173 | + * B. LLCs | |
174 | + * C. General partnerships | |
175 | + * D. Companies limited partnerships | |
176 | + * E. Communities of goods | |
177 | + * F. Cooperative Societies | |
178 | + * G. Associations | |
179 | + * H. Communities of homeowners in horizontal property regime | |
180 | + * J. Civil Societies | |
181 | + * K. Old format | |
182 | + * L. Old format | |
183 | + * M. Old format | |
184 | + * N. Nonresident entities | |
185 | + * P. Local authorities | |
186 | + * Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions | |
187 | + * R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008) | |
188 | + * S. Organs of State Administration and regions | |
189 | + * V. Agrarian Transformation | |
190 | + * W. Permanent establishments of non-resident in Spain | |
191 | + */ | |
192 | + if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) { | |
193 | + sum += ""; | |
194 | + controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 ); | |
195 | + value += controlDigit; | |
196 | + return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) ); | |
197 | + } | |
198 | + | |
199 | + return false; | |
200 | + | |
201 | +}, "Please specify a valid CIF number." ); | |
202 | + | |
203 | +/* | |
204 | + * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number. | |
205 | + * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. | |
206 | + */ | |
207 | +$.validator.addMethod( "cpfBR", function( value ) { | |
208 | + | |
209 | + // Removing special characters from value | |
210 | + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); | |
211 | + | |
212 | + // Checking value to have 11 digits only | |
213 | + if ( value.length !== 11 ) { | |
214 | + return false; | |
215 | + } | |
216 | + | |
217 | + var sum = 0, | |
218 | + firstCN, secondCN, checkResult, i; | |
219 | + | |
220 | + firstCN = parseInt( value.substring( 9, 10 ), 10 ); | |
221 | + secondCN = parseInt( value.substring( 10, 11 ), 10 ); | |
222 | + | |
223 | + checkResult = function( sum, cn ) { | |
224 | + var result = ( sum * 10 ) % 11; | |
225 | + if ( ( result === 10 ) || ( result === 11 ) ) { | |
226 | + result = 0; | |
227 | + } | |
228 | + return ( result === cn ); | |
229 | + }; | |
230 | + | |
231 | + // Checking for dump data | |
232 | + if ( value === "" || | |
233 | + value === "00000000000" || | |
234 | + value === "11111111111" || | |
235 | + value === "22222222222" || | |
236 | + value === "33333333333" || | |
237 | + value === "44444444444" || | |
238 | + value === "55555555555" || | |
239 | + value === "66666666666" || | |
240 | + value === "77777777777" || | |
241 | + value === "88888888888" || | |
242 | + value === "99999999999" | |
243 | + ) { | |
244 | + return false; | |
245 | + } | |
246 | + | |
247 | + // Step 1 - using first Check Number: | |
248 | + for ( i = 1; i <= 9; i++ ) { | |
249 | + sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 11 - i ); | |
250 | + } | |
251 | + | |
252 | + // If first Check Number (CN) is valid, move to Step 2 - using second Check Number: | |
253 | + if ( checkResult( sum, firstCN ) ) { | |
254 | + sum = 0; | |
255 | + for ( i = 1; i <= 10; i++ ) { | |
256 | + sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 12 - i ); | |
257 | + } | |
258 | + return checkResult( sum, secondCN ); | |
259 | + } | |
260 | + return false; | |
261 | + | |
262 | +}, "Please specify a valid CPF number" ); | |
263 | + | |
264 | +// http://jqueryvalidation.org/creditcard-method/ | |
265 | +// based on http://en.wikipedia.org/wiki/Luhn_algorithm | |
266 | +$.validator.addMethod( "creditcard", function( value, element ) { | |
267 | + if ( this.optional( element ) ) { | |
268 | + return "dependency-mismatch"; | |
269 | + } | |
270 | + | |
271 | + // Accept only spaces, digits and dashes | |
272 | + if ( /[^0-9 \-]+/.test( value ) ) { | |
273 | + return false; | |
274 | + } | |
275 | + | |
276 | + var nCheck = 0, | |
277 | + nDigit = 0, | |
278 | + bEven = false, | |
279 | + n, cDigit; | |
280 | + | |
281 | + value = value.replace( /\D/g, "" ); | |
282 | + | |
283 | + // Basing min and max length on | |
284 | + // http://developer.ean.com/general_info/Valid_Credit_Card_Types | |
285 | + if ( value.length < 13 || value.length > 19 ) { | |
286 | + return false; | |
287 | + } | |
288 | + | |
289 | + for ( n = value.length - 1; n >= 0; n-- ) { | |
290 | + cDigit = value.charAt( n ); | |
291 | + nDigit = parseInt( cDigit, 10 ); | |
292 | + if ( bEven ) { | |
293 | + if ( ( nDigit *= 2 ) > 9 ) { | |
294 | + nDigit -= 9; | |
295 | + } | |
296 | + } | |
297 | + | |
298 | + nCheck += nDigit; | |
299 | + bEven = !bEven; | |
300 | + } | |
301 | + | |
302 | + return ( nCheck % 10 ) === 0; | |
303 | +}, "Please enter a valid credit card number." ); | |
304 | + | |
305 | +/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator | |
306 | + * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 | |
307 | + * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) | |
308 | + */ | |
309 | +$.validator.addMethod( "creditcardtypes", function( value, element, param ) { | |
310 | + if ( /[^0-9\-]+/.test( value ) ) { | |
311 | + return false; | |
312 | + } | |
313 | + | |
314 | + value = value.replace( /\D/g, "" ); | |
315 | + | |
316 | + var validTypes = 0x0000; | |
317 | + | |
318 | + if ( param.mastercard ) { | |
319 | + validTypes |= 0x0001; | |
320 | + } | |
321 | + if ( param.visa ) { | |
322 | + validTypes |= 0x0002; | |
323 | + } | |
324 | + if ( param.amex ) { | |
325 | + validTypes |= 0x0004; | |
326 | + } | |
327 | + if ( param.dinersclub ) { | |
328 | + validTypes |= 0x0008; | |
329 | + } | |
330 | + if ( param.enroute ) { | |
331 | + validTypes |= 0x0010; | |
332 | + } | |
333 | + if ( param.discover ) { | |
334 | + validTypes |= 0x0020; | |
335 | + } | |
336 | + if ( param.jcb ) { | |
337 | + validTypes |= 0x0040; | |
338 | + } | |
339 | + if ( param.unknown ) { | |
340 | + validTypes |= 0x0080; | |
341 | + } | |
342 | + if ( param.all ) { | |
343 | + validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; | |
344 | + } | |
345 | + if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard | |
346 | + return value.length === 16; | |
347 | + } | |
348 | + if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa | |
349 | + return value.length === 16; | |
350 | + } | |
351 | + if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex | |
352 | + return value.length === 15; | |
353 | + } | |
354 | + if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub | |
355 | + return value.length === 14; | |
356 | + } | |
357 | + if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute | |
358 | + return value.length === 15; | |
359 | + } | |
360 | + if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover | |
361 | + return value.length === 16; | |
362 | + } | |
363 | + if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb | |
364 | + return value.length === 16; | |
365 | + } | |
366 | + if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb | |
367 | + return value.length === 15; | |
368 | + } | |
369 | + if ( validTypes & 0x0080 ) { // Unknown | |
370 | + return true; | |
371 | + } | |
372 | + return false; | |
373 | +}, "Please enter a valid credit card number." ); | |
374 | + | |
375 | +/** | |
376 | + * Validates currencies with any given symbols by @jameslouiz | |
377 | + * Symbols can be optional or required. Symbols required by default | |
378 | + * | |
379 | + * Usage examples: | |
380 | + * currency: ["£", false] - Use false for soft currency validation | |
381 | + * currency: ["$", false] | |
382 | + * currency: ["RM", false] - also works with text based symbols such as "RM" - Malaysia Ringgit etc | |
383 | + * | |
384 | + * <input class="currencyInput" name="currencyInput"> | |
385 | + * | |
386 | + * Soft symbol checking | |
387 | + * currencyInput: { | |
388 | + * currency: ["$", false] | |
389 | + * } | |
390 | + * | |
391 | + * Strict symbol checking (default) | |
392 | + * currencyInput: { | |
393 | + * currency: "$" | |
394 | + * //OR | |
395 | + * currency: ["$", true] | |
396 | + * } | |
397 | + * | |
398 | + * Multiple Symbols | |
399 | + * currencyInput: { | |
400 | + * currency: "$,£,¢" | |
401 | + * } | |
402 | + */ | |
403 | +$.validator.addMethod( "currency", function( value, element, param ) { | |
404 | + var isParamString = typeof param === "string", | |
405 | + symbol = isParamString ? param : param[ 0 ], | |
406 | + soft = isParamString ? true : param[ 1 ], | |
407 | + regex; | |
408 | + | |
409 | + symbol = symbol.replace( /,/g, "" ); | |
410 | + symbol = soft ? symbol + "]" : symbol + "]?"; | |
411 | + regex = "^[" + symbol + "([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$"; | |
412 | + regex = new RegExp( regex ); | |
413 | + return this.optional( element ) || regex.test( value ); | |
414 | + | |
415 | +}, "Please specify a valid currency" ); | |
416 | + | |
417 | +$.validator.addMethod( "dateFA", function( value, element ) { | |
418 | + return this.optional( element ) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test( value ); | |
419 | +}, $.validator.messages.date ); | |
420 | + | |
421 | +/** | |
422 | + * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy. | |
423 | + * | |
424 | + * @example $.validator.methods.date("01/01/1900") | |
425 | + * @result true | |
426 | + * | |
427 | + * @example $.validator.methods.date("01/13/1990") | |
428 | + * @result false | |
429 | + * | |
430 | + * @example $.validator.methods.date("01.01.1900") | |
431 | + * @result false | |
432 | + * | |
433 | + * @example <input name="pippo" class="{dateITA:true}" /> | |
434 | + * @desc Declares an optional input element whose value must be a valid date. | |
435 | + * | |
436 | + * @name $.validator.methods.dateITA | |
437 | + * @type Boolean | |
438 | + * @cat Plugins/Validate/Methods | |
439 | + */ | |
440 | +$.validator.addMethod( "dateITA", function( value, element ) { | |
441 | + var check = false, | |
442 | + re = /^\d{1,2}\/\d{1,2}\/\d{4}$/, | |
443 | + adata, gg, mm, aaaa, xdata; | |
444 | + if ( re.test( value ) ) { | |
445 | + adata = value.split( "/" ); | |
446 | + gg = parseInt( adata[ 0 ], 10 ); | |
447 | + mm = parseInt( adata[ 1 ], 10 ); | |
448 | + aaaa = parseInt( adata[ 2 ], 10 ); | |
449 | + xdata = new Date( Date.UTC( aaaa, mm - 1, gg, 12, 0, 0, 0 ) ); | |
450 | + if ( ( xdata.getUTCFullYear() === aaaa ) && ( xdata.getUTCMonth() === mm - 1 ) && ( xdata.getUTCDate() === gg ) ) { | |
451 | + check = true; | |
452 | + } else { | |
453 | + check = false; | |
454 | + } | |
455 | + } else { | |
456 | + check = false; | |
457 | + } | |
458 | + return this.optional( element ) || check; | |
459 | +}, $.validator.messages.date ); | |
460 | + | |
461 | +$.validator.addMethod( "dateNL", function( value, element ) { | |
462 | + return this.optional( element ) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test( value ); | |
463 | +}, $.validator.messages.date ); | |
464 | + | |
465 | +// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept | |
466 | +$.validator.addMethod( "extension", function( value, element, param ) { | |
467 | + param = typeof param === "string" ? param.replace( /,/g, "|" ) : "png|jpe?g|gif"; | |
468 | + return this.optional( element ) || value.match( new RegExp( "\\.(" + param + ")$", "i" ) ); | |
469 | +}, $.validator.format( "Please enter a value with a valid extension." ) ); | |
470 | + | |
471 | +/** | |
472 | + * Dutch giro account numbers (not bank numbers) have max 7 digits | |
473 | + */ | |
474 | +$.validator.addMethod( "giroaccountNL", function( value, element ) { | |
475 | + return this.optional( element ) || /^[0-9]{1,7}$/.test( value ); | |
476 | +}, "Please specify a valid giro account number" ); | |
477 | + | |
478 | +/** | |
479 | + * IBAN is the international bank account number. | |
480 | + * It has a country - specific format, that is checked here too | |
481 | + * | |
482 | + * Validation is case-insensitive. Please make sure to normalize input yourself. | |
483 | + */ | |
484 | +$.validator.addMethod( "iban", function( value, element ) { | |
485 | + | |
486 | + // Some quick simple tests to prevent needless work | |
487 | + if ( this.optional( element ) ) { | |
488 | + return true; | |
489 | + } | |
490 | + | |
491 | + // Remove spaces and to upper case | |
492 | + var iban = value.replace( / /g, "" ).toUpperCase(), | |
493 | + ibancheckdigits = "", | |
494 | + leadingZeroes = true, | |
495 | + cRest = "", | |
496 | + cOperator = "", | |
497 | + countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; | |
498 | + | |
499 | + // Check the country code and find the country specific format | |
500 | + countrycode = iban.substring( 0, 2 ); | |
501 | + bbancountrypatterns = { | |
502 | + "AL": "\\d{8}[\\dA-Z]{16}", | |
503 | + "AD": "\\d{8}[\\dA-Z]{12}", | |
504 | + "AT": "\\d{16}", | |
505 | + "AZ": "[\\dA-Z]{4}\\d{20}", | |
506 | + "BE": "\\d{12}", | |
507 | + "BH": "[A-Z]{4}[\\dA-Z]{14}", | |
508 | + "BA": "\\d{16}", | |
509 | + "BR": "\\d{23}[A-Z][\\dA-Z]", | |
510 | + "BG": "[A-Z]{4}\\d{6}[\\dA-Z]{8}", | |
511 | + "CR": "\\d{17}", | |
512 | + "HR": "\\d{17}", | |
513 | + "CY": "\\d{8}[\\dA-Z]{16}", | |
514 | + "CZ": "\\d{20}", | |
515 | + "DK": "\\d{14}", | |
516 | + "DO": "[A-Z]{4}\\d{20}", | |
517 | + "EE": "\\d{16}", | |
518 | + "FO": "\\d{14}", | |
519 | + "FI": "\\d{14}", | |
520 | + "FR": "\\d{10}[\\dA-Z]{11}\\d{2}", | |
521 | + "GE": "[\\dA-Z]{2}\\d{16}", | |
522 | + "DE": "\\d{18}", | |
523 | + "GI": "[A-Z]{4}[\\dA-Z]{15}", | |
524 | + "GR": "\\d{7}[\\dA-Z]{16}", | |
525 | + "GL": "\\d{14}", | |
526 | + "GT": "[\\dA-Z]{4}[\\dA-Z]{20}", | |
527 | + "HU": "\\d{24}", | |
528 | + "IS": "\\d{22}", | |
529 | + "IE": "[\\dA-Z]{4}\\d{14}", | |
530 | + "IL": "\\d{19}", | |
531 | + "IT": "[A-Z]\\d{10}[\\dA-Z]{12}", | |
532 | + "KZ": "\\d{3}[\\dA-Z]{13}", | |
533 | + "KW": "[A-Z]{4}[\\dA-Z]{22}", | |
534 | + "LV": "[A-Z]{4}[\\dA-Z]{13}", | |
535 | + "LB": "\\d{4}[\\dA-Z]{20}", | |
536 | + "LI": "\\d{5}[\\dA-Z]{12}", | |
537 | + "LT": "\\d{16}", | |
538 | + "LU": "\\d{3}[\\dA-Z]{13}", | |
539 | + "MK": "\\d{3}[\\dA-Z]{10}\\d{2}", | |
540 | + "MT": "[A-Z]{4}\\d{5}[\\dA-Z]{18}", | |
541 | + "MR": "\\d{23}", | |
542 | + "MU": "[A-Z]{4}\\d{19}[A-Z]{3}", | |
543 | + "MC": "\\d{10}[\\dA-Z]{11}\\d{2}", | |
544 | + "MD": "[\\dA-Z]{2}\\d{18}", | |
545 | + "ME": "\\d{18}", | |
546 | + "NL": "[A-Z]{4}\\d{10}", | |
547 | + "NO": "\\d{11}", | |
548 | + "PK": "[\\dA-Z]{4}\\d{16}", | |
549 | + "PS": "[\\dA-Z]{4}\\d{21}", | |
550 | + "PL": "\\d{24}", | |
551 | + "PT": "\\d{21}", | |
552 | + "RO": "[A-Z]{4}[\\dA-Z]{16}", | |
553 | + "SM": "[A-Z]\\d{10}[\\dA-Z]{12}", | |
554 | + "SA": "\\d{2}[\\dA-Z]{18}", | |
555 | + "RS": "\\d{18}", | |
556 | + "SK": "\\d{20}", | |
557 | + "SI": "\\d{15}", | |
558 | + "ES": "\\d{20}", | |
559 | + "SE": "\\d{20}", | |
560 | + "CH": "\\d{5}[\\dA-Z]{12}", | |
561 | + "TN": "\\d{20}", | |
562 | + "TR": "\\d{5}[\\dA-Z]{17}", | |
563 | + "AE": "\\d{3}\\d{16}", | |
564 | + "GB": "[A-Z]{4}\\d{14}", | |
565 | + "VG": "[\\dA-Z]{4}\\d{16}" | |
566 | + }; | |
567 | + | |
568 | + bbanpattern = bbancountrypatterns[ countrycode ]; | |
569 | + | |
570 | + // As new countries will start using IBAN in the | |
571 | + // future, we only check if the countrycode is known. | |
572 | + // This prevents false negatives, while almost all | |
573 | + // false positives introduced by this, will be caught | |
574 | + // by the checksum validation below anyway. | |
575 | + // Strict checking should return FALSE for unknown | |
576 | + // countries. | |
577 | + if ( typeof bbanpattern !== "undefined" ) { | |
578 | + ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); | |
579 | + if ( !( ibanregexp.test( iban ) ) ) { | |
580 | + return false; // Invalid country specific format | |
581 | + } | |
582 | + } | |
583 | + | |
584 | + // Now check the checksum, first convert to digits | |
585 | + ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); | |
586 | + for ( i = 0; i < ibancheck.length; i++ ) { | |
587 | + charAt = ibancheck.charAt( i ); | |
588 | + if ( charAt !== "0" ) { | |
589 | + leadingZeroes = false; | |
590 | + } | |
591 | + if ( !leadingZeroes ) { | |
592 | + ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf( charAt ); | |
593 | + } | |
594 | + } | |
595 | + | |
596 | + // Calculate the result of: ibancheckdigits % 97 | |
597 | + for ( p = 0; p < ibancheckdigits.length; p++ ) { | |
598 | + cChar = ibancheckdigits.charAt( p ); | |
599 | + cOperator = "" + cRest + "" + cChar; | |
600 | + cRest = cOperator % 97; | |
601 | + } | |
602 | + return cRest === 1; | |
603 | +}, "Please specify a valid IBAN" ); | |
604 | + | |
605 | +$.validator.addMethod( "integer", function( value, element ) { | |
606 | + return this.optional( element ) || /^-?\d+$/.test( value ); | |
607 | +}, "A positive or negative non-decimal number please" ); | |
608 | + | |
609 | +$.validator.addMethod( "ipv4", function( value, element ) { | |
610 | + return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value ); | |
611 | +}, "Please enter a valid IP v4 address." ); | |
612 | + | |
613 | +$.validator.addMethod( "ipv6", function( value, element ) { | |
614 | + return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value ); | |
615 | +}, "Please enter a valid IP v6 address." ); | |
616 | + | |
617 | +$.validator.addMethod( "lettersonly", function( value, element ) { | |
618 | + return this.optional( element ) || /^[a-z]+$/i.test( value ); | |
619 | +}, "Letters only please" ); | |
620 | + | |
621 | +$.validator.addMethod( "letterswithbasicpunc", function( value, element ) { | |
622 | + return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value ); | |
623 | +}, "Letters or punctuation only please" ); | |
624 | + | |
625 | +$.validator.addMethod( "mobileNL", function( value, element ) { | |
626 | + return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); | |
627 | +}, "Please specify a valid mobile number" ); | |
628 | + | |
629 | +/* For UK phone functions, do the following server side processing: | |
630 | + * Compare original input with this RegEx pattern: | |
631 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
632 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
633 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
634 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
635 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
636 | + */ | |
637 | +$.validator.addMethod( "mobileUK", function( phone_number, element ) { | |
638 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
639 | + return this.optional( element ) || phone_number.length > 9 && | |
640 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); | |
641 | +}, "Please specify a valid mobile number" ); | |
642 | + | |
643 | +/* | |
644 | + * The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain | |
645 | + */ | |
646 | +$.validator.addMethod( "nieES", function( value ) { | |
647 | + "use strict"; | |
648 | + | |
649 | + value = value.toUpperCase(); | |
650 | + | |
651 | + // Basic format test | |
652 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
653 | + return false; | |
654 | + } | |
655 | + | |
656 | + // Test NIE | |
657 | + //T | |
658 | + if ( /^[T]{1}/.test( value ) ) { | |
659 | + return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) ); | |
660 | + } | |
661 | + | |
662 | + //XYZ | |
663 | + if ( /^[XYZ]{1}/.test( value ) ) { | |
664 | + return ( | |
665 | + value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( | |
666 | + value.replace( "X", "0" ) | |
667 | + .replace( "Y", "1" ) | |
668 | + .replace( "Z", "2" ) | |
669 | + .substring( 0, 8 ) % 23 | |
670 | + ) | |
671 | + ); | |
672 | + } | |
673 | + | |
674 | + return false; | |
675 | + | |
676 | +}, "Please specify a valid NIE number." ); | |
677 | + | |
678 | +/* | |
679 | + * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals | |
680 | + */ | |
681 | +$.validator.addMethod( "nifES", function( value ) { | |
682 | + "use strict"; | |
683 | + | |
684 | + value = value.toUpperCase(); | |
685 | + | |
686 | + // Basic format test | |
687 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
688 | + return false; | |
689 | + } | |
690 | + | |
691 | + // Test NIF | |
692 | + if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { | |
693 | + return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); | |
694 | + } | |
695 | + | |
696 | + // Test specials NIF (starts with K, L or M) | |
697 | + if ( /^[KLM]{1}/.test( value ) ) { | |
698 | + return ( value[ 8 ] === String.fromCharCode( 64 ) ); | |
699 | + } | |
700 | + | |
701 | + return false; | |
702 | + | |
703 | +}, "Please specify a valid NIF number." ); | |
704 | + | |
705 | +jQuery.validator.addMethod( "notEqualTo", function( value, element, param ) { | |
706 | + return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); | |
707 | +}, "Please enter a different value, values must not be the same." ); | |
708 | + | |
709 | +$.validator.addMethod( "nowhitespace", function( value, element ) { | |
710 | + return this.optional( element ) || /^\S+$/i.test( value ); | |
711 | +}, "No white space please" ); | |
712 | + | |
713 | +/** | |
714 | +* Return true if the field value matches the given format RegExp | |
715 | +* | |
716 | +* @example $.validator.methods.pattern("AR1004",element,/^AR\d{4}$/) | |
717 | +* @result true | |
718 | +* | |
719 | +* @example $.validator.methods.pattern("BR1004",element,/^AR\d{4}$/) | |
720 | +* @result false | |
721 | +* | |
722 | +* @name $.validator.methods.pattern | |
723 | +* @type Boolean | |
724 | +* @cat Plugins/Validate/Methods | |
725 | +*/ | |
726 | +$.validator.addMethod( "pattern", function( value, element, param ) { | |
727 | + if ( this.optional( element ) ) { | |
728 | + return true; | |
729 | + } | |
730 | + if ( typeof param === "string" ) { | |
731 | + param = new RegExp( "^(?:" + param + ")$" ); | |
732 | + } | |
733 | + return param.test( value ); | |
734 | +}, "Invalid format." ); | |
735 | + | |
736 | +/** | |
737 | + * Dutch phone numbers have 10 digits (or 11 and start with +31). | |
738 | + */ | |
739 | +$.validator.addMethod( "phoneNL", function( value, element ) { | |
740 | + return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); | |
741 | +}, "Please specify a valid phone number." ); | |
742 | + | |
743 | +/* For UK phone functions, do the following server side processing: | |
744 | + * Compare original input with this RegEx pattern: | |
745 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
746 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
747 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
748 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
749 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
750 | + */ | |
751 | +$.validator.addMethod( "phoneUK", function( phone_number, element ) { | |
752 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
753 | + return this.optional( element ) || phone_number.length > 9 && | |
754 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); | |
755 | +}, "Please specify a valid phone number" ); | |
756 | + | |
757 | +/** | |
758 | + * Matches US phone number format | |
759 | + * | |
760 | + * where the area code may not start with 1 and the prefix may not start with 1 | |
761 | + * allows '-' or ' ' as a separator and allows parens around area code | |
762 | + * some people may want to put a '1' in front of their number | |
763 | + * | |
764 | + * 1(212)-999-2345 or | |
765 | + * 212 999 2344 or | |
766 | + * 212-999-0983 | |
767 | + * | |
768 | + * but not | |
769 | + * 111-123-5434 | |
770 | + * and not | |
771 | + * 212 123 4567 | |
772 | + */ | |
773 | +$.validator.addMethod( "phoneUS", function( phone_number, element ) { | |
774 | + phone_number = phone_number.replace( /\s+/g, "" ); | |
775 | + return this.optional( element ) || phone_number.length > 9 && | |
776 | + phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); | |
777 | +}, "Please specify a valid phone number" ); | |
778 | + | |
779 | +/* For UK phone functions, do the following server side processing: | |
780 | + * Compare original input with this RegEx pattern: | |
781 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
782 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
783 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
784 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
785 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
786 | + */ | |
787 | + | |
788 | +// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers | |
789 | +$.validator.addMethod( "phonesUK", function( phone_number, element ) { | |
790 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
791 | + return this.optional( element ) || phone_number.length > 9 && | |
792 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); | |
793 | +}, "Please specify a valid uk phone number" ); | |
794 | + | |
795 | +/** | |
796 | + * Matches a valid Canadian Postal Code | |
797 | + * | |
798 | + * @example jQuery.validator.methods.postalCodeCA( "H0H 0H0", element ) | |
799 | + * @result true | |
800 | + * | |
801 | + * @example jQuery.validator.methods.postalCodeCA( "H0H0H0", element ) | |
802 | + * @result false | |
803 | + * | |
804 | + * @name jQuery.validator.methods.postalCodeCA | |
805 | + * @type Boolean | |
806 | + * @cat Plugins/Validate/Methods | |
807 | + */ | |
808 | +$.validator.addMethod( "postalCodeCA", function( value, element ) { | |
809 | + return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); | |
810 | +}, "Please specify a valid postal code" ); | |
811 | + | |
812 | +/* | |
813 | +* Valida CEPs do brasileiros: | |
814 | +* | |
815 | +* Formatos aceitos: | |
816 | +* 99999-999 | |
817 | +* 99.999-999 | |
818 | +* 99999999 | |
819 | +*/ | |
820 | +$.validator.addMethod( "postalcodeBR", function( cep_value, element ) { | |
821 | + return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value ); | |
822 | +}, "Informe um CEP válido." ); | |
823 | + | |
824 | +/* Matches Italian postcode (CAP) */ | |
825 | +$.validator.addMethod( "postalcodeIT", function( value, element ) { | |
826 | + return this.optional( element ) || /^\d{5}$/.test( value ); | |
827 | +}, "Please specify a valid postal code" ); | |
828 | + | |
829 | +$.validator.addMethod( "postalcodeNL", function( value, element ) { | |
830 | + return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value ); | |
831 | +}, "Please specify a valid postal code" ); | |
832 | + | |
833 | +// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) | |
834 | +$.validator.addMethod( "postcodeUK", function( value, element ) { | |
835 | + return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); | |
836 | +}, "Please specify a valid UK postcode" ); | |
837 | + | |
838 | +/* | |
839 | + * Lets you say "at least X inputs that match selector Y must be filled." | |
840 | + * | |
841 | + * The end result is that neither of these inputs: | |
842 | + * | |
843 | + * <input class="productinfo" name="partnumber"> | |
844 | + * <input class="productinfo" name="description"> | |
845 | + * | |
846 | + * ...will validate unless at least one of them is filled. | |
847 | + * | |
848 | + * partnumber: {require_from_group: [1,".productinfo"]}, | |
849 | + * description: {require_from_group: [1,".productinfo"]} | |
850 | + * | |
851 | + * options[0]: number of fields that must be filled in the group | |
852 | + * options[1]: CSS selector that defines the group of conditionally required fields | |
853 | + */ | |
854 | +$.validator.addMethod( "require_from_group", function( value, element, options ) { | |
855 | + var $fields = $( options[ 1 ], element.form ), | |
856 | + $fieldsFirst = $fields.eq( 0 ), | |
857 | + validator = $fieldsFirst.data( "valid_req_grp" ) ? $fieldsFirst.data( "valid_req_grp" ) : $.extend( {}, this ), | |
858 | + isValid = $fields.filter( function() { | |
859 | + return validator.elementValue( this ); | |
860 | + } ).length >= options[ 0 ]; | |
861 | + | |
862 | + // Store the cloned validator for future validation | |
863 | + $fieldsFirst.data( "valid_req_grp", validator ); | |
864 | + | |
865 | + // If element isn't being validated, run each require_from_group field's validation rules | |
866 | + if ( !$( element ).data( "being_validated" ) ) { | |
867 | + $fields.data( "being_validated", true ); | |
868 | + $fields.each( function() { | |
869 | + validator.element( this ); | |
870 | + } ); | |
871 | + $fields.data( "being_validated", false ); | |
872 | + } | |
873 | + return isValid; | |
874 | +}, $.validator.format( "Please fill at least {0} of these fields." ) ); | |
875 | + | |
876 | +/* | |
877 | + * Lets you say "either at least X inputs that match selector Y must be filled, | |
878 | + * OR they must all be skipped (left blank)." | |
879 | + * | |
880 | + * The end result, is that none of these inputs: | |
881 | + * | |
882 | + * <input class="productinfo" name="partnumber"> | |
883 | + * <input class="productinfo" name="description"> | |
884 | + * <input class="productinfo" name="color"> | |
885 | + * | |
886 | + * ...will validate unless either at least two of them are filled, | |
887 | + * OR none of them are. | |
888 | + * | |
889 | + * partnumber: {skip_or_fill_minimum: [2,".productinfo"]}, | |
890 | + * description: {skip_or_fill_minimum: [2,".productinfo"]}, | |
891 | + * color: {skip_or_fill_minimum: [2,".productinfo"]} | |
892 | + * | |
893 | + * options[0]: number of fields that must be filled in the group | |
894 | + * options[1]: CSS selector that defines the group of conditionally required fields | |
895 | + * | |
896 | + */ | |
897 | +$.validator.addMethod( "skip_or_fill_minimum", function( value, element, options ) { | |
898 | + var $fields = $( options[ 1 ], element.form ), | |
899 | + $fieldsFirst = $fields.eq( 0 ), | |
900 | + validator = $fieldsFirst.data( "valid_skip" ) ? $fieldsFirst.data( "valid_skip" ) : $.extend( {}, this ), | |
901 | + numberFilled = $fields.filter( function() { | |
902 | + return validator.elementValue( this ); | |
903 | + } ).length, | |
904 | + isValid = numberFilled === 0 || numberFilled >= options[ 0 ]; | |
905 | + | |
906 | + // Store the cloned validator for future validation | |
907 | + $fieldsFirst.data( "valid_skip", validator ); | |
908 | + | |
909 | + // If element isn't being validated, run each skip_or_fill_minimum field's validation rules | |
910 | + if ( !$( element ).data( "being_validated" ) ) { | |
911 | + $fields.data( "being_validated", true ); | |
912 | + $fields.each( function() { | |
913 | + validator.element( this ); | |
914 | + } ); | |
915 | + $fields.data( "being_validated", false ); | |
916 | + } | |
917 | + return isValid; | |
918 | +}, $.validator.format( "Please either skip these fields or fill at least {0} of them." ) ); | |
919 | + | |
920 | +/* Validates US States and/or Territories by @jdforsythe | |
921 | + * Can be case insensitive or require capitalization - default is case insensitive | |
922 | + * Can include US Territories or not - default does not | |
923 | + * Can include US Military postal abbreviations (AA, AE, AP) - default does not | |
924 | + * | |
925 | + * Note: "States" always includes DC (District of Colombia) | |
926 | + * | |
927 | + * Usage examples: | |
928 | + * | |
929 | + * This is the default - case insensitive, no territories, no military zones | |
930 | + * stateInput: { | |
931 | + * caseSensitive: false, | |
932 | + * includeTerritories: false, | |
933 | + * includeMilitary: false | |
934 | + * } | |
935 | + * | |
936 | + * Only allow capital letters, no territories, no military zones | |
937 | + * stateInput: { | |
938 | + * caseSensitive: false | |
939 | + * } | |
940 | + * | |
941 | + * Case insensitive, include territories but not military zones | |
942 | + * stateInput: { | |
943 | + * includeTerritories: true | |
944 | + * } | |
945 | + * | |
946 | + * Only allow capital letters, include territories and military zones | |
947 | + * stateInput: { | |
948 | + * caseSensitive: true, | |
949 | + * includeTerritories: true, | |
950 | + * includeMilitary: true | |
951 | + * } | |
952 | + * | |
953 | + */ | |
954 | +$.validator.addMethod( "stateUS", function( value, element, options ) { | |
955 | + var isDefault = typeof options === "undefined", | |
956 | + caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, | |
957 | + includeTerritories = ( isDefault || typeof options.includeTerritories === "undefined" ) ? false : options.includeTerritories, | |
958 | + includeMilitary = ( isDefault || typeof options.includeMilitary === "undefined" ) ? false : options.includeMilitary, | |
959 | + regex; | |
960 | + | |
961 | + if ( !includeTerritories && !includeMilitary ) { | |
962 | + regex = "^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; | |
963 | + } else if ( includeTerritories && includeMilitary ) { | |
964 | + regex = "^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; | |
965 | + } else if ( includeTerritories ) { | |
966 | + regex = "^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; | |
967 | + } else { | |
968 | + regex = "^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; | |
969 | + } | |
970 | + | |
971 | + regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); | |
972 | + return this.optional( element ) || regex.test( value ); | |
973 | +}, "Please specify a valid state" ); | |
974 | + | |
975 | +// TODO check if value starts with <, otherwise don't try stripping anything | |
976 | +$.validator.addMethod( "strippedminlength", function( value, element, param ) { | |
977 | + return $( value ).text().length >= param; | |
978 | +}, $.validator.format( "Please enter at least {0} characters" ) ); | |
979 | + | |
980 | +$.validator.addMethod( "time", function( value, element ) { | |
981 | + return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value ); | |
982 | +}, "Please enter a valid time, between 00:00 and 23:59" ); | |
983 | + | |
984 | +$.validator.addMethod( "time12h", function( value, element ) { | |
985 | + return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); | |
986 | +}, "Please enter a valid time in 12-hour am/pm format" ); | |
987 | + | |
988 | +// Same as url, but TLD is optional | |
989 | +$.validator.addMethod( "url2", function( value, element ) { | |
990 | + return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); | |
991 | +}, $.validator.messages.url ); | |
992 | + | |
993 | +/** | |
994 | + * Return true, if the value is a valid vehicle identification number (VIN). | |
995 | + * | |
996 | + * Works with all kind of text inputs. | |
997 | + * | |
998 | + * @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" /> | |
999 | + * @desc Declares a required input element whose value must be a valid vehicle identification number. | |
1000 | + * | |
1001 | + * @name $.validator.methods.vinUS | |
1002 | + * @type Boolean | |
1003 | + * @cat Plugins/Validate/Methods | |
1004 | + */ | |
1005 | +$.validator.addMethod( "vinUS", function( v ) { | |
1006 | + if ( v.length !== 17 ) { | |
1007 | + return false; | |
1008 | + } | |
1009 | + | |
1010 | + var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ], | |
1011 | + VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ], | |
1012 | + FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ], | |
1013 | + rs = 0, | |
1014 | + i, n, d, f, cd, cdv; | |
1015 | + | |
1016 | + for ( i = 0; i < 17; i++ ) { | |
1017 | + f = FL[ i ]; | |
1018 | + d = v.slice( i, i + 1 ); | |
1019 | + if ( i === 8 ) { | |
1020 | + cdv = d; | |
1021 | + } | |
1022 | + if ( !isNaN( d ) ) { | |
1023 | + d *= f; | |
1024 | + } else { | |
1025 | + for ( n = 0; n < LL.length; n++ ) { | |
1026 | + if ( d.toUpperCase() === LL[ n ] ) { | |
1027 | + d = VL[ n ]; | |
1028 | + d *= f; | |
1029 | + if ( isNaN( cdv ) && n === 8 ) { | |
1030 | + cdv = LL[ n ]; | |
1031 | + } | |
1032 | + break; | |
1033 | + } | |
1034 | + } | |
1035 | + } | |
1036 | + rs += d; | |
1037 | + } | |
1038 | + cd = rs % 11; | |
1039 | + if ( cd === 10 ) { | |
1040 | + cd = "X"; | |
1041 | + } | |
1042 | + if ( cd === cdv ) { | |
1043 | + return true; | |
1044 | + } | |
1045 | + return false; | |
1046 | +}, "The specified vehicle identification number (VIN) is invalid." ); | |
1047 | + | |
1048 | +$.validator.addMethod( "zipcodeUS", function( value, element ) { | |
1049 | + return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value ); | |
1050 | +}, "The specified US ZIP Code is invalid" ); | |
1051 | + | |
1052 | +$.validator.addMethod( "ziprange", function( value, element ) { | |
1053 | + return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); | |
1054 | +}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); | |
1055 | + | |
1056 | +})); | |
0 | 1057 | \ No newline at end of file | ... | ... |
bower_components/jquery-validation/dist/additional-methods.min.js
0 → 100644
1 | +/*! jQuery Validation Plugin - v1.15.0 - 2/24/2016 | |
2 | + * http://jqueryvalidation.org/ | |
3 | + * Copyright (c) 2016 Jörn Zaefferer; Licensed MIT */ | |
4 | +!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){!function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace("/*","/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please"),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;h>c;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number"),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number"),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code"),a.validator.addMethod("cifES",function(a){"use strict";var b,c,d,e,f,g,h=[];if(a=a.toUpperCase(),!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)"))return!1;for(d=0;9>d;d++)h[d]=parseInt(a.charAt(d),10);for(c=h[2]+h[4]+h[6],e=1;8>e;e+=2)f=(2*h[e]).toString(),g=f.charAt(1),c+=parseInt(f.charAt(0),10)+(""===g?0:parseInt(g,10));return/^[ABCDEFGHJNPQRSUVW]{1}/.test(a)?(c+="",b=10-parseInt(c.charAt(c.length-1),10),a+=b,h[8].toString()===String.fromCharCode(64+b)||h[8].toString()===a.charAt(a.length-1)):!1},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;9>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;10>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=e?!0:c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="";if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN"),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please"),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please"),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please"),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number"),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[T]{1}/.test(a)?a[8]===/^[T]{1}[A-Z0-9]{8}$/.test(a):/^[XYZ]{1}/.test(a)?a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.replace("X","0").replace("Y","1").replace("Z","2").substring(0,8)%23):!1:!1},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):/^[KLM]{1}/.test(a)?a[8]===String.fromCharCode(64):!1:!1},"Please specify a valid NIF number."),jQuery.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return this.optional(b)?!0:("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=e||"undefined"==typeof c.caseSensitive?!1:c.caseSensitive,g=e||"undefined"==typeof c.includeTerritories?!1:c.includeTerritories,h=e||"undefined"==typeof c.includeMilitary?!1:c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;17>b;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid"),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx")}); | |
0 | 5 | \ No newline at end of file | ... | ... |
bower_components/jquery-validation/dist/jquery.validate.js
0 → 100644
1 | +/*! | |
2 | + * jQuery Validation Plugin v1.15.0 | |
3 | + * | |
4 | + * http://jqueryvalidation.org/ | |
5 | + * | |
6 | + * Copyright (c) 2016 Jörn Zaefferer | |
7 | + * Released under the MIT license | |
8 | + */ | |
9 | +(function( factory ) { | |
10 | + if ( typeof define === "function" && define.amd ) { | |
11 | + define( ["jquery"], factory ); | |
12 | + } else if (typeof module === "object" && module.exports) { | |
13 | + module.exports = factory( require( "jquery" ) ); | |
14 | + } else { | |
15 | + factory( jQuery ); | |
16 | + } | |
17 | +}(function( $ ) { | |
18 | + | |
19 | +$.extend( $.fn, { | |
20 | + | |
21 | + // http://jqueryvalidation.org/validate/ | |
22 | + validate: function( options ) { | |
23 | + | |
24 | + // If nothing is selected, return nothing; can't chain anyway | |
25 | + if ( !this.length ) { | |
26 | + if ( options && options.debug && window.console ) { | |
27 | + console.warn( "Nothing selected, can't validate, returning nothing." ); | |
28 | + } | |
29 | + return; | |
30 | + } | |
31 | + | |
32 | + // Check if a validator for this form was already created | |
33 | + var validator = $.data( this[ 0 ], "validator" ); | |
34 | + if ( validator ) { | |
35 | + return validator; | |
36 | + } | |
37 | + | |
38 | + // Add novalidate tag if HTML5. | |
39 | + this.attr( "novalidate", "novalidate" ); | |
40 | + | |
41 | + validator = new $.validator( options, this[ 0 ] ); | |
42 | + $.data( this[ 0 ], "validator", validator ); | |
43 | + | |
44 | + if ( validator.settings.onsubmit ) { | |
45 | + | |
46 | + this.on( "click.validate", ":submit", function( event ) { | |
47 | + if ( validator.settings.submitHandler ) { | |
48 | + validator.submitButton = event.target; | |
49 | + } | |
50 | + | |
51 | + // Allow suppressing validation by adding a cancel class to the submit button | |
52 | + if ( $( this ).hasClass( "cancel" ) ) { | |
53 | + validator.cancelSubmit = true; | |
54 | + } | |
55 | + | |
56 | + // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button | |
57 | + if ( $( this ).attr( "formnovalidate" ) !== undefined ) { | |
58 | + validator.cancelSubmit = true; | |
59 | + } | |
60 | + } ); | |
61 | + | |
62 | + // Validate the form on submit | |
63 | + this.on( "submit.validate", function( event ) { | |
64 | + if ( validator.settings.debug ) { | |
65 | + | |
66 | + // Prevent form submit to be able to see console output | |
67 | + event.preventDefault(); | |
68 | + } | |
69 | + function handle() { | |
70 | + var hidden, result; | |
71 | + if ( validator.settings.submitHandler ) { | |
72 | + if ( validator.submitButton ) { | |
73 | + | |
74 | + // Insert a hidden input as a replacement for the missing submit button | |
75 | + hidden = $( "<input type='hidden'/>" ) | |
76 | + .attr( "name", validator.submitButton.name ) | |
77 | + .val( $( validator.submitButton ).val() ) | |
78 | + .appendTo( validator.currentForm ); | |
79 | + } | |
80 | + result = validator.settings.submitHandler.call( validator, validator.currentForm, event ); | |
81 | + if ( validator.submitButton ) { | |
82 | + | |
83 | + // And clean up afterwards; thanks to no-block-scope, hidden can be referenced | |
84 | + hidden.remove(); | |
85 | + } | |
86 | + if ( result !== undefined ) { | |
87 | + return result; | |
88 | + } | |
89 | + return false; | |
90 | + } | |
91 | + return true; | |
92 | + } | |
93 | + | |
94 | + // Prevent submit for invalid forms or custom submit handlers | |
95 | + if ( validator.cancelSubmit ) { | |
96 | + validator.cancelSubmit = false; | |
97 | + return handle(); | |
98 | + } | |
99 | + if ( validator.form() ) { | |
100 | + if ( validator.pendingRequest ) { | |
101 | + validator.formSubmitted = true; | |
102 | + return false; | |
103 | + } | |
104 | + return handle(); | |
105 | + } else { | |
106 | + validator.focusInvalid(); | |
107 | + return false; | |
108 | + } | |
109 | + } ); | |
110 | + } | |
111 | + | |
112 | + return validator; | |
113 | + }, | |
114 | + | |
115 | + // http://jqueryvalidation.org/valid/ | |
116 | + valid: function() { | |
117 | + var valid, validator, errorList; | |
118 | + | |
119 | + if ( $( this[ 0 ] ).is( "form" ) ) { | |
120 | + valid = this.validate().form(); | |
121 | + } else { | |
122 | + errorList = []; | |
123 | + valid = true; | |
124 | + validator = $( this[ 0 ].form ).validate(); | |
125 | + this.each( function() { | |
126 | + valid = validator.element( this ) && valid; | |
127 | + if ( !valid ) { | |
128 | + errorList = errorList.concat( validator.errorList ); | |
129 | + } | |
130 | + } ); | |
131 | + validator.errorList = errorList; | |
132 | + } | |
133 | + return valid; | |
134 | + }, | |
135 | + | |
136 | + // http://jqueryvalidation.org/rules/ | |
137 | + rules: function( command, argument ) { | |
138 | + | |
139 | + // If nothing is selected, return nothing; can't chain anyway | |
140 | + if ( !this.length ) { | |
141 | + return; | |
142 | + } | |
143 | + | |
144 | + var element = this[ 0 ], | |
145 | + settings, staticRules, existingRules, data, param, filtered; | |
146 | + | |
147 | + if ( command ) { | |
148 | + settings = $.data( element.form, "validator" ).settings; | |
149 | + staticRules = settings.rules; | |
150 | + existingRules = $.validator.staticRules( element ); | |
151 | + switch ( command ) { | |
152 | + case "add": | |
153 | + $.extend( existingRules, $.validator.normalizeRule( argument ) ); | |
154 | + | |
155 | + // Remove messages from rules, but allow them to be set separately | |
156 | + delete existingRules.messages; | |
157 | + staticRules[ element.name ] = existingRules; | |
158 | + if ( argument.messages ) { | |
159 | + settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages ); | |
160 | + } | |
161 | + break; | |
162 | + case "remove": | |
163 | + if ( !argument ) { | |
164 | + delete staticRules[ element.name ]; | |
165 | + return existingRules; | |
166 | + } | |
167 | + filtered = {}; | |
168 | + $.each( argument.split( /\s/ ), function( index, method ) { | |
169 | + filtered[ method ] = existingRules[ method ]; | |
170 | + delete existingRules[ method ]; | |
171 | + if ( method === "required" ) { | |
172 | + $( element ).removeAttr( "aria-required" ); | |
173 | + } | |
174 | + } ); | |
175 | + return filtered; | |
176 | + } | |
177 | + } | |
178 | + | |
179 | + data = $.validator.normalizeRules( | |
180 | + $.extend( | |
181 | + {}, | |
182 | + $.validator.classRules( element ), | |
183 | + $.validator.attributeRules( element ), | |
184 | + $.validator.dataRules( element ), | |
185 | + $.validator.staticRules( element ) | |
186 | + ), element ); | |
187 | + | |
188 | + // Make sure required is at front | |
189 | + if ( data.required ) { | |
190 | + param = data.required; | |
191 | + delete data.required; | |
192 | + data = $.extend( { required: param }, data ); | |
193 | + $( element ).attr( "aria-required", "true" ); | |
194 | + } | |
195 | + | |
196 | + // Make sure remote is at back | |
197 | + if ( data.remote ) { | |
198 | + param = data.remote; | |
199 | + delete data.remote; | |
200 | + data = $.extend( data, { remote: param } ); | |
201 | + } | |
202 | + | |
203 | + return data; | |
204 | + } | |
205 | +} ); | |
206 | + | |
207 | +// Custom selectors | |
208 | +$.extend( $.expr[ ":" ], { | |
209 | + | |
210 | + // http://jqueryvalidation.org/blank-selector/ | |
211 | + blank: function( a ) { | |
212 | + return !$.trim( "" + $( a ).val() ); | |
213 | + }, | |
214 | + | |
215 | + // http://jqueryvalidation.org/filled-selector/ | |
216 | + filled: function( a ) { | |
217 | + var val = $( a ).val(); | |
218 | + return val !== null && !!$.trim( "" + val ); | |
219 | + }, | |
220 | + | |
221 | + // http://jqueryvalidation.org/unchecked-selector/ | |
222 | + unchecked: function( a ) { | |
223 | + return !$( a ).prop( "checked" ); | |
224 | + } | |
225 | +} ); | |
226 | + | |
227 | +// Constructor for validator | |
228 | +$.validator = function( options, form ) { | |
229 | + this.settings = $.extend( true, {}, $.validator.defaults, options ); | |
230 | + this.currentForm = form; | |
231 | + this.init(); | |
232 | +}; | |
233 | + | |
234 | +// http://jqueryvalidation.org/jQuery.validator.format/ | |
235 | +$.validator.format = function( source, params ) { | |
236 | + if ( arguments.length === 1 ) { | |
237 | + return function() { | |
238 | + var args = $.makeArray( arguments ); | |
239 | + args.unshift( source ); | |
240 | + return $.validator.format.apply( this, args ); | |
241 | + }; | |
242 | + } | |
243 | + if ( params === undefined ) { | |
244 | + return source; | |
245 | + } | |
246 | + if ( arguments.length > 2 && params.constructor !== Array ) { | |
247 | + params = $.makeArray( arguments ).slice( 1 ); | |
248 | + } | |
249 | + if ( params.constructor !== Array ) { | |
250 | + params = [ params ]; | |
251 | + } | |
252 | + $.each( params, function( i, n ) { | |
253 | + source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() { | |
254 | + return n; | |
255 | + } ); | |
256 | + } ); | |
257 | + return source; | |
258 | +}; | |
259 | + | |
260 | +$.extend( $.validator, { | |
261 | + | |
262 | + defaults: { | |
263 | + messages: {}, | |
264 | + groups: {}, | |
265 | + rules: {}, | |
266 | + errorClass: "error", | |
267 | + pendingClass: "pending", | |
268 | + validClass: "valid", | |
269 | + errorElement: "label", | |
270 | + focusCleanup: false, | |
271 | + focusInvalid: true, | |
272 | + errorContainer: $( [] ), | |
273 | + errorLabelContainer: $( [] ), | |
274 | + onsubmit: true, | |
275 | + ignore: ":hidden", | |
276 | + ignoreTitle: false, | |
277 | + onfocusin: function( element ) { | |
278 | + this.lastActive = element; | |
279 | + | |
280 | + // Hide error label and remove error class on focus if enabled | |
281 | + if ( this.settings.focusCleanup ) { | |
282 | + if ( this.settings.unhighlight ) { | |
283 | + this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); | |
284 | + } | |
285 | + this.hideThese( this.errorsFor( element ) ); | |
286 | + } | |
287 | + }, | |
288 | + onfocusout: function( element ) { | |
289 | + if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) { | |
290 | + this.element( element ); | |
291 | + } | |
292 | + }, | |
293 | + onkeyup: function( element, event ) { | |
294 | + | |
295 | + // Avoid revalidate the field when pressing one of the following keys | |
296 | + // Shift => 16 | |
297 | + // Ctrl => 17 | |
298 | + // Alt => 18 | |
299 | + // Caps lock => 20 | |
300 | + // End => 35 | |
301 | + // Home => 36 | |
302 | + // Left arrow => 37 | |
303 | + // Up arrow => 38 | |
304 | + // Right arrow => 39 | |
305 | + // Down arrow => 40 | |
306 | + // Insert => 45 | |
307 | + // Num lock => 144 | |
308 | + // AltGr key => 225 | |
309 | + var excludedKeys = [ | |
310 | + 16, 17, 18, 20, 35, 36, 37, | |
311 | + 38, 39, 40, 45, 144, 225 | |
312 | + ]; | |
313 | + | |
314 | + if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) { | |
315 | + return; | |
316 | + } else if ( element.name in this.submitted || element.name in this.invalid ) { | |
317 | + this.element( element ); | |
318 | + } | |
319 | + }, | |
320 | + onclick: function( element ) { | |
321 | + | |
322 | + // Click on selects, radiobuttons and checkboxes | |
323 | + if ( element.name in this.submitted ) { | |
324 | + this.element( element ); | |
325 | + | |
326 | + // Or option elements, check parent select in that case | |
327 | + } else if ( element.parentNode.name in this.submitted ) { | |
328 | + this.element( element.parentNode ); | |
329 | + } | |
330 | + }, | |
331 | + highlight: function( element, errorClass, validClass ) { | |
332 | + if ( element.type === "radio" ) { | |
333 | + this.findByName( element.name ).addClass( errorClass ).removeClass( validClass ); | |
334 | + } else { | |
335 | + $( element ).addClass( errorClass ).removeClass( validClass ); | |
336 | + } | |
337 | + }, | |
338 | + unhighlight: function( element, errorClass, validClass ) { | |
339 | + if ( element.type === "radio" ) { | |
340 | + this.findByName( element.name ).removeClass( errorClass ).addClass( validClass ); | |
341 | + } else { | |
342 | + $( element ).removeClass( errorClass ).addClass( validClass ); | |
343 | + } | |
344 | + } | |
345 | + }, | |
346 | + | |
347 | + // http://jqueryvalidation.org/jQuery.validator.setDefaults/ | |
348 | + setDefaults: function( settings ) { | |
349 | + $.extend( $.validator.defaults, settings ); | |
350 | + }, | |
351 | + | |
352 | + messages: { | |
353 | + required: "This field is required.", | |
354 | + remote: "Please fix this field.", | |
355 | + email: "Please enter a valid email address.", | |
356 | + url: "Please enter a valid URL.", | |
357 | + date: "Please enter a valid date.", | |
358 | + dateISO: "Please enter a valid date ( ISO ).", | |
359 | + number: "Please enter a valid number.", | |
360 | + digits: "Please enter only digits.", | |
361 | + equalTo: "Please enter the same value again.", | |
362 | + maxlength: $.validator.format( "Please enter no more than {0} characters." ), | |
363 | + minlength: $.validator.format( "Please enter at least {0} characters." ), | |
364 | + rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ), | |
365 | + range: $.validator.format( "Please enter a value between {0} and {1}." ), | |
366 | + max: $.validator.format( "Please enter a value less than or equal to {0}." ), | |
367 | + min: $.validator.format( "Please enter a value greater than or equal to {0}." ), | |
368 | + step: $.validator.format( "Please enter a multiple of {0}." ) | |
369 | + }, | |
370 | + | |
371 | + autoCreateRanges: false, | |
372 | + | |
373 | + prototype: { | |
374 | + | |
375 | + init: function() { | |
376 | + this.labelContainer = $( this.settings.errorLabelContainer ); | |
377 | + this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm ); | |
378 | + this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer ); | |
379 | + this.submitted = {}; | |
380 | + this.valueCache = {}; | |
381 | + this.pendingRequest = 0; | |
382 | + this.pending = {}; | |
383 | + this.invalid = {}; | |
384 | + this.reset(); | |
385 | + | |
386 | + var groups = ( this.groups = {} ), | |
387 | + rules; | |
388 | + $.each( this.settings.groups, function( key, value ) { | |
389 | + if ( typeof value === "string" ) { | |
390 | + value = value.split( /\s/ ); | |
391 | + } | |
392 | + $.each( value, function( index, name ) { | |
393 | + groups[ name ] = key; | |
394 | + } ); | |
395 | + } ); | |
396 | + rules = this.settings.rules; | |
397 | + $.each( rules, function( key, value ) { | |
398 | + rules[ key ] = $.validator.normalizeRule( value ); | |
399 | + } ); | |
400 | + | |
401 | + function delegate( event ) { | |
402 | + var validator = $.data( this.form, "validator" ), | |
403 | + eventType = "on" + event.type.replace( /^validate/, "" ), | |
404 | + settings = validator.settings; | |
405 | + if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) { | |
406 | + settings[ eventType ].call( validator, this, event ); | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + $( this.currentForm ) | |
411 | + .on( "focusin.validate focusout.validate keyup.validate", | |
412 | + ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " + | |
413 | + "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " + | |
414 | + "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " + | |
415 | + "[type='radio'], [type='checkbox'], [contenteditable]", delegate ) | |
416 | + | |
417 | + // Support: Chrome, oldIE | |
418 | + // "select" is provided as event.target when clicking a option | |
419 | + .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate ); | |
420 | + | |
421 | + if ( this.settings.invalidHandler ) { | |
422 | + $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler ); | |
423 | + } | |
424 | + | |
425 | + // Add aria-required to any Static/Data/Class required fields before first validation | |
426 | + // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html | |
427 | + $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" ); | |
428 | + }, | |
429 | + | |
430 | + // http://jqueryvalidation.org/Validator.form/ | |
431 | + form: function() { | |
432 | + this.checkForm(); | |
433 | + $.extend( this.submitted, this.errorMap ); | |
434 | + this.invalid = $.extend( {}, this.errorMap ); | |
435 | + if ( !this.valid() ) { | |
436 | + $( this.currentForm ).triggerHandler( "invalid-form", [ this ] ); | |
437 | + } | |
438 | + this.showErrors(); | |
439 | + return this.valid(); | |
440 | + }, | |
441 | + | |
442 | + checkForm: function() { | |
443 | + this.prepareForm(); | |
444 | + for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { | |
445 | + this.check( elements[ i ] ); | |
446 | + } | |
447 | + return this.valid(); | |
448 | + }, | |
449 | + | |
450 | + // http://jqueryvalidation.org/Validator.element/ | |
451 | + element: function( element ) { | |
452 | + var cleanElement = this.clean( element ), | |
453 | + checkElement = this.validationTargetFor( cleanElement ), | |
454 | + v = this, | |
455 | + result = true, | |
456 | + rs, group; | |
457 | + | |
458 | + if ( checkElement === undefined ) { | |
459 | + delete this.invalid[ cleanElement.name ]; | |
460 | + } else { | |
461 | + this.prepareElement( checkElement ); | |
462 | + this.currentElements = $( checkElement ); | |
463 | + | |
464 | + // If this element is grouped, then validate all group elements already | |
465 | + // containing a value | |
466 | + group = this.groups[ checkElement.name ]; | |
467 | + if ( group ) { | |
468 | + $.each( this.groups, function( name, testgroup ) { | |
469 | + if ( testgroup === group && name !== checkElement.name ) { | |
470 | + cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) ); | |
471 | + if ( cleanElement && cleanElement.name in v.invalid ) { | |
472 | + v.currentElements.push( cleanElement ); | |
473 | + result = result && v.check( cleanElement ); | |
474 | + } | |
475 | + } | |
476 | + } ); | |
477 | + } | |
478 | + | |
479 | + rs = this.check( checkElement ) !== false; | |
480 | + result = result && rs; | |
481 | + if ( rs ) { | |
482 | + this.invalid[ checkElement.name ] = false; | |
483 | + } else { | |
484 | + this.invalid[ checkElement.name ] = true; | |
485 | + } | |
486 | + | |
487 | + if ( !this.numberOfInvalids() ) { | |
488 | + | |
489 | + // Hide error containers on last error | |
490 | + this.toHide = this.toHide.add( this.containers ); | |
491 | + } | |
492 | + this.showErrors(); | |
493 | + | |
494 | + // Add aria-invalid status for screen readers | |
495 | + $( element ).attr( "aria-invalid", !rs ); | |
496 | + } | |
497 | + | |
498 | + return result; | |
499 | + }, | |
500 | + | |
501 | + // http://jqueryvalidation.org/Validator.showErrors/ | |
502 | + showErrors: function( errors ) { | |
503 | + if ( errors ) { | |
504 | + var validator = this; | |
505 | + | |
506 | + // Add items to error list and map | |
507 | + $.extend( this.errorMap, errors ); | |
508 | + this.errorList = $.map( this.errorMap, function( message, name ) { | |
509 | + return { | |
510 | + message: message, | |
511 | + element: validator.findByName( name )[ 0 ] | |
512 | + }; | |
513 | + } ); | |
514 | + | |
515 | + // Remove items from success list | |
516 | + this.successList = $.grep( this.successList, function( element ) { | |
517 | + return !( element.name in errors ); | |
518 | + } ); | |
519 | + } | |
520 | + if ( this.settings.showErrors ) { | |
521 | + this.settings.showErrors.call( this, this.errorMap, this.errorList ); | |
522 | + } else { | |
523 | + this.defaultShowErrors(); | |
524 | + } | |
525 | + }, | |
526 | + | |
527 | + // http://jqueryvalidation.org/Validator.resetForm/ | |
528 | + resetForm: function() { | |
529 | + if ( $.fn.resetForm ) { | |
530 | + $( this.currentForm ).resetForm(); | |
531 | + } | |
532 | + this.invalid = {}; | |
533 | + this.submitted = {}; | |
534 | + this.prepareForm(); | |
535 | + this.hideErrors(); | |
536 | + var elements = this.elements() | |
537 | + .removeData( "previousValue" ) | |
538 | + .removeAttr( "aria-invalid" ); | |
539 | + | |
540 | + this.resetElements( elements ); | |
541 | + }, | |
542 | + | |
543 | + resetElements: function( elements ) { | |
544 | + var i; | |
545 | + | |
546 | + if ( this.settings.unhighlight ) { | |
547 | + for ( i = 0; elements[ i ]; i++ ) { | |
548 | + this.settings.unhighlight.call( this, elements[ i ], | |
549 | + this.settings.errorClass, "" ); | |
550 | + this.findByName( elements[ i ].name ).removeClass( this.settings.validClass ); | |
551 | + } | |
552 | + } else { | |
553 | + elements | |
554 | + .removeClass( this.settings.errorClass ) | |
555 | + .removeClass( this.settings.validClass ); | |
556 | + } | |
557 | + }, | |
558 | + | |
559 | + numberOfInvalids: function() { | |
560 | + return this.objectLength( this.invalid ); | |
561 | + }, | |
562 | + | |
563 | + objectLength: function( obj ) { | |
564 | + /* jshint unused: false */ | |
565 | + var count = 0, | |
566 | + i; | |
567 | + for ( i in obj ) { | |
568 | + if ( obj[ i ] ) { | |
569 | + count++; | |
570 | + } | |
571 | + } | |
572 | + return count; | |
573 | + }, | |
574 | + | |
575 | + hideErrors: function() { | |
576 | + this.hideThese( this.toHide ); | |
577 | + }, | |
578 | + | |
579 | + hideThese: function( errors ) { | |
580 | + errors.not( this.containers ).text( "" ); | |
581 | + this.addWrapper( errors ).hide(); | |
582 | + }, | |
583 | + | |
584 | + valid: function() { | |
585 | + return this.size() === 0; | |
586 | + }, | |
587 | + | |
588 | + size: function() { | |
589 | + return this.errorList.length; | |
590 | + }, | |
591 | + | |
592 | + focusInvalid: function() { | |
593 | + if ( this.settings.focusInvalid ) { | |
594 | + try { | |
595 | + $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] ) | |
596 | + .filter( ":visible" ) | |
597 | + .focus() | |
598 | + | |
599 | + // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find | |
600 | + .trigger( "focusin" ); | |
601 | + } catch ( e ) { | |
602 | + | |
603 | + // Ignore IE throwing errors when focusing hidden elements | |
604 | + } | |
605 | + } | |
606 | + }, | |
607 | + | |
608 | + findLastActive: function() { | |
609 | + var lastActive = this.lastActive; | |
610 | + return lastActive && $.grep( this.errorList, function( n ) { | |
611 | + return n.element.name === lastActive.name; | |
612 | + } ).length === 1 && lastActive; | |
613 | + }, | |
614 | + | |
615 | + elements: function() { | |
616 | + var validator = this, | |
617 | + rulesCache = {}; | |
618 | + | |
619 | + // Select all valid inputs inside the form (no submit or reset buttons) | |
620 | + return $( this.currentForm ) | |
621 | + .find( "input, select, textarea, [contenteditable]" ) | |
622 | + .not( ":submit, :reset, :image, :disabled" ) | |
623 | + .not( this.settings.ignore ) | |
624 | + .filter( function() { | |
625 | + var name = this.name || $( this ).attr( "name" ); // For contenteditable | |
626 | + if ( !name && validator.settings.debug && window.console ) { | |
627 | + console.error( "%o has no name assigned", this ); | |
628 | + } | |
629 | + | |
630 | + // Set form expando on contenteditable | |
631 | + if ( this.hasAttribute( "contenteditable" ) ) { | |
632 | + this.form = $( this ).closest( "form" )[ 0 ]; | |
633 | + } | |
634 | + | |
635 | + // Select only the first element for each name, and only those with rules specified | |
636 | + if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) { | |
637 | + return false; | |
638 | + } | |
639 | + | |
640 | + rulesCache[ name ] = true; | |
641 | + return true; | |
642 | + } ); | |
643 | + }, | |
644 | + | |
645 | + clean: function( selector ) { | |
646 | + return $( selector )[ 0 ]; | |
647 | + }, | |
648 | + | |
649 | + errors: function() { | |
650 | + var errorClass = this.settings.errorClass.split( " " ).join( "." ); | |
651 | + return $( this.settings.errorElement + "." + errorClass, this.errorContext ); | |
652 | + }, | |
653 | + | |
654 | + resetInternals: function() { | |
655 | + this.successList = []; | |
656 | + this.errorList = []; | |
657 | + this.errorMap = {}; | |
658 | + this.toShow = $( [] ); | |
659 | + this.toHide = $( [] ); | |
660 | + }, | |
661 | + | |
662 | + reset: function() { | |
663 | + this.resetInternals(); | |
664 | + this.currentElements = $( [] ); | |
665 | + }, | |
666 | + | |
667 | + prepareForm: function() { | |
668 | + this.reset(); | |
669 | + this.toHide = this.errors().add( this.containers ); | |
670 | + }, | |
671 | + | |
672 | + prepareElement: function( element ) { | |
673 | + this.reset(); | |
674 | + this.toHide = this.errorsFor( element ); | |
675 | + }, | |
676 | + | |
677 | + elementValue: function( element ) { | |
678 | + var $element = $( element ), | |
679 | + type = element.type, | |
680 | + val, idx; | |
681 | + | |
682 | + if ( type === "radio" || type === "checkbox" ) { | |
683 | + return this.findByName( element.name ).filter( ":checked" ).val(); | |
684 | + } else if ( type === "number" && typeof element.validity !== "undefined" ) { | |
685 | + return element.validity.badInput ? "NaN" : $element.val(); | |
686 | + } | |
687 | + | |
688 | + if ( element.hasAttribute( "contenteditable" ) ) { | |
689 | + val = $element.text(); | |
690 | + } else { | |
691 | + val = $element.val(); | |
692 | + } | |
693 | + | |
694 | + if ( type === "file" ) { | |
695 | + | |
696 | + // Modern browser (chrome & safari) | |
697 | + if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) { | |
698 | + return val.substr( 12 ); | |
699 | + } | |
700 | + | |
701 | + // Legacy browsers | |
702 | + // Unix-based path | |
703 | + idx = val.lastIndexOf( "/" ); | |
704 | + if ( idx >= 0 ) { | |
705 | + return val.substr( idx + 1 ); | |
706 | + } | |
707 | + | |
708 | + // Windows-based path | |
709 | + idx = val.lastIndexOf( "\\" ); | |
710 | + if ( idx >= 0 ) { | |
711 | + return val.substr( idx + 1 ); | |
712 | + } | |
713 | + | |
714 | + // Just the file name | |
715 | + return val; | |
716 | + } | |
717 | + | |
718 | + if ( typeof val === "string" ) { | |
719 | + return val.replace( /\r/g, "" ); | |
720 | + } | |
721 | + return val; | |
722 | + }, | |
723 | + | |
724 | + check: function( element ) { | |
725 | + element = this.validationTargetFor( this.clean( element ) ); | |
726 | + | |
727 | + var rules = $( element ).rules(), | |
728 | + rulesCount = $.map( rules, function( n, i ) { | |
729 | + return i; | |
730 | + } ).length, | |
731 | + dependencyMismatch = false, | |
732 | + val = this.elementValue( element ), | |
733 | + result, method, rule; | |
734 | + | |
735 | + // If a normalizer is defined for this element, then | |
736 | + // call it to retreive the changed value instead | |
737 | + // of using the real one. | |
738 | + // Note that `this` in the normalizer is `element`. | |
739 | + if ( typeof rules.normalizer === "function" ) { | |
740 | + val = rules.normalizer.call( element, val ); | |
741 | + | |
742 | + if ( typeof val !== "string" ) { | |
743 | + throw new TypeError( "The normalizer should return a string value." ); | |
744 | + } | |
745 | + | |
746 | + // Delete the normalizer from rules to avoid treating | |
747 | + // it as a pre-defined method. | |
748 | + delete rules.normalizer; | |
749 | + } | |
750 | + | |
751 | + for ( method in rules ) { | |
752 | + rule = { method: method, parameters: rules[ method ] }; | |
753 | + try { | |
754 | + result = $.validator.methods[ method ].call( this, val, element, rule.parameters ); | |
755 | + | |
756 | + // If a method indicates that the field is optional and therefore valid, | |
757 | + // don't mark it as valid when there are no other rules | |
758 | + if ( result === "dependency-mismatch" && rulesCount === 1 ) { | |
759 | + dependencyMismatch = true; | |
760 | + continue; | |
761 | + } | |
762 | + dependencyMismatch = false; | |
763 | + | |
764 | + if ( result === "pending" ) { | |
765 | + this.toHide = this.toHide.not( this.errorsFor( element ) ); | |
766 | + return; | |
767 | + } | |
768 | + | |
769 | + if ( !result ) { | |
770 | + this.formatAndAdd( element, rule ); | |
771 | + return false; | |
772 | + } | |
773 | + } catch ( e ) { | |
774 | + if ( this.settings.debug && window.console ) { | |
775 | + console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); | |
776 | + } | |
777 | + if ( e instanceof TypeError ) { | |
778 | + e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method."; | |
779 | + } | |
780 | + | |
781 | + throw e; | |
782 | + } | |
783 | + } | |
784 | + if ( dependencyMismatch ) { | |
785 | + return; | |
786 | + } | |
787 | + if ( this.objectLength( rules ) ) { | |
788 | + this.successList.push( element ); | |
789 | + } | |
790 | + return true; | |
791 | + }, | |
792 | + | |
793 | + // Return the custom message for the given element and validation method | |
794 | + // specified in the element's HTML5 data attribute | |
795 | + // return the generic message if present and no method specific message is present | |
796 | + customDataMessage: function( element, method ) { | |
797 | + return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() + | |
798 | + method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" ); | |
799 | + }, | |
800 | + | |
801 | + // Return the custom message for the given element name and validation method | |
802 | + customMessage: function( name, method ) { | |
803 | + var m = this.settings.messages[ name ]; | |
804 | + return m && ( m.constructor === String ? m : m[ method ] ); | |
805 | + }, | |
806 | + | |
807 | + // Return the first defined argument, allowing empty strings | |
808 | + findDefined: function() { | |
809 | + for ( var i = 0; i < arguments.length; i++ ) { | |
810 | + if ( arguments[ i ] !== undefined ) { | |
811 | + return arguments[ i ]; | |
812 | + } | |
813 | + } | |
814 | + return undefined; | |
815 | + }, | |
816 | + | |
817 | + defaultMessage: function( element, rule ) { | |
818 | + var message = this.findDefined( | |
819 | + this.customMessage( element.name, rule.method ), | |
820 | + this.customDataMessage( element, rule.method ), | |
821 | + | |
822 | + // 'title' is never undefined, so handle empty string as undefined | |
823 | + !this.settings.ignoreTitle && element.title || undefined, | |
824 | + $.validator.messages[ rule.method ], | |
825 | + "<strong>Warning: No message defined for " + element.name + "</strong>" | |
826 | + ), | |
827 | + theregex = /\$?\{(\d+)\}/g; | |
828 | + if ( typeof message === "function" ) { | |
829 | + message = message.call( this, rule.parameters, element ); | |
830 | + } else if ( theregex.test( message ) ) { | |
831 | + message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters ); | |
832 | + } | |
833 | + | |
834 | + return message; | |
835 | + }, | |
836 | + | |
837 | + formatAndAdd: function( element, rule ) { | |
838 | + var message = this.defaultMessage( element, rule ); | |
839 | + | |
840 | + this.errorList.push( { | |
841 | + message: message, | |
842 | + element: element, | |
843 | + method: rule.method | |
844 | + } ); | |
845 | + | |
846 | + this.errorMap[ element.name ] = message; | |
847 | + this.submitted[ element.name ] = message; | |
848 | + }, | |
849 | + | |
850 | + addWrapper: function( toToggle ) { | |
851 | + if ( this.settings.wrapper ) { | |
852 | + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); | |
853 | + } | |
854 | + return toToggle; | |
855 | + }, | |
856 | + | |
857 | + defaultShowErrors: function() { | |
858 | + var i, elements, error; | |
859 | + for ( i = 0; this.errorList[ i ]; i++ ) { | |
860 | + error = this.errorList[ i ]; | |
861 | + if ( this.settings.highlight ) { | |
862 | + this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); | |
863 | + } | |
864 | + this.showLabel( error.element, error.message ); | |
865 | + } | |
866 | + if ( this.errorList.length ) { | |
867 | + this.toShow = this.toShow.add( this.containers ); | |
868 | + } | |
869 | + if ( this.settings.success ) { | |
870 | + for ( i = 0; this.successList[ i ]; i++ ) { | |
871 | + this.showLabel( this.successList[ i ] ); | |
872 | + } | |
873 | + } | |
874 | + if ( this.settings.unhighlight ) { | |
875 | + for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) { | |
876 | + this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass ); | |
877 | + } | |
878 | + } | |
879 | + this.toHide = this.toHide.not( this.toShow ); | |
880 | + this.hideErrors(); | |
881 | + this.addWrapper( this.toShow ).show(); | |
882 | + }, | |
883 | + | |
884 | + validElements: function() { | |
885 | + return this.currentElements.not( this.invalidElements() ); | |
886 | + }, | |
887 | + | |
888 | + invalidElements: function() { | |
889 | + return $( this.errorList ).map( function() { | |
890 | + return this.element; | |
891 | + } ); | |
892 | + }, | |
893 | + | |
894 | + showLabel: function( element, message ) { | |
895 | + var place, group, errorID, v, | |
896 | + error = this.errorsFor( element ), | |
897 | + elementID = this.idOrName( element ), | |
898 | + describedBy = $( element ).attr( "aria-describedby" ); | |
899 | + | |
900 | + if ( error.length ) { | |
901 | + | |
902 | + // Refresh error/success class | |
903 | + error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); | |
904 | + | |
905 | + // Replace message on existing label | |
906 | + error.html( message ); | |
907 | + } else { | |
908 | + | |
909 | + // Create error element | |
910 | + error = $( "<" + this.settings.errorElement + ">" ) | |
911 | + .attr( "id", elementID + "-error" ) | |
912 | + .addClass( this.settings.errorClass ) | |
913 | + .html( message || "" ); | |
914 | + | |
915 | + // Maintain reference to the element to be placed into the DOM | |
916 | + place = error; | |
917 | + if ( this.settings.wrapper ) { | |
918 | + | |
919 | + // Make sure the element is visible, even in IE | |
920 | + // actually showing the wrapped element is handled elsewhere | |
921 | + place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent(); | |
922 | + } | |
923 | + if ( this.labelContainer.length ) { | |
924 | + this.labelContainer.append( place ); | |
925 | + } else if ( this.settings.errorPlacement ) { | |
926 | + this.settings.errorPlacement( place, $( element ) ); | |
927 | + } else { | |
928 | + place.insertAfter( element ); | |
929 | + } | |
930 | + | |
931 | + // Link error back to the element | |
932 | + if ( error.is( "label" ) ) { | |
933 | + | |
934 | + // If the error is a label, then associate using 'for' | |
935 | + error.attr( "for", elementID ); | |
936 | + | |
937 | + // If the element is not a child of an associated label, then it's necessary | |
938 | + // to explicitly apply aria-describedby | |
939 | + } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) { | |
940 | + errorID = error.attr( "id" ); | |
941 | + | |
942 | + // Respect existing non-error aria-describedby | |
943 | + if ( !describedBy ) { | |
944 | + describedBy = errorID; | |
945 | + } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) { | |
946 | + | |
947 | + // Add to end of list if not already present | |
948 | + describedBy += " " + errorID; | |
949 | + } | |
950 | + $( element ).attr( "aria-describedby", describedBy ); | |
951 | + | |
952 | + // If this element is grouped, then assign to all elements in the same group | |
953 | + group = this.groups[ element.name ]; | |
954 | + if ( group ) { | |
955 | + v = this; | |
956 | + $.each( v.groups, function( name, testgroup ) { | |
957 | + if ( testgroup === group ) { | |
958 | + $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm ) | |
959 | + .attr( "aria-describedby", error.attr( "id" ) ); | |
960 | + } | |
961 | + } ); | |
962 | + } | |
963 | + } | |
964 | + } | |
965 | + if ( !message && this.settings.success ) { | |
966 | + error.text( "" ); | |
967 | + if ( typeof this.settings.success === "string" ) { | |
968 | + error.addClass( this.settings.success ); | |
969 | + } else { | |
970 | + this.settings.success( error, element ); | |
971 | + } | |
972 | + } | |
973 | + this.toShow = this.toShow.add( error ); | |
974 | + }, | |
975 | + | |
976 | + errorsFor: function( element ) { | |
977 | + var name = this.escapeCssMeta( this.idOrName( element ) ), | |
978 | + describer = $( element ).attr( "aria-describedby" ), | |
979 | + selector = "label[for='" + name + "'], label[for='" + name + "'] *"; | |
980 | + | |
981 | + // 'aria-describedby' should directly reference the error element | |
982 | + if ( describer ) { | |
983 | + selector = selector + ", #" + this.escapeCssMeta( describer ) | |
984 | + .replace( /\s+/g, ", #" ); | |
985 | + } | |
986 | + | |
987 | + return this | |
988 | + .errors() | |
989 | + .filter( selector ); | |
990 | + }, | |
991 | + | |
992 | + // See https://api.jquery.com/category/selectors/, for CSS | |
993 | + // meta-characters that should be escaped in order to be used with JQuery | |
994 | + // as a literal part of a name/id or any selector. | |
995 | + escapeCssMeta: function( string ) { | |
996 | + return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); | |
997 | + }, | |
998 | + | |
999 | + idOrName: function( element ) { | |
1000 | + return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name ); | |
1001 | + }, | |
1002 | + | |
1003 | + validationTargetFor: function( element ) { | |
1004 | + | |
1005 | + // If radio/checkbox, validate first element in group instead | |
1006 | + if ( this.checkable( element ) ) { | |
1007 | + element = this.findByName( element.name ); | |
1008 | + } | |
1009 | + | |
1010 | + // Always apply ignore filter | |
1011 | + return $( element ).not( this.settings.ignore )[ 0 ]; | |
1012 | + }, | |
1013 | + | |
1014 | + checkable: function( element ) { | |
1015 | + return ( /radio|checkbox/i ).test( element.type ); | |
1016 | + }, | |
1017 | + | |
1018 | + findByName: function( name ) { | |
1019 | + return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" ); | |
1020 | + }, | |
1021 | + | |
1022 | + getLength: function( value, element ) { | |
1023 | + switch ( element.nodeName.toLowerCase() ) { | |
1024 | + case "select": | |
1025 | + return $( "option:selected", element ).length; | |
1026 | + case "input": | |
1027 | + if ( this.checkable( element ) ) { | |
1028 | + return this.findByName( element.name ).filter( ":checked" ).length; | |
1029 | + } | |
1030 | + } | |
1031 | + return value.length; | |
1032 | + }, | |
1033 | + | |
1034 | + depend: function( param, element ) { | |
1035 | + return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true; | |
1036 | + }, | |
1037 | + | |
1038 | + dependTypes: { | |
1039 | + "boolean": function( param ) { | |
1040 | + return param; | |
1041 | + }, | |
1042 | + "string": function( param, element ) { | |
1043 | + return !!$( param, element.form ).length; | |
1044 | + }, | |
1045 | + "function": function( param, element ) { | |
1046 | + return param( element ); | |
1047 | + } | |
1048 | + }, | |
1049 | + | |
1050 | + optional: function( element ) { | |
1051 | + var val = this.elementValue( element ); | |
1052 | + return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch"; | |
1053 | + }, | |
1054 | + | |
1055 | + startRequest: function( element ) { | |
1056 | + if ( !this.pending[ element.name ] ) { | |
1057 | + this.pendingRequest++; | |
1058 | + $( element ).addClass( this.settings.pendingClass ); | |
1059 | + this.pending[ element.name ] = true; | |
1060 | + } | |
1061 | + }, | |
1062 | + | |
1063 | + stopRequest: function( element, valid ) { | |
1064 | + this.pendingRequest--; | |
1065 | + | |
1066 | + // Sometimes synchronization fails, make sure pendingRequest is never < 0 | |
1067 | + if ( this.pendingRequest < 0 ) { | |
1068 | + this.pendingRequest = 0; | |
1069 | + } | |
1070 | + delete this.pending[ element.name ]; | |
1071 | + $( element ).removeClass( this.settings.pendingClass ); | |
1072 | + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { | |
1073 | + $( this.currentForm ).submit(); | |
1074 | + this.formSubmitted = false; | |
1075 | + } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) { | |
1076 | + $( this.currentForm ).triggerHandler( "invalid-form", [ this ] ); | |
1077 | + this.formSubmitted = false; | |
1078 | + } | |
1079 | + }, | |
1080 | + | |
1081 | + previousValue: function( element, method ) { | |
1082 | + return $.data( element, "previousValue" ) || $.data( element, "previousValue", { | |
1083 | + old: null, | |
1084 | + valid: true, | |
1085 | + message: this.defaultMessage( element, { method: method } ) | |
1086 | + } ); | |
1087 | + }, | |
1088 | + | |
1089 | + // Cleans up all forms and elements, removes validator-specific events | |
1090 | + destroy: function() { | |
1091 | + this.resetForm(); | |
1092 | + | |
1093 | + $( this.currentForm ) | |
1094 | + .off( ".validate" ) | |
1095 | + .removeData( "validator" ) | |
1096 | + .find( ".validate-equalTo-blur" ) | |
1097 | + .off( ".validate-equalTo" ) | |
1098 | + .removeClass( "validate-equalTo-blur" ); | |
1099 | + } | |
1100 | + | |
1101 | + }, | |
1102 | + | |
1103 | + classRuleSettings: { | |
1104 | + required: { required: true }, | |
1105 | + email: { email: true }, | |
1106 | + url: { url: true }, | |
1107 | + date: { date: true }, | |
1108 | + dateISO: { dateISO: true }, | |
1109 | + number: { number: true }, | |
1110 | + digits: { digits: true }, | |
1111 | + creditcard: { creditcard: true } | |
1112 | + }, | |
1113 | + | |
1114 | + addClassRules: function( className, rules ) { | |
1115 | + if ( className.constructor === String ) { | |
1116 | + this.classRuleSettings[ className ] = rules; | |
1117 | + } else { | |
1118 | + $.extend( this.classRuleSettings, className ); | |
1119 | + } | |
1120 | + }, | |
1121 | + | |
1122 | + classRules: function( element ) { | |
1123 | + var rules = {}, | |
1124 | + classes = $( element ).attr( "class" ); | |
1125 | + | |
1126 | + if ( classes ) { | |
1127 | + $.each( classes.split( " " ), function() { | |
1128 | + if ( this in $.validator.classRuleSettings ) { | |
1129 | + $.extend( rules, $.validator.classRuleSettings[ this ] ); | |
1130 | + } | |
1131 | + } ); | |
1132 | + } | |
1133 | + return rules; | |
1134 | + }, | |
1135 | + | |
1136 | + normalizeAttributeRule: function( rules, type, method, value ) { | |
1137 | + | |
1138 | + // Convert the value to a number for number inputs, and for text for backwards compability | |
1139 | + // allows type="date" and others to be compared as strings | |
1140 | + if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { | |
1141 | + value = Number( value ); | |
1142 | + | |
1143 | + // Support Opera Mini, which returns NaN for undefined minlength | |
1144 | + if ( isNaN( value ) ) { | |
1145 | + value = undefined; | |
1146 | + } | |
1147 | + } | |
1148 | + | |
1149 | + if ( value || value === 0 ) { | |
1150 | + rules[ method ] = value; | |
1151 | + } else if ( type === method && type !== "range" ) { | |
1152 | + | |
1153 | + // Exception: the jquery validate 'range' method | |
1154 | + // does not test for the html5 'range' type | |
1155 | + rules[ method ] = true; | |
1156 | + } | |
1157 | + }, | |
1158 | + | |
1159 | + attributeRules: function( element ) { | |
1160 | + var rules = {}, | |
1161 | + $element = $( element ), | |
1162 | + type = element.getAttribute( "type" ), | |
1163 | + method, value; | |
1164 | + | |
1165 | + for ( method in $.validator.methods ) { | |
1166 | + | |
1167 | + // Support for <input required> in both html5 and older browsers | |
1168 | + if ( method === "required" ) { | |
1169 | + value = element.getAttribute( method ); | |
1170 | + | |
1171 | + // Some browsers return an empty string for the required attribute | |
1172 | + // and non-HTML5 browsers might have required="" markup | |
1173 | + if ( value === "" ) { | |
1174 | + value = true; | |
1175 | + } | |
1176 | + | |
1177 | + // Force non-HTML5 browsers to return bool | |
1178 | + value = !!value; | |
1179 | + } else { | |
1180 | + value = $element.attr( method ); | |
1181 | + } | |
1182 | + | |
1183 | + this.normalizeAttributeRule( rules, type, method, value ); | |
1184 | + } | |
1185 | + | |
1186 | + // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs | |
1187 | + if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) { | |
1188 | + delete rules.maxlength; | |
1189 | + } | |
1190 | + | |
1191 | + return rules; | |
1192 | + }, | |
1193 | + | |
1194 | + dataRules: function( element ) { | |
1195 | + var rules = {}, | |
1196 | + $element = $( element ), | |
1197 | + type = element.getAttribute( "type" ), | |
1198 | + method, value; | |
1199 | + | |
1200 | + for ( method in $.validator.methods ) { | |
1201 | + value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() ); | |
1202 | + this.normalizeAttributeRule( rules, type, method, value ); | |
1203 | + } | |
1204 | + return rules; | |
1205 | + }, | |
1206 | + | |
1207 | + staticRules: function( element ) { | |
1208 | + var rules = {}, | |
1209 | + validator = $.data( element.form, "validator" ); | |
1210 | + | |
1211 | + if ( validator.settings.rules ) { | |
1212 | + rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {}; | |
1213 | + } | |
1214 | + return rules; | |
1215 | + }, | |
1216 | + | |
1217 | + normalizeRules: function( rules, element ) { | |
1218 | + | |
1219 | + // Handle dependency check | |
1220 | + $.each( rules, function( prop, val ) { | |
1221 | + | |
1222 | + // Ignore rule when param is explicitly false, eg. required:false | |
1223 | + if ( val === false ) { | |
1224 | + delete rules[ prop ]; | |
1225 | + return; | |
1226 | + } | |
1227 | + if ( val.param || val.depends ) { | |
1228 | + var keepRule = true; | |
1229 | + switch ( typeof val.depends ) { | |
1230 | + case "string": | |
1231 | + keepRule = !!$( val.depends, element.form ).length; | |
1232 | + break; | |
1233 | + case "function": | |
1234 | + keepRule = val.depends.call( element, element ); | |
1235 | + break; | |
1236 | + } | |
1237 | + if ( keepRule ) { | |
1238 | + rules[ prop ] = val.param !== undefined ? val.param : true; | |
1239 | + } else { | |
1240 | + $.data( element.form, "validator" ).resetElements( $( element ) ); | |
1241 | + delete rules[ prop ]; | |
1242 | + } | |
1243 | + } | |
1244 | + } ); | |
1245 | + | |
1246 | + // Evaluate parameters | |
1247 | + $.each( rules, function( rule, parameter ) { | |
1248 | + rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter; | |
1249 | + } ); | |
1250 | + | |
1251 | + // Clean number parameters | |
1252 | + $.each( [ "minlength", "maxlength" ], function() { | |
1253 | + if ( rules[ this ] ) { | |
1254 | + rules[ this ] = Number( rules[ this ] ); | |
1255 | + } | |
1256 | + } ); | |
1257 | + $.each( [ "rangelength", "range" ], function() { | |
1258 | + var parts; | |
1259 | + if ( rules[ this ] ) { | |
1260 | + if ( $.isArray( rules[ this ] ) ) { | |
1261 | + rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ]; | |
1262 | + } else if ( typeof rules[ this ] === "string" ) { | |
1263 | + parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ ); | |
1264 | + rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ]; | |
1265 | + } | |
1266 | + } | |
1267 | + } ); | |
1268 | + | |
1269 | + if ( $.validator.autoCreateRanges ) { | |
1270 | + | |
1271 | + // Auto-create ranges | |
1272 | + if ( rules.min != null && rules.max != null ) { | |
1273 | + rules.range = [ rules.min, rules.max ]; | |
1274 | + delete rules.min; | |
1275 | + delete rules.max; | |
1276 | + } | |
1277 | + if ( rules.minlength != null && rules.maxlength != null ) { | |
1278 | + rules.rangelength = [ rules.minlength, rules.maxlength ]; | |
1279 | + delete rules.minlength; | |
1280 | + delete rules.maxlength; | |
1281 | + } | |
1282 | + } | |
1283 | + | |
1284 | + return rules; | |
1285 | + }, | |
1286 | + | |
1287 | + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} | |
1288 | + normalizeRule: function( data ) { | |
1289 | + if ( typeof data === "string" ) { | |
1290 | + var transformed = {}; | |
1291 | + $.each( data.split( /\s/ ), function() { | |
1292 | + transformed[ this ] = true; | |
1293 | + } ); | |
1294 | + data = transformed; | |
1295 | + } | |
1296 | + return data; | |
1297 | + }, | |
1298 | + | |
1299 | + // http://jqueryvalidation.org/jQuery.validator.addMethod/ | |
1300 | + addMethod: function( name, method, message ) { | |
1301 | + $.validator.methods[ name ] = method; | |
1302 | + $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ]; | |
1303 | + if ( method.length < 3 ) { | |
1304 | + $.validator.addClassRules( name, $.validator.normalizeRule( name ) ); | |
1305 | + } | |
1306 | + }, | |
1307 | + | |
1308 | + // http://jqueryvalidation.org/jQuery.validator.methods/ | |
1309 | + methods: { | |
1310 | + | |
1311 | + // http://jqueryvalidation.org/required-method/ | |
1312 | + required: function( value, element, param ) { | |
1313 | + | |
1314 | + // Check if dependency is met | |
1315 | + if ( !this.depend( param, element ) ) { | |
1316 | + return "dependency-mismatch"; | |
1317 | + } | |
1318 | + if ( element.nodeName.toLowerCase() === "select" ) { | |
1319 | + | |
1320 | + // Could be an array for select-multiple or a string, both are fine this way | |
1321 | + var val = $( element ).val(); | |
1322 | + return val && val.length > 0; | |
1323 | + } | |
1324 | + if ( this.checkable( element ) ) { | |
1325 | + return this.getLength( value, element ) > 0; | |
1326 | + } | |
1327 | + return value.length > 0; | |
1328 | + }, | |
1329 | + | |
1330 | + // http://jqueryvalidation.org/email-method/ | |
1331 | + email: function( value, element ) { | |
1332 | + | |
1333 | + // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address | |
1334 | + // Retrieved 2014-01-14 | |
1335 | + // If you have a problem with this implementation, report a bug against the above spec | |
1336 | + // Or use custom methods to implement your own email validation | |
1337 | + return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value ); | |
1338 | + }, | |
1339 | + | |
1340 | + // http://jqueryvalidation.org/url-method/ | |
1341 | + url: function( value, element ) { | |
1342 | + | |
1343 | + // Copyright (c) 2010-2013 Diego Perini, MIT licensed | |
1344 | + // https://gist.github.com/dperini/729294 | |
1345 | + // see also https://mathiasbynens.be/demo/url-regex | |
1346 | + // modified to allow protocol-relative URLs | |
1347 | + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); | |
1348 | + }, | |
1349 | + | |
1350 | + // http://jqueryvalidation.org/date-method/ | |
1351 | + date: function( value, element ) { | |
1352 | + return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() ); | |
1353 | + }, | |
1354 | + | |
1355 | + // http://jqueryvalidation.org/dateISO-method/ | |
1356 | + dateISO: function( value, element ) { | |
1357 | + return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value ); | |
1358 | + }, | |
1359 | + | |
1360 | + // http://jqueryvalidation.org/number-method/ | |
1361 | + number: function( value, element ) { | |
1362 | + return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value ); | |
1363 | + }, | |
1364 | + | |
1365 | + // http://jqueryvalidation.org/digits-method/ | |
1366 | + digits: function( value, element ) { | |
1367 | + return this.optional( element ) || /^\d+$/.test( value ); | |
1368 | + }, | |
1369 | + | |
1370 | + // http://jqueryvalidation.org/minlength-method/ | |
1371 | + minlength: function( value, element, param ) { | |
1372 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1373 | + return this.optional( element ) || length >= param; | |
1374 | + }, | |
1375 | + | |
1376 | + // http://jqueryvalidation.org/maxlength-method/ | |
1377 | + maxlength: function( value, element, param ) { | |
1378 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1379 | + return this.optional( element ) || length <= param; | |
1380 | + }, | |
1381 | + | |
1382 | + // http://jqueryvalidation.org/rangelength-method/ | |
1383 | + rangelength: function( value, element, param ) { | |
1384 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1385 | + return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] ); | |
1386 | + }, | |
1387 | + | |
1388 | + // http://jqueryvalidation.org/min-method/ | |
1389 | + min: function( value, element, param ) { | |
1390 | + return this.optional( element ) || value >= param; | |
1391 | + }, | |
1392 | + | |
1393 | + // http://jqueryvalidation.org/max-method/ | |
1394 | + max: function( value, element, param ) { | |
1395 | + return this.optional( element ) || value <= param; | |
1396 | + }, | |
1397 | + | |
1398 | + // http://jqueryvalidation.org/range-method/ | |
1399 | + range: function( value, element, param ) { | |
1400 | + return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] ); | |
1401 | + }, | |
1402 | + | |
1403 | + // http://jqueryvalidation.org/step-method/ | |
1404 | + step: function( value, element, param ) { | |
1405 | + var type = $( element ).attr( "type" ), | |
1406 | + errorMessage = "Step attribute on input type " + type + " is not supported.", | |
1407 | + supportedTypes = [ "text", "number", "range" ], | |
1408 | + re = new RegExp( "\\b" + type + "\\b" ), | |
1409 | + notSupported = type && !re.test( supportedTypes.join() ); | |
1410 | + | |
1411 | + // Works only for text, number and range input types | |
1412 | + // TODO find a way to support input types date, datetime, datetime-local, month, time and week | |
1413 | + if ( notSupported ) { | |
1414 | + throw new Error( errorMessage ); | |
1415 | + } | |
1416 | + return this.optional( element ) || ( value % param === 0 ); | |
1417 | + }, | |
1418 | + | |
1419 | + // http://jqueryvalidation.org/equalTo-method/ | |
1420 | + equalTo: function( value, element, param ) { | |
1421 | + | |
1422 | + // Bind to the blur event of the target in order to revalidate whenever the target field is updated | |
1423 | + var target = $( param ); | |
1424 | + if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) { | |
1425 | + target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() { | |
1426 | + $( element ).valid(); | |
1427 | + } ); | |
1428 | + } | |
1429 | + return value === target.val(); | |
1430 | + }, | |
1431 | + | |
1432 | + // http://jqueryvalidation.org/remote-method/ | |
1433 | + remote: function( value, element, param, method ) { | |
1434 | + if ( this.optional( element ) ) { | |
1435 | + return "dependency-mismatch"; | |
1436 | + } | |
1437 | + | |
1438 | + method = typeof method === "string" && method || "remote"; | |
1439 | + | |
1440 | + var previous = this.previousValue( element, method ), | |
1441 | + validator, data, optionDataString; | |
1442 | + | |
1443 | + if ( !this.settings.messages[ element.name ] ) { | |
1444 | + this.settings.messages[ element.name ] = {}; | |
1445 | + } | |
1446 | + previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ]; | |
1447 | + this.settings.messages[ element.name ][ method ] = previous.message; | |
1448 | + | |
1449 | + param = typeof param === "string" && { url: param } || param; | |
1450 | + optionDataString = $.param( $.extend( { data: value }, param.data ) ); | |
1451 | + if ( previous.old === optionDataString ) { | |
1452 | + return previous.valid; | |
1453 | + } | |
1454 | + | |
1455 | + previous.old = optionDataString; | |
1456 | + validator = this; | |
1457 | + this.startRequest( element ); | |
1458 | + data = {}; | |
1459 | + data[ element.name ] = value; | |
1460 | + $.ajax( $.extend( true, { | |
1461 | + mode: "abort", | |
1462 | + port: "validate" + element.name, | |
1463 | + dataType: "json", | |
1464 | + data: data, | |
1465 | + context: validator.currentForm, | |
1466 | + success: function( response ) { | |
1467 | + var valid = response === true || response === "true", | |
1468 | + errors, message, submitted; | |
1469 | + | |
1470 | + validator.settings.messages[ element.name ][ method ] = previous.originalMessage; | |
1471 | + if ( valid ) { | |
1472 | + submitted = validator.formSubmitted; | |
1473 | + validator.resetInternals(); | |
1474 | + validator.toHide = validator.errorsFor( element ); | |
1475 | + validator.formSubmitted = submitted; | |
1476 | + validator.successList.push( element ); | |
1477 | + validator.invalid[ element.name ] = false; | |
1478 | + validator.showErrors(); | |
1479 | + } else { | |
1480 | + errors = {}; | |
1481 | + message = response || validator.defaultMessage( element, { method: method, parameters: value } ); | |
1482 | + errors[ element.name ] = previous.message = message; | |
1483 | + validator.invalid[ element.name ] = true; | |
1484 | + validator.showErrors( errors ); | |
1485 | + } | |
1486 | + previous.valid = valid; | |
1487 | + validator.stopRequest( element, valid ); | |
1488 | + } | |
1489 | + }, param ) ); | |
1490 | + return "pending"; | |
1491 | + } | |
1492 | + } | |
1493 | + | |
1494 | +} ); | |
1495 | + | |
1496 | +// Ajax mode: abort | |
1497 | +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); | |
1498 | +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() | |
1499 | + | |
1500 | +var pendingRequests = {}, | |
1501 | + ajax; | |
1502 | + | |
1503 | +// Use a prefilter if available (1.5+) | |
1504 | +if ( $.ajaxPrefilter ) { | |
1505 | + $.ajaxPrefilter( function( settings, _, xhr ) { | |
1506 | + var port = settings.port; | |
1507 | + if ( settings.mode === "abort" ) { | |
1508 | + if ( pendingRequests[ port ] ) { | |
1509 | + pendingRequests[ port ].abort(); | |
1510 | + } | |
1511 | + pendingRequests[ port ] = xhr; | |
1512 | + } | |
1513 | + } ); | |
1514 | +} else { | |
1515 | + | |
1516 | + // Proxy ajax | |
1517 | + ajax = $.ajax; | |
1518 | + $.ajax = function( settings ) { | |
1519 | + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, | |
1520 | + port = ( "port" in settings ? settings : $.ajaxSettings ).port; | |
1521 | + if ( mode === "abort" ) { | |
1522 | + if ( pendingRequests[ port ] ) { | |
1523 | + pendingRequests[ port ].abort(); | |
1524 | + } | |
1525 | + pendingRequests[ port ] = ajax.apply( this, arguments ); | |
1526 | + return pendingRequests[ port ]; | |
1527 | + } | |
1528 | + return ajax.apply( this, arguments ); | |
1529 | + }; | |
1530 | +} | |
1531 | + | |
1532 | +})); | |
0 | 1533 | \ No newline at end of file | ... | ... |
bower_components/jquery-validation/dist/jquery.validate.min.js
0 → 100644
1 | +/*! jQuery Validation Plugin - v1.15.0 - 2/24/2016 | |
2 | + * http://jqueryvalidation.org/ | |
3 | + * Copyright (c) 2016 Jörn Zaefferer; Licensed MIT */ | |
4 | +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){if(this.length){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||-1!==a.inArray(c.keyCode,d)||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable]",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=h&&g.check(e)))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)a[b]&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0]),d in c||!b.objectLength(a(this).rules())?!1:(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);if("function"==typeof f.normalizer){if(i=f.normalizer.call(b,i),"string"!=typeof i)throw new TypeError("The normalizer should return a string value.");delete f.normalizer}for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j instanceof TypeError&&(j.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e=a(c).attr("type"),f="Step attribute on input type "+e+" is not supported.",g=["text","number","range"],h=new RegExp("\\b"+e+"\\b"),i=e&&!h.test(g.join());if(i)throw new Error(f);return this.optional(c)||b%d===0},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)})}); | |
0 | 5 | \ No newline at end of file | ... | ... |
1 | +{ | |
2 | + "name": "jquery-validation", | |
3 | + "title": "jQuery Validation Plugin", | |
4 | + "description": "Client-side form validation made easy", | |
5 | + "version": "1.15.0", | |
6 | + "homepage": "http://jqueryvalidation.org/", | |
7 | + "license": "MIT", | |
8 | + "author": { | |
9 | + "name": "Jörn Zaefferer", | |
10 | + "email": "joern.zaefferer@gmail.com", | |
11 | + "url": "http://bassistance.de" | |
12 | + }, | |
13 | + "repository": { | |
14 | + "type": "git", | |
15 | + "url": "git://github.com/jzaefferer/jquery-validation.git" | |
16 | + }, | |
17 | + "bugs": { | |
18 | + "url": "https://github.com/jzaefferer/jquery-validation/issues" | |
19 | + }, | |
20 | + "licenses": [ | |
21 | + { | |
22 | + "type": "MIT", | |
23 | + "url": "http://www.opensource.org/licenses/MIT" | |
24 | + } | |
25 | + ], | |
26 | + "scripts": { | |
27 | + "test": "grunt", | |
28 | + "prepublish": "grunt" | |
29 | + }, | |
30 | + "files": [ | |
31 | + "dist/localization/", | |
32 | + "dist/additional-methods.js", | |
33 | + "dist/jquery.validate.js" | |
34 | + ], | |
35 | + "main": "dist/jquery.validate.js", | |
36 | + "dependencies": {}, | |
37 | + "devDependencies": { | |
38 | + "commitplease": "^2.2.3", | |
39 | + "grunt": "^0.4.4", | |
40 | + "grunt-contrib-compress": "^0.7", | |
41 | + "grunt-contrib-concat": "^0.3", | |
42 | + "grunt-contrib-copy": "^0.5", | |
43 | + "grunt-contrib-jshint": "^0.11.3", | |
44 | + "grunt-contrib-qunit": "^0.4", | |
45 | + "grunt-contrib-uglify": "^0.4", | |
46 | + "grunt-contrib-watch": "^0.6", | |
47 | + "grunt-jscs": "^2.2", | |
48 | + "grunt-text-replace": "^0.3.11" | |
49 | + }, | |
50 | + "keywords": [ | |
51 | + "jquery", | |
52 | + "jquery-plugin", | |
53 | + "forms", | |
54 | + "validation", | |
55 | + "validate" | |
56 | + ] | |
57 | +} | ... | ... |
bower_components/jquery-validation/src/additional/accept.js
0 → 100644
1 | +// Accept a value from a file input based on a required mimetype | |
2 | +$.validator.addMethod( "accept", function( value, element, param ) { | |
3 | + | |
4 | + // Split mime on commas in case we have multiple types we can accept | |
5 | + var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*", | |
6 | + optionalValue = this.optional( element ), | |
7 | + i, file, regex; | |
8 | + | |
9 | + // Element is optional | |
10 | + if ( optionalValue ) { | |
11 | + return optionalValue; | |
12 | + } | |
13 | + | |
14 | + if ( $( element ).attr( "type" ) === "file" ) { | |
15 | + | |
16 | + // Escape string to be used in the regex | |
17 | + // see: http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex | |
18 | + // Escape also "/*" as "/.*" as a wildcard | |
19 | + typeParam = typeParam.replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" ).replace( /,/g, "|" ).replace( "\/*", "/.*" ); | |
20 | + | |
21 | + // Check if the element has a FileList before checking each file | |
22 | + if ( element.files && element.files.length ) { | |
23 | + regex = new RegExp( ".?(" + typeParam + ")$", "i" ); | |
24 | + for ( i = 0; i < element.files.length; i++ ) { | |
25 | + file = element.files[ i ]; | |
26 | + | |
27 | + // Grab the mimetype from the loaded file, verify it matches | |
28 | + if ( !file.type.match( regex ) ) { | |
29 | + return false; | |
30 | + } | |
31 | + } | |
32 | + } | |
33 | + } | |
34 | + | |
35 | + // Either return true because we've validated each file, or because the | |
36 | + // browser does not support element.files and the FileList feature | |
37 | + return true; | |
38 | +}, $.validator.format( "Please enter a value with a valid mimetype." ) ); | ... | ... |
bower_components/jquery-validation/src/additional/additional.js
0 → 100644
1 | +( function() { | |
2 | + | |
3 | + function stripHtml( value ) { | |
4 | + | |
5 | + // Remove html tags and space chars | |
6 | + return value.replace( /<.[^<>]*?>/g, " " ).replace( / | /gi, " " ) | |
7 | + | |
8 | + // Remove punctuation | |
9 | + .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" ); | |
10 | + } | |
11 | + | |
12 | + $.validator.addMethod( "maxWords", function( value, element, params ) { | |
13 | + return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length <= params; | |
14 | + }, $.validator.format( "Please enter {0} words or less." ) ); | |
15 | + | |
16 | + $.validator.addMethod( "minWords", function( value, element, params ) { | |
17 | + return this.optional( element ) || stripHtml( value ).match( /\b\w+\b/g ).length >= params; | |
18 | + }, $.validator.format( "Please enter at least {0} words." ) ); | |
19 | + | |
20 | + $.validator.addMethod( "rangeWords", function( value, element, params ) { | |
21 | + var valueStripped = stripHtml( value ), | |
22 | + regex = /\b\w+\b/g; | |
23 | + return this.optional( element ) || valueStripped.match( regex ).length >= params[ 0 ] && valueStripped.match( regex ).length <= params[ 1 ]; | |
24 | + }, $.validator.format( "Please enter between {0} and {1} words." ) ); | |
25 | + | |
26 | +}() ); | ... | ... |
bower_components/jquery-validation/src/additional/alphanumeric.js
0 → 100644
bower_components/jquery-validation/src/additional/bankaccountNL.js
0 → 100644
1 | +/* | |
2 | + * Dutch bank account numbers (not 'giro' numbers) have 9 digits | |
3 | + * and pass the '11 check'. | |
4 | + * We accept the notation with spaces, as that is common. | |
5 | + * acceptable: 123456789 or 12 34 56 789 | |
6 | + */ | |
7 | +$.validator.addMethod( "bankaccountNL", function( value, element ) { | |
8 | + if ( this.optional( element ) ) { | |
9 | + return true; | |
10 | + } | |
11 | + if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) { | |
12 | + return false; | |
13 | + } | |
14 | + | |
15 | + // Now '11 check' | |
16 | + var account = value.replace( / /g, "" ), // Remove spaces | |
17 | + sum = 0, | |
18 | + len = account.length, | |
19 | + pos, factor, digit; | |
20 | + for ( pos = 0; pos < len; pos++ ) { | |
21 | + factor = len - pos; | |
22 | + digit = account.substring( pos, pos + 1 ); | |
23 | + sum = sum + factor * digit; | |
24 | + } | |
25 | + return sum % 11 === 0; | |
26 | +}, "Please specify a valid bank account number" ); | ... | ... |
bower_components/jquery-validation/src/additional/bankorgiroaccountNL.js
0 → 100644
1 | +$.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { | |
2 | + return this.optional( element ) || | |
3 | + ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || | |
4 | + ( $.validator.methods.giroaccountNL.call( this, value, element ) ); | |
5 | +}, "Please specify a valid bank or giro account number" ); | ... | ... |
bower_components/jquery-validation/src/additional/bic.js
0 → 100644
1 | +/** | |
2 | + * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity. | |
3 | + * | |
4 | + * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional) | |
5 | + * | |
6 | + * Validation is case-insensitive. Please make sure to normalize input yourself. | |
7 | + * | |
8 | + * BIC definition in detail: | |
9 | + * - First 4 characters - bank code (only letters) | |
10 | + * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters) | |
11 | + * - Next 2 characters - location code (letters and digits) | |
12 | + * a. shall not start with '0' or '1' | |
13 | + * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing) | |
14 | + * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits) | |
15 | + */ | |
16 | +$.validator.addMethod( "bic", function( value, element ) { | |
17 | + return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); | |
18 | +}, "Please specify a valid BIC code" ); | ... | ... |
bower_components/jquery-validation/src/additional/cifES.js
0 → 100644
1 | +/* | |
2 | + * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities | |
3 | + * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal | |
4 | + */ | |
5 | +$.validator.addMethod( "cifES", function( value ) { | |
6 | + "use strict"; | |
7 | + | |
8 | + var num = [], | |
9 | + controlDigit, sum, i, count, tmp, secondDigit; | |
10 | + | |
11 | + value = value.toUpperCase(); | |
12 | + | |
13 | + // Quick format test | |
14 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
15 | + return false; | |
16 | + } | |
17 | + | |
18 | + for ( i = 0; i < 9; i++ ) { | |
19 | + num[ i ] = parseInt( value.charAt( i ), 10 ); | |
20 | + } | |
21 | + | |
22 | + // Algorithm for checking CIF codes | |
23 | + sum = num[ 2 ] + num[ 4 ] + num[ 6 ]; | |
24 | + for ( count = 1; count < 8; count += 2 ) { | |
25 | + tmp = ( 2 * num[ count ] ).toString(); | |
26 | + secondDigit = tmp.charAt( 1 ); | |
27 | + | |
28 | + sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) ); | |
29 | + } | |
30 | + | |
31 | + /* The first (position 1) is a letter following the following criteria: | |
32 | + * A. Corporations | |
33 | + * B. LLCs | |
34 | + * C. General partnerships | |
35 | + * D. Companies limited partnerships | |
36 | + * E. Communities of goods | |
37 | + * F. Cooperative Societies | |
38 | + * G. Associations | |
39 | + * H. Communities of homeowners in horizontal property regime | |
40 | + * J. Civil Societies | |
41 | + * K. Old format | |
42 | + * L. Old format | |
43 | + * M. Old format | |
44 | + * N. Nonresident entities | |
45 | + * P. Local authorities | |
46 | + * Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions | |
47 | + * R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008) | |
48 | + * S. Organs of State Administration and regions | |
49 | + * V. Agrarian Transformation | |
50 | + * W. Permanent establishments of non-resident in Spain | |
51 | + */ | |
52 | + if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) { | |
53 | + sum += ""; | |
54 | + controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 ); | |
55 | + value += controlDigit; | |
56 | + return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) ); | |
57 | + } | |
58 | + | |
59 | + return false; | |
60 | + | |
61 | +}, "Please specify a valid CIF number." ); | ... | ... |
bower_components/jquery-validation/src/additional/cpfBR.js
0 → 100644
1 | +/* | |
2 | + * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number. | |
3 | + * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. | |
4 | + */ | |
5 | +$.validator.addMethod( "cpfBR", function( value ) { | |
6 | + | |
7 | + // Removing special characters from value | |
8 | + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); | |
9 | + | |
10 | + // Checking value to have 11 digits only | |
11 | + if ( value.length !== 11 ) { | |
12 | + return false; | |
13 | + } | |
14 | + | |
15 | + var sum = 0, | |
16 | + firstCN, secondCN, checkResult, i; | |
17 | + | |
18 | + firstCN = parseInt( value.substring( 9, 10 ), 10 ); | |
19 | + secondCN = parseInt( value.substring( 10, 11 ), 10 ); | |
20 | + | |
21 | + checkResult = function( sum, cn ) { | |
22 | + var result = ( sum * 10 ) % 11; | |
23 | + if ( ( result === 10 ) || ( result === 11 ) ) { | |
24 | + result = 0; | |
25 | + } | |
26 | + return ( result === cn ); | |
27 | + }; | |
28 | + | |
29 | + // Checking for dump data | |
30 | + if ( value === "" || | |
31 | + value === "00000000000" || | |
32 | + value === "11111111111" || | |
33 | + value === "22222222222" || | |
34 | + value === "33333333333" || | |
35 | + value === "44444444444" || | |
36 | + value === "55555555555" || | |
37 | + value === "66666666666" || | |
38 | + value === "77777777777" || | |
39 | + value === "88888888888" || | |
40 | + value === "99999999999" | |
41 | + ) { | |
42 | + return false; | |
43 | + } | |
44 | + | |
45 | + // Step 1 - using first Check Number: | |
46 | + for ( i = 1; i <= 9; i++ ) { | |
47 | + sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 11 - i ); | |
48 | + } | |
49 | + | |
50 | + // If first Check Number (CN) is valid, move to Step 2 - using second Check Number: | |
51 | + if ( checkResult( sum, firstCN ) ) { | |
52 | + sum = 0; | |
53 | + for ( i = 1; i <= 10; i++ ) { | |
54 | + sum = sum + parseInt( value.substring( i - 1, i ), 10 ) * ( 12 - i ); | |
55 | + } | |
56 | + return checkResult( sum, secondCN ); | |
57 | + } | |
58 | + return false; | |
59 | + | |
60 | +}, "Please specify a valid CPF number" ); | ... | ... |
bower_components/jquery-validation/src/additional/creditcard.js
0 → 100644
1 | +// http://jqueryvalidation.org/creditcard-method/ | |
2 | +// based on http://en.wikipedia.org/wiki/Luhn_algorithm | |
3 | +$.validator.addMethod( "creditcard", function( value, element ) { | |
4 | + if ( this.optional( element ) ) { | |
5 | + return "dependency-mismatch"; | |
6 | + } | |
7 | + | |
8 | + // Accept only spaces, digits and dashes | |
9 | + if ( /[^0-9 \-]+/.test( value ) ) { | |
10 | + return false; | |
11 | + } | |
12 | + | |
13 | + var nCheck = 0, | |
14 | + nDigit = 0, | |
15 | + bEven = false, | |
16 | + n, cDigit; | |
17 | + | |
18 | + value = value.replace( /\D/g, "" ); | |
19 | + | |
20 | + // Basing min and max length on | |
21 | + // http://developer.ean.com/general_info/Valid_Credit_Card_Types | |
22 | + if ( value.length < 13 || value.length > 19 ) { | |
23 | + return false; | |
24 | + } | |
25 | + | |
26 | + for ( n = value.length - 1; n >= 0; n-- ) { | |
27 | + cDigit = value.charAt( n ); | |
28 | + nDigit = parseInt( cDigit, 10 ); | |
29 | + if ( bEven ) { | |
30 | + if ( ( nDigit *= 2 ) > 9 ) { | |
31 | + nDigit -= 9; | |
32 | + } | |
33 | + } | |
34 | + | |
35 | + nCheck += nDigit; | |
36 | + bEven = !bEven; | |
37 | + } | |
38 | + | |
39 | + return ( nCheck % 10 ) === 0; | |
40 | +}, "Please enter a valid credit card number." ); | ... | ... |
bower_components/jquery-validation/src/additional/creditcardtypes.js
0 → 100644
1 | +/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator | |
2 | + * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 | |
3 | + * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) | |
4 | + */ | |
5 | +$.validator.addMethod( "creditcardtypes", function( value, element, param ) { | |
6 | + if ( /[^0-9\-]+/.test( value ) ) { | |
7 | + return false; | |
8 | + } | |
9 | + | |
10 | + value = value.replace( /\D/g, "" ); | |
11 | + | |
12 | + var validTypes = 0x0000; | |
13 | + | |
14 | + if ( param.mastercard ) { | |
15 | + validTypes |= 0x0001; | |
16 | + } | |
17 | + if ( param.visa ) { | |
18 | + validTypes |= 0x0002; | |
19 | + } | |
20 | + if ( param.amex ) { | |
21 | + validTypes |= 0x0004; | |
22 | + } | |
23 | + if ( param.dinersclub ) { | |
24 | + validTypes |= 0x0008; | |
25 | + } | |
26 | + if ( param.enroute ) { | |
27 | + validTypes |= 0x0010; | |
28 | + } | |
29 | + if ( param.discover ) { | |
30 | + validTypes |= 0x0020; | |
31 | + } | |
32 | + if ( param.jcb ) { | |
33 | + validTypes |= 0x0040; | |
34 | + } | |
35 | + if ( param.unknown ) { | |
36 | + validTypes |= 0x0080; | |
37 | + } | |
38 | + if ( param.all ) { | |
39 | + validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; | |
40 | + } | |
41 | + if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard | |
42 | + return value.length === 16; | |
43 | + } | |
44 | + if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa | |
45 | + return value.length === 16; | |
46 | + } | |
47 | + if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex | |
48 | + return value.length === 15; | |
49 | + } | |
50 | + if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub | |
51 | + return value.length === 14; | |
52 | + } | |
53 | + if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute | |
54 | + return value.length === 15; | |
55 | + } | |
56 | + if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover | |
57 | + return value.length === 16; | |
58 | + } | |
59 | + if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb | |
60 | + return value.length === 16; | |
61 | + } | |
62 | + if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb | |
63 | + return value.length === 15; | |
64 | + } | |
65 | + if ( validTypes & 0x0080 ) { // Unknown | |
66 | + return true; | |
67 | + } | |
68 | + return false; | |
69 | +}, "Please enter a valid credit card number." ); | ... | ... |
bower_components/jquery-validation/src/additional/currency.js
0 → 100644
1 | +/** | |
2 | + * Validates currencies with any given symbols by @jameslouiz | |
3 | + * Symbols can be optional or required. Symbols required by default | |
4 | + * | |
5 | + * Usage examples: | |
6 | + * currency: ["£", false] - Use false for soft currency validation | |
7 | + * currency: ["$", false] | |
8 | + * currency: ["RM", false] - also works with text based symbols such as "RM" - Malaysia Ringgit etc | |
9 | + * | |
10 | + * <input class="currencyInput" name="currencyInput"> | |
11 | + * | |
12 | + * Soft symbol checking | |
13 | + * currencyInput: { | |
14 | + * currency: ["$", false] | |
15 | + * } | |
16 | + * | |
17 | + * Strict symbol checking (default) | |
18 | + * currencyInput: { | |
19 | + * currency: "$" | |
20 | + * //OR | |
21 | + * currency: ["$", true] | |
22 | + * } | |
23 | + * | |
24 | + * Multiple Symbols | |
25 | + * currencyInput: { | |
26 | + * currency: "$,£,¢" | |
27 | + * } | |
28 | + */ | |
29 | +$.validator.addMethod( "currency", function( value, element, param ) { | |
30 | + var isParamString = typeof param === "string", | |
31 | + symbol = isParamString ? param : param[ 0 ], | |
32 | + soft = isParamString ? true : param[ 1 ], | |
33 | + regex; | |
34 | + | |
35 | + symbol = symbol.replace( /,/g, "" ); | |
36 | + symbol = soft ? symbol + "]" : symbol + "]?"; | |
37 | + regex = "^[" + symbol + "([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$"; | |
38 | + regex = new RegExp( regex ); | |
39 | + return this.optional( element ) || regex.test( value ); | |
40 | + | |
41 | +}, "Please specify a valid currency" ); | ... | ... |
bower_components/jquery-validation/src/additional/dateFA.js
0 → 100644
bower_components/jquery-validation/src/additional/dateITA.js
0 → 100644
1 | +/** | |
2 | + * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy. | |
3 | + * | |
4 | + * @example $.validator.methods.date("01/01/1900") | |
5 | + * @result true | |
6 | + * | |
7 | + * @example $.validator.methods.date("01/13/1990") | |
8 | + * @result false | |
9 | + * | |
10 | + * @example $.validator.methods.date("01.01.1900") | |
11 | + * @result false | |
12 | + * | |
13 | + * @example <input name="pippo" class="{dateITA:true}" /> | |
14 | + * @desc Declares an optional input element whose value must be a valid date. | |
15 | + * | |
16 | + * @name $.validator.methods.dateITA | |
17 | + * @type Boolean | |
18 | + * @cat Plugins/Validate/Methods | |
19 | + */ | |
20 | +$.validator.addMethod( "dateITA", function( value, element ) { | |
21 | + var check = false, | |
22 | + re = /^\d{1,2}\/\d{1,2}\/\d{4}$/, | |
23 | + adata, gg, mm, aaaa, xdata; | |
24 | + if ( re.test( value ) ) { | |
25 | + adata = value.split( "/" ); | |
26 | + gg = parseInt( adata[ 0 ], 10 ); | |
27 | + mm = parseInt( adata[ 1 ], 10 ); | |
28 | + aaaa = parseInt( adata[ 2 ], 10 ); | |
29 | + xdata = new Date( Date.UTC( aaaa, mm - 1, gg, 12, 0, 0, 0 ) ); | |
30 | + if ( ( xdata.getUTCFullYear() === aaaa ) && ( xdata.getUTCMonth() === mm - 1 ) && ( xdata.getUTCDate() === gg ) ) { | |
31 | + check = true; | |
32 | + } else { | |
33 | + check = false; | |
34 | + } | |
35 | + } else { | |
36 | + check = false; | |
37 | + } | |
38 | + return this.optional( element ) || check; | |
39 | +}, $.validator.messages.date ); | ... | ... |
bower_components/jquery-validation/src/additional/dateNL.js
0 → 100644
bower_components/jquery-validation/src/additional/extension.js
0 → 100644
1 | +// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept | |
2 | +$.validator.addMethod( "extension", function( value, element, param ) { | |
3 | + param = typeof param === "string" ? param.replace( /,/g, "|" ) : "png|jpe?g|gif"; | |
4 | + return this.optional( element ) || value.match( new RegExp( "\\.(" + param + ")$", "i" ) ); | |
5 | +}, $.validator.format( "Please enter a value with a valid extension." ) ); | ... | ... |
bower_components/jquery-validation/src/additional/giroaccountNL.js
0 → 100644
bower_components/jquery-validation/src/additional/iban.js
0 → 100644
1 | +/** | |
2 | + * IBAN is the international bank account number. | |
3 | + * It has a country - specific format, that is checked here too | |
4 | + * | |
5 | + * Validation is case-insensitive. Please make sure to normalize input yourself. | |
6 | + */ | |
7 | +$.validator.addMethod( "iban", function( value, element ) { | |
8 | + | |
9 | + // Some quick simple tests to prevent needless work | |
10 | + if ( this.optional( element ) ) { | |
11 | + return true; | |
12 | + } | |
13 | + | |
14 | + // Remove spaces and to upper case | |
15 | + var iban = value.replace( / /g, "" ).toUpperCase(), | |
16 | + ibancheckdigits = "", | |
17 | + leadingZeroes = true, | |
18 | + cRest = "", | |
19 | + cOperator = "", | |
20 | + countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; | |
21 | + | |
22 | + // Check the country code and find the country specific format | |
23 | + countrycode = iban.substring( 0, 2 ); | |
24 | + bbancountrypatterns = { | |
25 | + "AL": "\\d{8}[\\dA-Z]{16}", | |
26 | + "AD": "\\d{8}[\\dA-Z]{12}", | |
27 | + "AT": "\\d{16}", | |
28 | + "AZ": "[\\dA-Z]{4}\\d{20}", | |
29 | + "BE": "\\d{12}", | |
30 | + "BH": "[A-Z]{4}[\\dA-Z]{14}", | |
31 | + "BA": "\\d{16}", | |
32 | + "BR": "\\d{23}[A-Z][\\dA-Z]", | |
33 | + "BG": "[A-Z]{4}\\d{6}[\\dA-Z]{8}", | |
34 | + "CR": "\\d{17}", | |
35 | + "HR": "\\d{17}", | |
36 | + "CY": "\\d{8}[\\dA-Z]{16}", | |
37 | + "CZ": "\\d{20}", | |
38 | + "DK": "\\d{14}", | |
39 | + "DO": "[A-Z]{4}\\d{20}", | |
40 | + "EE": "\\d{16}", | |
41 | + "FO": "\\d{14}", | |
42 | + "FI": "\\d{14}", | |
43 | + "FR": "\\d{10}[\\dA-Z]{11}\\d{2}", | |
44 | + "GE": "[\\dA-Z]{2}\\d{16}", | |
45 | + "DE": "\\d{18}", | |
46 | + "GI": "[A-Z]{4}[\\dA-Z]{15}", | |
47 | + "GR": "\\d{7}[\\dA-Z]{16}", | |
48 | + "GL": "\\d{14}", | |
49 | + "GT": "[\\dA-Z]{4}[\\dA-Z]{20}", | |
50 | + "HU": "\\d{24}", | |
51 | + "IS": "\\d{22}", | |
52 | + "IE": "[\\dA-Z]{4}\\d{14}", | |
53 | + "IL": "\\d{19}", | |
54 | + "IT": "[A-Z]\\d{10}[\\dA-Z]{12}", | |
55 | + "KZ": "\\d{3}[\\dA-Z]{13}", | |
56 | + "KW": "[A-Z]{4}[\\dA-Z]{22}", | |
57 | + "LV": "[A-Z]{4}[\\dA-Z]{13}", | |
58 | + "LB": "\\d{4}[\\dA-Z]{20}", | |
59 | + "LI": "\\d{5}[\\dA-Z]{12}", | |
60 | + "LT": "\\d{16}", | |
61 | + "LU": "\\d{3}[\\dA-Z]{13}", | |
62 | + "MK": "\\d{3}[\\dA-Z]{10}\\d{2}", | |
63 | + "MT": "[A-Z]{4}\\d{5}[\\dA-Z]{18}", | |
64 | + "MR": "\\d{23}", | |
65 | + "MU": "[A-Z]{4}\\d{19}[A-Z]{3}", | |
66 | + "MC": "\\d{10}[\\dA-Z]{11}\\d{2}", | |
67 | + "MD": "[\\dA-Z]{2}\\d{18}", | |
68 | + "ME": "\\d{18}", | |
69 | + "NL": "[A-Z]{4}\\d{10}", | |
70 | + "NO": "\\d{11}", | |
71 | + "PK": "[\\dA-Z]{4}\\d{16}", | |
72 | + "PS": "[\\dA-Z]{4}\\d{21}", | |
73 | + "PL": "\\d{24}", | |
74 | + "PT": "\\d{21}", | |
75 | + "RO": "[A-Z]{4}[\\dA-Z]{16}", | |
76 | + "SM": "[A-Z]\\d{10}[\\dA-Z]{12}", | |
77 | + "SA": "\\d{2}[\\dA-Z]{18}", | |
78 | + "RS": "\\d{18}", | |
79 | + "SK": "\\d{20}", | |
80 | + "SI": "\\d{15}", | |
81 | + "ES": "\\d{20}", | |
82 | + "SE": "\\d{20}", | |
83 | + "CH": "\\d{5}[\\dA-Z]{12}", | |
84 | + "TN": "\\d{20}", | |
85 | + "TR": "\\d{5}[\\dA-Z]{17}", | |
86 | + "AE": "\\d{3}\\d{16}", | |
87 | + "GB": "[A-Z]{4}\\d{14}", | |
88 | + "VG": "[\\dA-Z]{4}\\d{16}" | |
89 | + }; | |
90 | + | |
91 | + bbanpattern = bbancountrypatterns[ countrycode ]; | |
92 | + | |
93 | + // As new countries will start using IBAN in the | |
94 | + // future, we only check if the countrycode is known. | |
95 | + // This prevents false negatives, while almost all | |
96 | + // false positives introduced by this, will be caught | |
97 | + // by the checksum validation below anyway. | |
98 | + // Strict checking should return FALSE for unknown | |
99 | + // countries. | |
100 | + if ( typeof bbanpattern !== "undefined" ) { | |
101 | + ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); | |
102 | + if ( !( ibanregexp.test( iban ) ) ) { | |
103 | + return false; // Invalid country specific format | |
104 | + } | |
105 | + } | |
106 | + | |
107 | + // Now check the checksum, first convert to digits | |
108 | + ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); | |
109 | + for ( i = 0; i < ibancheck.length; i++ ) { | |
110 | + charAt = ibancheck.charAt( i ); | |
111 | + if ( charAt !== "0" ) { | |
112 | + leadingZeroes = false; | |
113 | + } | |
114 | + if ( !leadingZeroes ) { | |
115 | + ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf( charAt ); | |
116 | + } | |
117 | + } | |
118 | + | |
119 | + // Calculate the result of: ibancheckdigits % 97 | |
120 | + for ( p = 0; p < ibancheckdigits.length; p++ ) { | |
121 | + cChar = ibancheckdigits.charAt( p ); | |
122 | + cOperator = "" + cRest + "" + cChar; | |
123 | + cRest = cOperator % 97; | |
124 | + } | |
125 | + return cRest === 1; | |
126 | +}, "Please specify a valid IBAN" ); | ... | ... |
bower_components/jquery-validation/src/additional/integer.js
0 → 100644
bower_components/jquery-validation/src/additional/ipv4.js
0 → 100644
bower_components/jquery-validation/src/additional/ipv6.js
0 → 100644
1 | +$.validator.addMethod( "ipv6", function( value, element ) { | |
2 | + return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value ); | |
3 | +}, "Please enter a valid IP v6 address." ); | ... | ... |
bower_components/jquery-validation/src/additional/lettersonly.js
0 → 100644
bower_components/jquery-validation/src/additional/letterswithbasicpunc.js
0 → 100644
bower_components/jquery-validation/src/additional/mobileNL.js
0 → 100644
bower_components/jquery-validation/src/additional/mobileUK.js
0 → 100644
1 | +/* For UK phone functions, do the following server side processing: | |
2 | + * Compare original input with this RegEx pattern: | |
3 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
4 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
5 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
6 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
7 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
8 | + */ | |
9 | +$.validator.addMethod( "mobileUK", function( phone_number, element ) { | |
10 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
11 | + return this.optional( element ) || phone_number.length > 9 && | |
12 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); | |
13 | +}, "Please specify a valid mobile number" ); | ... | ... |
bower_components/jquery-validation/src/additional/nieES.js
0 → 100644
1 | +/* | |
2 | + * The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain | |
3 | + */ | |
4 | +$.validator.addMethod( "nieES", function( value ) { | |
5 | + "use strict"; | |
6 | + | |
7 | + value = value.toUpperCase(); | |
8 | + | |
9 | + // Basic format test | |
10 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
11 | + return false; | |
12 | + } | |
13 | + | |
14 | + // Test NIE | |
15 | + //T | |
16 | + if ( /^[T]{1}/.test( value ) ) { | |
17 | + return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) ); | |
18 | + } | |
19 | + | |
20 | + //XYZ | |
21 | + if ( /^[XYZ]{1}/.test( value ) ) { | |
22 | + return ( | |
23 | + value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( | |
24 | + value.replace( "X", "0" ) | |
25 | + .replace( "Y", "1" ) | |
26 | + .replace( "Z", "2" ) | |
27 | + .substring( 0, 8 ) % 23 | |
28 | + ) | |
29 | + ); | |
30 | + } | |
31 | + | |
32 | + return false; | |
33 | + | |
34 | +}, "Please specify a valid NIE number." ); | ... | ... |
bower_components/jquery-validation/src/additional/nifES.js
0 → 100644
1 | +/* | |
2 | + * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals | |
3 | + */ | |
4 | +$.validator.addMethod( "nifES", function( value ) { | |
5 | + "use strict"; | |
6 | + | |
7 | + value = value.toUpperCase(); | |
8 | + | |
9 | + // Basic format test | |
10 | + if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { | |
11 | + return false; | |
12 | + } | |
13 | + | |
14 | + // Test NIF | |
15 | + if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { | |
16 | + return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); | |
17 | + } | |
18 | + | |
19 | + // Test specials NIF (starts with K, L or M) | |
20 | + if ( /^[KLM]{1}/.test( value ) ) { | |
21 | + return ( value[ 8 ] === String.fromCharCode( 64 ) ); | |
22 | + } | |
23 | + | |
24 | + return false; | |
25 | + | |
26 | +}, "Please specify a valid NIF number." ); | ... | ... |
bower_components/jquery-validation/src/additional/notEqualTo.js
0 → 100644
bower_components/jquery-validation/src/additional/nowhitespace.js
0 → 100644
bower_components/jquery-validation/src/additional/pattern.js
0 → 100644
1 | +/** | |
2 | +* Return true if the field value matches the given format RegExp | |
3 | +* | |
4 | +* @example $.validator.methods.pattern("AR1004",element,/^AR\d{4}$/) | |
5 | +* @result true | |
6 | +* | |
7 | +* @example $.validator.methods.pattern("BR1004",element,/^AR\d{4}$/) | |
8 | +* @result false | |
9 | +* | |
10 | +* @name $.validator.methods.pattern | |
11 | +* @type Boolean | |
12 | +* @cat Plugins/Validate/Methods | |
13 | +*/ | |
14 | +$.validator.addMethod( "pattern", function( value, element, param ) { | |
15 | + if ( this.optional( element ) ) { | |
16 | + return true; | |
17 | + } | |
18 | + if ( typeof param === "string" ) { | |
19 | + param = new RegExp( "^(?:" + param + ")$" ); | |
20 | + } | |
21 | + return param.test( value ); | |
22 | +}, "Invalid format." ); | ... | ... |
bower_components/jquery-validation/src/additional/phoneNL.js
0 → 100644
1 | +/** | |
2 | + * Dutch phone numbers have 10 digits (or 11 and start with +31). | |
3 | + */ | |
4 | +$.validator.addMethod( "phoneNL", function( value, element ) { | |
5 | + return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); | |
6 | +}, "Please specify a valid phone number." ); | ... | ... |
bower_components/jquery-validation/src/additional/phoneUK.js
0 → 100644
1 | +/* For UK phone functions, do the following server side processing: | |
2 | + * Compare original input with this RegEx pattern: | |
3 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
4 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
5 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
6 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
7 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
8 | + */ | |
9 | +$.validator.addMethod( "phoneUK", function( phone_number, element ) { | |
10 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
11 | + return this.optional( element ) || phone_number.length > 9 && | |
12 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); | |
13 | +}, "Please specify a valid phone number" ); | ... | ... |
bower_components/jquery-validation/src/additional/phoneUS.js
0 → 100644
1 | +/** | |
2 | + * Matches US phone number format | |
3 | + * | |
4 | + * where the area code may not start with 1 and the prefix may not start with 1 | |
5 | + * allows '-' or ' ' as a separator and allows parens around area code | |
6 | + * some people may want to put a '1' in front of their number | |
7 | + * | |
8 | + * 1(212)-999-2345 or | |
9 | + * 212 999 2344 or | |
10 | + * 212-999-0983 | |
11 | + * | |
12 | + * but not | |
13 | + * 111-123-5434 | |
14 | + * and not | |
15 | + * 212 123 4567 | |
16 | + */ | |
17 | +$.validator.addMethod( "phoneUS", function( phone_number, element ) { | |
18 | + phone_number = phone_number.replace( /\s+/g, "" ); | |
19 | + return this.optional( element ) || phone_number.length > 9 && | |
20 | + phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); | |
21 | +}, "Please specify a valid phone number" ); | ... | ... |
bower_components/jquery-validation/src/additional/phonesUK.js
0 → 100644
1 | +/* For UK phone functions, do the following server side processing: | |
2 | + * Compare original input with this RegEx pattern: | |
3 | + * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ | |
4 | + * Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' | |
5 | + * Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. | |
6 | + * A number of very detailed GB telephone number RegEx patterns can also be found at: | |
7 | + * http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers | |
8 | + */ | |
9 | + | |
10 | +// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers | |
11 | +$.validator.addMethod( "phonesUK", function( phone_number, element ) { | |
12 | + phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); | |
13 | + return this.optional( element ) || phone_number.length > 9 && | |
14 | + phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); | |
15 | +}, "Please specify a valid uk phone number" ); | ... | ... |
bower_components/jquery-validation/src/additional/postalCodeCA.js
0 → 100644
1 | +/** | |
2 | + * Matches a valid Canadian Postal Code | |
3 | + * | |
4 | + * @example jQuery.validator.methods.postalCodeCA( "H0H 0H0", element ) | |
5 | + * @result true | |
6 | + * | |
7 | + * @example jQuery.validator.methods.postalCodeCA( "H0H0H0", element ) | |
8 | + * @result false | |
9 | + * | |
10 | + * @name jQuery.validator.methods.postalCodeCA | |
11 | + * @type Boolean | |
12 | + * @cat Plugins/Validate/Methods | |
13 | + */ | |
14 | +$.validator.addMethod( "postalCodeCA", function( value, element ) { | |
15 | + return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); | |
16 | +}, "Please specify a valid postal code" ); | ... | ... |
bower_components/jquery-validation/src/additional/postalcodeBR.js
0 → 100644
1 | +/* | |
2 | +* Valida CEPs do brasileiros: | |
3 | +* | |
4 | +* Formatos aceitos: | |
5 | +* 99999-999 | |
6 | +* 99.999-999 | |
7 | +* 99999999 | |
8 | +*/ | |
9 | +$.validator.addMethod( "postalcodeBR", function( cep_value, element ) { | |
10 | + return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value ); | |
11 | +}, "Informe um CEP válido." ); | ... | ... |
bower_components/jquery-validation/src/additional/postalcodeIT.js
0 → 100644
bower_components/jquery-validation/src/additional/postalcodeNL.js
0 → 100644
bower_components/jquery-validation/src/additional/postcodeUK.js
0 → 100644
1 | +// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) | |
2 | +$.validator.addMethod( "postcodeUK", function( value, element ) { | |
3 | + return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); | |
4 | +}, "Please specify a valid UK postcode" ); | ... | ... |
bower_components/jquery-validation/src/additional/require_from_group.js
0 → 100644
1 | +/* | |
2 | + * Lets you say "at least X inputs that match selector Y must be filled." | |
3 | + * | |
4 | + * The end result is that neither of these inputs: | |
5 | + * | |
6 | + * <input class="productinfo" name="partnumber"> | |
7 | + * <input class="productinfo" name="description"> | |
8 | + * | |
9 | + * ...will validate unless at least one of them is filled. | |
10 | + * | |
11 | + * partnumber: {require_from_group: [1,".productinfo"]}, | |
12 | + * description: {require_from_group: [1,".productinfo"]} | |
13 | + * | |
14 | + * options[0]: number of fields that must be filled in the group | |
15 | + * options[1]: CSS selector that defines the group of conditionally required fields | |
16 | + */ | |
17 | +$.validator.addMethod( "require_from_group", function( value, element, options ) { | |
18 | + var $fields = $( options[ 1 ], element.form ), | |
19 | + $fieldsFirst = $fields.eq( 0 ), | |
20 | + validator = $fieldsFirst.data( "valid_req_grp" ) ? $fieldsFirst.data( "valid_req_grp" ) : $.extend( {}, this ), | |
21 | + isValid = $fields.filter( function() { | |
22 | + return validator.elementValue( this ); | |
23 | + } ).length >= options[ 0 ]; | |
24 | + | |
25 | + // Store the cloned validator for future validation | |
26 | + $fieldsFirst.data( "valid_req_grp", validator ); | |
27 | + | |
28 | + // If element isn't being validated, run each require_from_group field's validation rules | |
29 | + if ( !$( element ).data( "being_validated" ) ) { | |
30 | + $fields.data( "being_validated", true ); | |
31 | + $fields.each( function() { | |
32 | + validator.element( this ); | |
33 | + } ); | |
34 | + $fields.data( "being_validated", false ); | |
35 | + } | |
36 | + return isValid; | |
37 | +}, $.validator.format( "Please fill at least {0} of these fields." ) ); | ... | ... |
bower_components/jquery-validation/src/additional/skip_or_fill_minimum.js
0 → 100644
1 | +/* | |
2 | + * Lets you say "either at least X inputs that match selector Y must be filled, | |
3 | + * OR they must all be skipped (left blank)." | |
4 | + * | |
5 | + * The end result, is that none of these inputs: | |
6 | + * | |
7 | + * <input class="productinfo" name="partnumber"> | |
8 | + * <input class="productinfo" name="description"> | |
9 | + * <input class="productinfo" name="color"> | |
10 | + * | |
11 | + * ...will validate unless either at least two of them are filled, | |
12 | + * OR none of them are. | |
13 | + * | |
14 | + * partnumber: {skip_or_fill_minimum: [2,".productinfo"]}, | |
15 | + * description: {skip_or_fill_minimum: [2,".productinfo"]}, | |
16 | + * color: {skip_or_fill_minimum: [2,".productinfo"]} | |
17 | + * | |
18 | + * options[0]: number of fields that must be filled in the group | |
19 | + * options[1]: CSS selector that defines the group of conditionally required fields | |
20 | + * | |
21 | + */ | |
22 | +$.validator.addMethod( "skip_or_fill_minimum", function( value, element, options ) { | |
23 | + var $fields = $( options[ 1 ], element.form ), | |
24 | + $fieldsFirst = $fields.eq( 0 ), | |
25 | + validator = $fieldsFirst.data( "valid_skip" ) ? $fieldsFirst.data( "valid_skip" ) : $.extend( {}, this ), | |
26 | + numberFilled = $fields.filter( function() { | |
27 | + return validator.elementValue( this ); | |
28 | + } ).length, | |
29 | + isValid = numberFilled === 0 || numberFilled >= options[ 0 ]; | |
30 | + | |
31 | + // Store the cloned validator for future validation | |
32 | + $fieldsFirst.data( "valid_skip", validator ); | |
33 | + | |
34 | + // If element isn't being validated, run each skip_or_fill_minimum field's validation rules | |
35 | + if ( !$( element ).data( "being_validated" ) ) { | |
36 | + $fields.data( "being_validated", true ); | |
37 | + $fields.each( function() { | |
38 | + validator.element( this ); | |
39 | + } ); | |
40 | + $fields.data( "being_validated", false ); | |
41 | + } | |
42 | + return isValid; | |
43 | +}, $.validator.format( "Please either skip these fields or fill at least {0} of them." ) ); | ... | ... |
bower_components/jquery-validation/src/additional/statesUS.js
0 → 100644
1 | +/* Validates US States and/or Territories by @jdforsythe | |
2 | + * Can be case insensitive or require capitalization - default is case insensitive | |
3 | + * Can include US Territories or not - default does not | |
4 | + * Can include US Military postal abbreviations (AA, AE, AP) - default does not | |
5 | + * | |
6 | + * Note: "States" always includes DC (District of Colombia) | |
7 | + * | |
8 | + * Usage examples: | |
9 | + * | |
10 | + * This is the default - case insensitive, no territories, no military zones | |
11 | + * stateInput: { | |
12 | + * caseSensitive: false, | |
13 | + * includeTerritories: false, | |
14 | + * includeMilitary: false | |
15 | + * } | |
16 | + * | |
17 | + * Only allow capital letters, no territories, no military zones | |
18 | + * stateInput: { | |
19 | + * caseSensitive: false | |
20 | + * } | |
21 | + * | |
22 | + * Case insensitive, include territories but not military zones | |
23 | + * stateInput: { | |
24 | + * includeTerritories: true | |
25 | + * } | |
26 | + * | |
27 | + * Only allow capital letters, include territories and military zones | |
28 | + * stateInput: { | |
29 | + * caseSensitive: true, | |
30 | + * includeTerritories: true, | |
31 | + * includeMilitary: true | |
32 | + * } | |
33 | + * | |
34 | + */ | |
35 | +$.validator.addMethod( "stateUS", function( value, element, options ) { | |
36 | + var isDefault = typeof options === "undefined", | |
37 | + caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, | |
38 | + includeTerritories = ( isDefault || typeof options.includeTerritories === "undefined" ) ? false : options.includeTerritories, | |
39 | + includeMilitary = ( isDefault || typeof options.includeMilitary === "undefined" ) ? false : options.includeMilitary, | |
40 | + regex; | |
41 | + | |
42 | + if ( !includeTerritories && !includeMilitary ) { | |
43 | + regex = "^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; | |
44 | + } else if ( includeTerritories && includeMilitary ) { | |
45 | + regex = "^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; | |
46 | + } else if ( includeTerritories ) { | |
47 | + regex = "^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; | |
48 | + } else { | |
49 | + regex = "^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; | |
50 | + } | |
51 | + | |
52 | + regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); | |
53 | + return this.optional( element ) || regex.test( value ); | |
54 | +}, "Please specify a valid state" ); | ... | ... |
bower_components/jquery-validation/src/additional/strippedminlength.js
0 → 100644
bower_components/jquery-validation/src/additional/time.js
0 → 100644
bower_components/jquery-validation/src/additional/time12h.js
0 → 100644
bower_components/jquery-validation/src/additional/url2.js
0 → 100644
1 | +// Same as url, but TLD is optional | |
2 | +$.validator.addMethod( "url2", function( value, element ) { | |
3 | + return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); | |
4 | +}, $.validator.messages.url ); | ... | ... |
bower_components/jquery-validation/src/additional/vinUS.js
0 → 100644
1 | +/** | |
2 | + * Return true, if the value is a valid vehicle identification number (VIN). | |
3 | + * | |
4 | + * Works with all kind of text inputs. | |
5 | + * | |
6 | + * @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" /> | |
7 | + * @desc Declares a required input element whose value must be a valid vehicle identification number. | |
8 | + * | |
9 | + * @name $.validator.methods.vinUS | |
10 | + * @type Boolean | |
11 | + * @cat Plugins/Validate/Methods | |
12 | + */ | |
13 | +$.validator.addMethod( "vinUS", function( v ) { | |
14 | + if ( v.length !== 17 ) { | |
15 | + return false; | |
16 | + } | |
17 | + | |
18 | + var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ], | |
19 | + VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ], | |
20 | + FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ], | |
21 | + rs = 0, | |
22 | + i, n, d, f, cd, cdv; | |
23 | + | |
24 | + for ( i = 0; i < 17; i++ ) { | |
25 | + f = FL[ i ]; | |
26 | + d = v.slice( i, i + 1 ); | |
27 | + if ( i === 8 ) { | |
28 | + cdv = d; | |
29 | + } | |
30 | + if ( !isNaN( d ) ) { | |
31 | + d *= f; | |
32 | + } else { | |
33 | + for ( n = 0; n < LL.length; n++ ) { | |
34 | + if ( d.toUpperCase() === LL[ n ] ) { | |
35 | + d = VL[ n ]; | |
36 | + d *= f; | |
37 | + if ( isNaN( cdv ) && n === 8 ) { | |
38 | + cdv = LL[ n ]; | |
39 | + } | |
40 | + break; | |
41 | + } | |
42 | + } | |
43 | + } | |
44 | + rs += d; | |
45 | + } | |
46 | + cd = rs % 11; | |
47 | + if ( cd === 10 ) { | |
48 | + cd = "X"; | |
49 | + } | |
50 | + if ( cd === cdv ) { | |
51 | + return true; | |
52 | + } | |
53 | + return false; | |
54 | +}, "The specified vehicle identification number (VIN) is invalid." ); | ... | ... |
bower_components/jquery-validation/src/additional/zipcodeUS.js
0 → 100644
bower_components/jquery-validation/src/additional/ziprange.js
0 → 100644
1 | +// Ajax mode: abort | |
2 | +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); | |
3 | +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() | |
4 | + | |
5 | +var pendingRequests = {}, | |
6 | + ajax; | |
7 | + | |
8 | +// Use a prefilter if available (1.5+) | |
9 | +if ( $.ajaxPrefilter ) { | |
10 | + $.ajaxPrefilter( function( settings, _, xhr ) { | |
11 | + var port = settings.port; | |
12 | + if ( settings.mode === "abort" ) { | |
13 | + if ( pendingRequests[ port ] ) { | |
14 | + pendingRequests[ port ].abort(); | |
15 | + } | |
16 | + pendingRequests[ port ] = xhr; | |
17 | + } | |
18 | + } ); | |
19 | +} else { | |
20 | + | |
21 | + // Proxy ajax | |
22 | + ajax = $.ajax; | |
23 | + $.ajax = function( settings ) { | |
24 | + var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, | |
25 | + port = ( "port" in settings ? settings : $.ajaxSettings ).port; | |
26 | + if ( mode === "abort" ) { | |
27 | + if ( pendingRequests[ port ] ) { | |
28 | + pendingRequests[ port ].abort(); | |
29 | + } | |
30 | + pendingRequests[ port ] = ajax.apply( this, arguments ); | |
31 | + return pendingRequests[ port ]; | |
32 | + } | |
33 | + return ajax.apply( this, arguments ); | |
34 | + }; | |
35 | +} | ... | ... |
1 | +$.extend( $.fn, { | |
2 | + | |
3 | + // http://jqueryvalidation.org/validate/ | |
4 | + validate: function( options ) { | |
5 | + | |
6 | + // If nothing is selected, return nothing; can't chain anyway | |
7 | + if ( !this.length ) { | |
8 | + if ( options && options.debug && window.console ) { | |
9 | + console.warn( "Nothing selected, can't validate, returning nothing." ); | |
10 | + } | |
11 | + return; | |
12 | + } | |
13 | + | |
14 | + // Check if a validator for this form was already created | |
15 | + var validator = $.data( this[ 0 ], "validator" ); | |
16 | + if ( validator ) { | |
17 | + return validator; | |
18 | + } | |
19 | + | |
20 | + // Add novalidate tag if HTML5. | |
21 | + this.attr( "novalidate", "novalidate" ); | |
22 | + | |
23 | + validator = new $.validator( options, this[ 0 ] ); | |
24 | + $.data( this[ 0 ], "validator", validator ); | |
25 | + | |
26 | + if ( validator.settings.onsubmit ) { | |
27 | + | |
28 | + this.on( "click.validate", ":submit", function( event ) { | |
29 | + if ( validator.settings.submitHandler ) { | |
30 | + validator.submitButton = event.target; | |
31 | + } | |
32 | + | |
33 | + // Allow suppressing validation by adding a cancel class to the submit button | |
34 | + if ( $( this ).hasClass( "cancel" ) ) { | |
35 | + validator.cancelSubmit = true; | |
36 | + } | |
37 | + | |
38 | + // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button | |
39 | + if ( $( this ).attr( "formnovalidate" ) !== undefined ) { | |
40 | + validator.cancelSubmit = true; | |
41 | + } | |
42 | + } ); | |
43 | + | |
44 | + // Validate the form on submit | |
45 | + this.on( "submit.validate", function( event ) { | |
46 | + if ( validator.settings.debug ) { | |
47 | + | |
48 | + // Prevent form submit to be able to see console output | |
49 | + event.preventDefault(); | |
50 | + } | |
51 | + function handle() { | |
52 | + var hidden, result; | |
53 | + if ( validator.settings.submitHandler ) { | |
54 | + if ( validator.submitButton ) { | |
55 | + | |
56 | + // Insert a hidden input as a replacement for the missing submit button | |
57 | + hidden = $( "<input type='hidden'/>" ) | |
58 | + .attr( "name", validator.submitButton.name ) | |
59 | + .val( $( validator.submitButton ).val() ) | |
60 | + .appendTo( validator.currentForm ); | |
61 | + } | |
62 | + result = validator.settings.submitHandler.call( validator, validator.currentForm, event ); | |
63 | + if ( validator.submitButton ) { | |
64 | + | |
65 | + // And clean up afterwards; thanks to no-block-scope, hidden can be referenced | |
66 | + hidden.remove(); | |
67 | + } | |
68 | + if ( result !== undefined ) { | |
69 | + return result; | |
70 | + } | |
71 | + return false; | |
72 | + } | |
73 | + return true; | |
74 | + } | |
75 | + | |
76 | + // Prevent submit for invalid forms or custom submit handlers | |
77 | + if ( validator.cancelSubmit ) { | |
78 | + validator.cancelSubmit = false; | |
79 | + return handle(); | |
80 | + } | |
81 | + if ( validator.form() ) { | |
82 | + if ( validator.pendingRequest ) { | |
83 | + validator.formSubmitted = true; | |
84 | + return false; | |
85 | + } | |
86 | + return handle(); | |
87 | + } else { | |
88 | + validator.focusInvalid(); | |
89 | + return false; | |
90 | + } | |
91 | + } ); | |
92 | + } | |
93 | + | |
94 | + return validator; | |
95 | + }, | |
96 | + | |
97 | + // http://jqueryvalidation.org/valid/ | |
98 | + valid: function() { | |
99 | + var valid, validator, errorList; | |
100 | + | |
101 | + if ( $( this[ 0 ] ).is( "form" ) ) { | |
102 | + valid = this.validate().form(); | |
103 | + } else { | |
104 | + errorList = []; | |
105 | + valid = true; | |
106 | + validator = $( this[ 0 ].form ).validate(); | |
107 | + this.each( function() { | |
108 | + valid = validator.element( this ) && valid; | |
109 | + if ( !valid ) { | |
110 | + errorList = errorList.concat( validator.errorList ); | |
111 | + } | |
112 | + } ); | |
113 | + validator.errorList = errorList; | |
114 | + } | |
115 | + return valid; | |
116 | + }, | |
117 | + | |
118 | + // http://jqueryvalidation.org/rules/ | |
119 | + rules: function( command, argument ) { | |
120 | + | |
121 | + // If nothing is selected, return nothing; can't chain anyway | |
122 | + if ( !this.length ) { | |
123 | + return; | |
124 | + } | |
125 | + | |
126 | + var element = this[ 0 ], | |
127 | + settings, staticRules, existingRules, data, param, filtered; | |
128 | + | |
129 | + if ( command ) { | |
130 | + settings = $.data( element.form, "validator" ).settings; | |
131 | + staticRules = settings.rules; | |
132 | + existingRules = $.validator.staticRules( element ); | |
133 | + switch ( command ) { | |
134 | + case "add": | |
135 | + $.extend( existingRules, $.validator.normalizeRule( argument ) ); | |
136 | + | |
137 | + // Remove messages from rules, but allow them to be set separately | |
138 | + delete existingRules.messages; | |
139 | + staticRules[ element.name ] = existingRules; | |
140 | + if ( argument.messages ) { | |
141 | + settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages ); | |
142 | + } | |
143 | + break; | |
144 | + case "remove": | |
145 | + if ( !argument ) { | |
146 | + delete staticRules[ element.name ]; | |
147 | + return existingRules; | |
148 | + } | |
149 | + filtered = {}; | |
150 | + $.each( argument.split( /\s/ ), function( index, method ) { | |
151 | + filtered[ method ] = existingRules[ method ]; | |
152 | + delete existingRules[ method ]; | |
153 | + if ( method === "required" ) { | |
154 | + $( element ).removeAttr( "aria-required" ); | |
155 | + } | |
156 | + } ); | |
157 | + return filtered; | |
158 | + } | |
159 | + } | |
160 | + | |
161 | + data = $.validator.normalizeRules( | |
162 | + $.extend( | |
163 | + {}, | |
164 | + $.validator.classRules( element ), | |
165 | + $.validator.attributeRules( element ), | |
166 | + $.validator.dataRules( element ), | |
167 | + $.validator.staticRules( element ) | |
168 | + ), element ); | |
169 | + | |
170 | + // Make sure required is at front | |
171 | + if ( data.required ) { | |
172 | + param = data.required; | |
173 | + delete data.required; | |
174 | + data = $.extend( { required: param }, data ); | |
175 | + $( element ).attr( "aria-required", "true" ); | |
176 | + } | |
177 | + | |
178 | + // Make sure remote is at back | |
179 | + if ( data.remote ) { | |
180 | + param = data.remote; | |
181 | + delete data.remote; | |
182 | + data = $.extend( data, { remote: param } ); | |
183 | + } | |
184 | + | |
185 | + return data; | |
186 | + } | |
187 | +} ); | |
188 | + | |
189 | +// Custom selectors | |
190 | +$.extend( $.expr[ ":" ], { | |
191 | + | |
192 | + // http://jqueryvalidation.org/blank-selector/ | |
193 | + blank: function( a ) { | |
194 | + return !$.trim( "" + $( a ).val() ); | |
195 | + }, | |
196 | + | |
197 | + // http://jqueryvalidation.org/filled-selector/ | |
198 | + filled: function( a ) { | |
199 | + var val = $( a ).val(); | |
200 | + return val !== null && !!$.trim( "" + val ); | |
201 | + }, | |
202 | + | |
203 | + // http://jqueryvalidation.org/unchecked-selector/ | |
204 | + unchecked: function( a ) { | |
205 | + return !$( a ).prop( "checked" ); | |
206 | + } | |
207 | +} ); | |
208 | + | |
209 | +// Constructor for validator | |
210 | +$.validator = function( options, form ) { | |
211 | + this.settings = $.extend( true, {}, $.validator.defaults, options ); | |
212 | + this.currentForm = form; | |
213 | + this.init(); | |
214 | +}; | |
215 | + | |
216 | +// http://jqueryvalidation.org/jQuery.validator.format/ | |
217 | +$.validator.format = function( source, params ) { | |
218 | + if ( arguments.length === 1 ) { | |
219 | + return function() { | |
220 | + var args = $.makeArray( arguments ); | |
221 | + args.unshift( source ); | |
222 | + return $.validator.format.apply( this, args ); | |
223 | + }; | |
224 | + } | |
225 | + if ( params === undefined ) { | |
226 | + return source; | |
227 | + } | |
228 | + if ( arguments.length > 2 && params.constructor !== Array ) { | |
229 | + params = $.makeArray( arguments ).slice( 1 ); | |
230 | + } | |
231 | + if ( params.constructor !== Array ) { | |
232 | + params = [ params ]; | |
233 | + } | |
234 | + $.each( params, function( i, n ) { | |
235 | + source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() { | |
236 | + return n; | |
237 | + } ); | |
238 | + } ); | |
239 | + return source; | |
240 | +}; | |
241 | + | |
242 | +$.extend( $.validator, { | |
243 | + | |
244 | + defaults: { | |
245 | + messages: {}, | |
246 | + groups: {}, | |
247 | + rules: {}, | |
248 | + errorClass: "error", | |
249 | + pendingClass: "pending", | |
250 | + validClass: "valid", | |
251 | + errorElement: "label", | |
252 | + focusCleanup: false, | |
253 | + focusInvalid: true, | |
254 | + errorContainer: $( [] ), | |
255 | + errorLabelContainer: $( [] ), | |
256 | + onsubmit: true, | |
257 | + ignore: ":hidden", | |
258 | + ignoreTitle: false, | |
259 | + onfocusin: function( element ) { | |
260 | + this.lastActive = element; | |
261 | + | |
262 | + // Hide error label and remove error class on focus if enabled | |
263 | + if ( this.settings.focusCleanup ) { | |
264 | + if ( this.settings.unhighlight ) { | |
265 | + this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); | |
266 | + } | |
267 | + this.hideThese( this.errorsFor( element ) ); | |
268 | + } | |
269 | + }, | |
270 | + onfocusout: function( element ) { | |
271 | + if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) { | |
272 | + this.element( element ); | |
273 | + } | |
274 | + }, | |
275 | + onkeyup: function( element, event ) { | |
276 | + | |
277 | + // Avoid revalidate the field when pressing one of the following keys | |
278 | + // Shift => 16 | |
279 | + // Ctrl => 17 | |
280 | + // Alt => 18 | |
281 | + // Caps lock => 20 | |
282 | + // End => 35 | |
283 | + // Home => 36 | |
284 | + // Left arrow => 37 | |
285 | + // Up arrow => 38 | |
286 | + // Right arrow => 39 | |
287 | + // Down arrow => 40 | |
288 | + // Insert => 45 | |
289 | + // Num lock => 144 | |
290 | + // AltGr key => 225 | |
291 | + var excludedKeys = [ | |
292 | + 16, 17, 18, 20, 35, 36, 37, | |
293 | + 38, 39, 40, 45, 144, 225 | |
294 | + ]; | |
295 | + | |
296 | + if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) { | |
297 | + return; | |
298 | + } else if ( element.name in this.submitted || element.name in this.invalid ) { | |
299 | + this.element( element ); | |
300 | + } | |
301 | + }, | |
302 | + onclick: function( element ) { | |
303 | + | |
304 | + // Click on selects, radiobuttons and checkboxes | |
305 | + if ( element.name in this.submitted ) { | |
306 | + this.element( element ); | |
307 | + | |
308 | + // Or option elements, check parent select in that case | |
309 | + } else if ( element.parentNode.name in this.submitted ) { | |
310 | + this.element( element.parentNode ); | |
311 | + } | |
312 | + }, | |
313 | + highlight: function( element, errorClass, validClass ) { | |
314 | + if ( element.type === "radio" ) { | |
315 | + this.findByName( element.name ).addClass( errorClass ).removeClass( validClass ); | |
316 | + } else { | |
317 | + $( element ).addClass( errorClass ).removeClass( validClass ); | |
318 | + } | |
319 | + }, | |
320 | + unhighlight: function( element, errorClass, validClass ) { | |
321 | + if ( element.type === "radio" ) { | |
322 | + this.findByName( element.name ).removeClass( errorClass ).addClass( validClass ); | |
323 | + } else { | |
324 | + $( element ).removeClass( errorClass ).addClass( validClass ); | |
325 | + } | |
326 | + } | |
327 | + }, | |
328 | + | |
329 | + // http://jqueryvalidation.org/jQuery.validator.setDefaults/ | |
330 | + setDefaults: function( settings ) { | |
331 | + $.extend( $.validator.defaults, settings ); | |
332 | + }, | |
333 | + | |
334 | + messages: { | |
335 | + required: "This field is required.", | |
336 | + remote: "Please fix this field.", | |
337 | + email: "Please enter a valid email address.", | |
338 | + url: "Please enter a valid URL.", | |
339 | + date: "Please enter a valid date.", | |
340 | + dateISO: "Please enter a valid date ( ISO ).", | |
341 | + number: "Please enter a valid number.", | |
342 | + digits: "Please enter only digits.", | |
343 | + equalTo: "Please enter the same value again.", | |
344 | + maxlength: $.validator.format( "Please enter no more than {0} characters." ), | |
345 | + minlength: $.validator.format( "Please enter at least {0} characters." ), | |
346 | + rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ), | |
347 | + range: $.validator.format( "Please enter a value between {0} and {1}." ), | |
348 | + max: $.validator.format( "Please enter a value less than or equal to {0}." ), | |
349 | + min: $.validator.format( "Please enter a value greater than or equal to {0}." ), | |
350 | + step: $.validator.format( "Please enter a multiple of {0}." ) | |
351 | + }, | |
352 | + | |
353 | + autoCreateRanges: false, | |
354 | + | |
355 | + prototype: { | |
356 | + | |
357 | + init: function() { | |
358 | + this.labelContainer = $( this.settings.errorLabelContainer ); | |
359 | + this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm ); | |
360 | + this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer ); | |
361 | + this.submitted = {}; | |
362 | + this.valueCache = {}; | |
363 | + this.pendingRequest = 0; | |
364 | + this.pending = {}; | |
365 | + this.invalid = {}; | |
366 | + this.reset(); | |
367 | + | |
368 | + var groups = ( this.groups = {} ), | |
369 | + rules; | |
370 | + $.each( this.settings.groups, function( key, value ) { | |
371 | + if ( typeof value === "string" ) { | |
372 | + value = value.split( /\s/ ); | |
373 | + } | |
374 | + $.each( value, function( index, name ) { | |
375 | + groups[ name ] = key; | |
376 | + } ); | |
377 | + } ); | |
378 | + rules = this.settings.rules; | |
379 | + $.each( rules, function( key, value ) { | |
380 | + rules[ key ] = $.validator.normalizeRule( value ); | |
381 | + } ); | |
382 | + | |
383 | + function delegate( event ) { | |
384 | + var validator = $.data( this.form, "validator" ), | |
385 | + eventType = "on" + event.type.replace( /^validate/, "" ), | |
386 | + settings = validator.settings; | |
387 | + if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) { | |
388 | + settings[ eventType ].call( validator, this, event ); | |
389 | + } | |
390 | + } | |
391 | + | |
392 | + $( this.currentForm ) | |
393 | + .on( "focusin.validate focusout.validate keyup.validate", | |
394 | + ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " + | |
395 | + "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " + | |
396 | + "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " + | |
397 | + "[type='radio'], [type='checkbox'], [contenteditable]", delegate ) | |
398 | + | |
399 | + // Support: Chrome, oldIE | |
400 | + // "select" is provided as event.target when clicking a option | |
401 | + .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate ); | |
402 | + | |
403 | + if ( this.settings.invalidHandler ) { | |
404 | + $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler ); | |
405 | + } | |
406 | + | |
407 | + // Add aria-required to any Static/Data/Class required fields before first validation | |
408 | + // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html | |
409 | + $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" ); | |
410 | + }, | |
411 | + | |
412 | + // http://jqueryvalidation.org/Validator.form/ | |
413 | + form: function() { | |
414 | + this.checkForm(); | |
415 | + $.extend( this.submitted, this.errorMap ); | |
416 | + this.invalid = $.extend( {}, this.errorMap ); | |
417 | + if ( !this.valid() ) { | |
418 | + $( this.currentForm ).triggerHandler( "invalid-form", [ this ] ); | |
419 | + } | |
420 | + this.showErrors(); | |
421 | + return this.valid(); | |
422 | + }, | |
423 | + | |
424 | + checkForm: function() { | |
425 | + this.prepareForm(); | |
426 | + for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { | |
427 | + this.check( elements[ i ] ); | |
428 | + } | |
429 | + return this.valid(); | |
430 | + }, | |
431 | + | |
432 | + // http://jqueryvalidation.org/Validator.element/ | |
433 | + element: function( element ) { | |
434 | + var cleanElement = this.clean( element ), | |
435 | + checkElement = this.validationTargetFor( cleanElement ), | |
436 | + v = this, | |
437 | + result = true, | |
438 | + rs, group; | |
439 | + | |
440 | + if ( checkElement === undefined ) { | |
441 | + delete this.invalid[ cleanElement.name ]; | |
442 | + } else { | |
443 | + this.prepareElement( checkElement ); | |
444 | + this.currentElements = $( checkElement ); | |
445 | + | |
446 | + // If this element is grouped, then validate all group elements already | |
447 | + // containing a value | |
448 | + group = this.groups[ checkElement.name ]; | |
449 | + if ( group ) { | |
450 | + $.each( this.groups, function( name, testgroup ) { | |
451 | + if ( testgroup === group && name !== checkElement.name ) { | |
452 | + cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) ); | |
453 | + if ( cleanElement && cleanElement.name in v.invalid ) { | |
454 | + v.currentElements.push( cleanElement ); | |
455 | + result = result && v.check( cleanElement ); | |
456 | + } | |
457 | + } | |
458 | + } ); | |
459 | + } | |
460 | + | |
461 | + rs = this.check( checkElement ) !== false; | |
462 | + result = result && rs; | |
463 | + if ( rs ) { | |
464 | + this.invalid[ checkElement.name ] = false; | |
465 | + } else { | |
466 | + this.invalid[ checkElement.name ] = true; | |
467 | + } | |
468 | + | |
469 | + if ( !this.numberOfInvalids() ) { | |
470 | + | |
471 | + // Hide error containers on last error | |
472 | + this.toHide = this.toHide.add( this.containers ); | |
473 | + } | |
474 | + this.showErrors(); | |
475 | + | |
476 | + // Add aria-invalid status for screen readers | |
477 | + $( element ).attr( "aria-invalid", !rs ); | |
478 | + } | |
479 | + | |
480 | + return result; | |
481 | + }, | |
482 | + | |
483 | + // http://jqueryvalidation.org/Validator.showErrors/ | |
484 | + showErrors: function( errors ) { | |
485 | + if ( errors ) { | |
486 | + var validator = this; | |
487 | + | |
488 | + // Add items to error list and map | |
489 | + $.extend( this.errorMap, errors ); | |
490 | + this.errorList = $.map( this.errorMap, function( message, name ) { | |
491 | + return { | |
492 | + message: message, | |
493 | + element: validator.findByName( name )[ 0 ] | |
494 | + }; | |
495 | + } ); | |
496 | + | |
497 | + // Remove items from success list | |
498 | + this.successList = $.grep( this.successList, function( element ) { | |
499 | + return !( element.name in errors ); | |
500 | + } ); | |
501 | + } | |
502 | + if ( this.settings.showErrors ) { | |
503 | + this.settings.showErrors.call( this, this.errorMap, this.errorList ); | |
504 | + } else { | |
505 | + this.defaultShowErrors(); | |
506 | + } | |
507 | + }, | |
508 | + | |
509 | + // http://jqueryvalidation.org/Validator.resetForm/ | |
510 | + resetForm: function() { | |
511 | + if ( $.fn.resetForm ) { | |
512 | + $( this.currentForm ).resetForm(); | |
513 | + } | |
514 | + this.invalid = {}; | |
515 | + this.submitted = {}; | |
516 | + this.prepareForm(); | |
517 | + this.hideErrors(); | |
518 | + var elements = this.elements() | |
519 | + .removeData( "previousValue" ) | |
520 | + .removeAttr( "aria-invalid" ); | |
521 | + | |
522 | + this.resetElements( elements ); | |
523 | + }, | |
524 | + | |
525 | + resetElements: function( elements ) { | |
526 | + var i; | |
527 | + | |
528 | + if ( this.settings.unhighlight ) { | |
529 | + for ( i = 0; elements[ i ]; i++ ) { | |
530 | + this.settings.unhighlight.call( this, elements[ i ], | |
531 | + this.settings.errorClass, "" ); | |
532 | + this.findByName( elements[ i ].name ).removeClass( this.settings.validClass ); | |
533 | + } | |
534 | + } else { | |
535 | + elements | |
536 | + .removeClass( this.settings.errorClass ) | |
537 | + .removeClass( this.settings.validClass ); | |
538 | + } | |
539 | + }, | |
540 | + | |
541 | + numberOfInvalids: function() { | |
542 | + return this.objectLength( this.invalid ); | |
543 | + }, | |
544 | + | |
545 | + objectLength: function( obj ) { | |
546 | + /* jshint unused: false */ | |
547 | + var count = 0, | |
548 | + i; | |
549 | + for ( i in obj ) { | |
550 | + if ( obj[ i ] ) { | |
551 | + count++; | |
552 | + } | |
553 | + } | |
554 | + return count; | |
555 | + }, | |
556 | + | |
557 | + hideErrors: function() { | |
558 | + this.hideThese( this.toHide ); | |
559 | + }, | |
560 | + | |
561 | + hideThese: function( errors ) { | |
562 | + errors.not( this.containers ).text( "" ); | |
563 | + this.addWrapper( errors ).hide(); | |
564 | + }, | |
565 | + | |
566 | + valid: function() { | |
567 | + return this.size() === 0; | |
568 | + }, | |
569 | + | |
570 | + size: function() { | |
571 | + return this.errorList.length; | |
572 | + }, | |
573 | + | |
574 | + focusInvalid: function() { | |
575 | + if ( this.settings.focusInvalid ) { | |
576 | + try { | |
577 | + $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] ) | |
578 | + .filter( ":visible" ) | |
579 | + .focus() | |
580 | + | |
581 | + // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find | |
582 | + .trigger( "focusin" ); | |
583 | + } catch ( e ) { | |
584 | + | |
585 | + // Ignore IE throwing errors when focusing hidden elements | |
586 | + } | |
587 | + } | |
588 | + }, | |
589 | + | |
590 | + findLastActive: function() { | |
591 | + var lastActive = this.lastActive; | |
592 | + return lastActive && $.grep( this.errorList, function( n ) { | |
593 | + return n.element.name === lastActive.name; | |
594 | + } ).length === 1 && lastActive; | |
595 | + }, | |
596 | + | |
597 | + elements: function() { | |
598 | + var validator = this, | |
599 | + rulesCache = {}; | |
600 | + | |
601 | + // Select all valid inputs inside the form (no submit or reset buttons) | |
602 | + return $( this.currentForm ) | |
603 | + .find( "input, select, textarea, [contenteditable]" ) | |
604 | + .not( ":submit, :reset, :image, :disabled" ) | |
605 | + .not( this.settings.ignore ) | |
606 | + .filter( function() { | |
607 | + var name = this.name || $( this ).attr( "name" ); // For contenteditable | |
608 | + if ( !name && validator.settings.debug && window.console ) { | |
609 | + console.error( "%o has no name assigned", this ); | |
610 | + } | |
611 | + | |
612 | + // Set form expando on contenteditable | |
613 | + if ( this.hasAttribute( "contenteditable" ) ) { | |
614 | + this.form = $( this ).closest( "form" )[ 0 ]; | |
615 | + } | |
616 | + | |
617 | + // Select only the first element for each name, and only those with rules specified | |
618 | + if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) { | |
619 | + return false; | |
620 | + } | |
621 | + | |
622 | + rulesCache[ name ] = true; | |
623 | + return true; | |
624 | + } ); | |
625 | + }, | |
626 | + | |
627 | + clean: function( selector ) { | |
628 | + return $( selector )[ 0 ]; | |
629 | + }, | |
630 | + | |
631 | + errors: function() { | |
632 | + var errorClass = this.settings.errorClass.split( " " ).join( "." ); | |
633 | + return $( this.settings.errorElement + "." + errorClass, this.errorContext ); | |
634 | + }, | |
635 | + | |
636 | + resetInternals: function() { | |
637 | + this.successList = []; | |
638 | + this.errorList = []; | |
639 | + this.errorMap = {}; | |
640 | + this.toShow = $( [] ); | |
641 | + this.toHide = $( [] ); | |
642 | + }, | |
643 | + | |
644 | + reset: function() { | |
645 | + this.resetInternals(); | |
646 | + this.currentElements = $( [] ); | |
647 | + }, | |
648 | + | |
649 | + prepareForm: function() { | |
650 | + this.reset(); | |
651 | + this.toHide = this.errors().add( this.containers ); | |
652 | + }, | |
653 | + | |
654 | + prepareElement: function( element ) { | |
655 | + this.reset(); | |
656 | + this.toHide = this.errorsFor( element ); | |
657 | + }, | |
658 | + | |
659 | + elementValue: function( element ) { | |
660 | + var $element = $( element ), | |
661 | + type = element.type, | |
662 | + val, idx; | |
663 | + | |
664 | + if ( type === "radio" || type === "checkbox" ) { | |
665 | + return this.findByName( element.name ).filter( ":checked" ).val(); | |
666 | + } else if ( type === "number" && typeof element.validity !== "undefined" ) { | |
667 | + return element.validity.badInput ? "NaN" : $element.val(); | |
668 | + } | |
669 | + | |
670 | + if ( element.hasAttribute( "contenteditable" ) ) { | |
671 | + val = $element.text(); | |
672 | + } else { | |
673 | + val = $element.val(); | |
674 | + } | |
675 | + | |
676 | + if ( type === "file" ) { | |
677 | + | |
678 | + // Modern browser (chrome & safari) | |
679 | + if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) { | |
680 | + return val.substr( 12 ); | |
681 | + } | |
682 | + | |
683 | + // Legacy browsers | |
684 | + // Unix-based path | |
685 | + idx = val.lastIndexOf( "/" ); | |
686 | + if ( idx >= 0 ) { | |
687 | + return val.substr( idx + 1 ); | |
688 | + } | |
689 | + | |
690 | + // Windows-based path | |
691 | + idx = val.lastIndexOf( "\\" ); | |
692 | + if ( idx >= 0 ) { | |
693 | + return val.substr( idx + 1 ); | |
694 | + } | |
695 | + | |
696 | + // Just the file name | |
697 | + return val; | |
698 | + } | |
699 | + | |
700 | + if ( typeof val === "string" ) { | |
701 | + return val.replace( /\r/g, "" ); | |
702 | + } | |
703 | + return val; | |
704 | + }, | |
705 | + | |
706 | + check: function( element ) { | |
707 | + element = this.validationTargetFor( this.clean( element ) ); | |
708 | + | |
709 | + var rules = $( element ).rules(), | |
710 | + rulesCount = $.map( rules, function( n, i ) { | |
711 | + return i; | |
712 | + } ).length, | |
713 | + dependencyMismatch = false, | |
714 | + val = this.elementValue( element ), | |
715 | + result, method, rule; | |
716 | + | |
717 | + // If a normalizer is defined for this element, then | |
718 | + // call it to retreive the changed value instead | |
719 | + // of using the real one. | |
720 | + // Note that `this` in the normalizer is `element`. | |
721 | + if ( typeof rules.normalizer === "function" ) { | |
722 | + val = rules.normalizer.call( element, val ); | |
723 | + | |
724 | + if ( typeof val !== "string" ) { | |
725 | + throw new TypeError( "The normalizer should return a string value." ); | |
726 | + } | |
727 | + | |
728 | + // Delete the normalizer from rules to avoid treating | |
729 | + // it as a pre-defined method. | |
730 | + delete rules.normalizer; | |
731 | + } | |
732 | + | |
733 | + for ( method in rules ) { | |
734 | + rule = { method: method, parameters: rules[ method ] }; | |
735 | + try { | |
736 | + result = $.validator.methods[ method ].call( this, val, element, rule.parameters ); | |
737 | + | |
738 | + // If a method indicates that the field is optional and therefore valid, | |
739 | + // don't mark it as valid when there are no other rules | |
740 | + if ( result === "dependency-mismatch" && rulesCount === 1 ) { | |
741 | + dependencyMismatch = true; | |
742 | + continue; | |
743 | + } | |
744 | + dependencyMismatch = false; | |
745 | + | |
746 | + if ( result === "pending" ) { | |
747 | + this.toHide = this.toHide.not( this.errorsFor( element ) ); | |
748 | + return; | |
749 | + } | |
750 | + | |
751 | + if ( !result ) { | |
752 | + this.formatAndAdd( element, rule ); | |
753 | + return false; | |
754 | + } | |
755 | + } catch ( e ) { | |
756 | + if ( this.settings.debug && window.console ) { | |
757 | + console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); | |
758 | + } | |
759 | + if ( e instanceof TypeError ) { | |
760 | + e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method."; | |
761 | + } | |
762 | + | |
763 | + throw e; | |
764 | + } | |
765 | + } | |
766 | + if ( dependencyMismatch ) { | |
767 | + return; | |
768 | + } | |
769 | + if ( this.objectLength( rules ) ) { | |
770 | + this.successList.push( element ); | |
771 | + } | |
772 | + return true; | |
773 | + }, | |
774 | + | |
775 | + // Return the custom message for the given element and validation method | |
776 | + // specified in the element's HTML5 data attribute | |
777 | + // return the generic message if present and no method specific message is present | |
778 | + customDataMessage: function( element, method ) { | |
779 | + return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() + | |
780 | + method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" ); | |
781 | + }, | |
782 | + | |
783 | + // Return the custom message for the given element name and validation method | |
784 | + customMessage: function( name, method ) { | |
785 | + var m = this.settings.messages[ name ]; | |
786 | + return m && ( m.constructor === String ? m : m[ method ] ); | |
787 | + }, | |
788 | + | |
789 | + // Return the first defined argument, allowing empty strings | |
790 | + findDefined: function() { | |
791 | + for ( var i = 0; i < arguments.length; i++ ) { | |
792 | + if ( arguments[ i ] !== undefined ) { | |
793 | + return arguments[ i ]; | |
794 | + } | |
795 | + } | |
796 | + return undefined; | |
797 | + }, | |
798 | + | |
799 | + defaultMessage: function( element, rule ) { | |
800 | + var message = this.findDefined( | |
801 | + this.customMessage( element.name, rule.method ), | |
802 | + this.customDataMessage( element, rule.method ), | |
803 | + | |
804 | + // 'title' is never undefined, so handle empty string as undefined | |
805 | + !this.settings.ignoreTitle && element.title || undefined, | |
806 | + $.validator.messages[ rule.method ], | |
807 | + "<strong>Warning: No message defined for " + element.name + "</strong>" | |
808 | + ), | |
809 | + theregex = /\$?\{(\d+)\}/g; | |
810 | + if ( typeof message === "function" ) { | |
811 | + message = message.call( this, rule.parameters, element ); | |
812 | + } else if ( theregex.test( message ) ) { | |
813 | + message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters ); | |
814 | + } | |
815 | + | |
816 | + return message; | |
817 | + }, | |
818 | + | |
819 | + formatAndAdd: function( element, rule ) { | |
820 | + var message = this.defaultMessage( element, rule ); | |
821 | + | |
822 | + this.errorList.push( { | |
823 | + message: message, | |
824 | + element: element, | |
825 | + method: rule.method | |
826 | + } ); | |
827 | + | |
828 | + this.errorMap[ element.name ] = message; | |
829 | + this.submitted[ element.name ] = message; | |
830 | + }, | |
831 | + | |
832 | + addWrapper: function( toToggle ) { | |
833 | + if ( this.settings.wrapper ) { | |
834 | + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); | |
835 | + } | |
836 | + return toToggle; | |
837 | + }, | |
838 | + | |
839 | + defaultShowErrors: function() { | |
840 | + var i, elements, error; | |
841 | + for ( i = 0; this.errorList[ i ]; i++ ) { | |
842 | + error = this.errorList[ i ]; | |
843 | + if ( this.settings.highlight ) { | |
844 | + this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); | |
845 | + } | |
846 | + this.showLabel( error.element, error.message ); | |
847 | + } | |
848 | + if ( this.errorList.length ) { | |
849 | + this.toShow = this.toShow.add( this.containers ); | |
850 | + } | |
851 | + if ( this.settings.success ) { | |
852 | + for ( i = 0; this.successList[ i ]; i++ ) { | |
853 | + this.showLabel( this.successList[ i ] ); | |
854 | + } | |
855 | + } | |
856 | + if ( this.settings.unhighlight ) { | |
857 | + for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) { | |
858 | + this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass ); | |
859 | + } | |
860 | + } | |
861 | + this.toHide = this.toHide.not( this.toShow ); | |
862 | + this.hideErrors(); | |
863 | + this.addWrapper( this.toShow ).show(); | |
864 | + }, | |
865 | + | |
866 | + validElements: function() { | |
867 | + return this.currentElements.not( this.invalidElements() ); | |
868 | + }, | |
869 | + | |
870 | + invalidElements: function() { | |
871 | + return $( this.errorList ).map( function() { | |
872 | + return this.element; | |
873 | + } ); | |
874 | + }, | |
875 | + | |
876 | + showLabel: function( element, message ) { | |
877 | + var place, group, errorID, v, | |
878 | + error = this.errorsFor( element ), | |
879 | + elementID = this.idOrName( element ), | |
880 | + describedBy = $( element ).attr( "aria-describedby" ); | |
881 | + | |
882 | + if ( error.length ) { | |
883 | + | |
884 | + // Refresh error/success class | |
885 | + error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); | |
886 | + | |
887 | + // Replace message on existing label | |
888 | + error.html( message ); | |
889 | + } else { | |
890 | + | |
891 | + // Create error element | |
892 | + error = $( "<" + this.settings.errorElement + ">" ) | |
893 | + .attr( "id", elementID + "-error" ) | |
894 | + .addClass( this.settings.errorClass ) | |
895 | + .html( message || "" ); | |
896 | + | |
897 | + // Maintain reference to the element to be placed into the DOM | |
898 | + place = error; | |
899 | + if ( this.settings.wrapper ) { | |
900 | + | |
901 | + // Make sure the element is visible, even in IE | |
902 | + // actually showing the wrapped element is handled elsewhere | |
903 | + place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent(); | |
904 | + } | |
905 | + if ( this.labelContainer.length ) { | |
906 | + this.labelContainer.append( place ); | |
907 | + } else if ( this.settings.errorPlacement ) { | |
908 | + this.settings.errorPlacement( place, $( element ) ); | |
909 | + } else { | |
910 | + place.insertAfter( element ); | |
911 | + } | |
912 | + | |
913 | + // Link error back to the element | |
914 | + if ( error.is( "label" ) ) { | |
915 | + | |
916 | + // If the error is a label, then associate using 'for' | |
917 | + error.attr( "for", elementID ); | |
918 | + | |
919 | + // If the element is not a child of an associated label, then it's necessary | |
920 | + // to explicitly apply aria-describedby | |
921 | + } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) { | |
922 | + errorID = error.attr( "id" ); | |
923 | + | |
924 | + // Respect existing non-error aria-describedby | |
925 | + if ( !describedBy ) { | |
926 | + describedBy = errorID; | |
927 | + } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) { | |
928 | + | |
929 | + // Add to end of list if not already present | |
930 | + describedBy += " " + errorID; | |
931 | + } | |
932 | + $( element ).attr( "aria-describedby", describedBy ); | |
933 | + | |
934 | + // If this element is grouped, then assign to all elements in the same group | |
935 | + group = this.groups[ element.name ]; | |
936 | + if ( group ) { | |
937 | + v = this; | |
938 | + $.each( v.groups, function( name, testgroup ) { | |
939 | + if ( testgroup === group ) { | |
940 | + $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm ) | |
941 | + .attr( "aria-describedby", error.attr( "id" ) ); | |
942 | + } | |
943 | + } ); | |
944 | + } | |
945 | + } | |
946 | + } | |
947 | + if ( !message && this.settings.success ) { | |
948 | + error.text( "" ); | |
949 | + if ( typeof this.settings.success === "string" ) { | |
950 | + error.addClass( this.settings.success ); | |
951 | + } else { | |
952 | + this.settings.success( error, element ); | |
953 | + } | |
954 | + } | |
955 | + this.toShow = this.toShow.add( error ); | |
956 | + }, | |
957 | + | |
958 | + errorsFor: function( element ) { | |
959 | + var name = this.escapeCssMeta( this.idOrName( element ) ), | |
960 | + describer = $( element ).attr( "aria-describedby" ), | |
961 | + selector = "label[for='" + name + "'], label[for='" + name + "'] *"; | |
962 | + | |
963 | + // 'aria-describedby' should directly reference the error element | |
964 | + if ( describer ) { | |
965 | + selector = selector + ", #" + this.escapeCssMeta( describer ) | |
966 | + .replace( /\s+/g, ", #" ); | |
967 | + } | |
968 | + | |
969 | + return this | |
970 | + .errors() | |
971 | + .filter( selector ); | |
972 | + }, | |
973 | + | |
974 | + // See https://api.jquery.com/category/selectors/, for CSS | |
975 | + // meta-characters that should be escaped in order to be used with JQuery | |
976 | + // as a literal part of a name/id or any selector. | |
977 | + escapeCssMeta: function( string ) { | |
978 | + return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); | |
979 | + }, | |
980 | + | |
981 | + idOrName: function( element ) { | |
982 | + return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name ); | |
983 | + }, | |
984 | + | |
985 | + validationTargetFor: function( element ) { | |
986 | + | |
987 | + // If radio/checkbox, validate first element in group instead | |
988 | + if ( this.checkable( element ) ) { | |
989 | + element = this.findByName( element.name ); | |
990 | + } | |
991 | + | |
992 | + // Always apply ignore filter | |
993 | + return $( element ).not( this.settings.ignore )[ 0 ]; | |
994 | + }, | |
995 | + | |
996 | + checkable: function( element ) { | |
997 | + return ( /radio|checkbox/i ).test( element.type ); | |
998 | + }, | |
999 | + | |
1000 | + findByName: function( name ) { | |
1001 | + return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" ); | |
1002 | + }, | |
1003 | + | |
1004 | + getLength: function( value, element ) { | |
1005 | + switch ( element.nodeName.toLowerCase() ) { | |
1006 | + case "select": | |
1007 | + return $( "option:selected", element ).length; | |
1008 | + case "input": | |
1009 | + if ( this.checkable( element ) ) { | |
1010 | + return this.findByName( element.name ).filter( ":checked" ).length; | |
1011 | + } | |
1012 | + } | |
1013 | + return value.length; | |
1014 | + }, | |
1015 | + | |
1016 | + depend: function( param, element ) { | |
1017 | + return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true; | |
1018 | + }, | |
1019 | + | |
1020 | + dependTypes: { | |
1021 | + "boolean": function( param ) { | |
1022 | + return param; | |
1023 | + }, | |
1024 | + "string": function( param, element ) { | |
1025 | + return !!$( param, element.form ).length; | |
1026 | + }, | |
1027 | + "function": function( param, element ) { | |
1028 | + return param( element ); | |
1029 | + } | |
1030 | + }, | |
1031 | + | |
1032 | + optional: function( element ) { | |
1033 | + var val = this.elementValue( element ); | |
1034 | + return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch"; | |
1035 | + }, | |
1036 | + | |
1037 | + startRequest: function( element ) { | |
1038 | + if ( !this.pending[ element.name ] ) { | |
1039 | + this.pendingRequest++; | |
1040 | + $( element ).addClass( this.settings.pendingClass ); | |
1041 | + this.pending[ element.name ] = true; | |
1042 | + } | |
1043 | + }, | |
1044 | + | |
1045 | + stopRequest: function( element, valid ) { | |
1046 | + this.pendingRequest--; | |
1047 | + | |
1048 | + // Sometimes synchronization fails, make sure pendingRequest is never < 0 | |
1049 | + if ( this.pendingRequest < 0 ) { | |
1050 | + this.pendingRequest = 0; | |
1051 | + } | |
1052 | + delete this.pending[ element.name ]; | |
1053 | + $( element ).removeClass( this.settings.pendingClass ); | |
1054 | + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { | |
1055 | + $( this.currentForm ).submit(); | |
1056 | + this.formSubmitted = false; | |
1057 | + } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) { | |
1058 | + $( this.currentForm ).triggerHandler( "invalid-form", [ this ] ); | |
1059 | + this.formSubmitted = false; | |
1060 | + } | |
1061 | + }, | |
1062 | + | |
1063 | + previousValue: function( element, method ) { | |
1064 | + return $.data( element, "previousValue" ) || $.data( element, "previousValue", { | |
1065 | + old: null, | |
1066 | + valid: true, | |
1067 | + message: this.defaultMessage( element, { method: method } ) | |
1068 | + } ); | |
1069 | + }, | |
1070 | + | |
1071 | + // Cleans up all forms and elements, removes validator-specific events | |
1072 | + destroy: function() { | |
1073 | + this.resetForm(); | |
1074 | + | |
1075 | + $( this.currentForm ) | |
1076 | + .off( ".validate" ) | |
1077 | + .removeData( "validator" ) | |
1078 | + .find( ".validate-equalTo-blur" ) | |
1079 | + .off( ".validate-equalTo" ) | |
1080 | + .removeClass( "validate-equalTo-blur" ); | |
1081 | + } | |
1082 | + | |
1083 | + }, | |
1084 | + | |
1085 | + classRuleSettings: { | |
1086 | + required: { required: true }, | |
1087 | + email: { email: true }, | |
1088 | + url: { url: true }, | |
1089 | + date: { date: true }, | |
1090 | + dateISO: { dateISO: true }, | |
1091 | + number: { number: true }, | |
1092 | + digits: { digits: true }, | |
1093 | + creditcard: { creditcard: true } | |
1094 | + }, | |
1095 | + | |
1096 | + addClassRules: function( className, rules ) { | |
1097 | + if ( className.constructor === String ) { | |
1098 | + this.classRuleSettings[ className ] = rules; | |
1099 | + } else { | |
1100 | + $.extend( this.classRuleSettings, className ); | |
1101 | + } | |
1102 | + }, | |
1103 | + | |
1104 | + classRules: function( element ) { | |
1105 | + var rules = {}, | |
1106 | + classes = $( element ).attr( "class" ); | |
1107 | + | |
1108 | + if ( classes ) { | |
1109 | + $.each( classes.split( " " ), function() { | |
1110 | + if ( this in $.validator.classRuleSettings ) { | |
1111 | + $.extend( rules, $.validator.classRuleSettings[ this ] ); | |
1112 | + } | |
1113 | + } ); | |
1114 | + } | |
1115 | + return rules; | |
1116 | + }, | |
1117 | + | |
1118 | + normalizeAttributeRule: function( rules, type, method, value ) { | |
1119 | + | |
1120 | + // Convert the value to a number for number inputs, and for text for backwards compability | |
1121 | + // allows type="date" and others to be compared as strings | |
1122 | + if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { | |
1123 | + value = Number( value ); | |
1124 | + | |
1125 | + // Support Opera Mini, which returns NaN for undefined minlength | |
1126 | + if ( isNaN( value ) ) { | |
1127 | + value = undefined; | |
1128 | + } | |
1129 | + } | |
1130 | + | |
1131 | + if ( value || value === 0 ) { | |
1132 | + rules[ method ] = value; | |
1133 | + } else if ( type === method && type !== "range" ) { | |
1134 | + | |
1135 | + // Exception: the jquery validate 'range' method | |
1136 | + // does not test for the html5 'range' type | |
1137 | + rules[ method ] = true; | |
1138 | + } | |
1139 | + }, | |
1140 | + | |
1141 | + attributeRules: function( element ) { | |
1142 | + var rules = {}, | |
1143 | + $element = $( element ), | |
1144 | + type = element.getAttribute( "type" ), | |
1145 | + method, value; | |
1146 | + | |
1147 | + for ( method in $.validator.methods ) { | |
1148 | + | |
1149 | + // Support for <input required> in both html5 and older browsers | |
1150 | + if ( method === "required" ) { | |
1151 | + value = element.getAttribute( method ); | |
1152 | + | |
1153 | + // Some browsers return an empty string for the required attribute | |
1154 | + // and non-HTML5 browsers might have required="" markup | |
1155 | + if ( value === "" ) { | |
1156 | + value = true; | |
1157 | + } | |
1158 | + | |
1159 | + // Force non-HTML5 browsers to return bool | |
1160 | + value = !!value; | |
1161 | + } else { | |
1162 | + value = $element.attr( method ); | |
1163 | + } | |
1164 | + | |
1165 | + this.normalizeAttributeRule( rules, type, method, value ); | |
1166 | + } | |
1167 | + | |
1168 | + // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs | |
1169 | + if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) { | |
1170 | + delete rules.maxlength; | |
1171 | + } | |
1172 | + | |
1173 | + return rules; | |
1174 | + }, | |
1175 | + | |
1176 | + dataRules: function( element ) { | |
1177 | + var rules = {}, | |
1178 | + $element = $( element ), | |
1179 | + type = element.getAttribute( "type" ), | |
1180 | + method, value; | |
1181 | + | |
1182 | + for ( method in $.validator.methods ) { | |
1183 | + value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() ); | |
1184 | + this.normalizeAttributeRule( rules, type, method, value ); | |
1185 | + } | |
1186 | + return rules; | |
1187 | + }, | |
1188 | + | |
1189 | + staticRules: function( element ) { | |
1190 | + var rules = {}, | |
1191 | + validator = $.data( element.form, "validator" ); | |
1192 | + | |
1193 | + if ( validator.settings.rules ) { | |
1194 | + rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {}; | |
1195 | + } | |
1196 | + return rules; | |
1197 | + }, | |
1198 | + | |
1199 | + normalizeRules: function( rules, element ) { | |
1200 | + | |
1201 | + // Handle dependency check | |
1202 | + $.each( rules, function( prop, val ) { | |
1203 | + | |
1204 | + // Ignore rule when param is explicitly false, eg. required:false | |
1205 | + if ( val === false ) { | |
1206 | + delete rules[ prop ]; | |
1207 | + return; | |
1208 | + } | |
1209 | + if ( val.param || val.depends ) { | |
1210 | + var keepRule = true; | |
1211 | + switch ( typeof val.depends ) { | |
1212 | + case "string": | |
1213 | + keepRule = !!$( val.depends, element.form ).length; | |
1214 | + break; | |
1215 | + case "function": | |
1216 | + keepRule = val.depends.call( element, element ); | |
1217 | + break; | |
1218 | + } | |
1219 | + if ( keepRule ) { | |
1220 | + rules[ prop ] = val.param !== undefined ? val.param : true; | |
1221 | + } else { | |
1222 | + $.data( element.form, "validator" ).resetElements( $( element ) ); | |
1223 | + delete rules[ prop ]; | |
1224 | + } | |
1225 | + } | |
1226 | + } ); | |
1227 | + | |
1228 | + // Evaluate parameters | |
1229 | + $.each( rules, function( rule, parameter ) { | |
1230 | + rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter; | |
1231 | + } ); | |
1232 | + | |
1233 | + // Clean number parameters | |
1234 | + $.each( [ "minlength", "maxlength" ], function() { | |
1235 | + if ( rules[ this ] ) { | |
1236 | + rules[ this ] = Number( rules[ this ] ); | |
1237 | + } | |
1238 | + } ); | |
1239 | + $.each( [ "rangelength", "range" ], function() { | |
1240 | + var parts; | |
1241 | + if ( rules[ this ] ) { | |
1242 | + if ( $.isArray( rules[ this ] ) ) { | |
1243 | + rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ]; | |
1244 | + } else if ( typeof rules[ this ] === "string" ) { | |
1245 | + parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ ); | |
1246 | + rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ]; | |
1247 | + } | |
1248 | + } | |
1249 | + } ); | |
1250 | + | |
1251 | + if ( $.validator.autoCreateRanges ) { | |
1252 | + | |
1253 | + // Auto-create ranges | |
1254 | + if ( rules.min != null && rules.max != null ) { | |
1255 | + rules.range = [ rules.min, rules.max ]; | |
1256 | + delete rules.min; | |
1257 | + delete rules.max; | |
1258 | + } | |
1259 | + if ( rules.minlength != null && rules.maxlength != null ) { | |
1260 | + rules.rangelength = [ rules.minlength, rules.maxlength ]; | |
1261 | + delete rules.minlength; | |
1262 | + delete rules.maxlength; | |
1263 | + } | |
1264 | + } | |
1265 | + | |
1266 | + return rules; | |
1267 | + }, | |
1268 | + | |
1269 | + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} | |
1270 | + normalizeRule: function( data ) { | |
1271 | + if ( typeof data === "string" ) { | |
1272 | + var transformed = {}; | |
1273 | + $.each( data.split( /\s/ ), function() { | |
1274 | + transformed[ this ] = true; | |
1275 | + } ); | |
1276 | + data = transformed; | |
1277 | + } | |
1278 | + return data; | |
1279 | + }, | |
1280 | + | |
1281 | + // http://jqueryvalidation.org/jQuery.validator.addMethod/ | |
1282 | + addMethod: function( name, method, message ) { | |
1283 | + $.validator.methods[ name ] = method; | |
1284 | + $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ]; | |
1285 | + if ( method.length < 3 ) { | |
1286 | + $.validator.addClassRules( name, $.validator.normalizeRule( name ) ); | |
1287 | + } | |
1288 | + }, | |
1289 | + | |
1290 | + // http://jqueryvalidation.org/jQuery.validator.methods/ | |
1291 | + methods: { | |
1292 | + | |
1293 | + // http://jqueryvalidation.org/required-method/ | |
1294 | + required: function( value, element, param ) { | |
1295 | + | |
1296 | + // Check if dependency is met | |
1297 | + if ( !this.depend( param, element ) ) { | |
1298 | + return "dependency-mismatch"; | |
1299 | + } | |
1300 | + if ( element.nodeName.toLowerCase() === "select" ) { | |
1301 | + | |
1302 | + // Could be an array for select-multiple or a string, both are fine this way | |
1303 | + var val = $( element ).val(); | |
1304 | + return val && val.length > 0; | |
1305 | + } | |
1306 | + if ( this.checkable( element ) ) { | |
1307 | + return this.getLength( value, element ) > 0; | |
1308 | + } | |
1309 | + return value.length > 0; | |
1310 | + }, | |
1311 | + | |
1312 | + // http://jqueryvalidation.org/email-method/ | |
1313 | + email: function( value, element ) { | |
1314 | + | |
1315 | + // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address | |
1316 | + // Retrieved 2014-01-14 | |
1317 | + // If you have a problem with this implementation, report a bug against the above spec | |
1318 | + // Or use custom methods to implement your own email validation | |
1319 | + return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value ); | |
1320 | + }, | |
1321 | + | |
1322 | + // http://jqueryvalidation.org/url-method/ | |
1323 | + url: function( value, element ) { | |
1324 | + | |
1325 | + // Copyright (c) 2010-2013 Diego Perini, MIT licensed | |
1326 | + // https://gist.github.com/dperini/729294 | |
1327 | + // see also https://mathiasbynens.be/demo/url-regex | |
1328 | + // modified to allow protocol-relative URLs | |
1329 | + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); | |
1330 | + }, | |
1331 | + | |
1332 | + // http://jqueryvalidation.org/date-method/ | |
1333 | + date: function( value, element ) { | |
1334 | + return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() ); | |
1335 | + }, | |
1336 | + | |
1337 | + // http://jqueryvalidation.org/dateISO-method/ | |
1338 | + dateISO: function( value, element ) { | |
1339 | + return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value ); | |
1340 | + }, | |
1341 | + | |
1342 | + // http://jqueryvalidation.org/number-method/ | |
1343 | + number: function( value, element ) { | |
1344 | + return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value ); | |
1345 | + }, | |
1346 | + | |
1347 | + // http://jqueryvalidation.org/digits-method/ | |
1348 | + digits: function( value, element ) { | |
1349 | + return this.optional( element ) || /^\d+$/.test( value ); | |
1350 | + }, | |
1351 | + | |
1352 | + // http://jqueryvalidation.org/minlength-method/ | |
1353 | + minlength: function( value, element, param ) { | |
1354 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1355 | + return this.optional( element ) || length >= param; | |
1356 | + }, | |
1357 | + | |
1358 | + // http://jqueryvalidation.org/maxlength-method/ | |
1359 | + maxlength: function( value, element, param ) { | |
1360 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1361 | + return this.optional( element ) || length <= param; | |
1362 | + }, | |
1363 | + | |
1364 | + // http://jqueryvalidation.org/rangelength-method/ | |
1365 | + rangelength: function( value, element, param ) { | |
1366 | + var length = $.isArray( value ) ? value.length : this.getLength( value, element ); | |
1367 | + return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] ); | |
1368 | + }, | |
1369 | + | |
1370 | + // http://jqueryvalidation.org/min-method/ | |
1371 | + min: function( value, element, param ) { | |
1372 | + return this.optional( element ) || value >= param; | |
1373 | + }, | |
1374 | + | |
1375 | + // http://jqueryvalidation.org/max-method/ | |
1376 | + max: function( value, element, param ) { | |
1377 | + return this.optional( element ) || value <= param; | |
1378 | + }, | |
1379 | + | |
1380 | + // http://jqueryvalidation.org/range-method/ | |
1381 | + range: function( value, element, param ) { | |
1382 | + return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] ); | |
1383 | + }, | |
1384 | + | |
1385 | + // http://jqueryvalidation.org/step-method/ | |
1386 | + step: function( value, element, param ) { | |
1387 | + var type = $( element ).attr( "type" ), | |
1388 | + errorMessage = "Step attribute on input type " + type + " is not supported.", | |
1389 | + supportedTypes = [ "text", "number", "range" ], | |
1390 | + re = new RegExp( "\\b" + type + "\\b" ), | |
1391 | + notSupported = type && !re.test( supportedTypes.join() ); | |
1392 | + | |
1393 | + // Works only for text, number and range input types | |
1394 | + // TODO find a way to support input types date, datetime, datetime-local, month, time and week | |
1395 | + if ( notSupported ) { | |
1396 | + throw new Error( errorMessage ); | |
1397 | + } | |
1398 | + return this.optional( element ) || ( value % param === 0 ); | |
1399 | + }, | |
1400 | + | |
1401 | + // http://jqueryvalidation.org/equalTo-method/ | |
1402 | + equalTo: function( value, element, param ) { | |
1403 | + | |
1404 | + // Bind to the blur event of the target in order to revalidate whenever the target field is updated | |
1405 | + var target = $( param ); | |
1406 | + if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) { | |
1407 | + target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() { | |
1408 | + $( element ).valid(); | |
1409 | + } ); | |
1410 | + } | |
1411 | + return value === target.val(); | |
1412 | + }, | |
1413 | + | |
1414 | + // http://jqueryvalidation.org/remote-method/ | |
1415 | + remote: function( value, element, param, method ) { | |
1416 | + if ( this.optional( element ) ) { | |
1417 | + return "dependency-mismatch"; | |
1418 | + } | |
1419 | + | |
1420 | + method = typeof method === "string" && method || "remote"; | |
1421 | + | |
1422 | + var previous = this.previousValue( element, method ), | |
1423 | + validator, data, optionDataString; | |
1424 | + | |
1425 | + if ( !this.settings.messages[ element.name ] ) { | |
1426 | + this.settings.messages[ element.name ] = {}; | |
1427 | + } | |
1428 | + previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ]; | |
1429 | + this.settings.messages[ element.name ][ method ] = previous.message; | |
1430 | + | |
1431 | + param = typeof param === "string" && { url: param } || param; | |
1432 | + optionDataString = $.param( $.extend( { data: value }, param.data ) ); | |
1433 | + if ( previous.old === optionDataString ) { | |
1434 | + return previous.valid; | |
1435 | + } | |
1436 | + | |
1437 | + previous.old = optionDataString; | |
1438 | + validator = this; | |
1439 | + this.startRequest( element ); | |
1440 | + data = {}; | |
1441 | + data[ element.name ] = value; | |
1442 | + $.ajax( $.extend( true, { | |
1443 | + mode: "abort", | |
1444 | + port: "validate" + element.name, | |
1445 | + dataType: "json", | |
1446 | + data: data, | |
1447 | + context: validator.currentForm, | |
1448 | + success: function( response ) { | |
1449 | + var valid = response === true || response === "true", | |
1450 | + errors, message, submitted; | |
1451 | + | |
1452 | + validator.settings.messages[ element.name ][ method ] = previous.originalMessage; | |
1453 | + if ( valid ) { | |
1454 | + submitted = validator.formSubmitted; | |
1455 | + validator.resetInternals(); | |
1456 | + validator.toHide = validator.errorsFor( element ); | |
1457 | + validator.formSubmitted = submitted; | |
1458 | + validator.successList.push( element ); | |
1459 | + validator.invalid[ element.name ] = false; | |
1460 | + validator.showErrors(); | |
1461 | + } else { | |
1462 | + errors = {}; | |
1463 | + message = response || validator.defaultMessage( element, { method: method, parameters: value } ); | |
1464 | + errors[ element.name ] = previous.message = message; | |
1465 | + validator.invalid[ element.name ] = true; | |
1466 | + validator.showErrors( errors ); | |
1467 | + } | |
1468 | + previous.valid = valid; | |
1469 | + validator.stopRequest( element, valid ); | |
1470 | + } | |
1471 | + }, param ) ); | |
1472 | + return "pending"; | |
1473 | + } | |
1474 | + } | |
1475 | + | |
1476 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ar.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: AR (Arabic; العربية) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "هذا الحقل إلزامي", | |
7 | + remote: "يرجى تصحيح هذا الحقل للمتابعة", | |
8 | + email: "رجاء إدخال عنوان بريد إلكتروني صحيح", | |
9 | + url: "رجاء إدخال عنوان موقع إلكتروني صحيح", | |
10 | + date: "رجاء إدخال تاريخ صحيح", | |
11 | + dateISO: "رجاء إدخال تاريخ صحيح (ISO)", | |
12 | + number: "رجاء إدخال عدد بطريقة صحيحة", | |
13 | + digits: "رجاء إدخال أرقام فقط", | |
14 | + creditcard: "رجاء إدخال رقم بطاقة ائتمان صحيح", | |
15 | + equalTo: "رجاء إدخال نفس القيمة", | |
16 | + extension: "رجاء إدخال ملف بامتداد موافق عليه", | |
17 | + maxlength: $.validator.format( "الحد الأقصى لعدد الحروف هو {0}" ), | |
18 | + minlength: $.validator.format( "الحد الأدنى لعدد الحروف هو {0}" ), | |
19 | + rangelength: $.validator.format( "عدد الحروف يجب أن يكون بين {0} و {1}" ), | |
20 | + range: $.validator.format( "رجاء إدخال عدد قيمته بين {0} و {1}" ), | |
21 | + max: $.validator.format( "رجاء إدخال عدد أقل من أو يساوي (0}" ), | |
22 | + min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي (0}" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_bg.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: BG (Bulgarian; български език) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Полето е задължително.", | |
7 | + remote: "Моля, въведете правилната стойност.", | |
8 | + email: "Моля, въведете валиден email.", | |
9 | + url: "Моля, въведете валидно URL.", | |
10 | + date: "Моля, въведете валидна дата.", | |
11 | + dateISO: "Моля, въведете валидна дата (ISO).", | |
12 | + number: "Моля, въведете валиден номер.", | |
13 | + digits: "Моля, въведете само цифри.", | |
14 | + creditcard: "Моля, въведете валиден номер на кредитна карта.", | |
15 | + equalTo: "Моля, въведете същата стойност отново.", | |
16 | + extension: "Моля, въведете стойност с валидно разширение.", | |
17 | + maxlength: $.validator.format( "Моля, въведете повече от {0} символа." ), | |
18 | + minlength: $.validator.format( "Моля, въведете поне {0} символа." ), | |
19 | + rangelength: $.validator.format( "Моля, въведете стойност с дължина между {0} и {1} символа." ), | |
20 | + range: $.validator.format( "Моля, въведете стойност между {0} и {1}." ), | |
21 | + max: $.validator.format( "Моля, въведете стойност по-малка или равна на {0}." ), | |
22 | + min: $.validator.format( "Моля, въведете стойност по-голяма или равна на {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_bn_BD.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: bn_BD (Bengali, Bangladesh) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "এই তথ্যটি আবশ্যক।", | |
7 | + remote: "এই তথ্যটি ঠিক করুন।", | |
8 | + email: "অনুগ্রহ করে একটি সঠিক মেইল ঠিকানা লিখুন।", | |
9 | + url: "অনুগ্রহ করে একটি সঠিক লিঙ্ক দিন।", | |
10 | + date: "তারিখ সঠিক নয়।", | |
11 | + dateISO: "অনুগ্রহ করে একটি সঠিক (ISO) তারিখ লিখুন।", | |
12 | + number: "অনুগ্রহ করে একটি সঠিক নম্বর লিখুন।", | |
13 | + digits: "এখানে শুধু সংখ্যা ব্যবহার করা যাবে।", | |
14 | + creditcard: "অনুগ্রহ করে একটি ক্রেডিট কার্ডের সঠিক নম্বর লিখুন।", | |
15 | + equalTo: "একই মান আবার লিখুন।", | |
16 | + extension: "সঠিক ধরনের ফাইল আপলোড করুন।", | |
17 | + maxlength: $.validator.format( "{0}টির বেশি অক্ষর লেখা যাবে না।" ), | |
18 | + minlength: $.validator.format( "{0}টির কম অক্ষর লেখা যাবে না।" ), | |
19 | + rangelength: $.validator.format( "{0} থেকে {1} টি অক্ষর সম্বলিত মান লিখুন।" ), | |
20 | + range: $.validator.format( "{0} থেকে {1} এর মধ্যে একটি মান ব্যবহার করুন।" ), | |
21 | + max: $.validator.format( "অনুগ্রহ করে {0} বা তার চাইতে কম মান ব্যবহার করুন।" ), | |
22 | + min: $.validator.format( "অনুগ্রহ করে {0} বা তার চাইতে বেশি মান ব্যবহার করুন।" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ca.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: CA (Catalan; català) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Aquest camp és obligatori.", | |
7 | + remote: "Si us plau, omple aquest camp.", | |
8 | + email: "Si us plau, escriu una adreça de correu-e vàlida", | |
9 | + url: "Si us plau, escriu una URL vàlida.", | |
10 | + date: "Si us plau, escriu una data vàlida.", | |
11 | + dateISO: "Si us plau, escriu una data (ISO) vàlida.", | |
12 | + number: "Si us plau, escriu un número enter vàlid.", | |
13 | + digits: "Si us plau, escriu només dígits.", | |
14 | + creditcard: "Si us plau, escriu un número de tarjeta vàlid.", | |
15 | + equalTo: "Si us plau, escriu el mateix valor de nou.", | |
16 | + extension: "Si us plau, escriu un valor amb una extensió acceptada.", | |
17 | + maxlength: $.validator.format( "Si us plau, no escriguis més de {0} caracters." ), | |
18 | + minlength: $.validator.format( "Si us plau, no escriguis menys de {0} caracters." ), | |
19 | + rangelength: $.validator.format( "Si us plau, escriu un valor entre {0} i {1} caracters." ), | |
20 | + range: $.validator.format( "Si us plau, escriu un valor entre {0} i {1}." ), | |
21 | + max: $.validator.format( "Si us plau, escriu un valor menor o igual a {0}." ), | |
22 | + min: $.validator.format( "Si us plau, escriu un valor major o igual a {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_cs.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: CS (Czech; čeština, český jazyk) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Tento údaj je povinný.", | |
7 | + remote: "Prosím, opravte tento údaj.", | |
8 | + email: "Prosím, zadejte platný e-mail.", | |
9 | + url: "Prosím, zadejte platné URL.", | |
10 | + date: "Prosím, zadejte platné datum.", | |
11 | + dateISO: "Prosím, zadejte platné datum (ISO).", | |
12 | + number: "Prosím, zadejte číslo.", | |
13 | + digits: "Prosím, zadávejte pouze číslice.", | |
14 | + creditcard: "Prosím, zadejte číslo kreditní karty.", | |
15 | + equalTo: "Prosím, zadejte znovu stejnou hodnotu.", | |
16 | + extension: "Prosím, zadejte soubor se správnou příponou.", | |
17 | + maxlength: $.validator.format( "Prosím, zadejte nejvíce {0} znaků." ), | |
18 | + minlength: $.validator.format( "Prosím, zadejte nejméně {0} znaků." ), | |
19 | + rangelength: $.validator.format( "Prosím, zadejte od {0} do {1} znaků." ), | |
20 | + range: $.validator.format( "Prosím, zadejte hodnotu od {0} do {1}." ), | |
21 | + max: $.validator.format( "Prosím, zadejte hodnotu menší nebo rovnu {0}." ), | |
22 | + min: $.validator.format( "Prosím, zadejte hodnotu větší nebo rovnu {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_da.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: DA (Danish; dansk) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Dette felt er påkrævet.", | |
7 | + maxlength: $.validator.format( "Indtast højst {0} tegn." ), | |
8 | + minlength: $.validator.format( "Indtast mindst {0} tegn." ), | |
9 | + rangelength: $.validator.format( "Indtast mindst {0} og højst {1} tegn." ), | |
10 | + email: "Indtast en gyldig email-adresse.", | |
11 | + url: "Indtast en gyldig URL.", | |
12 | + date: "Indtast en gyldig dato.", | |
13 | + number: "Indtast et tal.", | |
14 | + digits: "Indtast kun cifre.", | |
15 | + equalTo: "Indtast den samme værdi igen.", | |
16 | + range: $.validator.format( "Angiv en værdi mellem {0} og {1}." ), | |
17 | + max: $.validator.format( "Angiv en værdi der højst er {0}." ), | |
18 | + min: $.validator.format( "Angiv en værdi der mindst er {0}." ), | |
19 | + creditcard: "Indtast et gyldigt kreditkortnummer." | |
20 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_de.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: DE (German, Deutsch) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Dieses Feld ist ein Pflichtfeld.", | |
7 | + maxlength: $.validator.format( "Geben Sie bitte maximal {0} Zeichen ein." ), | |
8 | + minlength: $.validator.format( "Geben Sie bitte mindestens {0} Zeichen ein." ), | |
9 | + rangelength: $.validator.format( "Geben Sie bitte mindestens {0} und maximal {1} Zeichen ein." ), | |
10 | + email: "Geben Sie bitte eine gültige E-Mail Adresse ein.", | |
11 | + url: "Geben Sie bitte eine gültige URL ein.", | |
12 | + date: "Bitte geben Sie ein gültiges Datum ein.", | |
13 | + number: "Geben Sie bitte eine Nummer ein.", | |
14 | + digits: "Geben Sie bitte nur Ziffern ein.", | |
15 | + equalTo: "Bitte denselben Wert wiederholen.", | |
16 | + range: $.validator.format( "Geben Sie bitte einen Wert zwischen {0} und {1} ein." ), | |
17 | + max: $.validator.format( "Geben Sie bitte einen Wert kleiner oder gleich {0} ein." ), | |
18 | + min: $.validator.format( "Geben Sie bitte einen Wert größer oder gleich {0} ein." ), | |
19 | + creditcard: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein." | |
20 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_el.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: EL (Greek; ελληνικά) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Αυτό το πεδίο είναι υποχρεωτικό.", | |
7 | + remote: "Παρακαλώ διορθώστε αυτό το πεδίο.", | |
8 | + email: "Παρακαλώ εισάγετε μια έγκυρη διεύθυνση email.", | |
9 | + url: "Παρακαλώ εισάγετε ένα έγκυρο URL.", | |
10 | + date: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία.", | |
11 | + dateISO: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία (ISO).", | |
12 | + number: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό.", | |
13 | + digits: "Παρακαλώ εισάγετε μόνο αριθμητικά ψηφία.", | |
14 | + creditcard: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό πιστωτικής κάρτας.", | |
15 | + equalTo: "Παρακαλώ εισάγετε την ίδια τιμή ξανά.", | |
16 | + extension: "Παρακαλώ εισάγετε μια τιμή με έγκυρη επέκταση αρχείου.", | |
17 | + maxlength: $.validator.format( "Παρακαλώ εισάγετε μέχρι και {0} χαρακτήρες." ), | |
18 | + minlength: $.validator.format( "Παρακαλώ εισάγετε τουλάχιστον {0} χαρακτήρες." ), | |
19 | + rangelength: $.validator.format( "Παρακαλώ εισάγετε μια τιμή με μήκος μεταξύ {0} και {1} χαρακτήρων." ), | |
20 | + range: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μεταξύ {0} και {1}." ), | |
21 | + max: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μικρότερη ή ίση του {0}." ), | |
22 | + min: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μεγαλύτερη ή ίση του {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_es.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: ES (Spanish; Español) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Este campo es obligatorio.", | |
7 | + remote: "Por favor, rellena este campo.", | |
8 | + email: "Por favor, escribe una dirección de correo válida.", | |
9 | + url: "Por favor, escribe una URL válida.", | |
10 | + date: "Por favor, escribe una fecha válida.", | |
11 | + dateISO: "Por favor, escribe una fecha (ISO) válida.", | |
12 | + number: "Por favor, escribe un número válido.", | |
13 | + digits: "Por favor, escribe sólo dígitos.", | |
14 | + creditcard: "Por favor, escribe un número de tarjeta válido.", | |
15 | + equalTo: "Por favor, escribe el mismo valor de nuevo.", | |
16 | + extension: "Por favor, escribe un valor con una extensión aceptada.", | |
17 | + maxlength: $.validator.format( "Por favor, no escribas más de {0} caracteres." ), | |
18 | + minlength: $.validator.format( "Por favor, no escribas menos de {0} caracteres." ), | |
19 | + rangelength: $.validator.format( "Por favor, escribe un valor entre {0} y {1} caracteres." ), | |
20 | + range: $.validator.format( "Por favor, escribe un valor entre {0} y {1}." ), | |
21 | + max: $.validator.format( "Por favor, escribe un valor menor o igual a {0}." ), | |
22 | + min: $.validator.format( "Por favor, escribe un valor mayor o igual a {0}." ), | |
23 | + nifES: "Por favor, escribe un NIF válido.", | |
24 | + nieES: "Por favor, escribe un NIE válido.", | |
25 | + cifES: "Por favor, escribe un CIF válido." | |
26 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_es_AR.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: ES (Spanish; Español) | |
4 | + * Region: AR (Argentina) | |
5 | + */ | |
6 | +$.extend( $.validator.messages, { | |
7 | + required: "Este campo es obligatorio.", | |
8 | + remote: "Por favor, completá este campo.", | |
9 | + email: "Por favor, escribí una dirección de correo válida.", | |
10 | + url: "Por favor, escribí una URL válida.", | |
11 | + date: "Por favor, escribí una fecha válida.", | |
12 | + dateISO: "Por favor, escribí una fecha (ISO) válida.", | |
13 | + number: "Por favor, escribí un número entero válido.", | |
14 | + digits: "Por favor, escribí sólo dígitos.", | |
15 | + creditcard: "Por favor, escribí un número de tarjeta válido.", | |
16 | + equalTo: "Por favor, escribí el mismo valor de nuevo.", | |
17 | + extension: "Por favor, escribí un valor con una extensión aceptada.", | |
18 | + maxlength: $.validator.format( "Por favor, no escribas más de {0} caracteres." ), | |
19 | + minlength: $.validator.format( "Por favor, no escribas menos de {0} caracteres." ), | |
20 | + rangelength: $.validator.format( "Por favor, escribí un valor entre {0} y {1} caracteres." ), | |
21 | + range: $.validator.format( "Por favor, escribí un valor entre {0} y {1}." ), | |
22 | + max: $.validator.format( "Por favor, escribí un valor menor o igual a {0}." ), | |
23 | + min: $.validator.format( "Por favor, escribí un valor mayor o igual a {0}." ), | |
24 | + nifES: "Por favor, escribí un NIF válido.", | |
25 | + nieES: "Por favor, escribí un NIE válido.", | |
26 | + cifES: "Por favor, escribí un CIF válido." | |
27 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_es_PE.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: ES (Spanish; Español) | |
4 | + * Region: PE (Perú) | |
5 | + */ | |
6 | +$.extend( $.validator.messages, { | |
7 | + required: "Este campo es obligatorio.", | |
8 | + remote: "Por favor, llene este campo.", | |
9 | + email: "Por favor, escriba un correo electrónico válido.", | |
10 | + url: "Por favor, escriba una URL válida.", | |
11 | + date: "Por favor, escriba una fecha válida.", | |
12 | + dateISO: "Por favor, escriba una fecha (ISO) válida.", | |
13 | + number: "Por favor, escriba un número válido.", | |
14 | + digits: "Por favor, escriba sólo dígitos.", | |
15 | + creditcard: "Por favor, escriba un número de tarjeta válido.", | |
16 | + equalTo: "Por favor, escriba el mismo valor de nuevo.", | |
17 | + extension: "Por favor, escriba un valor con una extensión permitida.", | |
18 | + maxlength: $.validator.format( "Por favor, no escriba más de {0} caracteres." ), | |
19 | + minlength: $.validator.format( "Por favor, no escriba menos de {0} caracteres." ), | |
20 | + rangelength: $.validator.format( "Por favor, escriba un valor entre {0} y {1} caracteres." ), | |
21 | + range: $.validator.format( "Por favor, escriba un valor entre {0} y {1}." ), | |
22 | + max: $.validator.format( "Por favor, escriba un valor menor o igual a {0}." ), | |
23 | + min: $.validator.format( "Por favor, escriba un valor mayor o igual a {0}." ), | |
24 | + nifES: "Por favor, escriba un NIF válido.", | |
25 | + nieES: "Por favor, escriba un NIE válido.", | |
26 | + cifES: "Por favor, escriba un CIF válido." | |
27 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_et.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: ET (Estonian; eesti, eesti keel) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "See väli peab olema täidetud.", | |
7 | + maxlength: $.validator.format( "Palun sisestage vähem kui {0} tähemärki." ), | |
8 | + minlength: $.validator.format( "Palun sisestage vähemalt {0} tähemärki." ), | |
9 | + rangelength: $.validator.format( "Palun sisestage väärtus vahemikus {0} kuni {1} tähemärki." ), | |
10 | + email: "Palun sisestage korrektne e-maili aadress.", | |
11 | + url: "Palun sisestage korrektne URL.", | |
12 | + date: "Palun sisestage korrektne kuupäev.", | |
13 | + dateISO: "Palun sisestage korrektne kuupäev (YYYY-MM-DD).", | |
14 | + number: "Palun sisestage korrektne number.", | |
15 | + digits: "Palun sisestage ainult numbreid.", | |
16 | + equalTo: "Palun sisestage sama väärtus uuesti.", | |
17 | + range: $.validator.format( "Palun sisestage väärtus vahemikus {0} kuni {1}." ), | |
18 | + max: $.validator.format( "Palun sisestage väärtus, mis on väiksem või võrdne arvuga {0}." ), | |
19 | + min: $.validator.format( "Palun sisestage väärtus, mis on suurem või võrdne arvuga {0}." ), | |
20 | + creditcard: "Palun sisestage korrektne krediitkaardi number." | |
21 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_eu.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: EU (Basque; euskara, euskera) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Eremu hau beharrezkoa da.", | |
7 | + remote: "Mesedez, bete eremu hau.", | |
8 | + email: "Mesedez, idatzi baliozko posta helbide bat.", | |
9 | + url: "Mesedez, idatzi baliozko URL bat.", | |
10 | + date: "Mesedez, idatzi baliozko data bat.", | |
11 | + dateISO: "Mesedez, idatzi baliozko (ISO) data bat.", | |
12 | + number: "Mesedez, idatzi baliozko zenbaki oso bat.", | |
13 | + digits: "Mesedez, idatzi digituak soilik.", | |
14 | + creditcard: "Mesedez, idatzi baliozko txartel zenbaki bat.", | |
15 | + equalTo: "Mesedez, idatzi berdina berriro ere.", | |
16 | + extension: "Mesedez, idatzi onartutako luzapena duen balio bat.", | |
17 | + maxlength: $.validator.format( "Mesedez, ez idatzi {0} karaktere baino gehiago." ), | |
18 | + minlength: $.validator.format( "Mesedez, ez idatzi {0} karaktere baino gutxiago." ), | |
19 | + rangelength: $.validator.format( "Mesedez, idatzi {0} eta {1} karaktere arteko balio bat." ), | |
20 | + range: $.validator.format( "Mesedez, idatzi {0} eta {1} arteko balio bat." ), | |
21 | + max: $.validator.format( "Mesedez, idatzi {0} edo txikiagoa den balio bat." ), | |
22 | + min: $.validator.format( "Mesedez, idatzi {0} edo handiagoa den balio bat." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_fa.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: FA (Persian; فارسی) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "تکمیل این فیلد اجباری است.", | |
7 | + remote: "لطفا این فیلد را تصحیح کنید.", | |
8 | + email: ".لطفا یک ایمیل صحیح وارد کنید", | |
9 | + url: "لطفا آدرس صحیح وارد کنید.", | |
10 | + date: "لطفا یک تاریخ صحیح وارد کنید", | |
11 | + dateFA: "لطفا یک تاریخ صحیح وارد کنید", | |
12 | + dateISO: "لطفا تاریخ صحیح وارد کنید (ISO).", | |
13 | + number: "لطفا عدد صحیح وارد کنید.", | |
14 | + digits: "لطفا تنها رقم وارد کنید", | |
15 | + creditcard: "لطفا کریدیت کارت صحیح وارد کنید.", | |
16 | + equalTo: "لطفا مقدار برابری وارد کنید", | |
17 | + extension: "لطفا مقداری وارد کنید که ", | |
18 | + maxlength: $.validator.format( "لطفا بیشتر از {0} حرف وارد نکنید." ), | |
19 | + minlength: $.validator.format( "لطفا کمتر از {0} حرف وارد نکنید." ), | |
20 | + rangelength: $.validator.format( "لطفا مقداری بین {0} تا {1} حرف وارد کنید." ), | |
21 | + range: $.validator.format( "لطفا مقداری بین {0} تا {1} حرف وارد کنید." ), | |
22 | + max: $.validator.format( "لطفا مقداری کمتر از {0} وارد کنید." ), | |
23 | + min: $.validator.format( "لطفا مقداری بیشتر از {0} وارد کنید." ), | |
24 | + minWords: $.validator.format( "لطفا حداقل {0} کلمه وارد کنید." ), | |
25 | + maxWords: $.validator.format( "لطفا حداکثر {0} کلمه وارد کنید." ) | |
26 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_fi.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: FI (Finnish; suomi, suomen kieli) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Tämä kenttä on pakollinen.", | |
7 | + email: "Syötä oikea sähköpostiosoite.", | |
8 | + url: "Syötä oikea URL-osoite.", | |
9 | + date: "Syötä oikea päivämäärä.", | |
10 | + dateISO: "Syötä oikea päivämäärä muodossa VVVV-KK-PP.", | |
11 | + number: "Syötä luku.", | |
12 | + creditcard: "Syötä voimassa oleva luottokorttinumero.", | |
13 | + digits: "Syötä pelkästään numeroita.", | |
14 | + equalTo: "Syötä sama arvo uudestaan.", | |
15 | + maxlength: $.validator.format( "Voit syöttää enintään {0} merkkiä." ), | |
16 | + minlength: $.validator.format( "Vähintään {0} merkkiä." ), | |
17 | + rangelength: $.validator.format( "Syötä vähintään {0} ja enintään {1} merkkiä." ), | |
18 | + range: $.validator.format( "Syötä arvo väliltä {0}–{1}." ), | |
19 | + max: $.validator.format( "Syötä arvo, joka on enintään {0}." ), | |
20 | + min: $.validator.format( "Syötä arvo, joka on vähintään {0}." ) | |
21 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_fr.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: FR (French; français) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Ce champ est obligatoire.", | |
7 | + remote: "Veuillez corriger ce champ.", | |
8 | + email: "Veuillez fournir une adresse électronique valide.", | |
9 | + url: "Veuillez fournir une adresse URL valide.", | |
10 | + date: "Veuillez fournir une date valide.", | |
11 | + dateISO: "Veuillez fournir une date valide (ISO).", | |
12 | + number: "Veuillez fournir un numéro valide.", | |
13 | + digits: "Veuillez fournir seulement des chiffres.", | |
14 | + creditcard: "Veuillez fournir un numéro de carte de crédit valide.", | |
15 | + equalTo: "Veuillez fournir encore la même valeur.", | |
16 | + extension: "Veuillez fournir une valeur avec une extension valide.", | |
17 | + maxlength: $.validator.format( "Veuillez fournir au plus {0} caractères." ), | |
18 | + minlength: $.validator.format( "Veuillez fournir au moins {0} caractères." ), | |
19 | + rangelength: $.validator.format( "Veuillez fournir une valeur qui contient entre {0} et {1} caractères." ), | |
20 | + range: $.validator.format( "Veuillez fournir une valeur entre {0} et {1}." ), | |
21 | + max: $.validator.format( "Veuillez fournir une valeur inférieure ou égale à {0}." ), | |
22 | + min: $.validator.format( "Veuillez fournir une valeur supérieure ou égale à {0}." ), | |
23 | + maxWords: $.validator.format( "Veuillez fournir au plus {0} mots." ), | |
24 | + minWords: $.validator.format( "Veuillez fournir au moins {0} mots." ), | |
25 | + rangeWords: $.validator.format( "Veuillez fournir entre {0} et {1} mots." ), | |
26 | + letterswithbasicpunc: "Veuillez fournir seulement des lettres et des signes de ponctuation.", | |
27 | + alphanumeric: "Veuillez fournir seulement des lettres, nombres, espaces et soulignages.", | |
28 | + lettersonly: "Veuillez fournir seulement des lettres.", | |
29 | + nowhitespace: "Veuillez ne pas inscrire d'espaces blancs.", | |
30 | + ziprange: "Veuillez fournir un code postal entre 902xx-xxxx et 905-xx-xxxx.", | |
31 | + integer: "Veuillez fournir un nombre non décimal qui est positif ou négatif.", | |
32 | + vinUS: "Veuillez fournir un numéro d'identification du véhicule (VIN).", | |
33 | + dateITA: "Veuillez fournir une date valide.", | |
34 | + time: "Veuillez fournir une heure valide entre 00:00 et 23:59.", | |
35 | + phoneUS: "Veuillez fournir un numéro de téléphone valide.", | |
36 | + phoneUK: "Veuillez fournir un numéro de téléphone valide.", | |
37 | + mobileUK: "Veuillez fournir un numéro de téléphone mobile valide.", | |
38 | + strippedminlength: $.validator.format( "Veuillez fournir au moins {0} caractères." ), | |
39 | + email2: "Veuillez fournir une adresse électronique valide.", | |
40 | + url2: "Veuillez fournir une adresse URL valide.", | |
41 | + creditcardtypes: "Veuillez fournir un numéro de carte de crédit valide.", | |
42 | + ipv4: "Veuillez fournir une adresse IP v4 valide.", | |
43 | + ipv6: "Veuillez fournir une adresse IP v6 valide.", | |
44 | + require_from_group: "Veuillez fournir au moins {0} de ces champs.", | |
45 | + nifES: "Veuillez fournir un numéro NIF valide.", | |
46 | + nieES: "Veuillez fournir un numéro NIE valide.", | |
47 | + cifES: "Veuillez fournir un numéro CIF valide.", | |
48 | + postalCodeCA: "Veuillez fournir un code postal valide." | |
49 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ge.js
0 → 100644
1 | +/** | |
2 | + * @author @tatocaster <kutaliatato@gmail.com> | |
3 | + * Translated default messages for the jQuery validation plugin. | |
4 | + * Locale: GE (Georgian; ქართული) | |
5 | + */ | |
6 | +$.extend( $.validator.messages, { | |
7 | + required: "ეს ველი სავალდებულოა", | |
8 | + remote: "გთხოვთ შეასწოროთ.", | |
9 | + email: "გთხოვთ შეიყვანოთ სწორი ფორმატით.", | |
10 | + url: "გთხოვთ შეიყვანოთ სწორი ფორმატით.", | |
11 | + date: "გთხოვთ შეიყვანოთ სწორი თარიღი.", | |
12 | + dateISO: "გთხოვთ შეიყვანოთ სწორი ფორმატით ( ISO ).", | |
13 | + number: "გთხოვთ შეიყვანოთ რიცხვი.", | |
14 | + digits: "დაშვებულია მხოლოდ ციფრები.", | |
15 | + creditcard: "გთხოვთ შეიყვანოთ სწორი ფორმატის ბარათის კოდი.", | |
16 | + equalTo: "გთხოვთ შეიყვანოთ იგივე მნიშვნელობა.", | |
17 | + maxlength: $.validator.format( "გთხოვთ შეიყვანოთ არა უმეტეს {0} სიმბოლოსი." ), | |
18 | + minlength: $.validator.format( "შეიყვანეთ მინიმუმ {0} სიმბოლო." ), | |
19 | + rangelength: $.validator.format( "გთხოვთ შეიყვანოთ {0} -დან {1} -მდე რაოდენობის სიმბოლოები." ), | |
20 | + range: $.validator.format( "შეიყვანეთ {0} -სა {1} -ს შორის." ), | |
21 | + max: $.validator.format( "გთხოვთ შეიყვანოთ მნიშვნელობა ნაკლები ან ტოლი {0} -ს." ), | |
22 | + min: $.validator.format( "გთხოვთ შეიყვანოთ მნიშვნელობა მეტი ან ტოლი {0} -ს." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_gl.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: GL (Galician; Galego) | |
4 | + */ | |
5 | +( function( $ ) { | |
6 | + $.extend( $.validator.messages, { | |
7 | + required: "Este campo é obrigatorio.", | |
8 | + remote: "Por favor, cubre este campo.", | |
9 | + email: "Por favor, escribe unha dirección de correo válida.", | |
10 | + url: "Por favor, escribe unha URL válida.", | |
11 | + date: "Por favor, escribe unha data válida.", | |
12 | + dateISO: "Por favor, escribe unha data (ISO) válida.", | |
13 | + number: "Por favor, escribe un número válido.", | |
14 | + digits: "Por favor, escribe só díxitos.", | |
15 | + creditcard: "Por favor, escribe un número de tarxeta válido.", | |
16 | + equalTo: "Por favor, escribe o mesmo valor de novo.", | |
17 | + extension: "Por favor, escribe un valor cunha extensión aceptada.", | |
18 | + maxlength: $.validator.format( "Por favor, non escribas máis de {0} caracteres." ), | |
19 | + minlength: $.validator.format( "Por favor, non escribas menos de {0} caracteres." ), | |
20 | + rangelength: $.validator.format( "Por favor, escribe un valor entre {0} e {1} caracteres." ), | |
21 | + range: $.validator.format( "Por favor, escribe un valor entre {0} e {1}." ), | |
22 | + max: $.validator.format( "Por favor, escribe un valor menor ou igual a {0}." ), | |
23 | + min: $.validator.format( "Por favor, escribe un valor maior ou igual a {0}." ), | |
24 | + nifES: "Por favor, escribe un NIF válido.", | |
25 | + nieES: "Por favor, escribe un NIE válido.", | |
26 | + cifES: "Por favor, escribe un CIF válido." | |
27 | + } ); | |
28 | +}( jQuery ) ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_he.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: HE (Hebrew; עברית) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "השדה הזה הינו שדה חובה", | |
7 | + remote: "נא לתקן שדה זה", | |
8 | + email: "נא למלא כתובת דוא\"ל חוקית", | |
9 | + url: "נא למלא כתובת אינטרנט חוקית", | |
10 | + date: "נא למלא תאריך חוקי", | |
11 | + dateISO: "נא למלא תאריך חוקי (ISO)", | |
12 | + number: "נא למלא מספר", | |
13 | + digits: "נא למלא רק מספרים", | |
14 | + creditcard: "נא למלא מספר כרטיס אשראי חוקי", | |
15 | + equalTo: "נא למלא את אותו ערך שוב", | |
16 | + extension: "נא למלא ערך עם סיומת חוקית", | |
17 | + maxlength: $.validator.format( ".נא לא למלא יותר מ- {0} תווים" ), | |
18 | + minlength: $.validator.format( "נא למלא לפחות {0} תווים" ), | |
19 | + rangelength: $.validator.format( "נא למלא ערך בין {0} ל- {1} תווים" ), | |
20 | + range: $.validator.format( "נא למלא ערך בין {0} ל- {1}" ), | |
21 | + max: $.validator.format( "נא למלא ערך קטן או שווה ל- {0}" ), | |
22 | + min: $.validator.format( "נא למלא ערך גדול או שווה ל- {0}" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_hr.js
0 → 100755
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: HR (Croatia; hrvatski jezik) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Ovo polje je obavezno.", | |
7 | + remote: "Ovo polje treba popraviti.", | |
8 | + email: "Unesite ispravnu e-mail adresu.", | |
9 | + url: "Unesite ispravan URL.", | |
10 | + date: "Unesite ispravan datum.", | |
11 | + dateISO: "Unesite ispravan datum (ISO).", | |
12 | + number: "Unesite ispravan broj.", | |
13 | + digits: "Unesite samo brojeve.", | |
14 | + creditcard: "Unesite ispravan broj kreditne kartice.", | |
15 | + equalTo: "Unesite ponovo istu vrijednost.", | |
16 | + extension: "Unesite vrijednost sa ispravnom ekstenzijom.", | |
17 | + maxlength: $.validator.format( "Maksimalni broj znakova je {0} ." ), | |
18 | + minlength: $.validator.format( "Minimalni broj znakova je {0} ." ), | |
19 | + rangelength: $.validator.format( "Unesite vrijednost između {0} i {1} znakova." ), | |
20 | + range: $.validator.format( "Unesite vrijednost između {0} i {1}." ), | |
21 | + max: $.validator.format( "Unesite vrijednost manju ili jednaku {0}." ), | |
22 | + min: $.validator.format( "Unesite vrijednost veću ili jednaku {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_hu.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: HU (Hungarian; Magyar) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Kötelező megadni.", | |
7 | + maxlength: $.validator.format( "Legfeljebb {0} karakter hosszú legyen." ), | |
8 | + minlength: $.validator.format( "Legalább {0} karakter hosszú legyen." ), | |
9 | + rangelength: $.validator.format( "Legalább {0} és legfeljebb {1} karakter hosszú legyen." ), | |
10 | + email: "Érvényes e-mail címnek kell lennie.", | |
11 | + url: "Érvényes URL-nek kell lennie.", | |
12 | + date: "Dátumnak kell lennie.", | |
13 | + number: "Számnak kell lennie.", | |
14 | + digits: "Csak számjegyek lehetnek.", | |
15 | + equalTo: "Meg kell egyeznie a két értéknek.", | |
16 | + range: $.validator.format( "{0} és {1} közé kell esnie." ), | |
17 | + max: $.validator.format( "Nem lehet nagyobb, mint {0}." ), | |
18 | + min: $.validator.format( "Nem lehet kisebb, mint {0}." ), | |
19 | + creditcard: "Érvényes hitelkártyaszámnak kell lennie.", | |
20 | + remote: "Kérem javítsa ki ezt a mezőt.", | |
21 | + dateISO: "Kérem írjon be egy érvényes dátumot (ISO)." | |
22 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_hy_AM.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: HY_AM (Armenian; հայերեն լեզու) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Պարտադիր լրացման դաշտ", | |
7 | + remote: "Ներմուծեք ճիշտ արժեքը", | |
8 | + email: "Ներմուծեք վավեր էլեկտրոնային փոստի հասցե", | |
9 | + url: "Ներմուծեք վավեր URL", | |
10 | + date: "Ներմուծեք վավեր ամսաթիվ", | |
11 | + dateISO: "Ներմուծեք ISO ֆորմատով վավեր ամսաթիվ։", | |
12 | + number: "Ներմուծեք թիվ", | |
13 | + digits: "Ներմուծեք միայն թվեր", | |
14 | + creditcard: "Ներմուծեք ճիշտ բանկային քարտի համար", | |
15 | + equalTo: "Ներմուծեք միևնուն արժեքը ևս մեկ անգամ", | |
16 | + extension: "Ընտրեք ճիշտ ընդլանումով ֆայլ", | |
17 | + maxlength: $.validator.format( "Ներմուծեք ոչ ավել քան {0} նիշ" ), | |
18 | + minlength: $.validator.format( "Ներմուծեք ոչ պակաս քան {0} նիշ" ), | |
19 | + rangelength: $.validator.format( "Ներմուծեք {0}֊ից {1} երկարությամբ արժեք" ), | |
20 | + range: $.validator.format( "Ներմուծեք թիվ {0}֊ից {1} միջակայքում" ), | |
21 | + max: $.validator.format( "Ներմուծեք թիվ, որը փոքր կամ հավասար է {0}֊ին" ), | |
22 | + min: $.validator.format( "Ներմուծեք թիվ, որը մեծ կամ հավասար է {0}֊ին" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_id.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: ID (Indonesia; Indonesian) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Kolom ini diperlukan.", | |
7 | + remote: "Harap benarkan kolom ini.", | |
8 | + email: "Silakan masukkan format email yang benar.", | |
9 | + url: "Silakan masukkan format URL yang benar.", | |
10 | + date: "Silakan masukkan format tanggal yang benar.", | |
11 | + dateISO: "Silakan masukkan format tanggal(ISO) yang benar.", | |
12 | + number: "Silakan masukkan angka yang benar.", | |
13 | + digits: "Harap masukan angka saja.", | |
14 | + creditcard: "Harap masukkan format kartu kredit yang benar.", | |
15 | + equalTo: "Harap masukkan nilai yg sama dengan sebelumnya.", | |
16 | + maxlength: $.validator.format( "Input dibatasi hanya {0} karakter." ), | |
17 | + minlength: $.validator.format( "Input tidak kurang dari {0} karakter." ), | |
18 | + rangelength: $.validator.format( "Panjang karakter yg diizinkan antara {0} dan {1} karakter." ), | |
19 | + range: $.validator.format( "Harap masukkan nilai antara {0} dan {1}." ), | |
20 | + max: $.validator.format( "Harap masukkan nilai lebih kecil atau sama dengan {0}." ), | |
21 | + min: $.validator.format( "Harap masukkan nilai lebih besar atau sama dengan {0}." ) | |
22 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_is.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: IS (Icelandic; íslenska) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Þessi reitur er nauðsynlegur.", | |
7 | + remote: "Lagaðu þennan reit.", | |
8 | + maxlength: $.validator.format( "Sláðu inn mest {0} stafi." ), | |
9 | + minlength: $.validator.format( "Sláðu inn minnst {0} stafi." ), | |
10 | + rangelength: $.validator.format( "Sláðu inn minnst {0} og mest {1} stafi." ), | |
11 | + email: "Sláðu inn gilt netfang.", | |
12 | + url: "Sláðu inn gilda vefslóð.", | |
13 | + date: "Sláðu inn gilda dagsetningu.", | |
14 | + number: "Sláðu inn tölu.", | |
15 | + digits: "Sláðu inn tölustafi eingöngu.", | |
16 | + equalTo: "Sláðu sama gildi inn aftur.", | |
17 | + range: $.validator.format( "Sláðu inn gildi milli {0} og {1}." ), | |
18 | + max: $.validator.format( "Sláðu inn gildi sem er minna en eða jafnt og {0}." ), | |
19 | + min: $.validator.format( "Sláðu inn gildi sem er stærra en eða jafnt og {0}." ), | |
20 | + creditcard: "Sláðu inn gilt greiðslukortanúmer." | |
21 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_it.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: IT (Italian; Italiano) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Campo obbligatorio", | |
7 | + remote: "Controlla questo campo", | |
8 | + email: "Inserisci un indirizzo email valido", | |
9 | + url: "Inserisci un indirizzo web valido", | |
10 | + date: "Inserisci una data valida", | |
11 | + dateISO: "Inserisci una data valida (ISO)", | |
12 | + number: "Inserisci un numero valido", | |
13 | + digits: "Inserisci solo numeri", | |
14 | + creditcard: "Inserisci un numero di carta di credito valido", | |
15 | + equalTo: "Il valore non corrisponde", | |
16 | + extension: "Inserisci un valore con un'estensione valida", | |
17 | + maxlength: $.validator.format( "Non inserire più di {0} caratteri" ), | |
18 | + minlength: $.validator.format( "Inserisci almeno {0} caratteri" ), | |
19 | + rangelength: $.validator.format( "Inserisci un valore compreso tra {0} e {1} caratteri" ), | |
20 | + range: $.validator.format( "Inserisci un valore compreso tra {0} e {1}" ), | |
21 | + max: $.validator.format( "Inserisci un valore minore o uguale a {0}" ), | |
22 | + min: $.validator.format( "Inserisci un valore maggiore o uguale a {0}" ), | |
23 | + nifES: "Inserisci un NIF valido", | |
24 | + nieES: "Inserisci un NIE valido", | |
25 | + cifES: "Inserisci un CIF valido", | |
26 | + currency: "Inserisci una valuta valida" | |
27 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ja.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: JA (Japanese; 日本語) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "このフィールドは必須です。", | |
7 | + remote: "このフィールドを修正してください。", | |
8 | + email: "有効なEメールアドレスを入力してください。", | |
9 | + url: "有効なURLを入力してください。", | |
10 | + date: "有効な日付を入力してください。", | |
11 | + dateISO: "有効な日付(ISO)を入力してください。", | |
12 | + number: "有効な数字を入力してください。", | |
13 | + digits: "数字のみを入力してください。", | |
14 | + creditcard: "有効なクレジットカード番号を入力してください。", | |
15 | + equalTo: "同じ値をもう一度入力してください。", | |
16 | + extension: "有効な拡張子を含む値を入力してください。", | |
17 | + maxlength: $.validator.format( "{0} 文字以内で入力してください。" ), | |
18 | + minlength: $.validator.format( "{0} 文字以上で入力してください。" ), | |
19 | + rangelength: $.validator.format( "{0} 文字から {1} 文字までの値を入力してください。" ), | |
20 | + range: $.validator.format( "{0} から {1} までの値を入力してください。" ), | |
21 | + max: $.validator.format( "{0} 以下の値を入力してください。" ), | |
22 | + min: $.validator.format( "{0} 以上の値を入力してください。" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ka.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: KA (Georgian; ქართული) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "ამ ველის შევსება აუცილებელია.", | |
7 | + remote: "გთხოვთ მიუთითოთ სწორი მნიშვნელობა.", | |
8 | + email: "გთხოვთ მიუთითოთ ელ-ფოსტის კორექტული მისამართი.", | |
9 | + url: "გთხოვთ მიუთითოთ კორექტული URL.", | |
10 | + date: "გთხოვთ მიუთითოთ კორექტული თარიღი.", | |
11 | + dateISO: "გთხოვთ მიუთითოთ კორექტული თარიღი ISO ფორმატში.", | |
12 | + number: "გთხოვთ მიუთითოთ ციფრი.", | |
13 | + digits: "გთხოვთ მიუთითოთ მხოლოდ ციფრები.", | |
14 | + creditcard: "გთხოვთ მიუთითოთ საკრედიტო ბარათის კორექტული ნომერი.", | |
15 | + equalTo: "გთხოვთ მიუთითოთ ასეთივე მნიშვნელობა კიდევ ერთხელ.", | |
16 | + extension: "გთხოვთ აირჩიოთ ფაილი კორექტული გაფართოებით.", | |
17 | + maxlength: $.validator.format( "დასაშვებია არაუმეტეს {0} სიმბოლო." ), | |
18 | + minlength: $.validator.format( "აუცილებელია შეიყვანოთ მინიმუმ {0} სიმბოლო." ), | |
19 | + rangelength: $.validator.format( "ტექსტში სიმბოლოების რაოდენობა უნდა იყოს {0}-დან {1}-მდე." ), | |
20 | + range: $.validator.format( "გთხოვთ შეიყვანოთ ციფრი {0}-დან {1}-მდე." ), | |
21 | + max: $.validator.format( "გთხოვთ შეიყვანოთ ციფრი რომელიც ნაკლებია ან უდრის {0}-ს." ), | |
22 | + min: $.validator.format( "გთხოვთ შეიყვანოთ ციფრი რომელიც მეტია ან უდრის {0}-ს." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_kk.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: KK (Kazakh; қазақ тілі) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Бұл өрісті міндетті түрде толтырыңыз.", | |
7 | + remote: "Дұрыс мағына енгізуіңізді сұраймыз.", | |
8 | + email: "Нақты электронды поштаңызды енгізуіңізді сұраймыз.", | |
9 | + url: "Нақты URL-ды енгізуіңізді сұраймыз.", | |
10 | + date: "Нақты URL-ды енгізуіңізді сұраймыз.", | |
11 | + dateISO: "Нақты ISO форматымен сәйкес датасын енгізуіңізді сұраймыз.", | |
12 | + number: "Күнді енгізуіңізді сұраймыз.", | |
13 | + digits: "Тек қана сандарды енгізуіңізді сұраймыз.", | |
14 | + creditcard: "Несие картасының нөмірін дұрыс енгізуіңізді сұраймыз.", | |
15 | + equalTo: "Осы мәнді қайта енгізуіңізді сұраймыз.", | |
16 | + extension: "Файлдың кеңейтуін дұрыс таңдаңыз.", | |
17 | + maxlength: $.validator.format( "Ұзындығы {0} символдан көр болмасын." ), | |
18 | + minlength: $.validator.format( "Ұзындығы {0} символдан аз болмасын." ), | |
19 | + rangelength: $.validator.format( "Ұзындығы {0}-{1} дейін мән енгізуіңізді сұраймыз." ), | |
20 | + range: $.validator.format( "Пожалуйста, введите число от {0} до {1}. - {0} - {1} санын енгізуіңізді сұраймыз." ), | |
21 | + max: $.validator.format( "{0} аз немесе тең санын енгізуіңіді сұраймыз." ), | |
22 | + min: $.validator.format( "{0} көп немесе тең санын енгізуіңізді сұраймыз." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_ko.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: KO (Korean; 한국어) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "필수 항목입니다.", | |
7 | + remote: "항목을 수정하세요.", | |
8 | + email: "유효하지 않은 E-Mail주소입니다.", | |
9 | + url: "유효하지 않은 URL입니다.", | |
10 | + date: "올바른 날짜를 입력하세요.", | |
11 | + dateISO: "올바른 날짜(ISO)를 입력하세요.", | |
12 | + number: "유효한 숫자가 아닙니다.", | |
13 | + digits: "숫자만 입력 가능합니다.", | |
14 | + creditcard: "신용카드 번호가 바르지 않습니다.", | |
15 | + equalTo: "같은 값을 다시 입력하세요.", | |
16 | + extension: "올바른 확장자가 아닙니다.", | |
17 | + maxlength: $.validator.format( "{0}자를 넘을 수 없습니다. " ), | |
18 | + minlength: $.validator.format( "{0}자 이상 입력하세요." ), | |
19 | + rangelength: $.validator.format( "문자 길이가 {0} 에서 {1} 사이의 값을 입력하세요." ), | |
20 | + range: $.validator.format( "{0} 에서 {1} 사이의 값을 입력하세요." ), | |
21 | + max: $.validator.format( "{0} 이하의 값을 입력하세요." ), | |
22 | + min: $.validator.format( "{0} 이상의 값을 입력하세요." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_lt.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: LT (Lithuanian; lietuvių kalba) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Šis laukas yra privalomas.", | |
7 | + remote: "Prašau pataisyti šį lauką.", | |
8 | + email: "Prašau įvesti teisingą elektroninio pašto adresą.", | |
9 | + url: "Prašau įvesti teisingą URL.", | |
10 | + date: "Prašau įvesti teisingą datą.", | |
11 | + dateISO: "Prašau įvesti teisingą datą (ISO).", | |
12 | + number: "Prašau įvesti teisingą skaičių.", | |
13 | + digits: "Prašau naudoti tik skaitmenis.", | |
14 | + creditcard: "Prašau įvesti teisingą kreditinės kortelės numerį.", | |
15 | + equalTo: "Prašau įvestį tą pačią reikšmę dar kartą.", | |
16 | + extension: "Prašau įvesti reikšmę su teisingu plėtiniu.", | |
17 | + maxlength: $.validator.format( "Prašau įvesti ne daugiau kaip {0} simbolių." ), | |
18 | + minlength: $.validator.format( "Prašau įvesti bent {0} simbolius." ), | |
19 | + rangelength: $.validator.format( "Prašau įvesti reikšmes, kurių ilgis nuo {0} iki {1} simbolių." ), | |
20 | + range: $.validator.format( "Prašau įvesti reikšmę intervale nuo {0} iki {1}." ), | |
21 | + max: $.validator.format( "Prašau įvesti reikšmę mažesnę arba lygią {0}." ), | |
22 | + min: $.validator.format( "Prašau įvesti reikšmę didesnę arba lygią {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_lv.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: LV (Latvian; latviešu valoda) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Šis lauks ir obligāts.", | |
7 | + remote: "Lūdzu, pārbaudiet šo lauku.", | |
8 | + email: "Lūdzu, ievadiet derīgu e-pasta adresi.", | |
9 | + url: "Lūdzu, ievadiet derīgu URL adresi.", | |
10 | + date: "Lūdzu, ievadiet derīgu datumu.", | |
11 | + dateISO: "Lūdzu, ievadiet derīgu datumu (ISO).", | |
12 | + number: "Lūdzu, ievadiet derīgu numuru.", | |
13 | + digits: "Lūdzu, ievadiet tikai ciparus.", | |
14 | + creditcard: "Lūdzu, ievadiet derīgu kredītkartes numuru.", | |
15 | + equalTo: "Lūdzu, ievadiet to pašu vēlreiz.", | |
16 | + extension: "Lūdzu, ievadiet vērtību ar derīgu paplašinājumu.", | |
17 | + maxlength: $.validator.format( "Lūdzu, ievadiet ne vairāk kā {0} rakstzīmes." ), | |
18 | + minlength: $.validator.format( "Lūdzu, ievadiet vismaz {0} rakstzīmes." ), | |
19 | + rangelength: $.validator.format( "Lūdzu ievadiet {0} līdz {1} rakstzīmes." ), | |
20 | + range: $.validator.format( "Lūdzu, ievadiet skaitli no {0} līdz {1}." ), | |
21 | + max: $.validator.format( "Lūdzu, ievadiet skaitli, kurš ir mazāks vai vienāds ar {0}." ), | |
22 | + min: $.validator.format( "Lūdzu, ievadiet skaitli, kurš ir lielāks vai vienāds ar {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_mk.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: MK (Macedonian; македонски јазик) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Полето е задолжително.", | |
7 | + remote: "Поправете го ова поле", | |
8 | + email: "Внесете правилна e-mail адреса", | |
9 | + url: "Внесете правилен URL.", | |
10 | + date: "Внесете правилен датум", | |
11 | + dateISO: "Внесете правилен датум (ISO).", | |
12 | + number: "Внесете правилен број.", | |
13 | + digits: "Внесете само бројки.", | |
14 | + creditcard: "Внесете правилен број на кредитната картичка.", | |
15 | + equalTo: "Внесете ја истата вредност повторно.", | |
16 | + extension: "Внесете вредност со соодветна екстензија.", | |
17 | + maxlength: $.validator.format( "Внесете максимално {0} знаци." ), | |
18 | + minlength: $.validator.format( "Внесете барем {0} знаци." ), | |
19 | + rangelength: $.validator.format( "Внесете вредност со должина помеѓу {0} и {1} знаци." ), | |
20 | + range: $.validator.format( "Внесете вредност помеѓу {0} и {1}." ), | |
21 | + max: $.validator.format( "Внесете вредност помала или еднаква на {0}." ), | |
22 | + min: $.validator.format( "Внесете вредност поголема или еднаква на {0}" ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_my.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: MY (Malay; Melayu) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Medan ini diperlukan.", | |
7 | + remote: "Sila betulkan medan ini.", | |
8 | + email: "Sila masukkan alamat emel yang betul.", | |
9 | + url: "Sila masukkan URL yang betul.", | |
10 | + date: "Sila masukkan tarikh yang betul.", | |
11 | + dateISO: "Sila masukkan tarikh(ISO) yang betul.", | |
12 | + number: "Sila masukkan nombor yang betul.", | |
13 | + digits: "Sila masukkan nilai digit sahaja.", | |
14 | + creditcard: "Sila masukkan nombor kredit kad yang betul.", | |
15 | + equalTo: "Sila masukkan nilai yang sama semula.", | |
16 | + extension: "Sila masukkan nilai yang telah diterima.", | |
17 | + maxlength: $.validator.format( "Sila masukkan tidak lebih dari {0} aksara." ), | |
18 | + minlength: $.validator.format( "Sila masukkan sekurang-kurangnya {0} aksara." ), | |
19 | + rangelength: $.validator.format( "Sila masukkan antara {0} dan {1} panjang aksara." ), | |
20 | + range: $.validator.format( "Sila masukkan nilai antara {0} dan {1} aksara." ), | |
21 | + max: $.validator.format( "Sila masukkan nilai yang kurang atau sama dengan {0}." ), | |
22 | + min: $.validator.format( "Sila masukkan nilai yang lebih atau sama dengan {0}." ) | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_nl.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: NL (Dutch; Nederlands, Vlaams) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Dit is een verplicht veld.", | |
7 | + remote: "Controleer dit veld.", | |
8 | + email: "Vul hier een geldig e-mailadres in.", | |
9 | + url: "Vul hier een geldige URL in.", | |
10 | + date: "Vul hier een geldige datum in.", | |
11 | + dateISO: "Vul hier een geldige datum in (ISO-formaat).", | |
12 | + number: "Vul hier een geldig getal in.", | |
13 | + digits: "Vul hier alleen getallen in.", | |
14 | + creditcard: "Vul hier een geldig creditcardnummer in.", | |
15 | + equalTo: "Vul hier dezelfde waarde in.", | |
16 | + extension: "Vul hier een waarde in met een geldige extensie.", | |
17 | + maxlength: $.validator.format( "Vul hier maximaal {0} tekens in." ), | |
18 | + minlength: $.validator.format( "Vul hier minimaal {0} tekens in." ), | |
19 | + rangelength: $.validator.format( "Vul hier een waarde in van minimaal {0} en maximaal {1} tekens." ), | |
20 | + range: $.validator.format( "Vul hier een waarde in van minimaal {0} en maximaal {1}." ), | |
21 | + max: $.validator.format( "Vul hier een waarde in kleiner dan of gelijk aan {0}." ), | |
22 | + min: $.validator.format( "Vul hier een waarde in groter dan of gelijk aan {0}." ), | |
23 | + | |
24 | + // For validations in additional-methods.js | |
25 | + iban: "Vul hier een geldig IBAN in.", | |
26 | + dateNL: "Vul hier een geldige datum in.", | |
27 | + phoneNL: "Vul hier een geldig Nederlands telefoonnummer in.", | |
28 | + mobileNL: "Vul hier een geldig Nederlands mobiel telefoonnummer in.", | |
29 | + postalcodeNL: "Vul hier een geldige postcode in.", | |
30 | + bankaccountNL: "Vul hier een geldig bankrekeningnummer in.", | |
31 | + giroaccountNL: "Vul hier een geldig gironummer in.", | |
32 | + bankorgiroaccountNL: "Vul hier een geldig bank- of gironummer in." | |
33 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_no.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: NO (Norwegian; Norsk) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "Dette feltet er obligatorisk.", | |
7 | + maxlength: $.validator.format( "Maksimalt {0} tegn." ), | |
8 | + minlength: $.validator.format( "Minimum {0} tegn." ), | |
9 | + rangelength: $.validator.format( "Angi minimum {0} og maksimum {1} tegn." ), | |
10 | + email: "Oppgi en gyldig epostadresse.", | |
11 | + url: "Angi en gyldig URL.", | |
12 | + date: "Angi en gyldig dato.", | |
13 | + dateISO: "Angi en gyldig dato (&ARING;&ARING;&ARING;&ARING;-MM-DD).", | |
14 | + dateSE: "Angi en gyldig dato.", | |
15 | + number: "Angi et gyldig nummer.", | |
16 | + numberSE: "Angi et gyldig nummer.", | |
17 | + digits: "Skriv kun tall.", | |
18 | + equalTo: "Skriv samme verdi igjen.", | |
19 | + range: $.validator.format( "Angi en verdi mellom {0} og {1}." ), | |
20 | + max: $.validator.format( "Angi en verdi som er mindre eller lik {0}." ), | |
21 | + min: $.validator.format( "Angi en verdi som er større eller lik {0}." ), | |
22 | + creditcard: "Angi et gyldig kredittkortnummer." | |
23 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_pl.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: PL (Polish; język polski, polszczyzna) | |
4 | + */ | |
5 | +$.extend( $.validator.messages, { | |
6 | + required: "To pole jest wymagane.", | |
7 | + remote: "Proszę o wypełnienie tego pola.", | |
8 | + email: "Proszę o podanie prawidłowego adresu email.", | |
9 | + url: "Proszę o podanie prawidłowego URL.", | |
10 | + date: "Proszę o podanie prawidłowej daty.", | |
11 | + dateISO: "Proszę o podanie prawidłowej daty (ISO).", | |
12 | + number: "Proszę o podanie prawidłowej liczby.", | |
13 | + digits: "Proszę o podanie samych cyfr.", | |
14 | + creditcard: "Proszę o podanie prawidłowej karty kredytowej.", | |
15 | + equalTo: "Proszę o podanie tej samej wartości ponownie.", | |
16 | + extension: "Proszę o podanie wartości z prawidłowym rozszerzeniem.", | |
17 | + maxlength: $.validator.format( "Proszę o podanie nie więcej niż {0} znaków." ), | |
18 | + minlength: $.validator.format( "Proszę o podanie przynajmniej {0} znaków." ), | |
19 | + rangelength: $.validator.format( "Proszę o podanie wartości o długości od {0} do {1} znaków." ), | |
20 | + range: $.validator.format( "Proszę o podanie wartości z przedziału od {0} do {1}." ), | |
21 | + max: $.validator.format( "Proszę o podanie wartości mniejszej bądź równej {0}." ), | |
22 | + min: $.validator.format( "Proszę o podanie wartości większej bądź równej {0}." ), | |
23 | + pattern: $.validator.format( "Pole zawiera niedozwolone znaki." ) | |
24 | +} ); | ... | ... |
bower_components/jquery-validation/src/localization/messages_pt_BR.js
0 → 100644
1 | +/* | |
2 | + * Translated default messages for the jQuery validation plugin. | |
3 | + * Locale: PT (Portuguese; português) | |
4 | + * Region: BR (Brazil) | |
5 | + */ | |
6 | +$.extend( $.validator.messages, { | |
7 | + | |
8 | + // Core | |
9 | + required: "Este campo é requerido.", | |
10 | + remote: "Por favor, corrija este campo.", | |
11 | + email: "Por favor, forneça um endereço de email válido.", | |
12 | + url: "Por favor, forneça uma URL válida.", | |
13 | + date: "Por favor, forneça uma data válida.", | |
14 | + dateISO: "Por favor, forneça uma data válida (ISO).", | |
15 | + number: "Por favor, forneça um número válido.", | |
16 | + digits: "Por favor, forneça somente dígitos.", | |
17 | + creditcard: "Por favor, forneça um cartão de crédito válido.", | |
18 | + equalTo: "Por favor, forneça o mesmo valor novamente.", | |
19 | + maxlength: $.validator.format( "Por favor, forneça não mais que {0} caracteres." ), | |
20 | + minlength: $.validator.format( "Por favor, forneça ao menos {0} caracteres." ), | |
21 | + rangelength: $.validator.format( "Por favor, forneça um valor entre {0} e {1} caracteres de comprimento." ), | |
22 | + range: $.validator.format( "Por favor, forneça um valor entre {0} e {1}." ), | |
23 | + max: $.validator.format( "Por favor, forneça um valor menor ou igual a {0}." ), | |
24 | + min: $.validator.format( "Por favor, forneça um valor maior ou igual a {0}." ), | |
25 | + | |
26 | + // Metodos Adicionais | |
27 | + maxWords: $.validator.format( "Por favor, forneça com {0} palavras ou menos." ), | |
28 | + minWords: $.validator.format( "Por favor, forneça pelo menos {0} palavras." ), | |
29 | + rangeWords: $.validator.format( "Por favor, forneça entre {0} e {1} palavras." ), | |
30 | + accept: "Por favor, forneça um tipo válido.", | |
31 | + alphanumeric: "Por favor, forneça somente com letras, números e sublinhados.", | |
32 | + bankaccountNL: "Por favor, forneça com um número de conta bancária válida.", | |
33 | + bankorgiroaccountNL: "Por favor, forneça um banco válido ou número de conta.", | |
34 | + bic: "Por favor, forneça um código BIC válido.", | |
35 | + cifES: "Por favor, forneça um código CIF válido.", | |
36 | + creditcardtypes: "Por favor, forneça um número de cartão de crédito válido.", | |
37 | + currency: "Por favor, forneça uma moeda válida.", | |
38 | + dateFA: "Por favor, forneça uma data correta.", | |
39 | + dateITA: "Por favor, forneça uma data correta.", | |
40 | + dateNL: "Por favor, forneça uma data correta.", | |
41 | + extension: "Por favor, forneça um valor com uma extensão válida.", | |
42 | + giroaccountNL: "Por favor, forneça um número de conta corrente válido.", | |
43 | + iban: "Por favor, forneça um código IBAN válido.", | |
44 | + integer: "Por favor, forneça um número não decimal.", | |
45 | + ipv4: "Por favor, forneça um IPv4 válido.", | |
46 | + ipv6: "Por favor, forneça um IPv6 válido.", | |
47 | + lettersonly: "Por favor, forneça apenas com letras.", | |
48 | + letterswithbasicpunc: "Por favor, forneça apenas letras ou pontuações.", | |
49 | + mobileNL: "Por favor, forneceça um número válido de telefone.", | |
50 | + mobileUK: "Por favor, forneceça um número válido de telefone.", | |
51 | + nieES: "Por favor, forneça um NIE válido.", | |
52 | + nifES: "Por favor, forneça um NIF válido.", | |
53 | + nowhitespace: "Por favor, não utilize espaços em branco.", | |
54 | + pattern: "O formato fornenecido é inválido.", | |
55 | + phoneNL: "Por favor, forneceça um número de telefone válido.", | |
56 | + phoneUK: "Por favor, forneceça um número de telefone válido.", | |
57 | + phoneUS: "Por favor, forneceça um número de telefone válido.", | |
58 | + phonesUK: "Por favor, forneceça um número de telefone válido.", | |
59 | + postalCodeCA: "Por favor, forneceça um número de código postal válido.", | |
60 | + postalcodeIT: "Por favor, forneceça um número de código postal válido.", | |
61 | + postalcodeNL: "Por favor, forneceça um número de código postal válido.", | |
62 | + postcodeUK: "Por favor, forneceça um número de código postal válido.", | |
63 | + postalcodeBR: "Por favor, forneça um CEP válido.", | |
64 | + require_from_group: $.validator.format( "Por favor, forneça pelo menos {0} destes campos." ), | |
65 | + skip_or_fill_minimum: $.validator.format( "Por favor, optar entre ignorar esses campos ou preencher pelo menos {0} deles." ), | |
66 | + stateUS: "Por favor, forneça um estado válido.", | |
67 | + strippedminlength: $.validator.format( "Por favor, forneça pelo menos {0} caracteres." ), | |
68 | + time: "Por favor, forneça um horário válido, no intervado de 00:00 e 23:59.", | |
69 | + time12h: "Por favor, forneça um horário válido, no intervado de 01:00 e 12:59 am/pm.", | |
70 | + url2: "Por favor, forneceça uma URL válida.", | |
71 | + vinUS: "O número de identificação de veículo informada (VIN) é inválido.", | |
72 | + zipcodeUS: "Por favor, forneceça um código postal americano válido.", | |
73 | + ziprange: "O código postal deve estar entre 902xx-xxxx e 905xx-xxxx", | |
74 | + cpfBR: "Por favor, forneça um CPF válido." | |
75 | +} ); | ... | ... |