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.js
1
/*!
2
 * jQuery UI 1.8.11
3
 *
4
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
 * Dual licensed under the MIT or GPL Version 2 licenses.
6
 * http://jquery.org/license
7
 *
8
 * http://docs.jquery.com/UI
9
 */
1
/*! jQuery UI - v1.10.2 - 2013-03-14
2
* http://jqueryui.com
3
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
4
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
10 5
(function( $, undefined ) {
11 6

  
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
7
var uuid = 0,
8
	runiqueId = /^ui-id-\d+$/;
9

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

  
20 13
$.extend( $.ui, {
21
	version: "1.8.11",
14
	version: "1.10.2",
22 15

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

  
59 42
// plugins
60 43
$.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
	},
44
	focus: (function( orig ) {
45
		return function( delay, fn ) {
46
			return typeof delay === "number" ?
47
				this.each(function() {
48
					var elem = this;
49
					setTimeout(function() {
50
						$( elem ).focus();
51
						if ( fn ) {
52
							fn.call( elem );
53
						}
54
					}, delay );
55
				}) :
56
				orig.apply( this, arguments );
57
		};
58
	})( $.fn.focus ),
75 59

  
76 60
	scrollParent: function() {
77 61
		var scrollParent;
78
		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
62
		if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
79 63
			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));
64
				return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
81 65
			}).eq(0);
82 66
		} else {
83 67
			scrollParent = this.parents().filter(function() {
84
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
68
				return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
85 69
			}).eq(0);
86 70
		}
87 71

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

  
91 75
	zIndex: function( zIndex ) {
......
117 101
		return 0;
118 102
	},
119 103

  
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

  
104
	uniqueId: function() {
160 105
		return this.each(function() {
161
			$( this ).css( type, reduce( this, size ) + "px" );
106
			if ( !this.id ) {
107
				this.id = "ui-id-" + (++uuid);
108
			}
162 109
		});
163
	};
164

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

  
112
	removeUniqueId: function() {
170 113
		return this.each(function() {
171
			$( this).css( type, reduce( this, size, true, margin ) + "px" );
114
			if ( runiqueId.test( this.id ) ) {
115
				$( this ).removeAttr( "id" );
116
			}
172 117
		});
173
	};
118
	}
174 119
});
175 120

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

  
177 143
function visible( element ) {
178
	return !$( element ).parents().andSelf().filter(function() {
179
		return $.curCSS( this, "visibility" ) === "hidden" ||
180
			$.expr.filters.hidden( this );
181
	}).length;
144
	return $.expr.filters.visible( element ) &&
145
		!$( element ).parents().addBack().filter(function() {
146
			return $.css( this, "visibility" ) === "hidden";
147
		}).length;
182 148
}
183 149

  
184 150
$.extend( $.expr[ ":" ], {
185
	data: function( elem, i, match ) {
186
		return !!$.data( elem, match[ 3 ] );
187
	},
151
	data: $.expr.createPseudo ?
152
		$.expr.createPseudo(function( dataName ) {
153
			return function( elem ) {
154
				return !!$.data( elem, dataName );
155
			};
156
		}) :
157
		// support: jQuery <1.8
158
		function( elem, i, match ) {
159
			return !!$.data( elem, match[ 3 ] );
160
		},
188 161

  
189 162
	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 );
163
		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
209 164
	},
210 165

  
211 166
	tabbable: function( element ) {
212
		var tabIndex = $.attr( element, "tabindex" );
213
		return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
167
		var tabIndex = $.attr( element, "tabindex" ),
168
			isTabIndexNaN = isNaN( tabIndex );
169
		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
214 170
	}
215 171
});
216 172

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

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

  
198
		$.fn[ "inner" + name ] = function( size ) {
199
			if ( size === undefined ) {
200
				return orig[ "inner" + name ].call( this );
201
			}
202

  
203
			return this.each(function() {
204
				$( this ).css( type, reduce( this, size ) + "px" );
205
			});
206
		};
207

  
208
		$.fn[ "outer" + name] = function( size, margin ) {
209
			if ( typeof size !== "number" ) {
210
				return orig[ "outer" + name ].call( this, size );
211
			}
212

  
213
			return this.each(function() {
214
				$( this).css( type, reduce( this, size, true, margin ) + "px" );
215
			});
216
		};
227 217
	});
218
}
228 219

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

  
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
});
229
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
230
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
231
	$.fn.removeData = (function( removeData ) {
232
		return function( key ) {
233
			if ( arguments.length ) {
234
				return removeData.call( this, $.camelCase( key ) );
235
			} else {
236
				return removeData.call( this );
237
			}
238
		};
239
	})( $.fn.removeData );
240
}
236 241

  
237 242

  
238 243

  
239 244

  
240 245

  
241 246
// deprecated
247
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
248

  
249
$.support.selectstart = "onselectstart" in document.createElement( "div" );
250
$.fn.extend({
251
	disableSelection: function() {
252
		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
253
			".ui-disableSelection", function( event ) {
254
				event.preventDefault();
255
			});
256
	},
257

  
258
	enableSelection: function() {
259
		return this.unbind( ".ui-disableSelection" );
260
	}
261
});
262

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

  
281
			for ( i = 0; i < set.length; i++ ) {
259 282
				if ( instance.options[ set[ i ][ 0 ] ] ) {
260 283
					set[ i ][ 1 ].apply( instance.element, args );
261 284
				}
262 285
			}
263 286
		}
264 287
	},
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
	
288

  
273 289
	// only used by resizable
274 290
	hasScroll: function( el, a ) {
275
	
291

  
276 292
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
277 293
		if ( $( el ).css( "overflow" ) === "hidden") {
278 294
			return false;
279 295
		}
280
	
296

  
281 297
		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
282 298
			has = false;
283
	
299

  
284 300
		if ( el[ scroll ] > 0 ) {
285 301
			return true;
286 302
		}
287
	
303

  
288 304
		// TODO: determine which cases actually cause this to happen
289 305
		// if the element doesn't have the scroll set, see if it's possible to
290 306
		// set the scroll
......
292 308
		has = ( el[ scroll ] > 0 );
293 309
		el[ scroll ] = 0;
294 310
		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 311
	}
306 312
});
307 313

  
308 314
})( jQuery );
309
/*!
310
 * jQuery UI Widget 1.8.11
311
 *
312
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
313
 * Dual licensed under the MIT or GPL Version 2 licenses.
314
 * http://jquery.org/license
315
 *
316
 * http://docs.jquery.com/UI/Widget
317
 */
