PageSourceSearch

https://www.lofficielducycle.com/sites/default/files/js/js_mxSdPTCMWKWBHUB7u7Js1-ffVep-8GB-4NLVe31f0gY.js

js lofficielducycle.com collected 2026-10-02 19:47:17 UTC 48,464 bytes, 1,351 lines download raw bytes

1Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n>1)); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Une erreur HTTP AJAX s\u0027est produite.","HTTP Result Code: !status":"Code de statut HTTP : !status","An AJAX HTTP request terminated abnormally.":"Une requ\u00eate HTTP AJAX s\u0027est termin\u00e9e anormalement.","Debugging information follows.":"Informations de d\u00e9bogage ci-dessous.","Path: !uri":"Chemin : !uri","StatusText: !statusText":"StatusText: !statusText","ResponseText: !responseText":"ResponseText : !responseText","ReadyState: !readyState":"ReadyState : !readyState","Hide":"Masquer","Show":"Afficher","Re-order rows by numerical weight instead of dragging.":"R\u00e9-ordonner les lignes avec des poids num\u00e9riques plut\u00f4t qu\u0027en les d\u00e9pla\u00e7ant.","Show row weights":"Afficher le poids des lignes","Hide row weights":"Cacher le poids des lignes","Drag to re-order":"Cliquer-d\u00e9poser pour r\u00e9-organiser","Changes made in this table will not be saved until the form is submitted.":"Les changements effectu\u00e9s dans ce tableau ne seront pris en compte que lorsque la configuration aura \u00e9t\u00e9 enregistr\u00e9e.","(active tab)":"(onglet actif)","Wed":"mer","Wednesday":"Mercredi","Edit":"Modifier","Requires a title":"Titre obligatoire","Not published":"Non publi\u00e9","Don\u0027t display post information":"Ne pas afficher les informations de la contribution","Thu":"jeu","Thursday":"Jeudi","Sunday":"Dimanche","Monday":"Lundi","Tuesday":"Mardi","Friday":"Vendredi","Saturday":"Samedi","Jun":"juin","Configure":"Configurer","Feb":"f\u00e9v","May":"mai","Oct":"oct","Apr":"avr","Aug":"ao\u00fb","Mar":"mar","None":"Aucun(e)","Next":"Suivant","All":"Tout","Done":"Termin\u00e9","Prev":"Pr\u00e9c.","Mon":"lun","Tue":"mar","Fri":"ven","Sat":"sam","Sun":"dim","January":"janvier","February":"F\u00e9vrier","March":"mars","April":"avril","June":"juin","July":"juillet","August":"ao\u00fbt","September":"septembre","October":"octobre","November":"novembre","December":"d\u00e9cembre","Select all rows in this table":"S\u00e9lectionner toutes les lignes du tableau","Deselect all rows in this table":"D\u00e9s\u00e9lectionner toutes les lignes du tableau","Today":"Aujourd\u0027hui","Jan":"jan","Jul":"juil","Sep":"sep","Nov":"nov","Dec":"d\u00e9c","Su":"Di","Mo":"Lu","Tu":"Ma","We":"Me","Th":"Je","Fr":"Ve","Sa":"Sa","Please wait...":"Veuillez patienter...","mm\/dd\/yy":"dd\/mm\/yy","By @name on @date":"Par @name le @date","By @name":"Par @name","Not in menu":"Pas dans le menu","Alias: @alias":"Alias : @alias","No alias":"Aucun alias","New revision":"Nouvelle r\u00e9vision","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"N\u0027oubliez pas de cliquer sur \u003Cem\u003EEnregistrer les blocs\u003C\/em\u003E pour confirmer les modifications apport\u00e9es ici.","This permission is inherited from the authenticated user role.":"Ce droit est h\u00e9rit\u00e9e du r\u00f4le de l\u0027utilisateur authentifi\u00e9.","No revision":"Aucune r\u00e9vision","Not restricted":"Non restreint","Not customizable":"Non personnalisable","Restricted to certain pages":"R\u00e9serv\u00e9 \u00e0 certaines pages","The block cannot be placed in this region.":"Le bloc ne peut pas \u00eatre plac\u00e9 dans cette r\u00e9gion.","Hide summary":"Masquer le r\u00e9sum\u00e9","Edit summary":"Modifier le r\u00e9sum\u00e9","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"Le fichier s\u00e9lectionn\u00e9 %filename ne peut pas \u00eatre transf\u00e9r\u00e9. Seulement les fichiers avec les extensions suivantes sont permis : %extensions.","Autocomplete popup":"Popup d\u0027auto-compl\u00e9tion","Searching for matches...":"Recherche de correspondances...","Automatic alias":"Alias automatique","Available tokens":"Jetons (tokens) disponibles","Insert this token into your form":"Ins\u00e9rer ce jeton (\u003Cem\u003Etoken\u003C\/em\u003E) dans votre formulaire","First click a text field to insert your tokens into.":"Cliquez d\u0027abord sur un champ de texte pour ins\u00e9rer vos jetons (\u003Cem\u003Etokens\u003C\/em\u003E) dans celui -ci.","Loading token browser...":"Chargement de l\u0027explorateur de jetons...","Also allow !name role to !permission?":"Autoriser \u00e9galement le r\u00f4le !name \u00e0 !permission ?","Recent":"R\u00e9cent","New":"Nouveau","Ignored from settings":"Ignor\u00e9 volontairement","No results":"Aucun r\u00e9sultat","clear":"effacer","@enabled of @total":"@enabled sur @total","Sc
1heduled for publishing":"Planifi\u00e9 pour publication","Scheduled for unpublishing":"Planifi\u00e9 pour d\u00e9publication","Not scheduled":"Non planifi\u00e9","Publishing enabled":"Publication activ\u00e9e","Unpublishing enabled":"D\u00e9publication activ\u00e9e","Open file browser":"Ouvrir le navigateur de fichiers","Inclusion: @value":"Inclusion : @value","Priority: @value":"Priorit\u00e9 : @value","@label: @value":"@label: @value","Using defaults":"Utiliser les param\u00e8tres par d\u00e9faut.","Upload file":"Transf\u00e9rer le fichier","CustomMessage: !customMessage":"Message personalis\u00e9 : !customMessage","The response failed verification so will not be processed.":"La v\u00e9rification de la r\u00e9ponse a \u00e9chou\u00e9, elle ne sera pas trait\u00e9e.","The callback URL is not local and not trusted: !url":"L\u0027URL de retour n\u0027est pas locale et n\u0027est pas de confiance : !url"}} };;
2(function ($) {
3
4  Drupal.behaviors.captcha = {
5    attach: function (context) {
6
7      // Turn off autocompletion for the CAPTCHA response field.
8      // We do it here with JavaScript (instead of directly in the markup)
9      // because this autocomplete attribute is not standard and
10      // it would break (X)HTML compliance.
11      $("#edit-captcha-response").attr("autocomplete", "off");
12
13    }
14  };
15
16  Drupal.behaviors.captchaAdmin = {
17    attach: function (context) {
18      // Add onclick handler to checkbox for adding a CAPTCHA description
19      // so that the textfields for the CAPTCHA description are hidden
20      // when no description should be added.
21      // @todo: div.form-item-captcha-description depends on theming, maybe
22      // it's better to add our own wrapper with id (instead of a class).
23      $("#edit-captcha-add-captcha-description").click(function() {
24        if ($("#edit-captcha-add-captcha-description").is(":checked")) {
25          // Show the CAPTCHA description textfield(s).
26          $("div.form-item-captcha-description").show('slow');
27        }
28        else {
29          // Hide the CAPTCHA description textfield(s).
30          $("div.form-item-captcha-description").hide('slow');
31        }
32      });
33      // Hide the CAPTCHA description textfields if option is disabled on page load.
34      if (!$("#edit-captcha-add-captcha-description").is(":checked")) {
35        $("div.form-item-captcha-description").hide();
36      }
37    }
38
39  };
40
41})(jQuery);
42;
43jQuery(function($) {
44    var checked = false;
45
46    $('.btn_login_not_subscriber').on('click', function(e) {
47       e.preventDefault();
48
49       $(this).closest('form').find('.form-item, .form-actions, ul, input[name="name"], input[name="pass"], input[type="submit"]').show();
50        $(this).closest('form').find('.btn_login_not_subscriber, .btn_login_subscriber').hide();
51
52       return false;
53    });
54
55    $('.btn_login_subscriber').on('click', function(e) {
56        e.preventDefault();
57        location.href = "/sso-auth/start";
58
59        return false;
60    });
61
62    $('#user-login, #user-login-form').keypress(function(e) {
63        if (e.which == 13) {
64            e.preventDefault();
65            $(this).find('input[type="submit"]:last').click();
66        }
67    });
68
69
70    $('#user-login, #user-login-form').on('submit', function(e) {
71        var form = $(this);
72        var username = form.find('input[name="name"]').val();
73        var password = form.find('input[name="pass"]').val();
74
75        if (username == '' || password == '') {
76            e.preventDefault();
77
78            $('#alert-modal')
79                .find('.modal-title').html('Erreur de saisie').end()
80                .find('.modal-body').html('<p>Merci de renseigner votre identifiant et votre mot de passe.</p>').end()
81                .modal('show');
82        } else if (username != '' && password != '' && !checked) {
83            e.preventDefault();
84
85            // On récupère le login afin de vérifier si un utilisateur est déja connecté avec ce compte
86            $.post('/users/connectionstatus', {username: username})
87             .done(function(data) {
88                if (data.status == 'logged') {
89                    // Il y'a déja un utilisateur connecté, on demande confirmation
90                    if (confirm("Votre compte n’autorise pas plusieurs connexions simultanées. Voulez-vous forcer la connexion et déconnecter l’utilisateur courant de ce compte ?")) {
91                        checked = true;
92                        form[0].submit();
93                    }
94                } else if (data.status == 'away' || data.status == 'multiple') {
95                    // Personne n'est connecté avec ce compte ou il a le droit a la multiconnexion, on laisse passer
96                    checked = true;
97                    form[0].submit();
98                }
99            })
100            .fail(function() {
101                alert('Impossible de vérifier la connexion, merci de réessayer.')
102            });
103        }
104    });
105});
106;
107(function ($) {
108  Drupal.behaviors.motorCoreBehavior = {
109    attach: function (context) {
110      $(document).bind('clientsideValidationAddCustomRules', function(event) {
111        jQuery.validator.addMethod("checkSIRET", function(value, element, param) {
112          if (jQuery('#edit-field-pays-und').val() !== 'FR') {
113            return true;
114          }
115
116          if (value.length != 14) {
117              return false;
118          }
119
120          return luhn_validate(value);
121        }, jQuery.format("Le numéro de SIRET n'est pas valide"));
122      });
123    }
124  };
125
126  var luhn_validate = function(siret){
127    return !/^\d+$/.test(siret) || (siret.split('').reduce(function(sum, d, n) {
128      return n===(siret.length-1) ? 0 : sum + parseInt((n%2)? d: [0,2,4,6,8,1,3,5,7,9][d]);
129    }, 0)) % 10 == 0;
130  };
131})(jQuery);
132;
133/**
134 * jQuery Validation Plugin 1.11.0pre
135 *
136 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
137 * http://docs.jquery.com/Plugins/Validation
138 *
139 * Copyright (c) 2012 Jörn Zaefferer
140 *
141 * Dual licensed under the MIT and GPL licenses:
142 *   http://www.opensource.org/licenses/mit-license.php
143 *   http://www.gnu.org/licenses/gpl.html
144 */
145
146(function($) {
147
148$.extend($.fn, {
149	// http://docs.jquery.com/Plugins/Validation/validate
150	validate: function( options ) {
151
152		// if nothing is selected, return nothing; can't chain anyway
153		if (!this.length) {
154			if (options && options.debug && window.console) {
155				console.warn( "nothing selected, can't validate, returning nothing" );
156			}
157			return;
158		}
159
160		// check if a validator for this form was already created
161		var validator = $.data(this[0], 'validator');
162		if ( validator ) {
163			return validator;
164		}
165
166		// Add novalidate tag if HTML5.
167		this.attr('novalidate', 'novalidate');
168
169		validator = new $.validator( options, this[0] );
170		$.data(this[0], 'validator', validator);
171
172		if ( validator.settings.onsubmit ) {
173
174			this.validateDelegate( ":submit", "click", function(ev) {
175				if ( validator.settings.submitHandler ) {
176					validator.submitButton = ev.target;
177				}
178				// allow suppressing validation by adding a cancel class to the submit button
179				if ( $(ev.target).hasClass('cancel') ) {
180					validator.cancelSubmit = true;
181				}
182			});
183
184			// validate the form on submit
185			this.submit( function( event ) {
186				if ( validator.settings.debug ) {
187					// prevent form submit to be able to see console output
188					event.preventDefault();
189				}
190				function handle() {
191					var hidden;
192					if ( validator.settings.submitHandler ) {
193						if (validator.submitButton) {
194							// insert a hidden input as a replacement for the missing submit button
195							hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
196						}
197						validator.settings.submitHandler.call( validator, validator.currentForm, event );
198						if (validator.submitButton) {
199							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
200							hidden.remove();
201						}
202						return false;
203					}
204					return true;
205				}
206
207				// prevent submit for invalid forms or custom submit handlers
208				if ( validator.cancelSubmit ) {
209					validator.cancelSubmit = false;
210					return handle();
211				}
212				if ( validator.form() ) {
213					if ( validator.pendingRequest ) {
214						validator.formSubmitted = true;
215						return false;
216					}
217					return handle();
218				} else {
219					validator.focusInvalid();
220					return false;
221				}
222			});
223		}
224
225		return validator;
226	},
227	// http://docs.jquery.com/Plugins/Validation/valid
228	valid: function() {
229		if ( $(this[0]).is('form')) {
230			return this.validate().form();
231		} else {
232			var valid = true;
233			var validator = $(this[0].form).validate();
234			this.each(function() {
235				valid &= validator.element(this);
236			});
237			return valid;
238		}
239	},
240	// attributes: space seperated list of attributes to retrieve and remove
241	removeAttrs: function(attributes) {
242		var result = {},
243			$element = this;
244		$.each(attributes.split(/\s/), function(index, value) {
245			result[value] = $element.attr(value);
246			$element.removeAttr(value);
247		});
248		return result;
249	},
250	// http://docs.jquery.com/Plugins/Validation/rules
251	rules: function(command, argument) {
252		var element = this[0];
253
254		if (command) {
255			var settings = $.data(element.form, 'validator').settings;
256			var staticRules = settings.rules;
257			var existingRules = $.validator.staticRules(element);
258			switch(command) {
259			case "add":
260				$.extend(existingRules, $.validator.normalizeRule(argument));
261				staticRules[element.name] = existingRules;
262				if (argument.messages) {
263					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
264				}
265				break;
266			case "remove":
267				if (!argument) {
268					delete staticRules[element.name];
269					return existingRules;
270				}
271				var filtered = {};
272				$.each(argument.split(/\s/), function(index, method) {
273					filtered[method] = existingRules[method];
274					delete existingRules[method];
275				});
276				return filtered;
277			}
278		}
279
280		var data = $.validator.normalizeRules(
281		$.extend(
282			{},
283			$.validator.classRules(element),
284			$.validator.attributeRules(element),
285			$.validator.dataRules(element),
286			$.validator.staticRules(element)
287		), element);
288
289		// make sure required is at front
290		if (data.required) {
291			var param = data.required;
292			delete data.required;
293			data = $.extend({required: param}, data);
294		}
295
296		return data;
297	}
298});
299
300// Custom selectors
301$.extend($.expr[":"], {
302	// http://docs.jquery.com/Plugins/Validation/blank
303	blank: function(a) {return !$.trim("" + a.value);},
304	// http://docs.jquery.com/Plugins/Validation/filled
305	filled: function(a) {return !!$.trim("" + a.value);},
306	// http://docs.jquery.com/Plugins/Validation/unchecked
307	unchecked: function(a) {return !a.checked;}
308});
309
310// constructor for validator
311$.validator = function( options, form ) {
312	this.settings = $.extend( true, {}, $.validator.defaults, options );
313	this.currentForm = form;
314	this.init();
315};
316
317$.validator.format = function(source, params) {
318	if ( arguments.length === 1 ) {
319		return function() {
320			var args = $.makeArray(arguments);
321			args.unshift(source);
322			return $.validator.format.apply( this, args );
323		};
324	}
325	if ( arguments.length > 2 && params.constructor !== Array  ) {
326		params = $.makeArray(arguments).slice(1);
327	}
328	if ( params.constructor !== Array ) {
329		params = [ params ];
330	}
331	$.each(params, function(i, n) {
332		source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
333	});
334	return source;
335};
336
337$.extend($.validator, {
338
339	defaults: {
340		messages: {},
341		groups: {},
342		rules: {},
343		errorClass: "error",
344		validClass: "valid",
345		errorElement: "label",
346		focusInvalid: true,
347		errorContainer: $( [] ),
348		errorLabelContainer: $( [] ),
349		onsubmit: true,
350		ignore: ":hidden",
351		ignoreTitle: false,
352		onfocusin: function(element, event) {
353			this.lastActive = element;
354
355			// hide error label and remove error class on focus if enabled
356			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
357				if ( this.settings.unhighlight ) {
358					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
359				}
360				this.addWrapper(this.errorsFor(element)).hide();
361			}
362		},
363		onfocusout: function(element, event) {
364			if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
365				this.element(element);
366			}
367		},
368		onkeyup: function(element, event) {
369			if ( event.which === 9 && this.elementValue(element) === '' ) {
370				return;
371			} else if ( element.name in this.submitted || element === this.lastElement ) {
372				this.element(element);
373			}
374		},
375		onclick: function(element, event) {
376			// click on selects, radiobuttons and checkboxes
377			if ( element.name in this.submitted ) {
378				this.element(element);
379			}
380			// or option elements, check parent select in that case
381			else if (element.parentNode.name in this.submitted) {
382				this.element(element.parentNode);
383			}
384		},
385		highlight: function(element, errorClass, validClass) {
386			if (element.type === 'radio') {
387				this.findByName(element.name).addClass(errorClass).removeClass(validClass);
388			} else {
389				$(element).addClass(errorClass).removeClass(validClass);
390			}
391		},
392		unhighlight: function(element, errorClass, validClass) {
393			if (element.type === 'radio') {
394				this.findByName(element.name).removeClass(errorClass).addClass(validClass);
395			} else {
396				$(element).removeClass(errorClass).addClass(validClass);
397			}
398		}
399	},
400
401	// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
402	setDefaults: function(settings) {
403		$.extend( $.validator.defaults, settings );
404	},
405
406	messages: {
407		required: "This field is required.",
408		remote: "Please fix this field.",
409		email: "Please enter a valid email address.",
410		url: "Please enter a valid URL.",
411		date: "Please enter a valid date.",
412		dateISO: "Please enter a valid date (ISO).",
413		number: "Please enter a valid number.",
414		digits: "Please enter only digits.",
415		creditcard: "Please enter a valid credit card number.",
416		equalTo: "Please enter the same value again.",
417		maxlength: $.validator.format("Please enter no more than {0} characters."),
418		minlength: $.validator.format("Please enter at least {0} characters."),
419		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
420		range: $.validator.format("Please enter a value between {0} and {1}."),
421		max: $.validator.format("Please enter a value less than or equal to {0}."),
422		min: $.validator.format("Please enter a value greater than or equal to {0}.")
423	},
424
425	autoCreateRanges: false,
426
427	prototype: {
428
429		init: function() {
430			this.labelContainer = $(this.settings.errorLabelContainer);
431			this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
432			this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
433			this.submitted = {};
434			this.valueCache = {};
435			this.pendingRequest = 0;
436			this.pending = {};
437			this.invalid = {};
438			this.reset();
439
440			var groups = (this.groups = {});
441			$.each(this.settings.groups, function(key, value) {
442				if (typeof value === "string") {
443					value = value.split(/\s/);
444				}
445				$.each(value, function(index, name) {
446					groups[name] = key;
447				});
448			});
449			var rules = this.settings.rules;
450			$.each(rules, function(key, value) {
451				rules[key] = $.validator.normalizeRule(value);
452			});
453
454			function delegate(event) {
455				var validator = $.data(this[0].form, "validator"),
456					eventType = "on" + event.type.replace(/^validate/, "");
457				if (validator.settings[eventType]) {
458          validator.settings['name_event'] = eventType;
459					validator.settings[eventType].call(validator, this[0], event);
460				}
461			}
462			$(this.currentForm)
463				.validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
464					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
465					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
466					"[type='week'], [type='time'], [type='datetime-local'], " +
467					"[type='range'], [type='color'] ",
468					"focusin focusout keyup", delegate)
469				.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
470
471			if (this.settings.invalidHandler) {
472				$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
473			}
474		},
475
476		// http://docs.jquery.com/Plugins/Validation/Validator/form
477		form: function() {
478			this.checkForm();
479			$.extend(this.submitted, this.errorMap);
480			this.invalid = $.extend({}, this.errorMap);
481			if (!this.valid()) {
482				$(this.currentForm).triggerHandler("invalid-form", [this]);
483			}
484			this.showErrors();
485			return this.valid();
486		},
487
488		checkForm: function() {
489			this.prepareForm();
490			for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
491				this.check( elements[i] );
492			}
493			return this.valid();
494		},
495
496		// http://docs.jquery.com/Plugins/Validation/Validator/element
497		element: function( element ) {
498			element = this.validationTargetFor( this.clean( element ) );
499			this.lastElement = element;
500			this.prepareElement( element );
501			this.currentElements = $(element);
502			var result = this.check( element ) !== false;
503			if (result) {
504				delete this.invalid[element.name];
505			} else {
506				this.invalid[element.name] = true;
507			}
508			if ( !this.numberOfInvalids() ) {
509				// Hide error containers on last error
510				this.toHide = this.toHide.add( this.containers );
511			}
512			this.showErrors();
513			return result;
514		},
515
516		// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
517		showErrors: function(errors) {
518			if(errors) {
519				// add items to error list and map
520				$.extend( this.errorMap, errors );
521				this.errorList = [];
522				for ( var name in errors ) {
523					this.errorList.push({
524						message: errors[name],
525						element: this.findByName(name)[0]
526					});
527				}
528				// remove items from success list
529				this.successList = $.grep( this.successList, function(element) {
530					return !(element.name in errors);
531				});
532			}
533			if (this.settings.showErrors) {
534				this.settings.showErrors.call( this, this.errorMap, this.errorList );
535			} else {
536				this.defaultShowErrors();
537			}
538		},
539
540		// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
541		resetForm: function() {
542			if ( $.fn.resetForm ) {
543				$( this.currentForm ).resetForm();
544			}
545			this.submitted = {};
546			this.lastElement = null;
547			this.prepareForm();
548			this.hideErrors();
549			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
550		},
551
552		numberOfInvalids: function() {
553			return this.objectLength(this.invalid);
554		},
555
556		objectLength: function( obj ) {
557			var count = 0;
558			for ( var i in obj ) {
559				count++;
560			}
561			return count;
562		},
563
564		hideErrors: function() {
565			this.addWrapper( this.toHide ).hide();
566		},
567
568		valid: function() {
569			return this.size() === 0;
570		},
571
572		size: function() {
573			return this.errorList.length;
574		},
575
576		focusInvalid: function() {
577			if( this.settings.focusInvalid ) {
578				try {
579					$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
580					.filter(":visible")
581					.focus()
582					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
583					.trigger("focusin");
584				} catch(e) {
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")
604			.not(":submit, :reset, :image, [disabled]")
605			.not( this.settings.ignore )
606			.filter(function() {
607				if ( !this.name && validator.settings.debug && window.console ) {
608					console.error( "%o has no name assigned", this);
609				}
610
611				// select only the first element for each name, and only those with rules specified
612				if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
613					return false;
614				}
615
616				rulesCache[this.name] = true;
617				return true;
618			});
619		},
620
621		clean: function( selector ) {
622			return $( selector )[0];
623		},
624
625		errors: function() {
626			var errorClass = this.settings.errorClass.replace(' ', '.');
627			return $( this.settings.errorElement + "." + errorClass, this.errorContext );
628		},
629
630		reset: function() {
631			this.successList = [];
632			this.errorList = [];
633			this.errorMap = {};
634			this.toShow = $([]);
635			this.toHide = $([]);
636			this.currentElements = $([]);
637		},
638
639		prepareForm: function() {
640			this.reset();
641			this.toHide = this.errors().add( this.containers );
642		},
643
644		prepareElement: function( element ) {
645			this.reset();
646			this.toHide = this.errorsFor(element);
647		},
648
649		elementValue: function( element ) {
650			var type = $(element).attr('type'),
651				val = $(element).val();
652
653			if ( type === 'radio' || type === 'checkbox' ) {
654				return $('input[name="' + $(element).attr('name') + '"]:checked').val();
655			}
656
657			if ( typeof val === 'string' ) {
658				return val.replace(/\r/g, "");
659			}
660			return val;
661		},
662
663		check: function( element ) {
664			element = this.validationTargetFor( this.clean( element ) );
665
666			var rules = $(element).rules();
667			var dependencyMismatch = false;
668			var val = this.elementValue(element);
669			var result;
670
671			for (var method in rules ) {
672				var rule = { method: method, parameters: rules[method] };
673				try {
674
675					result = $.validator.methods[method].call( this, val, element, rule.parameters );
676
677					// if a method indicates that the field is optional and therefore valid,
678					// don't mark it as valid when there are no other rules
679					if ( result === "dependency-mismatch" ) {
680						dependencyMismatch = true;
681						continue;
682					}
683					dependencyMismatch = false;
684
685					if ( result === "pending" ) {
686						this.toHide = this.toHide.not( this.errorsFor(element) );
687						return;
688					}
689
690					if( !result ) {
691						this.formatAndAdd( element, rule );
692						return false;
693					}
694				} catch(e) {
695					if ( this.settings.debug && window.console ) {
696						console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e);
697					}
698					throw e;
699				}
700			}
701			if (dependencyMismatch) {
702				return;
703			}
704			if ( this.objectLength(rules) ) {
705				this.successList.push(element);
706			}
707			return true;
708		},
709
710		// return the custom message for the given element and validation method
711		// specified in the element's HTML5 data attribute
712		customDataMessage: function(element, method) {
713			return $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase()));
714		},
715
716		// return the custom message for the given element name and validation method
717		customMessage: function( name, method ) {
718			var m = this.settings.messages[name];
719			return m && (m.constructor === String ? m : m[method]);
720		},
721
722		// return the first defined argument, allowing empty strings
723		findDefined: function() {
724			for(var i = 0; i < arguments.length; i++) {
725				if (arguments[i] !== undefined) {
726					return arguments[i];
727				}
728			}
729			return undefined;
730		},
731
732		defaultMessage: function( element, method) {
733			return this.findDefined(
734				this.customMessage( element.name, method ),
735				this.customDataMessage( element, method ),
736				// title is never undefined, so handle empty string as undefined
737				!this.settings.ignoreTitle && element.title || undefined,
738				$.validator.messages[method],
739				"<strong>Warning: No message defined for " + element.name + "</strong>"
740			);
741		},
742
743		formatAndAdd: function( element, rule ) {
744			var message = this.defaultMessage( element, rule.method ),
745				theregex = /\$?\{(\d+)\}/g;
746			if ( typeof message === "function" ) {
747				message = message.call(this, rule.parameters, element);
748			} else if (theregex.test(message)) {
749				message = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters);
750			}
751			this.errorList.push({
752				message: message,
753				element: element
754			});
755
756			this.errorMap[element.name] = message;
757			this.submitted[element.name] = message;
758		},
759
760		addWrapper: function(toToggle) {
761			if ( this.settings.wrapper ) {
762				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
763			}
764			return toToggle;
765		},
766
767		defaultShowErrors: function() {
768			var i, elements;
769			for ( i = 0; this.errorList[i]; i++ ) {
770				var error = this.errorList[i];
771				if ( this.settings.highlight ) {
772					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.val
772idClass );
773				}
774				this.showLabel( error.element, error.message );
775			}
776			if( this.errorList.length ) {
777				this.toShow = this.toShow.add( this.containers );
778			}
779			if (this.settings.success) {
780				for ( i = 0; this.successList[i]; i++ ) {
781					this.showLabel( this.successList[i] );
782				}
783			}
784			if (this.settings.unhighlight) {
785				for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
786					this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
787				}
788			}
789			this.toHide = this.toHide.not( this.toShow );
790			this.hideErrors();
791			this.addWrapper( this.toShow ).show();
792		},
793
794		validElements: function() {
795			return this.currentElements.not(this.invalidElements());
796		},
797
798		invalidElements: function() {
799			return $(this.errorList).map(function() {
800				return this.element;
801			});
802		},
803
804		showLabel: function(element, message) {
805			var label = this.errorsFor( element );
806			if ( label.length ) {
807				// refresh error/success class
808				label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
809
810				// check if we have a generated label, replace the message then
811				if ( label.attr("generated") ) {
812					label.html(message);
813				}
814			} else {
815				// create label
816				label = $("<" + this.settings.errorElement + "/>")
817					.attr({"for":  this.idOrName(element), generated: true})
818					.addClass(this.settings.errorClass)
819					.html(message || "");
820				if ( this.settings.wrapper ) {
821					// make sure the element is visible, even in IE
822					// actually showing the wrapped element is handled elsewhere
823					label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
824				}
825				if ( !this.labelContainer.append(label).length ) {
826					if ( this.settings.errorPlacement ) {
827						this.settings.errorPlacement(label, $(element) );
828					} else {
829						label.insertAfter(element);
830					}
831				}
832			}
833			if ( !message && this.settings.success ) {
834				label.text("");
835				if ( typeof this.settings.success === "string" ) {
836					label.addClass( this.settings.success );
837				} else {
838					this.settings.success( label, element );
839				}
840			}
841			this.toShow = this.toShow.add(label);
842		},
843
844		errorsFor: function(element) {
845			var name = this.idOrName(element);
846			return this.errors().filter(function() {
847				return $(this).attr('for') === name;
848			});
849		},
850
851		idOrName: function(element) {
852			return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
853		},
854
855		validationTargetFor: function(element) {
856			// if radio/checkbox, validate first element in group instead
857			if (this.checkable(element)) {
858				element = this.findByName( element.name ).not(this.settings.ignore)[0];
859			}
860			return element;
861		},
862
863		checkable: function( element ) {
864			return (/radio|checkbox/i).test(element.type);
865		},
866
867		findByName: function( name ) {
868			return $(this.currentForm).find('[name="' + name + '"]');
869		},
870
871		getLength: function(value, element) {
872			switch( element.nodeName.toLowerCase() ) {
873			case 'select':
874				return $("option:selected", element).length;
875			case 'input':
876				if( this.checkable( element) ) {
877					return this.findByName(element.name).filter(':checked').length;
878				}
879			}
880			return value.length;
881		},
882
883		depend: function(param, element) {
884			return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
885		},
886
887		dependTypes: {
888			"boolean": function(param, element) {
889				return param;
890			},
891			"string": function(param, element) {
892				return !!$(param, element.form).length;
893			},
894			"function": function(param, element) {
895				return param(element);
896			}
897		},
898
899		optional: function(element) {
900			var val = this.elementValue(element);
901			return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
902		},
903
904		startRequest: function(element) {
905			if (!this.pending[element.name]) {
906				this.pendingRequest++;
907				this.pending[element.name] = true;
908			}
909		},
910
911		stopRequest: function(element, valid) {
912			this.pendingRequest--;
913			// sometimes synchronization fails, make sure pendingRequest is never < 0
914			if (this.pendingRequest < 0) {
915				this.pendingRequest = 0;
916			}
917			delete this.pending[element.name];
918			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
919				$(this.currentForm).submit();
920				this.formSubmitted = false;
921			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
922				$(this.currentForm).triggerHandler("invalid-form", [this]);
923				this.formSubmitted = false;
924			}
925		},
926
927		previousValue: function(element) {
928			return $.data(element, "previousValue") || $.data(element, "previousValue", {
929				old: null,
930				valid: true,
931				message: this.defaultMessage( element, "remote" )
932			});
933		}
934
935	},
936
937	classRuleSettings: {
938		required: {required: true},
939		email: {email: true},
940		url: {url: true},
941		date: {date: true},
942		dateISO: {dateISO: true},
943		number: {number: true},
944		digits: {digits: true},
945		creditcard: {creditcard: true}
946	},
947
948	addClassRules: function(className, rules) {
949		if ( className.constructor === String ) {
950			this.classRuleSettings[className] = rules;
951		} else {
952			$.extend(this.classRuleSettings, className);
953		}
954	},
955
956	classRules: function(element) {
957		var rules = {};
958		var classes = $(element).attr('class');
959		if ( classes ) {
960			$.each(classes.split(' '), function() {
961				if (this in $.validator.classRuleSettings) {
962					$.extend(rules, $.validator.classRuleSettings[this]);
963				}
964			});
965		}
966		return rules;
967	},
968
969	attributeRules: function(element) {
970		var rules = {};
971		var $element = $(element);
972
973		for (var method in $.validator.methods) {
974			var value;
975
976			// support for <input required> in both html5 and older browsers
977			if (method === 'required') {
978				value = $element.get(0).getAttribute(method);
979				// Some browsers return an empty string for the required attribute
980				// and non-HTML5 browsers might have required="" markup
981				if (value === "") {
982					value = true;
983				}
984				// force non-HTML5 browsers to return bool
985				value = !!value;
986			} else {
987				value = $element.attr(method);
988			}
989
990			if (value) {
991				rules[method] = value;
992			} else if ($element[0].getAttribute("type") === method) {
993				rules[method] = true;
994			}
995		}
996
997		// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
998		if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
999			delete rules.maxlength;
1000		}
1001
1002		return rules;
1003	},
1004
1005	dataRules: function(element) {
1006		var method, value,
1007			rules = {}, $element = $(element);
1008		for (method in $.validator.methods) {
1009			value = $element.data('rule-' + method.toLowerCase());
1010			if (value !== undefined) {
1011				rules[method] = value;
1012			}
1013		}
1014		return rules;
1015	},
1016
1017	staticRules: function(element) {
1018		var rules = {};
1019		var validator = $.data(element.form, 'validator');
1020		if (validator.settings.rules) {
1021			rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
1022		}
1023		return rules;
1024	},
1025
1026	normalizeRules: function(rules, element) {
1027		// handle dependency check
1028		$.each(rules, function(prop, val) {
1029			// ignore rule when param is explicitly false, eg. required:false
1030			if (val === false) {
1031				delete rules[prop];
1032				return;
1033			}
1034			if (val.param || val.depends) {
1035				var keepRule = true;
1036				switch (typeof val.depends) {
1037				case "string":
1038					keepRule = !!$(val.depends, element.form).length;
1039					break;
1040				case "function":
1041					keepRule = val.depends.call(element, element);
1042					break;
1043				}
1044				if (keepRule) {
1045					rules[prop] = val.param !== undefined ? val.param : true;
1046				} else {
1047					delete rules[prop];
1048				}
1049			}
1050		});
1051
1052		// evaluate parameters
1053		$.each(rules, function(rule, parameter) {
1054			rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
1055		});
1056
1057		// clean number parameters
1058		$.each(['minlength', 'maxlength', 'min', 'max'], function() {
1059			if (rules[this]) {
1060				rules[this] = Number(rules[this]);
1061			}
1062		});
1063		$.each(['rangelength', 'range'], function() {
1064			var parts;
1065			if (rules[this]) {
1066				if ($.isArray(rules[this])) {
1067					rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
1068				} else if (typeof rules[this] === 'string') {
1069					parts = rules[this].split(/[\s,]+/);
1070					rules[this] = [Number(parts[0]), Number(parts[1])];
1071				}
1072			}
1073		});
1074
1075		if ($.validator.autoCreateRanges) {
1076			// auto-create ranges
1077			if (rules.min && rules.max) {
1078				rules.range = [rules.min, rules.max];
1079				delete rules.min;
1080				delete rules.max;
1081			}
1082			if (rules.minlength && rules.maxlength) {
1083				rules.rangelength = [rules.minlength, rules.maxlength];
1084				delete rules.minlength;
1085				delete rules.maxlength;
1086			}
1087		}
1088
1089		return rules;
1090	},
1091
1092	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
1093	normalizeRule: function(data) {
1094		if( typeof data === "string" ) {
1095			var transformed = {};
1096			$.each(data.split(/\s/), function() {
1097				transformed[this] = true;
1098			});
1099			data = transformed;
1100		}
1101		return data;
1102	},
1103
1104	// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
1105	addMethod: function(name, method, message) {
1106		$.validator.methods[name] = method;
1107		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
1108		if (method.length < 3) {
1109			$.validator.addClassRules(name, $.validator.normalizeRule(name));
1110		}
1111	},
1112
1113	methods: {
1114
1115		// http://docs.jquery.com/Plugins/Validation/Methods/required
1116		required: function(value, element, param) {
1117			// check if dependency is met
1118			if ( !this.depend(param, element) ) {
1119				return "dependency-mismatch";
1120			}
1121			if ( element.nodeName.toLowerCase() === "select" ) {
1122				// could be an array for select-multiple or a string, both are fine this way
1123				var val = $(element).val();
1124				return val && val.length > 0;
1125			}
1126			if ( this.checkable(element) ) {
1127				return this.getLength(value, element) > 0;
1128			}
1129			return $.trim(value).length > 0;
1130		},
1131
1132		// http://docs.jquery.com/Plugins/Validation/Methods/remote
1133		remote: function(value, element, param) {
1134			if ( this.optional(element) ) {
1135				return "dependency-mismatch";
1136			}
1137
1138			var previous = this.previousValue(element);
1139			if (!this.settings.messages[element.name] ) {
1140				this.settings.messages[element.name] = {};
1141			}
1142			previous.originalMessage = this.settings.messages[element.name].remote;
1143			this.settings.messages[element.name].remote = previous.message;
1144
1145			param = typeof param === "string" && {url:param} || param;
1146
1147			if ( previous.old === value ) {
1148				return previous.valid;
1149			}
1150
1151			previous.old = value;
1152			var validator = this;
1153			this.startRequest(element);
1154			var data = {};
1155			data[element.name] = value;
1156			$.ajax($.extend(true, {
1157				url: param,
1158				mode: "abort",
1159				port: "validate" + element.name,
1160				dataType: "json",
1161				data: data,
1162				success: function(response) {
1163					validator.settings.messages[element.name].remote = previous.originalMessage;
1164					var valid = response === true || response === "true";
1165					if ( valid ) {
1166						var submitted = validator.formSubmitted;
1167						validator.prepareElement(element);
1168						validator.formSubmitted = submitted;
1169						validator.successList.push(element);
1170						delete validator.invalid[element.name];
1171						validator.showErrors();
1172					} else {
1173						var errors = {};
1174						var message = response || validator.defaultMessage( element, "remote" );
1175						errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
1176						validator.invalid[element.name] = true;
1177						validator.showErrors(errors);
1178					}
1179					previous.valid = valid;
1180					validator.stopRequest(element, valid);
1181				}
1182			}, param));
1183			return "pending";
1184		},
1185
1186		// http://docs.jquery.com/Plugins/Validation/Methods/minlength
1187		minlength: function(value, element, param) {
1188			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1189			return this.optional(element) || length >= param;
1190		},
1191
1192		// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
1193		maxlength: function(value, element, param) {
1194			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1195			return this.optional(element) || length <= param;
1196		},
1197
1198		// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
1199		rangelength: function(value, element, param) {
1200			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1201			return this.optional(element) || ( length >= param[0] && length <= param[1] );
1202		},
1203
1204		// http://docs.jquery.com/Plugins/Validation/Methods/min
1205		min: function( value, element, param ) {
1206			return this.optional(element) || value >= param;
1207		},
1208
1209		// http://docs.jquery.com/Plugins/Validation/Methods/max
1210		max: function( value, element, param ) {
1211			return this.optional(element) || value <= param;
1212		},
1213
1214		// http://docs.jquery.com/Plugins/Validation/Methods/range
1215		range: function( value, element, param ) {
1216			return this.optional(element) || ( value >= param[0] && value <= param[1] );
1217		},
1218
1219		// http://docs.jquery.com/Plugins/Validation/Methods/email
1220		email: function(value, element) {
1221			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
1222			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);
1223		},
1224
1225		// http://docs.jquery.com/Plugins/Validation/Methods/url
1226		url: function(value, element) {
1227			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
1228			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);
1229		},
1230
1231		// http://docs.jquery.com/Plugins/Validation/Methods/date
1232		date: function(value, element) {
1233			return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
1234		},
1235
1236		// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
1237		dateISO: function(value, element) {
1238			return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
1239		},
1240
1241		// http://docs.jquery.com/Plugins/Validation/Methods/number
1242		number: function(value, element) {
1243			return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
1244		},
1245
1246		// http://docs.jquery.com/Plugins/Validation/Methods/digits
1247		digits: function(value, element) {
1248			return this.optional(element) || /^\d+$/.test(value);
1249		},
1250
1251		// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
1252		// based on http://en.wikipedia.org/wiki/Luhn
1253		creditcard: function(value, element) {
1254			if ( this.optional(element) ) {
1255				return "dependency-mismatch";
1256			}
1257			// accept only spaces, digits and dashes
1258			if (/[^0-9 \-]+/.test(value)) {
1259				return false;
1260			}
1261			var nCheck = 0,
1262				nDigit = 0,
1263				bEven = false;
1264
1265			value = value.replace(/\D/g, "");
1266
1267			for (var n = value.length - 1; n >= 0; n--) {
1268				var cDigit = value.charAt(n);
1269				nDigit = parseInt(cDigit, 10);
1270				if (bEven) {
1271					if ((nDigit *= 2) > 9) {
1272						nDigit -= 9;
1273					}
1274				}
1275				nCheck += nDigit;
1276				bEven = !bEven;
1277			}
1278
1279			return (nCheck % 10) === 0;
1280		},
1281
1282		// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
1283		equalTo: function(value, element, param) {
1284			// bind to the blur event of the target in order to revalidate whenever the target field is updated
1285			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
1286			var target = $(param);
1287			if (this.settings.onfocusout) {
1288				target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
1289					$(element).valid();
1290				});
1291			}
1292			return value === target.val();
1293		}
1294
1295	}
1296
1297});
1298
1299// deprecated, use $.validator.format instead
1300$.format = $.validator.format;
1301
1302}(jQuery));
1303
1304// ajax mode: abort
1305// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1306// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1307(function($) {
1308	var pendingRequests = {};
1309	// Use a prefilter if available (1.5+)
1310	if ( $.ajaxPrefilter ) {
1311		$.ajaxPrefilter(function(settings, _, xhr) {
1312			var port = settings.port;
1313			if (settings.mode === "abort") {
1314				if ( pendingRequests[port] ) {
1315					pendingRequests[port].abort();
1316				}
1317				pendingRequests[port] = xhr;
1318			}
1319		});
1320	} else {
1321		// Proxy ajax
1322		var ajax = $.ajax;
1323		$.ajax = function(settings) {
1324			var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1325				port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1326			if (mode === "abort") {
1327				if ( pendingRequests[port] ) {
1328					pendingRequests[port].abort();
1329				}
1330				return (pendingRequests[port] = ajax.apply(this, arguments));
1331			}
1332			return ajax.apply(this, arguments);
1333		};
1334	}
1335}(jQuery));
1336
1337// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
1338// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
1339(function($) {
1340	$.extend($.fn, {
1341		validateDelegate: function(delegate, type, handler) {
1342			return this.bind(type, function(event) {
1343				var target = $(event.target);
1344				if (target.is(delegate)) {
1345					return handler.apply(target, arguments);
1346				}
1347			});
1348		}
1349	});
1350}(jQuery));
1351;

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.