1/** 2 * jQuery Validation Plugin 1.9.0 3 * 4 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 5 * http://docs.jquery.com/Plugins/Validation 6 * 7 * Copyright (c) 2006 - 2011 Jörn Zaefferer 8 * 9 * Dual licensed under the MIT and GPL licenses: 10 * http://www.opensource.org/licenses/mit-license.php 11 * http://www.gnu.org/licenses/gpl.html 12 */ 13(function(c) { 14 c 15 .extend( 16 c.fn, 17 { 18 validate : function(a) { 19 if (this.length) { 20 var b = c.data(this[0], "validator"); 21 if (b) 22 return b; 23 this.attr("novalidate", "novalidate"); 24 b = new c.validator(a, this[0]); 25 c.data(this[0], "validator", b); 26 if (b.settings.onsubmit) { 27 a = this.find("input, button"); 28 a.filter(".cancel").click(function() { 29 b.cancelSubmit = true 30 }); 31 b.settings.submitHandler 32 && a.filter(":submit").click(function() { 33 b.submitButton = this 34 }); 35 this.submit(function(d) { 36 function e() { 37 if (b.settings.submitHandler) { 38 if (b.submitButton) 39 var f = c("<input type='hidden'/>").attr("name", 40 b.submitButton.name).val(b.submitButton.value) 41 .appendTo(b.currentForm); 42 b.settings.submitHandler.call(b, b.currentForm); 43 b.submitButton && f.remove(); 44 return false 45 } 46 return true 47 } 48 b.settings.debug && d.preventDefault(); 49 if (b.cancelSubmit) { 50 b.cancelSubmit = false; 51 return e() 52 } 53 if (b.form()) { 54 if (b.pendingRequest) { 55 b.formSubmitted = true; 56 return false 57 } 58 return e() 59 } else { 60 b.focusInvalid(); 61 return false 62 } 63 }) 64 } 65 return b 66 } else 67 a 68 && a.debug 69 && window.console 70 && console 71 .warn("nothing selected, can't validate, returning nothing") 72 }, 73 valid : function() { 74 if (c(this[0]).is("form")) 75 return this.validate().form(); 76 else { 77 var a = true, b = c(this[0].form).validate(); 78 this.each(function() { 79 a &= b.element(this) 80 }); 81 return a 82 } 83 }, 84 removeAttrs : function(a) { 85 var b = {}, d = this; 86 c.each(a.split(/\s/), function(e, f) { 87 b[f] = d.attr(f); 88 d.removeAttr(f) 89 }); 90 return b 91 }, 92 rules : function(a, b) { 93 var d = this[0]; 94 if (a) { 95 var e = c.data(d.form, "validator").settings, f = e.rules, g = c.validator 96 .staticRules(d); 97 switch (a) { 98 case "add": 99 c.extend(g, c.validator.normalizeRule(b)); 100 f[d.name] = g; 101 if (b.messages) 102 e.messages[d.name] = c.extend(e.messages[d.name], 103 b.messages); 104 break; 105 case "remove": 106 if (!b) { 107 delete f[d.name]; 108 return g 109 } 110 var h = {}; 111 c.each(b.split(/\s/), function(j, i) { 112 h[i] = g[i]; 113 delete g[i] 114 }); 115 return h 116 } 117 } 118 d = c.validator.normalizeRules(c.extend({}, c.validator 119 .metadataRules(d), c.validator.classRules(d), c.validator 120 .attributeRules(d), c.validator.staticRules(d)), d); 121 if (d.required) { 122 e = d.required; 123 delete d.required; 124 d = c.extend({ 125 required : e 126 }, d) 127 } 128 return d 129 } 130 }); 131 c.extend(c.expr[":"], {
132 blank : function(a) { 133 return !c.trim("" + a.value) 134 }, 135 filled : function(a) { 136 return !!c.trim("" + a.value) 137 }, 138 unchecked : function(a) { 139 return !a.checked 140 } 141 }); 142 c.validator = function(a, b) { 143 this.settings = c.extend(true, {}, c.validator.defaults, a); 144 this.currentForm = b; 145 this.init() 146 }; 147 c.validator.format = function(a, b) { 148 if (arguments.length == 1) 149 return function() { 150 var d = c.makeArray(arguments); 151 d.unshift(a); 152 return c.validator.format.apply(this, d) 153 }; 154 if (arguments.length > 2 && b.constructor != Array) 155 b = c.makeArray(arguments).slice(1); 156 if (b.constructor != Array) 157 b = [ b ]; 158 c.each(b, function(d, e) { 159 a = a.replace(RegExp("\\{" + d + "\\}", "g"), e) 160 }); 161 return a 162 }; 163 c 164 .extend( 165 c.validator, 166 { 167 defaults : { 168 messages : {}, 169 groups : {}, 170 rules : {}, 171 errorClass : "error", 172 validClass : "valid", 173 errorElement : "label", 174 focusInvalid : true, 175 errorContainer : c([]), 176 errorLabelContainer : c([]), 177 onsubmit : true, 178 ignore : ":hidden", 179 ignoreTitle : false, 180 onfocusin : function(a) { 181 this.lastActive = a; 182 if (this.settings.focusCleanup && !this.blockFocusCleanup) { 183 this.settings.unhighlight 184 && this.settings.unhighlight.call(this, a, 185 this.settings.errorClass, this.settings.validClass); 186 this.addWrapper(this.errorsFor(a)).hide() 187 } 188 }, 189 onfocusout : function(a) { 190 if (!this.checkable(a) 191 && (a.name in this.submitted || !this.optional(a))) 192 this.element(a) 193 }, 194 onkeyup : function(a) { 195 if (a.name in this.submitted || a == this.lastElement) 196 this.element(a) 197 }, 198 onclick : function(a) { 199 if (a.name in this.submitted) 200 this.element(a); 201 else 202 a.parentNode.name in this.submitted 203 && this.element(a.parentNode) 204 }, 205 highlight : function(a, b, d) { 206 a.type === "radio" ? this.findByName(a.name).addClass(b) 207 .removeClass(d) : c(a).addClass(b).removeClass(d) 208 }, 209 unhighlight : function(a, b, d) { 210 a.type === "radio" ? this.findByName(a.name).removeClass(b) 211 .addClass(d) : c(a).removeClass(b).addClass(d) 212 } 213 }, 214 setDefaults : function(a) { 215 c.extend(c.validator.defaults, a) 216 }, 217 messages : { 218 required : "Ce champ est requis.", 219 remote : "Veuillez vérifier ce champs.", 220 email : "Veuillez entrer une adresse email valide.", 221 url : "Veuillez entrer une URL valide.", 222 date : "Veuillez entrer une date valide.", 223 dateISO : "Please enter a valid date (ISO).", 224 number : "Veuillez entrer un nombre.", 225 digits : "Veuillez entrer des chiffres.", 226 creditcard : "Please enter a valid credit card number.", 227 equalTo : "Veuillez entrer la même valeur à nouveau.", 228 accept : "Please enter a value with a valid extension.", 229 maxlength : c.validator 230 .format("Veuillez ne pas saisir plus de {0} caractères."), 231 minlength : c.validator 232 .format("Veuillez saisir un minimum de {0} caractères."), 233 rangelength : c.validator 234 .format("Veuillez saisir une valeur comprise entre {0} et {1} caractères de long."), 235 range : c.validator 236 .format("Veuillez entrer en valeur entre {0} et {1}."), 237 max : c.validator 238 .format("Veuillez saisir une valeur inférieure ou égale à {0}."), 239 min : c.validator 240 .format("Veuillez saisir une valeur supérieure ou égale à {0}.") 241 }, 242 autoCreateRanges : false, 243 prototype : { 244 init : function() { 245 function a(e) { 246 var f = c.data(this[0].form, "validator"), g = "on" 247 + e.type.replace(/^validate/, ""); 248 f.settings[g] && f.settings[g].call(f, this[0], e) 249 } 250 this.labelContainer = c(this.settings.errorLabelContainer); 251 this.errorContext = this.labelContainer.length 252 && this.labelContainer || c(this.currentForm); 253 this.containers = c(this.settings.errorContainer).add( 254 this.settings.errorLabelContainer); 255 this.submitted = {}; 256 this.valueCache = {}; 257 this.pendingRequest = 0; 258 this.pending = {}; 259 this.invalid = {}; 260 this.reset(); 261 var b = this.groups = {}; 262 c.each(this.settings.groups, function(e, f) { 263 c.each(f.split(/\s/), function(g, h) { 264 b[h] = e 265 }) 266 }); 267 var d = this.settings.rules; 268 c.each(d, function(e, f) { 269 d[e] = c.validator.normalizeRule(f) 270 }); 271 c(this.currentForm) 272 .validateDelegate( 273 "[type='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'] ", 274 "focusin focusout keyup", a).validateDelegate( 275 "[type='radio'], [type='checkbox'], select, option", 276 "click", a); 277 this.settings.invalidHandler 278 && c(this.currentForm).bind("invalid-form.validate", 279 this.settings.invalidHandler) 280 }, 281 form : function() { 282 this.checkForm(); 283 c.extend(this.submitted, this.errorMap); 284 this.invalid = c.extend({}, this.errorMap); 285 this.valid() 286 || c(this.currentForm).triggerHandler("invalid-form", 287 [ this ]); 288 this.showErrors(); 289 return this.valid() 290 }, 291 checkForm : function() { 292 this.prepareForm(); 293 for (var a = 0, b = this.currentElements = this.elements(); b[a]; a++) 294 this.check(b[a]); 295 return this.valid() 296 }, 297 element : function(a) { 298 this.lastElement = a = this.validationTargetFor(this.clean(a)); 299 this.prepareElement(a); 300 this.currentElements = c(a); 301 var b = this.check(a); 302 if (b) 303 delete this.invalid[a.name]; 304 else 305 this.invalid[a.name] = true; 306 if (!this.numberOfInvalids())
307 this.toHide = this.toHide.add(this.containers); 308 this.showErrors(); 309 return b 310 }, 311 showErrors : function(a) { 312 if (a) { 313 c.extend(this.errorMap, a); 314 this.errorList = []; 315 for ( var b in a) 316 this.errorList.push({ 317 message : a[b], 318 element : this.findByName(b)[0] 319 }); 320 this.successList = c.grep(this.successList, function(d) { 321 return !(d.name in a) 322 }) 323 } 324 this.settings.showErrors ? this.settings.showErrors.call(this, 325 this.errorMap, this.errorList) : this.defaultShowErrors() 326 }, 327 resetForm : function() { 328 c.fn.resetForm && c(this.currentForm).resetForm(); 329 this.submitted = {}; 330 this.lastElement = null; 331 this.prepareForm(); 332 this.hideErrors(); 333 this.elements().removeClass(this.settings.errorClass) 334 }, 335 numberOfInvalids : function() { 336 return this.objectLength(this.invalid) 337 }, 338 objectLength : function(a) { 339 var b = 0, d; 340 for (d in a) 341 b++; 342 return b 343 }, 344 hideErrors : function() { 345 this.addWrapper(this.toHide).hide() 346 }, 347 valid : function() { 348 return this.size() == 0 349 }, 350 size : function() { 351 return this.errorList.length 352 }, 353 focusInvalid : function() { 354 if (this.settings.focusInvalid) 355 try { 356 c( 357 this.findLastActive() || this.errorList.length 358 && this.errorList[0].element || []).filter( 359 ":visible").focus().trigger("focusin") 360 } catch (a) { 361 } 362 }, 363 findLastActive : function() { 364 var a = this.lastActive; 365 return a && c.grep(this.errorList, function(b) { 366 return b.element.name == a.name 367 }).length == 1 && a 368 }, 369 elements : function() { 370 var a = this, b = {}; 371 return c(this.currentForm).find("input, select, textarea").not( 372 ":submit, :reset, :image, [disabled]").not( 373 this.settings.ignore).filter( 374 function() { 375 !this.name && a.settings.debug && window.console 376 && console.error("%o has no name assigned", this); 377 if (this.name in b || !a.objectLength(c(this).rules())) 378 return false; 379 return b[this.name] = true 380 }) 381 }, 382 clean : function(a) { 383 return c(a)[0] 384 }, 385 errors : function() { 386 return c(this.settings.errorElement + "." 387 + this.settings.errorClass, this.errorContext) 388 }, 389 reset : function() { 390 this.successList = []; 391 this.errorList = []; 392 this.errorMap = {}; 393 this.toShow = c([]); 394 this.toHide = c([]); 395 this.currentElements = c([]) 396 }, 397 prepareForm : function() { 398 this.reset(); 399 this.toHide = this.errors().add(this.containers) 400 }, 401 prepareElement : function(a) { 402 this.reset(); 403 this.toHide = this.errorsFor(a) 404 }, 405 check : function(a) { 406 a = this.validationTargetFor(this.clean(a)); 407 var b = c(a).rules(), d = false, e; 408 for (e in b) { 409 var f = { 410 method : e, 411 parameters : b[e] 412 }; 413 try { 414 var g = c.validator.methods[e].call(this, a.value.replace( 415 /\r/g, ""), a, f.parameters); 416 if (g == "dependency-mismatch") 417 d = true; 418 else { 419 d = false;
420 if (g == "pending") { 421 this.toHide = this.toHide.not(this.errorsFor(a)); 422 return 423 } 424 if (!g) { 425 this.formatAndAdd(a, f); 426 return false 427 } 428 } 429 } catch (h) { 430 this.settings.debug 431 && window.console 432 && console.log( 433 "exception occured when checking element " + a.id 434 + ", check the '" + f.method + "' method", h); 435 throw h; 436 } 437 } 438 if (!d) { 439 this.objectLength(b) && this.successList.push(a); 440 return true 441 } 442 }, 443 customMetaMessage : function(a, b) { 444 if (c.metadata) { 445 var d = this.settings.meta ? c(a).metadata()[this.settings.meta] 446 : c(a).metadata(); 447 return d && d.messages && d.messages[b] 448 } 449 }, 450 customMessage : function(a, b) { 451 var d = this.settings.messages[a]; 452 return d && (d.constructor == String ? d : d[b]) 453 }, 454 findDefined : function() { 455 for (var a = 0; a < arguments.length; a++) 456 if (arguments[a] !== undefined) 457 return arguments[a] 458 }, 459 defaultMessage : function(a, b) { 460 return this.findDefined(this.customMessage(a.name, b), this 461 .customMetaMessage(a, b), !this.settings.ignoreTitle 462 && a.title || undefined, c.validator.messages[b], 463 "<strong>Warning: No message defined for " + a.name 464 + "</strong>") 465 }, 466 formatAndAdd : function(a, b) { 467 var d = this.defaultMessage(a, b.method), e = /\$?\{(\d+)\}/g; 468 if (typeof d == "function") 469 d = d.call(this, b.parameters, a); 470 else if (e.test(d)) 471 d = jQuery.format(d.replace(e, "{$1}"), b.parameters); 472 this.errorList.push({ 473 message : d, 474 element : a 475 }); 476 this.errorMap[a.name] = d; 477 this.submitted[a.name] = d 478 }, 479 addWrapper : function(a) { 480 if (this.settings.wrapper) 481 a = a.add(a.parent(this.settings.wrapper)); 482 return a 483 }, 484 defaultShowErrors : function() { 485 for (var a = 0; this.errorList[a]; a++) { 486 var b = this.errorList[a]; 487 this.settings.highlight 488 && this.settings.highlight.call(this, b.element, 489 this.settings.errorClass, this.settings.validClass); 490 this.showLabel(b.element, b.message) 491 } 492 if (this.errorList.length) 493 this.toShow = this.toShow.add(this.containers); 494 if (this.settings.success) 495 for (a = 0; this.successList[a]; a++) 496 this.showLabel(this.successList[a]); 497 if (this.settings.unhighlight) { 498 a = 0; 499 for (b = this.validElements(); b[a]; a++) 500 this.settings.unhighlight.call(this, b[a], 501 this.settings.errorClass, this.settings.validClass) 502 } 503 this.toHide = this.toHide.not(this.toShow); 504 this.hideErrors(); 505 this.addWrapper(this.toShow).show() 506 }, 507 validElements : function() { 508 return this.currentElements.not(this.invalidElements()) 509 }, 510 invalidElements : function() { 511 return c(this.errorList).map(function() { 512 return this.element 513 }) 514 }, 515 showLabel : function(a, b) { 516 var d = this.errorsFor(a); 517 if (d.length) { 518 d.removeClass(this.settings.validClass).addClass( 519 this.settings.errorClass); 520 d.attr("generated") && d.html(b) 521 } else { 522 d = c("<" + this.settings.errorElement + "/>").attr({ 523 "for" : this.idOrName(a), 524 generated : true 525 }).addClass(this.settings.errorClass).html(b || ""); 526 if (this.settings.wrapper) 527 d = d.hide().show() 528 .wrap("<" + this.settings.wrapper + "/>").parent(); 529 this.labelContainer.append(d).length 530 || (this.settings.errorPlacement ? this.settings 531 .errorPlacement(d, c(a)) : d.insertAfter(a)) 532 } 533 if (!b && this.settings.success) { 534 d.text(""); 535 typeof this.settings.success == "string" ? d 536 .addClass(this.settings.success) : this.settings 537 .success(d) 538 } 539 this.toShow = this.toShow.add(d) 540 }, 541 errorsFor : function(a) { 542 var b = this.idOrName(a); 543 return this.errors().filter(function() { 544 return c(this).attr("for") == b 545 }) 546 }, 547 idOrName : function(a) { 548 return this.groups[a.name] 549 || (this.checkable(a) ? a.name : a.id || a.name) 550 }, 551 validationTargetFor : function(a) { 552 if (this.checkable(a)) 553 a = this.findByName(a.name).not(this.settings.ignore)[0]; 554 return a 555 }, 556 checkable : function(a) { 557 return /radio|checkbox/i.test(a.type) 558 }, 559 findByName : function(a) { 560 var b = this.currentForm; 561 return c(document.getElementsByName(a)).map(function(d, e) { 562 return e.form == b && e.name == a && e || null 563 }) 564 }, 565 getLength : function(a, b) {
566 switch (b.nodeName.toLowerCase()) { 567 case "select": 568 return c("option:selected", b).length; 569 case "input": 570 if (this.checkable(b)) 571 return this.findByName(b.name).filter(":checked").length 572 } 573 return a.length 574 }, 575 depend : function(a, b) { 576 return this.dependTypes[typeof a] ? this.dependTypes[typeof a]( 577 a, b) : true 578 }, 579 dependTypes : { 580 "boolean" : function(a) { 581 return a 582 }, 583 string : function(a, b) { 584 return !!c(a, b.form).length 585 }, 586 "function" : function(a, b) { 587 return a(b) 588 } 589 }, 590 optional : function(a) { 591 return !c.validator.methods.required.call(this, 592 c.trim(a.value), a) 593 && "dependency-mismatch" 594 }, 595 startRequest : function(a) { 596 if (!this.pending[a.name]) { 597 this.pendingRequest++; 598 this.pending[a.name] = true 599 } 600 }, 601 stopRequest : function(a, b) { 602 this.pendingRequest--; 603 if (this.pendingRequest < 0) 604 this.pendingRequest = 0; 605 delete this.pending[a.name]; 606 if (b && this.pendingRequest == 0 && this.formSubmitted 607 && this.form()) { 608 c(this.currentForm).submit(); 609 this.formSubmitted = false 610 } else if (!b && this.pendingRequest == 0 && this.formSubmitted) { 611 c(this.currentForm).triggerHandler("invalid-form", [ this ]); 612 this.formSubmitted = false 613 } 614 }, 615 previousValue : function(a) { 616 return c.data(a, "previousValue") 617 || c.data(a, "previousValue", { 618 old : null, 619 valid : true, 620 message : this.defaultMessage(a, "remote") 621 }) 622 } 623 }, 624 classRuleSettings : { 625 required : { 626 required : true 627 }, 628 email : { 629 email : true 630 }, 631 url : { 632 url : true 633 }, 634 date : { 635 date : true 636 }, 637 dateISO : { 638 dateISO : true 639 }, 640 dateDE : { 641 dateDE : true 642 }, 643 number : { 644 number : true 645 }, 646 numberDE : { 647 numberDE : true 648 }, 649 digits : { 650 digits : true 651 }, 652 creditcard : { 653 creditcard : true 654 } 655 }, 656 addClassRules : function(a, b) { 657 a.constructor == String ? this.classRuleSettings[a] = b : c 658 .extend(this.classRuleSettings, a) 659 }, 660 classRules : function(a) { 661 var b = {}; 662 (a = c(a).attr("class")) 663 && c.each(a.split(" "), function() { 664 this in c.validator.classRuleSettings 665 && c.extend(b, c.validator.classRuleSettings[this]) 666 }); 667 return b 668 }, 669 attributeRules : function(a) { 670 var b = {}; 671 a = c(a); 672 for ( var d in c.validator.methods) { 673 var e; 674 if (e = d === "required" && typeof c.fn.prop === "function" ? a 675 .prop(d) : a.attr(d)) 676 b[d] = e; 677 else if (a[0].getAttribute("type") === d) 678 b[d] = true 679 } 680 b.maxlength && /-1|2147483647|524288/.test(b.maxlength) 681 && delete b.maxlength; 682 return b 683 }, 684 metadataRules : function(a) { 685 if (!c.metadata) 686 return {}; 687 var b = c.data(a.form, "validator").settings.meta; 688 return b ? c(a).metadata()[b] : c(a).metadata() 689 }, 690 staticRules : function(a) { 691 var b = {}, d = c.data(a.form, "validator"); 692 if (d.settings.rules) 693 b = c.validator.normalizeRule(d.settings.rules[a.name]) || {}; 694 return b 695 }, 696 normalizeRules : function(a, b) { 697 c.each(a, function(d, e) { 698 if (e === false) 699 delete a[d]; 700 else if (e.param || e.depends) { 701 var f = true; 702 switch (typeof e.depends) { 703 case "string": 704 f = !!c(e.depends, b.form).length; 705 break; 706 case "function": 707 f = e.depends.call(b, b) 708 } 709 if (f) 710 a[d] = e.param !== undefined ? e.param : true; 711 else 712 delete a[d] 713 } 714 }); 715 c.each(a, function(d, e) { 716 a[d] = c.isFunction(e) ? e(b) : e 717 }); 718 c.each([ "minlength", "maxlength", "min", "max" ], function() { 719 if (a[this]) 720 a[this] = Number(a[this]) 721 }); 722 c.each([ "rangelength", "range" ], function() { 723 if (a[this]) 724 a[this] = [ Number(a[this][0]), Number(a[this][1]) ] 725 }); 726 if (c.validator.autoCreateRanges) { 727 if (a.min && a.max) { 728 a.range = [ a.min, a.max ]; 729 delete a.min; 730 delete a.max 731 } 732 if (a.minlength && a.maxlength) { 733 a.rangelength = [ a.minlength, a.maxlength ]; 734 delete a.minlength; 735 delete a.maxlength 736 } 737 } 738 a.messages && delete a.messages; 739 return a 740 }, 741 normalizeRule : function(a) { 742 if (typeof a == "string") { 743 var b = {}; 744 c.each(a.split(/\s/), function() { 745 b[this] = true 746 }); 747 a = b 748 } 749 return a 750 }, 751 addMethod : function(a, b, d) { 752 c.validator.methods[a] = b; 753 c.validator.messages[a] = d != undefined ? d 754 : c.validator.messages[a]; 755 b.length < 3 756 && c.validator.addClassRules(a, c.validator.normalizeRule(a)) 757 }, 758 methods : { 759 required : function(a, b, d) { 760 if (!this.depend(d, b)) 761 return "dependency-mismatch";
762 switch (b.nodeName.toLowerCase()) { 763 case "select": 764 return (a = c(b).val()) && a.length > 0; 765 case "input": 766 if (this.checkable(b)) 767 return this.getLength(a, b) > 0; 768 default: 769 return c.trim(a).length > 0 770 } 771 }, 772 remote : function(a, b, d) { 773 if (this.optional(b)) 774 return "dependency-mismatch"; 775 var e = this.previousValue(b); 776 this.settings.messages[b.name] 777 || (this.settings.messages[b.name] = {}); 778 e.originalMessage = this.settings.messages[b.name].remote; 779 this.settings.messages[b.name].remote = e.message; 780 d = typeof d == "string" && { 781 url : d 782 } || d; 783 if (this.pending[b.name]) 784 return "pending"; 785 if (e.old === a) 786 return e.valid; 787 e.old = a; 788 var f = this; 789 this.startRequest(b); 790 var g = {}; 791 g[b.name] = a; 792 c.ajax(c.extend(true, { 793 url : d, 794 mode : "abort", 795 port : "validate" + b.name, 796 dataType : "json", 797 data : g, 798 success : function(h) { 799 f.settings.messages[b.name].remote = e.originalMessage; 800 var j = h === true; 801 if (j) { 802 var i = f.formSubmitted; 803 f.prepareElement(b); 804 f.formSubmitted = i; 805 f.successList.push(b); 806 f.showErrors() 807 } else { 808 i = {}; 809 h = h || f.defaultMessage(b, "remote"); 810 i[b.name] = e.message = c.isFunction(h) ? h(a) : h; 811 f.showErrors(i) 812 } 813 e.valid = j; 814 f.stopRequest(b, j) 815 } 816 }, d)); 817 return "pending" 818 }, 819 minlength : function(a, b, d) { 820 return this.optional(b) || this.getLength(c.trim(a), b) >= d 821 }, 822 maxlength : function(a, b, d) { 823 return this.optional(b) || this.getLength(c.trim(a), b) <= d 824 }, 825 rangelength : function(a, b, d) { 826 a = this.getLength(c.trim(a), b); 827 return this.optional(b) || a >= d[0] && a <= d[1] 828 }, 829 min : function(a, b, d) { 830 return this.optional(b) || a >= d 831 }, 832 max : function(a, b, d) { 833 return this.optional(b) || a <= d 834 }, 835 range : function(a, b, d) { 836 return this.optional(b) || a >= d[0] && a <= d[1] 837 }, 838 email : function(a, b) { 839 return this.optional(b) 840 || /^((([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 841 .test(a) 842 }, 843 url : function(a, b) { 844 return this.optional(b) 845 || /^(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 846 .test(a) 847 }, 848 date : function(a, b) { 849 return this.optional(b) || !/Invalid|NaN/.test(new Date(a)) 850 }, 851 dateISO : function(a, b) { 852 return this.optional(b) 853 || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a) 854 }, 855 number : function(a, b) { 856 return this.optional(b) 857 || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a) 858 }, 859 digits : function(a, b) { 860 return this.optional(b) || /^\d+$/.test(a) 861 }, 862 creditcard : function(a, b) { 863 if (this.optional(b)) 864 return "dependency-mismatch"; 865 if (/[^0-9 -]+/.test(a)) 866 return false;
867 var d = 0, e = 0, f = false; 868 a = a.replace(/\D/g, ""); 869 for (var g = a.length - 1; g >= 0; g--) { 870 e = a.charAt(g); 871 e = parseInt(e, 10); 872 if (f) 873 if ((e *= 2) > 9) 874 e -= 9; 875 d += e; 876 f = !f 877 } 878 return d % 10 == 0 879 }, 880 accept : function(a, b, d) { 881 d = typeof d == "string" ? d.replace(/,/g, "|") 882 : "png|jpe?g|gif"; 883 return this.optional(b) 884 || a.match(RegExp(".(" + d + ")$", "i")) 885 }, 886 equalTo : function(a, b, d) { 887 d = c(d).unbind(".validate-equalTo").bind( 888 "blur.validate-equalTo", function() { 889 c(b).valid() 890 }); 891 return a == d.val() 892 } 893 } 894 }); 895 c.format = c.validator.format 896})(jQuery); 897(function(c) { 898 var a = {}; 899 if (c.ajaxPrefilter) 900 c.ajaxPrefilter(function(d, e, f) { 901 e = d.port; 902 if (d.mode == "abort") { 903 a[e] && a[e].abort(); 904 a[e] = f 905 } 906 }); 907 else { 908 var b = c.ajax; 909 c.ajax = function(d) { 910 var e = ("port" in d ? d : c.ajaxSettings).port; 911 if (("mode" in d ? d : c.ajaxSettings).mode == "abort") { 912 a[e] && a[e].abort(); 913 return a[e] = b.apply(this, arguments) 914 } 915 return b.apply(this, arguments) 916 } 917 } 918})(jQuery); 919(function(c) { 920 !jQuery.event.special.focusin && !jQuery.event.special.focusout 921 && document.addEventListener && c.each({ 922 focus : "focusin", 923 blur : "focusout" 924 }, function(a, b) { 925 function d(e) { 926 e = c.event.fix(e); 927 e.type = b; 928 return c.event.handle.call(this, e) 929 } 930 c.event.special[b] = { 931 setup : function() { 932 this.addEventListener(a, d, true) 933 }, 934 teardown : function() { 935 this.removeEventListener(a, d, true) 936 }, 937 handler : function(e) { 938 arguments[0] = c.event.fix(e); 939 arguments[0].type = b; 940 return c.event.handle.apply(this, arguments) 941 } 942 } 943 }); 944 c.extend(c.fn, { 945 validateDelegate : function(a, b, d) { 946 return this.bind(b, function(e) { 947 var f = c(e.target); 948 if (f.is(a)) 949 return d.apply(f, arguments) 950 }) 951 } 952 }) 953})(jQuery);
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.