thd/web/js/jquery-tooltip/lib/.svn/text-base/jquery.js.svn-base
author Gautier Thibault <gthibault@universcine.com>
Tue, 22 Sep 2009 16:40:38 +0200
changeset 35 94a1dc255022
permissions -rw-r--r--
Commit the all thd project created with the framework symfony
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     1
(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     2
/*
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     3
 * jQuery 1.2.2 - New Wave Javascript
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     4
 *
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     5
 * Copyright (c) 2007 John Resig (jquery.com)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     6
 * Dual licensed under the MIT (MIT-LICENSE.txt)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     7
 * and GPL (GPL-LICENSE.txt) licenses.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     8
 *
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     9
 * $Date: 2008-01-14 17:56:07 -0500 (Mon, 14 Jan 2008) $
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    10
 * $Rev: 4454 $
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    11
 */
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    12
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    13
// Map over jQuery in case of overwrite
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    14
if ( window.jQuery )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    15
	var _jQuery = window.jQuery;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    16
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    17
var jQuery = window.jQuery = function( selector, context ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    18
	// The jQuery object is actually just the init constructor 'enhanced'
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    19
	return new jQuery.prototype.init( selector, context );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    20
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    21
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    22
// Map over the $ in case of overwrite
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    23
if ( window.$ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    24
	var _$ = window.$;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    25
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    26
// Map the jQuery namespace to the '$' one
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    27
window.$ = jQuery;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    28
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    29
// A simple way to check for HTML strings or ID strings
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    30
// (both of which we optimize for)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    31
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    32
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    33
// Is it a simple selector
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    34
var isSimple = /^.[^:#\[\.]*$/;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    35
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    36
jQuery.fn = jQuery.prototype = {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    37
	init: function( selector, context ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    38
		// Make sure that a selection was provided
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    39
		selector = selector || document;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    40
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    41
		// Handle $(DOMElement)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    42
		if ( selector.nodeType ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    43
			this[0] = selector;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    44
			this.length = 1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    45
			return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    46
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    47
		// Handle HTML strings
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    48
		} else if ( typeof selector == "string" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    49
			// Are we dealing with HTML string or an ID?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    50
			var match = quickExpr.exec( selector );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    51
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    52
			// Verify a match, and that no context was specified for #id
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    53
			if ( match && (match[1] || !context) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    54
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    55
				// HANDLE: $(html) -> $(array)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    56
				if ( match[1] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    57
					selector = jQuery.clean( [ match[1] ], context );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    58
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    59
				// HANDLE: $("#id")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    60
				else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    61
					var elem = document.getElementById( match[3] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    62
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    63
					// Make sure an element was located
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    64
					if ( elem )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    65
						// Handle the case where IE and Opera return items
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    66
						// by name instead of ID
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    67
						if ( elem.id != match[3] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    68
							return jQuery().find( selector );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    69
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    70
						// Otherwise, we inject the element directly into the jQuery object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    71
						else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    72
							this[0] = elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    73
							this.length = 1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    74
							return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    75
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    76
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    77
					else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    78
						selector = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    79
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    80
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    81
			// HANDLE: $(expr, [context])
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    82
			// (which is just equivalent to: $(content).find(expr)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    83
			} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    84
				return new jQuery( context ).find( selector );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    85
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    86
		// HANDLE: $(function)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    87
		// Shortcut for document ready
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    88
		} else if ( jQuery.isFunction( selector ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    89
			return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    90
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    91
		return this.setArray(
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    92
			// HANDLE: $(array)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    93
			selector.constructor == Array && selector ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    94
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    95
			// HANDLE: $(arraylike)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    96
			// Watch for when an array-like object, contains DOM nodes, is passed in as the selector
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    97
			(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    98
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    99
			// HANDLE: $(*)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   100
			[ selector ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   101
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   102
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   103
	// The current version of jQuery being used
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   104
	jquery: "1.2.2",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   105
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   106
	// The number of elements contained in the matched element set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   107
	size: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   108
		return this.length;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   109
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   110
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   111
	// The number of elements contained in the matched element set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   112
	length: 0,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   113
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   114
	// Get the Nth element in the matched element set OR
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   115
	// Get the whole matched element set as a clean array
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   116
	get: function( num ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   117
		return num == undefined ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   118
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   119
			// Return a 'clean' array
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   120
			jQuery.makeArray( this ) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   121
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   122
			// Return just the object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   123
			this[ num ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   124
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   125
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   126
	// Take an array of elements and push it onto the stack
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   127
	// (returning the new matched element set)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   128
	pushStack: function( elems ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   129
		// Build a new jQuery matched element set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   130
		var ret = jQuery( elems );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   131
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   132
		// Add the old object onto the stack (as a reference)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   133
		ret.prevObject = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   134
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   135
		// Return the newly-formed element set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   136
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   137
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   138
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   139
	// Force the current matched set of elements to become
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   140
	// the specified array of elements (destroying the stack in the process)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   141
	// You should use pushStack() in order to do this, but maintain the stack
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   142
	setArray: function( elems ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   143
		// Resetting the length to 0, then using the native Array push
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   144
		// is a super-fast way to populate an object with array-like properties
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   145
		this.length = 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   146
		Array.prototype.push.apply( this, elems );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   147
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   148
		return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   149
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   150
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   151
	// Execute a callback for every element in the matched set.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   152
	// (You can seed the arguments with an array of args, but this is
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   153
	// only used internally.)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   154
	each: function( callback, args ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   155
		return jQuery.each( this, callback, args );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   156
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   157
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   158
	// Determine the position of an element within 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   159
	// the matched set of elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   160
	index: function( elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   161
		var ret = -1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   162
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   163
		// Locate the position of the desired element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   164
		this.each(function(i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   165
			if ( this == elem )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   166
				ret = i;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   167
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   168
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   169
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   170
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   171
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   172
	attr: function( name, value, type ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   173
		var options = name;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   174
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   175
		// Look for the case where we're accessing a style value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   176
		if ( name.constructor == String )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   177
			if ( value == undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   178
				return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   179
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   180
			else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   181
				options = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   182
				options[ name ] = value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   183
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   184
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   185
		// Check to see if we're setting style values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   186
		return this.each(function(i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   187
			// Set all the styles
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   188
			for ( name in options )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   189
				jQuery.attr(
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   190
					type ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   191
						this.style :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   192
						this,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   193
					name, jQuery.prop( this, options[ name ], type, i, name )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   194
				);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   195
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   196
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   197
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   198
	css: function( key, value ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   199
		// ignore negative width and height values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   200
		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   201
			value = undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   202
		return this.attr( key, value, "curCSS" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   203
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   204
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   205
	text: function( text ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   206
		if ( typeof text != "object" && text != null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   207
			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   208
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   209
		var ret = "";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   210
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   211
		jQuery.each( text || this, function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   212
			jQuery.each( this.childNodes, function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   213
				if ( this.nodeType != 8 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   214
					ret += this.nodeType != 1 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   215
						this.nodeValue :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   216
						jQuery.fn.text( [ this ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   217
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   218
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   219
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   220
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   221
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   222
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   223
	wrapAll: function( html ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   224
		if ( this[0] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   225
			// The elements to wrap the target around
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   226
			jQuery( html, this[0].ownerDocument )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   227
				.clone()
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   228
				.insertBefore( this[0] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   229
				.map(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   230
					var elem = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   231
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   232
					while ( elem.firstChild )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   233
						elem = elem.firstChild;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   234
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   235
					return elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   236
				})
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   237
				.append(this);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   238
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   239
		return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   240
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   241
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   242
	wrapInner: function( html ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   243
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   244
			jQuery( this ).contents().wrapAll( html );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   245
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   246
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   247
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   248
	wrap: function( html ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   249
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   250
			jQuery( this ).wrapAll( html );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   251
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   252
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   253
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   254
	append: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   255
		return this.domManip(arguments, true, false, function(elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   256
			if (this.nodeType == 1)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   257
				this.appendChild( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   258
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   259
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   260
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   261
	prepend: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   262
		return this.domManip(arguments, true, true, function(elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   263
			if (this.nodeType == 1)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   264
				this.insertBefore( elem, this.firstChild );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   265
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   266
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   267
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   268
	before: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   269
		return this.domManip(arguments, false, false, function(elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   270
			this.parentNode.insertBefore( elem, this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   271
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   272
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   273
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   274
	after: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   275
		return this.domManip(arguments, false, true, function(elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   276
			this.parentNode.insertBefore( elem, this.nextSibling );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   277
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   278
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   279
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   280
	end: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   281
		return this.prevObject || jQuery( [] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   282
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   283
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   284
	find: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   285
		var elems = jQuery.map(this, function(elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   286
			return jQuery.find( selector, elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   287
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   288
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   289
		return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   290
			jQuery.unique( elems ) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   291
			elems );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   292
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   293
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   294
	clone: function( events ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   295
		// Do the clone
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   296
		var ret = this.map(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   297
			if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   298
				// IE copies events bound via attachEvent when
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   299
				// using cloneNode. Calling detachEvent on the
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   300
				// clone will also remove the events from the orignal
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   301
				// In order to get around this, we use innerHTML.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   302
				// Unfortunately, this means some modifications to 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   303
				// attributes in IE that are actually only stored 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   304
				// as properties will not be copied (such as the
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   305
				// the name attribute on an input).
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   306
				var clone = this.cloneNode(true),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   307
					container = document.createElement("div"),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   308
					container2 = document.createElement("div");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   309
				container.appendChild(clone);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   310
				container2.innerHTML = container.innerHTML;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   311
				return container2.firstChild;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   312
			} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   313
				return this.cloneNode(true);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   314
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   315
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   316
		// Need to set the expando to null on the cloned set if it exists
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   317
		// removeData doesn't work here, IE removes it from the original as well
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   318
		// this is primarily for IE but the data expando shouldn't be copied over in any browser
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   319
		var clone = ret.find("*").andSelf().each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   320
			if ( this[ expando ] != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   321
				this[ expando ] = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   322
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   323
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   324
		// Copy the events from the original to the clone
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   325
		if ( events === true )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   326
			this.find("*").andSelf().each(function(i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   327
				if (this.nodeType == 3)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   328
					return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   329
				var events = jQuery.data( this, "events" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   330
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   331
				for ( var type in events )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   332
					for ( var handler in events[ type ] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   333
						jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   334
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   335
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   336
		// Return the cloned set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   337
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   338
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   339
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   340
	filter: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   341
		return this.pushStack(
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   342
			jQuery.isFunction( selector ) &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   343
			jQuery.grep(this, function(elem, i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   344
				return selector.call( elem, i );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   345
			}) ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   346
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   347
			jQuery.multiFilter( selector, this ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   348
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   349
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   350
	not: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   351
		if ( selector.constructor == String )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   352
			// test special case where just one selector is passed in
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   353
			if ( isSimple.test( selector ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   354
				return this.pushStack( jQuery.multiFilter( selector, this, true ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   355
			else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   356
				selector = jQuery.multiFilter( selector, this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   357
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   358
		var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   359
		return this.filter(function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   360
			return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   361
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   362
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   363
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   364
	add: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   365
		return !selector ? this : this.pushStack( jQuery.merge( 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   366
			this.get(),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   367
			selector.constructor == String ? 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   368
				jQuery( selector ).get() :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   369
				selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   370
					selector : [selector] ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   371
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   372
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   373
	is: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   374
		return selector ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   375
			jQuery.multiFilter( selector, this ).length > 0 :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   376
			false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   377
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   378
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   379
	hasClass: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   380
		return this.is( "." + selector );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   381
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   382
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   383
	val: function( value ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   384
		if ( value == undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   385
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   386
			if ( this.length ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   387
				var elem = this[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   388
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   389
				// We need to handle select boxes special
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   390
				if ( jQuery.nodeName( elem, "select" ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   391
					var index = elem.selectedIndex,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   392
						values = [],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   393
						options = elem.options,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   394
						one = elem.type == "select-one";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   395
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   396
					// Nothing was selected
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   397
					if ( index < 0 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   398
						return null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   399
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   400
					// Loop through all the selected options
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   401
					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   402
						var option = options[ i ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   403
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   404
						if ( option.selected ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   405
							// Get the specifc value for the option
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   406
							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   407
							
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   408
							// We don't need an array for one selects
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   409
							if ( one )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   410
								return value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   411
							
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   412
							// Multi-Selects return an array
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   413
							values.push( value );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   414
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   415
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   416
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   417
					return values;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   418
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   419
				// Everything else, we just grab the value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   420
				} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   421
					return (this[0].value || "").replace(/\r/g, "");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   422
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   423
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   424
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   425
			return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   426
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   427
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   428
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   429
			if ( this.nodeType != 1 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   430
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   431
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   432
			if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   433
				this.checked = (jQuery.inArray(this.value, value) >= 0 ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   434
					jQuery.inArray(this.name, value) >= 0);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   435
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   436
			else if ( jQuery.nodeName( this, "select" ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   437
				var values = value.constructor == Array ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   438
					value :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   439
					[ value ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   440
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   441
				jQuery( "option", this ).each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   442
					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   443
						jQuery.inArray( this.text, values ) >= 0);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   444
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   445
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   446
				if ( !values.length )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   447
					this.selectedIndex = -1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   448
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   449
			} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   450
				this.value = value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   451
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   452
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   453
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   454
	html: function( value ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   455
		return value == undefined ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   456
			(this.length ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   457
				this[0].innerHTML :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   458
				null) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   459
			this.empty().append( value );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   460
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   461
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   462
	replaceWith: function( value ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   463
		return this.after( value ).remove();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   464
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   465
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   466
	eq: function( i ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   467
		return this.slice( i, i + 1 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   468
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   469
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   470
	slice: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   471
		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   472
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   473
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   474
	map: function( callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   475
		return this.pushStack( jQuery.map(this, function(elem, i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   476
			return callback.call( elem, i, elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   477
		}));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   478
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   479
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   480
	andSelf: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   481
		return this.add( this.prevObject );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   482
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   483
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   484
	domManip: function( args, table, reverse, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   485
		var clone = this.length > 1, elems; 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   486
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   487
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   488
			if ( !elems ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   489
				elems = jQuery.clean( args, this.ownerDocument );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   490
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   491
				if ( reverse )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   492
					elems.reverse();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   493
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   494
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   495
			var obj = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   496
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   497
			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   498
				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   499
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   500
			var scripts = jQuery( [] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   501
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   502
			jQuery.each(elems, function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   503
				var elem = clone ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   504
					jQuery( this ).clone( true )[0] :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   505
					this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   506
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   507
				// execute all scripts after the elements have been injected
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   508
				if ( jQuery.nodeName( elem, "script" ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   509
					scripts = scripts.add( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   510
				} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   511
					// Remove any inner scripts for later evaluation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   512
					if ( elem.nodeType == 1 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   513
						scripts = scripts.add( jQuery( "script", elem ).remove() );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   514
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   515
					// Inject the elements into the document
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   516
					callback.call( obj, elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   517
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   518
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   519
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   520
			scripts.each( evalScript );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   521
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   522
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   523
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   524
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   525
// Give the init function the jQuery prototype for later instantiation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   526
jQuery.prototype.init.prototype = jQuery.prototype;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   527
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   528
function evalScript( i, elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   529
	if ( elem.src )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   530
		jQuery.ajax({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   531
			url: elem.src,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   532
			async: false,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   533
			dataType: "script"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   534
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   535
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   536
	else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   537
		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   538
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   539
	if ( elem.parentNode )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   540
		elem.parentNode.removeChild( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   541
}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   542
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   543
jQuery.extend = jQuery.fn.extend = function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   544
	// copy reference to target object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   545
	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   546
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   547
	// Handle a deep copy situation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   548
	if ( target.constructor == Boolean ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   549
		deep = target;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   550
		target = arguments[1] || {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   551
		// skip the boolean and the target
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   552
		i = 2;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   553
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   554
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   555
	// Handle case when target is a string or something (possible in deep copy)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   556
	if ( typeof target != "object" && typeof target != "function" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   557
		target = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   558
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   559
	// extend jQuery itself if only one argument is passed
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   560
	if ( length == 1 ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   561
		target = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   562
		i = 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   563
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   564
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   565
	for ( ; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   566
		// Only deal with non-null/undefined values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   567
		if ( (options = arguments[ i ]) != null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   568
			// Extend the base object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   569
			for ( var name in options ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   570
				// Prevent never-ending loop
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   571
				if ( target === options[ name ] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   572
					continue;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   573
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   574
				// Recurse if we're merging object values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   575
				if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   576
					target[ name ] = jQuery.extend( target[ name ], options[ name ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   577
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   578
				// Don't bring in undefined values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   579
				else if ( options[ name ] != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   580
					target[ name ] = options[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   581
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   582
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   583
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   584
	// Return the modified object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   585
	return target;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   586
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   587
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   588
var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   589
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   590
// exclude the following css properties to add px
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   591
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   592
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   593
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   594
	noConflict: function( deep ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   595
		window.$ = _$;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   596
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   597
		if ( deep )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   598
			window.jQuery = _jQuery;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   599
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   600
		return jQuery;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   601
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   602
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   603
	// See test/unit/core.js for details concerning this function.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   604
	isFunction: function( fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   605
		return !!fn && typeof fn != "string" && !fn.nodeName && 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   606
			fn.constructor != Array && /function/i.test( fn + "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   607
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   608
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   609
	// check if an element is in a (or is an) XML document
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   610
	isXMLDoc: function( elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   611
		return elem.documentElement && !elem.body ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   612
			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   613
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   614
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   615
	// Evalulates a script in a global context
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   616
	globalEval: function( data ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   617
		data = jQuery.trim( data );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   618
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   619
		if ( data ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   620
			// Inspired by code by Andrea Giammarchi
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   621
			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   622
			var head = document.getElementsByTagName("head")[0] || document.documentElement,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   623
				script = document.createElement("script");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   624
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   625
			script.type = "text/javascript";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   626
			if ( jQuery.browser.msie )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   627
				script.text = data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   628
			else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   629
				script.appendChild( document.createTextNode( data ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   630
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   631
			head.appendChild( script );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   632
			head.removeChild( script );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   633
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   634
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   635
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   636
	nodeName: function( elem, name ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   637
		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   638
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   639
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   640
	cache: {},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   641
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   642
	data: function( elem, name, data ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   643
		elem = elem == window ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   644
			windowData :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   645
			elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   646
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   647
		var id = elem[ expando ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   648
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   649
		// Compute a unique ID for the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   650
		if ( !id ) 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   651
			id = elem[ expando ] = ++uuid;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   652
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   653
		// Only generate the data cache if we're
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   654
		// trying to access or manipulate it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   655
		if ( name && !jQuery.cache[ id ] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   656
			jQuery.cache[ id ] = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   657
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   658
		// Prevent overriding the named cache with undefined values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   659
		if ( data != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   660
			jQuery.cache[ id ][ name ] = data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   661
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   662
		// Return the named cache data, or the ID for the element	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   663
		return name ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   664
			jQuery.cache[ id ][ name ] :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   665
			id;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   666
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   667
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   668
	removeData: function( elem, name ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   669
		elem = elem == window ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   670
			windowData :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   671
			elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   672
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   673
		var id = elem[ expando ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   674
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   675
		// If we want to remove a specific section of the element's data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   676
		if ( name ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   677
			if ( jQuery.cache[ id ] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   678
				// Remove the section of cache data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   679
				delete jQuery.cache[ id ][ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   680
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   681
				// If we've removed all the data, remove the element's cache
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   682
				name = "";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   683
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   684
				for ( name in jQuery.cache[ id ] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   685
					break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   686
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   687
				if ( !name )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   688
					jQuery.removeData( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   689
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   690
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   691
		// Otherwise, we want to remove all of the element's data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   692
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   693
			// Clean up the element expando
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   694
			try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   695
				delete elem[ expando ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   696
			} catch(e){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   697
				// IE has trouble directly removing the expando
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   698
				// but it's ok with using removeAttribute
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   699
				if ( elem.removeAttribute )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   700
					elem.removeAttribute( expando );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   701
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   702
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   703
			// Completely remove the data cache
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   704
			delete jQuery.cache[ id ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   705
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   706
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   707
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   708
	// args is for internal usage only
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   709
	each: function( object, callback, args ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   710
		if ( args ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   711
			if ( object.length == undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   712
				for ( var name in object )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   713
					if ( callback.apply( object[ name ], args ) === false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   714
						break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   715
			} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   716
				for ( var i = 0, length = object.length; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   717
					if ( callback.apply( object[ i ], args ) === false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   718
						break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   719
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   720
		// A special, fast, case for the most common use of each
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   721
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   722
			if ( object.length == undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   723
				for ( var name in object )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   724
					if ( callback.call( object[ name ], name, object[ name ] ) === false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   725
						break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   726
			} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   727
				for ( var i = 0, length = object.length, value = object[0]; 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   728
					i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   729
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   730
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   731
		return object;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   732
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   733
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   734
	prop: function( elem, value, type, i, name ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   735
			// Handle executable functions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   736
			if ( jQuery.isFunction( value ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   737
				value = value.call( elem, i );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   738
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   739
			// Handle passing in a number to a CSS property
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   740
			return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   741
				value + "px" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   742
				value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   743
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   744
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   745
	className: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   746
		// internal only, use addClass("class")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   747
		add: function( elem, classNames ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   748
			jQuery.each((classNames || "").split(/\s+/), function(i, className){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   749
				if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   750
					elem.className += (elem.className ? " " : "") + className;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   751
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   752
		},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   753
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   754
		// internal only, use removeClass("class")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   755
		remove: function( elem, classNames ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   756
			if (elem.nodeType == 1)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   757
				elem.className = classNames != undefined ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   758
					jQuery.grep(elem.className.split(/\s+/), function(className){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   759
						return !jQuery.className.has( classNames, className );	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   760
					}).join(" ") :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   761
					"";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   762
		},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   763
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   764
		// internal only, use is(".class")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   765
		has: function( elem, className ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   766
			return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   767
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   768
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   769
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   770
	// A method for quickly swapping in/out CSS properties to get correct calculations
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   771
	swap: function( elem, options, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   772
		var old = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   773
		// Remember the old values, and insert the new ones
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   774
		for ( var name in options ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   775
			old[ name ] = elem.style[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   776
			elem.style[ name ] = options[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   777
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   778
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   779
		callback.call( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   780
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   781
		// Revert the old values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   782
		for ( var name in options )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   783
			elem.style[ name ] = old[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   784
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   785
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   786
	css: function( elem, name, force ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   787
		if ( name == "width" || name == "height" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   788
			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   789
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   790
			function getWH() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   791
				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   792
				var padding = 0, border = 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   793
				jQuery.each( which, function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   794
					padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   795
					border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   796
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   797
				val -= Math.round(padding + border);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   798
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   799
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   800
			if ( jQuery(elem).is(":visible") )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   801
				getWH();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   802
			else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   803
				jQuery.swap( elem, props, getWH );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   804
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   805
			return Math.max(0, val);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   806
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   807
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   808
		return jQuery.curCSS( elem, name, force );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   809
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   810
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   811
	curCSS: function( elem, name, force ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   812
		var ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   813
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   814
		// A helper method for determining if an element's values are broken
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   815
		function color( elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   816
			if ( !jQuery.browser.safari )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   817
				return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   818
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   819
			var ret = document.defaultView.getComputedStyle( elem, null );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   820
			return !ret || ret.getPropertyValue("color") == "";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   821
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   822
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   823
		// We need to handle opacity special in IE
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   824
		if ( name == "opacity" && jQuery.browser.msie ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   825
			ret = jQuery.attr( elem.style, "opacity" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   826
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   827
			return ret == "" ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   828
				"1" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   829
				ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   830
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   831
		// Opera sometimes will give the wrong display answer, this fixes it, see #2037
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   832
		if ( jQuery.browser.opera && name == "display" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   833
			var save = elem.style.display;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   834
			elem.style.display = "block";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   835
			elem.style.display = save;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   836
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   837
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   838
		// Make sure we're using the right name for getting the float value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   839
		if ( name.match( /float/i ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   840
			name = styleFloat;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   841
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   842
		if ( !force && elem.style && elem.style[ name ] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   843
			ret = elem.style[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   844
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   845
		else if ( document.defaultView && document.defaultView.getComputedStyle ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   846
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   847
			// Only "float" is needed here
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   848
			if ( name.match( /float/i ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   849
				name = "float";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   850
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   851
			name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   852
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   853
			var getComputedStyle = document.defaultView.getComputedStyle( elem, null );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   854
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   855
			if ( getComputedStyle && !color( elem ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   856
				ret = getComputedStyle.getPropertyValue( name );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   857
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   858
			// If the element isn't reporting its values properly in Safari
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   859
			// then some display: none elements are involved
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   860
			else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   861
				var swap = [], stack = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   862
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   863
				// Locate all of the parent display: none elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   864
				for ( var a = elem; a && color(a); a = a.parentNode )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   865
					stack.unshift(a);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   866
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   867
				// Go through and make them visible, but in reverse
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   868
				// (It would be better if we knew the exact display type that they had)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   869
				for ( var i = 0; i < stack.length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   870
					if ( color( stack[ i ] ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   871
						swap[ i ] = stack[ i ].style.display;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   872
						stack[ i ].style.display = "block";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   873
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   874
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   875
				// Since we flip the display style, we have to handle that
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   876
				// one special, otherwise get the value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   877
				ret = name == "display" && swap[ stack.length - 1 ] != null ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   878
					"none" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   879
					( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || "";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   880
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   881
				// Finally, revert the display styles back
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   882
				for ( var i = 0; i < swap.length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   883
					if ( swap[ i ] != null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   884
						stack[ i ].style.display = swap[ i ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   885
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   886
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   887
			// We should always get a number back from opacity
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   888
			if ( name == "opacity" && ret == "" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   889
				ret = "1";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   890
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   891
		} else if ( elem.currentStyle ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   892
			var camelCase = name.replace(/\-(\w)/g, function(all, letter){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   893
				return letter.toUpperCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   894
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   895
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   896
			ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   897
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   898
			// From the awesome hack by Dean Edwards
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   899
			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   900
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   901
			// If we're not dealing with a regular pixel number
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   902
			// but a number that has a weird ending, we need to convert it to pixels
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   903
			if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   904
				// Remember the original values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   905
				var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   906
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   907
				// Put in the new values to get a computed value out
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   908
				elem.runtimeStyle.left = elem.currentStyle.left;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   909
				elem.style.left = ret || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   910
				ret = elem.style.pixelLeft + "px";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   911
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   912
				// Revert the changed values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   913
				elem.style.left = style;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   914
				elem.runtimeStyle.left = runtimeStyle;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   915
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   916
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   917
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   918
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   919
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   920
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   921
	clean: function( elems, context ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   922
		var ret = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   923
		context = context || document;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   924
		// !context.createElement fails in IE with an error but returns typeof 'object'
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   925
		if (typeof context.createElement == 'undefined') 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   926
			context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   927
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   928
		jQuery.each(elems, function(i, elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   929
			if ( !elem )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   930
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   931
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   932
			if ( elem.constructor == Number )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   933
				elem = elem.toString();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   934
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   935
			// Convert html string into DOM nodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   936
			if ( typeof elem == "string" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   937
				// Fix "XHTML"-style tags in all browsers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   938
				elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   939
					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   940
						all :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   941
						front + "></" + tag + ">";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   942
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   943
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   944
				// Trim whitespace, otherwise indexOf won't work as expected
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   945
				var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   946
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   947
				var wrap =
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   948
					// option or optgroup
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   949
					!tags.indexOf("<opt") &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   950
					[ 1, "<select multiple='multiple'>", "</select>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   951
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   952
					!tags.indexOf("<leg") &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   953
					[ 1, "<fieldset>", "</fieldset>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   954
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   955
					tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   956
					[ 1, "<table>", "</table>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   957
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   958
					!tags.indexOf("<tr") &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   959
					[ 2, "<table><tbody>", "</tbody></table>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   960
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   961
				 	// <thead> matched above
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   962
					(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   963
					[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   964
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   965
					!tags.indexOf("<col") &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   966
					[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   967
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   968
					// IE can't serialize <link> and <script> tags normally
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   969
					jQuery.browser.msie &&
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   970
					[ 1, "div<div>", "</div>" ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   971
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   972
					[ 0, "", "" ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   973
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   974
				// Go to html and back, then peel off extra wrappers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   975
				div.innerHTML = wrap[1] + elem + wrap[2];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   976
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   977
				// Move to the right depth
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   978
				while ( wrap[0]-- )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   979
					div = div.lastChild;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   980
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   981
				// Remove IE's autoinserted <tbody> from table fragments
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   982
				if ( jQuery.browser.msie ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   983
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   984
					// String was a <table>, *may* have spurious <tbody>
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   985
					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   986
						div.firstChild && div.firstChild.childNodes :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   987
						
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   988
						// String was a bare <thead> or <tfoot>
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   989
						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   990
							div.childNodes :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   991
							[];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   992
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   993
					for ( var j = tbody.length - 1; j >= 0 ; --j )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   994
						if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   995
							tbody[ j ].parentNode.removeChild( tbody[ j ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   996
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   997
					// IE completely kills leading whitespace when innerHTML is used	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   998
					if ( /^\s/.test( elem ) )	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
   999
						div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1000
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1001
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1002
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1003
				elem = jQuery.makeArray( div.childNodes );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1004
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1005
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1006
			if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1007
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1008
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1009
			if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1010
				ret.push( elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1011
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1012
			else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1013
				ret = jQuery.merge( ret, elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1014
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1015
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1016
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1017
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1018
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1019
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1020
	attr: function( elem, name, value ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1021
		// don't set attributes on text and comment nodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1022
		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1023
			return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1024
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1025
		var fix = jQuery.isXMLDoc( elem ) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1026
			{} :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1027
			jQuery.props;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1028
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1029
		// Safari mis-reports the default selected property of a hidden option
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1030
		// Accessing the parent's selectedIndex property fixes it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1031
		if ( name == "selected" && jQuery.browser.safari )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1032
			elem.parentNode.selectedIndex;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1033
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1034
		// Certain attributes only work when accessed via the old DOM 0 way
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1035
		if ( fix[ name ] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1036
			if ( value != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1037
				elem[ fix[ name ] ] = value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1038
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1039
			return elem[ fix[ name ] ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1040
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1041
		} else if ( jQuery.browser.msie && name == "style" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1042
			return jQuery.attr( elem.style, "cssText", value );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1043
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1044
		else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1045
			return elem.getAttributeNode( name ).nodeValue;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1046
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1047
		// IE elem.getAttribute passes even for style
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1048
		else if ( elem.tagName ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1049
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1050
			if ( value != undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1051
				// We can't allow the type property to be changed (since it causes problems in IE)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1052
				if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1053
					throw "type property can't be changed";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1054
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1055
				// convert the value to a string (all browsers do this but IE) see #1070
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1056
				elem.setAttribute( name, "" + value );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1057
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1058
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1059
			if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) ) 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1060
				return elem.getAttribute( name, 2 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1061
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1062
			return elem.getAttribute( name );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1063
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1064
		// elem is actually elem.style ... set the style
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1065
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1066
			// IE actually uses filters for opacity
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1067
			if ( name == "opacity" && jQuery.browser.msie ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1068
				if ( value != undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1069
					// IE has trouble with opacity if it does not have layout
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1070
					// Force it by setting the zoom level
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1071
					elem.zoom = 1; 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1072
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1073
					// Set the alpha filter to set the opacity
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1074
					elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1075
						(parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1076
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1077
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1078
				return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1079
					(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1080
					"";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1081
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1082
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1083
			name = name.replace(/-([a-z])/ig, function(all, letter){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1084
				return letter.toUpperCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1085
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1086
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1087
			if ( value != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1088
				elem[ name ] = value;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1089
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1090
			return elem[ name ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1091
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1092
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1093
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1094
	trim: function( text ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1095
		return (text || "").replace( /^\s+|\s+$/g, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1096
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1097
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1098
	makeArray: function( array ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1099
		var ret = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1100
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1101
		// Need to use typeof to fight Safari childNodes crashes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1102
		if ( typeof array != "array" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1103
			for ( var i = 0, length = array.length; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1104
				ret.push( array[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1105
		else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1106
			ret = array.slice( 0 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1107
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1108
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1109
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1110
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1111
	inArray: function( elem, array ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1112
		for ( var i = 0, length = array.length; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1113
			if ( array[ i ] == elem )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1114
				return i;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1115
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1116
		return -1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1117
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1118
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1119
	merge: function( first, second ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1120
		// We have to loop this way because IE & Opera overwrite the length
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1121
		// expando of getElementsByTagName
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1122
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1123
		// Also, we need to make sure that the correct elements are being returned
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1124
		// (IE returns comment nodes in a '*' query)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1125
		if ( jQuery.browser.msie ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1126
			for ( var i = 0; second[ i ]; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1127
				if ( second[ i ].nodeType != 8 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1128
					first.push( second[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1129
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1130
		} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1131
			for ( var i = 0; second[ i ]; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1132
				first.push( second[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1133
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1134
		return first;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1135
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1136
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1137
	unique: function( array ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1138
		var ret = [], done = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1139
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1140
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1141
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1142
			for ( var i = 0, length = array.length; i < length; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1143
				var id = jQuery.data( array[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1144
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1145
				if ( !done[ id ] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1146
					done[ id ] = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1147
					ret.push( array[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1148
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1149
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1150
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1151
		} catch( e ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1152
			ret = array;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1153
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1154
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1155
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1156
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1157
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1158
	grep: function( elems, callback, inv ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1159
		// If a string is passed in for the function, make a function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1160
		// for it (a handy shortcut)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1161
		if ( typeof callback == "string" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1162
			callback = eval("false||function(a,i){return " + callback + "}");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1163
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1164
		var ret = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1165
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1166
		// Go through the array, only saving the items
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1167
		// that pass the validator function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1168
		for ( var i = 0, length = elems.length; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1169
			if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1170
				ret.push( elems[ i ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1171
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1172
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1173
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1174
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1175
	map: function( elems, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1176
		var ret = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1177
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1178
		// Go through the array, translating each of the items to their
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1179
		// new value (or values).
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1180
		for ( var i = 0, length = elems.length; i < length; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1181
			var value = callback( elems[ i ], i );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1182
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1183
			if ( value !== null && value != undefined ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1184
				if ( value.constructor != Array )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1185
					value = [ value ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1186
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1187
				ret = ret.concat( value );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1188
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1189
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1190
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1191
		return ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1192
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1193
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1194
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1195
var userAgent = navigator.userAgent.toLowerCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1196
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1197
// Figure out what browser is being used
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1198
jQuery.browser = {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1199
	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1200
	safari: /webkit/.test( userAgent ),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1201
	opera: /opera/.test( userAgent ),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1202
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1203
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1204
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1205
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1206
var styleFloat = jQuery.browser.msie ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1207
	"styleFloat" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1208
	"cssFloat";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1209
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1210
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1211
	// Check to see if the W3C box model is being used
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1212
	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1213
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1214
	props: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1215
		"for": "htmlFor",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1216
		"class": "className",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1217
		"float": styleFloat,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1218
		cssFloat: styleFloat,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1219
		styleFloat: styleFloat,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1220
		innerHTML: "innerHTML",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1221
		className: "className",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1222
		value: "value",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1223
		disabled: "disabled",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1224
		checked: "checked",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1225
		readonly: "readOnly",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1226
		selected: "selected",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1227
		maxlength: "maxLength",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1228
		selectedIndex: "selectedIndex",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1229
		defaultValue: "defaultValue",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1230
		tagName: "tagName",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1231
		nodeName: "nodeName"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1232
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1233
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1234
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1235
jQuery.each({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1236
	parent: "elem.parentNode",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1237
	parents: "jQuery.dir(elem,'parentNode')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1238
	next: "jQuery.nth(elem,2,'nextSibling')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1239
	prev: "jQuery.nth(elem,2,'previousSibling')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1240
	nextAll: "jQuery.dir(elem,'nextSibling')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1241
	prevAll: "jQuery.dir(elem,'previousSibling')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1242
	siblings: "jQuery.sibling(elem.parentNode.firstChild,elem)",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1243
	children: "jQuery.sibling(elem.firstChild)",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1244
	contents: "jQuery.nodeName(elem,'iframe')?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1245
}, function(name, fn){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1246
	fn = eval("false||function(elem){return " + fn + "}");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1247
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1248
	jQuery.fn[ name ] = function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1249
		var ret = jQuery.map( this, fn );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1250
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1251
		if ( selector && typeof selector == "string" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1252
			ret = jQuery.multiFilter( selector, ret );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1253
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1254
		return this.pushStack( jQuery.unique( ret ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1255
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1256
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1257
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1258
jQuery.each({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1259
	appendTo: "append",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1260
	prependTo: "prepend",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1261
	insertBefore: "before",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1262
	insertAfter: "after",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1263
	replaceAll: "replaceWith"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1264
}, function(name, original){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1265
	jQuery.fn[ name ] = function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1266
		var args = arguments;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1267
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1268
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1269
			for ( var i = 0, length = args.length; i < length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1270
				jQuery( args[ i ] )[ original ]( this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1271
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1272
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1273
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1274
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1275
jQuery.each({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1276
	removeAttr: function( name ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1277
		jQuery.attr( this, name, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1278
		if (this.nodeType == 1) 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1279
			this.removeAttribute( name );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1280
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1281
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1282
	addClass: function( classNames ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1283
		jQuery.className.add( this, classNames );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1284
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1285
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1286
	removeClass: function( classNames ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1287
		jQuery.className.remove( this, classNames );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1288
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1289
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1290
	toggleClass: function( classNames ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1291
		jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1292
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1293
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1294
	remove: function( selector ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1295
		if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1296
			// Prevent memory leaks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1297
			jQuery( "*", this ).add(this).each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1298
				jQuery.event.remove(this);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1299
				jQuery.removeData(this);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1300
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1301
			if (this.parentNode)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1302
				this.parentNode.removeChild( this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1303
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1304
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1305
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1306
	empty: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1307
		// Remove element nodes and prevent memory leaks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1308
		jQuery( ">*", this ).remove();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1309
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1310
		// Remove any remaining nodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1311
		while ( this.firstChild )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1312
			this.removeChild( this.firstChild );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1313
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1314
}, function(name, fn){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1315
	jQuery.fn[ name ] = function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1316
		return this.each( fn, arguments );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1317
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1318
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1319
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1320
jQuery.each([ "Height", "Width" ], function(i, name){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1321
	var type = name.toLowerCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1322
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1323
	jQuery.fn[ type ] = function( size ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1324
		// Get window width or height
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1325
		return this[0] == window ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1326
			// Opera reports document.body.client[Width/Height] properly in both quirks and standards
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1327
			jQuery.browser.opera && document.body[ "client" + name ] || 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1328
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1329
			// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1330
			jQuery.browser.safari && window[ "inner" + name ] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1331
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1332
			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1333
			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1334
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1335
			// Get document width or height
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1336
			this[0] == document ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1337
				// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1338
				Math.max( 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1339
					Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1340
					Math.max(document.body["offset" + name], document.documentElement["offset" + name]) 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1341
				) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1342
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1343
				// Get or set width or height on the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1344
				size == undefined ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1345
					// Get width or height on the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1346
					(this.length ? jQuery.css( this[0], type ) : null) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1347
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1348
					// Set the width or height on the element (default to pixels if value is unitless)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1349
					this.css( type, size.constructor == String ? size : size + "px" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1350
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1351
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1352
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1353
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1354
		"(?:[\\w*_-]|\\\\.)" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1355
		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1356
	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1357
	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1358
	quickClass = new RegExp("^([#.]?)(" + chars + "*)");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1359
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1360
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1361
	expr: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1362
		"": "m[2]=='*'||jQuery.nodeName(a,m[2])",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1363
		"#": "a.getAttribute('id')==m[2]",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1364
		":": {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1365
			// Position Checks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1366
			lt: "i<m[3]-0",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1367
			gt: "i>m[3]-0",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1368
			nth: "m[3]-0==i",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1369
			eq: "m[3]-0==i",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1370
			first: "i==0",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1371
			last: "i==r.length-1",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1372
			even: "i%2==0",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1373
			odd: "i%2",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1374
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1375
			// Child Checks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1376
			"first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1377
			"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1378
			"only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1379
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1380
			// Parent Checks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1381
			parent: "a.firstChild",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1382
			empty: "!a.firstChild",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1383
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1384
			// Text Check
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1385
			contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1386
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1387
			// Visibility
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1388
			visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1389
			hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1390
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1391
			// Form attributes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1392
			enabled: "!a.disabled",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1393
			disabled: "a.disabled",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1394
			checked: "a.checked",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1395
			selected: "a.selected||jQuery.attr(a,'selected')",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1396
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1397
			// Form elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1398
			text: "'text'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1399
			radio: "'radio'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1400
			checkbox: "'checkbox'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1401
			file: "'file'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1402
			password: "'password'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1403
			submit: "'submit'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1404
			image: "'image'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1405
			reset: "'reset'==a.type",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1406
			button: '"button"==a.type||jQuery.nodeName(a,"button")',
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1407
			input: "/input|select|textarea|button/i.test(a.nodeName)",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1408
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1409
			// :has()
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1410
			has: "jQuery.find(m[3],a).length",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1411
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1412
			// :header
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1413
			header: "/h\\d/i.test(a.nodeName)",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1414
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1415
			// :animated
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1416
			animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1417
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1418
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1419
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1420
	// The regular expressions that power the parsing engine
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1421
	parse: [
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1422
		// Match: [@value='test'], [@foo]
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1423
		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1424
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1425
		// Match: :contains('foo')
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1426
		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1427
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1428
		// Match: :even, :last-chlid, #id, .class
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1429
		new RegExp("^([:.#]*)(" + chars + "+)")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1430
	],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1431
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1432
	multiFilter: function( expr, elems, not ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1433
		var old, cur = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1434
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1435
		while ( expr && expr != old ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1436
			old = expr;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1437
			var f = jQuery.filter( expr, elems, not );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1438
			expr = f.t.replace(/^\s*,\s*/, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1439
			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1440
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1441
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1442
		return cur;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1443
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1444
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1445
	find: function( t, context ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1446
		// Quickly handle non-string expressions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1447
		if ( typeof t != "string" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1448
			return [ t ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1449
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1450
		// check to make sure context is a DOM element or a document
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1451
		if ( context && context.nodeType != 1 && context.nodeType != 9)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1452
			return [ ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1453
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1454
		// Set the correct context (if none is provided)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1455
		context = context || document;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1456
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1457
		// Initialize the search
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1458
		var ret = [context], done = [], last, nodeName;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1459
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1460
		// Continue while a selector expression exists, and while
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1461
		// we're no longer looping upon ourselves
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1462
		while ( t && last != t ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1463
			var r = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1464
			last = t;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1465
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1466
			t = jQuery.trim(t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1467
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1468
			var foundToken = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1469
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1470
			// An attempt at speeding up child selectors that
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1471
			// point to a specific element tag
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1472
			var re = quickChild;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1473
			var m = re.exec(t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1474
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1475
			if ( m ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1476
				nodeName = m[1].toUpperCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1477
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1478
				// Perform our own iteration and filter
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1479
				for ( var i = 0; ret[i]; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1480
					for ( var c = ret[i].firstChild; c; c = c.nextSibling )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1481
						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1482
							r.push( c );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1483
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1484
				ret = r;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1485
				t = t.replace( re, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1486
				if ( t.indexOf(" ") == 0 ) continue;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1487
				foundToken = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1488
			} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1489
				re = /^([>+~])\s*(\w*)/i;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1490
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1491
				if ( (m = re.exec(t)) != null ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1492
					r = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1493
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1494
					var merge = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1495
					nodeName = m[2].toUpperCase();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1496
					m = m[1];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1497
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1498
					for ( var j = 0, rl = ret.length; j < rl; j++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1499
						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1500
						for ( ; n; n = n.nextSibling )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1501
							if ( n.nodeType == 1 ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1502
								var id = jQuery.data(n);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1503
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1504
								if ( m == "~" && merge[id] ) break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1505
								
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1506
								if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1507
									if ( m == "~" ) merge[id] = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1508
									r.push( n );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1509
								}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1510
								
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1511
								if ( m == "+" ) break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1512
							}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1513
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1514
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1515
					ret = r;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1516
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1517
					// And remove the token
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1518
					t = jQuery.trim( t.replace( re, "" ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1519
					foundToken = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1520
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1521
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1522
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1523
			// See if there's still an expression, and that we haven't already
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1524
			// matched a token
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1525
			if ( t && !foundToken ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1526
				// Handle multiple expressions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1527
				if ( !t.indexOf(",") ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1528
					// Clean the result set
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1529
					if ( context == ret[0] ) ret.shift();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1530
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1531
					// Merge the result sets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1532
					done = jQuery.merge( done, ret );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1533
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1534
					// Reset the context
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1535
					r = ret = [context];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1536
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1537
					// Touch up the selector string
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1538
					t = " " + t.substr(1,t.length);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1539
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1540
				} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1541
					// Optimize for the case nodeName#idName
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1542
					var re2 = quickID;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1543
					var m = re2.exec(t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1544
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1545
					// Re-organize the results, so that they're consistent
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1546
					if ( m ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1547
						m = [ 0, m[2], m[3], m[1] ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1548
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1549
					} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1550
						// Otherwise, do a traditional filter check for
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1551
						// ID, class, and element selectors
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1552
						re2 = quickClass;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1553
						m = re2.exec(t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1554
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1555
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1556
					m[2] = m[2].replace(/\\/g, "");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1557
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1558
					var elem = ret[ret.length-1];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1559
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1560
					// Try to do a global search by ID, where we can
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1561
					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1562
						// Optimization for HTML document case
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1563
						var oid = elem.getElementById(m[2]);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1564
						
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1565
						// Do a quick check for the existence of the actual ID attribute
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1566
						// to avoid selecting by the name attribute in IE
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1567
						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1568
						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1569
							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1570
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1571
						// Do a quick check for node name (where applicable) so
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1572
						// that div#foo searches will be really fast
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1573
						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1574
					} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1575
						// We need to find all descendant elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1576
						for ( var i = 0; ret[i]; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1577
							// Grab the tag name being searched for
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1578
							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1579
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1580
							// Handle IE7 being really dumb about <object>s
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1581
							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1582
								tag = "param";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1583
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1584
							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1585
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1586
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1587
						// It's faster to filter by class and be done with it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1588
						if ( m[1] == "." )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1589
							r = jQuery.classFilter( r, m[2] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1590
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1591
						// Same with ID filtering
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1592
						if ( m[1] == "#" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1593
							var tmp = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1594
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1595
							// Try to find the element with the ID
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1596
							for ( var i = 0; r[i]; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1597
								if ( r[i].getAttribute("id") == m[2] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1598
									tmp = [ r[i] ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1599
									break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1600
								}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1601
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1602
							r = tmp;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1603
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1604
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1605
						ret = r;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1606
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1607
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1608
					t = t.replace( re2, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1609
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1610
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1611
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1612
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1613
			// If a selector string still exists
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1614
			if ( t ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1615
				// Attempt to filter it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1616
				var val = jQuery.filter(t,r);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1617
				ret = r = val.r;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1618
				t = jQuery.trim(val.t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1619
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1620
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1621
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1622
		// An error occurred with the selector;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1623
		// just return an empty set instead
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1624
		if ( t )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1625
			ret = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1626
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1627
		// Remove the root context
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1628
		if ( ret && context == ret[0] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1629
			ret.shift();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1630
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1631
		// And combine the results
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1632
		done = jQuery.merge( done, ret );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1633
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1634
		return done;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1635
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1636
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1637
	classFilter: function(r,m,not){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1638
		m = " " + m + " ";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1639
		var tmp = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1640
		for ( var i = 0; r[i]; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1641
			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1642
			if ( !not && pass || not && !pass )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1643
				tmp.push( r[i] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1644
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1645
		return tmp;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1646
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1647
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1648
	filter: function(t,r,not) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1649
		var last;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1650
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1651
		// Look for common filter expressions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1652
		while ( t && t != last ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1653
			last = t;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1654
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1655
			var p = jQuery.parse, m;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1656
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1657
			for ( var i = 0; p[i]; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1658
				m = p[i].exec( t );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1659
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1660
				if ( m ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1661
					// Remove what we just matched
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1662
					t = t.substring( m[0].length );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1663
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1664
					m[2] = m[2].replace(/\\/g, "");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1665
					break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1666
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1667
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1668
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1669
			if ( !m )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1670
				break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1671
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1672
			// :not() is a special case that can be optimized by
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1673
			// keeping it out of the expression list
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1674
			if ( m[1] == ":" && m[2] == "not" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1675
				// optimize if only one selector found (most common case)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1676
				r = isSimple.test( m[3] ) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1677
					jQuery.filter(m[3], r, true).r :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1678
					jQuery( r ).not( m[3] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1679
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1680
			// We can get a big speed boost by filtering by class here
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1681
			else if ( m[1] == "." )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1682
				r = jQuery.classFilter(r, m[2], not);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1683
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1684
			else if ( m[1] == "[" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1685
				var tmp = [], type = m[3];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1686
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1687
				for ( var i = 0, rl = r.length; i < rl; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1688
					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1689
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1690
					if ( z == null || /href|src|selected/.test(m[2]) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1691
						z = jQuery.attr(a,m[2]) || '';
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1692
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1693
					if ( (type == "" && !!z ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1694
						 type == "=" && z == m[5] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1695
						 type == "!=" && z != m[5] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1696
						 type == "^=" && z && !z.indexOf(m[5]) ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1697
						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1698
						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1699
							tmp.push( a );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1700
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1701
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1702
				r = tmp;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1703
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1704
			// We can get a speed boost by handling nth-child here
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1705
			} else if ( m[1] == ":" && m[2] == "nth-child" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1706
				var merge = {}, tmp = [],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1707
					// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1708
					test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1709
						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1710
						!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1711
					// calculate the numbers (first)n+(last) including if they are negative
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1712
					first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1713
 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1714
				// loop through all the elements left in the jQuery object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1715
				for ( var i = 0, rl = r.length; i < rl; i++ ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1716
					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1717
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1718
					if ( !merge[id] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1719
						var c = 1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1720
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1721
						for ( var n = parentNode.firstChild; n; n = n.nextSibling )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1722
							if ( n.nodeType == 1 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1723
								n.nodeIndex = c++;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1724
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1725
						merge[id] = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1726
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1727
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1728
					var add = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1729
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1730
					if ( first == 0 ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1731
						if ( node.nodeIndex == last )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1732
							add = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1733
					} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1734
						add = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1735
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1736
					if ( add ^ not )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1737
						tmp.push( node );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1738
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1739
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1740
				r = tmp;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1741
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1742
			// Otherwise, find the expression to execute
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1743
			} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1744
				var f = jQuery.expr[m[1]];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1745
				if ( typeof f != "string" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1746
					f = jQuery.expr[m[1]][m[2]];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1747
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1748
				// Build a custom macro to enclose it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1749
				f = eval("false||function(a,i){return " + f + "}");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1750
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1751
				// Execute it against the current filter
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1752
				r = jQuery.grep( r, f, not );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1753
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1754
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1755
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1756
		// Return an array of filtered elements (r)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1757
		// and the modified expression string (t)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1758
		return { r: r, t: t };
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1759
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1760
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1761
	dir: function( elem, dir ){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1762
		var matched = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1763
		var cur = elem[dir];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1764
		while ( cur && cur != document ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1765
			if ( cur.nodeType == 1 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1766
				matched.push( cur );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1767
			cur = cur[dir];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1768
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1769
		return matched;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1770
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1771
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1772
	nth: function(cur,result,dir,elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1773
		result = result || 1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1774
		var num = 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1775
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1776
		for ( ; cur; cur = cur[dir] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1777
			if ( cur.nodeType == 1 && ++num == result )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1778
				break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1779
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1780
		return cur;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1781
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1782
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1783
	sibling: function( n, elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1784
		var r = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1785
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1786
		for ( ; n; n = n.nextSibling ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1787
			if ( n.nodeType == 1 && (!elem || n != elem) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1788
				r.push( n );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1789
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1790
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1791
		return r;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1792
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1793
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1794
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1795
/*
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1796
 * A number of helper functions used for managing events.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1797
 * Many of the ideas behind this code orignated from 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1798
 * Dean Edwards' addEvent library.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1799
 */
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1800
jQuery.event = {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1801
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1802
	// Bind an event to an element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1803
	// Original by Dean Edwards
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1804
	add: function(elem, types, handler, data) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1805
		if ( elem.nodeType == 3 || elem.nodeType == 8 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1806
			return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1807
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1808
		// For whatever reason, IE has trouble passing the window object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1809
		// around, causing it to be cloned in the process
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1810
		if ( jQuery.browser.msie && elem.setInterval != undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1811
			elem = window;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1812
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1813
		// Make sure that the function being executed has a unique ID
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1814
		if ( !handler.guid )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1815
			handler.guid = this.guid++;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1816
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1817
		// if data is passed, bind to handler 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1818
		if( data != undefined ) { 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1819
			// Create temporary function pointer to original handler 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1820
			var fn = handler; 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1821
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1822
			// Create unique handler function, wrapped around original handler 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1823
			handler = function() { 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1824
				// Pass arguments and context to original handler 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1825
				return fn.apply(this, arguments); 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1826
			};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1827
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1828
			// Store data in unique handler 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1829
			handler.data = data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1830
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1831
			// Set the guid of unique handler to the same of original handler, so it can be removed 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1832
			handler.guid = fn.guid;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1833
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1834
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1835
		// Init the element's event structure
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1836
		var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1837
			handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1838
				// returned undefined or false
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1839
				var val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1840
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1841
				// Handle the second event of a trigger and when
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1842
				// an event is called after a page has unloaded
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1843
				if ( typeof jQuery == "undefined" || jQuery.event.triggered )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1844
					return val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1845
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1846
				val = jQuery.event.handle.apply(arguments.callee.elem, arguments);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1847
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1848
				return val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1849
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1850
		// Add elem as a property of the handle function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1851
		// This is to prevent a memory leak with non-native
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1852
		// event in IE.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1853
		handle.elem = elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1854
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1855
			// Handle multiple events seperated by a space
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1856
			// jQuery(...).bind("mouseover mouseout", fn);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1857
			jQuery.each(types.split(/\s+/), function(index, type) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1858
				// Namespaced event handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1859
				var parts = type.split(".");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1860
				type = parts[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1861
				handler.type = parts[1];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1862
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1863
				// Get the current list of functions bound to this event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1864
				var handlers = events[type];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1865
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1866
				// Init the event handler queue
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1867
				if (!handlers) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1868
					handlers = events[type] = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1869
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1870
					// Check for a special event handler
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1871
					// Only use addEventListener/attachEvent if the special
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1872
					// events handler returns false
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1873
					if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1874
						// Bind the global event handler to the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1875
						if (elem.addEventListener)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1876
							elem.addEventListener(type, handle, false);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1877
						else if (elem.attachEvent)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1878
							elem.attachEvent("on" + type, handle);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1879
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1880
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1881
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1882
				// Add the function to the element's handler list
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1883
				handlers[handler.guid] = handler;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1884
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1885
				// Keep track of which events have been used, for global triggering
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1886
				jQuery.event.global[type] = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1887
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1888
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1889
		// Nullify elem to prevent memory leaks in IE
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1890
		elem = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1891
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1892
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1893
	guid: 1,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1894
	global: {},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1895
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1896
	// Detach an event or set of events from an element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1897
	remove: function(elem, types, handler) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1898
		// don't do events on text and comment nodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1899
		if ( elem.nodeType == 3 || elem.nodeType == 8 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1900
			return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1901
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1902
		var events = jQuery.data(elem, "events"), ret, index;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1903
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1904
		if ( events ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1905
			// Unbind all events for the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1906
			if ( types == undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1907
				for ( var type in events )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1908
					this.remove( elem, type );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1909
			else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1910
				// types is actually an event object here
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1911
				if ( types.type ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1912
					handler = types.handler;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1913
					types = types.type;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1914
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1915
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1916
				// Handle multiple events seperated by a space
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1917
				// jQuery(...).unbind("mouseover mouseout", fn);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1918
				jQuery.each(types.split(/\s+/), function(index, type){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1919
					// Namespaced event handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1920
					var parts = type.split(".");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1921
					type = parts[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1922
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1923
					if ( events[type] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1924
						// remove the given handler for the given type
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1925
						if ( handler )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1926
							delete events[type][handler.guid];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1927
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1928
						// remove all handlers for the given type
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1929
						else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1930
							for ( handler in events[type] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1931
								// Handle the removal of namespaced events
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1932
								if ( !parts[1] || events[type][handler].type == parts[1] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1933
									delete events[type][handler];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1934
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1935
						// remove generic event handler if no more handlers exist
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1936
						for ( ret in events[type] ) break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1937
						if ( !ret ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1938
							if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1939
								if (elem.removeEventListener)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1940
									elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1941
								else if (elem.detachEvent)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1942
									elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1943
							}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1944
							ret = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1945
							delete events[type];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1946
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1947
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1948
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1949
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1950
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1951
			// Remove the expando if it's no longer used
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1952
			for ( ret in events ) break;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1953
			if ( !ret ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1954
				var handle = jQuery.data( elem, "handle" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1955
				if ( handle ) handle.elem = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1956
				jQuery.removeData( elem, "events" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1957
				jQuery.removeData( elem, "handle" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1958
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1959
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1960
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1961
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1962
	trigger: function(type, data, elem, donative, extra) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1963
		// Clone the incoming data, if any
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1964
		data = jQuery.makeArray(data || []);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1965
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1966
		// Handle a global trigger
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1967
		if ( !elem ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1968
			// Only trigger if we've ever bound an event for it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1969
			if ( this.global[type] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1970
				jQuery("*").add([window, document]).trigger(type, data);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1971
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1972
		// Handle triggering a single element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1973
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1974
			// don't do events on text and comment nodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1975
			if ( elem.nodeType == 3 || elem.nodeType == 8 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1976
				return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1977
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1978
			var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1979
				// Check to see if we need to provide a fake event, or not
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1980
				event = !data[0] || !data[0].preventDefault;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1981
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1982
			// Pass along a fake event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1983
			if ( event )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1984
				data.unshift( this.fix({ type: type, target: elem }) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1985
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1986
			// Enforce the right trigger type
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1987
			data[0].type = type;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1988
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1989
			// Trigger the event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1990
			if ( jQuery.isFunction( jQuery.data(elem, "handle") ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1991
				val = jQuery.data(elem, "handle").apply( elem, data );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1992
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1993
			// Handle triggering native .onfoo handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1994
			if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1995
				val = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1996
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1997
			// Extra functions don't get the custom event object
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1998
			if ( event )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  1999
				data.shift();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2000
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2001
			// Handle triggering of extra function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2002
			if ( extra && jQuery.isFunction( extra ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2003
				// call the extra function and tack the current return value on the end for possible inspection
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2004
				ret = extra.apply( elem, val == null ? data : data.concat( val ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2005
				// if anything is returned, give it precedence and have it overwrite the previous value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2006
				if (ret !== undefined)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2007
					val = ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2008
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2009
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2010
			// Trigger the native events (except for clicks on links)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2011
			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2012
				this.triggered = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2013
				try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2014
					elem[ type ]();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2015
				// prevent IE from throwing an error for some hidden elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2016
				} catch (e) {}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2017
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2018
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2019
			this.triggered = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2020
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2021
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2022
		return val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2023
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2024
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2025
	handle: function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2026
		// returned undefined or false
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2027
		var val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2028
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2029
		// Empty object is for triggered events with no data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2030
		event = jQuery.event.fix( event || window.event || {} ); 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2031
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2032
		// Namespaced event handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2033
		var parts = event.type.split(".");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2034
		event.type = parts[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2035
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2036
		var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2037
		args.unshift( event );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2038
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2039
		for ( var j in handlers ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2040
			var handler = handlers[j];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2041
			// Pass in a reference to the handler function itself
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2042
			// So that we can later remove it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2043
			args[0].handler = handler;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2044
			args[0].data = handler.data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2045
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2046
			// Filter the functions by class
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2047
			if ( !parts[1] || handler.type == parts[1] ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2048
				var ret = handler.apply( this, args );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2049
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2050
				if ( val !== false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2051
					val = ret;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2052
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2053
				if ( ret === false ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2054
					event.preventDefault();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2055
					event.stopPropagation();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2056
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2057
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2058
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2059
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2060
		// Clean up added properties in IE to prevent memory leak
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2061
		if (jQuery.browser.msie)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2062
			event.target = event.preventDefault = event.stopPropagation =
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2063
				event.handler = event.data = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2064
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2065
		return val;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2066
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2067
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2068
	fix: function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2069
		// store a copy of the original event object 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2070
		// and clone to set read-only properties
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2071
		var originalEvent = event;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2072
		event = jQuery.extend({}, originalEvent);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2073
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2074
		// add preventDefault and stopPropagation since 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2075
		// they will not work on the clone
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2076
		event.preventDefault = function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2077
			// if preventDefault exists run it on the original event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2078
			if (originalEvent.preventDefault)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2079
				originalEvent.preventDefault();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2080
			// otherwise set the returnValue property of the original event to false (IE)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2081
			originalEvent.returnValue = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2082
		};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2083
		event.stopPropagation = function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2084
			// if stopPropagation exists run it on the original event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2085
			if (originalEvent.stopPropagation)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2086
				originalEvent.stopPropagation();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2087
			// otherwise set the cancelBubble property of the original event to true (IE)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2088
			originalEvent.cancelBubble = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2089
		};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2090
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2091
		// Fix target property, if necessary
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2092
		if ( !event.target )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2093
			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2094
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2095
		// check if target is a textnode (safari)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2096
		if ( event.target.nodeType == 3 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2097
			event.target = originalEvent.target.parentNode;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2098
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2099
		// Add relatedTarget, if necessary
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2100
		if ( !event.relatedTarget && event.fromElement )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2101
			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2102
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2103
		// Calculate pageX/Y if missing and clientX/Y available
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2104
		if ( event.pageX == null && event.clientX != null ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2105
			var doc = document.documentElement, body = document.body;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2106
			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2107
			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2108
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2109
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2110
		// Add which for key events
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2111
		if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2112
			event.which = event.charCode || event.keyCode;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2113
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2114
		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2115
		if ( !event.metaKey && event.ctrlKey )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2116
			event.metaKey = event.ctrlKey;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2117
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2118
		// Add which for click: 1 == left; 2 == middle; 3 == right
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2119
		// Note: button is not normalized, so don't use it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2120
		if ( !event.which && event.button )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2121
			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2122
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2123
		return event;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2124
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2125
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2126
	special: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2127
		ready: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2128
			setup: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2129
				// Make sure the ready event is setup
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2130
				bindReady();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2131
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2132
			},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2133
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2134
			teardown: function() { return; }
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2135
		},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2136
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2137
		mouseenter: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2138
			setup: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2139
				if ( jQuery.browser.msie ) return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2140
				jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2141
				return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2142
			},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2143
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2144
			teardown: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2145
				if ( jQuery.browser.msie ) return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2146
				jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2147
				return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2148
			},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2149
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2150
			handler: function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2151
				// If we actually just moused on to a sub-element, ignore it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2152
				if ( withinElement(event, this) ) return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2153
				// Execute the right handlers by setting the event type to mouseenter
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2154
				arguments[0].type = "mouseenter";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2155
				return jQuery.event.handle.apply(this, arguments);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2156
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2157
		},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2158
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2159
		mouseleave: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2160
			setup: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2161
				if ( jQuery.browser.msie ) return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2162
				jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2163
				return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2164
			},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2165
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2166
			teardown: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2167
				if ( jQuery.browser.msie ) return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2168
				jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2169
				return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2170
			},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2171
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2172
			handler: function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2173
				// If we actually just moused on to a sub-element, ignore it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2174
				if ( withinElement(event, this) ) return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2175
				// Execute the right handlers by setting the event type to mouseleave
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2176
				arguments[0].type = "mouseleave";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2177
				return jQuery.event.handle.apply(this, arguments);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2178
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2179
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2180
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2181
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2182
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2183
jQuery.fn.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2184
	bind: function( type, data, fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2185
		return type == "unload" ? this.one(type, data, fn) : this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2186
			jQuery.event.add( this, type, fn || data, fn && data );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2187
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2188
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2189
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2190
	one: function( type, data, fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2191
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2192
			jQuery.event.add( this, type, function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2193
				jQuery(this).unbind(event);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2194
				return (fn || data).apply( this, arguments);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2195
			}, fn && data);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2196
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2197
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2198
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2199
	unbind: function( type, fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2200
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2201
			jQuery.event.remove( this, type, fn );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2202
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2203
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2204
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2205
	trigger: function( type, data, fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2206
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2207
			jQuery.event.trigger( type, data, this, true, fn );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2208
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2209
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2210
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2211
	triggerHandler: function( type, data, fn ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2212
		if ( this[0] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2213
			return jQuery.event.trigger( type, data, this[0], false, fn );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2214
		return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2215
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2216
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2217
	toggle: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2218
		// Save reference to arguments for access in closure
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2219
		var args = arguments;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2220
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2221
		return this.click(function(event) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2222
			// Figure out which function to execute
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2223
			this.lastToggle = 0 == this.lastToggle ? 1 : 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2224
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2225
			// Make sure that clicks stop
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2226
			event.preventDefault();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2227
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2228
			// and execute the function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2229
			return args[this.lastToggle].apply( this, arguments ) || false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2230
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2231
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2232
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2233
	hover: function(fnOver, fnOut) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2234
		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2235
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2236
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2237
	ready: function(fn) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2238
		// Attach the listeners
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2239
		bindReady();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2240
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2241
		// If the DOM is already ready
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2242
		if ( jQuery.isReady )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2243
			// Execute the function immediately
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2244
			fn.call( document, jQuery );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2245
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2246
		// Otherwise, remember the function for later
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2247
		else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2248
			// Add the function to the wait list
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2249
			jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2250
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2251
		return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2252
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2253
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2254
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2255
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2256
	isReady: false,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2257
	readyList: [],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2258
	// Handle when the DOM is ready
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2259
	ready: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2260
		// Make sure that the DOM is not already loaded
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2261
		if ( !jQuery.isReady ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2262
			// Remember that the DOM is ready
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2263
			jQuery.isReady = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2264
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2265
			// If there are functions bound, to execute
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2266
			if ( jQuery.readyList ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2267
				// Execute all of them
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2268
				jQuery.each( jQuery.readyList, function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2269
					this.apply( document );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2270
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2271
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2272
				// Reset the list of functions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2273
				jQuery.readyList = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2274
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2275
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2276
			// Trigger any bound ready events
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2277
			jQuery(document).triggerHandler("ready");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2278
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2279
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2280
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2281
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2282
var readyBound = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2283
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2284
function bindReady(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2285
	if ( readyBound ) return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2286
	readyBound = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2287
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2288
	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2289
	if ( document.addEventListener && !jQuery.browser.opera)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2290
		// Use the handy event callback
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2291
		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2292
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2293
	// If IE is used and is not in a frame
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2294
	// Continually check to see if the document is ready
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2295
	if ( jQuery.browser.msie && window == top ) (function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2296
		if (jQuery.isReady) return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2297
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2298
			// If IE is used, use the trick by Diego Perini
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2299
			// http://javascript.nwbox.com/IEContentLoaded/
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2300
			document.documentElement.doScroll("left");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2301
		} catch( error ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2302
			setTimeout( arguments.callee, 0 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2303
			return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2304
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2305
		// and execute any waiting functions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2306
		jQuery.ready();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2307
	})();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2308
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2309
	if ( jQuery.browser.opera )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2310
		document.addEventListener( "DOMContentLoaded", function () {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2311
			if (jQuery.isReady) return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2312
			for (var i = 0; i < document.styleSheets.length; i++)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2313
				if (document.styleSheets[i].disabled) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2314
					setTimeout( arguments.callee, 0 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2315
					return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2316
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2317
			// and execute any waiting functions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2318
			jQuery.ready();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2319
		}, false);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2320
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2321
	if ( jQuery.browser.safari ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2322
		var numStyles;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2323
		(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2324
			if (jQuery.isReady) return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2325
			if ( document.readyState != "loaded" && document.readyState != "complete" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2326
				setTimeout( arguments.callee, 0 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2327
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2328
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2329
			if ( numStyles === undefined )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2330
				numStyles = jQuery("style, link[rel=stylesheet]").length;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2331
			if ( document.styleSheets.length != numStyles ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2332
				setTimeout( arguments.callee, 0 );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2333
				return;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2334
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2335
			// and execute any waiting functions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2336
			jQuery.ready();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2337
		})();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2338
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2339
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2340
	// A fallback to window.onload, that will always work
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2341
	jQuery.event.add( window, "load", jQuery.ready );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2342
}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2343
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2344
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2345
	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2346
	"submit,keydown,keypress,keyup,error").split(","), function(i, name){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2347
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2348
	// Handle event binding
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2349
	jQuery.fn[name] = function(fn){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2350
		return fn ? this.bind(name, fn) : this.trigger(name);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2351
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2352
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2353
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2354
// Checks if an event happened on an element within another element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2355
// Used in jQuery.event.special.mouseenter and mouseleave handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2356
var withinElement = function(event, elem) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2357
	// Check if mouse(over|out) are still within the same parent element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2358
	var parent = event.relatedTarget;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2359
	// Traverse up the tree
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2360
	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2361
	// Return true if we actually just moused on to a sub-element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2362
	return parent == elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2363
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2364
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2365
// Prevent memory leaks in IE
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2366
// And prevent errors on refresh with events like mouseover in other browsers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2367
// Window isn't included so as not to unbind existing unload events
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2368
jQuery(window).bind("unload", function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2369
	jQuery("*").add(document).unbind();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2370
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2371
jQuery.fn.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2372
	load: function( url, params, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2373
		if ( jQuery.isFunction( url ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2374
			return this.bind("load", url);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2375
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2376
		var off = url.indexOf(" ");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2377
		if ( off >= 0 ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2378
			var selector = url.slice(off, url.length);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2379
			url = url.slice(0, off);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2380
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2381
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2382
		callback = callback || function(){};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2383
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2384
		// Default to a GET request
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2385
		var type = "GET";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2386
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2387
		// If the second parameter was provided
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2388
		if ( params )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2389
			// If it's a function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2390
			if ( jQuery.isFunction( params ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2391
				// We assume that it's the callback
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2392
				callback = params;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2393
				params = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2394
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2395
			// Otherwise, build a param string
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2396
			} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2397
				params = jQuery.param( params );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2398
				type = "POST";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2399
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2400
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2401
		var self = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2402
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2403
		// Request the remote document
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2404
		jQuery.ajax({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2405
			url: url,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2406
			type: type,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2407
			dataType: "html",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2408
			data: params,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2409
			complete: function(res, status){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2410
				// If successful, inject the HTML into all the matched elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2411
				if ( status == "success" || status == "notmodified" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2412
					// See if a selector was specified
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2413
					self.html( selector ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2414
						// Create a dummy div to hold the results
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2415
						jQuery("<div/>")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2416
							// inject the contents of the document in, removing the scripts
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2417
							// to avoid any 'Permission Denied' errors in IE
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2418
							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2419
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2420
							// Locate the specified elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2421
							.find(selector) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2422
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2423
						// If not, just inject the full result
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2424
						res.responseText );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2425
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2426
				self.each( callback, [res.responseText, status, res] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2427
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2428
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2429
		return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2430
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2431
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2432
	serialize: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2433
		return jQuery.param(this.serializeArray());
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2434
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2435
	serializeArray: function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2436
		return this.map(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2437
			return jQuery.nodeName(this, "form") ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2438
				jQuery.makeArray(this.elements) : this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2439
		})
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2440
		.filter(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2441
			return this.name && !this.disabled && 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2442
				(this.checked || /select|textarea/i.test(this.nodeName) || 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2443
					/text|hidden|password/i.test(this.type));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2444
		})
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2445
		.map(function(i, elem){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2446
			var val = jQuery(this).val();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2447
			return val == null ? null :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2448
				val.constructor == Array ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2449
					jQuery.map( val, function(val, i){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2450
						return {name: elem.name, value: val};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2451
					}) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2452
					{name: elem.name, value: val};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2453
		}).get();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2454
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2455
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2456
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2457
// Attach a bunch of functions for handling common AJAX events
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2458
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2459
	jQuery.fn[o] = function(f){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2460
		return this.bind(o, f);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2461
	};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2462
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2463
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2464
var jsc = (new Date).getTime();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2465
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2466
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2467
	get: function( url, data, callback, type ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2468
		// shift arguments if data argument was ommited
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2469
		if ( jQuery.isFunction( data ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2470
			callback = data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2471
			data = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2472
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2473
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2474
		return jQuery.ajax({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2475
			type: "GET",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2476
			url: url,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2477
			data: data,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2478
			success: callback,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2479
			dataType: type
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2480
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2481
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2482
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2483
	getScript: function( url, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2484
		return jQuery.get(url, null, callback, "script");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2485
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2486
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2487
	getJSON: function( url, data, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2488
		return jQuery.get(url, data, callback, "json");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2489
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2490
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2491
	post: function( url, data, callback, type ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2492
		if ( jQuery.isFunction( data ) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2493
			callback = data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2494
			data = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2495
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2496
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2497
		return jQuery.ajax({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2498
			type: "POST",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2499
			url: url,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2500
			data: data,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2501
			success: callback,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2502
			dataType: type
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2503
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2504
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2505
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2506
	ajaxSetup: function( settings ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2507
		jQuery.extend( jQuery.ajaxSettings, settings );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2508
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2509
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2510
	ajaxSettings: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2511
		global: true,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2512
		type: "GET",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2513
		timeout: 0,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2514
		contentType: "application/x-www-form-urlencoded",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2515
		processData: true,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2516
		async: true,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2517
		data: null,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2518
		username: null,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2519
		password: null,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2520
		accepts: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2521
			xml: "application/xml, text/xml",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2522
			html: "text/html",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2523
			script: "text/javascript, application/javascript",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2524
			json: "application/json, text/javascript",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2525
			text: "text/plain",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2526
			_default: "*/*"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2527
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2528
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2529
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2530
	// Last-Modified header cache for next request
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2531
	lastModified: {},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2532
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2533
	ajax: function( s ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2534
		var jsonp, jsre = /=\?(&|$)/g, status, data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2535
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2536
		// Extend the settings, but re-extend 's' so that it can be
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2537
		// checked again later (in the test suite, specifically)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2538
		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2539
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2540
		// convert data if not already a string
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2541
		if ( s.data && s.processData && typeof s.data != "string" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2542
			s.data = jQuery.param(s.data);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2543
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2544
		// Handle JSONP Parameter Callbacks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2545
		if ( s.dataType == "jsonp" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2546
			if ( s.type.toLowerCase() == "get" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2547
				if ( !s.url.match(jsre) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2548
					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2549
			} else if ( !s.data || !s.data.match(jsre) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2550
				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2551
			s.dataType = "json";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2552
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2553
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2554
		// Build temporary JSONP function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2555
		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2556
			jsonp = "jsonp" + jsc++;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2557
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2558
			// Replace the =? sequence both in the query string and the data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2559
			if ( s.data )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2560
				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2561
			s.url = s.url.replace(jsre, "=" + jsonp + "$1");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2562
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2563
			// We need to make sure
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2564
			// that a JSONP style response is executed properly
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2565
			s.dataType = "script";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2566
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2567
			// Handle JSONP-style loading
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2568
			window[ jsonp ] = function(tmp){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2569
				data = tmp;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2570
				success();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2571
				complete();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2572
				// Garbage collect
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2573
				window[ jsonp ] = undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2574
				try{ delete window[ jsonp ]; } catch(e){}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2575
				if ( head )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2576
					head.removeChild( script );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2577
			};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2578
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2579
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2580
		if ( s.dataType == "script" && s.cache == null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2581
			s.cache = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2582
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2583
		if ( s.cache === false && s.type.toLowerCase() == "get" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2584
			var ts = (new Date()).getTime();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2585
			// try replacing _= if it is there
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2586
			var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2587
			// if nothing was replaced, add timestamp to the end
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2588
			s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2589
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2590
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2591
		// If data is available, append data to url for get requests
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2592
		if ( s.data && s.type.toLowerCase() == "get" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2593
			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2594
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2595
			// IE likes to send both get and post data, prevent this
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2596
			s.data = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2597
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2598
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2599
		// Watch for a new set of requests
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2600
		if ( s.global && ! jQuery.active++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2601
			jQuery.event.trigger( "ajaxStart" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2602
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2603
		// If we're requesting a remote document
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2604
		// and trying to load JSON or Script with a GET
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2605
		if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2606
			var head = document.getElementsByTagName("head")[0];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2607
			var script = document.createElement("script");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2608
			script.src = s.url;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2609
			if (s.scriptCharset)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2610
				script.charset = s.scriptCharset;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2611
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2612
			// Handle Script loading
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2613
			if ( !jsonp ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2614
				var done = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2615
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2616
				// Attach handlers for all browsers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2617
				script.onload = script.onreadystatechange = function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2618
					if ( !done && (!this.readyState || 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2619
							this.readyState == "loaded" || this.readyState == "complete") ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2620
						done = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2621
						success();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2622
						complete();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2623
						head.removeChild( script );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2624
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2625
				};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2626
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2627
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2628
			head.appendChild(script);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2629
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2630
			// We handle everything using the script element injection
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2631
			return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2632
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2633
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2634
		var requestDone = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2635
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2636
		// Create the request object; Microsoft failed to properly
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2637
		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2638
		var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2639
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2640
		// Open the socket
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2641
		xml.open(s.type, s.url, s.async, s.username, s.password);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2642
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2643
		// Need an extra try/catch for cross domain requests in Firefox 3
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2644
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2645
			// Set the correct header, if data is being sent
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2646
			if ( s.data )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2647
				xml.setRequestHeader("Content-Type", s.contentType);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2648
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2649
			// Set the If-Modified-Since header, if ifModified mode.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2650
			if ( s.ifModified )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2651
				xml.setRequestHeader("If-Modified-Since",
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2652
					jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2653
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2654
			// Set header so the called script knows that it's an XMLHttpRequest
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2655
			xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2656
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2657
			// Set the Accepts header for the server, depending on the dataType
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2658
			xml.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2659
				s.accepts[ s.dataType ] + ", */*" :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2660
				s.accepts._default );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2661
		} catch(e){}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2662
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2663
		// Allow custom headers/mimetypes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2664
		if ( s.beforeSend )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2665
			s.beforeSend(xml);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2666
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2667
		if ( s.global )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2668
			jQuery.event.trigger("ajaxSend", [xml, s]);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2669
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2670
		// Wait for a response to come back
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2671
		var onreadystatechange = function(isTimeout){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2672
			// The transfer is complete and the data is available, or the request timed out
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2673
			if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2674
				requestDone = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2675
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2676
				// clear poll interval
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2677
				if (ival) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2678
					clearInterval(ival);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2679
					ival = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2680
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2681
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2682
				status = isTimeout == "timeout" && "timeout" ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2683
					!jQuery.httpSuccess( xml ) && "error" ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2684
					s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2685
					"success";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2686
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2687
				if ( status == "success" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2688
					// Watch for, and catch, XML document parse errors
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2689
					try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2690
						// process the data (runs the xml through httpData regardless of callback)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2691
						data = jQuery.httpData( xml, s.dataType );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2692
					} catch(e) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2693
						status = "parsererror";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2694
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2695
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2696
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2697
				// Make sure that the request was successful or notmodified
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2698
				if ( status == "success" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2699
					// Cache Last-Modified header, if ifModified mode.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2700
					var modRes;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2701
					try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2702
						modRes = xml.getResponseHeader("Last-Modified");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2703
					} catch(e) {} // swallow exception thrown by FF if header is not available
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2704
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2705
					if ( s.ifModified && modRes )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2706
						jQuery.lastModified[s.url] = modRes;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2707
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2708
					// JSONP handles its own success callback
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2709
					if ( !jsonp )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2710
						success();	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2711
				} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2712
					jQuery.handleError(s, xml, status);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2713
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2714
				// Fire the complete handlers
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2715
				complete();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2716
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2717
				// Stop memory leaks
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2718
				if ( s.async )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2719
					xml = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2720
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2721
		};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2722
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2723
		if ( s.async ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2724
			// don't attach the handler to the request, just poll it instead
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2725
			var ival = setInterval(onreadystatechange, 13); 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2726
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2727
			// Timeout checker
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2728
			if ( s.timeout > 0 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2729
				setTimeout(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2730
					// Check to see if the request is still happening
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2731
					if ( xml ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2732
						// Cancel the request
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2733
						xml.abort();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2734
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2735
						if( !requestDone )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2736
							onreadystatechange( "timeout" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2737
					}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2738
				}, s.timeout);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2739
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2740
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2741
		// Send the data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2742
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2743
			xml.send(s.data);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2744
		} catch(e) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2745
			jQuery.handleError(s, xml, null, e);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2746
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2747
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2748
		// firefox 1.5 doesn't fire statechange for sync requests
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2749
		if ( !s.async )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2750
			onreadystatechange();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2751
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2752
		function success(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2753
			// If a local callback was specified, fire it and pass it the data
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2754
			if ( s.success )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2755
				s.success( data, status );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2756
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2757
			// Fire the global callback
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2758
			if ( s.global )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2759
				jQuery.event.trigger( "ajaxSuccess", [xml, s] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2760
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2761
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2762
		function complete(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2763
			// Process result
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2764
			if ( s.complete )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2765
				s.complete(xml, status);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2766
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2767
			// The request was completed
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2768
			if ( s.global )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2769
				jQuery.event.trigger( "ajaxComplete", [xml, s] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2770
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2771
			// Handle the global AJAX counter
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2772
			if ( s.global && ! --jQuery.active )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2773
				jQuery.event.trigger( "ajaxStop" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2774
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2775
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2776
		// return XMLHttpRequest to allow aborting the request etc.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2777
		return xml;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2778
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2779
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2780
	handleError: function( s, xml, status, e ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2781
		// If a local callback was specified, fire it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2782
		if ( s.error ) s.error( xml, status, e );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2783
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2784
		// Fire the global callback
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2785
		if ( s.global )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2786
			jQuery.event.trigger( "ajaxError", [xml, s, e] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2787
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2788
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2789
	// Counter for holding the number of active queries
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2790
	active: 0,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2791
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2792
	// Determines if an XMLHttpRequest was successful or not
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2793
	httpSuccess: function( r ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2794
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2795
			// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2796
			return !r.status && location.protocol == "file:" ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2797
				( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2798
				jQuery.browser.safari && r.status == undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2799
		} catch(e){}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2800
		return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2801
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2802
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2803
	// Determines if an XMLHttpRequest returns NotModified
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2804
	httpNotModified: function( xml, url ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2805
		try {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2806
			var xmlRes = xml.getResponseHeader("Last-Modified");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2807
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2808
			// Firefox always returns 200. check Last-Modified date
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2809
			return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2810
				jQuery.browser.safari && xml.status == undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2811
		} catch(e){}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2812
		return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2813
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2814
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2815
	httpData: function( r, type ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2816
		var ct = r.getResponseHeader("content-type");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2817
		var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2818
		var data = xml ? r.responseXML : r.responseText;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2819
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2820
		if ( xml && data.documentElement.tagName == "parsererror" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2821
			throw "parsererror";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2822
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2823
		// If the type is "script", eval it in global context
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2824
		if ( type == "script" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2825
			jQuery.globalEval( data );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2826
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2827
		// Get the JavaScript object, if JSON is used.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2828
		if ( type == "json" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2829
			data = eval("(" + data + ")");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2830
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2831
		return data;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2832
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2833
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2834
	// Serialize an array of form elements or a set of
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2835
	// key/values into a query string
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2836
	param: function( a ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2837
		var s = [];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2838
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2839
		// If an array was passed in, assume that it is an array
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2840
		// of form elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2841
		if ( a.constructor == Array || a.jquery )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2842
			// Serialize the form elements
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2843
			jQuery.each( a, function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2844
				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2845
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2846
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2847
		// Otherwise, assume that it's an object of key/value pairs
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2848
		else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2849
			// Serialize the key/values
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2850
			for ( var j in a )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2851
				// If the value is an array then the key names need to be repeated
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2852
				if ( a[j] && a[j].constructor == Array )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2853
					jQuery.each( a[j], function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2854
						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2855
					});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2856
				else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2857
					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2858
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2859
		// Return the resulting serialization
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2860
		return s.join("&").replace(/%20/g, "+");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2861
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2862
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2863
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2864
jQuery.fn.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2865
	show: function(speed,callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2866
		return speed ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2867
			this.animate({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2868
				height: "show", width: "show", opacity: "show"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2869
			}, speed, callback) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2870
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2871
			this.filter(":hidden").each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2872
				this.style.display = this.oldblock || "";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2873
				if ( jQuery.css(this,"display") == "none" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2874
					var elem = jQuery("<" + this.tagName + " />").appendTo("body");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2875
					this.style.display = elem.css("display");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2876
					// handle an edge condition where css is - div { display:none; } or similar
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2877
					if (this.style.display == "none")
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2878
						this.style.display = "block";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2879
					elem.remove();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2880
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2881
			}).end();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2882
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2883
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2884
	hide: function(speed,callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2885
		return speed ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2886
			this.animate({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2887
				height: "hide", width: "hide", opacity: "hide"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2888
			}, speed, callback) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2889
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2890
			this.filter(":visible").each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2891
				this.oldblock = this.oldblock || jQuery.css(this,"display");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2892
				this.style.display = "none";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2893
			}).end();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2894
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2895
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2896
	// Save the old toggle function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2897
	_toggle: jQuery.fn.toggle,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2898
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2899
	toggle: function( fn, fn2 ){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2900
		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2901
			this._toggle( fn, fn2 ) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2902
			fn ?
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2903
				this.animate({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2904
					height: "toggle", width: "toggle", opacity: "toggle"
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2905
				}, fn, fn2) :
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2906
				this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2907
					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2908
				});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2909
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2910
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2911
	slideDown: function(speed,callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2912
		return this.animate({height: "show"}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2913
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2914
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2915
	slideUp: function(speed,callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2916
		return this.animate({height: "hide"}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2917
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2918
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2919
	slideToggle: function(speed, callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2920
		return this.animate({height: "toggle"}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2921
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2922
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2923
	fadeIn: function(speed, callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2924
		return this.animate({opacity: "show"}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2925
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2926
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2927
	fadeOut: function(speed, callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2928
		return this.animate({opacity: "hide"}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2929
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2930
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2931
	fadeTo: function(speed,to,callback){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2932
		return this.animate({opacity: to}, speed, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2933
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2934
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2935
	animate: function( prop, speed, easing, callback ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2936
		var optall = jQuery.speed(speed, easing, callback);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2937
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2938
		return this[ optall.queue === false ? "each" : "queue" ](function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2939
			if ( this.nodeType != 1)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2940
				return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2941
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2942
			var opt = jQuery.extend({}, optall);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2943
			var hidden = jQuery(this).is(":hidden"), self = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2944
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2945
			for ( var p in prop ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2946
				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2947
					return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2948
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2949
				if ( p == "height" || p == "width" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2950
					// Store display property
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2951
					opt.display = jQuery.css(this, "display");
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2952
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2953
					// Make sure that nothing sneaks out
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2954
					opt.overflow = this.style.overflow;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2955
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2956
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2957
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2958
			if ( opt.overflow != null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2959
				this.style.overflow = "hidden";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2960
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2961
			opt.curAnim = jQuery.extend({}, prop);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2962
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2963
			jQuery.each( prop, function(name, val){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2964
				var e = new jQuery.fx( self, opt, name );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2965
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2966
				if ( /toggle|show|hide/.test(val) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2967
					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2968
				else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2969
					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2970
						start = e.cur(true) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2971
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2972
					if ( parts ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2973
						var end = parseFloat(parts[2]),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2974
							unit = parts[3] || "px";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2975
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2976
						// We need to compute starting value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2977
						if ( unit != "px" ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2978
							self.style[ name ] = (end || 1) + unit;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2979
							start = ((end || 1) / e.cur(true)) * start;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2980
							self.style[ name ] = start + unit;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2981
						}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2982
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2983
						// If a +=/-= token was provided, we're doing a relative animation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2984
						if ( parts[1] )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2985
							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2986
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2987
						e.custom( start, end, unit );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2988
					} else
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2989
						e.custom( start, val, "" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2990
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2991
			});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2992
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2993
			// For JS strict compliance
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2994
			return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2995
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2996
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2997
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2998
	queue: function(type, fn){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  2999
		if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3000
			fn = type;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3001
			type = "fx";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3002
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3003
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3004
		if ( !type || (typeof type == "string" && !fn) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3005
			return queue( this[0], type );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3006
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3007
		return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3008
			if ( fn.constructor == Array )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3009
				queue(this, type, fn);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3010
			else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3011
				queue(this, type).push( fn );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3012
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3013
				if ( queue(this, type).length == 1 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3014
					fn.apply(this);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3015
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3016
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3017
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3018
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3019
	stop: function(clearQueue, gotoEnd){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3020
		var timers = jQuery.timers;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3021
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3022
		if (clearQueue)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3023
			this.queue([]);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3024
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3025
		this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3026
			// go in reverse order so anything added to the queue during the loop is ignored
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3027
			for ( var i = timers.length - 1; i >= 0; i-- )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3028
				if ( timers[i].elem == this ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3029
					if (gotoEnd)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3030
						// force the next step to be the last
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3031
						timers[i](true);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3032
					timers.splice(i, 1);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3033
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3034
		});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3035
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3036
		// start the next in the queue if the last step wasn't forced
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3037
		if (!gotoEnd)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3038
			this.dequeue();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3039
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3040
		return this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3041
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3042
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3043
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3044
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3045
var queue = function( elem, type, array ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3046
	if ( !elem )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3047
		return undefined;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3048
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3049
	type = type || "fx";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3050
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3051
	var q = jQuery.data( elem, type + "queue" );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3052
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3053
	if ( !q || array )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3054
		q = jQuery.data( elem, type + "queue", 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3055
			array ? jQuery.makeArray(array) : [] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3056
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3057
	return q;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3058
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3059
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3060
jQuery.fn.dequeue = function(type){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3061
	type = type || "fx";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3062
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3063
	return this.each(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3064
		var q = queue(this, type);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3065
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3066
		q.shift();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3067
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3068
		if ( q.length )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3069
			q[0].apply( this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3070
	});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3071
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3072
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3073
jQuery.extend({
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3074
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3075
	speed: function(speed, easing, fn) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3076
		var opt = speed && speed.constructor == Object ? speed : {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3077
			complete: fn || !fn && easing || 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3078
				jQuery.isFunction( speed ) && speed,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3079
			duration: speed,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3080
			easing: fn && easing || easing && easing.constructor != Function && easing
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3081
		};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3082
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3083
		opt.duration = (opt.duration && opt.duration.constructor == Number ? 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3084
			opt.duration : 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3085
			{ slow: 600, fast: 200 }[opt.duration]) || 400;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3086
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3087
		// Queueing
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3088
		opt.old = opt.complete;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3089
		opt.complete = function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3090
			if ( opt.queue !== false )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3091
				jQuery(this).dequeue();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3092
			if ( jQuery.isFunction( opt.old ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3093
				opt.old.apply( this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3094
		};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3095
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3096
		return opt;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3097
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3098
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3099
	easing: {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3100
		linear: function( p, n, firstNum, diff ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3101
			return firstNum + diff * p;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3102
		},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3103
		swing: function( p, n, firstNum, diff ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3104
			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3105
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3106
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3107
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3108
	timers: [],
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3109
	timerId: null,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3110
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3111
	fx: function( elem, options, prop ){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3112
		this.options = options;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3113
		this.elem = elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3114
		this.prop = prop;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3115
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3116
		if ( !options.orig )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3117
			options.orig = {};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3118
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3119
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3120
});
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3121
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3122
jQuery.fx.prototype = {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3123
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3124
	// Simple function for setting a style value
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3125
	update: function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3126
		if ( this.options.step )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3127
			this.options.step.apply( this.elem, [ this.now, this ] );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3128
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3129
		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3130
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3131
		// Set display property to block for height/width animations
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3132
		if ( this.prop == "height" || this.prop == "width" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3133
			this.elem.style.display = "block";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3134
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3135
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3136
	// Get the current size
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3137
	cur: function(force){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3138
		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3139
			return this.elem[ this.prop ];
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3140
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3141
		var r = parseFloat(jQuery.css(this.elem, this.prop, force));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3142
		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3143
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3144
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3145
	// Start an animation from one number to another
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3146
	custom: function(from, to, unit){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3147
		this.startTime = (new Date()).getTime();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3148
		this.start = from;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3149
		this.end = to;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3150
		this.unit = unit || this.unit || "px";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3151
		this.now = this.start;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3152
		this.pos = this.state = 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3153
		this.update();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3154
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3155
		var self = this;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3156
		function t(gotoEnd){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3157
			return self.step(gotoEnd);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3158
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3159
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3160
		t.elem = this.elem;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3161
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3162
		jQuery.timers.push(t);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3163
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3164
		if ( jQuery.timerId == null ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3165
			jQuery.timerId = setInterval(function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3166
				var timers = jQuery.timers;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3167
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3168
				for ( var i = 0; i < timers.length; i++ )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3169
					if ( !timers[i]() )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3170
						timers.splice(i--, 1);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3171
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3172
				if ( !timers.length ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3173
					clearInterval( jQuery.timerId );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3174
					jQuery.timerId = null;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3175
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3176
			}, 13);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3177
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3178
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3179
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3180
	// Simple 'show' function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3181
	show: function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3182
		// Remember where we started, so that we can go back to it later
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3183
		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3184
		this.options.show = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3185
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3186
		// Begin the animation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3187
		this.custom(0, this.cur());
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3188
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3189
		// Make sure that we start at a small width/height to avoid any
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3190
		// flash of content
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3191
		if ( this.prop == "width" || this.prop == "height" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3192
			this.elem.style[this.prop] = "1px";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3193
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3194
		// Start by showing the element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3195
		jQuery(this.elem).show();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3196
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3197
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3198
	// Simple 'hide' function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3199
	hide: function(){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3200
		// Remember where we started, so that we can go back to it later
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3201
		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3202
		this.options.hide = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3203
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3204
		// Begin the animation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3205
		this.custom(this.cur(), 0);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3206
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3207
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3208
	// Each step of an animation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3209
	step: function(gotoEnd){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3210
		var t = (new Date()).getTime();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3211
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3212
		if ( gotoEnd || t > this.options.duration + this.startTime ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3213
			this.now = this.end;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3214
			this.pos = this.state = 1;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3215
			this.update();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3216
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3217
			this.options.curAnim[ this.prop ] = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3218
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3219
			var done = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3220
			for ( var i in this.options.curAnim )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3221
				if ( this.options.curAnim[i] !== true )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3222
					done = false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3223
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3224
			if ( done ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3225
				if ( this.options.display != null ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3226
					// Reset the overflow
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3227
					this.elem.style.overflow = this.options.overflow;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3228
				
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3229
					// Reset the display
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3230
					this.elem.style.display = this.options.display;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3231
					if ( jQuery.css(this.elem, "display") == "none" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3232
						this.elem.style.display = "block";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3233
				}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3234
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3235
				// Hide the element if the "hide" operation was done
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3236
				if ( this.options.hide )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3237
					this.elem.style.display = "none";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3238
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3239
				// Reset the properties, if the item has been hidden or shown
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3240
				if ( this.options.hide || this.options.show )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3241
					for ( var p in this.options.curAnim )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3242
						jQuery.attr(this.elem.style, p, this.options.orig[p]);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3243
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3244
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3245
			// If a callback was provided, execute it
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3246
			if ( done && jQuery.isFunction( this.options.complete ) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3247
				// Execute the complete function
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3248
				this.options.complete.apply( this.elem );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3249
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3250
			return false;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3251
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3252
			var n = t - this.startTime;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3253
			this.state = n / this.options.duration;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3254
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3255
			// Perform the easing function, defaults to swing
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3256
			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3257
			this.now = this.start + ((this.end - this.start) * this.pos);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3258
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3259
			// Perform the next step of the animation
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3260
			this.update();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3261
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3262
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3263
		return true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3264
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3265
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3266
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3267
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3268
jQuery.fx.step = {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3269
	scrollLeft: function(fx){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3270
		fx.elem.scrollLeft = fx.now;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3271
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3272
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3273
	scrollTop: function(fx){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3274
		fx.elem.scrollTop = fx.now;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3275
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3276
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3277
	opacity: function(fx){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3278
		jQuery.attr(fx.elem.style, "opacity", fx.now);
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3279
	},
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3280
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3281
	_default: function(fx){
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3282
		fx.elem.style[ fx.prop ] = fx.now + fx.unit;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3283
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3284
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3285
// The Offset Method
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3286
// Originally By Brandon Aaron, part of the Dimension Plugin
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3287
// http://jquery.com/plugins/project/dimensions
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3288
jQuery.fn.offset = function() {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3289
	var left = 0, top = 0, elem = this[0], results;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3290
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3291
	if ( elem ) with ( jQuery.browser ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3292
		var parent       = elem.parentNode, 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3293
		    offsetChild  = elem,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3294
		    offsetParent = elem.offsetParent, 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3295
		    doc          = elem.ownerDocument,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3296
		    safari2      = safari && parseInt(version) < 522,
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3297
		    fixed        = jQuery.css(elem, "position") == "fixed";
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3298
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3299
		// Use getBoundingClientRect if available
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3300
		if ( elem.getBoundingClientRect ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3301
			var box = elem.getBoundingClientRect();
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3302
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3303
			// Add the document scroll offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3304
			add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3305
				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3306
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3307
			// IE adds the HTML element's border, by default it is medium which is 2px
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3308
			// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3309
			// IE 7 standards mode, the border is always 2px
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3310
			// This border/offset is typically represented by the clientLeft and clientTop properties
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3311
			// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3312
			// Therefore this method will be off by 2px in IE while in quirksmode
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3313
			add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3314
	
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3315
		// Otherwise loop through the offsetParents and parentNodes
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3316
		} else {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3317
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3318
			// Initial element offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3319
			add( elem.offsetLeft, elem.offsetTop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3320
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3321
			// Get parent offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3322
			while ( offsetParent ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3323
				// Add offsetParent offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3324
				add( offsetParent.offsetLeft, offsetParent.offsetTop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3325
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3326
				// Mozilla and Safari > 2 does not include the border on offset parents
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3327
				// However Mozilla adds the border for table or table cells
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3328
				if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3329
					border( offsetParent );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3330
					
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3331
				// Add the document scroll offsets if position is fixed on any offsetParent
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3332
				if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3333
					fixed = true;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3334
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3335
				// Set offsetChild to previous offsetParent unless it is the body element
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3336
				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3337
				// Get next offsetParent
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3338
				offsetParent = offsetParent.offsetParent;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3339
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3340
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3341
			// Get parent scroll offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3342
			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3343
				// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3344
				if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3345
					// Subtract parent scroll offsets
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3346
					add( -parent.scrollLeft, -parent.scrollTop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3347
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3348
				// Mozilla does not add the border for a parent that has overflow != visible
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3349
				if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3350
					border( parent );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3351
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3352
				// Get next parent
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3353
				parent = parent.parentNode;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3354
			}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3355
		
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3356
			// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3357
			// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3358
			if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) || 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3359
				(mozilla && jQuery.css(offsetChild, "position") != "absolute") )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3360
					add( -doc.body.offsetLeft, -doc.body.offsetTop );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3361
			
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3362
			// Add the document scroll offsets if position is fixed
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3363
			if ( fixed )
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3364
				add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3365
					Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3366
		}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3367
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3368
		// Return an object with top and left properties
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3369
		results = { top: top, left: left };
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3370
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3371
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3372
	function border(elem) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3373
		add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3374
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3375
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3376
	function add(l, t) {
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3377
		left += parseInt(l) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3378
		top += parseInt(t) || 0;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3379
	}
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3380
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3381
	return results;
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3382
};
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
  3383
})();