1 | /*! |
---|
2 | * jQuery UI Core 1.10.1 |
---|
3 | * http://jqueryui.com |
---|
4 | * |
---|
5 | * Copyright 2013 jQuery Foundation and other contributors |
---|
6 | * Released under the MIT license. |
---|
7 | * http://jquery.org/license |
---|
8 | * |
---|
9 | * http://api.jqueryui.com/category/ui-core/ |
---|
10 | */ |
---|
11 | (function( $, undefined ) { |
---|
12 | |
---|
13 | var uuid = 0, |
---|
14 | runiqueId = /^ui-id-\d+$/; |
---|
15 | |
---|
16 | // prevent duplicate loading |
---|
17 | // this is only a problem because we proxy existing functions |
---|
18 | // and we don't want to double proxy them |
---|
19 | $.ui = $.ui || {}; |
---|
20 | if ( $.ui.version ) { |
---|
21 | return; |
---|
22 | } |
---|
23 | |
---|
24 | $.extend( $.ui, { |
---|
25 | version: "1.10.1", |
---|
26 | |
---|
27 | keyCode: { |
---|
28 | BACKSPACE: 8, |
---|
29 | COMMA: 188, |
---|
30 | DELETE: 46, |
---|
31 | DOWN: 40, |
---|
32 | END: 35, |
---|
33 | ENTER: 13, |
---|
34 | ESCAPE: 27, |
---|
35 | HOME: 36, |
---|
36 | LEFT: 37, |
---|
37 | NUMPAD_ADD: 107, |
---|
38 | NUMPAD_DECIMAL: 110, |
---|
39 | NUMPAD_DIVIDE: 111, |
---|
40 | NUMPAD_ENTER: 108, |
---|
41 | NUMPAD_MULTIPLY: 106, |
---|
42 | NUMPAD_SUBTRACT: 109, |
---|
43 | PAGE_DOWN: 34, |
---|
44 | PAGE_UP: 33, |
---|
45 | PERIOD: 190, |
---|
46 | RIGHT: 39, |
---|
47 | SPACE: 32, |
---|
48 | TAB: 9, |
---|
49 | UP: 38 |
---|
50 | } |
---|
51 | }); |
---|
52 | |
---|
53 | // plugins |
---|
54 | $.fn.extend({ |
---|
55 | _focus: $.fn.focus, |
---|
56 | focus: function( delay, fn ) { |
---|
57 | return typeof delay === "number" ? |
---|
58 | this.each(function() { |
---|
59 | var elem = this; |
---|
60 | setTimeout(function() { |
---|
61 | $( elem ).focus(); |
---|
62 | if ( fn ) { |
---|
63 | fn.call( elem ); |
---|
64 | } |
---|
65 | }, delay ); |
---|
66 | }) : |
---|
67 | this._focus.apply( this, arguments ); |
---|
68 | }, |
---|
69 | |
---|
70 | scrollParent: function() { |
---|
71 | var scrollParent; |
---|
72 | if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { |
---|
73 | scrollParent = this.parents().filter(function() { |
---|
74 | return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); |
---|
75 | }).eq(0); |
---|
76 | } else { |
---|
77 | scrollParent = this.parents().filter(function() { |
---|
78 | return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); |
---|
79 | }).eq(0); |
---|
80 | } |
---|
81 | |
---|
82 | return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; |
---|
83 | }, |
---|
84 | |
---|
85 | zIndex: function( zIndex ) { |
---|
86 | if ( zIndex !== undefined ) { |
---|
87 | return this.css( "zIndex", zIndex ); |
---|
88 | } |
---|
89 | |
---|
90 | if ( this.length ) { |
---|
91 | var elem = $( this[ 0 ] ), position, value; |
---|
92 | while ( elem.length && elem[ 0 ] !== document ) { |
---|
93 | // Ignore z-index if position is set to a value where z-index is ignored by the browser |
---|
94 | // This makes behavior of this function consistent across browsers |
---|
95 | // WebKit always returns auto if the element is positioned |
---|
96 | position = elem.css( "position" ); |
---|
97 | if ( position === "absolute" || position === "relative" || position === "fixed" ) { |
---|
98 | // IE returns 0 when zIndex is not specified |
---|
99 | // other browsers return a string |
---|
100 | // we ignore the case of nested elements with an explicit value of 0 |
---|
101 | // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> |
---|
102 | value = parseInt( elem.css( "zIndex" ), 10 ); |
---|
103 | if ( !isNaN( value ) && value !== 0 ) { |
---|
104 | return value; |
---|
105 | } |
---|
106 | } |
---|
107 | elem = elem.parent(); |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | return 0; |
---|
112 | }, |
---|
113 | |
---|
114 | uniqueId: function() { |
---|
115 | return this.each(function() { |
---|
116 | if ( !this.id ) { |
---|
117 | this.id = "ui-id-" + (++uuid); |
---|
118 | } |
---|
119 | }); |
---|
120 | }, |
---|
121 | |
---|
122 | removeUniqueId: function() { |
---|
123 | return this.each(function() { |
---|
124 | if ( runiqueId.test( this.id ) ) { |
---|
125 | $( this ).removeAttr( "id" ); |
---|
126 | } |
---|
127 | }); |
---|
128 | } |
---|
129 | }); |
---|
130 | |
---|
131 | // selectors |
---|
132 | function focusable( element, isTabIndexNotNaN ) { |
---|
133 | var map, mapName, img, |
---|
134 | nodeName = element.nodeName.toLowerCase(); |
---|
135 | if ( "area" === nodeName ) { |
---|
136 | map = element.parentNode; |
---|
137 | mapName = map.name; |
---|
138 | if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { |
---|
139 | return false; |
---|
140 | } |
---|
141 | img = $( "img[usemap=#" + mapName + "]" )[0]; |
---|
142 | return !!img && visible( img ); |
---|
143 | } |
---|
144 | return ( /input|select|textarea|button|object/.test( nodeName ) ? |
---|
145 | !element.disabled : |
---|
146 | "a" === nodeName ? |
---|
147 | element.href || isTabIndexNotNaN : |
---|
148 | isTabIndexNotNaN) && |
---|
149 | // the element and all of its ancestors must be visible |
---|
150 | visible( element ); |
---|
151 | } |
---|
152 | |
---|
153 | function visible( element ) { |
---|
154 | return $.expr.filters.visible( element ) && |
---|
155 | !$( element ).parents().addBack().filter(function() { |
---|
156 | return $.css( this, "visibility" ) === "hidden"; |
---|
157 | }).length; |
---|
158 | } |
---|
159 | |
---|
160 | $.extend( $.expr[ ":" ], { |
---|
161 | data: $.expr.createPseudo ? |
---|
162 | $.expr.createPseudo(function( dataName ) { |
---|
163 | return function( elem ) { |
---|
164 | return !!$.data( elem, dataName ); |
---|
165 | }; |
---|
166 | }) : |
---|
167 | // support: jQuery <1.8 |
---|
168 | function( elem, i, match ) { |
---|
169 | return !!$.data( elem, match[ 3 ] ); |
---|
170 | }, |
---|
171 | |
---|
172 | focusable: function( element ) { |
---|
173 | return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); |
---|
174 | }, |
---|
175 | |
---|
176 | tabbable: function( element ) { |
---|
177 | var tabIndex = $.attr( element, "tabindex" ), |
---|
178 | isTabIndexNaN = isNaN( tabIndex ); |
---|
179 | return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); |
---|
180 | } |
---|
181 | }); |
---|
182 | |
---|
183 | // support: jQuery <1.8 |
---|
184 | if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { |
---|
185 | $.each( [ "Width", "Height" ], function( i, name ) { |
---|
186 | var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], |
---|
187 | type = name.toLowerCase(), |
---|
188 | orig = { |
---|
189 | innerWidth: $.fn.innerWidth, |
---|
190 | innerHeight: $.fn.innerHeight, |
---|
191 | outerWidth: $.fn.outerWidth, |
---|
192 | outerHeight: $.fn.outerHeight |
---|
193 | }; |
---|
194 | |
---|
195 | function reduce( elem, size, border, margin ) { |
---|
196 | $.each( side, function() { |
---|
197 | size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; |
---|
198 | if ( border ) { |
---|
199 | size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; |
---|
200 | } |
---|
201 | if ( margin ) { |
---|
202 | size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; |
---|
203 | } |
---|
204 | }); |
---|
205 | return size; |
---|
206 | } |
---|
207 | |
---|
208 | $.fn[ "inner" + name ] = function( size ) { |
---|
209 | if ( size === undefined ) { |
---|
210 | return orig[ "inner" + name ].call( this ); |
---|
211 | } |
---|
212 | |
---|
213 | return this.each(function() { |
---|
214 | $( this ).css( type, reduce( this, size ) + "px" ); |
---|
215 | }); |
---|
216 | }; |
---|
217 | |
---|
218 | $.fn[ "outer" + name] = function( size, margin ) { |
---|
219 | if ( typeof size !== "number" ) { |
---|
220 | return orig[ "outer" + name ].call( this, size ); |
---|
221 | } |
---|
222 | |
---|
223 | return this.each(function() { |
---|
224 | $( this).css( type, reduce( this, size, true, margin ) + "px" ); |
---|
225 | }); |
---|
226 | }; |
---|
227 | }); |
---|
228 | } |
---|
229 | |
---|
230 | // support: jQuery <1.8 |
---|
231 | if ( !$.fn.addBack ) { |
---|
232 | $.fn.addBack = function( selector ) { |
---|
233 | return this.add( selector == null ? |
---|
234 | this.prevObject : this.prevObject.filter( selector ) |
---|
235 | ); |
---|
236 | }; |
---|
237 | } |
---|
238 | |
---|
239 | // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) |
---|
240 | if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { |
---|
241 | $.fn.removeData = (function( removeData ) { |
---|
242 | return function( key ) { |
---|
243 | if ( arguments.length ) { |
---|
244 | return removeData.call( this, $.camelCase( key ) ); |
---|
245 | } else { |
---|
246 | return removeData.call( this ); |
---|
247 | } |
---|
248 | }; |
---|
249 | })( $.fn.removeData ); |
---|
250 | } |
---|
251 | |
---|
252 | |
---|
253 | |
---|
254 | |
---|
255 | |
---|
256 | // deprecated |
---|
257 | $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); |
---|
258 | |
---|
259 | $.support.selectstart = "onselectstart" in document.createElement( "div" ); |
---|
260 | $.fn.extend({ |
---|
261 | disableSelection: function() { |
---|
262 | return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + |
---|
263 | ".ui-disableSelection", function( event ) { |
---|
264 | event.preventDefault(); |
---|
265 | }); |
---|
266 | }, |
---|
267 | |
---|
268 | enableSelection: function() { |
---|
269 | return this.unbind( ".ui-disableSelection" ); |
---|
270 | } |
---|
271 | }); |
---|
272 | |
---|
273 | $.extend( $.ui, { |
---|
274 | // $.ui.plugin is deprecated. Use the proxy pattern instead. |
---|
275 | plugin: { |
---|
276 | add: function( module, option, set ) { |
---|
277 | var i, |
---|
278 | proto = $.ui[ module ].prototype; |
---|
279 | for ( i in set ) { |
---|
280 | proto.plugins[ i ] = proto.plugins[ i ] || []; |
---|
281 | proto.plugins[ i ].push( [ option, set[ i ] ] ); |
---|
282 | } |
---|
283 | }, |
---|
284 | call: function( instance, name, args ) { |
---|
285 | var i, |
---|
286 | set = instance.plugins[ name ]; |
---|
287 | if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { |
---|
288 | return; |
---|
289 | } |
---|
290 | |
---|
291 | for ( i = 0; i < set.length; i++ ) { |
---|
292 | if ( instance.options[ set[ i ][ 0 ] ] ) { |
---|
293 | set[ i ][ 1 ].apply( instance.element, args ); |
---|
294 | } |
---|
295 | } |
---|
296 | } |
---|
297 | }, |
---|
298 | |
---|
299 | // only used by resizable |
---|
300 | hasScroll: function( el, a ) { |
---|
301 | |
---|
302 | //If overflow is hidden, the element might have extra content, but the user wants to hide it |
---|
303 | if ( $( el ).css( "overflow" ) === "hidden") { |
---|
304 | return false; |
---|
305 | } |
---|
306 | |
---|
307 | var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", |
---|
308 | has = false; |
---|
309 | |
---|
310 | if ( el[ scroll ] > 0 ) { |
---|
311 | return true; |
---|
312 | } |
---|
313 | |
---|
314 | // TODO: determine which cases actually cause this to happen |
---|
315 | // if the element doesn't have the scroll set, see if it's possible to |
---|
316 | // set the scroll |
---|
317 | el[ scroll ] = 1; |
---|
318 | has = ( el[ scroll ] > 0 ); |
---|
319 | el[ scroll ] = 0; |
---|
320 | return has; |
---|
321 | } |
---|
322 | }); |
---|
323 | |
---|
324 | })( jQuery ); |
---|