315

  
318 316
(function( $, undefined ) {
319 317

  
320
// jQuery 1.4+
321
if ( $.cleanData ) {
322
	var _cleanData = $.cleanData;
323
	$.cleanData = function( elems ) {
324
		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
318
var uuid = 0,
319
	slice = Array.prototype.slice,
320
	_cleanData = $.cleanData;
321
$.cleanData = function( elems ) {
322
	for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
323
		try {
325 324
			$( elem ).triggerHandler( "remove" );
326
		}
327
		_cleanData( elems );
328
	};
329
} else {
330
	var _remove = $.fn.remove;
331
	$.fn.remove = function( selector, keepData ) {
332
		return this.each(function() {
333
			if ( !keepData ) {
334
				if ( !selector || $.filter( selector, [ this ] ).length ) {
335
					$( "*", this ).add( [ this ] ).each(function() {
336
						$( this ).triggerHandler( "remove" );
337
					});
338
				}
339
			}
340
			return _remove.call( $(this), selector, keepData );
341
		});
342
	};
343
}
325
		// http://bugs.jquery.com/ticket/8235
326
		} catch( e ) {}
327
	}
328
	_cleanData( elems );
329
};
344 330

  
345 331
$.widget = function( name, base, prototype ) {
346
	var namespace = name.split( "." )[ 0 ],
347
		fullName;
332
	var fullName, existingConstructor, constructor, basePrototype,
333
		// proxiedPrototype allows the provided prototype to remain unmodified
334
		// so that it can be used as a mixin for multiple widgets (#8876)
335
		proxiedPrototype = {},
336
		namespace = name.split( "." )[ 0 ];
337

  
348 338
	name = name.split( "." )[ 1 ];
349 339
	fullName = namespace + "-" + name;
350 340

  
......
354 344
	}
355 345

  
356 346
	// create selector for plugin
357
	$.expr[ ":" ][ fullName ] = function( elem ) {
358
		return !!$.data( elem, name );
347
	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
348
		return !!$.data( elem, fullName );
359 349
	};
360 350

  
361 351
	$[ namespace ] = $[ namespace ] || {};
362
	$[ namespace ][ name ] = function( options, element ) {
352
	existingConstructor = $[ namespace ][ name ];
353
	constructor = $[ namespace ][ name ] = function( options, element ) {
354
		// allow instantiation without "new" keyword
355
		if ( !this._createWidget ) {
356
			return new constructor( options, element );
357
		}
358

  
363 359
		// allow instantiation without initializing for simple inheritance
360
		// must use "new" keyword (the code above always passes args)
364 361
		if ( arguments.length ) {
365 362
			this._createWidget( options, element );
366 363
		}
367 364
	};
365
	// extend with the existing constructor to carry over any static properties
366
	$.extend( constructor, existingConstructor, {
367
		version: prototype.version,
368
		// copy the object used to create the prototype in case we need to
369
		// redefine the widget later
370
		_proto: $.extend( {}, prototype ),
371
		// track widgets that inherit from this widget in case this widget is
372
		// redefined after a widget inherits from it
373
		_childConstructors: []
374
	});
368 375

  
369
	var basePrototype = new base();
376
	basePrototype = new base();
370 377
	// we need to make the options hash a property directly on the new instance
371 378
	// otherwise we'll modify the options hash on the prototype that we're
372 379
	// inheriting from
373
//	$.each( basePrototype, function( key, val ) {
374
//		if ( $.isPlainObject(val) ) {
375
//			basePrototype[ key ] = $.extend( {}, val );
376
//		}
377
//	});
378
	basePrototype.options = $.extend( true, {}, basePrototype.options );
379
	$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
380
	basePrototype.options = $.widget.extend( {}, basePrototype.options );
381
	$.each( prototype, function( prop, value ) {
382
		if ( !$.isFunction( value ) ) {
383
			proxiedPrototype[ prop ] = value;
384
			return;
385
		}
386
		proxiedPrototype[ prop ] = (function() {
387
			var _super = function() {
388
					return base.prototype[ prop ].apply( this, arguments );
389
				},
390
				_superApply = function( args ) {
391
					return base.prototype[ prop ].apply( this, args );
392
				};
393
			return function() {
394
				var __super = this._super,
395
					__superApply = this._superApply,
396
					returnValue;
397

  
398
				this._super = _super;
399
				this._superApply = _superApply;
400

  
401
				returnValue = value.apply( this, arguments );
402

  
403
				this._super = __super;
404
				this._superApply = __superApply;
405

  
406
				return returnValue;
407
			};
408
		})();
409
	});
410
	constructor.prototype = $.widget.extend( basePrototype, {
411
		// TODO: remove support for widgetEventPrefix
412
		// always use the name + a colon as the prefix, e.g., draggable:start
413
		// don't prefix for widgets that aren't DOM-based
414
		widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
415
	}, proxiedPrototype, {
416
		constructor: constructor,
380 417
		namespace: namespace,
381 418
		widgetName: name,
382
		widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
383
		widgetBaseClass: fullName
384
	}, prototype );
419
		widgetFullName: fullName
420
	});
