1 | /*! |
---|
2 | * jQuery UI 1.8.9 |
---|
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.9", |
---|
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 visible( element ) { |
---|
178 | return !$( element ).parents().andSelf().filter(function() { |
---|
179 | return $.curCSS( this, "visibility" ) === "hidden" || |
---|
180 | $.expr.filters.hidden( this ); |
---|
181 | }).length; |
---|
182 | } |
---|
183 | |
---|
184 | $.extend( $.expr[ ":" ], { |
---|
185 | data: function( elem, i, match ) { |
---|
186 | return !!$.data( elem, match[ 3 ] ); |
---|
187 | }, |
---|
188 | |
---|
189 | 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 ); |
---|
209 | }, |
---|
210 | |
---|
211 | tabbable: function( element ) { |
---|
212 | var tabIndex = $.attr( element, "tabindex" ); |
---|
213 | return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" ); |
---|
214 | } |
---|
215 | }); |
---|
216 | |
---|
217 | // support |
---|
218 | $(function() { |
---|
219 | var body = document.body, |
---|
220 | div = body.appendChild( div = document.createElement( "div" ) ); |
---|
221 | |
---|
222 | $.extend( div.style, { |
---|
223 | minHeight: "100px", |
---|
224 | height: "auto", |
---|
225 | padding: 0, |
---|
226 | borderWidth: 0 |
---|
227 | }); |
---|
228 | |
---|
229 | $.support.minHeight = div.offsetHeight === 100; |
---|
230 | $.support.selectstart = "onselectstart" in div; |
---|
231 | |
---|
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 | }); |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | |
---|
240 | |
---|
241 | // deprecated |
---|
242 | $.extend( $.ui, { |
---|
243 | // $.ui.plugin is deprecated. Use the proxy pattern instead. |
---|
244 | plugin: { |
---|
245 | add: function( module, option, set ) { |
---|
246 | var proto = $.ui[ module ].prototype; |
---|
247 | for ( var i in set ) { |
---|
248 | proto.plugins[ i ] = proto.plugins[ i ] || []; |
---|
249 | proto.plugins[ i ].push( [ option, set[ i ] ] ); |
---|
250 | } |
---|
251 | }, |
---|
252 | call: function( instance, name, args ) { |
---|
253 | var set = instance.plugins[ name ]; |
---|
254 | if ( !set || !instance.element[ 0 ].parentNode ) { |
---|
255 | return; |
---|
256 | } |
---|
257 | |
---|
258 | for ( var i = 0; i < set.length; i++ ) { |
---|
259 | if ( instance.options[ set[ i ][ 0 ] ] ) { |
---|
260 | set[ i ][ 1 ].apply( instance.element, args ); |
---|
261 | } |
---|
262 | } |
---|
263 | } |
---|
264 | }, |
---|
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 | |
---|
273 | // only used by resizable |
---|
274 | hasScroll: function( el, a ) { |
---|
275 | |
---|
276 | //If overflow is hidden, the element might have extra content, but the user wants to hide it |
---|
277 | if ( $( el ).css( "overflow" ) === "hidden") { |
---|
278 | return false; |
---|
279 | } |
---|
280 | |
---|
281 | var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", |
---|
282 | has = false; |
---|
283 | |
---|
284 | if ( el[ scroll ] > 0 ) { |
---|
285 | return true; |
---|
286 | } |
---|
287 | |
---|
288 | // TODO: determine which cases actually cause this to happen |
---|
289 | // if the element doesn't have the scroll set, see if it's possible to |
---|
290 | // set the scroll |
---|
291 | el[ scroll ] = 1; |
---|
292 | has = ( el[ scroll ] > 0 ); |
---|
293 | el[ scroll ] = 0; |
---|
294 | 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 | } |
---|
306 | }); |
---|
307 | |
---|
308 | })( jQuery ); |
---|