Projet

Général

Profil

Révision 503b3f7b

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/jquery_update/replace/ui/ui/jquery.ui.core.js
1 1
/*!
2
 * jQuery UI 1.8.11
2
 * jQuery UI Core 1.10.2
3
 * http://jqueryui.com
3 4
 *
4
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
 * Dual licensed under the MIT or GPL Version 2 licenses.
5
 * Copyright 2013 jQuery Foundation and other contributors
6
 * Released under the MIT license.
6 7
 * http://jquery.org/license
7 8
 *
8
 * http://docs.jquery.com/UI
9
 * http://api.jqueryui.com/category/ui-core/
9 10
 */
10 11
(function( $, undefined ) {
11 12

  
12
// prevent duplicate loading
13
// this is only a problem because we proxy existing functions
14
// and we don't want to double proxy them
13
var uuid = 0,
14
	runiqueId = /^ui-id-\d+$/;
15

  
16
// $.ui might exist from components with no dependencies, e.g., $.ui.position
15 17
$.ui = $.ui || {};
16
if ( $.ui.version ) {
17
	return;
18
}
19 18

  
20 19
$.extend( $.ui, {
21
	version: "1.8.11",
20
	version: "1.10.2",
22 21

  
23 22
	keyCode: {
24
		ALT: 18,
25 23
		BACKSPACE: 8,
26
		CAPS_LOCK: 20,
27 24
		COMMA: 188,
28
		COMMAND: 91,
29
		COMMAND_LEFT: 91, // COMMAND
30
		COMMAND_RIGHT: 93,
31
		CONTROL: 17,
32 25
		DELETE: 46,
33 26
		DOWN: 40,
34 27
		END: 35,
35 28
		ENTER: 13,
36 29
		ESCAPE: 27,
37 30
		HOME: 36,
38
		INSERT: 45,
39 31
		LEFT: 37,
40
		MENU: 93, // COMMAND_RIGHT
41 32
		NUMPAD_ADD: 107,
42 33
		NUMPAD_DECIMAL: 110,
43 34
		NUMPAD_DIVIDE: 111,
......
48 39
		PAGE_UP: 33,
49 40
		PERIOD: 190,
50 41
		RIGHT: 39,
51
		SHIFT: 16,
52 42
		SPACE: 32,
53 43
		TAB: 9,
54
		UP: 38,
55
		WINDOWS: 91 // COMMAND
44
		UP: 38
56 45
	}
57 46
});
58 47

  
59 48
// plugins
60 49
$.fn.extend({
61
	_focus: $.fn.focus,
62
	focus: function( delay, fn ) {
63
		return typeof delay === "number" ?
64
			this.each(function() {
65
				var elem = this;
66
				setTimeout(function() {
67
					$( elem ).focus();
68
					if ( fn ) {
69
						fn.call( elem );
70
					}
71
				}, delay );
72
			}) :
73
			this._focus.apply( this, arguments );
74
	},
50
	focus: (function( orig ) {
51
		return function( delay, fn ) {
52
			return typeof delay === "number" ?
53
				this.each(function() {
54
					var elem = this;
55
					setTimeout(function() {
56
						$( elem ).focus();
57
						if ( fn ) {
58
							fn.call( elem );
59
						}
60
					}, delay );
61
				}) :
62
				orig.apply( this, arguments );
63
		};
64
	})( $.fn.focus ),
75 65

  
76 66
	scrollParent: function() {
77 67
		var scrollParent;
78
		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
68
		if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
79 69
			scrollParent = this.parents().filter(function() {
80
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
70
				return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
81 71
			}).eq(0);
82 72
		} else {
83 73
			scrollParent = this.parents().filter(function() {
84
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
74
				return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
85 75
			}).eq(0);
86 76
		}
87 77

  
88
		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
78
		return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
89 79
	},
90 80

  
91 81
	zIndex: function( zIndex ) {
......
117 107
		return 0;
118 108
	},
119 109

  
120
	disableSelection: function() {
121
		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
122
			".ui-disableSelection", function( event ) {
123
				event.preventDefault();
124
			});
125
	},
126

  
127
	enableSelection: function() {
128
		return this.unbind( ".ui-disableSelection" );
129
	}
130
});
131

  
132
$.each( [ "Width", "Height" ], function( i, name ) {
133
	var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
134
		type = name.toLowerCase(),
135
		orig = {
136
			innerWidth: $.fn.innerWidth,
137
			innerHeight: $.fn.innerHeight,
138
			outerWidth: $.fn.outerWidth,
139
			outerHeight: $.fn.outerHeight
140
		};
141

  
142
	function reduce( elem, size, border, margin ) {
143
		$.each( side, function() {
144
			size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
145
			if ( border ) {
146
				size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
147
			}
148
			if ( margin ) {
149
				size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
150
			}
151
		});
152
		return size;
153
	}
154

  
155
	$.fn[ "inner" + name ] = function( size ) {
156
		if ( size === undefined ) {
157
			return orig[ "inner" + name ].call( this );
158
		}
159

  
110
	uniqueId: function() {
160 111
		return this.each(function() {
161
			$( this ).css( type, reduce( this, size ) + "px" );
112
			if ( !this.id ) {
113
				this.id = "ui-id-" + (++uuid);
114
			}
162 115
		});
163
	};
164

  
165
	$.fn[ "outer" + name] = function( size, margin ) {
166
		if ( typeof size !== "number" ) {
167
			return orig[ "outer" + name ].call( this, size );
168
		}
116
	},
169 117

  
118
	removeUniqueId: function() {
170 119
		return this.each(function() {
171
			$( this).css( type, reduce( this, size, true, margin ) + "px" );
120
			if ( runiqueId.test( this.id ) ) {
121
				$( this ).removeAttr( "id" );
122
			}
172 123
		});
173
	};
124
	}
174 125
});
175 126

  
176 127
// selectors
128
function focusable( element, isTabIndexNotNaN ) {
129
	var map, mapName, img,
130
		nodeName = element.nodeName.toLowerCase();
131
	if ( "area" === nodeName ) {
132
		map = element.parentNode;
133
		mapName = map.name;
134
		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
135
			return false;
136
		}
137
		img = $( "img[usemap=#" + mapName + "]" )[0];
138
		return !!img && visible( img );
139
	}