385 421

  
386
	$.widget.bridge( name, $[ namespace ][ name ] );
422
	// If this widget is being redefined then we need to find all widgets that
423
	// are inheriting from it and redefine all of them so that they inherit from
424
	// the new version of this widget. We're essentially trying to replace one
425
	// level in the prototype chain.
426
	if ( existingConstructor ) {
427
		$.each( existingConstructor._childConstructors, function( i, child ) {
428
			var childPrototype = child.prototype;
429

  
430
			// redefine the child widget using the same prototype that was
431
			// originally used, but inherit from the new version of the base
432
			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
433
		});
434
		// remove the list of existing child constructors from the old constructor
435
		// so the old child constructors can be garbage collected
436
		delete existingConstructor._childConstructors;
437
	} else {
438
		base._childConstructors.push( constructor );
439
	}
440

  
441
	$.widget.bridge( name, constructor );
442
};
443

  
444
$.widget.extend = function( target ) {
445
	var input = slice.call( arguments, 1 ),
446
		inputIndex = 0,
447
		inputLength = input.length,
448
		key,
449
		value;
450
	for ( ; inputIndex < inputLength; inputIndex++ ) {
451
		for ( key in input[ inputIndex ] ) {
452
			value = input[ inputIndex ][ key ];
453
			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
454
				// Clone objects
455
				if ( $.isPlainObject( value ) ) {
456
					target[ key ] = $.isPlainObject( target[ key ] ) ?
457
						$.widget.extend( {}, target[ key ], value ) :
458
						// Don't extend strings, arrays, etc. with objects
459
						$.widget.extend( {}, value );
460
				// Copy everything else by reference
461
				} else {
462
					target[ key ] = value;
463
				}
464
			}
465
		}
466
	}
467
	return target;
387 468
};
388 469

  
389 470
$.widget.bridge = function( name, object ) {
471
	var fullName = object.prototype.widgetFullName || name;
390 472
	$.fn[ name ] = function( options ) {
391 473
		var isMethodCall = typeof options === "string",
392
			args = Array.prototype.slice.call( arguments, 1 ),
474
			args = slice.call( arguments, 1 ),
393 475
			returnValue = this;
394 476

  
395 477
		// allow multiple hashes to be passed on init
396 478
		options = !isMethodCall && args.length ?
397
			$.extend.apply( null, [ true, options ].concat(args) ) :
479
			$.widget.extend.apply( null, [ options ].concat(args) ) :
398 480
			options;
399 481

  
400
		// prevent calls to internal methods
401
		if ( isMethodCall && options.charAt( 0 ) === "_" ) {
402
			return returnValue;
403
		}
404

  
405 482
		if ( isMethodCall ) {
406 483
			this.each(function() {
407
				var instance = $.data( this, name ),
408
					methodValue = instance && $.isFunction( instance[options] ) ?
409
						instance[ options ].apply( instance, args ) :
410
						instance;
411
				// TODO: add this back in 1.9 and use $.error() (see #5972)
412
//				if ( !instance ) {
413
//					throw "cannot call methods on " + name + " prior to initialization; " +
414
//						"attempted to call method '" + options + "'";
415
//				}
416
//				if ( !$.isFunction( instance[options] ) ) {
417
//					throw "no such method '" + options + "' for " + name + " widget instance";
418
//				}
419
//				var methodValue = instance[ options ].apply( instance, args );
484
				var methodValue,
485
					instance = $.data( this, fullName );
486
				if ( !instance ) {
487
					return $.error( "cannot call methods on " + name + " prior to initialization; " +
488
						"attempted to call method '" + options + "'" );
489
				}
490
				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
491
					return $.error( "no such method '" + options + "' for " + name + " widget instance" );
492
				}
493
				methodValue = instance[ options ].apply( instance, args );
420 494
				if ( methodValue !== instance && methodValue !== undefined ) {
421
					returnValue = methodValue;
495
					returnValue = methodValue && methodValue.jquery ?
496
						returnValue.pushStack( methodValue.get() ) :
497
						methodValue;
422 498
					return false;
423 499
				}
424 500
			});
425 501
		} else {
426 502
			this.each(function() {
427
				var instance = $.data( this, name );
503
				var instance = $.data( this, fullName );
428 504
				if ( instance ) {
429 505
					instance.option( options || {} )._init();
430 506
				} else {
431
					$.data( this, name, new object( options, this ) );
507
					$.data( this, fullName, new object( options, this ) );
432 508
				}
433 509
			});
434 510
		}
......
437 513
	};
