1/*! 2 * jQuery Validation Plugin 1.11.1 3 * 4 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 5 * http://docs.jquery.com/Plugins/Validation 6 * 7 * Copyright 2013 Jï¾ï½¶rn Zaefferer 8 * Released under the MIT license: 9 * http://www.opensource.org/licenses/mit-license.php 10 */ 11 12(function($) { 13 14$.extend($.fn, { 15 // http://docs.jquery.com/Plugins/Validation/validate 16 validate: function( options ) { 17 18 // if nothing is selected, return nothing; can't chain anyway 19 if ( !this.length ) { 20 if ( options && options.debug && window.console ) { 21 console.warn( "Nothing selected, can't validate, returning nothing." ); 22 } 23 return; 24 } 25 26 // check if a validator for this form was already created 27 var validator = $.data( this[0], "validator" ); 28 if ( validator ) { 29 return validator; 30 } 31 32 // Add novalidate tag if HTML5. 33 this.attr( "novalidate", "novalidate" ); 34 35 validator = new $.validator( options, this[0] ); 36 $.data( this[0], "validator", validator ); 37 38 if ( validator.settings.onsubmit ) { 39 40 this.validateDelegate( ":submit", "click", function( event ) { 41 if ( validator.settings.submitHandler ) { 42 validator.submitButton = event.target; 43 } 44 // allow suppressing validation by adding a cancel class to the submit button 45 if ( $(event.target).hasClass("cancel") ) { 46 validator.cancelSubmit = true; 47 } 48 49 // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button 50 if ( $(event.target).attr("formnovalidate") !== undefined ) { 51 validator.cancelSubmit = true; 52 } 53 }); 54 55 // validate the form on submit 56 this.submit( function( event ) { 57 if ( validator.settings.debug ) { 58 // prevent form submit to be able to see console output 59 event.preventDefault(); 60 } 61 function handle() { 62 var hidden; 63 if ( validator.settings.submitHandler ) { 64 if ( validator.submitButton ) { 65 // insert a hidden input as a replacement for the missing submit button 66 hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm); 67 } 68 validator.settings.submitHandler.call( validator, validator.currentForm, event ); 69 if ( validator.submitButton ) { 70 // and clean up afterwards; thanks to no-block-scope, hidden can be referenced 71 hidden.remove(); 72 } 73 return false; 74 } 75 return true; 76 } 77 78 // prevent submit for invalid forms or custom submit handlers 79 if ( validator.cancelSubmit ) { 80 validator.cancelSubmit = false; 81 return handle(); 82 } 83 if ( validator.form() ) { 84 if ( validator.pendingRequest ) { 85 validator.formSubmitted = true; 86 return false; 87 } 88 return handle(); 89 } else { 90 validator.focusInvalid(); 91 return false; 92 } 93 }); 94 } 95 96 return validator; 97 }, 98 // http://docs.jquery.com/Plugins/Validation/valid 99 valid: function() { 100 if ( $(this[0]).is("form")) { 101 return this.validate().form(); 102 } else { 103 var valid = true; 104 var validator = $(this[0].form).validate(); 105 this.each(function() { 106 valid = valid && validator.element(this); 107 }); 108 return valid; 109 } 110 }, 111 // attributes: space seperated list of attributes to retrieve and remove 112 removeAttrs: function( attributes ) { 113 var result = {}, 114 $element = this; 115 $.each(attributes.split(/\s/), function( index, value ) { 116 result[value] = $element.attr(value); 117 $element.removeAttr(value); 118 }); 119 return result; 120 }, 121 // http://docs.jquery.com/Plugins/Validation/rules 122 rules: function( command, argument ) { 123 var element = this[0]; 124 125 if ( command ) { 126 var settings = $.data(element.form, "validator").settings; 127 var staticRules = settings.rules; 128 var existingRules = $.validator.staticRules(element); 129 switch(command) { 130 case "add": 131 $.extend(existingRules, $.validator.normalizeRule(argument)); 132 // remove messages from rules, but allow them to be set separetely 133 delete existingRules.messages; 134 staticRules[element.name] = existingRules; 135 if ( argument.messages ) { 136 settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); 137 } 138 break; 139 case "remove": 140 if ( !argument ) { 141 delete staticRules[element.name]; 142 return existingRules; 143 } 144 var filtered = {}; 145 $.each(argument.split(/\s/), function( index, method ) { 146 filtered[method] = existingRules[method]; 147 delete existingRules[method]; 148 }); 149 return filtered; 150 } 151 } 152 153 var data = $.validator.normalizeRules( 154 $.extend( 155 {}, 156 $.validator.classRules(element), 157 $.validator.attributeRules(element), 158 $.validator.dataRules(element), 159 $.validator.staticRules(element) 160 ), element); 161 162 // make sure required is at front 163 if ( data.required ) { 164 var param = data.required; 165 delete data.required; 166 data = $.extend({required: param}, data); 167 } 168 169 return data; 170 } 171}); 172 173// Custom selectors 174$.extend($.expr[":"], {
175 // http://docs.jquery.com/Plugins/Validation/blank 176 blank: function( a ) { return !$.trim("" + $(a).val()); }, 177 // http://docs.jquery.com/Plugins/Validation/filled 178 filled: function( a ) { return !!$.trim("" + $(a).val()); }, 179 // http://docs.jquery.com/Plugins/Validation/unchecked 180 unchecked: function( a ) { return !$(a).prop("checked"); } 181}); 182 183// constructor for validator 184$.validator = function( options, form ) { 185 this.settings = $.extend( true, {}, $.validator.defaults, options ); 186 this.currentForm = form; 187 this.init(); 188}; 189 190$.validator.format = function( source, params ) { 191 if ( arguments.length === 1 ) { 192 return function() { 193 var args = $.makeArray(arguments); 194 args.unshift(source); 195 return $.validator.format.apply( this, args ); 196 }; 197 } 198 if ( arguments.length > 2 && params.constructor !== Array ) { 199 params = $.makeArray(arguments).slice(1); 200 } 201 if ( params.constructor !== Array ) { 202 params = [ params ]; 203 } 204 $.each(params, function( i, n ) { 205 source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() { 206 return n; 207 }); 208 }); 209 return source; 210}; 211 212$.extend($.validator, { 213 214 defaults: { 215 messages: {}, 216 groups: {}, 217 rules: {}, 218 errorClass: "error", 219 validClass: "valid", 220 errorElement: "label", 221 focusInvalid: true, 222 errorContainer: $([]), 223 errorLabelContainer: $([]), 224 onsubmit: true, 225 ignore: ":hidden", 226 ignoreTitle: false, 227 onfocusin: function( element, event ) { 228 this.lastActive = element; 229 230 // hide error label and remove error class on focus if enabled 231 if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { 232 if ( this.settings.unhighlight ) { 233 this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); 234 } 235 this.addWrapper(this.errorsFor(element)).hide(); 236 } 237 }, 238 onfocusout: function( element, event ) { 239 if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { 240 this.element(element); 241 } 242 }, 243 onkeyup: function( element, event ) { 244 if ( event.which === 9 && this.elementValue(element) === "" ) { 245 return; 246 } else if ( element.name in this.submitted || element === this.lastElement ) { 247 this.element(element); 248 } 249 }, 250 onclick: function( element, event ) { 251 // click on selects, radiobuttons and checkboxes 252 if ( element.name in this.submitted ) { 253 this.element(element); 254 } 255 // or option elements, check parent select in that case 256 else if ( element.parentNode.name in this.submitted ) { 257 this.element(element.parentNode); 258 } 259 }, 260 highlight: function( element, errorClass, validClass ) { 261 if ( element.type === "radio" ) { 262 this.findByName(element.name).addClass(errorClass).removeClass(validClass); 263 } else { 264 $(element).addClass(errorClass).removeClass(validClass); 265 } 266 }, 267 unhighlight: function( element, errorClass, validClass ) { 268 if ( element.type === "radio" ) { 269 this.findByName(element.name).removeClass(errorClass).addClass(validClass); 270 } else { 271 $(element).removeClass(errorClass).addClass(validClass); 272 } 273 } 274 }, 275 276 // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults 277 setDefaults: function( settings ) { 278 $.extend( $.validator.defaults, settings ); 279 }, 280 281 messages: { 282 required: "This field is required.", 283 remote: "Please fix this field.", 284 email: "Please enter a valid email address.", 285 url: "Please enter a valid URL.", 286 date: "Please enter a valid date.", 287 dateISO: "Please enter a valid date (ISO).", 288 number: "Please enter a valid number.", 289 digits: "Please enter only digits.", 290 creditcard: "Please enter a valid credit card number.", 291 equalTo: "Please enter the same value again.", 292 maxlength: $.validator.format("Please enter no more than {0} characters."), 293 minlength: $.validator.format("Please enter at least {0} characters."), 294 rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), 295 range: $.validator.format("Please enter a value between {0} and {1}."), 296 max: $.validator.format("Please enter a value less than or equal to {0}."), 297 min: $.validator.format("Please enter a value greater than or equal to {0}.") 298 }, 299 300 autoCreateRanges: false, 301 302 prototype: { 303 304 init: function() { 305 this.labelContainer = $(this.settings.errorLabelContainer); 306 this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); 307 this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); 308 this.submitted = {}; 309 this.valueCache = {}; 310 this.pendingRequest = 0; 311 this.pending = {}; 312 this.invalid = {}; 313 this.reset(); 314 315 var groups = (this.groups = {}); 316 $.each(this.settings.groups, function( key, value ) { 317 if ( typeof value === "string" ) { 318 value = value.split(/\s/); 319 } 320 $.each(value, function( index, name ) { 321 groups[name] = key; 322 }); 323 }); 324 var rules = this.settings.rules; 325 $.each(rules, function( key, value ) { 326 rules[key] = $.validator.normalizeRule(value); 327 }); 328 329 function delegate(event) {
330 var validator = $.data(this[0].form, "validator"), 331 eventType = "on" + event.type.replace(/^validate/, ""); 332 if ( validator.settings[eventType] ) { 333 validator.settings[eventType].call(validator, this[0], event); 334 } 335 } 336 $(this.currentForm) 337 .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + 338 "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + 339 "[type='email'], [type='datetime'], [type='date'], [type='month'], " + 340 "[type='week'], [type='time'], [type='datetime-local'], " + 341 "[type='range'], [type='color'] ", 342 "focusin focusout keyup", delegate) 343 .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); 344 345 if ( this.settings.invalidHandler ) { 346 $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); 347 } 348 }, 349 350 // http://docs.jquery.com/Plugins/Validation/Validator/form 351 form: function() { 352 this.checkForm(); 353 $.extend(this.submitted, this.errorMap); 354 this.invalid = $.extend({}, this.errorMap); 355 if ( !this.valid() ) { 356 $(this.currentForm).triggerHandler("invalid-form", [this]); 357 } 358 this.showErrors(); 359 return this.valid(); 360 }, 361 362 checkForm: function() { 363 this.prepareForm(); 364 for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { 365 this.check( elements[i] ); 366 } 367 return this.valid(); 368 }, 369 370 // http://docs.jquery.com/Plugins/Validation/Validator/element 371 element: function( element ) { 372 element = this.validationTargetFor( this.clean( element ) ); 373 this.lastElement = element; 374 this.prepareElement( element ); 375 this.currentElements = $(element); 376 var result = this.check( element ) !== false; 377 if ( result ) { 378 delete this.invalid[element.name]; 379 } else { 380 this.invalid[element.name] = true; 381 } 382 if ( !this.numberOfInvalids() ) { 383 384 // Hide error containers on last error 385 this.toHide = this.toHide.add( this.containers ); 386 } 387 this.showErrors(); 388 return result; 389 }, 390 391 // http://docs.jquery.com/Plugins/Validation/Validator/showErrors 392 showErrors: function( errors ) { 393 if ( errors ) { 394 // add items to error list and map 395 $.extend( this.errorMap, errors ); 396 this.errorList = []; 397 for ( var name in errors ) { 398 this.errorList.push({ 399 message: errors[name], 400 element: this.findByName(name)[0] 401 }); 402 } 403 // remove items from success list 404 this.successList = $.grep( this.successList, function( element ) { 405 return !(element.name in errors); 406 }); 407 } 408 if ( this.settings.showErrors ) { 409 this.settings.showErrors.call( this, this.errorMap, this.errorList ); 410 } else { 411 this.defaultShowErrors(); 412 } 413 }, 414 415 // http://docs.jquery.com/Plugins/Validation/Validator/resetForm 416 resetForm: function() { 417 if ( $.fn.resetForm ) { 418 $(this.currentForm).resetForm(); 419 } 420 this.submitted = {}; 421 this.lastElement = null; 422 this.prepareForm(); 423 this.hideErrors(); 424 this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); 425 }, 426 427 numberOfInvalids: function() { 428 return this.objectLength(this.invalid); 429 }, 430 431 objectLength: function( obj ) { 432 var count = 0; 433 for ( var i in obj ) { 434 count++; 435 } 436 return count; 437 }, 438 439 hideErrors: function() { 440 this.addWrapper( this.toHide ).hide(); 441 }, 442 443 valid: function() { 444 return this.size() === 0; 445 }, 446 447 size: function() { 448 return this.errorList.length; 449 }, 450 451 focusInvalid: function() { 452 if ( this.settings.focusInvalid ) { 453 try { 454 $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) 455 .filter(":visible") 456 .focus() 457 // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find 458 .trigger("focusin"); 459 } catch(e) { 460 // ignore IE throwing errors when focusing hidden elements 461 } 462 } 463 }, 464 465 findLastActive: function() { 466 var lastActive = this.lastActive; 467 return lastActive && $.grep(this.errorList, function( n ) { 468 return n.element.name === lastActive.name; 469 }).length === 1 && lastActive; 470 }, 471 472 elements: function() {
473 var validator = this, 474 rulesCache = {}; 475 476 // select all valid inputs inside the form (no submit or reset buttons) 477 return $(this.currentForm) 478 .find("input, select, textarea") 479 .not(":submit, :reset, :image, [disabled]") 480 .not( this.settings.ignore ) 481 .filter(function() { 482 if ( !this.name && validator.settings.debug && window.console ) { 483 console.error( "%o has no name assigned", this); 484 } 485 486 // select only the first element for each name, and only those with rules specified 487 if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { 488 return false; 489 } 490 491 rulesCache[this.name] = true; 492 return true; 493 }); 494 }, 495 496 clean: function( selector ) { 497 return $(selector)[0]; 498 }, 499 500 errors: function() { 501 var errorClass = this.settings.errorClass.replace(" ", "."); 502 return $(this.settings.errorElement + "." + errorClass, this.errorContext); 503 }, 504 505 reset: function() { 506 this.successList = []; 507 this.errorList = []; 508 this.errorMap = {}; 509 this.toShow = $([]); 510 this.toHide = $([]); 511 this.currentElements = $([]); 512 }, 513 514 prepareForm: function() { 515 this.reset(); 516 this.toHide = this.errors().add( this.containers ); 517 }, 518 519 prepareElement: function( element ) { 520 this.reset(); 521 this.toHide = this.errorsFor(element); 522 }, 523 524 elementValue: function( element ) { 525 var type = $(element).attr("type"), 526 val = $(element).val(); 527 528 if ( type === "radio" || type === "checkbox" ) { 529 return $("input[name='" + $(element).attr("name") + "']:checked").val(); 530 } 531 532 if ( typeof val === "string" ) { 533 return val.replace(/\r/g, ""); 534 } 535 return val; 536 }, 537 538 check: function( element ) { 539 element = this.validationTargetFor( this.clean( element ) ); 540 541 var rules = $(element).rules(); 542 var dependencyMismatch = false; 543 var val = this.elementValue(element); 544 var result; 545 546 for (var method in rules ) { 547 var rule = { method: method, parameters: rules[method] }; 548 try { 549 550 result = $.validator.methods[method].call( this, val, element, rule.parameters ); 551 552 // if a method indicates that the field is optional and therefore valid, 553 // don't mark it as valid when there are no other rules 554 if ( result === "dependency-mismatch" ) { 555 dependencyMismatch = true; 556 continue; 557 } 558 dependencyMismatch = false; 559 560 if ( result === "pending" ) { 561 this.toHide = this.toHide.not( this.errorsFor(element) ); 562 return; 563 } 564 565 if ( !result ) { 566 this.formatAndAdd( element, rule ); 567 return false; 568 } 569 } catch(e) { 570 if ( this.settings.debug && window.console ) { 571 console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); 572 } 573 throw e; 574 } 575 } 576 if ( dependencyMismatch ) { 577 return; 578 } 579 if ( this.objectLength(rules) ) { 580 this.successList.push(element); 581 } 582 return true; 583 }, 584 585 // return the custom message for the given element and validation method 586 // specified in the element's HTML5 data attribute 587 customDataMessage: function( element, method ) { 588 return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase())); 589 }, 590 591 // return the custom message for the given element name and validation method 592 customMessage: function( name, method ) { 593 var m = this.settings.messages[name]; 594 return m && (m.constructor === String ? m : m[method]); 595 }, 596 597 // return the first defined argument, allowing empty strings 598 findDefined: function() { 599 for(var i = 0; i < arguments.length; i++) { 600 if ( arguments[i] !== undefined ) { 601 return arguments[i]; 602 } 603 } 604 return undefined; 605 }, 606 607 defaultMessage: function( element, method ) { 608 return this.findDefined( 609 this.customMessage( element.name, method ), 610 this.customDataMessage( element, method ), 611 // title is never undefined, so handle empty string as undefined 612 !this.settings.ignoreTitle && element.title || undefined, 613 $.validator.messages[method], 614 "<strong>Warning: No message defined for " + element.name + "</strong>" 615 ); 616 }, 617 618 formatAndAdd: function( element, rule ) { 619 var message = this.defaultMessage( element, rule.method ), 620 theregex = /\$?\{(\d+)\}/g; 621 if ( typeof message === "function" ) { 622 message = message.call(this, rule.parameters, element); 623 } else if (theregex.test(message)) { 624 message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters); 625 } 626 this.errorList.push({ 627 message: message, 628 element: element 629 }); 630 631 this.errorMap[element.name] = message; 632 this.submitted[element.name] = message; 633 }, 634 635 addWrapper: function( toToggle ) { 636 if ( this.settings.wrapper ) { 637 toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); 638 } 639 return toToggle; 640 }, 641 642 defaultShowErrors: function() { 643 var i, elements; 644 for ( i = 0; this.errorList[i]; i++ ) { 645 var error = this.errorList[i]; 646 if ( this.settings.highlight ) { 647 this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.val
647idClass ); 648 } 649 this.showLabel( error.element, error.message ); 650 } 651 if ( this.errorList.length ) { 652 this.toShow = this.toShow.add( this.containers ); 653 } 654 if ( this.settings.success ) { 655 for ( i = 0; this.successList[i]; i++ ) { 656 this.showLabel( this.successList[i] ); 657 } 658 } 659 if ( this.settings.unhighlight ) { 660 for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { 661 this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); 662 } 663 } 664 this.toHide = this.toHide.not( this.toShow ); 665 this.hideErrors(); 666 this.addWrapper( this.toShow ).show(); 667 }, 668 669 validElements: function() { 670 return this.currentElements.not(this.invalidElements()); 671 }, 672 673 invalidElements: function() { 674 return $(this.errorList).map(function() { 675 return this.element; 676 }); 677 }, 678 679 showLabel: function( element, message ) { 680 var label = this.errorsFor( element ); 681 if ( label.length ) { 682 // refresh error/success class 683 label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); 684 // replace message on existing label 685 label.html(message); 686 } else { 687 // create label 688 label = $("<" + this.settings.errorElement + ">") 689 .attr("for", this.idOrName(element)) 690 .addClass(this.settings.errorClass) 691 .html(message || ""); 692 if ( this.settings.wrapper ) { 693 // make sure the element is visible, even in IE 694 // actually showing the wrapped element is handled elsewhere 695 label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); 696 } 697 if ( !this.labelContainer.append(label).length ) { 698 if ( this.settings.errorPlacement ) { 699 this.settings.errorPlacement(label, $(element) ); 700 } else { 701 label.insertAfter(element); 702 } 703 } 704 } 705 if ( !message && this.settings.success ) { 706 label.text(""); 707 if ( typeof this.settings.success === "string" ) { 708 label.addClass( this.settings.success ); 709 } else { 710 this.settings.success( label, element ); 711 } 712 } 713 this.toShow = this.toShow.add(label); 714 }, 715 716 errorsFor: function( element ) { 717 var name = this.idOrName(element); 718 return this.errors().filter(function() { 719 return $(this).attr("for") === name; 720 }); 721 }, 722 723 idOrName: function( element ) { 724 return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); 725 }, 726 727 validationTargetFor: function( element ) { 728 // if radio/checkbox, validate first element in group instead 729 if ( this.checkable(element) ) { 730 element = this.findByName( element.name ).not(this.settings.ignore)[0]; 731 } 732 return element; 733 }, 734 735 checkable: function( element ) { 736 return (/radio|checkbox/i).test(element.type); 737 }, 738 739 findByName: function( name ) { 740 return $(this.currentForm).find("[name='" + name + "']"); 741 }, 742 743 getLength: function( value, element ) { 744 switch( element.nodeName.toLowerCase() ) { 745 case "select": 746 return $("option:selected", element).length; 747 case "input": 748 if ( this.checkable( element) ) { 749 return this.findByName(element.name).filter(":checked").length; 750 } 751 } 752 return value.length; 753 }, 754 755 depend: function( param, element ) { 756 return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; 757 }, 758 759 dependTypes: { 760 "boolean": function( param, element ) { 761 return param; 762 }, 763 "string": function( param, element ) { 764 return !!$(param, element.form).length; 765 }, 766 "function": function( param, element ) { 767 return param(element); 768 } 769 }, 770 771 optional: function( element ) { 772 var val = this.elementValue(element); 773 return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; 774 }, 775 776 startRequest: function( element ) { 777 if ( !this.pending[element.name] ) { 778 this.pendingRequest++; 779 this.pending[element.name] = true; 780 } 781 }, 782 783 stopRequest: function( element, valid ) { 784 this.pendingRequest--; 785 // sometimes synchronization fails, make sure pendingRequest is never < 0 786 if ( this.pendingRequest < 0 ) { 787 this.pendingRequest = 0; 788 } 789 delete this.pending[element.name]; 790 if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { 791 $(this.currentForm).submit(); 792 this.formSubmitted = false;
793 } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { 794 $(this.currentForm).triggerHandler("invalid-form", [this]); 795 this.formSubmitted = false; 796 } 797 }, 798 799 previousValue: function( element ) { 800 return $.data(element, "previousValue") || $.data(element, "previousValue", { 801 old: null, 802 valid: true, 803 message: this.defaultMessage( element, "remote" ) 804 }); 805 } 806 807 }, 808 809 classRuleSettings: { 810 required: {required: true}, 811 email: {email: true}, 812 url: {url: true}, 813 date: {date: true}, 814 dateISO: {dateISO: true}, 815 number: {number: true}, 816 digits: {digits: true}, 817 creditcard: {creditcard: true} 818 }, 819 820 addClassRules: function( className, rules ) { 821 if ( className.constructor === String ) { 822 this.classRuleSettings[className] = rules; 823 } else { 824 $.extend(this.classRuleSettings, className); 825 } 826 }, 827 828 classRules: function( element ) { 829 var rules = {}; 830 var classes = $(element).attr("class"); 831 if ( classes ) { 832 $.each(classes.split(" "), function() { 833 if ( this in $.validator.classRuleSettings ) { 834 $.extend(rules, $.validator.classRuleSettings[this]); 835 } 836 }); 837 } 838 return rules; 839 }, 840 841 attributeRules: function( element ) { 842 var rules = {}; 843 var $element = $(element); 844 var type = $element[0].getAttribute("type"); 845 846 for (var method in $.validator.methods) { 847 var value; 848 849 // support for <input required> in both html5 and older browsers 850 if ( method === "required" ) { 851 value = $element.get(0).getAttribute(method); 852 // Some browsers return an empty string for the required attribute 853 // and non-HTML5 browsers might have required="" markup 854 if ( value === "" ) { 855 value = true; 856 } 857 // force non-HTML5 browsers to return bool 858 value = !!value; 859 } else { 860 value = $element.attr(method); 861 } 862 863 // convert the value to a number for number inputs, and for text for backwards compability 864 // allows type="date" and others to be compared as strings 865 if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { 866 value = Number(value); 867 } 868 869 if ( value ) { 870 rules[method] = value; 871 } else if ( type === method && type !== 'range' ) { 872 // exception: the jquery validate 'range' method 873 // does not test for the html5 'range' type 874 rules[method] = true; 875 } 876 } 877 878 // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs 879 if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) { 880 delete rules.maxlength; 881 } 882 883 return rules; 884 }, 885 886 dataRules: function( element ) { 887 var method, value, 888 rules = {}, $element = $(element); 889 for (method in $.validator.methods) { 890 value = $element.data("rule-" + method.toLowerCase()); 891 if ( value !== undefined ) { 892 rules[method] = value; 893 } 894 } 895 return rules; 896 }, 897 898 staticRules: function( element ) { 899 var rules = {}; 900 var validator = $.data(element.form, "validator"); 901 if ( validator.settings.rules ) { 902 rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; 903 } 904 return rules; 905 }, 906 907 normalizeRules: function( rules, element ) { 908 // handle dependency check 909 $.each(rules, function( prop, val ) { 910 // ignore rule when param is explicitly false, eg. required:false 911 if ( val === false ) { 912 delete rules[prop]; 913 return; 914 } 915 if ( val.param || val.depends ) { 916 var keepRule = true; 917 switch (typeof val.depends) { 918 case "string": 919 keepRule = !!$(val.depends, element.form).length; 920 break; 921 case "function": 922 keepRule = val.depends.call(element, element); 923 break; 924 } 925 if ( keepRule ) { 926 rules[prop] = val.param !== undefined ? val.param : true; 927 } else { 928 delete rules[prop]; 929 } 930 } 931 }); 932 933 // evaluate parameters 934 $.each(rules, function( rule, parameter ) { 935 rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; 936 }); 937 938 // clean number parameters 939 $.each(['minlength', 'maxlength'], function() { 940 if ( rules[this] ) { 941 rules[this] = Number(rules[this]); 942 } 943 }); 944 $.each(['rangelength', 'range'], function() { 945 var parts; 946 if ( rules[this] ) { 947 if ( $.isArray(rules[this]) ) { 948 rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; 949 } else if ( typeof rules[this] === "string" ) { 950 parts = rules[this].split(/[\s,]+/); 951 rules[this] = [Number(parts[0]), Number(parts[1])]; 952 } 953 } 954 }); 955 956 if ( $.validator.autoCreateRanges ) { 957 // auto-create ranges 958 if ( rules.min && rules.max ) { 959 rules.range = [rules.min, rules.max]; 960 delete rules.min; 961 delete rules.max; 962 } 963 if ( rules.minlength && rules.maxlength ) { 964 rules.rangelength = [rules.minlength, rules.maxlength]; 965 delete rules.minlength; 966 delete rules.maxlength; 967 } 968 } 969 970 return rules; 971 }, 972
vendor: 4,896 bytes, lines 973-1053
973 // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} 974 normalizeRule: function( data ) { 975 if ( typeof data === "string" ) { 976 var transformed = {}; 977 $.each(data.split(/\s/), function() { 978 transformed[this] = true; 979 }); 980 data = transformed; 981 } 982 return data; 983 }, 984 985 // http://docs.jquery.com/Plugins/Validation/Validator/addMethod 986 addMethod: function( name, method, message ) { 987 $.validator.methods[name] = method; 988 $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; 989 if ( method.length < 3 ) { 990 $.validator.addClassRules(name, $.validator.normalizeRule(name)); 991 } 992 }, 993 994 methods: { 995 996 // http://docs.jquery.com/Plugins/Validation/Methods/required 997 required: function( value, element, param ) { 998 // check if dependency is met 999 if ( !this.depend(param, element) ) { 1000 return "dependency-mismatch"; 1001 } 1002 if ( element.nodeName.toLowerCase() === "select" ) { 1003 // could be an array for select-multiple or a string, both are fine this way 1004 var val = $(element).val(); 1005 return val && val.length > 0; 1006 } 1007 if ( this.checkable(element) ) { 1008 return this.getLength(value, element) > 0; 1009 } 1010 return $.trim(value).length > 0; 1011 }, 1012 1013 // http://docs.jquery.com/Plugins/Validation/Methods/email 1014 email: function( value, element ) { 1015 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ 1016 return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))$/i.test(value); 1017 }, 1018 1019 // http://docs.jquery.com/Plugins/Validation/Methods/url 1020 url: function( value, element ) { 1021 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ 1022 return this.optional(element) || /^(https?|s?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); 1023 }, 1024 1025 // http://docs.jquery.com/Plugins/Validation/Methods/date 1026 date: function( value, element ) { 1027 return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); 1028 }, 1029 1030 // http://docs.jquery.com/Plugins/Validation/Methods/dateISO 1031 dateISO: function( value, element ) { 1032 return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); 1033 }, 1034 1035 // http://docs.jquery.com/Plugins/Validation/Methods/number 1036 number: function( value, element ) { 1037 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); 1038 }, 1039 1040 // http://docs.jquery.com/Plugins/Validation/Methods/digits 1041 digits: function( value, element ) { 1042 return this.optional(element) || /^\d+$/.test(value); 1043 }, 1044 1045 // http://docs.jquery.com/Plugins/Validation/Methods/creditcard 1046 // based on http://en.wikipedia.org/wiki/Luhn 1047 creditcard: function( value, element ) { 1048 if ( this.optional(element) ) { 1049 return "dependency-mismatch"; 1050 } 1051 // accept only spaces, digits and dashes 1052 if ( /[^0-9 \-]+/.test(value) ) { 1053 return false;
1054 } 1055 var nCheck = 0, 1056 nDigit = 0, 1057 bEven = false; 1058 1059 value = value.replace(/\D/g, ""); 1060 1061 for (var n = value.length - 1; n >= 0; n--) { 1062 var cDigit = value.charAt(n); 1063 nDigit = parseInt(cDigit, 10); 1064 if ( bEven ) { 1065 if ( (nDigit *= 2) > 9 ) { 1066 nDigit -= 9; 1067 } 1068 } 1069 nCheck += nDigit; 1070 bEven = !bEven; 1071 } 1072 1073 return (nCheck % 10) === 0; 1074 }, 1075 1076 // http://docs.jquery.com/Plugins/Validation/Methods/minlength 1077 minlength: function( value, element, param ) { 1078 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 1079 return this.optional(element) || length >= param; 1080 }, 1081 1082 // http://docs.jquery.com/Plugins/Validation/Methods/maxlength 1083 maxlength: function( value, element, param ) { 1084 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 1085 return this.optional(element) || length <= param; 1086 }, 1087 1088 // http://docs.jquery.com/Plugins/Validation/Methods/rangelength 1089 rangelength: function( value, element, param ) { 1090 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 1091 return this.optional(element) || ( length >= param[0] && length <= param[1] ); 1092 }, 1093 1094 // http://docs.jquery.com/Plugins/Validation/Methods/min 1095 min: function( value, element, param ) { 1096 return this.optional(element) || value >= param; 1097 }, 1098 1099 // http://docs.jquery.com/Plugins/Validation/Methods/max 1100 max: function( value, element, param ) { 1101 return this.optional(element) || value <= param; 1102 }, 1103 1104 // http://docs.jquery.com/Plugins/Validation/Methods/range 1105 range: function( value, element, param ) { 1106 return this.optional(element) || ( value >= param[0] && value <= param[1] ); 1107 }, 1108 1109 // http://docs.jquery.com/Plugins/Validation/Methods/equalTo 1110 equalTo: function( value, element, param ) {
1111 // bind to the blur event of the target in order to revalidate whenever the target field is updated 1112 // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead 1113 var target = $(param); 1114 if ( this.settings.onfocusout ) { 1115 target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { 1116 $(element).valid(); 1117 }); 1118 } 1119 return value === target.val(); 1120 }, 1121 1122 // http://docs.jquery.com/Plugins/Validation/Methods/remote 1123 remote: function( value, element, param ) { 1124 if ( this.optional(element) ) { 1125 return "dependency-mismatch"; 1126 } 1127 1128 var previous = this.previousValue(element); 1129 if (!this.settings.messages[element.name] ) { 1130 this.settings.messages[element.name] = {}; 1131 } 1132 previous.originalMessage = this.settings.messages[element.name].remote; 1133 this.settings.messages[element.name].remote = previous.message; 1134 1135 param = typeof param === "string" && {url:param} || param; 1136 1137 if ( previous.old === value ) { 1138 return previous.valid; 1139 } 1140 1141 previous.old = value; 1142 var validator = this; 1143 this.startRequest(element); 1144 var data = {}; 1145 data[element.name] = value; 1146 $.ajax($.extend(true, { 1147 url: param, 1148 mode: "abort", 1149 port: "validate" + element.name, 1150 dataType: "json", 1151 data: data, 1152 success: function( response ) { 1153 validator.settings.messages[element.name].remote = previous.originalMessage; 1154 var valid = response === true || response === "true"; 1155 if ( valid ) { 1156 var submitted = validator.formSubmitted; 1157 validator.prepareElement(element); 1158 validator.formSubmitted = submitted; 1159 validator.successList.push(element); 1160 delete validator.invalid[element.name]; 1161 validator.showErrors(); 1162 } else { 1163 var errors = {}; 1164 var message = response || validator.defaultMessage( element, "remote" ); 1165 errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; 1166 validator.invalid[element.name] = true; 1167 validator.showErrors(errors); 1168 } 1169 previous.valid = valid; 1170 validator.stopRequest(element, valid); 1171 } 1172 }, param)); 1173 return "pending"; 1174 } 1175 1176 } 1177 1178}); 1179 1180// deprecated, use $.validator.format instead 1181$.format = $.validator.format; 1182 1183}(jQuery)); 1184 1185// ajax mode: abort 1186// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); 1187// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 1188(function($) { 1189 var pendingRequests = {}; 1190 // Use a prefilter if available (1.5+) 1191 if ( $.ajaxPrefilter ) { 1192 $.ajaxPrefilter(function( settings, _, xhr ) { 1193 var port = settings.port; 1194 if ( settings.mode === "abort" ) { 1195 if ( pendingRequests[port] ) { 1196 pendingRequests[port].abort(); 1197 } 1198 pendingRequests[port] = xhr; 1199 } 1200 }); 1201 } else { 1202 // Proxy ajax 1203 var ajax = $.ajax; 1204 $.ajax = function( settings ) { 1205 var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, 1206 port = ( "port" in settings ? settings : $.ajaxSettings ).port; 1207 if ( mode === "abort" ) { 1208 if ( pendingRequests[port] ) { 1209 pendingRequests[port].abort(); 1210 } 1211 pendingRequests[port] = ajax.apply(this, arguments); 1212 return pendingRequests[port]; 1213 } 1214 return ajax.apply(this, arguments); 1215 }; 1216 } 1217}(jQuery)); 1218 1219// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation 1220// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 1221(function($) { 1222 $.extend($.fn, { 1223 validateDelegate: function( delegate, type, handler ) { 1224 return this.bind(type, function( event ) { 1225 var target = $(event.target); 1226 if ( target.is(delegate) ) { 1227 return handler.apply(target, arguments); 1228 } 1229 }); 1230 } 1231 }); 1232}(jQuery)); 1233 1234/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation 1235* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(){function t(t){return t.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'"_+=\/\-]*/g,"")}jQuery.validator.addMethod("maxWords",function(e,i,a){return this.optional(i)||a>=t(e).match(/\b\w+\b/g).length},jQuery.validator.format("Please enter {0} words or less.")),jQuery.validator.addMethod("minWords",function(e,i,a){return this.optional(i)||t(e).match(/\b\w+\b/g).length>=a},jQuery.validator.format("Please enter at least {0} words.")),jQuery.validator.addMethod("rangeWords",function(e,i,a){var r=t(e),n=/\b\w+\b/g;return this.optional(i)||r.match(n).length>=a[0]&&r.match(n).length<=a[1]},jQuery.validator.format("Please enter between {0} and {1} words."))})(),jQuery.validator.addMethod("letterswithbasicpunc",function(t,e){return this.optional(e)||/^[a-z\-.,()'"\s]+$/i.test(t)},"Letters or punctuation only please"),jQuery.validator.addMethod("alphanumeric",function(t,e){return this.optional(e)||/^\w+$/i.test(t)},"Letters, numbers, and underscores only please"),jQuery.validator.addMethod("lettersonly",function(t,e){return this.optional(e)||/^[a-z]+$/i.test(t)},"Letters only please"),jQuery.validator.addMethod("nowhitespace",function(t,e){return this.optional(e)||/^\S+$/i.test(t)},"No white space please"),jQuery.validator.addMethod("ziprange",function(t,e){return this.optional(e)||/^90[2-5]\d\{2\}-\d{4}$/.test(t)},"Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"),jQuery.validator.addMethod("zipcodeUS",function(t,e){return this.optional(e)||/\d{5}-\d{4}$|^\d{5}$/.test(t)}
1235,"The specified US ZIP Code is invalid"),jQuery.validator.addMethod("integer",function(t,e){return this.optional(e)||/^-?\d+$/.test(t)},"A positive or negative non-decimal number please"),jQuery.validator.addMethod("vinUS",function(t){if(17!==t.length)return!1;var e,i,a,r,n,s,u=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],d=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],o=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],l=0;for(e=0;17>e;e++){if(r=o[e],a=t.slice(e,e+1),8===e&&(s=a),isNaN(a)){for(i=0;u.length>i;i++)if(a.toUpperCase()===u[i]){a=d[i],a*=r,isNaN(s)&&8===i&&(s=u[i]);break}}else a*=r;l+=a}return n=l%11,10===n&&(n="X"),n===s?!0:!1},"The specified vehicle identification number (VIN) is invalid."),jQuery.validator.addMethod("dateITA",function(t,e){var i=!1,a=/^\d{1,2}\/\d{1,2}\/\d{4}$/;if(a.test(t)){var r=t.split("/"),n=parseInt(r[0],10),s=parseInt(r[1],10),u=parseInt(r[2],10),d=new Date(u,s-1,n);i=d.getFullYear()===u&&d.getMonth()===s-1&&d.getDate()===n?!0:!1}else i=!1;return this.optional(e)||i},"Please enter a correct date"),jQuery.validator.addMethod("iban",function(t,e){if(this.optional(e))return!0;if(!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(t))return!1;var i=t.replace(/ /g,"").toUpperCase(),a=i.substring(0,2),r={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}"},n=r[a];if(n!==void 0){var s=RegExp("^[A-Z]{2}\\d{2}"+n+"$","");if(!s.test(i))return!1}for(var u,d=i.substring(4,i.length)+i.substring(0,4),o="",l=!0,h=0;d.length>h;h++)u=d.charAt(h),"0"!==u&&(l=!1),l||(o+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(u));for(var F="",c="",m=0;o.length>m;m++){var f=o.charAt(m);c=""+F+f,F=c%97}return 1===F},"Please specify a valid IBAN"),jQuery.validator.addMethod("dateNL",function(t,e){return this.optional(e)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(t)},"Please enter a correct date"),jQuery.validator.addMethod("phoneNL",function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(t)},"Please specify a valid phone number."),jQuery.validator.addMethod("mobileNL",function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(t)},"Please specify a valid mobile number"),jQuery.validator.addMethod("postalcodeNL",function(t,e){return this.optional(e)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(t)},"Please specify a valid postal code"),jQuery.validator.addMethod("bankaccountNL",function(t,e){if(this.optional(e))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(t))return!1;for(var i=t.replace(/ /g,""),a=0,r=i.length,n=0;r>n;n++){var s=r-n,u=i.substring(n,n+1);a+=s*u}return 0===a%11},"Please specify a valid bank account number"),jQuery.validator.addMethod("giroaccountNL",function(t,e){return this.optional(e)||/^[0-9]{1,7}$/.test(t)},"Please specify a valid giro account number"),jQuery.validator.addMethod("bankorgiroaccountNL",function(t,e){return this.optional(e)||$.validator.methods.bankaccountNL.call(this,t,e)||$.validator.methods.giroaccountNL.call(this,t,e)},"Please specify a valid bank or giro account number"),jQuery.validator.addMethod("time",function(t,e){return this.optional(e)||/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(t)},"Please enter a valid time, between 00:00 and 23:59"),jQuery.validator.addMethod("time12h",function(t,e){return this.optional(e)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(t)},"Please enter a valid time in 12-hour am/pm format"),jQuery.validator.addMethod("phoneUS",function(t,e){return t=t.replace(/\s+/g,""),this.optional(e)||t.length>9&&t.match(/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number"),jQuery.validator.addMethod("phoneUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>
vendor: 5,494 bytes, line 1235
12359&&t.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"),jQuery.validator.addMethod("mobileUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),jQuery.validator.addMethod("phonesUK",function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[45789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),jQuery.validator.addMethod("postcodeUK",function(t,e){return this.optional(e)||/^((([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(t)},"Please specify a valid UK postcode"),jQuery.validator.addMethod("strippedminlength",function(t,e,i){return jQuery(t).text().length>=i},jQuery.validator.format("Please enter at least {0} characters")),jQuery.validator.addMethod("email2",function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))\.?$/i.test(t)},jQuery.validator.messages.email),jQuery.validator.addMethod("url2",function(t,e){return this.optional(e)||/^(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(t)},jQuery.validator.messages.url),jQuery.validator.addMethod("creditcardtypes",function(t,e,i){if(/[^0-9\-]+/.test(t))return!1;t=t.replace(/\D/g,"");var a=0;return i.mastercard&&(a|=1),i.visa&&(a|=2),i.amex&&(a|=4),i.dinersclub&&(a|=8),i.enroute&&(a|=16),i.discover&&(a|=32),i.jcb&&(a|=64),i.unknown&&(a|=128),i.all&&(a=255),1&a&&/^(5[12345])/.test(t)?16===t.length:2&a&&/^(4)/.test(t)?16===t.length:4&a&&/^(3[47])/.test(t)?15===t.length:8&a&&/^(3(0[012345]|[68]))/.test(t)?14===t.length:16&a&&/^(2(014|149))/.test(t)?15===t.length:32&a&&/^(6011)/.test(t)?16===t.length:64&a&&/^(3)/.test(t)?16===t.length:64&a&&/^(2131|1800)/.test(t)?15===t.length:128&a?!0:!1},"Please enter a valid credit card number."),jQuery.validator.addMethod("ipv4",function(t,e){return this.optional(e)||/^(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(t)},"Please enter a valid IP v4 address."),jQuery.validator.addMethod("ipv6",function(t,e){return this.optional(e)||/^((([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(t)},"Please enter a valid IP v6 address."),jQuery.validator.addMethod("pattern",function(t,e,
1235i){return this.optional(e)?!0:("string"==typeof i&&(i=RegExp("^(?:"+i+")$")),i.test(t))},"Invalid format."),jQuery.validator.addMethod("require_from_group",function(t,e,i){var a=this,r=i[1],n=$(r,e.form).filter(function(){return a.elementValue(this)}).length>=i[0];if(!$(e).data("being_validated")){var s=$(r,e.form);s.data("being_validated",!0),s.valid(),s.data("being_validated",!1)}return n},jQuery.format("Please fill at least {0} of these fields.")),jQuery.validator.addMethod("skip_or_fill_minimum",function(t,e,i){var a=this,r=i[0],n=i[1],s=$(n,e.form).filter(function(){return a.elementValue(this)}).length,u=s>=r||0===s;if(!$(e).data("being_validated")){var d=$(n,e.form);d.data("being_validated",!0),d.valid(),d.data("being_validated",!1)}return u},jQuery.format("Please either skip these fields or fill at least {0} of them.")),jQuery.validator.addMethod("accept",function(t,e,i){var a,r,n="string"==typeof i?i.replace(/\s/g,"").replace(/,/g,"|"):"image/*",s=this.optional(e);if(s)return s;if("file"===$(e).attr("type")&&(n=n.replace(/\*/g,".*"),e.files&&e.files.length))for(a=0;e.files.length>a;a++)if(r=e.files[a],!r.type.match(RegExp(".?("+n+")$","i")))return!1;return!0},jQuery.format("Please enter a value with a valid mimetype.")),jQuery.validator.addMethod("extension",function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(RegExp(".("+i+")$","i"))},jQuery.format("Please enter a value with a valid extension."));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.