Subversion Repositories Sites.obs-saisons.fr

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
40 aurelien 1
/*!
2
 * jQuery UI 1.8.5
3
 *
4
 * Copyright 2010, 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
 */
10
(function( $, undefined ) {
11
 
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
15
$.ui = $.ui || {};
16
if ( $.ui.version ) {
17
	return;
18
}
19
 
20
$.extend( $.ui, {
21
	version: "1.8.5",
22
 
23
	keyCode: {
24
		ALT: 18,
25
		BACKSPACE: 8,
26
		CAPS_LOCK: 20,
27
		COMMA: 188,
28
		COMMAND: 91,
29
		COMMAND_LEFT: 91, // COMMAND
30
		COMMAND_RIGHT: 93,
31
		CONTROL: 17,
32
		DELETE: 46,
33
		DOWN: 40,
34
		END: 35,
35
		ENTER: 13,
36
		ESCAPE: 27,
37
		HOME: 36,
38
		INSERT: 45,
39
		LEFT: 37,
40
		MENU: 93, // COMMAND_RIGHT
41
		NUMPAD_ADD: 107,
42
		NUMPAD_DECIMAL: 110,
43
		NUMPAD_DIVIDE: 111,
44
		NUMPAD_ENTER: 108,
45
		NUMPAD_MULTIPLY: 106,
46
		NUMPAD_SUBTRACT: 109,
47
		PAGE_DOWN: 34,
48
		PAGE_UP: 33,
49
		PERIOD: 190,
50
		RIGHT: 39,
51
		SHIFT: 16,
52
		SPACE: 32,
53
		TAB: 9,
54
		UP: 38,
55
		WINDOWS: 91 // COMMAND
56
	}
57
});
58
 
59
// plugins
60
$.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
	},
75
 
76
	scrollParent: function() {
77
		var scrollParent;
78
		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
79
			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));
81
			}).eq(0);
82
		} else {
83
			scrollParent = this.parents().filter(function() {
84
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
85
			}).eq(0);
86
		}
87
 
88
		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
89
	},
90
 
91
	zIndex: function( zIndex ) {
92
		if ( zIndex !== undefined ) {
93
			return this.css( "zIndex", zIndex );
94
		}
95
 
96
		if ( this.length ) {
97
			var elem = $( this[ 0 ] ), position, value;
98
			while ( elem.length && elem[ 0 ] !== document ) {
99
				// Ignore z-index if position is set to a value where z-index is ignored by the browser
100
				// This makes behavior of this function consistent across browsers
101
				// WebKit always returns auto if the element is positioned
102
				position = elem.css( "position" );
103
				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
104
					// IE returns 0 when zIndex is not specified
105
					// other browsers return a string
106
					// we ignore the case of nested elements with an explicit value of 0
107
					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
108
					value = parseInt( elem.css( "zIndex" ) );
109
					if ( !isNaN( value ) && value != 0 ) {
110
						return value;
111
					}
112
				}
113
				elem = elem.parent();
114
			}
115
		}
116
 
117
		return 0;
118
	},
119
 
120
	disableSelection: function() {
121
		return this.bind(
122
			"mousedown.ui-disableSelection selectstart.ui-disableSelection",
123
			function( event ) {
124
				event.preventDefault();
125
			});
126
	},
127
 
128
	enableSelection: function() {
129
		return this.unbind( ".ui-disableSelection" );
130
	}
131
});
132
 
133
$.each( [ "Width", "Height" ], function( i, name ) {
134
	var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
135
		type = name.toLowerCase(),
136
		orig = {
137
			innerWidth: $.fn.innerWidth,
138
			innerHeight: $.fn.innerHeight,
139
			outerWidth: $.fn.outerWidth,
140
			outerHeight: $.fn.outerHeight
141
		};
142
 
143
	function reduce( elem, size, border, margin ) {
144
		$.each( side, function() {
145
			size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
146
			if ( border ) {
147
				size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
148
			}
149
			if ( margin ) {
150
				size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
151
			}
152
		});
153
		return size;
154
	}
155
 
156
	$.fn[ "inner" + name ] = function( size ) {
157
		if ( size === undefined ) {
158
			return orig[ "inner" + name ].call( this );
159
		}
160
 
161
		return this.each(function() {
162
			$.style( this, type, reduce( this, size ) + "px" );
163
		});
164
	};
165
 
166
	$.fn[ "outer" + name] = function( size, margin ) {
167
		if ( typeof size !== "number" ) {
168
			return orig[ "outer" + name ].call( this, size );
169
		}
170
 
171
		return this.each(function() {
172
			$.style( this, type, reduce( this, size, true, margin ) + "px" );
173
		});
174
	};
175
});
176
 
177
// selectors
178
function visible( element ) {
179
	return !$( element ).parents().andSelf().filter(function() {
180
		return $.curCSS( this, "visibility" ) === "hidden" ||
181
			$.expr.filters.hidden( this );
182
	}).length;
183
}
184
 
185
$.extend( $.expr[ ":" ], {
186
	data: function( elem, i, match ) {
187
		return !!$.data( elem, match[ 3 ] );
188
	},
189
 
190
	focusable: function( element ) {
191
		var nodeName = element.nodeName.toLowerCase(),
192
			tabIndex = $.attr( element, "tabindex" );
193
		if ( "area" === nodeName ) {
194
			var map = element.parentNode,
195
				mapName = map.name,
196
				img;
197
			if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
198
				return false;
199
			}
200
			img = $( "img[usemap=#" + mapName + "]" )[0];
201
			return !!img && visible( img );
202
		}
203
		return ( /input|select|textarea|button|object/.test( nodeName )
204
			? !element.disabled
205
			: "a" == nodeName
206
				? element.href || !isNaN( tabIndex )
207
				: !isNaN( tabIndex ))
208
			// the element and all of its ancestors must be visible
209
			&& visible( element );
210
	},
211
 
212
	tabbable: function( element ) {
213
		var tabIndex = $.attr( element, "tabindex" );
214
		return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
215
	}
216
});
217
 
218
// support
219
$(function() {
220
	var div = document.createElement( "div" ),
221
		body = document.body;
222
 
223
	$.extend( div.style, {
224
		minHeight: "100px",
225
		height: "auto",
226
		padding: 0,
227
		borderWidth: 0
228
	});
229
 
230
	$.support.minHeight = body.appendChild( div ).offsetHeight === 100;
231
	// set display to none to avoid a layout bug in IE
232
	// http://dev.jquery.com/ticket/4014
233
	body.removeChild( div ).style.display = "none";
234
});
235
 
236
 
237
 
238
 
239
 
240
// deprecated
241
$.extend( $.ui, {
242
	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
243
	plugin: {
244
		add: function( module, option, set ) {
245
			var proto = $.ui[ module ].prototype;
246
			for ( var i in set ) {
247
				proto.plugins[ i ] = proto.plugins[ i ] || [];
248
				proto.plugins[ i ].push( [ option, set[ i ] ] );
249
			}
250
		},
251
		call: function( instance, name, args ) {
252
			var set = instance.plugins[ name ];
253
			if ( !set || !instance.element[ 0 ].parentNode ) {
254
				return;
255
			}
256
 
257
			for ( var i = 0; i < set.length; i++ ) {
258
				if ( instance.options[ set[ i ][ 0 ] ] ) {
259
					set[ i ][ 1 ].apply( instance.element, args );
260
				}
261
			}
262
		}
263
	},
264
 
265
	// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
266
	contains: function( a, b ) {
267
		return document.compareDocumentPosition ?
268
			a.compareDocumentPosition( b ) & 16 :
269
			a !== b && a.contains( b );
270
	},
271
 
272
	// only used by resizable
273
	hasScroll: function( el, a ) {
274
 
275
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
276
		if ( $( el ).css( "overflow" ) === "hidden") {
277
			return false;
278
		}
279
 
280
		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
281
			has = false;
282
 
283
		if ( el[ scroll ] > 0 ) {
284
			return true;
285
		}
286
 
287
		// TODO: determine which cases actually cause this to happen
288
		// if the element doesn't have the scroll set, see if it's possible to
289
		// set the scroll
290
		el[ scroll ] = 1;
291
		has = ( el[ scroll ] > 0 );
292
		el[ scroll ] = 0;
293
		return has;
294
	},
295
 
296
	// these are odd functions, fix the API or move into individual plugins
297
	isOverAxis: function( x, reference, size ) {
298
		//Determines when x coordinate is over "b" element axis
299
		return ( x > reference ) && ( x < ( reference + size ) );
300
	},
301
	isOver: function( y, x, top, left, height, width ) {
302
		//Determines when x, y coordinates is over "b" element
303
		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
304
	}
305
});
306
 
307
})( jQuery );