438 514
};
439 515

  
440
$.Widget = function( options, element ) {
441
	// allow instantiation without initializing for simple inheritance
442
	if ( arguments.length ) {
443
		this._createWidget( options, element );
444
	}
445
};
516
$.Widget = function( /* options, element */ ) {};
517
$.Widget._childConstructors = [];
446 518

  
447 519
$.Widget.prototype = {
448 520
	widgetName: "widget",
449 521
	widgetEventPrefix: "",
522
	defaultElement: "<div>",
450 523
	options: {
451
		disabled: false
524
		disabled: false,
525

  
526
		// callbacks
527
		create: null
452 528
	},
453 529
	_createWidget: function( options, element ) {
454
		// $.widget.bridge stores the plugin instance, but we do it anyway
455
		// so that it's stored even before the _create function runs
456
		$.data( element, this.widgetName, this );
530
		element = $( element || this.defaultElement || this )[ 0 ];
457 531
		this.element = $( element );
458
		this.options = $.extend( true, {},
532
		this.uuid = uuid++;
533
		this.eventNamespace = "." + this.widgetName + this.uuid;
534
		this.options = $.widget.extend( {},
459 535
			this.options,
460 536
			this._getCreateOptions(),
461 537
			options );
462 538

  
463
		var self = this;
464
		this.element.bind( "remove." + this.widgetName, function() {
465
			self.destroy();
466
		});
539
		this.bindings = $();
540
		this.hoverable = $();
541
		this.focusable = $();
542

  
543
		if ( element !== this ) {
544
			$.data( element, this.widgetFullName, this );
545
			this._on( true, this.element, {
546
				remove: function( event ) {
547
					if ( event.target === element ) {
548
						this.destroy();
549
					}
550
				}
551
			});
552
			this.document = $( element.style ?
553
				// element within the document
554
				element.ownerDocument :
555
				// element is window or document
556
				element.document || element );
557
			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
558
		}
467 559

  
468 560
		this._create();
469
		this._trigger( "create" );
561
		this._trigger( "create", null, this._getCreateEventData() );
470 562
		this._init();
471 563
	},
472
	_getCreateOptions: function() {
473
		return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
474
	},
475
	_create: function() {},
476
	_init: function() {},
564
	_getCreateOptions: $.noop,
565
	_getCreateEventData: $.noop,
566
	_create: $.noop,
567
	_init: $.noop,
477 568

  
478 569
	destroy: function() {
570
		this._destroy();
571
		// we can probably remove the unbind calls in 2.0
572
		// all event bindings should go through this._on()
479 573
		this.element
480
			.unbind( "." + this.widgetName )
481
			.removeData( this.widgetName );
574
			.unbind( this.eventNamespace )
575
			// 1.9 BC for #7810
576
			// TODO remove dual storage
577
			.removeData( this.widgetName )
578
			.removeData( this.widgetFullName )
579
			// support: jquery <1.6.3
580
			// http://bugs.jquery.com/ticket/9413
581
			.removeData( $.camelCase( this.widgetFullName ) );
482 582
		this.widget()
483
			.unbind( "." + this.widgetName )
583
			.unbind( this.eventNamespace )
484 584
			.removeAttr( "aria-disabled" )
485 585
			.removeClass(
486
				this.widgetBaseClass + "-disabled " +
586
				this.widgetFullName + "-disabled " +
487 587
				"ui-state-disabled" );
588

  
589
		// clean up events and states
590
		this.bindings.unbind( this.eventNamespace );
591
		this.hoverable.removeClass( "ui-state-hover" );
592
		this.focusable.removeClass( "ui-state-focus" );
488 593
	},
594
	_destroy: $.noop,
489 595

  
490 596
	widget: function() {
491 597
		return this.element;
492 598
	},
493 599

  
494 600
	option: function( key, value ) {
495
		var options = key;
601
		var options = key,
602
			parts,
603
			curOption,
604
			i;
496 605

  
497 606
		if ( arguments.length === 0 ) {
498 607
			// don't return a reference to the internal hash
499
			return $.extend( {}, this.options );
608
			return $.widget.extend( {}, this.options );
500 609
		}
501 610

  
502
		if  (typeof key === "string" ) {
503
			if ( value === undefined ) {
504
				return this.options[ key ];
505
			}
611
		if ( typeof key === "string" ) {
612
			// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
506 613
			options = {};
507
			options[ key ] = value;
614
			parts = key.split( "." );
615
			key = parts.shift();
616
			if ( parts.length ) {
617
				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
618
				for ( i = 0; i < parts.length - 1; i++ ) {
619
					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
620
					curOption = curOption[ parts[ i ] ];
621
				}
622
				key = parts.pop();
623
				if ( value === undefined ) {
624
					return curOption[ key ] === undefined ? null : curOption[ key ];
625
				}
626
				curOption[ key ] = value;
627
			} else {
628
				if ( value === undefined ) {
629
					return this.options[ key ] === undefined ? null : this.options[ key ];
630
				}
631
				options[ key ] = value;
632
			}
508 633
		}
509 634

  
510 635
		this._setOptions( options );
......
512 637
		return this;
513 638
	},
514 639
	_setOptions: function( options ) {
515
		var self = this;
516
		$.each( options, function( key, value ) {
517
			self._setOption( key, value );
518
		});
640
		var key;
641

  
642
		for ( key in options ) {
643
			this._setOption( key, options[ key ] );
644
		}
519 645

  
520 646
		return this;
521 647
	},
......
524 650

  
525 651
		if ( key === "disabled" ) {
526 652
			this.widget()
527
				[ value ? "addClass" : "removeClass"](
528
					this.widgetBaseClass + "-disabled" + " " +
529
					"ui-state-disabled" )
653
				.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
530 654
				.attr( "aria-disabled", value );
655
			this.hoverable.removeClass( "ui-state-hover" );
656
			this.focusable.removeClass( "ui-state-focus" );
531 657
		}
532 658

  
533 659
		return this;
......
540 666
		return this._setOption( "disabled", true );
541 667
	},
542 668

  
669
	_on: function( suppressDisabledCheck, element, handlers ) {
670
		var delegateElement,
671
			instance = this;
672

  
673
		// no suppressDisabledCheck flag, shuffle arguments
674
		if ( typeof suppressDisabledCheck !== "boolean" ) {
675
			handlers = element;
676
			element = suppressDisabledCheck;
677
			suppressDisabledCheck = false;
678
		}
679

  
680
		// no element argument, shuffle and use this.element
681
		if ( !handlers ) {
682
			handlers = element;
683
			element = this.element;
684
			delegateElement = this.widget();
685
		} else {
686
			// accept selectors, DOM elements
687
			element = delegateElement = $( element );
688
			this.bindings = this.bindings.add( element );
689
		}
690

  
691
		$.each( handlers, function( event, handler ) {
692
			function handlerProxy() {
693
				// allow widgets to customize the disabled handling
694
				// - disabled as an array instead of boolean
695
				// - disabled class as method for disabling individual parts
696
				if ( !suppressDisabledCheck &&
697
						( instance.options.disabled === true ||
698
							$( this ).hasClass( "ui-state-disabled" ) ) ) {
699
					return;
700
				}
701
				return ( typeof handler === "string" ? instance[ handler ] : handler )
702
					.apply( instance, arguments );
703
			}
704

  
705
			// copy the guid so direct unbinding works
706
			if ( typeof handler !== "string" ) {
707
				handlerProxy.guid = handler.guid =
708
					handler.guid || handlerProxy.guid || $.guid++;
709
			}
710

  
711
			var match = event.match( /^(\w+)\s*(.*)$/ ),
712
				eventName = match[1] + instance.eventNamespace,
713
				selector = match[2];
714
			if ( selector ) {
715
				delegateElement.delegate( selector, eventName, handlerProxy );
716
			} else {
717
				element.bind( eventName, handlerProxy );
718
			}
719
		});
720
	},
721

  
722
	_off: function( element, eventName ) {
723
		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
724
		element.unbind( eventName ).undelegate( eventName );
725
	},
726

  
727
	_delay: function( handler, delay ) {
728
		function handlerProxy() {
729
			return ( typeof handler === "string" ? instance[ handler ] : handler )
730
				.apply( instance, arguments );
731
		}
732
		var instance = this;
733
		return setTimeout( handlerProxy, delay || 0 );
734
	},
735

  
736
	_hoverable: function( element ) {
737
		this.hoverable = this.hoverable.add( element );
738
		this._on( element, {
739
			mouseenter: function( event ) {
740
				$( event.currentTarget ).addClass( "ui-state-hover" );
741
			},
742
			mouseleave: function( event ) {
743
				$( event.currentTarget ).removeClass( "ui-state-hover" );
744
			}
745
		});
746
	},
747

  
748
	_focusable: function( element ) {
749
		this.focusable = this.focusable.add( element );
750
		this._on( element, {
751
			focusin: function( event ) {
752
				$( event.currentTarget ).addClass( "ui-state-focus" );
753
			},
754
			focusout: function( event ) {
755
				$( event.currentTarget ).removeClass( "ui-state-focus" );
756
			}
757
		});
758
	},
759

  
543 760
	_trigger: function( type, event, data ) {
544
		var callback = this.options[ type ];
761
		var prop, orig,
762
			callback = this.options[ type ];
545 763

  
764
		data = data || {};
546 765
		event = $.Event( event );
547 766
		event.type = ( type === this.widgetEventPrefix ?
548 767
			type :
549 768
			this.widgetEventPrefix + type ).toLowerCase();
550
		data = data || {};
769
		// the original event may come from any element
770
		// so we need to reset the target on the new event
771
		event.target = this.element[ 0 ];
551 772

  
552 773
		// copy original event properties over to the new event
553
		// this would happen if we could call $.event.fix instead of $.Event
554
		// but we don't have a way to force an event to be fixed multiple times
555
		if ( event.originalEvent ) {
556
			for ( var i = $.event.props.length, prop; i; ) {
557
				prop = $.event.props[ --i ];
558
				event[ prop ] = event.originalEvent[ prop ];
774
		orig = event.originalEvent;
775
		if ( orig ) {
776
			for ( prop in orig ) {
777
				if ( !( prop in event ) ) {
778
					event[ prop ] = orig[ prop ];
779
				}
559 780
			}
560 781
		}
561 782

  
562 783
		this.element.trigger( event, data );
563

  
564
		return !( $.isFunction(callback) &&
565
			callback.call( this.element[0], event, data ) === false ||
784
		return !( $.isFunction( callback ) &&
785
			callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
566 786
			event.isDefaultPrevented() );
567 787
	}
568 788
};
569 789

  
790
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
791
	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
792
		if ( typeof options === "string" ) {
793
			options = { effect: options };
794
		}
795
		var hasOptions,
796
			effectName = !options ?
797
				method :
798
				options === true || typeof options === "number" ?
799
					defaultEffect :
800
					options.effect || defaultEffect;
801
		options = options || {};
802
		if ( typeof options === "number" ) {
803
			options = { duration: options };
804
		}
805
		hasOptions = !$.isEmptyObject( options );
806
		options.complete = callback;
807
		if ( options.delay ) {
808
			element.delay( options.delay );
809
		}
810
		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
811
			element[ method ]( options );
812
		} else if ( effectName !== method && element[ effectName ] ) {
813
			element[ effectName ]( options.duration, options.easing, callback );
814
		} else {
815
			element.queue(function( next ) {
816
				$( this )[ method ]();
817
				if ( callback ) {
818
					callback.call( element[ 0 ] );
819
				}
820
				next();
821
			});
822
		}
823
	};
824
});
825

  
570 826
})( jQuery );
571
/*!
572
 * jQuery UI Mouse 1.8.11
573
 *
574
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
575
 * Dual licensed under the MIT or GPL Version 2 licenses.
576
 * http://jquery.org/license
577
 *
578
 * http://docs.jquery.com/UI/Mouse
579
 *
580
 * Depends:
581
 *	jquery.ui.widget.js
582
 */
