Mercurial > hg > STI-GWT
comparison war/scripts/jQuery/ui/jquery.ui.core.js @ 3:cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author | StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b> |
---|---|
date | Tue, 17 Jul 2012 13:34:40 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:2897af43ccc6 | 3:cf06b77a8bbd |
---|---|
1 /*! | |
2 * jQuery UI 1.8.14 | |
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 */ | |
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.14", | |
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" ), 10 ); | |
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( ( $.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 | |
160 return this.each(function() { | |
161 $( this ).css( type, reduce( this, size ) + "px" ); | |
162 }); | |
163 }; | |
164 | |
165 $.fn[ "outer" + name] = function( size, margin ) { | |
166 if ( typeof size !== "number" ) { | |
167 return orig[ "outer" + name ].call( this, size ); | |
168 } | |
169 | |
170 return this.each(function() { | |
171 $( this).css( type, reduce( this, size, true, margin ) + "px" ); | |
172 }); | |
173 }; | |
174 }); | |
175 | |
176 // selectors | |
177 function focusable( element, isTabIndexNotNaN ) { | |
178 var nodeName = element.nodeName.toLowerCase(); | |
179 if ( "area" === nodeName ) { | |
180 var map = element.parentNode, | |
181 mapName = map.name, | |
182 img; | |
183 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { | |
184 return false; | |
185 } | |
186 img = $( "img[usemap=#" + mapName + "]" )[0]; | |
187 return !!img && visible( img ); | |
188 } | |
189 return ( /input|select|textarea|button|object/.test( nodeName ) | |
190 ? !element.disabled | |
191 : "a" == nodeName | |
192 ? element.href || isTabIndexNotNaN | |
193 : isTabIndexNotNaN) | |
194 // the element and all of its ancestors must be visible | |
195 && visible( element ); | |
196 } | |
197 | |
198 function visible( element ) { | |
199 return !$( element ).parents().andSelf().filter(function() { | |
200 return $.curCSS( this, "visibility" ) === "hidden" || | |
201 $.expr.filters.hidden( this ); | |
202 }).length; | |
203 } | |
204 | |
205 $.extend( $.expr[ ":" ], { | |
206 data: function( elem, i, match ) { | |
207 return !!$.data( elem, match[ 3 ] ); | |
208 }, | |
209 | |
210 focusable: function( element ) { | |
211 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); | |
212 }, | |
213 | |
214 tabbable: function( element ) { | |
215 var tabIndex = $.attr( element, "tabindex" ), | |
216 isTabIndexNaN = isNaN( tabIndex ); | |
217 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); | |
218 } | |
219 }); | |
220 | |
221 // support | |
222 $(function() { | |
223 var body = document.body, | |
224 div = body.appendChild( div = document.createElement( "div" ) ); | |
225 | |
226 $.extend( div.style, { | |
227 minHeight: "100px", | |
228 height: "auto", | |
229 padding: 0, | |
230 borderWidth: 0 | |
231 }); | |
232 | |
233 $.support.minHeight = div.offsetHeight === 100; | |
234 $.support.selectstart = "onselectstart" in div; | |
235 | |
236 // set display to none to avoid a layout bug in IE | |
237 // http://dev.jquery.com/ticket/4014 | |
238 body.removeChild( div ).style.display = "none"; | |
239 }); | |
240 | |
241 | |
242 | |
243 | |
244 | |
245 // deprecated | |
246 $.extend( $.ui, { | |
247 // $.ui.plugin is deprecated. Use the proxy pattern instead. | |
248 plugin: { | |
249 add: function( module, option, set ) { | |
250 var proto = $.ui[ module ].prototype; | |
251 for ( var i in set ) { | |
252 proto.plugins[ i ] = proto.plugins[ i ] || []; | |
253 proto.plugins[ i ].push( [ option, set[ i ] ] ); | |
254 } | |
255 }, | |
256 call: function( instance, name, args ) { | |
257 var set = instance.plugins[ name ]; | |
258 if ( !set || !instance.element[ 0 ].parentNode ) { | |
259 return; | |
260 } | |
261 | |
262 for ( var i = 0; i < set.length; i++ ) { | |
263 if ( instance.options[ set[ i ][ 0 ] ] ) { | |
264 set[ i ][ 1 ].apply( instance.element, args ); | |
265 } | |
266 } | |
267 } | |
268 }, | |
269 | |
270 // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() | |
271 contains: function( a, b ) { | |
272 return document.compareDocumentPosition ? | |
273 a.compareDocumentPosition( b ) & 16 : | |
274 a !== b && a.contains( b ); | |
275 }, | |
276 | |
277 // only used by resizable | |
278 hasScroll: function( el, a ) { | |
279 | |
280 //If overflow is hidden, the element might have extra content, but the user wants to hide it | |
281 if ( $( el ).css( "overflow" ) === "hidden") { | |
282 return false; | |
283 } | |
284 | |
285 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", | |
286 has = false; | |
287 | |
288 if ( el[ scroll ] > 0 ) { | |
289 return true; | |
290 } | |
291 | |
292 // TODO: determine which cases actually cause this to happen | |
293 // if the element doesn't have the scroll set, see if it's possible to | |
294 // set the scroll | |
295 el[ scroll ] = 1; | |
296 has = ( el[ scroll ] > 0 ); | |
297 el[ scroll ] = 0; | |
298 return has; | |
299 }, | |
300 | |
301 // these are odd functions, fix the API or move into individual plugins | |
302 isOverAxis: function( x, reference, size ) { | |
303 //Determines when x coordinate is over "b" element axis | |
304 return ( x > reference ) && ( x < ( reference + size ) ); | |
305 }, | |
306 isOver: function( y, x, top, left, height, width ) { | |
307 //Determines when x, y coordinates is over "b" element | |
308 return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); | |
309 } | |
310 }); | |
311 | |
312 })( jQuery ); |