140
	return ( /input|select|textarea|button|object/.test( nodeName ) ?
141
		!element.disabled :
142
		"a" === nodeName ?
143
			element.href || isTabIndexNotNaN :
144
			isTabIndexNotNaN) &&
145
		// the element and all of its ancestors must be visible
146
		visible( element );
147
}
148

  
177 149
function visible( element ) {
178
	return !$( element ).parents().andSelf().filter(function() {
179
		return $.curCSS( this, "visibility" ) === "hidden" ||
180
			$.expr.filters.hidden( this );
181
	}).length;
150
	return $.expr.filters.visible( element ) &&
151
		!$( element ).parents().addBack().filter(function() {
152
			return $.css( this, "visibility" ) === "hidden";
153
		}).length;
182 154
}
183 155

  
184 156
$.extend( $.expr[ ":" ], {
185
	data: function( elem, i, match ) {
186
		return !!$.data( elem, match[ 3 ] );
187
	},
157
	data: $.expr.createPseudo ?
158
		$.expr.createPseudo(function( dataName ) {
159
			return function( elem ) {
160
				return !!$.data( elem, dataName );
161
			};
162
		}) :
163
		// support: jQuery <1.8
164
		function( elem, i, match ) {
165
			return !!$.data( elem, match[ 3 ] );
166
		},
188 167

  
189 168
	focusable: function( element ) {
190
		var nodeName = element.nodeName.toLowerCase(),
191
			tabIndex = $.attr( element, "tabindex" );
192
		if ( "area" === nodeName ) {
193
			var map = element.parentNode,
194
				mapName = map.name,
195
				img;
196
			if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
197
				return false;
198
			}
199
			img = $( "img[usemap=#" + mapName + "]" )[0];
200
			return !!img && visible( img );
201
		}
202
		return ( /input|select|textarea|button|object/.test( nodeName )
203
			? !element.disabled
204
			: "a" == nodeName
205
				? element.href || !isNaN( tabIndex )
206
				: !isNaN( tabIndex ))
207
			// the element and all of its ancestors must be visible
208
			&& visible( element );
169
		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
209 170
	},
210 171

  
211 172
	tabbable: function( element ) {
212
		var tabIndex = $.attr( element, "tabindex" );
213
		return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
173
		var tabIndex = $.attr( element, "tabindex" ),
174
			isTabIndexNaN = isNaN( tabIndex );
175
		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
214 176
	}
215 177
});
216 178

  
217
// support
218
$(function() {
219
	var body = document.body,
220
		div = body.appendChild( div = document.createElement( "div" ) );
179
// support: jQuery <1.8
180
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
181
	$.each( [ "Width", "Height" ], function( i, name ) {
182
		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
183
			type = name.toLowerCase(),
184
			orig = {
185
				innerWidth: $.fn.innerWidth,
186
				innerHeight: $.fn.innerHeight,
187
				outerWidth: $.fn.outerWidth,
188
				outerHeight: $.fn.outerHeight
189
			};
221 190

  
222
	$.extend( div.style, {
223
		minHeight: "100px",
224
		height: "auto",
225
		padding: 0,
226
		borderWidth: 0
191
		function reduce( elem, size, border, margin ) {
192
			$.each( side, function() {
193
				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
194
				if ( border ) {
195
					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
196
				}
197
				if ( margin ) {
198
					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
199
				}
200
			});
201
			return size;
202
		}
203

  
204
		$.fn[ "inner" + name ] = function( size ) {
205
			if ( size === undefined ) {
206
				return orig[ "inner" + name ].call( this );
207
			}
208

  
209
			return this.each(function() {
210
				$( this ).css( type, reduce( this, size ) + "px" );
211
			});
212
		};
213

  
214
		$.fn[ "outer" + name] = function( size, margin ) {
215
			if ( typeof size !== "number" ) {
216
				return orig[ "outer" + name ].call( this, size );
217
			}
218

  
219
			return this.each(function() {
220
				$( this).css( type, reduce( this, size, true, margin ) + "px" );
221
			});
222
		};
227 223
	});
224
}
228 225

  
229
	$.support.minHeight = div.offsetHeight === 100;
230
	$.support.selectstart = "onselectstart" in div;
226
// support: jQuery <1.8
227
if ( !$.fn.addBack ) {
228
	$.fn.addBack = function( selector ) {
229
		return this.add( selector == null ?
230
			this.prevObject : this.prevObject.filter( selector )
231
		);
232
	};
233
}
231 234

  
232
	// set display to none to avoid a layout bug in IE
233
	// http://dev.jquery.com/ticket/4014
234
	body.removeChild( div ).style.display = "none";
235
});
235
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
236
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
237
	$.fn.removeData = (function( removeData ) {
238
		return function( key ) {
239
			if ( arguments.length ) {
240
				return removeData.call( this, $.camelCase( key ) );
241
			} else {
242
				return removeData.call( this );
243
			}
244
		};
245
	})( $.fn.removeData );
246
}
236 247

  
237 248

  
238 249

  
239 250

  
240 251

  
241 252
// deprecated
253
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
254

  
255
$.support.selectstart = "onselectstart" in document.createElement( "div" );
256
$.fn.extend({
257
	disableSelection: function() {
258
		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
259
			".ui-disableSelection", function( event ) {
260
				event.preventDefault();
261
			});
262
	},
263

  
264
	enableSelection: function() {
265
		return this.unbind( ".ui-disableSelection" );
266
	}
267
});
268

  
242 269
$.extend( $.ui, {
243 270
	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
244 271
	plugin: {
245 272
		add: function( module, option, set ) {
246
			var proto = $.ui[ module ].prototype;
247
			for ( var i in set ) {
273
			var i,
274
				proto = $.ui[ module ].prototype;
275
			for ( i in set ) {
248 276
				proto.plugins[ i ] = proto.plugins[ i ] || [];
249 277
				proto.plugins[ i ].push( [ option, set[ i ] ] );
250 278
			}
251 279
		},
252 280
		call: function( instance, name, args ) {
253
			var set = instance.plugins[ name ];
254
			if ( !set || !instance.element[ 0 ].parentNode ) {
281
			var i,
282
				set = instance.plugins[ name ];
283
			if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
255 284
				return;
256 285
			}
257
	
258
			for ( var i = 0; i < set.length; i++ ) {
286

  
287
			for ( i = 0; i < set.length; i++ ) {
259 288
				if ( instance.options[ set[ i ][ 0 ] ] ) {
260 289
					set[ i ][ 1 ].apply( instance.element, args );
261 290
				}
262 291
			}
263 292
		}
264 293
	},
265
	
266
	// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
267
	contains: function( a, b ) {
268
		return document.compareDocumentPosition ?
269
			a.compareDocumentPosition( b ) & 16 :
270
			a !== b && a.contains( b );
271
	},
272
	
294

  
273 295
	// only used by resizable
274 296
	hasScroll: function( el, a ) {
275
	
297

  
276 298
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
277 299
		if ( $( el ).css( "overflow" ) === "hidden") {
278 300
			return false;
279 301
		}
280
	
302

  
281 303
		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
282 304
			has = false;
283
	
305

  
284 306
		if ( el[ scroll ] > 0 ) {
285 307
			return true;
286 308
		}
287
	
309

  
288 310
		// TODO: determine which cases actually cause this to happen
289 311
		// if the element doesn't have the scroll set, see if it's possible to
290 312
		// set the scroll
......
292 314
		has = ( el[ scroll ] > 0 );
293 315
		el[ scroll ] = 0;
294 316
		return has;
295
	},
296
	
297
	// these are odd functions, fix the API or move into individual plugins
298
	isOverAxis: function( x, reference, size ) {
299
		//Determines when x coordinate is over "b" element axis
300
		return ( x > reference ) && ( x < ( reference + size ) );
301
	},
302
	isOver: function( y, x, top, left, height, width ) {
303
		//Determines when x, y coordinates is over "b" element
304
		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
305 317
	}
306 318
});
307 319

  

Formats disponibles : Unified diff