827

  
583 828
(function( $, undefined ) {
584 829

  
830
var mouseHandled = false;
831
$( document ).mouseup( function() {
832
	mouseHandled = false;
833
});
834

  
585 835
$.widget("ui.mouse", {
836
	version: "1.10.2",
586 837
	options: {
587
		cancel: ':input,option',
838
		cancel: "input,textarea,button,select,option",
588 839
		distance: 1,
589 840
		delay: 0
590 841
	},
591 842
	_mouseInit: function() {
592
		var self = this;
843
		var that = this;
593 844

  
594 845
		this.element
595
			.bind('mousedown.'+this.widgetName, function(event) {
596
				return self._mouseDown(event);
846
			.bind("mousedown."+this.widgetName, function(event) {
847
				return that._mouseDown(event);
597 848
			})
598
			.bind('click.'+this.widgetName, function(event) {
599
				if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
600
				    $.removeData(event.target, self.widgetName + '.preventClickEvent');
849
			.bind("click."+this.widgetName, function(event) {
850
				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
851
					$.removeData(event.target, that.widgetName + ".preventClickEvent");
601 852
					event.stopImmediatePropagation();
602 853
					return false;
603 854
				}
......
609 860
	// TODO: make sure destroying one instance of mouse doesn't mess with
610 861
	// other instances of mouse
611 862
	_mouseDestroy: function() {
612
		this.element.unbind('.'+this.widgetName);
863
		this.element.unbind("."+this.widgetName);
864
		if ( this._mouseMoveDelegate ) {
865
			$(document)
866
				.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
867
				.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
868
		}
613 869
	},
614 870

  
615 871
	_mouseDown: function(event) {
616 872
		// don't let more than one widget handle mouseStart
617
		// TODO: figure out why we have to use originalEvent
618
		event.originalEvent = event.originalEvent || {};
619
		if (event.originalEvent.mouseHandled) { return; }
873
		if( mouseHandled ) { return; }
620 874

  
621 875
		// we may have missed mouseup (out of window)
622 876
		(this._mouseStarted && this._mouseUp(event));
623 877

  
624 878
		this._mouseDownEvent = event;
625 879

  
626
		var self = this,
627
			btnIsLeft = (event.which == 1),
628
			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
880
		var that = this,
881
			btnIsLeft = (event.which === 1),
882
			// event.target.nodeName works around a bug in IE 8 with
883
			// disabled inputs (#7620)
884
			elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
629 885
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
630 886
			return true;
631 887
		}
......
633 889
		this.mouseDelayMet = !this.options.delay;
634 890
		if (!this.mouseDelayMet) {
635 891
			this._mouseDelayTimer = setTimeout(function() {
636
				self.mouseDelayMet = true;
892
				that.mouseDelayMet = true;
637 893
			}, this.options.delay);
638 894
		}
639 895

  
......
646 902
		}
647 903

  
648 904
		// Click event may never have fired (Gecko & Opera)
649
		if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
650
			$.removeData(event.target, this.widgetName + '.preventClickEvent');
905
		if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
906
			$.removeData(event.target, this.widgetName + ".preventClickEvent");
651 907
		}
652 908

  
653 909
		// these delegates are required to keep context
654 910
		this._mouseMoveDelegate = function(event) {
655
			return self._mouseMove(event);
911
			return that._mouseMove(event);
656 912
		};
657 913
		this._mouseUpDelegate = function(event) {
658
			return self._mouseUp(event);
914
			return that._mouseUp(event);
659 915
		};
660 916
		$(document)
661
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
662
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
917
			.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
918
			.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
663 919

  
664 920
		event.preventDefault();
665
		event.originalEvent.mouseHandled = true;
921

  
922
		mouseHandled = true;
666 923
		return true;
667 924
	},
668 925

  
669 926
	_mouseMove: function(event) {
670 927
		// IE mouseup check - mouseup happened when mouse was out of window
671
		if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
928
		if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
672 929
			return this._mouseUp(event);
673 930
		}
674 931

  
......
688 945

  
689 946
	_mouseUp: function(event) {
690 947
		$(document)
691
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
692
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
948
			.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
949
			.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
693 950

  
694 951
		if (this._mouseStarted) {
695 952
			this._mouseStarted = false;
696 953

  
697
			if (event.target == this._mouseDownEvent.target) {
698
			    $.data(event.target, this.widgetName + '.preventClickEvent', true);
954
			if (event.target === this._mouseDownEvent.target) {
955
				$.data(event.target, this.widgetName + ".preventClickEvent", true);
699 956
			}
700 957

  
701 958
			this._mouseStop(event);
......
712 969
		);
713 970
	},
714 971

  
715
	_mouseDelayMet: function(event) {
972
	_mouseDelayMet: function(/* event */) {
716 973
		return this.mouseDelayMet;
717 974
	},
718 975

  
719 976
	// These are placeholder methods, to be overriden by extending plugin
720
	_mouseStart: function(event) {},
721
	_mouseDrag: function(event) {},
722
	_mouseStop: function(event) {},
723
	_mouseCapture: function(event) { return true; }
977
	_mouseStart: function(/* event */) {},
978
	_mouseDrag: function(/* event */) {},
979
	_mouseStop: function(/* event */) {},
980
	_mouseCapture: function(/* event */) { return true; }
724 981
});
725 982

  
726 983
})(jQuery);
727
/*
728
 * jQuery UI Draggable 1.8.11
729
 *
730
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
731
 * Dual licensed under the MIT or GPL Version 2 licenses.
732
 * http://jquery.org/license
733
 *
734
 * http://docs.jquery.com/UI/Draggables
735
 *
736
 * Depends:
737
 *	jquery.ui.core.js
738
 *	jquery.ui.mouse.js
739
 *	jquery.ui.widget.js
740
 */
984

  
741 985
(function( $, undefined ) {
742 986

  
743 987
$.widget("ui.draggable", $.ui.mouse, {
988
	version: "1.10.2",
744 989
	widgetEventPrefix: "drag",
745 990
	options: {
746 991
		addClasses: true,
......
766 1011
		snapMode: "both",
767 1012
		snapTolerance: 20,
768 1013
		stack: false,
769
		zIndex: false
1014
		zIndex: false,
1015

  
1016
		// callbacks
1017
		drag: null,
1018
		start: null,
1019
		stop: null
770 1020
	},
771 1021
	_create: function() {
772 1022

  
773
		if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
774
			this.element[0].style.position = 'relative';
775

  
776
		(this.options.addClasses && this.element.addClass("ui-draggable"));
777
		(this.options.disabled && this.element.addClass("ui-draggable-disabled"));
1023
		if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
1024
			this.element[0].style.position = "relative";
1025
		}
1026
		if (this.options.addClasses){
1027
			this.element.addClass("ui-draggable");
1028
		}
1029
		if (this.options.disabled){
1030
			this.element.addClass("ui-draggable-disabled");
1031
		}
778 1032

  
779 1033
		this._mouseInit();
780 1034

  
781 1035
	},
782 1036

  
783
	destroy: function() {
784
		if(!this.element.data('draggable')) return;
785
		this.element
786
			.removeData("draggable")
787
			.unbind(".draggable")
788
			.removeClass("ui-draggable"
789
				+ " ui-draggable-dragging"
790
				+ " ui-draggable-disabled");
1037
	_destroy: function() {
1038
		this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
791 1039
		this._mouseDestroy();
792

  
793
		return this;
794 1040
	},
795 1041

  
796 1042
	_mouseCapture: function(event) {
......
798 1044
		var o = this.options;
799 1045

  
800 1046
		// among others, prevent a drag on a resizable-handle
801
		if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
1047
		if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
802 1048
			return false;
1049
		}
803 1050

  
804 1051
		//Quit if we're not on a valid handle
805 1052
		this.handle = this._getHandle(event);
806
		if (!this.handle)
1053
		if (!this.handle) {
807 1054
			return false;
1055
		}
1056

  
1057
		$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1058
			$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>")
1059
			.css({
1060
				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1061
				position: "absolute", opacity: "0.001", zIndex: 1000
1062
			})
1063
			.css($(this).offset())
1064
			.appendTo("body");
1065
		});
808 1066

  
809 1067
		return true;
810 1068

  
......
817 1075
		//Create and append the visible helper
818 1076
		this.helper = this._createHelper(event);
819 1077

  
820
		//Cache the helper size
1078
		this.helper.addClass("ui-draggable-dragging");
1079

  
1080
		//Cache the helper size
821 1081
		this._cacheHelperProportions();
822 1082

  
823 1083
		//If ddmanager is used for droppables, set the global draggable
824
		if($.ui.ddmanager)
1084
		if($.ui.ddmanager) {
825 1085
			$.ui.ddmanager.current = this;
1086
		}
826 1087

  
827 1088
		/*
828 1089
		 * - Position generation -
......
857 1118
		this.originalPageX = event.pageX;
858 1119
		this.originalPageY = event.pageY;
859 1120

  
860
		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
1121
		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
861 1122
		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
862 1123

  
863 1124
		//Set a containment if given in the options
864
		if(o.containment)
1125
		if(o.containment) {
865 1126
			this._setContainment();
1127
		}
866 1128

  
867 1129
		//Trigger event + callbacks
868 1130
		if(this._trigger("start", event) === false) {
......
874 1136
		this._cacheHelperProportions();
875 1137

  
876 1138
		//Prepare the droppable offsets
877
		if ($.ui.ddmanager && !o.dropBehaviour)
1139
		if ($.ui.ddmanager && !o.dropBehaviour) {
878 1140
			$.ui.ddmanager.prepareOffsets(this, event);
1141
		}
1142

  
879 1143

  
880
		this.helper.addClass("ui-draggable-dragging");
881 1144
		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1145

  
1146
		//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
1147
		if ( $.ui.ddmanager ) {
1148
			$.ui.ddmanager.dragStart(this, event);
1149
		}
1150

  
882 1151
		return true;
883 1152
	},
884 1153

  
......
891 1160
		//Call plugins and callbacks and use the resulting position if something is returned
892 1161
		if (!noPropagation) {
893 1162
			var ui = this._uiHash();
894
			if(this._trigger('drag', event, ui) === false) {
1163
			if(this._trigger("drag", event, ui) === false) {
895 1164
				this._mouseUp({});
896 1165
				return false;
897 1166
			}
898 1167
			this.position = ui.position;
899 1168
		}
900 1169

  
901
		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
902
		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
903
		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
1170
		if(!this.options.axis || this.options.axis !== "y") {
1171
			this.helper[0].style.left = this.position.left+"px";
1172
		}
1173
		if(!this.options.axis || this.options.axis !== "x") {
1174
			this.helper[0].style.top = this.position.top+"px";
1175
		}
1176
		if($.ui.ddmanager) {
1177
			$.ui.ddmanager.drag(this, event);
1178
		}
904 1179

  
905 1180
		return false;
906 1181
	},
......
908 1183
	_mouseStop: function(event) {
909 1184

  
910 1185
		//If we are using droppables, inform the manager about the drop
911
		var dropped = false;
912
		if ($.ui.ddmanager && !this.options.dropBehaviour)
1186
		var element,
1187
			that = this,
1188
			elementInDom = false,
1189
			dropped = false;
1190
		if ($.ui.ddmanager && !this.options.dropBehaviour) {
913 1191
			dropped = $.ui.ddmanager.drop(this, event);
1192
		}
914 1193

  
915 1194
		//if a drop comes from outside (a sortable)
916 1195
		if(this.dropped) {
917 1196
			dropped = this.dropped;
918 1197
			this.dropped = false;
919 1198
		}
920
		
921
		//if the original element is removed, don't bother to continue if helper is set to "original"
922
		if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
1199

  
1200
		//if the original element is no longer in the DOM don't bother to continue (see #8269)
1201
		element = this.element[0];
1202
		while ( element && (element = element.parentNode) ) {
1203
			if (element === document ) {
1204
				elementInDom = true;
1205
			}
1206
		}
1207
		if ( !elementInDom && this.options.helper === "original" ) {
923 1208
			return false;
1209
		}
924 1210

  
925
		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
926
			var self = this;
1211
		if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
927 1212
			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
928
				if(self._trigger("stop", event) !== false) {
929
					self._clear();
1213
				if(that._trigger("stop", event) !== false) {
1214
					that._clear();
930 1215
				}
931 1216
			});
932 1217
		} else {
......
937 1222

  
938 1223
		return false;
939 1224
	},
940
	
1225

  
1226
	_mouseUp: function(event) {
1227
		//Remove frame helpers
1228
		$("div.ui-draggable-iframeFix").each(function() {
1229
			this.parentNode.removeChild(this);
1230
		});
1231

  
1232
		//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
1233
		if( $.ui.ddmanager ) {
1234
			$.ui.ddmanager.dragStop(this, event);
1235
		}
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff