Index: branches/resourceloader/phase3/resources/test/index.html |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | } |
11 | 11 | </style> |
12 | 12 | <script type="text/javascript" src="../../load.php?modules=jquery|mw&debug=1"></script> |
13 | | - <script type="text/javascript" src="../../load.php?modules=mw.util|test&debug=1"></script> |
| 13 | + <script type="text/javascript" src="../../load.php?modules=test&debug=1"></script> |
14 | 14 | <script> |
15 | 15 | mw.config.set( 'wgScriptPath', '../..' ); |
16 | 16 | </script> |
Index: branches/resourceloader/phase3/resources/Resources.php |
— | — | @@ -2,15 +2,15 @@ |
3 | 3 | |
4 | 4 | ResourceLoader::register( array( |
5 | 5 | 'jquery' => array( |
6 | | - 'script' => 'resources/base/jquery-1.4.2.js', |
| 6 | + 'script' => 'resources/base/jquery/jquery-1.4.2.js', |
7 | 7 | 'raw' => true, |
8 | 8 | ), |
9 | | - 'mw' => array( |
10 | | - 'script' => 'resources/base/mw.js', |
| 9 | + 'jquery.tabIndex' => array( |
| 10 | + 'script' => 'resources/base/jquery/jquery.tabIndex.js', |
11 | 11 | 'raw' => true, |
12 | 12 | ), |
13 | | - 'mw.util' => array( |
14 | | - 'script' => 'resources/base/mw/mw.util.js', |
| 13 | + 'mw' => array( |
| 14 | + 'script' => 'resources/base/mw/mw.js', |
15 | 15 | 'raw' => true, |
16 | 16 | ), |
17 | 17 | 'test' => array( |
Index: branches/resourceloader/phase3/resources/base/jquery-1.4.2.js |
— | — | @@ -1,6240 +0,0 @@ |
2 | | -/*! |
3 | | - * jQuery JavaScript Library v1.4.2 |
4 | | - * http://jquery.com/ |
5 | | - * |
6 | | - * Copyright 2010, John Resig |
7 | | - * Dual licensed under the MIT or GPL Version 2 licenses. |
8 | | - * http://jquery.org/license |
9 | | - * |
10 | | - * Includes Sizzle.js |
11 | | - * http://sizzlejs.com/ |
12 | | - * Copyright 2010, The Dojo Foundation |
13 | | - * Released under the MIT, BSD, and GPL Licenses. |
14 | | - * |
15 | | - * Date: Sat Feb 13 22:33:48 2010 -0500 |
16 | | - */ |
17 | | -(function( window, undefined ) { |
18 | | - |
19 | | -// Define a local copy of jQuery |
20 | | -var jQuery = function( selector, context ) { |
21 | | - // The jQuery object is actually just the init constructor 'enhanced' |
22 | | - return new jQuery.fn.init( selector, context ); |
23 | | - }, |
24 | | - |
25 | | - // Map over jQuery in case of overwrite |
26 | | - _jQuery = window.jQuery, |
27 | | - |
28 | | - // Map over the $ in case of overwrite |
29 | | - _$ = window.$, |
30 | | - |
31 | | - // Use the correct document accordingly with window argument (sandbox) |
32 | | - document = window.document, |
33 | | - |
34 | | - // A central reference to the root jQuery(document) |
35 | | - rootjQuery, |
36 | | - |
37 | | - // A simple way to check for HTML strings or ID strings |
38 | | - // (both of which we optimize for) |
39 | | - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, |
40 | | - |
41 | | - // Is it a simple selector |
42 | | - isSimple = /^.[^:#\[\.,]*$/, |
43 | | - |
44 | | - // Check if a string has a non-whitespace character in it |
45 | | - rnotwhite = /\S/, |
46 | | - |
47 | | - // Used for trimming whitespace |
48 | | - rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, |
49 | | - |
50 | | - // Match a standalone tag |
51 | | - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, |
52 | | - |
53 | | - // Keep a UserAgent string for use with jQuery.browser |
54 | | - userAgent = navigator.userAgent, |
55 | | - |
56 | | - // For matching the engine and version of the browser |
57 | | - browserMatch, |
58 | | - |
59 | | - // Has the ready events already been bound? |
60 | | - readyBound = false, |
61 | | - |
62 | | - // The functions to execute on DOM ready |
63 | | - readyList = [], |
64 | | - |
65 | | - // The ready event handler |
66 | | - DOMContentLoaded, |
67 | | - |
68 | | - // Save a reference to some core methods |
69 | | - toString = Object.prototype.toString, |
70 | | - hasOwnProperty = Object.prototype.hasOwnProperty, |
71 | | - push = Array.prototype.push, |
72 | | - slice = Array.prototype.slice, |
73 | | - indexOf = Array.prototype.indexOf; |
74 | | - |
75 | | -jQuery.fn = jQuery.prototype = { |
76 | | - init: function( selector, context ) { |
77 | | - var match, elem, ret, doc; |
78 | | - |
79 | | - // Handle $(""), $(null), or $(undefined) |
80 | | - if ( !selector ) { |
81 | | - return this; |
82 | | - } |
83 | | - |
84 | | - // Handle $(DOMElement) |
85 | | - if ( selector.nodeType ) { |
86 | | - this.context = this[0] = selector; |
87 | | - this.length = 1; |
88 | | - return this; |
89 | | - } |
90 | | - |
91 | | - // The body element only exists once, optimize finding it |
92 | | - if ( selector === "body" && !context ) { |
93 | | - this.context = document; |
94 | | - this[0] = document.body; |
95 | | - this.selector = "body"; |
96 | | - this.length = 1; |
97 | | - return this; |
98 | | - } |
99 | | - |
100 | | - // Handle HTML strings |
101 | | - if ( typeof selector === "string" ) { |
102 | | - // Are we dealing with HTML string or an ID? |
103 | | - match = quickExpr.exec( selector ); |
104 | | - |
105 | | - // Verify a match, and that no context was specified for #id |
106 | | - if ( match && (match[1] || !context) ) { |
107 | | - |
108 | | - // HANDLE: $(html) -> $(array) |
109 | | - if ( match[1] ) { |
110 | | - doc = (context ? context.ownerDocument || context : document); |
111 | | - |
112 | | - // If a single string is passed in and it's a single tag |
113 | | - // just do a createElement and skip the rest |
114 | | - ret = rsingleTag.exec( selector ); |
115 | | - |
116 | | - if ( ret ) { |
117 | | - if ( jQuery.isPlainObject( context ) ) { |
118 | | - selector = [ document.createElement( ret[1] ) ]; |
119 | | - jQuery.fn.attr.call( selector, context, true ); |
120 | | - |
121 | | - } else { |
122 | | - selector = [ doc.createElement( ret[1] ) ]; |
123 | | - } |
124 | | - |
125 | | - } else { |
126 | | - ret = buildFragment( [ match[1] ], [ doc ] ); |
127 | | - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; |
128 | | - } |
129 | | - |
130 | | - return jQuery.merge( this, selector ); |
131 | | - |
132 | | - // HANDLE: $("#id") |
133 | | - } else { |
134 | | - elem = document.getElementById( match[2] ); |
135 | | - |
136 | | - if ( elem ) { |
137 | | - // Handle the case where IE and Opera return items |
138 | | - // by name instead of ID |
139 | | - if ( elem.id !== match[2] ) { |
140 | | - return rootjQuery.find( selector ); |
141 | | - } |
142 | | - |
143 | | - // Otherwise, we inject the element directly into the jQuery object |
144 | | - this.length = 1; |
145 | | - this[0] = elem; |
146 | | - } |
147 | | - |
148 | | - this.context = document; |
149 | | - this.selector = selector; |
150 | | - return this; |
151 | | - } |
152 | | - |
153 | | - // HANDLE: $("TAG") |
154 | | - } else if ( !context && /^\w+$/.test( selector ) ) { |
155 | | - this.selector = selector; |
156 | | - this.context = document; |
157 | | - selector = document.getElementsByTagName( selector ); |
158 | | - return jQuery.merge( this, selector ); |
159 | | - |
160 | | - // HANDLE: $(expr, $(...)) |
161 | | - } else if ( !context || context.jquery ) { |
162 | | - return (context || rootjQuery).find( selector ); |
163 | | - |
164 | | - // HANDLE: $(expr, context) |
165 | | - // (which is just equivalent to: $(context).find(expr) |
166 | | - } else { |
167 | | - return jQuery( context ).find( selector ); |
168 | | - } |
169 | | - |
170 | | - // HANDLE: $(function) |
171 | | - // Shortcut for document ready |
172 | | - } else if ( jQuery.isFunction( selector ) ) { |
173 | | - return rootjQuery.ready( selector ); |
174 | | - } |
175 | | - |
176 | | - if (selector.selector !== undefined) { |
177 | | - this.selector = selector.selector; |
178 | | - this.context = selector.context; |
179 | | - } |
180 | | - |
181 | | - return jQuery.makeArray( selector, this ); |
182 | | - }, |
183 | | - |
184 | | - // Start with an empty selector |
185 | | - selector: "", |
186 | | - |
187 | | - // The current version of jQuery being used |
188 | | - jquery: "1.4.2", |
189 | | - |
190 | | - // The default length of a jQuery object is 0 |
191 | | - length: 0, |
192 | | - |
193 | | - // The number of elements contained in the matched element set |
194 | | - size: function() { |
195 | | - return this.length; |
196 | | - }, |
197 | | - |
198 | | - toArray: function() { |
199 | | - return slice.call( this, 0 ); |
200 | | - }, |
201 | | - |
202 | | - // Get the Nth element in the matched element set OR |
203 | | - // Get the whole matched element set as a clean array |
204 | | - get: function( num ) { |
205 | | - return num == null ? |
206 | | - |
207 | | - // Return a 'clean' array |
208 | | - this.toArray() : |
209 | | - |
210 | | - // Return just the object |
211 | | - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); |
212 | | - }, |
213 | | - |
214 | | - // Take an array of elements and push it onto the stack |
215 | | - // (returning the new matched element set) |
216 | | - pushStack: function( elems, name, selector ) { |
217 | | - // Build a new jQuery matched element set |
218 | | - var ret = jQuery(); |
219 | | - |
220 | | - if ( jQuery.isArray( elems ) ) { |
221 | | - push.apply( ret, elems ); |
222 | | - |
223 | | - } else { |
224 | | - jQuery.merge( ret, elems ); |
225 | | - } |
226 | | - |
227 | | - // Add the old object onto the stack (as a reference) |
228 | | - ret.prevObject = this; |
229 | | - |
230 | | - ret.context = this.context; |
231 | | - |
232 | | - if ( name === "find" ) { |
233 | | - ret.selector = this.selector + (this.selector ? " " : "") + selector; |
234 | | - } else if ( name ) { |
235 | | - ret.selector = this.selector + "." + name + "(" + selector + ")"; |
236 | | - } |
237 | | - |
238 | | - // Return the newly-formed element set |
239 | | - return ret; |
240 | | - }, |
241 | | - |
242 | | - // Execute a callback for every element in the matched set. |
243 | | - // (You can seed the arguments with an array of args, but this is |
244 | | - // only used internally.) |
245 | | - each: function( callback, args ) { |
246 | | - return jQuery.each( this, callback, args ); |
247 | | - }, |
248 | | - |
249 | | - ready: function( fn ) { |
250 | | - // Attach the listeners |
251 | | - jQuery.bindReady(); |
252 | | - |
253 | | - // If the DOM is already ready |
254 | | - if ( jQuery.isReady ) { |
255 | | - // Execute the function immediately |
256 | | - fn.call( document, jQuery ); |
257 | | - |
258 | | - // Otherwise, remember the function for later |
259 | | - } else if ( readyList ) { |
260 | | - // Add the function to the wait list |
261 | | - readyList.push( fn ); |
262 | | - } |
263 | | - |
264 | | - return this; |
265 | | - }, |
266 | | - |
267 | | - eq: function( i ) { |
268 | | - return i === -1 ? |
269 | | - this.slice( i ) : |
270 | | - this.slice( i, +i + 1 ); |
271 | | - }, |
272 | | - |
273 | | - first: function() { |
274 | | - return this.eq( 0 ); |
275 | | - }, |
276 | | - |
277 | | - last: function() { |
278 | | - return this.eq( -1 ); |
279 | | - }, |
280 | | - |
281 | | - slice: function() { |
282 | | - return this.pushStack( slice.apply( this, arguments ), |
283 | | - "slice", slice.call(arguments).join(",") ); |
284 | | - }, |
285 | | - |
286 | | - map: function( callback ) { |
287 | | - return this.pushStack( jQuery.map(this, function( elem, i ) { |
288 | | - return callback.call( elem, i, elem ); |
289 | | - })); |
290 | | - }, |
291 | | - |
292 | | - end: function() { |
293 | | - return this.prevObject || jQuery(null); |
294 | | - }, |
295 | | - |
296 | | - // For internal use only. |
297 | | - // Behaves like an Array's method, not like a jQuery method. |
298 | | - push: push, |
299 | | - sort: [].sort, |
300 | | - splice: [].splice |
301 | | -}; |
302 | | - |
303 | | -// Give the init function the jQuery prototype for later instantiation |
304 | | -jQuery.fn.init.prototype = jQuery.fn; |
305 | | - |
306 | | -jQuery.extend = jQuery.fn.extend = function() { |
307 | | - // copy reference to target object |
308 | | - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; |
309 | | - |
310 | | - // Handle a deep copy situation |
311 | | - if ( typeof target === "boolean" ) { |
312 | | - deep = target; |
313 | | - target = arguments[1] || {}; |
314 | | - // skip the boolean and the target |
315 | | - i = 2; |
316 | | - } |
317 | | - |
318 | | - // Handle case when target is a string or something (possible in deep copy) |
319 | | - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
320 | | - target = {}; |
321 | | - } |
322 | | - |
323 | | - // extend jQuery itself if only one argument is passed |
324 | | - if ( length === i ) { |
325 | | - target = this; |
326 | | - --i; |
327 | | - } |
328 | | - |
329 | | - for ( ; i < length; i++ ) { |
330 | | - // Only deal with non-null/undefined values |
331 | | - if ( (options = arguments[ i ]) != null ) { |
332 | | - // Extend the base object |
333 | | - for ( name in options ) { |
334 | | - src = target[ name ]; |
335 | | - copy = options[ name ]; |
336 | | - |
337 | | - // Prevent never-ending loop |
338 | | - if ( target === copy ) { |
339 | | - continue; |
340 | | - } |
341 | | - |
342 | | - // Recurse if we're merging object literal values or arrays |
343 | | - if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { |
344 | | - var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src |
345 | | - : jQuery.isArray(copy) ? [] : {}; |
346 | | - |
347 | | - // Never move original objects, clone them |
348 | | - target[ name ] = jQuery.extend( deep, clone, copy ); |
349 | | - |
350 | | - // Don't bring in undefined values |
351 | | - } else if ( copy !== undefined ) { |
352 | | - target[ name ] = copy; |
353 | | - } |
354 | | - } |
355 | | - } |
356 | | - } |
357 | | - |
358 | | - // Return the modified object |
359 | | - return target; |
360 | | -}; |
361 | | - |
362 | | -jQuery.extend({ |
363 | | - noConflict: function( deep ) { |
364 | | - window.$ = _$; |
365 | | - |
366 | | - if ( deep ) { |
367 | | - window.jQuery = _jQuery; |
368 | | - } |
369 | | - |
370 | | - return jQuery; |
371 | | - }, |
372 | | - |
373 | | - // Is the DOM ready to be used? Set to true once it occurs. |
374 | | - isReady: false, |
375 | | - |
376 | | - // Handle when the DOM is ready |
377 | | - ready: function() { |
378 | | - // Make sure that the DOM is not already loaded |
379 | | - if ( !jQuery.isReady ) { |
380 | | - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
381 | | - if ( !document.body ) { |
382 | | - return setTimeout( jQuery.ready, 13 ); |
383 | | - } |
384 | | - |
385 | | - // Remember that the DOM is ready |
386 | | - jQuery.isReady = true; |
387 | | - |
388 | | - // If there are functions bound, to execute |
389 | | - if ( readyList ) { |
390 | | - // Execute all of them |
391 | | - var fn, i = 0; |
392 | | - while ( (fn = readyList[ i++ ]) ) { |
393 | | - fn.call( document, jQuery ); |
394 | | - } |
395 | | - |
396 | | - // Reset the list of functions |
397 | | - readyList = null; |
398 | | - } |
399 | | - |
400 | | - // Trigger any bound ready events |
401 | | - if ( jQuery.fn.triggerHandler ) { |
402 | | - jQuery( document ).triggerHandler( "ready" ); |
403 | | - } |
404 | | - } |
405 | | - }, |
406 | | - |
407 | | - bindReady: function() { |
408 | | - if ( readyBound ) { |
409 | | - return; |
410 | | - } |
411 | | - |
412 | | - readyBound = true; |
413 | | - |
414 | | - // Catch cases where $(document).ready() is called after the |
415 | | - // browser event has already occurred. |
416 | | - if ( document.readyState === "complete" ) { |
417 | | - return jQuery.ready(); |
418 | | - } |
419 | | - |
420 | | - // Mozilla, Opera and webkit nightlies currently support this event |
421 | | - if ( document.addEventListener ) { |
422 | | - // Use the handy event callback |
423 | | - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
424 | | - |
425 | | - // A fallback to window.onload, that will always work |
426 | | - window.addEventListener( "load", jQuery.ready, false ); |
427 | | - |
428 | | - // If IE event model is used |
429 | | - } else if ( document.attachEvent ) { |
430 | | - // ensure firing before onload, |
431 | | - // maybe late but safe also for iframes |
432 | | - document.attachEvent("onreadystatechange", DOMContentLoaded); |
433 | | - |
434 | | - // A fallback to window.onload, that will always work |
435 | | - window.attachEvent( "onload", jQuery.ready ); |
436 | | - |
437 | | - // If IE and not a frame |
438 | | - // continually check to see if the document is ready |
439 | | - var toplevel = false; |
440 | | - |
441 | | - try { |
442 | | - toplevel = window.frameElement == null; |
443 | | - } catch(e) {} |
444 | | - |
445 | | - if ( document.documentElement.doScroll && toplevel ) { |
446 | | - doScrollCheck(); |
447 | | - } |
448 | | - } |
449 | | - }, |
450 | | - |
451 | | - // See test/unit/core.js for details concerning isFunction. |
452 | | - // Since version 1.3, DOM methods and functions like alert |
453 | | - // aren't supported. They return false on IE (#2968). |
454 | | - isFunction: function( obj ) { |
455 | | - return toString.call(obj) === "[object Function]"; |
456 | | - }, |
457 | | - |
458 | | - isArray: function( obj ) { |
459 | | - return toString.call(obj) === "[object Array]"; |
460 | | - }, |
461 | | - |
462 | | - isPlainObject: function( obj ) { |
463 | | - // Must be an Object. |
464 | | - // Because of IE, we also have to check the presence of the constructor property. |
465 | | - // Make sure that DOM nodes and window objects don't pass through, as well |
466 | | - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { |
467 | | - return false; |
468 | | - } |
469 | | - |
470 | | - // Not own constructor property must be Object |
471 | | - if ( obj.constructor |
472 | | - && !hasOwnProperty.call(obj, "constructor") |
473 | | - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { |
474 | | - return false; |
475 | | - } |
476 | | - |
477 | | - // Own properties are enumerated firstly, so to speed up, |
478 | | - // if last one is own, then all properties are own. |
479 | | - |
480 | | - var key; |
481 | | - for ( key in obj ) {} |
482 | | - |
483 | | - return key === undefined || hasOwnProperty.call( obj, key ); |
484 | | - }, |
485 | | - |
486 | | - isEmptyObject: function( obj ) { |
487 | | - for ( var name in obj ) { |
488 | | - return false; |
489 | | - } |
490 | | - return true; |
491 | | - }, |
492 | | - |
493 | | - error: function( msg ) { |
494 | | - throw msg; |
495 | | - }, |
496 | | - |
497 | | - parseJSON: function( data ) { |
498 | | - if ( typeof data !== "string" || !data ) { |
499 | | - return null; |
500 | | - } |
501 | | - |
502 | | - // Make sure leading/trailing whitespace is removed (IE can't handle it) |
503 | | - data = jQuery.trim( data ); |
504 | | - |
505 | | - // Make sure the incoming data is actual JSON |
506 | | - // Logic borrowed from http://json.org/json2.js |
507 | | - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") |
508 | | - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") |
509 | | - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { |
510 | | - |
511 | | - // Try to use the native JSON parser first |
512 | | - return window.JSON && window.JSON.parse ? |
513 | | - window.JSON.parse( data ) : |
514 | | - (new Function("return " + data))(); |
515 | | - |
516 | | - } else { |
517 | | - jQuery.error( "Invalid JSON: " + data ); |
518 | | - } |
519 | | - }, |
520 | | - |
521 | | - noop: function() {}, |
522 | | - |
523 | | - // Evalulates a script in a global context |
524 | | - globalEval: function( data ) { |
525 | | - if ( data && rnotwhite.test(data) ) { |
526 | | - // Inspired by code by Andrea Giammarchi |
527 | | - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
528 | | - var head = document.getElementsByTagName("head")[0] || document.documentElement, |
529 | | - script = document.createElement("script"); |
530 | | - |
531 | | - script.type = "text/javascript"; |
532 | | - |
533 | | - if ( jQuery.support.scriptEval ) { |
534 | | - script.appendChild( document.createTextNode( data ) ); |
535 | | - } else { |
536 | | - script.text = data; |
537 | | - } |
538 | | - |
539 | | - // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
540 | | - // This arises when a base node is used (#2709). |
541 | | - head.insertBefore( script, head.firstChild ); |
542 | | - head.removeChild( script ); |
543 | | - } |
544 | | - }, |
545 | | - |
546 | | - nodeName: function( elem, name ) { |
547 | | - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
548 | | - }, |
549 | | - |
550 | | - // args is for internal usage only |
551 | | - each: function( object, callback, args ) { |
552 | | - var name, i = 0, |
553 | | - length = object.length, |
554 | | - isObj = length === undefined || jQuery.isFunction(object); |
555 | | - |
556 | | - if ( args ) { |
557 | | - if ( isObj ) { |
558 | | - for ( name in object ) { |
559 | | - if ( callback.apply( object[ name ], args ) === false ) { |
560 | | - break; |
561 | | - } |
562 | | - } |
563 | | - } else { |
564 | | - for ( ; i < length; ) { |
565 | | - if ( callback.apply( object[ i++ ], args ) === false ) { |
566 | | - break; |
567 | | - } |
568 | | - } |
569 | | - } |
570 | | - |
571 | | - // A special, fast, case for the most common use of each |
572 | | - } else { |
573 | | - if ( isObj ) { |
574 | | - for ( name in object ) { |
575 | | - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
576 | | - break; |
577 | | - } |
578 | | - } |
579 | | - } else { |
580 | | - for ( var value = object[0]; |
581 | | - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} |
582 | | - } |
583 | | - } |
584 | | - |
585 | | - return object; |
586 | | - }, |
587 | | - |
588 | | - trim: function( text ) { |
589 | | - return (text || "").replace( rtrim, "" ); |
590 | | - }, |
591 | | - |
592 | | - // results is for internal usage only |
593 | | - makeArray: function( array, results ) { |
594 | | - var ret = results || []; |
595 | | - |
596 | | - if ( array != null ) { |
597 | | - // The window, strings (and functions) also have 'length' |
598 | | - // The extra typeof function check is to prevent crashes |
599 | | - // in Safari 2 (See: #3039) |
600 | | - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { |
601 | | - push.call( ret, array ); |
602 | | - } else { |
603 | | - jQuery.merge( ret, array ); |
604 | | - } |
605 | | - } |
606 | | - |
607 | | - return ret; |
608 | | - }, |
609 | | - |
610 | | - inArray: function( elem, array ) { |
611 | | - if ( array.indexOf ) { |
612 | | - return array.indexOf( elem ); |
613 | | - } |
614 | | - |
615 | | - for ( var i = 0, length = array.length; i < length; i++ ) { |
616 | | - if ( array[ i ] === elem ) { |
617 | | - return i; |
618 | | - } |
619 | | - } |
620 | | - |
621 | | - return -1; |
622 | | - }, |
623 | | - |
624 | | - merge: function( first, second ) { |
625 | | - var i = first.length, j = 0; |
626 | | - |
627 | | - if ( typeof second.length === "number" ) { |
628 | | - for ( var l = second.length; j < l; j++ ) { |
629 | | - first[ i++ ] = second[ j ]; |
630 | | - } |
631 | | - |
632 | | - } else { |
633 | | - while ( second[j] !== undefined ) { |
634 | | - first[ i++ ] = second[ j++ ]; |
635 | | - } |
636 | | - } |
637 | | - |
638 | | - first.length = i; |
639 | | - |
640 | | - return first; |
641 | | - }, |
642 | | - |
643 | | - grep: function( elems, callback, inv ) { |
644 | | - var ret = []; |
645 | | - |
646 | | - // Go through the array, only saving the items |
647 | | - // that pass the validator function |
648 | | - for ( var i = 0, length = elems.length; i < length; i++ ) { |
649 | | - if ( !inv !== !callback( elems[ i ], i ) ) { |
650 | | - ret.push( elems[ i ] ); |
651 | | - } |
652 | | - } |
653 | | - |
654 | | - return ret; |
655 | | - }, |
656 | | - |
657 | | - // arg is for internal usage only |
658 | | - map: function( elems, callback, arg ) { |
659 | | - var ret = [], value; |
660 | | - |
661 | | - // Go through the array, translating each of the items to their |
662 | | - // new value (or values). |
663 | | - for ( var i = 0, length = elems.length; i < length; i++ ) { |
664 | | - value = callback( elems[ i ], i, arg ); |
665 | | - |
666 | | - if ( value != null ) { |
667 | | - ret[ ret.length ] = value; |
668 | | - } |
669 | | - } |
670 | | - |
671 | | - return ret.concat.apply( [], ret ); |
672 | | - }, |
673 | | - |
674 | | - // A global GUID counter for objects |
675 | | - guid: 1, |
676 | | - |
677 | | - proxy: function( fn, proxy, thisObject ) { |
678 | | - if ( arguments.length === 2 ) { |
679 | | - if ( typeof proxy === "string" ) { |
680 | | - thisObject = fn; |
681 | | - fn = thisObject[ proxy ]; |
682 | | - proxy = undefined; |
683 | | - |
684 | | - } else if ( proxy && !jQuery.isFunction( proxy ) ) { |
685 | | - thisObject = proxy; |
686 | | - proxy = undefined; |
687 | | - } |
688 | | - } |
689 | | - |
690 | | - if ( !proxy && fn ) { |
691 | | - proxy = function() { |
692 | | - return fn.apply( thisObject || this, arguments ); |
693 | | - }; |
694 | | - } |
695 | | - |
696 | | - // Set the guid of unique handler to the same of original handler, so it can be removed |
697 | | - if ( fn ) { |
698 | | - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
699 | | - } |
700 | | - |
701 | | - // So proxy can be declared as an argument |
702 | | - return proxy; |
703 | | - }, |
704 | | - |
705 | | - // Use of jQuery.browser is frowned upon. |
706 | | - // More details: http://docs.jquery.com/Utilities/jQuery.browser |
707 | | - uaMatch: function( ua ) { |
708 | | - ua = ua.toLowerCase(); |
709 | | - |
710 | | - var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || |
711 | | - /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || |
712 | | - /(msie) ([\w.]+)/.exec( ua ) || |
713 | | - !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || |
714 | | - []; |
715 | | - |
716 | | - return { browser: match[1] || "", version: match[2] || "0" }; |
717 | | - }, |
718 | | - |
719 | | - browser: {} |
720 | | -}); |
721 | | - |
722 | | -browserMatch = jQuery.uaMatch( userAgent ); |
723 | | -if ( browserMatch.browser ) { |
724 | | - jQuery.browser[ browserMatch.browser ] = true; |
725 | | - jQuery.browser.version = browserMatch.version; |
726 | | -} |
727 | | - |
728 | | -// Deprecated, use jQuery.browser.webkit instead |
729 | | -if ( jQuery.browser.webkit ) { |
730 | | - jQuery.browser.safari = true; |
731 | | -} |
732 | | - |
733 | | -if ( indexOf ) { |
734 | | - jQuery.inArray = function( elem, array ) { |
735 | | - return indexOf.call( array, elem ); |
736 | | - }; |
737 | | -} |
738 | | - |
739 | | -// All jQuery objects should point back to these |
740 | | -rootjQuery = jQuery(document); |
741 | | - |
742 | | -// Cleanup functions for the document ready method |
743 | | -if ( document.addEventListener ) { |
744 | | - DOMContentLoaded = function() { |
745 | | - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
746 | | - jQuery.ready(); |
747 | | - }; |
748 | | - |
749 | | -} else if ( document.attachEvent ) { |
750 | | - DOMContentLoaded = function() { |
751 | | - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
752 | | - if ( document.readyState === "complete" ) { |
753 | | - document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
754 | | - jQuery.ready(); |
755 | | - } |
756 | | - }; |
757 | | -} |
758 | | - |
759 | | -// The DOM ready check for Internet Explorer |
760 | | -function doScrollCheck() { |
761 | | - if ( jQuery.isReady ) { |
762 | | - return; |
763 | | - } |
764 | | - |
765 | | - try { |
766 | | - // If IE is used, use the trick by Diego Perini |
767 | | - // http://javascript.nwbox.com/IEContentLoaded/ |
768 | | - document.documentElement.doScroll("left"); |
769 | | - } catch( error ) { |
770 | | - setTimeout( doScrollCheck, 1 ); |
771 | | - return; |
772 | | - } |
773 | | - |
774 | | - // and execute any waiting functions |
775 | | - jQuery.ready(); |
776 | | -} |
777 | | - |
778 | | -function evalScript( i, elem ) { |
779 | | - if ( elem.src ) { |
780 | | - jQuery.ajax({ |
781 | | - url: elem.src, |
782 | | - async: false, |
783 | | - dataType: "script" |
784 | | - }); |
785 | | - } else { |
786 | | - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
787 | | - } |
788 | | - |
789 | | - if ( elem.parentNode ) { |
790 | | - elem.parentNode.removeChild( elem ); |
791 | | - } |
792 | | -} |
793 | | - |
794 | | -// Mutifunctional method to get and set values to a collection |
795 | | -// The value/s can be optionally by executed if its a function |
796 | | -function access( elems, key, value, exec, fn, pass ) { |
797 | | - var length = elems.length; |
798 | | - |
799 | | - // Setting many attributes |
800 | | - if ( typeof key === "object" ) { |
801 | | - for ( var k in key ) { |
802 | | - access( elems, k, key[k], exec, fn, value ); |
803 | | - } |
804 | | - return elems; |
805 | | - } |
806 | | - |
807 | | - // Setting one attribute |
808 | | - if ( value !== undefined ) { |
809 | | - // Optionally, function values get executed if exec is true |
810 | | - exec = !pass && exec && jQuery.isFunction(value); |
811 | | - |
812 | | - for ( var i = 0; i < length; i++ ) { |
813 | | - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
814 | | - } |
815 | | - |
816 | | - return elems; |
817 | | - } |
818 | | - |
819 | | - // Getting an attribute |
820 | | - return length ? fn( elems[0], key ) : undefined; |
821 | | -} |
822 | | - |
823 | | -function now() { |
824 | | - return (new Date).getTime(); |
825 | | -} |
826 | | -(function() { |
827 | | - |
828 | | - jQuery.support = {}; |
829 | | - |
830 | | - var root = document.documentElement, |
831 | | - script = document.createElement("script"), |
832 | | - div = document.createElement("div"), |
833 | | - id = "script" + now(); |
834 | | - |
835 | | - div.style.display = "none"; |
836 | | - div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
837 | | - |
838 | | - var all = div.getElementsByTagName("*"), |
839 | | - a = div.getElementsByTagName("a")[0]; |
840 | | - |
841 | | - // Can't get basic test support |
842 | | - if ( !all || !all.length || !a ) { |
843 | | - return; |
844 | | - } |
845 | | - |
846 | | - jQuery.support = { |
847 | | - // IE strips leading whitespace when .innerHTML is used |
848 | | - leadingWhitespace: div.firstChild.nodeType === 3, |
849 | | - |
850 | | - // Make sure that tbody elements aren't automatically inserted |
851 | | - // IE will insert them into empty tables |
852 | | - tbody: !div.getElementsByTagName("tbody").length, |
853 | | - |
854 | | - // Make sure that link elements get serialized correctly by innerHTML |
855 | | - // This requires a wrapper element in IE |
856 | | - htmlSerialize: !!div.getElementsByTagName("link").length, |
857 | | - |
858 | | - // Get the style information from getAttribute |
859 | | - // (IE uses .cssText insted) |
860 | | - style: /red/.test( a.getAttribute("style") ), |
861 | | - |
862 | | - // Make sure that URLs aren't manipulated |
863 | | - // (IE normalizes it by default) |
864 | | - hrefNormalized: a.getAttribute("href") === "/a", |
865 | | - |
866 | | - // Make sure that element opacity exists |
867 | | - // (IE uses filter instead) |
868 | | - // Use a regex to work around a WebKit issue. See #5145 |
869 | | - opacity: /^0.55$/.test( a.style.opacity ), |
870 | | - |
871 | | - // Verify style float existence |
872 | | - // (IE uses styleFloat instead of cssFloat) |
873 | | - cssFloat: !!a.style.cssFloat, |
874 | | - |
875 | | - // Make sure that if no value is specified for a checkbox |
876 | | - // that it defaults to "on". |
877 | | - // (WebKit defaults to "" instead) |
878 | | - checkOn: div.getElementsByTagName("input")[0].value === "on", |
879 | | - |
880 | | - // Make sure that a selected-by-default option has a working selected property. |
881 | | - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
882 | | - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, |
883 | | - |
884 | | - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, |
885 | | - |
886 | | - // Will be defined later |
887 | | - deleteExpando: true, |
888 | | - checkClone: false, |
889 | | - scriptEval: false, |
890 | | - noCloneEvent: true, |
891 | | - boxModel: null |
892 | | - }; |
893 | | - |
894 | | - script.type = "text/javascript"; |
895 | | - try { |
896 | | - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
897 | | - } catch(e) {} |
898 | | - |
899 | | - root.insertBefore( script, root.firstChild ); |
900 | | - |
901 | | - // Make sure that the execution of code works by injecting a script |
902 | | - // tag with appendChild/createTextNode |
903 | | - // (IE doesn't support this, fails, and uses .text instead) |
904 | | - if ( window[ id ] ) { |
905 | | - jQuery.support.scriptEval = true; |
906 | | - delete window[ id ]; |
907 | | - } |
908 | | - |
909 | | - // Test to see if it's possible to delete an expando from an element |
910 | | - // Fails in Internet Explorer |
911 | | - try { |
912 | | - delete script.test; |
913 | | - |
914 | | - } catch(e) { |
915 | | - jQuery.support.deleteExpando = false; |
916 | | - } |
917 | | - |
918 | | - root.removeChild( script ); |
919 | | - |
920 | | - if ( div.attachEvent && div.fireEvent ) { |
921 | | - div.attachEvent("onclick", function click() { |
922 | | - // Cloning a node shouldn't copy over any |
923 | | - // bound event handlers (IE does this) |
924 | | - jQuery.support.noCloneEvent = false; |
925 | | - div.detachEvent("onclick", click); |
926 | | - }); |
927 | | - div.cloneNode(true).fireEvent("onclick"); |
928 | | - } |
929 | | - |
930 | | - div = document.createElement("div"); |
931 | | - div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; |
932 | | - |
933 | | - var fragment = document.createDocumentFragment(); |
934 | | - fragment.appendChild( div.firstChild ); |
935 | | - |
936 | | - // WebKit doesn't clone checked state correctly in fragments |
937 | | - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; |
938 | | - |
939 | | - // Figure out if the W3C box model works as expected |
940 | | - // document.body must exist before we can do this |
941 | | - jQuery(function() { |
942 | | - var div = document.createElement("div"); |
943 | | - div.style.width = div.style.paddingLeft = "1px"; |
944 | | - |
945 | | - document.body.appendChild( div ); |
946 | | - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
947 | | - document.body.removeChild( div ).style.display = 'none'; |
948 | | - |
949 | | - div = null; |
950 | | - }); |
951 | | - |
952 | | - // Technique from Juriy Zaytsev |
953 | | - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ |
954 | | - var eventSupported = function( eventName ) { |
955 | | - var el = document.createElement("div"); |
956 | | - eventName = "on" + eventName; |
957 | | - |
958 | | - var isSupported = (eventName in el); |
959 | | - if ( !isSupported ) { |
960 | | - el.setAttribute(eventName, "return;"); |
961 | | - isSupported = typeof el[eventName] === "function"; |
962 | | - } |
963 | | - el = null; |
964 | | - |
965 | | - return isSupported; |
966 | | - }; |
967 | | - |
968 | | - jQuery.support.submitBubbles = eventSupported("submit"); |
969 | | - jQuery.support.changeBubbles = eventSupported("change"); |
970 | | - |
971 | | - // release memory in IE |
972 | | - root = script = div = all = a = null; |
973 | | -})(); |
974 | | - |
975 | | -jQuery.props = { |
976 | | - "for": "htmlFor", |
977 | | - "class": "className", |
978 | | - readonly: "readOnly", |
979 | | - maxlength: "maxLength", |
980 | | - cellspacing: "cellSpacing", |
981 | | - rowspan: "rowSpan", |
982 | | - colspan: "colSpan", |
983 | | - tabindex: "tabIndex", |
984 | | - usemap: "useMap", |
985 | | - frameborder: "frameBorder" |
986 | | -}; |
987 | | -var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
988 | | - |
989 | | -jQuery.extend({ |
990 | | - cache: {}, |
991 | | - |
992 | | - expando:expando, |
993 | | - |
994 | | - // The following elements throw uncatchable exceptions if you |
995 | | - // attempt to add expando properties to them. |
996 | | - noData: { |
997 | | - "embed": true, |
998 | | - "object": true, |
999 | | - "applet": true |
1000 | | - }, |
1001 | | - |
1002 | | - data: function( elem, name, data ) { |
1003 | | - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { |
1004 | | - return; |
1005 | | - } |
1006 | | - |
1007 | | - elem = elem == window ? |
1008 | | - windowData : |
1009 | | - elem; |
1010 | | - |
1011 | | - var id = elem[ expando ], cache = jQuery.cache, thisCache; |
1012 | | - |
1013 | | - if ( !id && typeof name === "string" && data === undefined ) { |
1014 | | - return null; |
1015 | | - } |
1016 | | - |
1017 | | - // Compute a unique ID for the element |
1018 | | - if ( !id ) { |
1019 | | - id = ++uuid; |
1020 | | - } |
1021 | | - |
1022 | | - // Avoid generating a new cache unless none exists and we |
1023 | | - // want to manipulate it. |
1024 | | - if ( typeof name === "object" ) { |
1025 | | - elem[ expando ] = id; |
1026 | | - thisCache = cache[ id ] = jQuery.extend(true, {}, name); |
1027 | | - |
1028 | | - } else if ( !cache[ id ] ) { |
1029 | | - elem[ expando ] = id; |
1030 | | - cache[ id ] = {}; |
1031 | | - } |
1032 | | - |
1033 | | - thisCache = cache[ id ]; |
1034 | | - |
1035 | | - // Prevent overriding the named cache with undefined values |
1036 | | - if ( data !== undefined ) { |
1037 | | - thisCache[ name ] = data; |
1038 | | - } |
1039 | | - |
1040 | | - return typeof name === "string" ? thisCache[ name ] : thisCache; |
1041 | | - }, |
1042 | | - |
1043 | | - removeData: function( elem, name ) { |
1044 | | - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { |
1045 | | - return; |
1046 | | - } |
1047 | | - |
1048 | | - elem = elem == window ? |
1049 | | - windowData : |
1050 | | - elem; |
1051 | | - |
1052 | | - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; |
1053 | | - |
1054 | | - // If we want to remove a specific section of the element's data |
1055 | | - if ( name ) { |
1056 | | - if ( thisCache ) { |
1057 | | - // Remove the section of cache data |
1058 | | - delete thisCache[ name ]; |
1059 | | - |
1060 | | - // If we've removed all the data, remove the element's cache |
1061 | | - if ( jQuery.isEmptyObject(thisCache) ) { |
1062 | | - jQuery.removeData( elem ); |
1063 | | - } |
1064 | | - } |
1065 | | - |
1066 | | - // Otherwise, we want to remove all of the element's data |
1067 | | - } else { |
1068 | | - if ( jQuery.support.deleteExpando ) { |
1069 | | - delete elem[ jQuery.expando ]; |
1070 | | - |
1071 | | - } else if ( elem.removeAttribute ) { |
1072 | | - elem.removeAttribute( jQuery.expando ); |
1073 | | - } |
1074 | | - |
1075 | | - // Completely remove the data cache |
1076 | | - delete cache[ id ]; |
1077 | | - } |
1078 | | - } |
1079 | | -}); |
1080 | | - |
1081 | | -jQuery.fn.extend({ |
1082 | | - data: function( key, value ) { |
1083 | | - if ( typeof key === "undefined" && this.length ) { |
1084 | | - return jQuery.data( this[0] ); |
1085 | | - |
1086 | | - } else if ( typeof key === "object" ) { |
1087 | | - return this.each(function() { |
1088 | | - jQuery.data( this, key ); |
1089 | | - }); |
1090 | | - } |
1091 | | - |
1092 | | - var parts = key.split("."); |
1093 | | - parts[1] = parts[1] ? "." + parts[1] : ""; |
1094 | | - |
1095 | | - if ( value === undefined ) { |
1096 | | - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
1097 | | - |
1098 | | - if ( data === undefined && this.length ) { |
1099 | | - data = jQuery.data( this[0], key ); |
1100 | | - } |
1101 | | - return data === undefined && parts[1] ? |
1102 | | - this.data( parts[0] ) : |
1103 | | - data; |
1104 | | - } else { |
1105 | | - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { |
1106 | | - jQuery.data( this, key, value ); |
1107 | | - }); |
1108 | | - } |
1109 | | - }, |
1110 | | - |
1111 | | - removeData: function( key ) { |
1112 | | - return this.each(function() { |
1113 | | - jQuery.removeData( this, key ); |
1114 | | - }); |
1115 | | - } |
1116 | | -}); |
1117 | | -jQuery.extend({ |
1118 | | - queue: function( elem, type, data ) { |
1119 | | - if ( !elem ) { |
1120 | | - return; |
1121 | | - } |
1122 | | - |
1123 | | - type = (type || "fx") + "queue"; |
1124 | | - var q = jQuery.data( elem, type ); |
1125 | | - |
1126 | | - // Speed up dequeue by getting out quickly if this is just a lookup |
1127 | | - if ( !data ) { |
1128 | | - return q || []; |
1129 | | - } |
1130 | | - |
1131 | | - if ( !q || jQuery.isArray(data) ) { |
1132 | | - q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
1133 | | - |
1134 | | - } else { |
1135 | | - q.push( data ); |
1136 | | - } |
1137 | | - |
1138 | | - return q; |
1139 | | - }, |
1140 | | - |
1141 | | - dequeue: function( elem, type ) { |
1142 | | - type = type || "fx"; |
1143 | | - |
1144 | | - var queue = jQuery.queue( elem, type ), fn = queue.shift(); |
1145 | | - |
1146 | | - // If the fx queue is dequeued, always remove the progress sentinel |
1147 | | - if ( fn === "inprogress" ) { |
1148 | | - fn = queue.shift(); |
1149 | | - } |
1150 | | - |
1151 | | - if ( fn ) { |
1152 | | - // Add a progress sentinel to prevent the fx queue from being |
1153 | | - // automatically dequeued |
1154 | | - if ( type === "fx" ) { |
1155 | | - queue.unshift("inprogress"); |
1156 | | - } |
1157 | | - |
1158 | | - fn.call(elem, function() { |
1159 | | - jQuery.dequeue(elem, type); |
1160 | | - }); |
1161 | | - } |
1162 | | - } |
1163 | | -}); |
1164 | | - |
1165 | | -jQuery.fn.extend({ |
1166 | | - queue: function( type, data ) { |
1167 | | - if ( typeof type !== "string" ) { |
1168 | | - data = type; |
1169 | | - type = "fx"; |
1170 | | - } |
1171 | | - |
1172 | | - if ( data === undefined ) { |
1173 | | - return jQuery.queue( this[0], type ); |
1174 | | - } |
1175 | | - return this.each(function( i, elem ) { |
1176 | | - var queue = jQuery.queue( this, type, data ); |
1177 | | - |
1178 | | - if ( type === "fx" && queue[0] !== "inprogress" ) { |
1179 | | - jQuery.dequeue( this, type ); |
1180 | | - } |
1181 | | - }); |
1182 | | - }, |
1183 | | - dequeue: function( type ) { |
1184 | | - return this.each(function() { |
1185 | | - jQuery.dequeue( this, type ); |
1186 | | - }); |
1187 | | - }, |
1188 | | - |
1189 | | - // Based off of the plugin by Clint Helfers, with permission. |
1190 | | - // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
1191 | | - delay: function( time, type ) { |
1192 | | - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
1193 | | - type = type || "fx"; |
1194 | | - |
1195 | | - return this.queue( type, function() { |
1196 | | - var elem = this; |
1197 | | - setTimeout(function() { |
1198 | | - jQuery.dequeue( elem, type ); |
1199 | | - }, time ); |
1200 | | - }); |
1201 | | - }, |
1202 | | - |
1203 | | - clearQueue: function( type ) { |
1204 | | - return this.queue( type || "fx", [] ); |
1205 | | - } |
1206 | | -}); |
1207 | | -var rclass = /[\n\t]/g, |
1208 | | - rspace = /\s+/, |
1209 | | - rreturn = /\r/g, |
1210 | | - rspecialurl = /href|src|style/, |
1211 | | - rtype = /(button|input)/i, |
1212 | | - rfocusable = /(button|input|object|select|textarea)/i, |
1213 | | - rclickable = /^(a|area)$/i, |
1214 | | - rradiocheck = /radio|checkbox/; |
1215 | | - |
1216 | | -jQuery.fn.extend({ |
1217 | | - attr: function( name, value ) { |
1218 | | - return access( this, name, value, true, jQuery.attr ); |
1219 | | - }, |
1220 | | - |
1221 | | - removeAttr: function( name, fn ) { |
1222 | | - return this.each(function(){ |
1223 | | - jQuery.attr( this, name, "" ); |
1224 | | - if ( this.nodeType === 1 ) { |
1225 | | - this.removeAttribute( name ); |
1226 | | - } |
1227 | | - }); |
1228 | | - }, |
1229 | | - |
1230 | | - addClass: function( value ) { |
1231 | | - if ( jQuery.isFunction(value) ) { |
1232 | | - return this.each(function(i) { |
1233 | | - var self = jQuery(this); |
1234 | | - self.addClass( value.call(this, i, self.attr("class")) ); |
1235 | | - }); |
1236 | | - } |
1237 | | - |
1238 | | - if ( value && typeof value === "string" ) { |
1239 | | - var classNames = (value || "").split( rspace ); |
1240 | | - |
1241 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
1242 | | - var elem = this[i]; |
1243 | | - |
1244 | | - if ( elem.nodeType === 1 ) { |
1245 | | - if ( !elem.className ) { |
1246 | | - elem.className = value; |
1247 | | - |
1248 | | - } else { |
1249 | | - var className = " " + elem.className + " ", setClass = elem.className; |
1250 | | - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
1251 | | - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { |
1252 | | - setClass += " " + classNames[c]; |
1253 | | - } |
1254 | | - } |
1255 | | - elem.className = jQuery.trim( setClass ); |
1256 | | - } |
1257 | | - } |
1258 | | - } |
1259 | | - } |
1260 | | - |
1261 | | - return this; |
1262 | | - }, |
1263 | | - |
1264 | | - removeClass: function( value ) { |
1265 | | - if ( jQuery.isFunction(value) ) { |
1266 | | - return this.each(function(i) { |
1267 | | - var self = jQuery(this); |
1268 | | - self.removeClass( value.call(this, i, self.attr("class")) ); |
1269 | | - }); |
1270 | | - } |
1271 | | - |
1272 | | - if ( (value && typeof value === "string") || value === undefined ) { |
1273 | | - var classNames = (value || "").split(rspace); |
1274 | | - |
1275 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
1276 | | - var elem = this[i]; |
1277 | | - |
1278 | | - if ( elem.nodeType === 1 && elem.className ) { |
1279 | | - if ( value ) { |
1280 | | - var className = (" " + elem.className + " ").replace(rclass, " "); |
1281 | | - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
1282 | | - className = className.replace(" " + classNames[c] + " ", " "); |
1283 | | - } |
1284 | | - elem.className = jQuery.trim( className ); |
1285 | | - |
1286 | | - } else { |
1287 | | - elem.className = ""; |
1288 | | - } |
1289 | | - } |
1290 | | - } |
1291 | | - } |
1292 | | - |
1293 | | - return this; |
1294 | | - }, |
1295 | | - |
1296 | | - toggleClass: function( value, stateVal ) { |
1297 | | - var type = typeof value, isBool = typeof stateVal === "boolean"; |
1298 | | - |
1299 | | - if ( jQuery.isFunction( value ) ) { |
1300 | | - return this.each(function(i) { |
1301 | | - var self = jQuery(this); |
1302 | | - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); |
1303 | | - }); |
1304 | | - } |
1305 | | - |
1306 | | - return this.each(function() { |
1307 | | - if ( type === "string" ) { |
1308 | | - // toggle individual class names |
1309 | | - var className, i = 0, self = jQuery(this), |
1310 | | - state = stateVal, |
1311 | | - classNames = value.split( rspace ); |
1312 | | - |
1313 | | - while ( (className = classNames[ i++ ]) ) { |
1314 | | - // check each className given, space seperated list |
1315 | | - state = isBool ? state : !self.hasClass( className ); |
1316 | | - self[ state ? "addClass" : "removeClass" ]( className ); |
1317 | | - } |
1318 | | - |
1319 | | - } else if ( type === "undefined" || type === "boolean" ) { |
1320 | | - if ( this.className ) { |
1321 | | - // store className if set |
1322 | | - jQuery.data( this, "__className__", this.className ); |
1323 | | - } |
1324 | | - |
1325 | | - // toggle whole className |
1326 | | - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; |
1327 | | - } |
1328 | | - }); |
1329 | | - }, |
1330 | | - |
1331 | | - hasClass: function( selector ) { |
1332 | | - var className = " " + selector + " "; |
1333 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
1334 | | - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { |
1335 | | - return true; |
1336 | | - } |
1337 | | - } |
1338 | | - |
1339 | | - return false; |
1340 | | - }, |
1341 | | - |
1342 | | - val: function( value ) { |
1343 | | - if ( value === undefined ) { |
1344 | | - var elem = this[0]; |
1345 | | - |
1346 | | - if ( elem ) { |
1347 | | - if ( jQuery.nodeName( elem, "option" ) ) { |
1348 | | - return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
1349 | | - } |
1350 | | - |
1351 | | - // We need to handle select boxes special |
1352 | | - if ( jQuery.nodeName( elem, "select" ) ) { |
1353 | | - var index = elem.selectedIndex, |
1354 | | - values = [], |
1355 | | - options = elem.options, |
1356 | | - one = elem.type === "select-one"; |
1357 | | - |
1358 | | - // Nothing was selected |
1359 | | - if ( index < 0 ) { |
1360 | | - return null; |
1361 | | - } |
1362 | | - |
1363 | | - // Loop through all the selected options |
1364 | | - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
1365 | | - var option = options[ i ]; |
1366 | | - |
1367 | | - if ( option.selected ) { |
1368 | | - // Get the specifc value for the option |
1369 | | - value = jQuery(option).val(); |
1370 | | - |
1371 | | - // We don't need an array for one selects |
1372 | | - if ( one ) { |
1373 | | - return value; |
1374 | | - } |
1375 | | - |
1376 | | - // Multi-Selects return an array |
1377 | | - values.push( value ); |
1378 | | - } |
1379 | | - } |
1380 | | - |
1381 | | - return values; |
1382 | | - } |
1383 | | - |
1384 | | - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
1385 | | - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { |
1386 | | - return elem.getAttribute("value") === null ? "on" : elem.value; |
1387 | | - } |
1388 | | - |
1389 | | - |
1390 | | - // Everything else, we just grab the value |
1391 | | - return (elem.value || "").replace(rreturn, ""); |
1392 | | - |
1393 | | - } |
1394 | | - |
1395 | | - return undefined; |
1396 | | - } |
1397 | | - |
1398 | | - var isFunction = jQuery.isFunction(value); |
1399 | | - |
1400 | | - return this.each(function(i) { |
1401 | | - var self = jQuery(this), val = value; |
1402 | | - |
1403 | | - if ( this.nodeType !== 1 ) { |
1404 | | - return; |
1405 | | - } |
1406 | | - |
1407 | | - if ( isFunction ) { |
1408 | | - val = value.call(this, i, self.val()); |
1409 | | - } |
1410 | | - |
1411 | | - // Typecast each time if the value is a Function and the appended |
1412 | | - // value is therefore different each time. |
1413 | | - if ( typeof val === "number" ) { |
1414 | | - val += ""; |
1415 | | - } |
1416 | | - |
1417 | | - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { |
1418 | | - this.checked = jQuery.inArray( self.val(), val ) >= 0; |
1419 | | - |
1420 | | - } else if ( jQuery.nodeName( this, "select" ) ) { |
1421 | | - var values = jQuery.makeArray(val); |
1422 | | - |
1423 | | - jQuery( "option", this ).each(function() { |
1424 | | - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
1425 | | - }); |
1426 | | - |
1427 | | - if ( !values.length ) { |
1428 | | - this.selectedIndex = -1; |
1429 | | - } |
1430 | | - |
1431 | | - } else { |
1432 | | - this.value = val; |
1433 | | - } |
1434 | | - }); |
1435 | | - } |
1436 | | -}); |
1437 | | - |
1438 | | -jQuery.extend({ |
1439 | | - attrFn: { |
1440 | | - val: true, |
1441 | | - css: true, |
1442 | | - html: true, |
1443 | | - text: true, |
1444 | | - data: true, |
1445 | | - width: true, |
1446 | | - height: true, |
1447 | | - offset: true |
1448 | | - }, |
1449 | | - |
1450 | | - attr: function( elem, name, value, pass ) { |
1451 | | - // don't set attributes on text and comment nodes |
1452 | | - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
1453 | | - return undefined; |
1454 | | - } |
1455 | | - |
1456 | | - if ( pass && name in jQuery.attrFn ) { |
1457 | | - return jQuery(elem)[name](value); |
1458 | | - } |
1459 | | - |
1460 | | - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
1461 | | - // Whether we are setting (or getting) |
1462 | | - set = value !== undefined; |
1463 | | - |
1464 | | - // Try to normalize/fix the name |
1465 | | - name = notxml && jQuery.props[ name ] || name; |
1466 | | - |
1467 | | - // Only do all the following if this is a node (faster for style) |
1468 | | - if ( elem.nodeType === 1 ) { |
1469 | | - // These attributes require special treatment |
1470 | | - var special = rspecialurl.test( name ); |
1471 | | - |
1472 | | - // Safari mis-reports the default selected property of an option |
1473 | | - // Accessing the parent's selectedIndex property fixes it |
1474 | | - if ( name === "selected" && !jQuery.support.optSelected ) { |
1475 | | - var parent = elem.parentNode; |
1476 | | - if ( parent ) { |
1477 | | - parent.selectedIndex; |
1478 | | - |
1479 | | - // Make sure that it also works with optgroups, see #5701 |
1480 | | - if ( parent.parentNode ) { |
1481 | | - parent.parentNode.selectedIndex; |
1482 | | - } |
1483 | | - } |
1484 | | - } |
1485 | | - |
1486 | | - // If applicable, access the attribute via the DOM 0 way |
1487 | | - if ( name in elem && notxml && !special ) { |
1488 | | - if ( set ) { |
1489 | | - // We can't allow the type property to be changed (since it causes problems in IE) |
1490 | | - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { |
1491 | | - jQuery.error( "type property can't be changed" ); |
1492 | | - } |
1493 | | - |
1494 | | - elem[ name ] = value; |
1495 | | - } |
1496 | | - |
1497 | | - // browsers index elements by id/name on forms, give priority to attributes. |
1498 | | - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { |
1499 | | - return elem.getAttributeNode( name ).nodeValue; |
1500 | | - } |
1501 | | - |
1502 | | - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
1503 | | - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
1504 | | - if ( name === "tabIndex" ) { |
1505 | | - var attributeNode = elem.getAttributeNode( "tabIndex" ); |
1506 | | - |
1507 | | - return attributeNode && attributeNode.specified ? |
1508 | | - attributeNode.value : |
1509 | | - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
1510 | | - 0 : |
1511 | | - undefined; |
1512 | | - } |
1513 | | - |
1514 | | - return elem[ name ]; |
1515 | | - } |
1516 | | - |
1517 | | - if ( !jQuery.support.style && notxml && name === "style" ) { |
1518 | | - if ( set ) { |
1519 | | - elem.style.cssText = "" + value; |
1520 | | - } |
1521 | | - |
1522 | | - return elem.style.cssText; |
1523 | | - } |
1524 | | - |
1525 | | - if ( set ) { |
1526 | | - // convert the value to a string (all browsers do this but IE) see #1070 |
1527 | | - elem.setAttribute( name, "" + value ); |
1528 | | - } |
1529 | | - |
1530 | | - var attr = !jQuery.support.hrefNormalized && notxml && special ? |
1531 | | - // Some attributes require a special call on IE |
1532 | | - elem.getAttribute( name, 2 ) : |
1533 | | - elem.getAttribute( name ); |
1534 | | - |
1535 | | - // Non-existent attributes return null, we normalize to undefined |
1536 | | - return attr === null ? undefined : attr; |
1537 | | - } |
1538 | | - |
1539 | | - // elem is actually elem.style ... set the style |
1540 | | - // Using attr for specific style information is now deprecated. Use style instead. |
1541 | | - return jQuery.style( elem, name, value ); |
1542 | | - } |
1543 | | -}); |
1544 | | -var rnamespaces = /\.(.*)$/, |
1545 | | - fcleanup = function( nm ) { |
1546 | | - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { |
1547 | | - return "\\" + ch; |
1548 | | - }); |
1549 | | - }; |
1550 | | - |
1551 | | -/* |
1552 | | - * A number of helper functions used for managing events. |
1553 | | - * Many of the ideas behind this code originated from |
1554 | | - * Dean Edwards' addEvent library. |
1555 | | - */ |
1556 | | -jQuery.event = { |
1557 | | - |
1558 | | - // Bind an event to an element |
1559 | | - // Original by Dean Edwards |
1560 | | - add: function( elem, types, handler, data ) { |
1561 | | - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
1562 | | - return; |
1563 | | - } |
1564 | | - |
1565 | | - // For whatever reason, IE has trouble passing the window object |
1566 | | - // around, causing it to be cloned in the process |
1567 | | - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { |
1568 | | - elem = window; |
1569 | | - } |
1570 | | - |
1571 | | - var handleObjIn, handleObj; |
1572 | | - |
1573 | | - if ( handler.handler ) { |
1574 | | - handleObjIn = handler; |
1575 | | - handler = handleObjIn.handler; |
1576 | | - } |
1577 | | - |
1578 | | - // Make sure that the function being executed has a unique ID |
1579 | | - if ( !handler.guid ) { |
1580 | | - handler.guid = jQuery.guid++; |
1581 | | - } |
1582 | | - |
1583 | | - // Init the element's event structure |
1584 | | - var elemData = jQuery.data( elem ); |
1585 | | - |
1586 | | - // If no elemData is found then we must be trying to bind to one of the |
1587 | | - // banned noData elements |
1588 | | - if ( !elemData ) { |
1589 | | - return; |
1590 | | - } |
1591 | | - |
1592 | | - var events = elemData.events = elemData.events || {}, |
1593 | | - eventHandle = elemData.handle, eventHandle; |
1594 | | - |
1595 | | - if ( !eventHandle ) { |
1596 | | - elemData.handle = eventHandle = function() { |
1597 | | - // Handle the second event of a trigger and when |
1598 | | - // an event is called after a page has unloaded |
1599 | | - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
1600 | | - jQuery.event.handle.apply( eventHandle.elem, arguments ) : |
1601 | | - undefined; |
1602 | | - }; |
1603 | | - } |
1604 | | - |
1605 | | - // Add elem as a property of the handle function |
1606 | | - // This is to prevent a memory leak with non-native events in IE. |
1607 | | - eventHandle.elem = elem; |
1608 | | - |
1609 | | - // Handle multiple events separated by a space |
1610 | | - // jQuery(...).bind("mouseover mouseout", fn); |
1611 | | - types = types.split(" "); |
1612 | | - |
1613 | | - var type, i = 0, namespaces; |
1614 | | - |
1615 | | - while ( (type = types[ i++ ]) ) { |
1616 | | - handleObj = handleObjIn ? |
1617 | | - jQuery.extend({}, handleObjIn) : |
1618 | | - { handler: handler, data: data }; |
1619 | | - |
1620 | | - // Namespaced event handlers |
1621 | | - if ( type.indexOf(".") > -1 ) { |
1622 | | - namespaces = type.split("."); |
1623 | | - type = namespaces.shift(); |
1624 | | - handleObj.namespace = namespaces.slice(0).sort().join("."); |
1625 | | - |
1626 | | - } else { |
1627 | | - namespaces = []; |
1628 | | - handleObj.namespace = ""; |
1629 | | - } |
1630 | | - |
1631 | | - handleObj.type = type; |
1632 | | - handleObj.guid = handler.guid; |
1633 | | - |
1634 | | - // Get the current list of functions bound to this event |
1635 | | - var handlers = events[ type ], |
1636 | | - special = jQuery.event.special[ type ] || {}; |
1637 | | - |
1638 | | - // Init the event handler queue |
1639 | | - if ( !handlers ) { |
1640 | | - handlers = events[ type ] = []; |
1641 | | - |
1642 | | - // Check for a special event handler |
1643 | | - // Only use addEventListener/attachEvent if the special |
1644 | | - // events handler returns false |
1645 | | - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
1646 | | - // Bind the global event handler to the element |
1647 | | - if ( elem.addEventListener ) { |
1648 | | - elem.addEventListener( type, eventHandle, false ); |
1649 | | - |
1650 | | - } else if ( elem.attachEvent ) { |
1651 | | - elem.attachEvent( "on" + type, eventHandle ); |
1652 | | - } |
1653 | | - } |
1654 | | - } |
1655 | | - |
1656 | | - if ( special.add ) { |
1657 | | - special.add.call( elem, handleObj ); |
1658 | | - |
1659 | | - if ( !handleObj.handler.guid ) { |
1660 | | - handleObj.handler.guid = handler.guid; |
1661 | | - } |
1662 | | - } |
1663 | | - |
1664 | | - // Add the function to the element's handler list |
1665 | | - handlers.push( handleObj ); |
1666 | | - |
1667 | | - // Keep track of which events have been used, for global triggering |
1668 | | - jQuery.event.global[ type ] = true; |
1669 | | - } |
1670 | | - |
1671 | | - // Nullify elem to prevent memory leaks in IE |
1672 | | - elem = null; |
1673 | | - }, |
1674 | | - |
1675 | | - global: {}, |
1676 | | - |
1677 | | - // Detach an event or set of events from an element |
1678 | | - remove: function( elem, types, handler, pos ) { |
1679 | | - // don't do events on text and comment nodes |
1680 | | - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
1681 | | - return; |
1682 | | - } |
1683 | | - |
1684 | | - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, |
1685 | | - elemData = jQuery.data( elem ), |
1686 | | - events = elemData && elemData.events; |
1687 | | - |
1688 | | - if ( !elemData || !events ) { |
1689 | | - return; |
1690 | | - } |
1691 | | - |
1692 | | - // types is actually an event object here |
1693 | | - if ( types && types.type ) { |
1694 | | - handler = types.handler; |
1695 | | - types = types.type; |
1696 | | - } |
1697 | | - |
1698 | | - // Unbind all events for the element |
1699 | | - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { |
1700 | | - types = types || ""; |
1701 | | - |
1702 | | - for ( type in events ) { |
1703 | | - jQuery.event.remove( elem, type + types ); |
1704 | | - } |
1705 | | - |
1706 | | - return; |
1707 | | - } |
1708 | | - |
1709 | | - // Handle multiple events separated by a space |
1710 | | - // jQuery(...).unbind("mouseover mouseout", fn); |
1711 | | - types = types.split(" "); |
1712 | | - |
1713 | | - while ( (type = types[ i++ ]) ) { |
1714 | | - origType = type; |
1715 | | - handleObj = null; |
1716 | | - all = type.indexOf(".") < 0; |
1717 | | - namespaces = []; |
1718 | | - |
1719 | | - if ( !all ) { |
1720 | | - // Namespaced event handlers |
1721 | | - namespaces = type.split("."); |
1722 | | - type = namespaces.shift(); |
1723 | | - |
1724 | | - namespace = new RegExp("(^|\\.)" + |
1725 | | - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") |
1726 | | - } |
1727 | | - |
1728 | | - eventType = events[ type ]; |
1729 | | - |
1730 | | - if ( !eventType ) { |
1731 | | - continue; |
1732 | | - } |
1733 | | - |
1734 | | - if ( !handler ) { |
1735 | | - for ( var j = 0; j < eventType.length; j++ ) { |
1736 | | - handleObj = eventType[ j ]; |
1737 | | - |
1738 | | - if ( all || namespace.test( handleObj.namespace ) ) { |
1739 | | - jQuery.event.remove( elem, origType, handleObj.handler, j ); |
1740 | | - eventType.splice( j--, 1 ); |
1741 | | - } |
1742 | | - } |
1743 | | - |
1744 | | - continue; |
1745 | | - } |
1746 | | - |
1747 | | - special = jQuery.event.special[ type ] || {}; |
1748 | | - |
1749 | | - for ( var j = pos || 0; j < eventType.length; j++ ) { |
1750 | | - handleObj = eventType[ j ]; |
1751 | | - |
1752 | | - if ( handler.guid === handleObj.guid ) { |
1753 | | - // remove the given handler for the given type |
1754 | | - if ( all || namespace.test( handleObj.namespace ) ) { |
1755 | | - if ( pos == null ) { |
1756 | | - eventType.splice( j--, 1 ); |
1757 | | - } |
1758 | | - |
1759 | | - if ( special.remove ) { |
1760 | | - special.remove.call( elem, handleObj ); |
1761 | | - } |
1762 | | - } |
1763 | | - |
1764 | | - if ( pos != null ) { |
1765 | | - break; |
1766 | | - } |
1767 | | - } |
1768 | | - } |
1769 | | - |
1770 | | - // remove generic event handler if no more handlers exist |
1771 | | - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { |
1772 | | - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { |
1773 | | - removeEvent( elem, type, elemData.handle ); |
1774 | | - } |
1775 | | - |
1776 | | - ret = null; |
1777 | | - delete events[ type ]; |
1778 | | - } |
1779 | | - } |
1780 | | - |
1781 | | - // Remove the expando if it's no longer used |
1782 | | - if ( jQuery.isEmptyObject( events ) ) { |
1783 | | - var handle = elemData.handle; |
1784 | | - if ( handle ) { |
1785 | | - handle.elem = null; |
1786 | | - } |
1787 | | - |
1788 | | - delete elemData.events; |
1789 | | - delete elemData.handle; |
1790 | | - |
1791 | | - if ( jQuery.isEmptyObject( elemData ) ) { |
1792 | | - jQuery.removeData( elem ); |
1793 | | - } |
1794 | | - } |
1795 | | - }, |
1796 | | - |
1797 | | - // bubbling is internal |
1798 | | - trigger: function( event, data, elem /*, bubbling */ ) { |
1799 | | - // Event object or event type |
1800 | | - var type = event.type || event, |
1801 | | - bubbling = arguments[3]; |
1802 | | - |
1803 | | - if ( !bubbling ) { |
1804 | | - event = typeof event === "object" ? |
1805 | | - // jQuery.Event object |
1806 | | - event[expando] ? event : |
1807 | | - // Object literal |
1808 | | - jQuery.extend( jQuery.Event(type), event ) : |
1809 | | - // Just the event type (string) |
1810 | | - jQuery.Event(type); |
1811 | | - |
1812 | | - if ( type.indexOf("!") >= 0 ) { |
1813 | | - event.type = type = type.slice(0, -1); |
1814 | | - event.exclusive = true; |
1815 | | - } |
1816 | | - |
1817 | | - // Handle a global trigger |
1818 | | - if ( !elem ) { |
1819 | | - // Don't bubble custom events when global (to avoid too much overhead) |
1820 | | - event.stopPropagation(); |
1821 | | - |
1822 | | - // Only trigger if we've ever bound an event for it |
1823 | | - if ( jQuery.event.global[ type ] ) { |
1824 | | - jQuery.each( jQuery.cache, function() { |
1825 | | - if ( this.events && this.events[type] ) { |
1826 | | - jQuery.event.trigger( event, data, this.handle.elem ); |
1827 | | - } |
1828 | | - }); |
1829 | | - } |
1830 | | - } |
1831 | | - |
1832 | | - // Handle triggering a single element |
1833 | | - |
1834 | | - // don't do events on text and comment nodes |
1835 | | - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
1836 | | - return undefined; |
1837 | | - } |
1838 | | - |
1839 | | - // Clean up in case it is reused |
1840 | | - event.result = undefined; |
1841 | | - event.target = elem; |
1842 | | - |
1843 | | - // Clone the incoming data, if any |
1844 | | - data = jQuery.makeArray( data ); |
1845 | | - data.unshift( event ); |
1846 | | - } |
1847 | | - |
1848 | | - event.currentTarget = elem; |
1849 | | - |
1850 | | - // Trigger the event, it is assumed that "handle" is a function |
1851 | | - var handle = jQuery.data( elem, "handle" ); |
1852 | | - if ( handle ) { |
1853 | | - handle.apply( elem, data ); |
1854 | | - } |
1855 | | - |
1856 | | - var parent = elem.parentNode || elem.ownerDocument; |
1857 | | - |
1858 | | - // Trigger an inline bound script |
1859 | | - try { |
1860 | | - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { |
1861 | | - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { |
1862 | | - event.result = false; |
1863 | | - } |
1864 | | - } |
1865 | | - |
1866 | | - // prevent IE from throwing an error for some elements with some event types, see #3533 |
1867 | | - } catch (e) {} |
1868 | | - |
1869 | | - if ( !event.isPropagationStopped() && parent ) { |
1870 | | - jQuery.event.trigger( event, data, parent, true ); |
1871 | | - |
1872 | | - } else if ( !event.isDefaultPrevented() ) { |
1873 | | - var target = event.target, old, |
1874 | | - isClick = jQuery.nodeName(target, "a") && type === "click", |
1875 | | - special = jQuery.event.special[ type ] || {}; |
1876 | | - |
1877 | | - if ( (!special._default || special._default.call( elem, event ) === false) && |
1878 | | - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { |
1879 | | - |
1880 | | - try { |
1881 | | - if ( target[ type ] ) { |
1882 | | - // Make sure that we don't accidentally re-trigger the onFOO events |
1883 | | - old = target[ "on" + type ]; |
1884 | | - |
1885 | | - if ( old ) { |
1886 | | - target[ "on" + type ] = null; |
1887 | | - } |
1888 | | - |
1889 | | - jQuery.event.triggered = true; |
1890 | | - target[ type ](); |
1891 | | - } |
1892 | | - |
1893 | | - // prevent IE from throwing an error for some elements with some event types, see #3533 |
1894 | | - } catch (e) {} |
1895 | | - |
1896 | | - if ( old ) { |
1897 | | - target[ "on" + type ] = old; |
1898 | | - } |
1899 | | - |
1900 | | - jQuery.event.triggered = false; |
1901 | | - } |
1902 | | - } |
1903 | | - }, |
1904 | | - |
1905 | | - handle: function( event ) { |
1906 | | - var all, handlers, namespaces, namespace, events; |
1907 | | - |
1908 | | - event = arguments[0] = jQuery.event.fix( event || window.event ); |
1909 | | - event.currentTarget = this; |
1910 | | - |
1911 | | - // Namespaced event handlers |
1912 | | - all = event.type.indexOf(".") < 0 && !event.exclusive; |
1913 | | - |
1914 | | - if ( !all ) { |
1915 | | - namespaces = event.type.split("."); |
1916 | | - event.type = namespaces.shift(); |
1917 | | - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); |
1918 | | - } |
1919 | | - |
1920 | | - var events = jQuery.data(this, "events"), handlers = events[ event.type ]; |
1921 | | - |
1922 | | - if ( events && handlers ) { |
1923 | | - // Clone the handlers to prevent manipulation |
1924 | | - handlers = handlers.slice(0); |
1925 | | - |
1926 | | - for ( var j = 0, l = handlers.length; j < l; j++ ) { |
1927 | | - var handleObj = handlers[ j ]; |
1928 | | - |
1929 | | - // Filter the functions by class |
1930 | | - if ( all || namespace.test( handleObj.namespace ) ) { |
1931 | | - // Pass in a reference to the handler function itself |
1932 | | - // So that we can later remove it |
1933 | | - event.handler = handleObj.handler; |
1934 | | - event.data = handleObj.data; |
1935 | | - event.handleObj = handleObj; |
1936 | | - |
1937 | | - var ret = handleObj.handler.apply( this, arguments ); |
1938 | | - |
1939 | | - if ( ret !== undefined ) { |
1940 | | - event.result = ret; |
1941 | | - if ( ret === false ) { |
1942 | | - event.preventDefault(); |
1943 | | - event.stopPropagation(); |
1944 | | - } |
1945 | | - } |
1946 | | - |
1947 | | - if ( event.isImmediatePropagationStopped() ) { |
1948 | | - break; |
1949 | | - } |
1950 | | - } |
1951 | | - } |
1952 | | - } |
1953 | | - |
1954 | | - return event.result; |
1955 | | - }, |
1956 | | - |
1957 | | - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
1958 | | - |
1959 | | - fix: function( event ) { |
1960 | | - if ( event[ expando ] ) { |
1961 | | - return event; |
1962 | | - } |
1963 | | - |
1964 | | - // store a copy of the original event object |
1965 | | - // and "clone" to set read-only properties |
1966 | | - var originalEvent = event; |
1967 | | - event = jQuery.Event( originalEvent ); |
1968 | | - |
1969 | | - for ( var i = this.props.length, prop; i; ) { |
1970 | | - prop = this.props[ --i ]; |
1971 | | - event[ prop ] = originalEvent[ prop ]; |
1972 | | - } |
1973 | | - |
1974 | | - // Fix target property, if necessary |
1975 | | - if ( !event.target ) { |
1976 | | - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
1977 | | - } |
1978 | | - |
1979 | | - // check if target is a textnode (safari) |
1980 | | - if ( event.target.nodeType === 3 ) { |
1981 | | - event.target = event.target.parentNode; |
1982 | | - } |
1983 | | - |
1984 | | - // Add relatedTarget, if necessary |
1985 | | - if ( !event.relatedTarget && event.fromElement ) { |
1986 | | - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
1987 | | - } |
1988 | | - |
1989 | | - // Calculate pageX/Y if missing and clientX/Y available |
1990 | | - if ( event.pageX == null && event.clientX != null ) { |
1991 | | - var doc = document.documentElement, body = document.body; |
1992 | | - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
1993 | | - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
1994 | | - } |
1995 | | - |
1996 | | - // Add which for key events |
1997 | | - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { |
1998 | | - event.which = event.charCode || event.keyCode; |
1999 | | - } |
2000 | | - |
2001 | | - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
2002 | | - if ( !event.metaKey && event.ctrlKey ) { |
2003 | | - event.metaKey = event.ctrlKey; |
2004 | | - } |
2005 | | - |
2006 | | - // Add which for click: 1 === left; 2 === middle; 3 === right |
2007 | | - // Note: button is not normalized, so don't use it |
2008 | | - if ( !event.which && event.button !== undefined ) { |
2009 | | - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
2010 | | - } |
2011 | | - |
2012 | | - return event; |
2013 | | - }, |
2014 | | - |
2015 | | - // Deprecated, use jQuery.guid instead |
2016 | | - guid: 1E8, |
2017 | | - |
2018 | | - // Deprecated, use jQuery.proxy instead |
2019 | | - proxy: jQuery.proxy, |
2020 | | - |
2021 | | - special: { |
2022 | | - ready: { |
2023 | | - // Make sure the ready event is setup |
2024 | | - setup: jQuery.bindReady, |
2025 | | - teardown: jQuery.noop |
2026 | | - }, |
2027 | | - |
2028 | | - live: { |
2029 | | - add: function( handleObj ) { |
2030 | | - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); |
2031 | | - }, |
2032 | | - |
2033 | | - remove: function( handleObj ) { |
2034 | | - var remove = true, |
2035 | | - type = handleObj.origType.replace(rnamespaces, ""); |
2036 | | - |
2037 | | - jQuery.each( jQuery.data(this, "events").live || [], function() { |
2038 | | - if ( type === this.origType.replace(rnamespaces, "") ) { |
2039 | | - remove = false; |
2040 | | - return false; |
2041 | | - } |
2042 | | - }); |
2043 | | - |
2044 | | - if ( remove ) { |
2045 | | - jQuery.event.remove( this, handleObj.origType, liveHandler ); |
2046 | | - } |
2047 | | - } |
2048 | | - |
2049 | | - }, |
2050 | | - |
2051 | | - beforeunload: { |
2052 | | - setup: function( data, namespaces, eventHandle ) { |
2053 | | - // We only want to do this special case on windows |
2054 | | - if ( this.setInterval ) { |
2055 | | - this.onbeforeunload = eventHandle; |
2056 | | - } |
2057 | | - |
2058 | | - return false; |
2059 | | - }, |
2060 | | - teardown: function( namespaces, eventHandle ) { |
2061 | | - if ( this.onbeforeunload === eventHandle ) { |
2062 | | - this.onbeforeunload = null; |
2063 | | - } |
2064 | | - } |
2065 | | - } |
2066 | | - } |
2067 | | -}; |
2068 | | - |
2069 | | -var removeEvent = document.removeEventListener ? |
2070 | | - function( elem, type, handle ) { |
2071 | | - elem.removeEventListener( type, handle, false ); |
2072 | | - } : |
2073 | | - function( elem, type, handle ) { |
2074 | | - elem.detachEvent( "on" + type, handle ); |
2075 | | - }; |
2076 | | - |
2077 | | -jQuery.Event = function( src ) { |
2078 | | - // Allow instantiation without the 'new' keyword |
2079 | | - if ( !this.preventDefault ) { |
2080 | | - return new jQuery.Event( src ); |
2081 | | - } |
2082 | | - |
2083 | | - // Event object |
2084 | | - if ( src && src.type ) { |
2085 | | - this.originalEvent = src; |
2086 | | - this.type = src.type; |
2087 | | - // Event type |
2088 | | - } else { |
2089 | | - this.type = src; |
2090 | | - } |
2091 | | - |
2092 | | - // timeStamp is buggy for some events on Firefox(#3843) |
2093 | | - // So we won't rely on the native value |
2094 | | - this.timeStamp = now(); |
2095 | | - |
2096 | | - // Mark it as fixed |
2097 | | - this[ expando ] = true; |
2098 | | -}; |
2099 | | - |
2100 | | -function returnFalse() { |
2101 | | - return false; |
2102 | | -} |
2103 | | -function returnTrue() { |
2104 | | - return true; |
2105 | | -} |
2106 | | - |
2107 | | -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
2108 | | -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
2109 | | -jQuery.Event.prototype = { |
2110 | | - preventDefault: function() { |
2111 | | - this.isDefaultPrevented = returnTrue; |
2112 | | - |
2113 | | - var e = this.originalEvent; |
2114 | | - if ( !e ) { |
2115 | | - return; |
2116 | | - } |
2117 | | - |
2118 | | - // if preventDefault exists run it on the original event |
2119 | | - if ( e.preventDefault ) { |
2120 | | - e.preventDefault(); |
2121 | | - } |
2122 | | - // otherwise set the returnValue property of the original event to false (IE) |
2123 | | - e.returnValue = false; |
2124 | | - }, |
2125 | | - stopPropagation: function() { |
2126 | | - this.isPropagationStopped = returnTrue; |
2127 | | - |
2128 | | - var e = this.originalEvent; |
2129 | | - if ( !e ) { |
2130 | | - return; |
2131 | | - } |
2132 | | - // if stopPropagation exists run it on the original event |
2133 | | - if ( e.stopPropagation ) { |
2134 | | - e.stopPropagation(); |
2135 | | - } |
2136 | | - // otherwise set the cancelBubble property of the original event to true (IE) |
2137 | | - e.cancelBubble = true; |
2138 | | - }, |
2139 | | - stopImmediatePropagation: function() { |
2140 | | - this.isImmediatePropagationStopped = returnTrue; |
2141 | | - this.stopPropagation(); |
2142 | | - }, |
2143 | | - isDefaultPrevented: returnFalse, |
2144 | | - isPropagationStopped: returnFalse, |
2145 | | - isImmediatePropagationStopped: returnFalse |
2146 | | -}; |
2147 | | - |
2148 | | -// Checks if an event happened on an element within another element |
2149 | | -// Used in jQuery.event.special.mouseenter and mouseleave handlers |
2150 | | -var withinElement = function( event ) { |
2151 | | - // Check if mouse(over|out) are still within the same parent element |
2152 | | - var parent = event.relatedTarget; |
2153 | | - |
2154 | | - // Firefox sometimes assigns relatedTarget a XUL element |
2155 | | - // which we cannot access the parentNode property of |
2156 | | - try { |
2157 | | - // Traverse up the tree |
2158 | | - while ( parent && parent !== this ) { |
2159 | | - parent = parent.parentNode; |
2160 | | - } |
2161 | | - |
2162 | | - if ( parent !== this ) { |
2163 | | - // set the correct event type |
2164 | | - event.type = event.data; |
2165 | | - |
2166 | | - // handle event if we actually just moused on to a non sub-element |
2167 | | - jQuery.event.handle.apply( this, arguments ); |
2168 | | - } |
2169 | | - |
2170 | | - // assuming we've left the element since we most likely mousedover a xul element |
2171 | | - } catch(e) { } |
2172 | | -}, |
2173 | | - |
2174 | | -// In case of event delegation, we only need to rename the event.type, |
2175 | | -// liveHandler will take care of the rest. |
2176 | | -delegate = function( event ) { |
2177 | | - event.type = event.data; |
2178 | | - jQuery.event.handle.apply( this, arguments ); |
2179 | | -}; |
2180 | | - |
2181 | | -// Create mouseenter and mouseleave events |
2182 | | -jQuery.each({ |
2183 | | - mouseenter: "mouseover", |
2184 | | - mouseleave: "mouseout" |
2185 | | -}, function( orig, fix ) { |
2186 | | - jQuery.event.special[ orig ] = { |
2187 | | - setup: function( data ) { |
2188 | | - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); |
2189 | | - }, |
2190 | | - teardown: function( data ) { |
2191 | | - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); |
2192 | | - } |
2193 | | - }; |
2194 | | -}); |
2195 | | - |
2196 | | -// submit delegation |
2197 | | -if ( !jQuery.support.submitBubbles ) { |
2198 | | - |
2199 | | - jQuery.event.special.submit = { |
2200 | | - setup: function( data, namespaces ) { |
2201 | | - if ( this.nodeName.toLowerCase() !== "form" ) { |
2202 | | - jQuery.event.add(this, "click.specialSubmit", function( e ) { |
2203 | | - var elem = e.target, type = elem.type; |
2204 | | - |
2205 | | - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
2206 | | - return trigger( "submit", this, arguments ); |
2207 | | - } |
2208 | | - }); |
2209 | | - |
2210 | | - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
2211 | | - var elem = e.target, type = elem.type; |
2212 | | - |
2213 | | - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
2214 | | - return trigger( "submit", this, arguments ); |
2215 | | - } |
2216 | | - }); |
2217 | | - |
2218 | | - } else { |
2219 | | - return false; |
2220 | | - } |
2221 | | - }, |
2222 | | - |
2223 | | - teardown: function( namespaces ) { |
2224 | | - jQuery.event.remove( this, ".specialSubmit" ); |
2225 | | - } |
2226 | | - }; |
2227 | | - |
2228 | | -} |
2229 | | - |
2230 | | -// change delegation, happens here so we have bind. |
2231 | | -if ( !jQuery.support.changeBubbles ) { |
2232 | | - |
2233 | | - var formElems = /textarea|input|select/i, |
2234 | | - |
2235 | | - changeFilters, |
2236 | | - |
2237 | | - getVal = function( elem ) { |
2238 | | - var type = elem.type, val = elem.value; |
2239 | | - |
2240 | | - if ( type === "radio" || type === "checkbox" ) { |
2241 | | - val = elem.checked; |
2242 | | - |
2243 | | - } else if ( type === "select-multiple" ) { |
2244 | | - val = elem.selectedIndex > -1 ? |
2245 | | - jQuery.map( elem.options, function( elem ) { |
2246 | | - return elem.selected; |
2247 | | - }).join("-") : |
2248 | | - ""; |
2249 | | - |
2250 | | - } else if ( elem.nodeName.toLowerCase() === "select" ) { |
2251 | | - val = elem.selectedIndex; |
2252 | | - } |
2253 | | - |
2254 | | - return val; |
2255 | | - }, |
2256 | | - |
2257 | | - testChange = function testChange( e ) { |
2258 | | - var elem = e.target, data, val; |
2259 | | - |
2260 | | - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { |
2261 | | - return; |
2262 | | - } |
2263 | | - |
2264 | | - data = jQuery.data( elem, "_change_data" ); |
2265 | | - val = getVal(elem); |
2266 | | - |
2267 | | - // the current data will be also retrieved by beforeactivate |
2268 | | - if ( e.type !== "focusout" || elem.type !== "radio" ) { |
2269 | | - jQuery.data( elem, "_change_data", val ); |
2270 | | - } |
2271 | | - |
2272 | | - if ( data === undefined || val === data ) { |
2273 | | - return; |
2274 | | - } |
2275 | | - |
2276 | | - if ( data != null || val ) { |
2277 | | - e.type = "change"; |
2278 | | - return jQuery.event.trigger( e, arguments[1], elem ); |
2279 | | - } |
2280 | | - }; |
2281 | | - |
2282 | | - jQuery.event.special.change = { |
2283 | | - filters: { |
2284 | | - focusout: testChange, |
2285 | | - |
2286 | | - click: function( e ) { |
2287 | | - var elem = e.target, type = elem.type; |
2288 | | - |
2289 | | - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { |
2290 | | - return testChange.call( this, e ); |
2291 | | - } |
2292 | | - }, |
2293 | | - |
2294 | | - // Change has to be called before submit |
2295 | | - // Keydown will be called before keypress, which is used in submit-event delegation |
2296 | | - keydown: function( e ) { |
2297 | | - var elem = e.target, type = elem.type; |
2298 | | - |
2299 | | - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || |
2300 | | - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || |
2301 | | - type === "select-multiple" ) { |
2302 | | - return testChange.call( this, e ); |
2303 | | - } |
2304 | | - }, |
2305 | | - |
2306 | | - // Beforeactivate happens also before the previous element is blurred |
2307 | | - // with this event you can't trigger a change event, but you can store |
2308 | | - // information/focus[in] is not needed anymore |
2309 | | - beforeactivate: function( e ) { |
2310 | | - var elem = e.target; |
2311 | | - jQuery.data( elem, "_change_data", getVal(elem) ); |
2312 | | - } |
2313 | | - }, |
2314 | | - |
2315 | | - setup: function( data, namespaces ) { |
2316 | | - if ( this.type === "file" ) { |
2317 | | - return false; |
2318 | | - } |
2319 | | - |
2320 | | - for ( var type in changeFilters ) { |
2321 | | - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); |
2322 | | - } |
2323 | | - |
2324 | | - return formElems.test( this.nodeName ); |
2325 | | - }, |
2326 | | - |
2327 | | - teardown: function( namespaces ) { |
2328 | | - jQuery.event.remove( this, ".specialChange" ); |
2329 | | - |
2330 | | - return formElems.test( this.nodeName ); |
2331 | | - } |
2332 | | - }; |
2333 | | - |
2334 | | - changeFilters = jQuery.event.special.change.filters; |
2335 | | -} |
2336 | | - |
2337 | | -function trigger( type, elem, args ) { |
2338 | | - args[0].type = type; |
2339 | | - return jQuery.event.handle.apply( elem, args ); |
2340 | | -} |
2341 | | - |
2342 | | -// Create "bubbling" focus and blur events |
2343 | | -if ( document.addEventListener ) { |
2344 | | - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
2345 | | - jQuery.event.special[ fix ] = { |
2346 | | - setup: function() { |
2347 | | - this.addEventListener( orig, handler, true ); |
2348 | | - }, |
2349 | | - teardown: function() { |
2350 | | - this.removeEventListener( orig, handler, true ); |
2351 | | - } |
2352 | | - }; |
2353 | | - |
2354 | | - function handler( e ) { |
2355 | | - e = jQuery.event.fix( e ); |
2356 | | - e.type = fix; |
2357 | | - return jQuery.event.handle.call( this, e ); |
2358 | | - } |
2359 | | - }); |
2360 | | -} |
2361 | | - |
2362 | | -jQuery.each(["bind", "one"], function( i, name ) { |
2363 | | - jQuery.fn[ name ] = function( type, data, fn ) { |
2364 | | - // Handle object literals |
2365 | | - if ( typeof type === "object" ) { |
2366 | | - for ( var key in type ) { |
2367 | | - this[ name ](key, data, type[key], fn); |
2368 | | - } |
2369 | | - return this; |
2370 | | - } |
2371 | | - |
2372 | | - if ( jQuery.isFunction( data ) ) { |
2373 | | - fn = data; |
2374 | | - data = undefined; |
2375 | | - } |
2376 | | - |
2377 | | - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { |
2378 | | - jQuery( this ).unbind( event, handler ); |
2379 | | - return fn.apply( this, arguments ); |
2380 | | - }) : fn; |
2381 | | - |
2382 | | - if ( type === "unload" && name !== "one" ) { |
2383 | | - this.one( type, data, fn ); |
2384 | | - |
2385 | | - } else { |
2386 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
2387 | | - jQuery.event.add( this[i], type, handler, data ); |
2388 | | - } |
2389 | | - } |
2390 | | - |
2391 | | - return this; |
2392 | | - }; |
2393 | | -}); |
2394 | | - |
2395 | | -jQuery.fn.extend({ |
2396 | | - unbind: function( type, fn ) { |
2397 | | - // Handle object literals |
2398 | | - if ( typeof type === "object" && !type.preventDefault ) { |
2399 | | - for ( var key in type ) { |
2400 | | - this.unbind(key, type[key]); |
2401 | | - } |
2402 | | - |
2403 | | - } else { |
2404 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
2405 | | - jQuery.event.remove( this[i], type, fn ); |
2406 | | - } |
2407 | | - } |
2408 | | - |
2409 | | - return this; |
2410 | | - }, |
2411 | | - |
2412 | | - delegate: function( selector, types, data, fn ) { |
2413 | | - return this.live( types, data, fn, selector ); |
2414 | | - }, |
2415 | | - |
2416 | | - undelegate: function( selector, types, fn ) { |
2417 | | - if ( arguments.length === 0 ) { |
2418 | | - return this.unbind( "live" ); |
2419 | | - |
2420 | | - } else { |
2421 | | - return this.die( types, null, fn, selector ); |
2422 | | - } |
2423 | | - }, |
2424 | | - |
2425 | | - trigger: function( type, data ) { |
2426 | | - return this.each(function() { |
2427 | | - jQuery.event.trigger( type, data, this ); |
2428 | | - }); |
2429 | | - }, |
2430 | | - |
2431 | | - triggerHandler: function( type, data ) { |
2432 | | - if ( this[0] ) { |
2433 | | - var event = jQuery.Event( type ); |
2434 | | - event.preventDefault(); |
2435 | | - event.stopPropagation(); |
2436 | | - jQuery.event.trigger( event, data, this[0] ); |
2437 | | - return event.result; |
2438 | | - } |
2439 | | - }, |
2440 | | - |
2441 | | - toggle: function( fn ) { |
2442 | | - // Save reference to arguments for access in closure |
2443 | | - var args = arguments, i = 1; |
2444 | | - |
2445 | | - // link all the functions, so any of them can unbind this click handler |
2446 | | - while ( i < args.length ) { |
2447 | | - jQuery.proxy( fn, args[ i++ ] ); |
2448 | | - } |
2449 | | - |
2450 | | - return this.click( jQuery.proxy( fn, function( event ) { |
2451 | | - // Figure out which function to execute |
2452 | | - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
2453 | | - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
2454 | | - |
2455 | | - // Make sure that clicks stop |
2456 | | - event.preventDefault(); |
2457 | | - |
2458 | | - // and execute the function |
2459 | | - return args[ lastToggle ].apply( this, arguments ) || false; |
2460 | | - })); |
2461 | | - }, |
2462 | | - |
2463 | | - hover: function( fnOver, fnOut ) { |
2464 | | - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
2465 | | - } |
2466 | | -}); |
2467 | | - |
2468 | | -var liveMap = { |
2469 | | - focus: "focusin", |
2470 | | - blur: "focusout", |
2471 | | - mouseenter: "mouseover", |
2472 | | - mouseleave: "mouseout" |
2473 | | -}; |
2474 | | - |
2475 | | -jQuery.each(["live", "die"], function( i, name ) { |
2476 | | - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { |
2477 | | - var type, i = 0, match, namespaces, preType, |
2478 | | - selector = origSelector || this.selector, |
2479 | | - context = origSelector ? this : jQuery( this.context ); |
2480 | | - |
2481 | | - if ( jQuery.isFunction( data ) ) { |
2482 | | - fn = data; |
2483 | | - data = undefined; |
2484 | | - } |
2485 | | - |
2486 | | - types = (types || "").split(" "); |
2487 | | - |
2488 | | - while ( (type = types[ i++ ]) != null ) { |
2489 | | - match = rnamespaces.exec( type ); |
2490 | | - namespaces = ""; |
2491 | | - |
2492 | | - if ( match ) { |
2493 | | - namespaces = match[0]; |
2494 | | - type = type.replace( rnamespaces, "" ); |
2495 | | - } |
2496 | | - |
2497 | | - if ( type === "hover" ) { |
2498 | | - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); |
2499 | | - continue; |
2500 | | - } |
2501 | | - |
2502 | | - preType = type; |
2503 | | - |
2504 | | - if ( type === "focus" || type === "blur" ) { |
2505 | | - types.push( liveMap[ type ] + namespaces ); |
2506 | | - type = type + namespaces; |
2507 | | - |
2508 | | - } else { |
2509 | | - type = (liveMap[ type ] || type) + namespaces; |
2510 | | - } |
2511 | | - |
2512 | | - if ( name === "live" ) { |
2513 | | - // bind live handler |
2514 | | - context.each(function(){ |
2515 | | - jQuery.event.add( this, liveConvert( type, selector ), |
2516 | | - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); |
2517 | | - }); |
2518 | | - |
2519 | | - } else { |
2520 | | - // unbind live handler |
2521 | | - context.unbind( liveConvert( type, selector ), fn ); |
2522 | | - } |
2523 | | - } |
2524 | | - |
2525 | | - return this; |
2526 | | - } |
2527 | | -}); |
2528 | | - |
2529 | | -function liveHandler( event ) { |
2530 | | - var stop, elems = [], selectors = [], args = arguments, |
2531 | | - related, match, handleObj, elem, j, i, l, data, |
2532 | | - events = jQuery.data( this, "events" ); |
2533 | | - |
2534 | | - // Make sure we avoid non-left-click bubbling in Firefox (#3861) |
2535 | | - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { |
2536 | | - return; |
2537 | | - } |
2538 | | - |
2539 | | - event.liveFired = this; |
2540 | | - |
2541 | | - var live = events.live.slice(0); |
2542 | | - |
2543 | | - for ( j = 0; j < live.length; j++ ) { |
2544 | | - handleObj = live[j]; |
2545 | | - |
2546 | | - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { |
2547 | | - selectors.push( handleObj.selector ); |
2548 | | - |
2549 | | - } else { |
2550 | | - live.splice( j--, 1 ); |
2551 | | - } |
2552 | | - } |
2553 | | - |
2554 | | - match = jQuery( event.target ).closest( selectors, event.currentTarget ); |
2555 | | - |
2556 | | - for ( i = 0, l = match.length; i < l; i++ ) { |
2557 | | - for ( j = 0; j < live.length; j++ ) { |
2558 | | - handleObj = live[j]; |
2559 | | - |
2560 | | - if ( match[i].selector === handleObj.selector ) { |
2561 | | - elem = match[i].elem; |
2562 | | - related = null; |
2563 | | - |
2564 | | - // Those two events require additional checking |
2565 | | - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { |
2566 | | - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; |
2567 | | - } |
2568 | | - |
2569 | | - if ( !related || related !== elem ) { |
2570 | | - elems.push({ elem: elem, handleObj: handleObj }); |
2571 | | - } |
2572 | | - } |
2573 | | - } |
2574 | | - } |
2575 | | - |
2576 | | - for ( i = 0, l = elems.length; i < l; i++ ) { |
2577 | | - match = elems[i]; |
2578 | | - event.currentTarget = match.elem; |
2579 | | - event.data = match.handleObj.data; |
2580 | | - event.handleObj = match.handleObj; |
2581 | | - |
2582 | | - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { |
2583 | | - stop = false; |
2584 | | - break; |
2585 | | - } |
2586 | | - } |
2587 | | - |
2588 | | - return stop; |
2589 | | -} |
2590 | | - |
2591 | | -function liveConvert( type, selector ) { |
2592 | | - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); |
2593 | | -} |
2594 | | - |
2595 | | -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
2596 | | - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
2597 | | - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { |
2598 | | - |
2599 | | - // Handle event binding |
2600 | | - jQuery.fn[ name ] = function( fn ) { |
2601 | | - return fn ? this.bind( name, fn ) : this.trigger( name ); |
2602 | | - }; |
2603 | | - |
2604 | | - if ( jQuery.attrFn ) { |
2605 | | - jQuery.attrFn[ name ] = true; |
2606 | | - } |
2607 | | -}); |
2608 | | - |
2609 | | -// Prevent memory leaks in IE |
2610 | | -// Window isn't included so as not to unbind existing unload events |
2611 | | -// More info: |
2612 | | -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ |
2613 | | -if ( window.attachEvent && !window.addEventListener ) { |
2614 | | - window.attachEvent("onunload", function() { |
2615 | | - for ( var id in jQuery.cache ) { |
2616 | | - if ( jQuery.cache[ id ].handle ) { |
2617 | | - // Try/Catch is to handle iframes being unloaded, see #4280 |
2618 | | - try { |
2619 | | - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
2620 | | - } catch(e) {} |
2621 | | - } |
2622 | | - } |
2623 | | - }); |
2624 | | -} |
2625 | | -/*! |
2626 | | - * Sizzle CSS Selector Engine - v1.0 |
2627 | | - * Copyright 2009, The Dojo Foundation |
2628 | | - * Released under the MIT, BSD, and GPL Licenses. |
2629 | | - * More information: http://sizzlejs.com/ |
2630 | | - */ |
2631 | | -(function(){ |
2632 | | - |
2633 | | -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, |
2634 | | - done = 0, |
2635 | | - toString = Object.prototype.toString, |
2636 | | - hasDuplicate = false, |
2637 | | - baseHasDuplicate = true; |
2638 | | - |
2639 | | -// Here we check if the JavaScript engine is using some sort of |
2640 | | -// optimization where it does not always call our comparision |
2641 | | -// function. If that is the case, discard the hasDuplicate value. |
2642 | | -// Thus far that includes Google Chrome. |
2643 | | -[0, 0].sort(function(){ |
2644 | | - baseHasDuplicate = false; |
2645 | | - return 0; |
2646 | | -}); |
2647 | | - |
2648 | | -var Sizzle = function(selector, context, results, seed) { |
2649 | | - results = results || []; |
2650 | | - var origContext = context = context || document; |
2651 | | - |
2652 | | - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
2653 | | - return []; |
2654 | | - } |
2655 | | - |
2656 | | - if ( !selector || typeof selector !== "string" ) { |
2657 | | - return results; |
2658 | | - } |
2659 | | - |
2660 | | - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), |
2661 | | - soFar = selector; |
2662 | | - |
2663 | | - // Reset the position of the chunker regexp (start from head) |
2664 | | - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { |
2665 | | - soFar = m[3]; |
2666 | | - |
2667 | | - parts.push( m[1] ); |
2668 | | - |
2669 | | - if ( m[2] ) { |
2670 | | - extra = m[3]; |
2671 | | - break; |
2672 | | - } |
2673 | | - } |
2674 | | - |
2675 | | - if ( parts.length > 1 && origPOS.exec( selector ) ) { |
2676 | | - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
2677 | | - set = posProcess( parts[0] + parts[1], context ); |
2678 | | - } else { |
2679 | | - set = Expr.relative[ parts[0] ] ? |
2680 | | - [ context ] : |
2681 | | - Sizzle( parts.shift(), context ); |
2682 | | - |
2683 | | - while ( parts.length ) { |
2684 | | - selector = parts.shift(); |
2685 | | - |
2686 | | - if ( Expr.relative[ selector ] ) { |
2687 | | - selector += parts.shift(); |
2688 | | - } |
2689 | | - |
2690 | | - set = posProcess( selector, set ); |
2691 | | - } |
2692 | | - } |
2693 | | - } else { |
2694 | | - // Take a shortcut and set the context if the root selector is an ID |
2695 | | - // (but not if it'll be faster if the inner selector is an ID) |
2696 | | - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
2697 | | - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
2698 | | - var ret = Sizzle.find( parts.shift(), context, contextXML ); |
2699 | | - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; |
2700 | | - } |
2701 | | - |
2702 | | - if ( context ) { |
2703 | | - var ret = seed ? |
2704 | | - { expr: parts.pop(), set: makeArray(seed) } : |
2705 | | - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
2706 | | - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; |
2707 | | - |
2708 | | - if ( parts.length > 0 ) { |
2709 | | - checkSet = makeArray(set); |
2710 | | - } else { |
2711 | | - prune = false; |
2712 | | - } |
2713 | | - |
2714 | | - while ( parts.length ) { |
2715 | | - var cur = parts.pop(), pop = cur; |
2716 | | - |
2717 | | - if ( !Expr.relative[ cur ] ) { |
2718 | | - cur = ""; |
2719 | | - } else { |
2720 | | - pop = parts.pop(); |
2721 | | - } |
2722 | | - |
2723 | | - if ( pop == null ) { |
2724 | | - pop = context; |
2725 | | - } |
2726 | | - |
2727 | | - Expr.relative[ cur ]( checkSet, pop, contextXML ); |
2728 | | - } |
2729 | | - } else { |
2730 | | - checkSet = parts = []; |
2731 | | - } |
2732 | | - } |
2733 | | - |
2734 | | - if ( !checkSet ) { |
2735 | | - checkSet = set; |
2736 | | - } |
2737 | | - |
2738 | | - if ( !checkSet ) { |
2739 | | - Sizzle.error( cur || selector ); |
2740 | | - } |
2741 | | - |
2742 | | - if ( toString.call(checkSet) === "[object Array]" ) { |
2743 | | - if ( !prune ) { |
2744 | | - results.push.apply( results, checkSet ); |
2745 | | - } else if ( context && context.nodeType === 1 ) { |
2746 | | - for ( var i = 0; checkSet[i] != null; i++ ) { |
2747 | | - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
2748 | | - results.push( set[i] ); |
2749 | | - } |
2750 | | - } |
2751 | | - } else { |
2752 | | - for ( var i = 0; checkSet[i] != null; i++ ) { |
2753 | | - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
2754 | | - results.push( set[i] ); |
2755 | | - } |
2756 | | - } |
2757 | | - } |
2758 | | - } else { |
2759 | | - makeArray( checkSet, results ); |
2760 | | - } |
2761 | | - |
2762 | | - if ( extra ) { |
2763 | | - Sizzle( extra, origContext, results, seed ); |
2764 | | - Sizzle.uniqueSort( results ); |
2765 | | - } |
2766 | | - |
2767 | | - return results; |
2768 | | -}; |
2769 | | - |
2770 | | -Sizzle.uniqueSort = function(results){ |
2771 | | - if ( sortOrder ) { |
2772 | | - hasDuplicate = baseHasDuplicate; |
2773 | | - results.sort(sortOrder); |
2774 | | - |
2775 | | - if ( hasDuplicate ) { |
2776 | | - for ( var i = 1; i < results.length; i++ ) { |
2777 | | - if ( results[i] === results[i-1] ) { |
2778 | | - results.splice(i--, 1); |
2779 | | - } |
2780 | | - } |
2781 | | - } |
2782 | | - } |
2783 | | - |
2784 | | - return results; |
2785 | | -}; |
2786 | | - |
2787 | | -Sizzle.matches = function(expr, set){ |
2788 | | - return Sizzle(expr, null, null, set); |
2789 | | -}; |
2790 | | - |
2791 | | -Sizzle.find = function(expr, context, isXML){ |
2792 | | - var set, match; |
2793 | | - |
2794 | | - if ( !expr ) { |
2795 | | - return []; |
2796 | | - } |
2797 | | - |
2798 | | - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
2799 | | - var type = Expr.order[i], match; |
2800 | | - |
2801 | | - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { |
2802 | | - var left = match[1]; |
2803 | | - match.splice(1,1); |
2804 | | - |
2805 | | - if ( left.substr( left.length - 1 ) !== "\\" ) { |
2806 | | - match[1] = (match[1] || "").replace(/\\/g, ""); |
2807 | | - set = Expr.find[ type ]( match, context, isXML ); |
2808 | | - if ( set != null ) { |
2809 | | - expr = expr.replace( Expr.match[ type ], "" ); |
2810 | | - break; |
2811 | | - } |
2812 | | - } |
2813 | | - } |
2814 | | - } |
2815 | | - |
2816 | | - if ( !set ) { |
2817 | | - set = context.getElementsByTagName("*"); |
2818 | | - } |
2819 | | - |
2820 | | - return {set: set, expr: expr}; |
2821 | | -}; |
2822 | | - |
2823 | | -Sizzle.filter = function(expr, set, inplace, not){ |
2824 | | - var old = expr, result = [], curLoop = set, match, anyFound, |
2825 | | - isXMLFilter = set && set[0] && isXML(set[0]); |
2826 | | - |
2827 | | - while ( expr && set.length ) { |
2828 | | - for ( var type in Expr.filter ) { |
2829 | | - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { |
2830 | | - var filter = Expr.filter[ type ], found, item, left = match[1]; |
2831 | | - anyFound = false; |
2832 | | - |
2833 | | - match.splice(1,1); |
2834 | | - |
2835 | | - if ( left.substr( left.length - 1 ) === "\\" ) { |
2836 | | - continue; |
2837 | | - } |
2838 | | - |
2839 | | - if ( curLoop === result ) { |
2840 | | - result = []; |
2841 | | - } |
2842 | | - |
2843 | | - if ( Expr.preFilter[ type ] ) { |
2844 | | - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
2845 | | - |
2846 | | - if ( !match ) { |
2847 | | - anyFound = found = true; |
2848 | | - } else if ( match === true ) { |
2849 | | - continue; |
2850 | | - } |
2851 | | - } |
2852 | | - |
2853 | | - if ( match ) { |
2854 | | - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
2855 | | - if ( item ) { |
2856 | | - found = filter( item, match, i, curLoop ); |
2857 | | - var pass = not ^ !!found; |
2858 | | - |
2859 | | - if ( inplace && found != null ) { |
2860 | | - if ( pass ) { |
2861 | | - anyFound = true; |
2862 | | - } else { |
2863 | | - curLoop[i] = false; |
2864 | | - } |
2865 | | - } else if ( pass ) { |
2866 | | - result.push( item ); |
2867 | | - anyFound = true; |
2868 | | - } |
2869 | | - } |
2870 | | - } |
2871 | | - } |
2872 | | - |
2873 | | - if ( found !== undefined ) { |
2874 | | - if ( !inplace ) { |
2875 | | - curLoop = result; |
2876 | | - } |
2877 | | - |
2878 | | - expr = expr.replace( Expr.match[ type ], "" ); |
2879 | | - |
2880 | | - if ( !anyFound ) { |
2881 | | - return []; |
2882 | | - } |
2883 | | - |
2884 | | - break; |
2885 | | - } |
2886 | | - } |
2887 | | - } |
2888 | | - |
2889 | | - // Improper expression |
2890 | | - if ( expr === old ) { |
2891 | | - if ( anyFound == null ) { |
2892 | | - Sizzle.error( expr ); |
2893 | | - } else { |
2894 | | - break; |
2895 | | - } |
2896 | | - } |
2897 | | - |
2898 | | - old = expr; |
2899 | | - } |
2900 | | - |
2901 | | - return curLoop; |
2902 | | -}; |
2903 | | - |
2904 | | -Sizzle.error = function( msg ) { |
2905 | | - throw "Syntax error, unrecognized expression: " + msg; |
2906 | | -}; |
2907 | | - |
2908 | | -var Expr = Sizzle.selectors = { |
2909 | | - order: [ "ID", "NAME", "TAG" ], |
2910 | | - match: { |
2911 | | - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, |
2912 | | - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, |
2913 | | - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, |
2914 | | - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
2915 | | - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, |
2916 | | - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
2917 | | - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
2918 | | - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ |
2919 | | - }, |
2920 | | - leftMatch: {}, |
2921 | | - attrMap: { |
2922 | | - "class": "className", |
2923 | | - "for": "htmlFor" |
2924 | | - }, |
2925 | | - attrHandle: { |
2926 | | - href: function(elem){ |
2927 | | - return elem.getAttribute("href"); |
2928 | | - } |
2929 | | - }, |
2930 | | - relative: { |
2931 | | - "+": function(checkSet, part){ |
2932 | | - var isPartStr = typeof part === "string", |
2933 | | - isTag = isPartStr && !/\W/.test(part), |
2934 | | - isPartStrNotTag = isPartStr && !isTag; |
2935 | | - |
2936 | | - if ( isTag ) { |
2937 | | - part = part.toLowerCase(); |
2938 | | - } |
2939 | | - |
2940 | | - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
2941 | | - if ( (elem = checkSet[i]) ) { |
2942 | | - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
2943 | | - |
2944 | | - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? |
2945 | | - elem || false : |
2946 | | - elem === part; |
2947 | | - } |
2948 | | - } |
2949 | | - |
2950 | | - if ( isPartStrNotTag ) { |
2951 | | - Sizzle.filter( part, checkSet, true ); |
2952 | | - } |
2953 | | - }, |
2954 | | - ">": function(checkSet, part){ |
2955 | | - var isPartStr = typeof part === "string"; |
2956 | | - |
2957 | | - if ( isPartStr && !/\W/.test(part) ) { |
2958 | | - part = part.toLowerCase(); |
2959 | | - |
2960 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
2961 | | - var elem = checkSet[i]; |
2962 | | - if ( elem ) { |
2963 | | - var parent = elem.parentNode; |
2964 | | - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; |
2965 | | - } |
2966 | | - } |
2967 | | - } else { |
2968 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
2969 | | - var elem = checkSet[i]; |
2970 | | - if ( elem ) { |
2971 | | - checkSet[i] = isPartStr ? |
2972 | | - elem.parentNode : |
2973 | | - elem.parentNode === part; |
2974 | | - } |
2975 | | - } |
2976 | | - |
2977 | | - if ( isPartStr ) { |
2978 | | - Sizzle.filter( part, checkSet, true ); |
2979 | | - } |
2980 | | - } |
2981 | | - }, |
2982 | | - "": function(checkSet, part, isXML){ |
2983 | | - var doneName = done++, checkFn = dirCheck; |
2984 | | - |
2985 | | - if ( typeof part === "string" && !/\W/.test(part) ) { |
2986 | | - var nodeCheck = part = part.toLowerCase(); |
2987 | | - checkFn = dirNodeCheck; |
2988 | | - } |
2989 | | - |
2990 | | - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
2991 | | - }, |
2992 | | - "~": function(checkSet, part, isXML){ |
2993 | | - var doneName = done++, checkFn = dirCheck; |
2994 | | - |
2995 | | - if ( typeof part === "string" && !/\W/.test(part) ) { |
2996 | | - var nodeCheck = part = part.toLowerCase(); |
2997 | | - checkFn = dirNodeCheck; |
2998 | | - } |
2999 | | - |
3000 | | - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
3001 | | - } |
3002 | | - }, |
3003 | | - find: { |
3004 | | - ID: function(match, context, isXML){ |
3005 | | - if ( typeof context.getElementById !== "undefined" && !isXML ) { |
3006 | | - var m = context.getElementById(match[1]); |
3007 | | - return m ? [m] : []; |
3008 | | - } |
3009 | | - }, |
3010 | | - NAME: function(match, context){ |
3011 | | - if ( typeof context.getElementsByName !== "undefined" ) { |
3012 | | - var ret = [], results = context.getElementsByName(match[1]); |
3013 | | - |
3014 | | - for ( var i = 0, l = results.length; i < l; i++ ) { |
3015 | | - if ( results[i].getAttribute("name") === match[1] ) { |
3016 | | - ret.push( results[i] ); |
3017 | | - } |
3018 | | - } |
3019 | | - |
3020 | | - return ret.length === 0 ? null : ret; |
3021 | | - } |
3022 | | - }, |
3023 | | - TAG: function(match, context){ |
3024 | | - return context.getElementsByTagName(match[1]); |
3025 | | - } |
3026 | | - }, |
3027 | | - preFilter: { |
3028 | | - CLASS: function(match, curLoop, inplace, result, not, isXML){ |
3029 | | - match = " " + match[1].replace(/\\/g, "") + " "; |
3030 | | - |
3031 | | - if ( isXML ) { |
3032 | | - return match; |
3033 | | - } |
3034 | | - |
3035 | | - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
3036 | | - if ( elem ) { |
3037 | | - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { |
3038 | | - if ( !inplace ) { |
3039 | | - result.push( elem ); |
3040 | | - } |
3041 | | - } else if ( inplace ) { |
3042 | | - curLoop[i] = false; |
3043 | | - } |
3044 | | - } |
3045 | | - } |
3046 | | - |
3047 | | - return false; |
3048 | | - }, |
3049 | | - ID: function(match){ |
3050 | | - return match[1].replace(/\\/g, ""); |
3051 | | - }, |
3052 | | - TAG: function(match, curLoop){ |
3053 | | - return match[1].toLowerCase(); |
3054 | | - }, |
3055 | | - CHILD: function(match){ |
3056 | | - if ( match[1] === "nth" ) { |
3057 | | - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
3058 | | - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
3059 | | - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || |
3060 | | - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
3061 | | - |
3062 | | - // calculate the numbers (first)n+(last) including if they are negative |
3063 | | - match[2] = (test[1] + (test[2] || 1)) - 0; |
3064 | | - match[3] = test[3] - 0; |
3065 | | - } |
3066 | | - |
3067 | | - // TODO: Move to normal caching system |
3068 | | - match[0] = done++; |
3069 | | - |
3070 | | - return match; |
3071 | | - }, |
3072 | | - ATTR: function(match, curLoop, inplace, result, not, isXML){ |
3073 | | - var name = match[1].replace(/\\/g, ""); |
3074 | | - |
3075 | | - if ( !isXML && Expr.attrMap[name] ) { |
3076 | | - match[1] = Expr.attrMap[name]; |
3077 | | - } |
3078 | | - |
3079 | | - if ( match[2] === "~=" ) { |
3080 | | - match[4] = " " + match[4] + " "; |
3081 | | - } |
3082 | | - |
3083 | | - return match; |
3084 | | - }, |
3085 | | - PSEUDO: function(match, curLoop, inplace, result, not){ |
3086 | | - if ( match[1] === "not" ) { |
3087 | | - // If we're dealing with a complex expression, or a simple one |
3088 | | - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { |
3089 | | - match[3] = Sizzle(match[3], null, null, curLoop); |
3090 | | - } else { |
3091 | | - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
3092 | | - if ( !inplace ) { |
3093 | | - result.push.apply( result, ret ); |
3094 | | - } |
3095 | | - return false; |
3096 | | - } |
3097 | | - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
3098 | | - return true; |
3099 | | - } |
3100 | | - |
3101 | | - return match; |
3102 | | - }, |
3103 | | - POS: function(match){ |
3104 | | - match.unshift( true ); |
3105 | | - return match; |
3106 | | - } |
3107 | | - }, |
3108 | | - filters: { |
3109 | | - enabled: function(elem){ |
3110 | | - return elem.disabled === false && elem.type !== "hidden"; |
3111 | | - }, |
3112 | | - disabled: function(elem){ |
3113 | | - return elem.disabled === true; |
3114 | | - }, |
3115 | | - checked: function(elem){ |
3116 | | - return elem.checked === true; |
3117 | | - }, |
3118 | | - selected: function(elem){ |
3119 | | - // Accessing this property makes selected-by-default |
3120 | | - // options in Safari work properly |
3121 | | - elem.parentNode.selectedIndex; |
3122 | | - return elem.selected === true; |
3123 | | - }, |
3124 | | - parent: function(elem){ |
3125 | | - return !!elem.firstChild; |
3126 | | - }, |
3127 | | - empty: function(elem){ |
3128 | | - return !elem.firstChild; |
3129 | | - }, |
3130 | | - has: function(elem, i, match){ |
3131 | | - return !!Sizzle( match[3], elem ).length; |
3132 | | - }, |
3133 | | - header: function(elem){ |
3134 | | - return /h\d/i.test( elem.nodeName ); |
3135 | | - }, |
3136 | | - text: function(elem){ |
3137 | | - return "text" === elem.type; |
3138 | | - }, |
3139 | | - radio: function(elem){ |
3140 | | - return "radio" === elem.type; |
3141 | | - }, |
3142 | | - checkbox: function(elem){ |
3143 | | - return "checkbox" === elem.type; |
3144 | | - }, |
3145 | | - file: function(elem){ |
3146 | | - return "file" === elem.type; |
3147 | | - }, |
3148 | | - password: function(elem){ |
3149 | | - return "password" === elem.type; |
3150 | | - }, |
3151 | | - submit: function(elem){ |
3152 | | - return "submit" === elem.type; |
3153 | | - }, |
3154 | | - image: function(elem){ |
3155 | | - return "image" === elem.type; |
3156 | | - }, |
3157 | | - reset: function(elem){ |
3158 | | - return "reset" === elem.type; |
3159 | | - }, |
3160 | | - button: function(elem){ |
3161 | | - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; |
3162 | | - }, |
3163 | | - input: function(elem){ |
3164 | | - return /input|select|textarea|button/i.test(elem.nodeName); |
3165 | | - } |
3166 | | - }, |
3167 | | - setFilters: { |
3168 | | - first: function(elem, i){ |
3169 | | - return i === 0; |
3170 | | - }, |
3171 | | - last: function(elem, i, match, array){ |
3172 | | - return i === array.length - 1; |
3173 | | - }, |
3174 | | - even: function(elem, i){ |
3175 | | - return i % 2 === 0; |
3176 | | - }, |
3177 | | - odd: function(elem, i){ |
3178 | | - return i % 2 === 1; |
3179 | | - }, |
3180 | | - lt: function(elem, i, match){ |
3181 | | - return i < match[3] - 0; |
3182 | | - }, |
3183 | | - gt: function(elem, i, match){ |
3184 | | - return i > match[3] - 0; |
3185 | | - }, |
3186 | | - nth: function(elem, i, match){ |
3187 | | - return match[3] - 0 === i; |
3188 | | - }, |
3189 | | - eq: function(elem, i, match){ |
3190 | | - return match[3] - 0 === i; |
3191 | | - } |
3192 | | - }, |
3193 | | - filter: { |
3194 | | - PSEUDO: function(elem, match, i, array){ |
3195 | | - var name = match[1], filter = Expr.filters[ name ]; |
3196 | | - |
3197 | | - if ( filter ) { |
3198 | | - return filter( elem, i, match, array ); |
3199 | | - } else if ( name === "contains" ) { |
3200 | | - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; |
3201 | | - } else if ( name === "not" ) { |
3202 | | - var not = match[3]; |
3203 | | - |
3204 | | - for ( var i = 0, l = not.length; i < l; i++ ) { |
3205 | | - if ( not[i] === elem ) { |
3206 | | - return false; |
3207 | | - } |
3208 | | - } |
3209 | | - |
3210 | | - return true; |
3211 | | - } else { |
3212 | | - Sizzle.error( "Syntax error, unrecognized expression: " + name ); |
3213 | | - } |
3214 | | - }, |
3215 | | - CHILD: function(elem, match){ |
3216 | | - var type = match[1], node = elem; |
3217 | | - switch (type) { |
3218 | | - case 'only': |
3219 | | - case 'first': |
3220 | | - while ( (node = node.previousSibling) ) { |
3221 | | - if ( node.nodeType === 1 ) { |
3222 | | - return false; |
3223 | | - } |
3224 | | - } |
3225 | | - if ( type === "first" ) { |
3226 | | - return true; |
3227 | | - } |
3228 | | - node = elem; |
3229 | | - case 'last': |
3230 | | - while ( (node = node.nextSibling) ) { |
3231 | | - if ( node.nodeType === 1 ) { |
3232 | | - return false; |
3233 | | - } |
3234 | | - } |
3235 | | - return true; |
3236 | | - case 'nth': |
3237 | | - var first = match[2], last = match[3]; |
3238 | | - |
3239 | | - if ( first === 1 && last === 0 ) { |
3240 | | - return true; |
3241 | | - } |
3242 | | - |
3243 | | - var doneName = match[0], |
3244 | | - parent = elem.parentNode; |
3245 | | - |
3246 | | - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
3247 | | - var count = 0; |
3248 | | - for ( node = parent.firstChild; node; node = node.nextSibling ) { |
3249 | | - if ( node.nodeType === 1 ) { |
3250 | | - node.nodeIndex = ++count; |
3251 | | - } |
3252 | | - } |
3253 | | - parent.sizcache = doneName; |
3254 | | - } |
3255 | | - |
3256 | | - var diff = elem.nodeIndex - last; |
3257 | | - if ( first === 0 ) { |
3258 | | - return diff === 0; |
3259 | | - } else { |
3260 | | - return ( diff % first === 0 && diff / first >= 0 ); |
3261 | | - } |
3262 | | - } |
3263 | | - }, |
3264 | | - ID: function(elem, match){ |
3265 | | - return elem.nodeType === 1 && elem.getAttribute("id") === match; |
3266 | | - }, |
3267 | | - TAG: function(elem, match){ |
3268 | | - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; |
3269 | | - }, |
3270 | | - CLASS: function(elem, match){ |
3271 | | - return (" " + (elem.className || elem.getAttribute("class")) + " ") |
3272 | | - .indexOf( match ) > -1; |
3273 | | - }, |
3274 | | - ATTR: function(elem, match){ |
3275 | | - var name = match[1], |
3276 | | - result = Expr.attrHandle[ name ] ? |
3277 | | - Expr.attrHandle[ name ]( elem ) : |
3278 | | - elem[ name ] != null ? |
3279 | | - elem[ name ] : |
3280 | | - elem.getAttribute( name ), |
3281 | | - value = result + "", |
3282 | | - type = match[2], |
3283 | | - check = match[4]; |
3284 | | - |
3285 | | - return result == null ? |
3286 | | - type === "!=" : |
3287 | | - type === "=" ? |
3288 | | - value === check : |
3289 | | - type === "*=" ? |
3290 | | - value.indexOf(check) >= 0 : |
3291 | | - type === "~=" ? |
3292 | | - (" " + value + " ").indexOf(check) >= 0 : |
3293 | | - !check ? |
3294 | | - value && result !== false : |
3295 | | - type === "!=" ? |
3296 | | - value !== check : |
3297 | | - type === "^=" ? |
3298 | | - value.indexOf(check) === 0 : |
3299 | | - type === "$=" ? |
3300 | | - value.substr(value.length - check.length) === check : |
3301 | | - type === "|=" ? |
3302 | | - value === check || value.substr(0, check.length + 1) === check + "-" : |
3303 | | - false; |
3304 | | - }, |
3305 | | - POS: function(elem, match, i, array){ |
3306 | | - var name = match[2], filter = Expr.setFilters[ name ]; |
3307 | | - |
3308 | | - if ( filter ) { |
3309 | | - return filter( elem, i, match, array ); |
3310 | | - } |
3311 | | - } |
3312 | | - } |
3313 | | -}; |
3314 | | - |
3315 | | -var origPOS = Expr.match.POS; |
3316 | | - |
3317 | | -for ( var type in Expr.match ) { |
3318 | | - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
3319 | | - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ |
3320 | | - return "\\" + (num - 0 + 1); |
3321 | | - })); |
3322 | | -} |
3323 | | - |
3324 | | -var makeArray = function(array, results) { |
3325 | | - array = Array.prototype.slice.call( array, 0 ); |
3326 | | - |
3327 | | - if ( results ) { |
3328 | | - results.push.apply( results, array ); |
3329 | | - return results; |
3330 | | - } |
3331 | | - |
3332 | | - return array; |
3333 | | -}; |
3334 | | - |
3335 | | -// Perform a simple check to determine if the browser is capable of |
3336 | | -// converting a NodeList to an array using builtin methods. |
3337 | | -// Also verifies that the returned array holds DOM nodes |
3338 | | -// (which is not the case in the Blackberry browser) |
3339 | | -try { |
3340 | | - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; |
3341 | | - |
3342 | | -// Provide a fallback method if it does not work |
3343 | | -} catch(e){ |
3344 | | - makeArray = function(array, results) { |
3345 | | - var ret = results || []; |
3346 | | - |
3347 | | - if ( toString.call(array) === "[object Array]" ) { |
3348 | | - Array.prototype.push.apply( ret, array ); |
3349 | | - } else { |
3350 | | - if ( typeof array.length === "number" ) { |
3351 | | - for ( var i = 0, l = array.length; i < l; i++ ) { |
3352 | | - ret.push( array[i] ); |
3353 | | - } |
3354 | | - } else { |
3355 | | - for ( var i = 0; array[i]; i++ ) { |
3356 | | - ret.push( array[i] ); |
3357 | | - } |
3358 | | - } |
3359 | | - } |
3360 | | - |
3361 | | - return ret; |
3362 | | - }; |
3363 | | -} |
3364 | | - |
3365 | | -var sortOrder; |
3366 | | - |
3367 | | -if ( document.documentElement.compareDocumentPosition ) { |
3368 | | - sortOrder = function( a, b ) { |
3369 | | - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { |
3370 | | - if ( a == b ) { |
3371 | | - hasDuplicate = true; |
3372 | | - } |
3373 | | - return a.compareDocumentPosition ? -1 : 1; |
3374 | | - } |
3375 | | - |
3376 | | - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
3377 | | - if ( ret === 0 ) { |
3378 | | - hasDuplicate = true; |
3379 | | - } |
3380 | | - return ret; |
3381 | | - }; |
3382 | | -} else if ( "sourceIndex" in document.documentElement ) { |
3383 | | - sortOrder = function( a, b ) { |
3384 | | - if ( !a.sourceIndex || !b.sourceIndex ) { |
3385 | | - if ( a == b ) { |
3386 | | - hasDuplicate = true; |
3387 | | - } |
3388 | | - return a.sourceIndex ? -1 : 1; |
3389 | | - } |
3390 | | - |
3391 | | - var ret = a.sourceIndex - b.sourceIndex; |
3392 | | - if ( ret === 0 ) { |
3393 | | - hasDuplicate = true; |
3394 | | - } |
3395 | | - return ret; |
3396 | | - }; |
3397 | | -} else if ( document.createRange ) { |
3398 | | - sortOrder = function( a, b ) { |
3399 | | - if ( !a.ownerDocument || !b.ownerDocument ) { |
3400 | | - if ( a == b ) { |
3401 | | - hasDuplicate = true; |
3402 | | - } |
3403 | | - return a.ownerDocument ? -1 : 1; |
3404 | | - } |
3405 | | - |
3406 | | - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
3407 | | - aRange.setStart(a, 0); |
3408 | | - aRange.setEnd(a, 0); |
3409 | | - bRange.setStart(b, 0); |
3410 | | - bRange.setEnd(b, 0); |
3411 | | - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
3412 | | - if ( ret === 0 ) { |
3413 | | - hasDuplicate = true; |
3414 | | - } |
3415 | | - return ret; |
3416 | | - }; |
3417 | | -} |
3418 | | - |
3419 | | -// Utility function for retreiving the text value of an array of DOM nodes |
3420 | | -function getText( elems ) { |
3421 | | - var ret = "", elem; |
3422 | | - |
3423 | | - for ( var i = 0; elems[i]; i++ ) { |
3424 | | - elem = elems[i]; |
3425 | | - |
3426 | | - // Get the text from text nodes and CDATA nodes |
3427 | | - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { |
3428 | | - ret += elem.nodeValue; |
3429 | | - |
3430 | | - // Traverse everything else, except comment nodes |
3431 | | - } else if ( elem.nodeType !== 8 ) { |
3432 | | - ret += getText( elem.childNodes ); |
3433 | | - } |
3434 | | - } |
3435 | | - |
3436 | | - return ret; |
3437 | | -} |
3438 | | - |
3439 | | -// Check to see if the browser returns elements by name when |
3440 | | -// querying by getElementById (and provide a workaround) |
3441 | | -(function(){ |
3442 | | - // We're going to inject a fake input element with a specified name |
3443 | | - var form = document.createElement("div"), |
3444 | | - id = "script" + (new Date).getTime(); |
3445 | | - form.innerHTML = "<a name='" + id + "'/>"; |
3446 | | - |
3447 | | - // Inject it into the root element, check its status, and remove it quickly |
3448 | | - var root = document.documentElement; |
3449 | | - root.insertBefore( form, root.firstChild ); |
3450 | | - |
3451 | | - // The workaround has to do additional checks after a getElementById |
3452 | | - // Which slows things down for other browsers (hence the branching) |
3453 | | - if ( document.getElementById( id ) ) { |
3454 | | - Expr.find.ID = function(match, context, isXML){ |
3455 | | - if ( typeof context.getElementById !== "undefined" && !isXML ) { |
3456 | | - var m = context.getElementById(match[1]); |
3457 | | - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
3458 | | - } |
3459 | | - }; |
3460 | | - |
3461 | | - Expr.filter.ID = function(elem, match){ |
3462 | | - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
3463 | | - return elem.nodeType === 1 && node && node.nodeValue === match; |
3464 | | - }; |
3465 | | - } |
3466 | | - |
3467 | | - root.removeChild( form ); |
3468 | | - root = form = null; // release memory in IE |
3469 | | -})(); |
3470 | | - |
3471 | | -(function(){ |
3472 | | - // Check to see if the browser returns only elements |
3473 | | - // when doing getElementsByTagName("*") |
3474 | | - |
3475 | | - // Create a fake element |
3476 | | - var div = document.createElement("div"); |
3477 | | - div.appendChild( document.createComment("") ); |
3478 | | - |
3479 | | - // Make sure no comments are found |
3480 | | - if ( div.getElementsByTagName("*").length > 0 ) { |
3481 | | - Expr.find.TAG = function(match, context){ |
3482 | | - var results = context.getElementsByTagName(match[1]); |
3483 | | - |
3484 | | - // Filter out possible comments |
3485 | | - if ( match[1] === "*" ) { |
3486 | | - var tmp = []; |
3487 | | - |
3488 | | - for ( var i = 0; results[i]; i++ ) { |
3489 | | - if ( results[i].nodeType === 1 ) { |
3490 | | - tmp.push( results[i] ); |
3491 | | - } |
3492 | | - } |
3493 | | - |
3494 | | - results = tmp; |
3495 | | - } |
3496 | | - |
3497 | | - return results; |
3498 | | - }; |
3499 | | - } |
3500 | | - |
3501 | | - // Check to see if an attribute returns normalized href attributes |
3502 | | - div.innerHTML = "<a href='#'></a>"; |
3503 | | - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
3504 | | - div.firstChild.getAttribute("href") !== "#" ) { |
3505 | | - Expr.attrHandle.href = function(elem){ |
3506 | | - return elem.getAttribute("href", 2); |
3507 | | - }; |
3508 | | - } |
3509 | | - |
3510 | | - div = null; // release memory in IE |
3511 | | -})(); |
3512 | | - |
3513 | | -if ( document.querySelectorAll ) { |
3514 | | - (function(){ |
3515 | | - var oldSizzle = Sizzle, div = document.createElement("div"); |
3516 | | - div.innerHTML = "<p class='TEST'></p>"; |
3517 | | - |
3518 | | - // Safari can't handle uppercase or unicode characters when |
3519 | | - // in quirks mode. |
3520 | | - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
3521 | | - return; |
3522 | | - } |
3523 | | - |
3524 | | - Sizzle = function(query, context, extra, seed){ |
3525 | | - context = context || document; |
3526 | | - |
3527 | | - // Only use querySelectorAll on non-XML documents |
3528 | | - // (ID selectors don't work in non-HTML documents) |
3529 | | - if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
3530 | | - try { |
3531 | | - return makeArray( context.querySelectorAll(query), extra ); |
3532 | | - } catch(e){} |
3533 | | - } |
3534 | | - |
3535 | | - return oldSizzle(query, context, extra, seed); |
3536 | | - }; |
3537 | | - |
3538 | | - for ( var prop in oldSizzle ) { |
3539 | | - Sizzle[ prop ] = oldSizzle[ prop ]; |
3540 | | - } |
3541 | | - |
3542 | | - div = null; // release memory in IE |
3543 | | - })(); |
3544 | | -} |
3545 | | - |
3546 | | -(function(){ |
3547 | | - var div = document.createElement("div"); |
3548 | | - |
3549 | | - div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
3550 | | - |
3551 | | - // Opera can't find a second classname (in 9.6) |
3552 | | - // Also, make sure that getElementsByClassName actually exists |
3553 | | - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { |
3554 | | - return; |
3555 | | - } |
3556 | | - |
3557 | | - // Safari caches class attributes, doesn't catch changes (in 3.2) |
3558 | | - div.lastChild.className = "e"; |
3559 | | - |
3560 | | - if ( div.getElementsByClassName("e").length === 1 ) { |
3561 | | - return; |
3562 | | - } |
3563 | | - |
3564 | | - Expr.order.splice(1, 0, "CLASS"); |
3565 | | - Expr.find.CLASS = function(match, context, isXML) { |
3566 | | - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
3567 | | - return context.getElementsByClassName(match[1]); |
3568 | | - } |
3569 | | - }; |
3570 | | - |
3571 | | - div = null; // release memory in IE |
3572 | | -})(); |
3573 | | - |
3574 | | -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
3575 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
3576 | | - var elem = checkSet[i]; |
3577 | | - if ( elem ) { |
3578 | | - elem = elem[dir]; |
3579 | | - var match = false; |
3580 | | - |
3581 | | - while ( elem ) { |
3582 | | - if ( elem.sizcache === doneName ) { |
3583 | | - match = checkSet[elem.sizset]; |
3584 | | - break; |
3585 | | - } |
3586 | | - |
3587 | | - if ( elem.nodeType === 1 && !isXML ){ |
3588 | | - elem.sizcache = doneName; |
3589 | | - elem.sizset = i; |
3590 | | - } |
3591 | | - |
3592 | | - if ( elem.nodeName.toLowerCase() === cur ) { |
3593 | | - match = elem; |
3594 | | - break; |
3595 | | - } |
3596 | | - |
3597 | | - elem = elem[dir]; |
3598 | | - } |
3599 | | - |
3600 | | - checkSet[i] = match; |
3601 | | - } |
3602 | | - } |
3603 | | -} |
3604 | | - |
3605 | | -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
3606 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
3607 | | - var elem = checkSet[i]; |
3608 | | - if ( elem ) { |
3609 | | - elem = elem[dir]; |
3610 | | - var match = false; |
3611 | | - |
3612 | | - while ( elem ) { |
3613 | | - if ( elem.sizcache === doneName ) { |
3614 | | - match = checkSet[elem.sizset]; |
3615 | | - break; |
3616 | | - } |
3617 | | - |
3618 | | - if ( elem.nodeType === 1 ) { |
3619 | | - if ( !isXML ) { |
3620 | | - elem.sizcache = doneName; |
3621 | | - elem.sizset = i; |
3622 | | - } |
3623 | | - if ( typeof cur !== "string" ) { |
3624 | | - if ( elem === cur ) { |
3625 | | - match = true; |
3626 | | - break; |
3627 | | - } |
3628 | | - |
3629 | | - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
3630 | | - match = elem; |
3631 | | - break; |
3632 | | - } |
3633 | | - } |
3634 | | - |
3635 | | - elem = elem[dir]; |
3636 | | - } |
3637 | | - |
3638 | | - checkSet[i] = match; |
3639 | | - } |
3640 | | - } |
3641 | | -} |
3642 | | - |
3643 | | -var contains = document.compareDocumentPosition ? function(a, b){ |
3644 | | - return !!(a.compareDocumentPosition(b) & 16); |
3645 | | -} : function(a, b){ |
3646 | | - return a !== b && (a.contains ? a.contains(b) : true); |
3647 | | -}; |
3648 | | - |
3649 | | -var isXML = function(elem){ |
3650 | | - // documentElement is verified for cases where it doesn't yet exist |
3651 | | - // (such as loading iframes in IE - #4833) |
3652 | | - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; |
3653 | | - return documentElement ? documentElement.nodeName !== "HTML" : false; |
3654 | | -}; |
3655 | | - |
3656 | | -var posProcess = function(selector, context){ |
3657 | | - var tmpSet = [], later = "", match, |
3658 | | - root = context.nodeType ? [context] : context; |
3659 | | - |
3660 | | - // Position selectors must be done after the filter |
3661 | | - // And so must :not(positional) so we move all PSEUDOs to the end |
3662 | | - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
3663 | | - later += match[0]; |
3664 | | - selector = selector.replace( Expr.match.PSEUDO, "" ); |
3665 | | - } |
3666 | | - |
3667 | | - selector = Expr.relative[selector] ? selector + "*" : selector; |
3668 | | - |
3669 | | - for ( var i = 0, l = root.length; i < l; i++ ) { |
3670 | | - Sizzle( selector, root[i], tmpSet ); |
3671 | | - } |
3672 | | - |
3673 | | - return Sizzle.filter( later, tmpSet ); |
3674 | | -}; |
3675 | | - |
3676 | | -// EXPOSE |
3677 | | -jQuery.find = Sizzle; |
3678 | | -jQuery.expr = Sizzle.selectors; |
3679 | | -jQuery.expr[":"] = jQuery.expr.filters; |
3680 | | -jQuery.unique = Sizzle.uniqueSort; |
3681 | | -jQuery.text = getText; |
3682 | | -jQuery.isXMLDoc = isXML; |
3683 | | -jQuery.contains = contains; |
3684 | | - |
3685 | | -return; |
3686 | | - |
3687 | | -window.Sizzle = Sizzle; |
3688 | | - |
3689 | | -})(); |
3690 | | -var runtil = /Until$/, |
3691 | | - rparentsprev = /^(?:parents|prevUntil|prevAll)/, |
3692 | | - // Note: This RegExp should be improved, or likely pulled from Sizzle |
3693 | | - rmultiselector = /,/, |
3694 | | - slice = Array.prototype.slice; |
3695 | | - |
3696 | | -// Implement the identical functionality for filter and not |
3697 | | -var winnow = function( elements, qualifier, keep ) { |
3698 | | - if ( jQuery.isFunction( qualifier ) ) { |
3699 | | - return jQuery.grep(elements, function( elem, i ) { |
3700 | | - return !!qualifier.call( elem, i, elem ) === keep; |
3701 | | - }); |
3702 | | - |
3703 | | - } else if ( qualifier.nodeType ) { |
3704 | | - return jQuery.grep(elements, function( elem, i ) { |
3705 | | - return (elem === qualifier) === keep; |
3706 | | - }); |
3707 | | - |
3708 | | - } else if ( typeof qualifier === "string" ) { |
3709 | | - var filtered = jQuery.grep(elements, function( elem ) { |
3710 | | - return elem.nodeType === 1; |
3711 | | - }); |
3712 | | - |
3713 | | - if ( isSimple.test( qualifier ) ) { |
3714 | | - return jQuery.filter(qualifier, filtered, !keep); |
3715 | | - } else { |
3716 | | - qualifier = jQuery.filter( qualifier, filtered ); |
3717 | | - } |
3718 | | - } |
3719 | | - |
3720 | | - return jQuery.grep(elements, function( elem, i ) { |
3721 | | - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
3722 | | - }); |
3723 | | -}; |
3724 | | - |
3725 | | -jQuery.fn.extend({ |
3726 | | - find: function( selector ) { |
3727 | | - var ret = this.pushStack( "", "find", selector ), length = 0; |
3728 | | - |
3729 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
3730 | | - length = ret.length; |
3731 | | - jQuery.find( selector, this[i], ret ); |
3732 | | - |
3733 | | - if ( i > 0 ) { |
3734 | | - // Make sure that the results are unique |
3735 | | - for ( var n = length; n < ret.length; n++ ) { |
3736 | | - for ( var r = 0; r < length; r++ ) { |
3737 | | - if ( ret[r] === ret[n] ) { |
3738 | | - ret.splice(n--, 1); |
3739 | | - break; |
3740 | | - } |
3741 | | - } |
3742 | | - } |
3743 | | - } |
3744 | | - } |
3745 | | - |
3746 | | - return ret; |
3747 | | - }, |
3748 | | - |
3749 | | - has: function( target ) { |
3750 | | - var targets = jQuery( target ); |
3751 | | - return this.filter(function() { |
3752 | | - for ( var i = 0, l = targets.length; i < l; i++ ) { |
3753 | | - if ( jQuery.contains( this, targets[i] ) ) { |
3754 | | - return true; |
3755 | | - } |
3756 | | - } |
3757 | | - }); |
3758 | | - }, |
3759 | | - |
3760 | | - not: function( selector ) { |
3761 | | - return this.pushStack( winnow(this, selector, false), "not", selector); |
3762 | | - }, |
3763 | | - |
3764 | | - filter: function( selector ) { |
3765 | | - return this.pushStack( winnow(this, selector, true), "filter", selector ); |
3766 | | - }, |
3767 | | - |
3768 | | - is: function( selector ) { |
3769 | | - return !!selector && jQuery.filter( selector, this ).length > 0; |
3770 | | - }, |
3771 | | - |
3772 | | - closest: function( selectors, context ) { |
3773 | | - if ( jQuery.isArray( selectors ) ) { |
3774 | | - var ret = [], cur = this[0], match, matches = {}, selector; |
3775 | | - |
3776 | | - if ( cur && selectors.length ) { |
3777 | | - for ( var i = 0, l = selectors.length; i < l; i++ ) { |
3778 | | - selector = selectors[i]; |
3779 | | - |
3780 | | - if ( !matches[selector] ) { |
3781 | | - matches[selector] = jQuery.expr.match.POS.test( selector ) ? |
3782 | | - jQuery( selector, context || this.context ) : |
3783 | | - selector; |
3784 | | - } |
3785 | | - } |
3786 | | - |
3787 | | - while ( cur && cur.ownerDocument && cur !== context ) { |
3788 | | - for ( selector in matches ) { |
3789 | | - match = matches[selector]; |
3790 | | - |
3791 | | - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { |
3792 | | - ret.push({ selector: selector, elem: cur }); |
3793 | | - delete matches[selector]; |
3794 | | - } |
3795 | | - } |
3796 | | - cur = cur.parentNode; |
3797 | | - } |
3798 | | - } |
3799 | | - |
3800 | | - return ret; |
3801 | | - } |
3802 | | - |
3803 | | - var pos = jQuery.expr.match.POS.test( selectors ) ? |
3804 | | - jQuery( selectors, context || this.context ) : null; |
3805 | | - |
3806 | | - return this.map(function( i, cur ) { |
3807 | | - while ( cur && cur.ownerDocument && cur !== context ) { |
3808 | | - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { |
3809 | | - return cur; |
3810 | | - } |
3811 | | - cur = cur.parentNode; |
3812 | | - } |
3813 | | - return null; |
3814 | | - }); |
3815 | | - }, |
3816 | | - |
3817 | | - // Determine the position of an element within |
3818 | | - // the matched set of elements |
3819 | | - index: function( elem ) { |
3820 | | - if ( !elem || typeof elem === "string" ) { |
3821 | | - return jQuery.inArray( this[0], |
3822 | | - // If it receives a string, the selector is used |
3823 | | - // If it receives nothing, the siblings are used |
3824 | | - elem ? jQuery( elem ) : this.parent().children() ); |
3825 | | - } |
3826 | | - // Locate the position of the desired element |
3827 | | - return jQuery.inArray( |
3828 | | - // If it receives a jQuery object, the first element is used |
3829 | | - elem.jquery ? elem[0] : elem, this ); |
3830 | | - }, |
3831 | | - |
3832 | | - add: function( selector, context ) { |
3833 | | - var set = typeof selector === "string" ? |
3834 | | - jQuery( selector, context || this.context ) : |
3835 | | - jQuery.makeArray( selector ), |
3836 | | - all = jQuery.merge( this.get(), set ); |
3837 | | - |
3838 | | - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? |
3839 | | - all : |
3840 | | - jQuery.unique( all ) ); |
3841 | | - }, |
3842 | | - |
3843 | | - andSelf: function() { |
3844 | | - return this.add( this.prevObject ); |
3845 | | - } |
3846 | | -}); |
3847 | | - |
3848 | | -// A painfully simple check to see if an element is disconnected |
3849 | | -// from a document (should be improved, where feasible). |
3850 | | -function isDisconnected( node ) { |
3851 | | - return !node || !node.parentNode || node.parentNode.nodeType === 11; |
3852 | | -} |
3853 | | - |
3854 | | -jQuery.each({ |
3855 | | - parent: function( elem ) { |
3856 | | - var parent = elem.parentNode; |
3857 | | - return parent && parent.nodeType !== 11 ? parent : null; |
3858 | | - }, |
3859 | | - parents: function( elem ) { |
3860 | | - return jQuery.dir( elem, "parentNode" ); |
3861 | | - }, |
3862 | | - parentsUntil: function( elem, i, until ) { |
3863 | | - return jQuery.dir( elem, "parentNode", until ); |
3864 | | - }, |
3865 | | - next: function( elem ) { |
3866 | | - return jQuery.nth( elem, 2, "nextSibling" ); |
3867 | | - }, |
3868 | | - prev: function( elem ) { |
3869 | | - return jQuery.nth( elem, 2, "previousSibling" ); |
3870 | | - }, |
3871 | | - nextAll: function( elem ) { |
3872 | | - return jQuery.dir( elem, "nextSibling" ); |
3873 | | - }, |
3874 | | - prevAll: function( elem ) { |
3875 | | - return jQuery.dir( elem, "previousSibling" ); |
3876 | | - }, |
3877 | | - nextUntil: function( elem, i, until ) { |
3878 | | - return jQuery.dir( elem, "nextSibling", until ); |
3879 | | - }, |
3880 | | - prevUntil: function( elem, i, until ) { |
3881 | | - return jQuery.dir( elem, "previousSibling", until ); |
3882 | | - }, |
3883 | | - siblings: function( elem ) { |
3884 | | - return jQuery.sibling( elem.parentNode.firstChild, elem ); |
3885 | | - }, |
3886 | | - children: function( elem ) { |
3887 | | - return jQuery.sibling( elem.firstChild ); |
3888 | | - }, |
3889 | | - contents: function( elem ) { |
3890 | | - return jQuery.nodeName( elem, "iframe" ) ? |
3891 | | - elem.contentDocument || elem.contentWindow.document : |
3892 | | - jQuery.makeArray( elem.childNodes ); |
3893 | | - } |
3894 | | -}, function( name, fn ) { |
3895 | | - jQuery.fn[ name ] = function( until, selector ) { |
3896 | | - var ret = jQuery.map( this, fn, until ); |
3897 | | - |
3898 | | - if ( !runtil.test( name ) ) { |
3899 | | - selector = until; |
3900 | | - } |
3901 | | - |
3902 | | - if ( selector && typeof selector === "string" ) { |
3903 | | - ret = jQuery.filter( selector, ret ); |
3904 | | - } |
3905 | | - |
3906 | | - ret = this.length > 1 ? jQuery.unique( ret ) : ret; |
3907 | | - |
3908 | | - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { |
3909 | | - ret = ret.reverse(); |
3910 | | - } |
3911 | | - |
3912 | | - return this.pushStack( ret, name, slice.call(arguments).join(",") ); |
3913 | | - }; |
3914 | | -}); |
3915 | | - |
3916 | | -jQuery.extend({ |
3917 | | - filter: function( expr, elems, not ) { |
3918 | | - if ( not ) { |
3919 | | - expr = ":not(" + expr + ")"; |
3920 | | - } |
3921 | | - |
3922 | | - return jQuery.find.matches(expr, elems); |
3923 | | - }, |
3924 | | - |
3925 | | - dir: function( elem, dir, until ) { |
3926 | | - var matched = [], cur = elem[dir]; |
3927 | | - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { |
3928 | | - if ( cur.nodeType === 1 ) { |
3929 | | - matched.push( cur ); |
3930 | | - } |
3931 | | - cur = cur[dir]; |
3932 | | - } |
3933 | | - return matched; |
3934 | | - }, |
3935 | | - |
3936 | | - nth: function( cur, result, dir, elem ) { |
3937 | | - result = result || 1; |
3938 | | - var num = 0; |
3939 | | - |
3940 | | - for ( ; cur; cur = cur[dir] ) { |
3941 | | - if ( cur.nodeType === 1 && ++num === result ) { |
3942 | | - break; |
3943 | | - } |
3944 | | - } |
3945 | | - |
3946 | | - return cur; |
3947 | | - }, |
3948 | | - |
3949 | | - sibling: function( n, elem ) { |
3950 | | - var r = []; |
3951 | | - |
3952 | | - for ( ; n; n = n.nextSibling ) { |
3953 | | - if ( n.nodeType === 1 && n !== elem ) { |
3954 | | - r.push( n ); |
3955 | | - } |
3956 | | - } |
3957 | | - |
3958 | | - return r; |
3959 | | - } |
3960 | | -}); |
3961 | | -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, |
3962 | | - rleadingWhitespace = /^\s+/, |
3963 | | - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, |
3964 | | - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, |
3965 | | - rtagName = /<([\w:]+)/, |
3966 | | - rtbody = /<tbody/i, |
3967 | | - rhtml = /<|&#?\w+;/, |
3968 | | - rnocache = /<script|<object|<embed|<option|<style/i, |
3969 | | - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5) |
3970 | | - fcloseTag = function( all, front, tag ) { |
3971 | | - return rselfClosing.test( tag ) ? |
3972 | | - all : |
3973 | | - front + "></" + tag + ">"; |
3974 | | - }, |
3975 | | - wrapMap = { |
3976 | | - option: [ 1, "<select multiple='multiple'>", "</select>" ], |
3977 | | - legend: [ 1, "<fieldset>", "</fieldset>" ], |
3978 | | - thead: [ 1, "<table>", "</table>" ], |
3979 | | - tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
3980 | | - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
3981 | | - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], |
3982 | | - area: [ 1, "<map>", "</map>" ], |
3983 | | - _default: [ 0, "", "" ] |
3984 | | - }; |
3985 | | - |
3986 | | -wrapMap.optgroup = wrapMap.option; |
3987 | | -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
3988 | | -wrapMap.th = wrapMap.td; |
3989 | | - |
3990 | | -// IE can't serialize <link> and <script> tags normally |
3991 | | -if ( !jQuery.support.htmlSerialize ) { |
3992 | | - wrapMap._default = [ 1, "div<div>", "</div>" ]; |
3993 | | -} |
3994 | | - |
3995 | | -jQuery.fn.extend({ |
3996 | | - text: function( text ) { |
3997 | | - if ( jQuery.isFunction(text) ) { |
3998 | | - return this.each(function(i) { |
3999 | | - var self = jQuery(this); |
4000 | | - self.text( text.call(this, i, self.text()) ); |
4001 | | - }); |
4002 | | - } |
4003 | | - |
4004 | | - if ( typeof text !== "object" && text !== undefined ) { |
4005 | | - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
4006 | | - } |
4007 | | - |
4008 | | - return jQuery.text( this ); |
4009 | | - }, |
4010 | | - |
4011 | | - wrapAll: function( html ) { |
4012 | | - if ( jQuery.isFunction( html ) ) { |
4013 | | - return this.each(function(i) { |
4014 | | - jQuery(this).wrapAll( html.call(this, i) ); |
4015 | | - }); |
4016 | | - } |
4017 | | - |
4018 | | - if ( this[0] ) { |
4019 | | - // The elements to wrap the target around |
4020 | | - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); |
4021 | | - |
4022 | | - if ( this[0].parentNode ) { |
4023 | | - wrap.insertBefore( this[0] ); |
4024 | | - } |
4025 | | - |
4026 | | - wrap.map(function() { |
4027 | | - var elem = this; |
4028 | | - |
4029 | | - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
4030 | | - elem = elem.firstChild; |
4031 | | - } |
4032 | | - |
4033 | | - return elem; |
4034 | | - }).append(this); |
4035 | | - } |
4036 | | - |
4037 | | - return this; |
4038 | | - }, |
4039 | | - |
4040 | | - wrapInner: function( html ) { |
4041 | | - if ( jQuery.isFunction( html ) ) { |
4042 | | - return this.each(function(i) { |
4043 | | - jQuery(this).wrapInner( html.call(this, i) ); |
4044 | | - }); |
4045 | | - } |
4046 | | - |
4047 | | - return this.each(function() { |
4048 | | - var self = jQuery( this ), contents = self.contents(); |
4049 | | - |
4050 | | - if ( contents.length ) { |
4051 | | - contents.wrapAll( html ); |
4052 | | - |
4053 | | - } else { |
4054 | | - self.append( html ); |
4055 | | - } |
4056 | | - }); |
4057 | | - }, |
4058 | | - |
4059 | | - wrap: function( html ) { |
4060 | | - return this.each(function() { |
4061 | | - jQuery( this ).wrapAll( html ); |
4062 | | - }); |
4063 | | - }, |
4064 | | - |
4065 | | - unwrap: function() { |
4066 | | - return this.parent().each(function() { |
4067 | | - if ( !jQuery.nodeName( this, "body" ) ) { |
4068 | | - jQuery( this ).replaceWith( this.childNodes ); |
4069 | | - } |
4070 | | - }).end(); |
4071 | | - }, |
4072 | | - |
4073 | | - append: function() { |
4074 | | - return this.domManip(arguments, true, function( elem ) { |
4075 | | - if ( this.nodeType === 1 ) { |
4076 | | - this.appendChild( elem ); |
4077 | | - } |
4078 | | - }); |
4079 | | - }, |
4080 | | - |
4081 | | - prepend: function() { |
4082 | | - return this.domManip(arguments, true, function( elem ) { |
4083 | | - if ( this.nodeType === 1 ) { |
4084 | | - this.insertBefore( elem, this.firstChild ); |
4085 | | - } |
4086 | | - }); |
4087 | | - }, |
4088 | | - |
4089 | | - before: function() { |
4090 | | - if ( this[0] && this[0].parentNode ) { |
4091 | | - return this.domManip(arguments, false, function( elem ) { |
4092 | | - this.parentNode.insertBefore( elem, this ); |
4093 | | - }); |
4094 | | - } else if ( arguments.length ) { |
4095 | | - var set = jQuery(arguments[0]); |
4096 | | - set.push.apply( set, this.toArray() ); |
4097 | | - return this.pushStack( set, "before", arguments ); |
4098 | | - } |
4099 | | - }, |
4100 | | - |
4101 | | - after: function() { |
4102 | | - if ( this[0] && this[0].parentNode ) { |
4103 | | - return this.domManip(arguments, false, function( elem ) { |
4104 | | - this.parentNode.insertBefore( elem, this.nextSibling ); |
4105 | | - }); |
4106 | | - } else if ( arguments.length ) { |
4107 | | - var set = this.pushStack( this, "after", arguments ); |
4108 | | - set.push.apply( set, jQuery(arguments[0]).toArray() ); |
4109 | | - return set; |
4110 | | - } |
4111 | | - }, |
4112 | | - |
4113 | | - // keepData is for internal use only--do not document |
4114 | | - remove: function( selector, keepData ) { |
4115 | | - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { |
4116 | | - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { |
4117 | | - if ( !keepData && elem.nodeType === 1 ) { |
4118 | | - jQuery.cleanData( elem.getElementsByTagName("*") ); |
4119 | | - jQuery.cleanData( [ elem ] ); |
4120 | | - } |
4121 | | - |
4122 | | - if ( elem.parentNode ) { |
4123 | | - elem.parentNode.removeChild( elem ); |
4124 | | - } |
4125 | | - } |
4126 | | - } |
4127 | | - |
4128 | | - return this; |
4129 | | - }, |
4130 | | - |
4131 | | - empty: function() { |
4132 | | - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { |
4133 | | - // Remove element nodes and prevent memory leaks |
4134 | | - if ( elem.nodeType === 1 ) { |
4135 | | - jQuery.cleanData( elem.getElementsByTagName("*") ); |
4136 | | - } |
4137 | | - |
4138 | | - // Remove any remaining nodes |
4139 | | - while ( elem.firstChild ) { |
4140 | | - elem.removeChild( elem.firstChild ); |
4141 | | - } |
4142 | | - } |
4143 | | - |
4144 | | - return this; |
4145 | | - }, |
4146 | | - |
4147 | | - clone: function( events ) { |
4148 | | - // Do the clone |
4149 | | - var ret = this.map(function() { |
4150 | | - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
4151 | | - // IE copies events bound via attachEvent when |
4152 | | - // using cloneNode. Calling detachEvent on the |
4153 | | - // clone will also remove the events from the orignal |
4154 | | - // In order to get around this, we use innerHTML. |
4155 | | - // Unfortunately, this means some modifications to |
4156 | | - // attributes in IE that are actually only stored |
4157 | | - // as properties will not be copied (such as the |
4158 | | - // the name attribute on an input). |
4159 | | - var html = this.outerHTML, ownerDocument = this.ownerDocument; |
4160 | | - if ( !html ) { |
4161 | | - var div = ownerDocument.createElement("div"); |
4162 | | - div.appendChild( this.cloneNode(true) ); |
4163 | | - html = div.innerHTML; |
4164 | | - } |
4165 | | - |
4166 | | - return jQuery.clean([html.replace(rinlinejQuery, "") |
4167 | | - // Handle the case in IE 8 where action=/test/> self-closes a tag |
4168 | | - .replace(/=([^="'>\s]+\/)>/g, '="$1">') |
4169 | | - .replace(rleadingWhitespace, "")], ownerDocument)[0]; |
4170 | | - } else { |
4171 | | - return this.cloneNode(true); |
4172 | | - } |
4173 | | - }); |
4174 | | - |
4175 | | - // Copy the events from the original to the clone |
4176 | | - if ( events === true ) { |
4177 | | - cloneCopyEvent( this, ret ); |
4178 | | - cloneCopyEvent( this.find("*"), ret.find("*") ); |
4179 | | - } |
4180 | | - |
4181 | | - // Return the cloned set |
4182 | | - return ret; |
4183 | | - }, |
4184 | | - |
4185 | | - html: function( value ) { |
4186 | | - if ( value === undefined ) { |
4187 | | - return this[0] && this[0].nodeType === 1 ? |
4188 | | - this[0].innerHTML.replace(rinlinejQuery, "") : |
4189 | | - null; |
4190 | | - |
4191 | | - // See if we can take a shortcut and just use innerHTML |
4192 | | - } else if ( typeof value === "string" && !rnocache.test( value ) && |
4193 | | - (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && |
4194 | | - !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { |
4195 | | - |
4196 | | - value = value.replace(rxhtmlTag, fcloseTag); |
4197 | | - |
4198 | | - try { |
4199 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
4200 | | - // Remove element nodes and prevent memory leaks |
4201 | | - if ( this[i].nodeType === 1 ) { |
4202 | | - jQuery.cleanData( this[i].getElementsByTagName("*") ); |
4203 | | - this[i].innerHTML = value; |
4204 | | - } |
4205 | | - } |
4206 | | - |
4207 | | - // If using innerHTML throws an exception, use the fallback method |
4208 | | - } catch(e) { |
4209 | | - this.empty().append( value ); |
4210 | | - } |
4211 | | - |
4212 | | - } else if ( jQuery.isFunction( value ) ) { |
4213 | | - this.each(function(i){ |
4214 | | - var self = jQuery(this), old = self.html(); |
4215 | | - self.empty().append(function(){ |
4216 | | - return value.call( this, i, old ); |
4217 | | - }); |
4218 | | - }); |
4219 | | - |
4220 | | - } else { |
4221 | | - this.empty().append( value ); |
4222 | | - } |
4223 | | - |
4224 | | - return this; |
4225 | | - }, |
4226 | | - |
4227 | | - replaceWith: function( value ) { |
4228 | | - if ( this[0] && this[0].parentNode ) { |
4229 | | - // Make sure that the elements are removed from the DOM before they are inserted |
4230 | | - // this can help fix replacing a parent with child elements |
4231 | | - if ( jQuery.isFunction( value ) ) { |
4232 | | - return this.each(function(i) { |
4233 | | - var self = jQuery(this), old = self.html(); |
4234 | | - self.replaceWith( value.call( this, i, old ) ); |
4235 | | - }); |
4236 | | - } |
4237 | | - |
4238 | | - if ( typeof value !== "string" ) { |
4239 | | - value = jQuery(value).detach(); |
4240 | | - } |
4241 | | - |
4242 | | - return this.each(function() { |
4243 | | - var next = this.nextSibling, parent = this.parentNode; |
4244 | | - |
4245 | | - jQuery(this).remove(); |
4246 | | - |
4247 | | - if ( next ) { |
4248 | | - jQuery(next).before( value ); |
4249 | | - } else { |
4250 | | - jQuery(parent).append( value ); |
4251 | | - } |
4252 | | - }); |
4253 | | - } else { |
4254 | | - return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); |
4255 | | - } |
4256 | | - }, |
4257 | | - |
4258 | | - detach: function( selector ) { |
4259 | | - return this.remove( selector, true ); |
4260 | | - }, |
4261 | | - |
4262 | | - domManip: function( args, table, callback ) { |
4263 | | - var results, first, value = args[0], scripts = [], fragment, parent; |
4264 | | - |
4265 | | - // We can't cloneNode fragments that contain checked, in WebKit |
4266 | | - if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { |
4267 | | - return this.each(function() { |
4268 | | - jQuery(this).domManip( args, table, callback, true ); |
4269 | | - }); |
4270 | | - } |
4271 | | - |
4272 | | - if ( jQuery.isFunction(value) ) { |
4273 | | - return this.each(function(i) { |
4274 | | - var self = jQuery(this); |
4275 | | - args[0] = value.call(this, i, table ? self.html() : undefined); |
4276 | | - self.domManip( args, table, callback ); |
4277 | | - }); |
4278 | | - } |
4279 | | - |
4280 | | - if ( this[0] ) { |
4281 | | - parent = value && value.parentNode; |
4282 | | - |
4283 | | - // If we're in a fragment, just use that instead of building a new one |
4284 | | - if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { |
4285 | | - results = { fragment: parent }; |
4286 | | - |
4287 | | - } else { |
4288 | | - results = buildFragment( args, this, scripts ); |
4289 | | - } |
4290 | | - |
4291 | | - fragment = results.fragment; |
4292 | | - |
4293 | | - if ( fragment.childNodes.length === 1 ) { |
4294 | | - first = fragment = fragment.firstChild; |
4295 | | - } else { |
4296 | | - first = fragment.firstChild; |
4297 | | - } |
4298 | | - |
4299 | | - if ( first ) { |
4300 | | - table = table && jQuery.nodeName( first, "tr" ); |
4301 | | - |
4302 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
4303 | | - callback.call( |
4304 | | - table ? |
4305 | | - root(this[i], first) : |
4306 | | - this[i], |
4307 | | - i > 0 || results.cacheable || this.length > 1 ? |
4308 | | - fragment.cloneNode(true) : |
4309 | | - fragment |
4310 | | - ); |
4311 | | - } |
4312 | | - } |
4313 | | - |
4314 | | - if ( scripts.length ) { |
4315 | | - jQuery.each( scripts, evalScript ); |
4316 | | - } |
4317 | | - } |
4318 | | - |
4319 | | - return this; |
4320 | | - |
4321 | | - function root( elem, cur ) { |
4322 | | - return jQuery.nodeName(elem, "table") ? |
4323 | | - (elem.getElementsByTagName("tbody")[0] || |
4324 | | - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
4325 | | - elem; |
4326 | | - } |
4327 | | - } |
4328 | | -}); |
4329 | | - |
4330 | | -function cloneCopyEvent(orig, ret) { |
4331 | | - var i = 0; |
4332 | | - |
4333 | | - ret.each(function() { |
4334 | | - if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) { |
4335 | | - return; |
4336 | | - } |
4337 | | - |
4338 | | - var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events; |
4339 | | - |
4340 | | - if ( events ) { |
4341 | | - delete curData.handle; |
4342 | | - curData.events = {}; |
4343 | | - |
4344 | | - for ( var type in events ) { |
4345 | | - for ( var handler in events[ type ] ) { |
4346 | | - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
4347 | | - } |
4348 | | - } |
4349 | | - } |
4350 | | - }); |
4351 | | -} |
4352 | | - |
4353 | | -function buildFragment( args, nodes, scripts ) { |
4354 | | - var fragment, cacheable, cacheresults, |
4355 | | - doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); |
4356 | | - |
4357 | | - // Only cache "small" (1/2 KB) strings that are associated with the main document |
4358 | | - // Cloning options loses the selected state, so don't cache them |
4359 | | - // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment |
4360 | | - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache |
4361 | | - if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && |
4362 | | - !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { |
4363 | | - |
4364 | | - cacheable = true; |
4365 | | - cacheresults = jQuery.fragments[ args[0] ]; |
4366 | | - if ( cacheresults ) { |
4367 | | - if ( cacheresults !== 1 ) { |
4368 | | - fragment = cacheresults; |
4369 | | - } |
4370 | | - } |
4371 | | - } |
4372 | | - |
4373 | | - if ( !fragment ) { |
4374 | | - fragment = doc.createDocumentFragment(); |
4375 | | - jQuery.clean( args, doc, fragment, scripts ); |
4376 | | - } |
4377 | | - |
4378 | | - if ( cacheable ) { |
4379 | | - jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; |
4380 | | - } |
4381 | | - |
4382 | | - return { fragment: fragment, cacheable: cacheable }; |
4383 | | -} |
4384 | | - |
4385 | | -jQuery.fragments = {}; |
4386 | | - |
4387 | | -jQuery.each({ |
4388 | | - appendTo: "append", |
4389 | | - prependTo: "prepend", |
4390 | | - insertBefore: "before", |
4391 | | - insertAfter: "after", |
4392 | | - replaceAll: "replaceWith" |
4393 | | -}, function( name, original ) { |
4394 | | - jQuery.fn[ name ] = function( selector ) { |
4395 | | - var ret = [], insert = jQuery( selector ), |
4396 | | - parent = this.length === 1 && this[0].parentNode; |
4397 | | - |
4398 | | - if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { |
4399 | | - insert[ original ]( this[0] ); |
4400 | | - return this; |
4401 | | - |
4402 | | - } else { |
4403 | | - for ( var i = 0, l = insert.length; i < l; i++ ) { |
4404 | | - var elems = (i > 0 ? this.clone(true) : this).get(); |
4405 | | - jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
4406 | | - ret = ret.concat( elems ); |
4407 | | - } |
4408 | | - |
4409 | | - return this.pushStack( ret, name, insert.selector ); |
4410 | | - } |
4411 | | - }; |
4412 | | -}); |
4413 | | - |
4414 | | -jQuery.extend({ |
4415 | | - clean: function( elems, context, fragment, scripts ) { |
4416 | | - context = context || document; |
4417 | | - |
4418 | | - // !context.createElement fails in IE with an error but returns typeof 'object' |
4419 | | - if ( typeof context.createElement === "undefined" ) { |
4420 | | - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
4421 | | - } |
4422 | | - |
4423 | | - var ret = []; |
4424 | | - |
4425 | | - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { |
4426 | | - if ( typeof elem === "number" ) { |
4427 | | - elem += ""; |
4428 | | - } |
4429 | | - |
4430 | | - if ( !elem ) { |
4431 | | - continue; |
4432 | | - } |
4433 | | - |
4434 | | - // Convert html string into DOM nodes |
4435 | | - if ( typeof elem === "string" && !rhtml.test( elem ) ) { |
4436 | | - elem = context.createTextNode( elem ); |
4437 | | - |
4438 | | - } else if ( typeof elem === "string" ) { |
4439 | | - // Fix "XHTML"-style tags in all browsers |
4440 | | - elem = elem.replace(rxhtmlTag, fcloseTag); |
4441 | | - |
4442 | | - // Trim whitespace, otherwise indexOf won't work as expected |
4443 | | - var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), |
4444 | | - wrap = wrapMap[ tag ] || wrapMap._default, |
4445 | | - depth = wrap[0], |
4446 | | - div = context.createElement("div"); |
4447 | | - |
4448 | | - // Go to html and back, then peel off extra wrappers |
4449 | | - div.innerHTML = wrap[1] + elem + wrap[2]; |
4450 | | - |
4451 | | - // Move to the right depth |
4452 | | - while ( depth-- ) { |
4453 | | - div = div.lastChild; |
4454 | | - } |
4455 | | - |
4456 | | - // Remove IE's autoinserted <tbody> from table fragments |
4457 | | - if ( !jQuery.support.tbody ) { |
4458 | | - |
4459 | | - // String was a <table>, *may* have spurious <tbody> |
4460 | | - var hasBody = rtbody.test(elem), |
4461 | | - tbody = tag === "table" && !hasBody ? |
4462 | | - div.firstChild && div.firstChild.childNodes : |
4463 | | - |
4464 | | - // String was a bare <thead> or <tfoot> |
4465 | | - wrap[1] === "<table>" && !hasBody ? |
4466 | | - div.childNodes : |
4467 | | - []; |
4468 | | - |
4469 | | - for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
4470 | | - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
4471 | | - tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
4472 | | - } |
4473 | | - } |
4474 | | - |
4475 | | - } |
4476 | | - |
4477 | | - // IE completely kills leading whitespace when innerHTML is used |
4478 | | - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
4479 | | - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
4480 | | - } |
4481 | | - |
4482 | | - elem = div.childNodes; |
4483 | | - } |
4484 | | - |
4485 | | - if ( elem.nodeType ) { |
4486 | | - ret.push( elem ); |
4487 | | - } else { |
4488 | | - ret = jQuery.merge( ret, elem ); |
4489 | | - } |
4490 | | - } |
4491 | | - |
4492 | | - if ( fragment ) { |
4493 | | - for ( var i = 0; ret[i]; i++ ) { |
4494 | | - if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
4495 | | - scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
4496 | | - |
4497 | | - } else { |
4498 | | - if ( ret[i].nodeType === 1 ) { |
4499 | | - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
4500 | | - } |
4501 | | - fragment.appendChild( ret[i] ); |
4502 | | - } |
4503 | | - } |
4504 | | - } |
4505 | | - |
4506 | | - return ret; |
4507 | | - }, |
4508 | | - |
4509 | | - cleanData: function( elems ) { |
4510 | | - var data, id, cache = jQuery.cache, |
4511 | | - special = jQuery.event.special, |
4512 | | - deleteExpando = jQuery.support.deleteExpando; |
4513 | | - |
4514 | | - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { |
4515 | | - id = elem[ jQuery.expando ]; |
4516 | | - |
4517 | | - if ( id ) { |
4518 | | - data = cache[ id ]; |
4519 | | - |
4520 | | - if ( data.events ) { |
4521 | | - for ( var type in data.events ) { |
4522 | | - if ( special[ type ] ) { |
4523 | | - jQuery.event.remove( elem, type ); |
4524 | | - |
4525 | | - } else { |
4526 | | - removeEvent( elem, type, data.handle ); |
4527 | | - } |
4528 | | - } |
4529 | | - } |
4530 | | - |
4531 | | - if ( deleteExpando ) { |
4532 | | - delete elem[ jQuery.expando ]; |
4533 | | - |
4534 | | - } else if ( elem.removeAttribute ) { |
4535 | | - elem.removeAttribute( jQuery.expando ); |
4536 | | - } |
4537 | | - |
4538 | | - delete cache[ id ]; |
4539 | | - } |
4540 | | - } |
4541 | | - } |
4542 | | -}); |
4543 | | -// exclude the following css properties to add px |
4544 | | -var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
4545 | | - ralpha = /alpha\([^)]*\)/, |
4546 | | - ropacity = /opacity=([^)]*)/, |
4547 | | - rfloat = /float/i, |
4548 | | - rdashAlpha = /-([a-z])/ig, |
4549 | | - rupper = /([A-Z])/g, |
4550 | | - rnumpx = /^-?\d+(?:px)?$/i, |
4551 | | - rnum = /^-?\d/, |
4552 | | - |
4553 | | - cssShow = { position: "absolute", visibility: "hidden", display:"block" }, |
4554 | | - cssWidth = [ "Left", "Right" ], |
4555 | | - cssHeight = [ "Top", "Bottom" ], |
4556 | | - |
4557 | | - // cache check for defaultView.getComputedStyle |
4558 | | - getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, |
4559 | | - // normalize float css property |
4560 | | - styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", |
4561 | | - fcamelCase = function( all, letter ) { |
4562 | | - return letter.toUpperCase(); |
4563 | | - }; |
4564 | | - |
4565 | | -jQuery.fn.css = function( name, value ) { |
4566 | | - return access( this, name, value, true, function( elem, name, value ) { |
4567 | | - if ( value === undefined ) { |
4568 | | - return jQuery.curCSS( elem, name ); |
4569 | | - } |
4570 | | - |
4571 | | - if ( typeof value === "number" && !rexclude.test(name) ) { |
4572 | | - value += "px"; |
4573 | | - } |
4574 | | - |
4575 | | - jQuery.style( elem, name, value ); |
4576 | | - }); |
4577 | | -}; |
4578 | | - |
4579 | | -jQuery.extend({ |
4580 | | - style: function( elem, name, value ) { |
4581 | | - // don't set styles on text and comment nodes |
4582 | | - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
4583 | | - return undefined; |
4584 | | - } |
4585 | | - |
4586 | | - // ignore negative width and height values #1599 |
4587 | | - if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) { |
4588 | | - value = undefined; |
4589 | | - } |
4590 | | - |
4591 | | - var style = elem.style || elem, set = value !== undefined; |
4592 | | - |
4593 | | - // IE uses filters for opacity |
4594 | | - if ( !jQuery.support.opacity && name === "opacity" ) { |
4595 | | - if ( set ) { |
4596 | | - // IE has trouble with opacity if it does not have layout |
4597 | | - // Force it by setting the zoom level |
4598 | | - style.zoom = 1; |
4599 | | - |
4600 | | - // Set the alpha filter to set the opacity |
4601 | | - var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"; |
4602 | | - var filter = style.filter || jQuery.curCSS( elem, "filter" ) || ""; |
4603 | | - style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity; |
4604 | | - } |
4605 | | - |
4606 | | - return style.filter && style.filter.indexOf("opacity=") >= 0 ? |
4607 | | - (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "": |
4608 | | - ""; |
4609 | | - } |
4610 | | - |
4611 | | - // Make sure we're using the right name for getting the float value |
4612 | | - if ( rfloat.test( name ) ) { |
4613 | | - name = styleFloat; |
4614 | | - } |
4615 | | - |
4616 | | - name = name.replace(rdashAlpha, fcamelCase); |
4617 | | - |
4618 | | - if ( set ) { |
4619 | | - style[ name ] = value; |
4620 | | - } |
4621 | | - |
4622 | | - return style[ name ]; |
4623 | | - }, |
4624 | | - |
4625 | | - css: function( elem, name, force, extra ) { |
4626 | | - if ( name === "width" || name === "height" ) { |
4627 | | - var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight; |
4628 | | - |
4629 | | - function getWH() { |
4630 | | - val = name === "width" ? elem.offsetWidth : elem.offsetHeight; |
4631 | | - |
4632 | | - if ( extra === "border" ) { |
4633 | | - return; |
4634 | | - } |
4635 | | - |
4636 | | - jQuery.each( which, function() { |
4637 | | - if ( !extra ) { |
4638 | | - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
4639 | | - } |
4640 | | - |
4641 | | - if ( extra === "margin" ) { |
4642 | | - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
4643 | | - } else { |
4644 | | - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
4645 | | - } |
4646 | | - }); |
4647 | | - } |
4648 | | - |
4649 | | - if ( elem.offsetWidth !== 0 ) { |
4650 | | - getWH(); |
4651 | | - } else { |
4652 | | - jQuery.swap( elem, props, getWH ); |
4653 | | - } |
4654 | | - |
4655 | | - return Math.max(0, Math.round(val)); |
4656 | | - } |
4657 | | - |
4658 | | - return jQuery.curCSS( elem, name, force ); |
4659 | | - }, |
4660 | | - |
4661 | | - curCSS: function( elem, name, force ) { |
4662 | | - var ret, style = elem.style, filter; |
4663 | | - |
4664 | | - // IE uses filters for opacity |
4665 | | - if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { |
4666 | | - ret = ropacity.test(elem.currentStyle.filter || "") ? |
4667 | | - (parseFloat(RegExp.$1) / 100) + "" : |
4668 | | - ""; |
4669 | | - |
4670 | | - return ret === "" ? |
4671 | | - "1" : |
4672 | | - ret; |
4673 | | - } |
4674 | | - |
4675 | | - // Make sure we're using the right name for getting the float value |
4676 | | - if ( rfloat.test( name ) ) { |
4677 | | - name = styleFloat; |
4678 | | - } |
4679 | | - |
4680 | | - if ( !force && style && style[ name ] ) { |
4681 | | - ret = style[ name ]; |
4682 | | - |
4683 | | - } else if ( getComputedStyle ) { |
4684 | | - |
4685 | | - // Only "float" is needed here |
4686 | | - if ( rfloat.test( name ) ) { |
4687 | | - name = "float"; |
4688 | | - } |
4689 | | - |
4690 | | - name = name.replace( rupper, "-$1" ).toLowerCase(); |
4691 | | - |
4692 | | - var defaultView = elem.ownerDocument.defaultView; |
4693 | | - |
4694 | | - if ( !defaultView ) { |
4695 | | - return null; |
4696 | | - } |
4697 | | - |
4698 | | - var computedStyle = defaultView.getComputedStyle( elem, null ); |
4699 | | - |
4700 | | - if ( computedStyle ) { |
4701 | | - ret = computedStyle.getPropertyValue( name ); |
4702 | | - } |
4703 | | - |
4704 | | - // We should always get a number back from opacity |
4705 | | - if ( name === "opacity" && ret === "" ) { |
4706 | | - ret = "1"; |
4707 | | - } |
4708 | | - |
4709 | | - } else if ( elem.currentStyle ) { |
4710 | | - var camelCase = name.replace(rdashAlpha, fcamelCase); |
4711 | | - |
4712 | | - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
4713 | | - |
4714 | | - // From the awesome hack by Dean Edwards |
4715 | | - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
4716 | | - |
4717 | | - // If we're not dealing with a regular pixel number |
4718 | | - // but a number that has a weird ending, we need to convert it to pixels |
4719 | | - if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { |
4720 | | - // Remember the original values |
4721 | | - var left = style.left, rsLeft = elem.runtimeStyle.left; |
4722 | | - |
4723 | | - // Put in the new values to get a computed value out |
4724 | | - elem.runtimeStyle.left = elem.currentStyle.left; |
4725 | | - style.left = camelCase === "fontSize" ? "1em" : (ret || 0); |
4726 | | - ret = style.pixelLeft + "px"; |
4727 | | - |
4728 | | - // Revert the changed values |
4729 | | - style.left = left; |
4730 | | - elem.runtimeStyle.left = rsLeft; |
4731 | | - } |
4732 | | - } |
4733 | | - |
4734 | | - return ret; |
4735 | | - }, |
4736 | | - |
4737 | | - // A method for quickly swapping in/out CSS properties to get correct calculations |
4738 | | - swap: function( elem, options, callback ) { |
4739 | | - var old = {}; |
4740 | | - |
4741 | | - // Remember the old values, and insert the new ones |
4742 | | - for ( var name in options ) { |
4743 | | - old[ name ] = elem.style[ name ]; |
4744 | | - elem.style[ name ] = options[ name ]; |
4745 | | - } |
4746 | | - |
4747 | | - callback.call( elem ); |
4748 | | - |
4749 | | - // Revert the old values |
4750 | | - for ( var name in options ) { |
4751 | | - elem.style[ name ] = old[ name ]; |
4752 | | - } |
4753 | | - } |
4754 | | -}); |
4755 | | - |
4756 | | -if ( jQuery.expr && jQuery.expr.filters ) { |
4757 | | - jQuery.expr.filters.hidden = function( elem ) { |
4758 | | - var width = elem.offsetWidth, height = elem.offsetHeight, |
4759 | | - skip = elem.nodeName.toLowerCase() === "tr"; |
4760 | | - |
4761 | | - return width === 0 && height === 0 && !skip ? |
4762 | | - true : |
4763 | | - width > 0 && height > 0 && !skip ? |
4764 | | - false : |
4765 | | - jQuery.curCSS(elem, "display") === "none"; |
4766 | | - }; |
4767 | | - |
4768 | | - jQuery.expr.filters.visible = function( elem ) { |
4769 | | - return !jQuery.expr.filters.hidden( elem ); |
4770 | | - }; |
4771 | | -} |
4772 | | -var jsc = now(), |
4773 | | - rscript = /<script(.|\s)*?\/script>/gi, |
4774 | | - rselectTextarea = /select|textarea/i, |
4775 | | - rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, |
4776 | | - jsre = /=\?(&|$)/, |
4777 | | - rquery = /\?/, |
4778 | | - rts = /(\?|&)_=.*?(&|$)/, |
4779 | | - rurl = /^(\w+:)?\/\/([^\/?#]+)/, |
4780 | | - r20 = /%20/g, |
4781 | | - |
4782 | | - // Keep a copy of the old load method |
4783 | | - _load = jQuery.fn.load; |
4784 | | - |
4785 | | -jQuery.fn.extend({ |
4786 | | - load: function( url, params, callback ) { |
4787 | | - if ( typeof url !== "string" ) { |
4788 | | - return _load.call( this, url ); |
4789 | | - |
4790 | | - // Don't do a request if no elements are being requested |
4791 | | - } else if ( !this.length ) { |
4792 | | - return this; |
4793 | | - } |
4794 | | - |
4795 | | - var off = url.indexOf(" "); |
4796 | | - if ( off >= 0 ) { |
4797 | | - var selector = url.slice(off, url.length); |
4798 | | - url = url.slice(0, off); |
4799 | | - } |
4800 | | - |
4801 | | - // Default to a GET request |
4802 | | - var type = "GET"; |
4803 | | - |
4804 | | - // If the second parameter was provided |
4805 | | - if ( params ) { |
4806 | | - // If it's a function |
4807 | | - if ( jQuery.isFunction( params ) ) { |
4808 | | - // We assume that it's the callback |
4809 | | - callback = params; |
4810 | | - params = null; |
4811 | | - |
4812 | | - // Otherwise, build a param string |
4813 | | - } else if ( typeof params === "object" ) { |
4814 | | - params = jQuery.param( params, jQuery.ajaxSettings.traditional ); |
4815 | | - type = "POST"; |
4816 | | - } |
4817 | | - } |
4818 | | - |
4819 | | - var self = this; |
4820 | | - |
4821 | | - // Request the remote document |
4822 | | - jQuery.ajax({ |
4823 | | - url: url, |
4824 | | - type: type, |
4825 | | - dataType: "html", |
4826 | | - data: params, |
4827 | | - complete: function( res, status ) { |
4828 | | - // If successful, inject the HTML into all the matched elements |
4829 | | - if ( status === "success" || status === "notmodified" ) { |
4830 | | - // See if a selector was specified |
4831 | | - self.html( selector ? |
4832 | | - // Create a dummy div to hold the results |
4833 | | - jQuery("<div />") |
4834 | | - // inject the contents of the document in, removing the scripts |
4835 | | - // to avoid any 'Permission Denied' errors in IE |
4836 | | - .append(res.responseText.replace(rscript, "")) |
4837 | | - |
4838 | | - // Locate the specified elements |
4839 | | - .find(selector) : |
4840 | | - |
4841 | | - // If not, just inject the full result |
4842 | | - res.responseText ); |
4843 | | - } |
4844 | | - |
4845 | | - if ( callback ) { |
4846 | | - self.each( callback, [res.responseText, status, res] ); |
4847 | | - } |
4848 | | - } |
4849 | | - }); |
4850 | | - |
4851 | | - return this; |
4852 | | - }, |
4853 | | - |
4854 | | - serialize: function() { |
4855 | | - return jQuery.param(this.serializeArray()); |
4856 | | - }, |
4857 | | - serializeArray: function() { |
4858 | | - return this.map(function() { |
4859 | | - return this.elements ? jQuery.makeArray(this.elements) : this; |
4860 | | - }) |
4861 | | - .filter(function() { |
4862 | | - return this.name && !this.disabled && |
4863 | | - (this.checked || rselectTextarea.test(this.nodeName) || |
4864 | | - rinput.test(this.type)); |
4865 | | - }) |
4866 | | - .map(function( i, elem ) { |
4867 | | - var val = jQuery(this).val(); |
4868 | | - |
4869 | | - return val == null ? |
4870 | | - null : |
4871 | | - jQuery.isArray(val) ? |
4872 | | - jQuery.map( val, function( val, i ) { |
4873 | | - return { name: elem.name, value: val }; |
4874 | | - }) : |
4875 | | - { name: elem.name, value: val }; |
4876 | | - }).get(); |
4877 | | - } |
4878 | | -}); |
4879 | | - |
4880 | | -// Attach a bunch of functions for handling common AJAX events |
4881 | | -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) { |
4882 | | - jQuery.fn[o] = function( f ) { |
4883 | | - return this.bind(o, f); |
4884 | | - }; |
4885 | | -}); |
4886 | | - |
4887 | | -jQuery.extend({ |
4888 | | - |
4889 | | - get: function( url, data, callback, type ) { |
4890 | | - // shift arguments if data argument was omited |
4891 | | - if ( jQuery.isFunction( data ) ) { |
4892 | | - type = type || callback; |
4893 | | - callback = data; |
4894 | | - data = null; |
4895 | | - } |
4896 | | - |
4897 | | - return jQuery.ajax({ |
4898 | | - type: "GET", |
4899 | | - url: url, |
4900 | | - data: data, |
4901 | | - success: callback, |
4902 | | - dataType: type |
4903 | | - }); |
4904 | | - }, |
4905 | | - |
4906 | | - getScript: function( url, callback ) { |
4907 | | - return jQuery.get(url, null, callback, "script"); |
4908 | | - }, |
4909 | | - |
4910 | | - getJSON: function( url, data, callback ) { |
4911 | | - return jQuery.get(url, data, callback, "json"); |
4912 | | - }, |
4913 | | - |
4914 | | - post: function( url, data, callback, type ) { |
4915 | | - // shift arguments if data argument was omited |
4916 | | - if ( jQuery.isFunction( data ) ) { |
4917 | | - type = type || callback; |
4918 | | - callback = data; |
4919 | | - data = {}; |
4920 | | - } |
4921 | | - |
4922 | | - return jQuery.ajax({ |
4923 | | - type: "POST", |
4924 | | - url: url, |
4925 | | - data: data, |
4926 | | - success: callback, |
4927 | | - dataType: type |
4928 | | - }); |
4929 | | - }, |
4930 | | - |
4931 | | - ajaxSetup: function( settings ) { |
4932 | | - jQuery.extend( jQuery.ajaxSettings, settings ); |
4933 | | - }, |
4934 | | - |
4935 | | - ajaxSettings: { |
4936 | | - url: location.href, |
4937 | | - global: true, |
4938 | | - type: "GET", |
4939 | | - contentType: "application/x-www-form-urlencoded", |
4940 | | - processData: true, |
4941 | | - async: true, |
4942 | | - /* |
4943 | | - timeout: 0, |
4944 | | - data: null, |
4945 | | - username: null, |
4946 | | - password: null, |
4947 | | - traditional: false, |
4948 | | - */ |
4949 | | - // Create the request object; Microsoft failed to properly |
4950 | | - // implement the XMLHttpRequest in IE7 (can't request local files), |
4951 | | - // so we use the ActiveXObject when it is available |
4952 | | - // This function can be overriden by calling jQuery.ajaxSetup |
4953 | | - xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? |
4954 | | - function() { |
4955 | | - return new window.XMLHttpRequest(); |
4956 | | - } : |
4957 | | - function() { |
4958 | | - try { |
4959 | | - return new window.ActiveXObject("Microsoft.XMLHTTP"); |
4960 | | - } catch(e) {} |
4961 | | - }, |
4962 | | - accepts: { |
4963 | | - xml: "application/xml, text/xml", |
4964 | | - html: "text/html", |
4965 | | - script: "text/javascript, application/javascript", |
4966 | | - json: "application/json, text/javascript", |
4967 | | - text: "text/plain", |
4968 | | - _default: "*/*" |
4969 | | - } |
4970 | | - }, |
4971 | | - |
4972 | | - // Last-Modified header cache for next request |
4973 | | - lastModified: {}, |
4974 | | - etag: {}, |
4975 | | - |
4976 | | - ajax: function( origSettings ) { |
4977 | | - var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings); |
4978 | | - |
4979 | | - var jsonp, status, data, |
4980 | | - callbackContext = origSettings && origSettings.context || s, |
4981 | | - type = s.type.toUpperCase(); |
4982 | | - |
4983 | | - // convert data if not already a string |
4984 | | - if ( s.data && s.processData && typeof s.data !== "string" ) { |
4985 | | - s.data = jQuery.param( s.data, s.traditional ); |
4986 | | - } |
4987 | | - |
4988 | | - // Handle JSONP Parameter Callbacks |
4989 | | - if ( s.dataType === "jsonp" ) { |
4990 | | - if ( type === "GET" ) { |
4991 | | - if ( !jsre.test( s.url ) ) { |
4992 | | - s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
4993 | | - } |
4994 | | - } else if ( !s.data || !jsre.test(s.data) ) { |
4995 | | - s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
4996 | | - } |
4997 | | - s.dataType = "json"; |
4998 | | - } |
4999 | | - |
5000 | | - // Build temporary JSONP function |
5001 | | - if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) { |
5002 | | - jsonp = s.jsonpCallback || ("jsonp" + jsc++); |
5003 | | - |
5004 | | - // Replace the =? sequence both in the query string and the data |
5005 | | - if ( s.data ) { |
5006 | | - s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
5007 | | - } |
5008 | | - |
5009 | | - s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
5010 | | - |
5011 | | - // We need to make sure |
5012 | | - // that a JSONP style response is executed properly |
5013 | | - s.dataType = "script"; |
5014 | | - |
5015 | | - // Handle JSONP-style loading |
5016 | | - window[ jsonp ] = window[ jsonp ] || function( tmp ) { |
5017 | | - data = tmp; |
5018 | | - success(); |
5019 | | - complete(); |
5020 | | - // Garbage collect |
5021 | | - window[ jsonp ] = undefined; |
5022 | | - |
5023 | | - try { |
5024 | | - delete window[ jsonp ]; |
5025 | | - } catch(e) {} |
5026 | | - |
5027 | | - if ( head ) { |
5028 | | - head.removeChild( script ); |
5029 | | - } |
5030 | | - }; |
5031 | | - } |
5032 | | - |
5033 | | - if ( s.dataType === "script" && s.cache === null ) { |
5034 | | - s.cache = false; |
5035 | | - } |
5036 | | - |
5037 | | - if ( s.cache === false && type === "GET" ) { |
5038 | | - var ts = now(); |
5039 | | - |
5040 | | - // try replacing _= if it is there |
5041 | | - var ret = s.url.replace(rts, "$1_=" + ts + "$2"); |
5042 | | - |
5043 | | - // if nothing was replaced, add timestamp to the end |
5044 | | - s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); |
5045 | | - } |
5046 | | - |
5047 | | - // If data is available, append data to url for get requests |
5048 | | - if ( s.data && type === "GET" ) { |
5049 | | - s.url += (rquery.test(s.url) ? "&" : "?") + s.data; |
5050 | | - } |
5051 | | - |
5052 | | - // Watch for a new set of requests |
5053 | | - if ( s.global && ! jQuery.active++ ) { |
5054 | | - jQuery.event.trigger( "ajaxStart" ); |
5055 | | - } |
5056 | | - |
5057 | | - // Matches an absolute URL, and saves the domain |
5058 | | - var parts = rurl.exec( s.url ), |
5059 | | - remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host); |
5060 | | - |
5061 | | - // If we're requesting a remote document |
5062 | | - // and trying to load JSON or Script with a GET |
5063 | | - if ( s.dataType === "script" && type === "GET" && remote ) { |
5064 | | - var head = document.getElementsByTagName("head")[0] || document.documentElement; |
5065 | | - var script = document.createElement("script"); |
5066 | | - script.src = s.url; |
5067 | | - if ( s.scriptCharset ) { |
5068 | | - script.charset = s.scriptCharset; |
5069 | | - } |
5070 | | - |
5071 | | - // Handle Script loading |
5072 | | - if ( !jsonp ) { |
5073 | | - var done = false; |
5074 | | - |
5075 | | - // Attach handlers for all browsers |
5076 | | - script.onload = script.onreadystatechange = function() { |
5077 | | - if ( !done && (!this.readyState || |
5078 | | - this.readyState === "loaded" || this.readyState === "complete") ) { |
5079 | | - done = true; |
5080 | | - success(); |
5081 | | - complete(); |
5082 | | - |
5083 | | - // Handle memory leak in IE |
5084 | | - script.onload = script.onreadystatechange = null; |
5085 | | - if ( head && script.parentNode ) { |
5086 | | - head.removeChild( script ); |
5087 | | - } |
5088 | | - } |
5089 | | - }; |
5090 | | - } |
5091 | | - |
5092 | | - // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
5093 | | - // This arises when a base node is used (#2709 and #4378). |
5094 | | - head.insertBefore( script, head.firstChild ); |
5095 | | - |
5096 | | - // We handle everything using the script element injection |
5097 | | - return undefined; |
5098 | | - } |
5099 | | - |
5100 | | - var requestDone = false; |
5101 | | - |
5102 | | - // Create the request object |
5103 | | - var xhr = s.xhr(); |
5104 | | - |
5105 | | - if ( !xhr ) { |
5106 | | - return; |
5107 | | - } |
5108 | | - |
5109 | | - // Open the socket |
5110 | | - // Passing null username, generates a login popup on Opera (#2865) |
5111 | | - if ( s.username ) { |
5112 | | - xhr.open(type, s.url, s.async, s.username, s.password); |
5113 | | - } else { |
5114 | | - xhr.open(type, s.url, s.async); |
5115 | | - } |
5116 | | - |
5117 | | - // Need an extra try/catch for cross domain requests in Firefox 3 |
5118 | | - try { |
5119 | | - // Set the correct header, if data is being sent |
5120 | | - if ( s.data || origSettings && origSettings.contentType ) { |
5121 | | - xhr.setRequestHeader("Content-Type", s.contentType); |
5122 | | - } |
5123 | | - |
5124 | | - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
5125 | | - if ( s.ifModified ) { |
5126 | | - if ( jQuery.lastModified[s.url] ) { |
5127 | | - xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); |
5128 | | - } |
5129 | | - |
5130 | | - if ( jQuery.etag[s.url] ) { |
5131 | | - xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); |
5132 | | - } |
5133 | | - } |
5134 | | - |
5135 | | - // Set header so the called script knows that it's an XMLHttpRequest |
5136 | | - // Only send the header if it's not a remote XHR |
5137 | | - if ( !remote ) { |
5138 | | - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
5139 | | - } |
5140 | | - |
5141 | | - // Set the Accepts header for the server, depending on the dataType |
5142 | | - xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
5143 | | - s.accepts[ s.dataType ] + ", */*" : |
5144 | | - s.accepts._default ); |
5145 | | - } catch(e) {} |
5146 | | - |
5147 | | - // Allow custom headers/mimetypes and early abort |
5148 | | - if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { |
5149 | | - // Handle the global AJAX counter |
5150 | | - if ( s.global && ! --jQuery.active ) { |
5151 | | - jQuery.event.trigger( "ajaxStop" ); |
5152 | | - } |
5153 | | - |
5154 | | - // close opended socket |
5155 | | - xhr.abort(); |
5156 | | - return false; |
5157 | | - } |
5158 | | - |
5159 | | - if ( s.global ) { |
5160 | | - trigger("ajaxSend", [xhr, s]); |
5161 | | - } |
5162 | | - |
5163 | | - // Wait for a response to come back |
5164 | | - var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) { |
5165 | | - // The request was aborted |
5166 | | - if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) { |
5167 | | - // Opera doesn't call onreadystatechange before this point |
5168 | | - // so we simulate the call |
5169 | | - if ( !requestDone ) { |
5170 | | - complete(); |
5171 | | - } |
5172 | | - |
5173 | | - requestDone = true; |
5174 | | - if ( xhr ) { |
5175 | | - xhr.onreadystatechange = jQuery.noop; |
5176 | | - } |
5177 | | - |
5178 | | - // The transfer is complete and the data is available, or the request timed out |
5179 | | - } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { |
5180 | | - requestDone = true; |
5181 | | - xhr.onreadystatechange = jQuery.noop; |
5182 | | - |
5183 | | - status = isTimeout === "timeout" ? |
5184 | | - "timeout" : |
5185 | | - !jQuery.httpSuccess( xhr ) ? |
5186 | | - "error" : |
5187 | | - s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? |
5188 | | - "notmodified" : |
5189 | | - "success"; |
5190 | | - |
5191 | | - var errMsg; |
5192 | | - |
5193 | | - if ( status === "success" ) { |
5194 | | - // Watch for, and catch, XML document parse errors |
5195 | | - try { |
5196 | | - // process the data (runs the xml through httpData regardless of callback) |
5197 | | - data = jQuery.httpData( xhr, s.dataType, s ); |
5198 | | - } catch(err) { |
5199 | | - status = "parsererror"; |
5200 | | - errMsg = err; |
5201 | | - } |
5202 | | - } |
5203 | | - |
5204 | | - // Make sure that the request was successful or notmodified |
5205 | | - if ( status === "success" || status === "notmodified" ) { |
5206 | | - // JSONP handles its own success callback |
5207 | | - if ( !jsonp ) { |
5208 | | - success(); |
5209 | | - } |
5210 | | - } else { |
5211 | | - jQuery.handleError(s, xhr, status, errMsg); |
5212 | | - } |
5213 | | - |
5214 | | - // Fire the complete handlers |
5215 | | - complete(); |
5216 | | - |
5217 | | - if ( isTimeout === "timeout" ) { |
5218 | | - xhr.abort(); |
5219 | | - } |
5220 | | - |
5221 | | - // Stop memory leaks |
5222 | | - if ( s.async ) { |
5223 | | - xhr = null; |
5224 | | - } |
5225 | | - } |
5226 | | - }; |
5227 | | - |
5228 | | - // Override the abort handler, if we can (IE doesn't allow it, but that's OK) |
5229 | | - // Opera doesn't fire onreadystatechange at all on abort |
5230 | | - try { |
5231 | | - var oldAbort = xhr.abort; |
5232 | | - xhr.abort = function() { |
5233 | | - if ( xhr ) { |
5234 | | - oldAbort.call( xhr ); |
5235 | | - } |
5236 | | - |
5237 | | - onreadystatechange( "abort" ); |
5238 | | - }; |
5239 | | - } catch(e) { } |
5240 | | - |
5241 | | - // Timeout checker |
5242 | | - if ( s.async && s.timeout > 0 ) { |
5243 | | - setTimeout(function() { |
5244 | | - // Check to see if the request is still happening |
5245 | | - if ( xhr && !requestDone ) { |
5246 | | - onreadystatechange( "timeout" ); |
5247 | | - } |
5248 | | - }, s.timeout); |
5249 | | - } |
5250 | | - |
5251 | | - // Send the data |
5252 | | - try { |
5253 | | - xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); |
5254 | | - } catch(e) { |
5255 | | - jQuery.handleError(s, xhr, null, e); |
5256 | | - // Fire the complete handlers |
5257 | | - complete(); |
5258 | | - } |
5259 | | - |
5260 | | - // firefox 1.5 doesn't fire statechange for sync requests |
5261 | | - if ( !s.async ) { |
5262 | | - onreadystatechange(); |
5263 | | - } |
5264 | | - |
5265 | | - function success() { |
5266 | | - // If a local callback was specified, fire it and pass it the data |
5267 | | - if ( s.success ) { |
5268 | | - s.success.call( callbackContext, data, status, xhr ); |
5269 | | - } |
5270 | | - |
5271 | | - // Fire the global callback |
5272 | | - if ( s.global ) { |
5273 | | - trigger( "ajaxSuccess", [xhr, s] ); |
5274 | | - } |
5275 | | - } |
5276 | | - |
5277 | | - function complete() { |
5278 | | - // Process result |
5279 | | - if ( s.complete ) { |
5280 | | - s.complete.call( callbackContext, xhr, status); |
5281 | | - } |
5282 | | - |
5283 | | - // The request was completed |
5284 | | - if ( s.global ) { |
5285 | | - trigger( "ajaxComplete", [xhr, s] ); |
5286 | | - } |
5287 | | - |
5288 | | - // Handle the global AJAX counter |
5289 | | - if ( s.global && ! --jQuery.active ) { |
5290 | | - jQuery.event.trigger( "ajaxStop" ); |
5291 | | - } |
5292 | | - } |
5293 | | - |
5294 | | - function trigger(type, args) { |
5295 | | - (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); |
5296 | | - } |
5297 | | - |
5298 | | - // return XMLHttpRequest to allow aborting the request etc. |
5299 | | - return xhr; |
5300 | | - }, |
5301 | | - |
5302 | | - handleError: function( s, xhr, status, e ) { |
5303 | | - // If a local callback was specified, fire it |
5304 | | - if ( s.error ) { |
5305 | | - s.error.call( s.context || s, xhr, status, e ); |
5306 | | - } |
5307 | | - |
5308 | | - // Fire the global callback |
5309 | | - if ( s.global ) { |
5310 | | - (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] ); |
5311 | | - } |
5312 | | - }, |
5313 | | - |
5314 | | - // Counter for holding the number of active queries |
5315 | | - active: 0, |
5316 | | - |
5317 | | - // Determines if an XMLHttpRequest was successful or not |
5318 | | - httpSuccess: function( xhr ) { |
5319 | | - try { |
5320 | | - // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
5321 | | - return !xhr.status && location.protocol === "file:" || |
5322 | | - // Opera returns 0 when status is 304 |
5323 | | - ( xhr.status >= 200 && xhr.status < 300 ) || |
5324 | | - xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; |
5325 | | - } catch(e) {} |
5326 | | - |
5327 | | - return false; |
5328 | | - }, |
5329 | | - |
5330 | | - // Determines if an XMLHttpRequest returns NotModified |
5331 | | - httpNotModified: function( xhr, url ) { |
5332 | | - var lastModified = xhr.getResponseHeader("Last-Modified"), |
5333 | | - etag = xhr.getResponseHeader("Etag"); |
5334 | | - |
5335 | | - if ( lastModified ) { |
5336 | | - jQuery.lastModified[url] = lastModified; |
5337 | | - } |
5338 | | - |
5339 | | - if ( etag ) { |
5340 | | - jQuery.etag[url] = etag; |
5341 | | - } |
5342 | | - |
5343 | | - // Opera returns 0 when status is 304 |
5344 | | - return xhr.status === 304 || xhr.status === 0; |
5345 | | - }, |
5346 | | - |
5347 | | - httpData: function( xhr, type, s ) { |
5348 | | - var ct = xhr.getResponseHeader("content-type") || "", |
5349 | | - xml = type === "xml" || !type && ct.indexOf("xml") >= 0, |
5350 | | - data = xml ? xhr.responseXML : xhr.responseText; |
5351 | | - |
5352 | | - if ( xml && data.documentElement.nodeName === "parsererror" ) { |
5353 | | - jQuery.error( "parsererror" ); |
5354 | | - } |
5355 | | - |
5356 | | - // Allow a pre-filtering function to sanitize the response |
5357 | | - // s is checked to keep backwards compatibility |
5358 | | - if ( s && s.dataFilter ) { |
5359 | | - data = s.dataFilter( data, type ); |
5360 | | - } |
5361 | | - |
5362 | | - // The filter can actually parse the response |
5363 | | - if ( typeof data === "string" ) { |
5364 | | - // Get the JavaScript object, if JSON is used. |
5365 | | - if ( type === "json" || !type && ct.indexOf("json") >= 0 ) { |
5366 | | - data = jQuery.parseJSON( data ); |
5367 | | - |
5368 | | - // If the type is "script", eval it in global context |
5369 | | - } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) { |
5370 | | - jQuery.globalEval( data ); |
5371 | | - } |
5372 | | - } |
5373 | | - |
5374 | | - return data; |
5375 | | - }, |
5376 | | - |
5377 | | - // Serialize an array of form elements or a set of |
5378 | | - // key/values into a query string |
5379 | | - param: function( a, traditional ) { |
5380 | | - var s = []; |
5381 | | - |
5382 | | - // Set traditional to true for jQuery <= 1.3.2 behavior. |
5383 | | - if ( traditional === undefined ) { |
5384 | | - traditional = jQuery.ajaxSettings.traditional; |
5385 | | - } |
5386 | | - |
5387 | | - // If an array was passed in, assume that it is an array of form elements. |
5388 | | - if ( jQuery.isArray(a) || a.jquery ) { |
5389 | | - // Serialize the form elements |
5390 | | - jQuery.each( a, function() { |
5391 | | - add( this.name, this.value ); |
5392 | | - }); |
5393 | | - |
5394 | | - } else { |
5395 | | - // If traditional, encode the "old" way (the way 1.3.2 or older |
5396 | | - // did it), otherwise encode params recursively. |
5397 | | - for ( var prefix in a ) { |
5398 | | - buildParams( prefix, a[prefix] ); |
5399 | | - } |
5400 | | - } |
5401 | | - |
5402 | | - // Return the resulting serialization |
5403 | | - return s.join("&").replace(r20, "+"); |
5404 | | - |
5405 | | - function buildParams( prefix, obj ) { |
5406 | | - if ( jQuery.isArray(obj) ) { |
5407 | | - // Serialize array item. |
5408 | | - jQuery.each( obj, function( i, v ) { |
5409 | | - if ( traditional || /\[\]$/.test( prefix ) ) { |
5410 | | - // Treat each array item as a scalar. |
5411 | | - add( prefix, v ); |
5412 | | - } else { |
5413 | | - // If array item is non-scalar (array or object), encode its |
5414 | | - // numeric index to resolve deserialization ambiguity issues. |
5415 | | - // Note that rack (as of 1.0.0) can't currently deserialize |
5416 | | - // nested arrays properly, and attempting to do so may cause |
5417 | | - // a server error. Possible fixes are to modify rack's |
5418 | | - // deserialization algorithm or to provide an option or flag |
5419 | | - // to force array serialization to be shallow. |
5420 | | - buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); |
5421 | | - } |
5422 | | - }); |
5423 | | - |
5424 | | - } else if ( !traditional && obj != null && typeof obj === "object" ) { |
5425 | | - // Serialize object item. |
5426 | | - jQuery.each( obj, function( k, v ) { |
5427 | | - buildParams( prefix + "[" + k + "]", v ); |
5428 | | - }); |
5429 | | - |
5430 | | - } else { |
5431 | | - // Serialize scalar item. |
5432 | | - add( prefix, obj ); |
5433 | | - } |
5434 | | - } |
5435 | | - |
5436 | | - function add( key, value ) { |
5437 | | - // If value is a function, invoke it and return its value |
5438 | | - value = jQuery.isFunction(value) ? value() : value; |
5439 | | - s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); |
5440 | | - } |
5441 | | - } |
5442 | | -}); |
5443 | | -var elemdisplay = {}, |
5444 | | - rfxtypes = /toggle|show|hide/, |
5445 | | - rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/, |
5446 | | - timerId, |
5447 | | - fxAttrs = [ |
5448 | | - // height animations |
5449 | | - [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
5450 | | - // width animations |
5451 | | - [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
5452 | | - // opacity animations |
5453 | | - [ "opacity" ] |
5454 | | - ]; |
5455 | | - |
5456 | | -jQuery.fn.extend({ |
5457 | | - show: function( speed, callback ) { |
5458 | | - if ( speed || speed === 0) { |
5459 | | - return this.animate( genFx("show", 3), speed, callback); |
5460 | | - |
5461 | | - } else { |
5462 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
5463 | | - var old = jQuery.data(this[i], "olddisplay"); |
5464 | | - |
5465 | | - this[i].style.display = old || ""; |
5466 | | - |
5467 | | - if ( jQuery.css(this[i], "display") === "none" ) { |
5468 | | - var nodeName = this[i].nodeName, display; |
5469 | | - |
5470 | | - if ( elemdisplay[ nodeName ] ) { |
5471 | | - display = elemdisplay[ nodeName ]; |
5472 | | - |
5473 | | - } else { |
5474 | | - var elem = jQuery("<" + nodeName + " />").appendTo("body"); |
5475 | | - |
5476 | | - display = elem.css("display"); |
5477 | | - |
5478 | | - if ( display === "none" ) { |
5479 | | - display = "block"; |
5480 | | - } |
5481 | | - |
5482 | | - elem.remove(); |
5483 | | - |
5484 | | - elemdisplay[ nodeName ] = display; |
5485 | | - } |
5486 | | - |
5487 | | - jQuery.data(this[i], "olddisplay", display); |
5488 | | - } |
5489 | | - } |
5490 | | - |
5491 | | - // Set the display of the elements in a second loop |
5492 | | - // to avoid the constant reflow |
5493 | | - for ( var j = 0, k = this.length; j < k; j++ ) { |
5494 | | - this[j].style.display = jQuery.data(this[j], "olddisplay") || ""; |
5495 | | - } |
5496 | | - |
5497 | | - return this; |
5498 | | - } |
5499 | | - }, |
5500 | | - |
5501 | | - hide: function( speed, callback ) { |
5502 | | - if ( speed || speed === 0 ) { |
5503 | | - return this.animate( genFx("hide", 3), speed, callback); |
5504 | | - |
5505 | | - } else { |
5506 | | - for ( var i = 0, l = this.length; i < l; i++ ) { |
5507 | | - var old = jQuery.data(this[i], "olddisplay"); |
5508 | | - if ( !old && old !== "none" ) { |
5509 | | - jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); |
5510 | | - } |
5511 | | - } |
5512 | | - |
5513 | | - // Set the display of the elements in a second loop |
5514 | | - // to avoid the constant reflow |
5515 | | - for ( var j = 0, k = this.length; j < k; j++ ) { |
5516 | | - this[j].style.display = "none"; |
5517 | | - } |
5518 | | - |
5519 | | - return this; |
5520 | | - } |
5521 | | - }, |
5522 | | - |
5523 | | - // Save the old toggle function |
5524 | | - _toggle: jQuery.fn.toggle, |
5525 | | - |
5526 | | - toggle: function( fn, fn2 ) { |
5527 | | - var bool = typeof fn === "boolean"; |
5528 | | - |
5529 | | - if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { |
5530 | | - this._toggle.apply( this, arguments ); |
5531 | | - |
5532 | | - } else if ( fn == null || bool ) { |
5533 | | - this.each(function() { |
5534 | | - var state = bool ? fn : jQuery(this).is(":hidden"); |
5535 | | - jQuery(this)[ state ? "show" : "hide" ](); |
5536 | | - }); |
5537 | | - |
5538 | | - } else { |
5539 | | - this.animate(genFx("toggle", 3), fn, fn2); |
5540 | | - } |
5541 | | - |
5542 | | - return this; |
5543 | | - }, |
5544 | | - |
5545 | | - fadeTo: function( speed, to, callback ) { |
5546 | | - return this.filter(":hidden").css("opacity", 0).show().end() |
5547 | | - .animate({opacity: to}, speed, callback); |
5548 | | - }, |
5549 | | - |
5550 | | - animate: function( prop, speed, easing, callback ) { |
5551 | | - var optall = jQuery.speed(speed, easing, callback); |
5552 | | - |
5553 | | - if ( jQuery.isEmptyObject( prop ) ) { |
5554 | | - return this.each( optall.complete ); |
5555 | | - } |
5556 | | - |
5557 | | - return this[ optall.queue === false ? "each" : "queue" ](function() { |
5558 | | - var opt = jQuery.extend({}, optall), p, |
5559 | | - hidden = this.nodeType === 1 && jQuery(this).is(":hidden"), |
5560 | | - self = this; |
5561 | | - |
5562 | | - for ( p in prop ) { |
5563 | | - var name = p.replace(rdashAlpha, fcamelCase); |
5564 | | - |
5565 | | - if ( p !== name ) { |
5566 | | - prop[ name ] = prop[ p ]; |
5567 | | - delete prop[ p ]; |
5568 | | - p = name; |
5569 | | - } |
5570 | | - |
5571 | | - if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { |
5572 | | - return opt.complete.call(this); |
5573 | | - } |
5574 | | - |
5575 | | - if ( ( p === "height" || p === "width" ) && this.style ) { |
5576 | | - // Store display property |
5577 | | - opt.display = jQuery.css(this, "display"); |
5578 | | - |
5579 | | - // Make sure that nothing sneaks out |
5580 | | - opt.overflow = this.style.overflow; |
5581 | | - } |
5582 | | - |
5583 | | - if ( jQuery.isArray( prop[p] ) ) { |
5584 | | - // Create (if needed) and add to specialEasing |
5585 | | - (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; |
5586 | | - prop[p] = prop[p][0]; |
5587 | | - } |
5588 | | - } |
5589 | | - |
5590 | | - if ( opt.overflow != null ) { |
5591 | | - this.style.overflow = "hidden"; |
5592 | | - } |
5593 | | - |
5594 | | - opt.curAnim = jQuery.extend({}, prop); |
5595 | | - |
5596 | | - jQuery.each( prop, function( name, val ) { |
5597 | | - var e = new jQuery.fx( self, opt, name ); |
5598 | | - |
5599 | | - if ( rfxtypes.test(val) ) { |
5600 | | - e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
5601 | | - |
5602 | | - } else { |
5603 | | - var parts = rfxnum.exec(val), |
5604 | | - start = e.cur(true) || 0; |
5605 | | - |
5606 | | - if ( parts ) { |
5607 | | - var end = parseFloat( parts[2] ), |
5608 | | - unit = parts[3] || "px"; |
5609 | | - |
5610 | | - // We need to compute starting value |
5611 | | - if ( unit !== "px" ) { |
5612 | | - self.style[ name ] = (end || 1) + unit; |
5613 | | - start = ((end || 1) / e.cur(true)) * start; |
5614 | | - self.style[ name ] = start + unit; |
5615 | | - } |
5616 | | - |
5617 | | - // If a +=/-= token was provided, we're doing a relative animation |
5618 | | - if ( parts[1] ) { |
5619 | | - end = ((parts[1] === "-=" ? -1 : 1) * end) + start; |
5620 | | - } |
5621 | | - |
5622 | | - e.custom( start, end, unit ); |
5623 | | - |
5624 | | - } else { |
5625 | | - e.custom( start, val, "" ); |
5626 | | - } |
5627 | | - } |
5628 | | - }); |
5629 | | - |
5630 | | - // For JS strict compliance |
5631 | | - return true; |
5632 | | - }); |
5633 | | - }, |
5634 | | - |
5635 | | - stop: function( clearQueue, gotoEnd ) { |
5636 | | - var timers = jQuery.timers; |
5637 | | - |
5638 | | - if ( clearQueue ) { |
5639 | | - this.queue([]); |
5640 | | - } |
5641 | | - |
5642 | | - this.each(function() { |
5643 | | - // go in reverse order so anything added to the queue during the loop is ignored |
5644 | | - for ( var i = timers.length - 1; i >= 0; i-- ) { |
5645 | | - if ( timers[i].elem === this ) { |
5646 | | - if (gotoEnd) { |
5647 | | - // force the next step to be the last |
5648 | | - timers[i](true); |
5649 | | - } |
5650 | | - |
5651 | | - timers.splice(i, 1); |
5652 | | - } |
5653 | | - } |
5654 | | - }); |
5655 | | - |
5656 | | - // start the next in the queue if the last step wasn't forced |
5657 | | - if ( !gotoEnd ) { |
5658 | | - this.dequeue(); |
5659 | | - } |
5660 | | - |
5661 | | - return this; |
5662 | | - } |
5663 | | - |
5664 | | -}); |
5665 | | - |
5666 | | -// Generate shortcuts for custom animations |
5667 | | -jQuery.each({ |
5668 | | - slideDown: genFx("show", 1), |
5669 | | - slideUp: genFx("hide", 1), |
5670 | | - slideToggle: genFx("toggle", 1), |
5671 | | - fadeIn: { opacity: "show" }, |
5672 | | - fadeOut: { opacity: "hide" } |
5673 | | -}, function( name, props ) { |
5674 | | - jQuery.fn[ name ] = function( speed, callback ) { |
5675 | | - return this.animate( props, speed, callback ); |
5676 | | - }; |
5677 | | -}); |
5678 | | - |
5679 | | -jQuery.extend({ |
5680 | | - speed: function( speed, easing, fn ) { |
5681 | | - var opt = speed && typeof speed === "object" ? speed : { |
5682 | | - complete: fn || !fn && easing || |
5683 | | - jQuery.isFunction( speed ) && speed, |
5684 | | - duration: speed, |
5685 | | - easing: fn && easing || easing && !jQuery.isFunction(easing) && easing |
5686 | | - }; |
5687 | | - |
5688 | | - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
5689 | | - jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; |
5690 | | - |
5691 | | - // Queueing |
5692 | | - opt.old = opt.complete; |
5693 | | - opt.complete = function() { |
5694 | | - if ( opt.queue !== false ) { |
5695 | | - jQuery(this).dequeue(); |
5696 | | - } |
5697 | | - if ( jQuery.isFunction( opt.old ) ) { |
5698 | | - opt.old.call( this ); |
5699 | | - } |
5700 | | - }; |
5701 | | - |
5702 | | - return opt; |
5703 | | - }, |
5704 | | - |
5705 | | - easing: { |
5706 | | - linear: function( p, n, firstNum, diff ) { |
5707 | | - return firstNum + diff * p; |
5708 | | - }, |
5709 | | - swing: function( p, n, firstNum, diff ) { |
5710 | | - return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
5711 | | - } |
5712 | | - }, |
5713 | | - |
5714 | | - timers: [], |
5715 | | - |
5716 | | - fx: function( elem, options, prop ) { |
5717 | | - this.options = options; |
5718 | | - this.elem = elem; |
5719 | | - this.prop = prop; |
5720 | | - |
5721 | | - if ( !options.orig ) { |
5722 | | - options.orig = {}; |
5723 | | - } |
5724 | | - } |
5725 | | - |
5726 | | -}); |
5727 | | - |
5728 | | -jQuery.fx.prototype = { |
5729 | | - // Simple function for setting a style value |
5730 | | - update: function() { |
5731 | | - if ( this.options.step ) { |
5732 | | - this.options.step.call( this.elem, this.now, this ); |
5733 | | - } |
5734 | | - |
5735 | | - (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
5736 | | - |
5737 | | - // Set display property to block for height/width animations |
5738 | | - if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) { |
5739 | | - this.elem.style.display = "block"; |
5740 | | - } |
5741 | | - }, |
5742 | | - |
5743 | | - // Get the current size |
5744 | | - cur: function( force ) { |
5745 | | - if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { |
5746 | | - return this.elem[ this.prop ]; |
5747 | | - } |
5748 | | - |
5749 | | - var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
5750 | | - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
5751 | | - }, |
5752 | | - |
5753 | | - // Start an animation from one number to another |
5754 | | - custom: function( from, to, unit ) { |
5755 | | - this.startTime = now(); |
5756 | | - this.start = from; |
5757 | | - this.end = to; |
5758 | | - this.unit = unit || this.unit || "px"; |
5759 | | - this.now = this.start; |
5760 | | - this.pos = this.state = 0; |
5761 | | - |
5762 | | - var self = this; |
5763 | | - function t( gotoEnd ) { |
5764 | | - return self.step(gotoEnd); |
5765 | | - } |
5766 | | - |
5767 | | - t.elem = this.elem; |
5768 | | - |
5769 | | - if ( t() && jQuery.timers.push(t) && !timerId ) { |
5770 | | - timerId = setInterval(jQuery.fx.tick, 13); |
5771 | | - } |
5772 | | - }, |
5773 | | - |
5774 | | - // Simple 'show' function |
5775 | | - show: function() { |
5776 | | - // Remember where we started, so that we can go back to it later |
5777 | | - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); |
5778 | | - this.options.show = true; |
5779 | | - |
5780 | | - // Begin the animation |
5781 | | - // Make sure that we start at a small width/height to avoid any |
5782 | | - // flash of content |
5783 | | - this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); |
5784 | | - |
5785 | | - // Start by showing the element |
5786 | | - jQuery( this.elem ).show(); |
5787 | | - }, |
5788 | | - |
5789 | | - // Simple 'hide' function |
5790 | | - hide: function() { |
5791 | | - // Remember where we started, so that we can go back to it later |
5792 | | - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); |
5793 | | - this.options.hide = true; |
5794 | | - |
5795 | | - // Begin the animation |
5796 | | - this.custom(this.cur(), 0); |
5797 | | - }, |
5798 | | - |
5799 | | - // Each step of an animation |
5800 | | - step: function( gotoEnd ) { |
5801 | | - var t = now(), done = true; |
5802 | | - |
5803 | | - if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
5804 | | - this.now = this.end; |
5805 | | - this.pos = this.state = 1; |
5806 | | - this.update(); |
5807 | | - |
5808 | | - this.options.curAnim[ this.prop ] = true; |
5809 | | - |
5810 | | - for ( var i in this.options.curAnim ) { |
5811 | | - if ( this.options.curAnim[i] !== true ) { |
5812 | | - done = false; |
5813 | | - } |
5814 | | - } |
5815 | | - |
5816 | | - if ( done ) { |
5817 | | - if ( this.options.display != null ) { |
5818 | | - // Reset the overflow |
5819 | | - this.elem.style.overflow = this.options.overflow; |
5820 | | - |
5821 | | - // Reset the display |
5822 | | - var old = jQuery.data(this.elem, "olddisplay"); |
5823 | | - this.elem.style.display = old ? old : this.options.display; |
5824 | | - |
5825 | | - if ( jQuery.css(this.elem, "display") === "none" ) { |
5826 | | - this.elem.style.display = "block"; |
5827 | | - } |
5828 | | - } |
5829 | | - |
5830 | | - // Hide the element if the "hide" operation was done |
5831 | | - if ( this.options.hide ) { |
5832 | | - jQuery(this.elem).hide(); |
5833 | | - } |
5834 | | - |
5835 | | - // Reset the properties, if the item has been hidden or shown |
5836 | | - if ( this.options.hide || this.options.show ) { |
5837 | | - for ( var p in this.options.curAnim ) { |
5838 | | - jQuery.style(this.elem, p, this.options.orig[p]); |
5839 | | - } |
5840 | | - } |
5841 | | - |
5842 | | - // Execute the complete function |
5843 | | - this.options.complete.call( this.elem ); |
5844 | | - } |
5845 | | - |
5846 | | - return false; |
5847 | | - |
5848 | | - } else { |
5849 | | - var n = t - this.startTime; |
5850 | | - this.state = n / this.options.duration; |
5851 | | - |
5852 | | - // Perform the easing function, defaults to swing |
5853 | | - var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; |
5854 | | - var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); |
5855 | | - this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); |
5856 | | - this.now = this.start + ((this.end - this.start) * this.pos); |
5857 | | - |
5858 | | - // Perform the next step of the animation |
5859 | | - this.update(); |
5860 | | - } |
5861 | | - |
5862 | | - return true; |
5863 | | - } |
5864 | | -}; |
5865 | | - |
5866 | | -jQuery.extend( jQuery.fx, { |
5867 | | - tick: function() { |
5868 | | - var timers = jQuery.timers; |
5869 | | - |
5870 | | - for ( var i = 0; i < timers.length; i++ ) { |
5871 | | - if ( !timers[i]() ) { |
5872 | | - timers.splice(i--, 1); |
5873 | | - } |
5874 | | - } |
5875 | | - |
5876 | | - if ( !timers.length ) { |
5877 | | - jQuery.fx.stop(); |
5878 | | - } |
5879 | | - }, |
5880 | | - |
5881 | | - stop: function() { |
5882 | | - clearInterval( timerId ); |
5883 | | - timerId = null; |
5884 | | - }, |
5885 | | - |
5886 | | - speeds: { |
5887 | | - slow: 600, |
5888 | | - fast: 200, |
5889 | | - // Default speed |
5890 | | - _default: 400 |
5891 | | - }, |
5892 | | - |
5893 | | - step: { |
5894 | | - opacity: function( fx ) { |
5895 | | - jQuery.style(fx.elem, "opacity", fx.now); |
5896 | | - }, |
5897 | | - |
5898 | | - _default: function( fx ) { |
5899 | | - if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { |
5900 | | - fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; |
5901 | | - } else { |
5902 | | - fx.elem[ fx.prop ] = fx.now; |
5903 | | - } |
5904 | | - } |
5905 | | - } |
5906 | | -}); |
5907 | | - |
5908 | | -if ( jQuery.expr && jQuery.expr.filters ) { |
5909 | | - jQuery.expr.filters.animated = function( elem ) { |
5910 | | - return jQuery.grep(jQuery.timers, function( fn ) { |
5911 | | - return elem === fn.elem; |
5912 | | - }).length; |
5913 | | - }; |
5914 | | -} |
5915 | | - |
5916 | | -function genFx( type, num ) { |
5917 | | - var obj = {}; |
5918 | | - |
5919 | | - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { |
5920 | | - obj[ this ] = type; |
5921 | | - }); |
5922 | | - |
5923 | | - return obj; |
5924 | | -} |
5925 | | -if ( "getBoundingClientRect" in document.documentElement ) { |
5926 | | - jQuery.fn.offset = function( options ) { |
5927 | | - var elem = this[0]; |
5928 | | - |
5929 | | - if ( options ) { |
5930 | | - return this.each(function( i ) { |
5931 | | - jQuery.offset.setOffset( this, options, i ); |
5932 | | - }); |
5933 | | - } |
5934 | | - |
5935 | | - if ( !elem || !elem.ownerDocument ) { |
5936 | | - return null; |
5937 | | - } |
5938 | | - |
5939 | | - if ( elem === elem.ownerDocument.body ) { |
5940 | | - return jQuery.offset.bodyOffset( elem ); |
5941 | | - } |
5942 | | - |
5943 | | - var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, |
5944 | | - clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, |
5945 | | - top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
5946 | | - left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
5947 | | - |
5948 | | - return { top: top, left: left }; |
5949 | | - }; |
5950 | | - |
5951 | | -} else { |
5952 | | - jQuery.fn.offset = function( options ) { |
5953 | | - var elem = this[0]; |
5954 | | - |
5955 | | - if ( options ) { |
5956 | | - return this.each(function( i ) { |
5957 | | - jQuery.offset.setOffset( this, options, i ); |
5958 | | - }); |
5959 | | - } |
5960 | | - |
5961 | | - if ( !elem || !elem.ownerDocument ) { |
5962 | | - return null; |
5963 | | - } |
5964 | | - |
5965 | | - if ( elem === elem.ownerDocument.body ) { |
5966 | | - return jQuery.offset.bodyOffset( elem ); |
5967 | | - } |
5968 | | - |
5969 | | - jQuery.offset.initialize(); |
5970 | | - |
5971 | | - var offsetParent = elem.offsetParent, prevOffsetParent = elem, |
5972 | | - doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, |
5973 | | - body = doc.body, defaultView = doc.defaultView, |
5974 | | - prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, |
5975 | | - top = elem.offsetTop, left = elem.offsetLeft; |
5976 | | - |
5977 | | - while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
5978 | | - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
5979 | | - break; |
5980 | | - } |
5981 | | - |
5982 | | - computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; |
5983 | | - top -= elem.scrollTop; |
5984 | | - left -= elem.scrollLeft; |
5985 | | - |
5986 | | - if ( elem === offsetParent ) { |
5987 | | - top += elem.offsetTop; |
5988 | | - left += elem.offsetLeft; |
5989 | | - |
5990 | | - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { |
5991 | | - top += parseFloat( computedStyle.borderTopWidth ) || 0; |
5992 | | - left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
5993 | | - } |
5994 | | - |
5995 | | - prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; |
5996 | | - } |
5997 | | - |
5998 | | - if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { |
5999 | | - top += parseFloat( computedStyle.borderTopWidth ) || 0; |
6000 | | - left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
6001 | | - } |
6002 | | - |
6003 | | - prevComputedStyle = computedStyle; |
6004 | | - } |
6005 | | - |
6006 | | - if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { |
6007 | | - top += body.offsetTop; |
6008 | | - left += body.offsetLeft; |
6009 | | - } |
6010 | | - |
6011 | | - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
6012 | | - top += Math.max( docElem.scrollTop, body.scrollTop ); |
6013 | | - left += Math.max( docElem.scrollLeft, body.scrollLeft ); |
6014 | | - } |
6015 | | - |
6016 | | - return { top: top, left: left }; |
6017 | | - }; |
6018 | | -} |
6019 | | - |
6020 | | -jQuery.offset = { |
6021 | | - initialize: function() { |
6022 | | - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0, |
6023 | | - html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; |
6024 | | - |
6025 | | - jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); |
6026 | | - |
6027 | | - container.innerHTML = html; |
6028 | | - body.insertBefore( container, body.firstChild ); |
6029 | | - innerDiv = container.firstChild; |
6030 | | - checkDiv = innerDiv.firstChild; |
6031 | | - td = innerDiv.nextSibling.firstChild.firstChild; |
6032 | | - |
6033 | | - this.doesNotAddBorder = (checkDiv.offsetTop !== 5); |
6034 | | - this.doesAddBorderForTableAndCells = (td.offsetTop === 5); |
6035 | | - |
6036 | | - checkDiv.style.position = "fixed", checkDiv.style.top = "20px"; |
6037 | | - // safari subtracts parent border width here which is 5px |
6038 | | - this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); |
6039 | | - checkDiv.style.position = checkDiv.style.top = ""; |
6040 | | - |
6041 | | - innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative"; |
6042 | | - this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
6043 | | - |
6044 | | - this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
6045 | | - |
6046 | | - body.removeChild( container ); |
6047 | | - body = container = innerDiv = checkDiv = table = td = null; |
6048 | | - jQuery.offset.initialize = jQuery.noop; |
6049 | | - }, |
6050 | | - |
6051 | | - bodyOffset: function( body ) { |
6052 | | - var top = body.offsetTop, left = body.offsetLeft; |
6053 | | - |
6054 | | - jQuery.offset.initialize(); |
6055 | | - |
6056 | | - if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { |
6057 | | - top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0; |
6058 | | - left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0; |
6059 | | - } |
6060 | | - |
6061 | | - return { top: top, left: left }; |
6062 | | - }, |
6063 | | - |
6064 | | - setOffset: function( elem, options, i ) { |
6065 | | - // set position first, in-case top/left are set even on static elem |
6066 | | - if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) { |
6067 | | - elem.style.position = "relative"; |
6068 | | - } |
6069 | | - var curElem = jQuery( elem ), |
6070 | | - curOffset = curElem.offset(), |
6071 | | - curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0, |
6072 | | - curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0; |
6073 | | - |
6074 | | - if ( jQuery.isFunction( options ) ) { |
6075 | | - options = options.call( elem, i, curOffset ); |
6076 | | - } |
6077 | | - |
6078 | | - var props = { |
6079 | | - top: (options.top - curOffset.top) + curTop, |
6080 | | - left: (options.left - curOffset.left) + curLeft |
6081 | | - }; |
6082 | | - |
6083 | | - if ( "using" in options ) { |
6084 | | - options.using.call( elem, props ); |
6085 | | - } else { |
6086 | | - curElem.css( props ); |
6087 | | - } |
6088 | | - } |
6089 | | -}; |
6090 | | - |
6091 | | - |
6092 | | -jQuery.fn.extend({ |
6093 | | - position: function() { |
6094 | | - if ( !this[0] ) { |
6095 | | - return null; |
6096 | | - } |
6097 | | - |
6098 | | - var elem = this[0], |
6099 | | - |
6100 | | - // Get *real* offsetParent |
6101 | | - offsetParent = this.offsetParent(), |
6102 | | - |
6103 | | - // Get correct offsets |
6104 | | - offset = this.offset(), |
6105 | | - parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); |
6106 | | - |
6107 | | - // Subtract element margins |
6108 | | - // note: when an element has margin: auto the offsetLeft and marginLeft |
6109 | | - // are the same in Safari causing offset.left to incorrectly be 0 |
6110 | | - offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0; |
6111 | | - offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0; |
6112 | | - |
6113 | | - // Add offsetParent borders |
6114 | | - parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0; |
6115 | | - parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0; |
6116 | | - |
6117 | | - // Subtract the two offsets |
6118 | | - return { |
6119 | | - top: offset.top - parentOffset.top, |
6120 | | - left: offset.left - parentOffset.left |
6121 | | - }; |
6122 | | - }, |
6123 | | - |
6124 | | - offsetParent: function() { |
6125 | | - return this.map(function() { |
6126 | | - var offsetParent = this.offsetParent || document.body; |
6127 | | - while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { |
6128 | | - offsetParent = offsetParent.offsetParent; |
6129 | | - } |
6130 | | - return offsetParent; |
6131 | | - }); |
6132 | | - } |
6133 | | -}); |
6134 | | - |
6135 | | - |
6136 | | -// Create scrollLeft and scrollTop methods |
6137 | | -jQuery.each( ["Left", "Top"], function( i, name ) { |
6138 | | - var method = "scroll" + name; |
6139 | | - |
6140 | | - jQuery.fn[ method ] = function(val) { |
6141 | | - var elem = this[0], win; |
6142 | | - |
6143 | | - if ( !elem ) { |
6144 | | - return null; |
6145 | | - } |
6146 | | - |
6147 | | - if ( val !== undefined ) { |
6148 | | - // Set the scroll offset |
6149 | | - return this.each(function() { |
6150 | | - win = getWindow( this ); |
6151 | | - |
6152 | | - if ( win ) { |
6153 | | - win.scrollTo( |
6154 | | - !i ? val : jQuery(win).scrollLeft(), |
6155 | | - i ? val : jQuery(win).scrollTop() |
6156 | | - ); |
6157 | | - |
6158 | | - } else { |
6159 | | - this[ method ] = val; |
6160 | | - } |
6161 | | - }); |
6162 | | - } else { |
6163 | | - win = getWindow( elem ); |
6164 | | - |
6165 | | - // Return the scroll offset |
6166 | | - return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : |
6167 | | - jQuery.support.boxModel && win.document.documentElement[ method ] || |
6168 | | - win.document.body[ method ] : |
6169 | | - elem[ method ]; |
6170 | | - } |
6171 | | - }; |
6172 | | -}); |
6173 | | - |
6174 | | -function getWindow( elem ) { |
6175 | | - return ("scrollTo" in elem && elem.document) ? |
6176 | | - elem : |
6177 | | - elem.nodeType === 9 ? |
6178 | | - elem.defaultView || elem.parentWindow : |
6179 | | - false; |
6180 | | -} |
6181 | | -// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
6182 | | -jQuery.each([ "Height", "Width" ], function( i, name ) { |
6183 | | - |
6184 | | - var type = name.toLowerCase(); |
6185 | | - |
6186 | | - // innerHeight and innerWidth |
6187 | | - jQuery.fn["inner" + name] = function() { |
6188 | | - return this[0] ? |
6189 | | - jQuery.css( this[0], type, false, "padding" ) : |
6190 | | - null; |
6191 | | - }; |
6192 | | - |
6193 | | - // outerHeight and outerWidth |
6194 | | - jQuery.fn["outer" + name] = function( margin ) { |
6195 | | - return this[0] ? |
6196 | | - jQuery.css( this[0], type, false, margin ? "margin" : "border" ) : |
6197 | | - null; |
6198 | | - }; |
6199 | | - |
6200 | | - jQuery.fn[ type ] = function( size ) { |
6201 | | - // Get window width or height |
6202 | | - var elem = this[0]; |
6203 | | - if ( !elem ) { |
6204 | | - return size == null ? null : this; |
6205 | | - } |
6206 | | - |
6207 | | - if ( jQuery.isFunction( size ) ) { |
6208 | | - return this.each(function( i ) { |
6209 | | - var self = jQuery( this ); |
6210 | | - self[ type ]( size.call( this, i, self[ type ]() ) ); |
6211 | | - }); |
6212 | | - } |
6213 | | - |
6214 | | - return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window? |
6215 | | - // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
6216 | | - elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || |
6217 | | - elem.document.body[ "client" + name ] : |
6218 | | - |
6219 | | - // Get document width or height |
6220 | | - (elem.nodeType === 9) ? // is it a document |
6221 | | - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
6222 | | - Math.max( |
6223 | | - elem.documentElement["client" + name], |
6224 | | - elem.body["scroll" + name], elem.documentElement["scroll" + name], |
6225 | | - elem.body["offset" + name], elem.documentElement["offset" + name] |
6226 | | - ) : |
6227 | | - |
6228 | | - // Get or set width or height on the element |
6229 | | - size === undefined ? |
6230 | | - // Get width or height on the element |
6231 | | - jQuery.css( elem, type ) : |
6232 | | - |
6233 | | - // Set the width or height on the element (default to pixels if value is unitless) |
6234 | | - this.css( type, typeof size === "string" ? size : size + "px" ); |
6235 | | - }; |
6236 | | - |
6237 | | -}); |
6238 | | -// Expose jQuery to the global object |
6239 | | -window.jQuery = window.$ = jQuery; |
6240 | | - |
6241 | | -})(window); |
Index: branches/resourceloader/phase3/resources/base/mw.js |
— | — | @@ -1,504 +0,0 @@ |
2 | | -/* |
3 | | - * JavaScript Backwards Compatibility |
4 | | - */ |
5 | | - |
6 | | -// Make calling .indexOf() on an array work on older browsers |
7 | | -if ( typeof Array.prototype.indexOf === 'undefined' ) { |
8 | | - Array.prototype.indexOf = function( needle ) { |
9 | | - for ( var i = 0; i < this.length; i++ ) { |
10 | | - if ( this[i] === needle ) { |
11 | | - return i; |
12 | | - } |
13 | | - } |
14 | | - return -1; |
15 | | - }; |
16 | | -} |
17 | | - |
18 | | -/* |
19 | | - * Core MediaWiki JavaScript Library |
20 | | - */ |
21 | | - |
22 | | -window.mw = $.extend( typeof window.mw === 'undefined' ? {} : window.mw, { |
23 | | - 'prototypes': { |
24 | | - /* |
25 | | - * An object which allows single and multiple existence, setting and getting on a list of key / value pairs |
26 | | - */ |
27 | | - 'Collection': function() { |
28 | | - |
29 | | - /* Private Members */ |
30 | | - |
31 | | - var that = this; |
32 | | - // List of configuration values |
33 | | - var values = {}; |
34 | | - |
35 | | - /* Public Functions */ |
36 | | - |
37 | | - /** |
38 | | - * Sets one or multiple configuration values using a key and a value or an object of keys and values |
39 | | - */ |
40 | | - this.set = function( keys, value ) { |
41 | | - if ( typeof keys === 'object' ) { |
42 | | - for ( var key in keys ) { |
43 | | - values[key] = keys[key]; |
44 | | - } |
45 | | - } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { |
46 | | - values[keys] = value; |
47 | | - } |
48 | | - }; |
49 | | - /** |
50 | | - * Gets one or multiple configuration values using a key and an optional fallback or an array of keys |
51 | | - */ |
52 | | - this.get = function( keys, fallback ) { |
53 | | - if ( typeof keys === 'object' ) { |
54 | | - var result = {}; |
55 | | - for ( var k = 0; k < keys.length; k++ ) { |
56 | | - if ( typeof values[keys[k]] !== 'undefined' ) { |
57 | | - result[keys[k]] = values[keys[k]]; |
58 | | - } |
59 | | - } |
60 | | - return result; |
61 | | - } else if ( typeof values[keys] === 'undefined' ) { |
62 | | - return typeof fallback !== 'undefined' ? fallback : null; |
63 | | - } else { |
64 | | - return values[keys]; |
65 | | - } |
66 | | - }; |
67 | | - /** |
68 | | - * Checks if one or multiple configuration fields exist |
69 | | - */ |
70 | | - this.exists = function( keys ) { |
71 | | - if ( typeof keys === 'object' ) { |
72 | | - for ( var k = 0; k < keys.length; k++ ) { |
73 | | - if ( !( keys[k] in values ) ) { |
74 | | - return false; |
75 | | - } |
76 | | - } |
77 | | - return true; |
78 | | - } else { |
79 | | - return keys in values; |
80 | | - } |
81 | | - }; |
82 | | - }, |
83 | | - /* |
84 | | - * Localization system |
85 | | - */ |
86 | | - 'Language': function() { |
87 | | - |
88 | | - /* Private Members */ |
89 | | - |
90 | | - var that = this; |
91 | | - // List of localized messages |
92 | | - var messages = {}; |
93 | | - |
94 | | - /* Public Functions */ |
95 | | - |
96 | | - this.set = function( keys, value ) { |
97 | | - if ( typeof keys === 'object' ) { |
98 | | - for ( var key in keys ) { |
99 | | - messages[key] = keys[key]; |
100 | | - } |
101 | | - } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { |
102 | | - messages[keys] = value; |
103 | | - } |
104 | | - }; |
105 | | - this.get = function( key, args ) { |
106 | | - if ( !( key in messages ) ) { |
107 | | - return '<' + key + '>'; |
108 | | - } |
109 | | - var msg = messages[key]; |
110 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
111 | | - for ( var argKey in args ) { |
112 | | - msg = msg.replace( '\$' + ( parseInt( argKey ) + 1 ), args[argKey] ); |
113 | | - } |
114 | | - } else if ( typeof args == 'string' || typeof args == 'number' ) { |
115 | | - msg = msg.replace( '$1', args ); |
116 | | - } |
117 | | - return msg; |
118 | | - }; |
119 | | - }, |
120 | | - /* |
121 | | - * Client-side module loader which integrates with the MediaWiki ResourceLoader |
122 | | - */ |
123 | | - 'ResourceLoader': function() { |
124 | | - |
125 | | - /* Private Members */ |
126 | | - |
127 | | - var that = this; |
128 | | - var server = 'load.php'; |
129 | | - /* |
130 | | - * Mapping of registered modules |
131 | | - * |
132 | | - * Format: |
133 | | - * { |
134 | | - * 'moduleName': { |
135 | | - * 'needs': ['required module', 'required module', ...], |
136 | | - * 'state': 'registered, loading, loaded, or ready', |
137 | | - * 'script': function() {}, |
138 | | - * 'style': 'css code string', |
139 | | - * 'localization': { 'key': 'value' } |
140 | | - * } |
141 | | - * } |
142 | | - */ |
143 | | - var registry = {}; |
144 | | - // List of callbacks waiting on dependent modules to be loaded so they can be executed |
145 | | - var queue = []; |
146 | | - // Until document ready, load requests will be collected in a batch queue |
147 | | - var batch = []; |
148 | | - // True after document ready occurs |
149 | | - var ready = false; |
150 | | - |
151 | | - /* Private Functions */ |
152 | | - |
153 | | - /** |
154 | | - * Gets a list of modules names that a module needs in their proper dependency order |
155 | | - * |
156 | | - * @param string module name |
157 | | - * @return |
158 | | - * @throws Error if circular reference is detected |
159 | | - */ |
160 | | - function needs( module ) { |
161 | | - if ( !( module in registry ) ) { |
162 | | - // Undefined modules have no needs |
163 | | - return []; |
164 | | - } |
165 | | - var resolved = []; |
166 | | - var unresolved = []; |
167 | | - if ( arguments.length === 3 ) { |
168 | | - // Use arguemnts on inner call |
169 | | - resolved = arguments[1]; |
170 | | - unresolved = arguments[2]; |
171 | | - } |
172 | | - unresolved[unresolved.length] = module; |
173 | | - for ( n in registry[module].needs ) { |
174 | | - if ( resolved.indexOf( registry[module].needs[n] ) === -1 ) { |
175 | | - if ( unresolved.indexOf( registry[module].needs[n] ) !== -1 ) { |
176 | | - throw new Error( |
177 | | - 'Circular reference detected: ' + module + ' -> ' + registry[module].needs[n] |
178 | | - ); |
179 | | - } |
180 | | - needs( registry[module].needs[n], resolved, unresolved ); |
181 | | - } |
182 | | - } |
183 | | - resolved[resolved.length] = module; |
184 | | - unresolved.slice( unresolved.indexOf( module ), 1 ); |
185 | | - if ( arguments.length === 1 ) { |
186 | | - // Return resolved list on outer call |
187 | | - return resolved; |
188 | | - } |
189 | | - }; |
190 | | - /** |
191 | | - * Narrows a list of module names down to those matching a specific state. Possible states are 'undefined', |
192 | | - * 'registered', 'loading', 'loaded', or 'ready' |
193 | | - * |
194 | | - * @param mixed string or array of strings of module states to filter by |
195 | | - * @param array list of module names to filter (optional, all modules will be used by default) |
196 | | - * @return array list of filtered module names |
197 | | - */ |
198 | | - function filter( states, modules ) { |
199 | | - var list = []; |
200 | | - if ( typeof modules === 'undefined' ) { |
201 | | - modules = []; |
202 | | - for ( module in registry ) { |
203 | | - modules[modules.length] = module; |
204 | | - } |
205 | | - } |
206 | | - for ( var s in states ) { |
207 | | - for ( var m in modules ) { |
208 | | - if ( |
209 | | - ( states[s] == 'undefined' && typeof registry[modules[m]] === 'undefined' ) || |
210 | | - ( typeof registry[modules[m]] === 'object' && registry[modules[m]].state === states[s] ) |
211 | | - ) { |
212 | | - list[list.length] = modules[m]; |
213 | | - } |
214 | | - } |
215 | | - } |
216 | | - return list; |
217 | | - } |
218 | | - /** |
219 | | - * Executes a loaded module, making it ready to use |
220 | | - * |
221 | | - * @param string module name to execute |
222 | | - */ |
223 | | - function execute( module ) { |
224 | | - if ( typeof registry[module] === 'undefined' ) { |
225 | | - throw new Error( 'module has not been registered: ' + module ); |
226 | | - } |
227 | | - switch ( registry[module].state ) { |
228 | | - case 'registered': |
229 | | - throw new Error( 'module has not completed loading: ' + module ); |
230 | | - break; |
231 | | - case 'loading': |
232 | | - throw new Error( 'module has not completed loading: ' + module ); |
233 | | - break; |
234 | | - case 'ready': |
235 | | - throw new Error( 'module has already been loaded: ' + module ); |
236 | | - break; |
237 | | - } |
238 | | - // Add style sheet to document |
239 | | - if ( typeof registry[module].style === 'string' && registry[module].style.length ) { |
240 | | - $( 'head' ).append( '<style type="text/css">' + registry[module].style + '</style>' ); |
241 | | - } |
242 | | - // Add localizations to message system |
243 | | - if ( typeof registry[module].localization === 'object' ) { |
244 | | - mw.msg.set( registry[module].localization ); |
245 | | - } |
246 | | - // Execute script |
247 | | - try { |
248 | | - registry[module].script(); |
249 | | - } catch( e ) { |
250 | | - mw.log( 'Exception thrown by ' + module + ': ' + e.message ); |
251 | | - } |
252 | | - // Change state |
253 | | - registry[module].state = 'ready'; |
254 | | - |
255 | | - // Execute all modules which were waiting for this to be ready |
256 | | - for ( r in registry ) { |
257 | | - if ( registry[r].state == 'loaded' ) { |
258 | | - if ( filter( ['ready'], registry[r].needs ).length == registry[r].needs.length ) { |
259 | | - execute( r ); |
260 | | - } |
261 | | - } |
262 | | - } |
263 | | - } |
264 | | - /** |
265 | | - * Adds a callback and it's needs to the queue |
266 | | - * |
267 | | - * @param array list of module names the callback needs to be ready before being executed |
268 | | - * @param function callback to execute when needs are met |
269 | | - */ |
270 | | - function request( needs, callback ) { |
271 | | - queue[queue.length] = { 'needs': filter( ['undefined', 'registered'], needs ), 'callback': callback }; |
272 | | - } |
273 | | - |
274 | | - /* Public Functions */ |
275 | | - |
276 | | - /** |
277 | | - * Processes the queue, loading and executing when things when ready. |
278 | | - */ |
279 | | - this.work = function() { |
280 | | - // Appends a list of modules to the batch |
281 | | - function append( modules ) { |
282 | | - for ( m in modules ) { |
283 | | - // Prevent requesting modules which are loading, loaded or ready |
284 | | - if ( modules[m] in registry && registry[modules[m]].state == 'registered' ) { |
285 | | - // Since the batch can live between calls to work until document ready, we need to make sure |
286 | | - // we aren't making a duplicate entry |
287 | | - if ( batch.indexOf( modules[m] ) == -1 ) { |
288 | | - batch[batch.length] = modules[m]; |
289 | | - registry[modules[m]].state = 'loading'; |
290 | | - } |
291 | | - } |
292 | | - } |
293 | | - } |
294 | | - // Fill batch with modules that need to be loaded |
295 | | - for ( var q in queue ) { |
296 | | - append( queue[q].needs ); |
297 | | - for ( n in queue[q].needs ) { |
298 | | - append( needs( queue[q].needs[n] ) ); |
299 | | - } |
300 | | - } |
301 | | - // After document ready, handle the batch |
302 | | - if ( ready && batch.length ) { |
303 | | - // Always order modules alphabetically to help reduce cache misses for otherwise identical content |
304 | | - batch.sort(); |
305 | | - |
306 | | - var base = $.extend( {}, |
307 | | - // Pass configuration values through the URL |
308 | | - mw.config.get( [ 'user', 'skin', 'space', 'view', 'language' ] ), |
309 | | - // Ensure request comes back in the proper mode (debug or not) |
310 | | - { 'debug': typeof mw.debug !== 'undefined' ? '1' : '0' } |
311 | | - ); |
312 | | - var requests = []; |
313 | | - if ( base.debug == '1' ) { |
314 | | - for ( b in batch ) { |
315 | | - requests[requests.length] = $.extend( { 'modules': batch[b] }, base ); |
316 | | - } |
317 | | - } else { |
318 | | - requests[requests.length] = $.extend( { 'modules': batch.join( '|' ) }, base ); |
319 | | - } |
320 | | - // It may be more performant to do this with an Ajax call, but that's limited to same-domain, so we |
321 | | - // can either auto-detect (if there really is any benefit) or just use this method, which is safe |
322 | | - setTimeout( function() { |
323 | | - // Clear the batch - this MUST happen before we append the script element to the body or it's |
324 | | - // possible that the script will be locally cached, instantly load, and work the batch again, |
325 | | - // all before we've cleared it causing each request to include modules which are already loaded |
326 | | - batch = []; |
327 | | - var html = ''; |
328 | | - for ( r in requests ) { |
329 | | - // Build out the HTML |
330 | | - var src = mw.util.buildUrlString( { |
331 | | - 'path': mw.config.get( 'wgScriptPath' ) + '/load.php', |
332 | | - 'query': requests[r] |
333 | | - } ); |
334 | | - html += '<script type="text/javascript" src="' + src + '"></script>'; |
335 | | - } |
336 | | - // Append script to head |
337 | | - $( 'head' ).append( html ); |
338 | | - }, 0 ) |
339 | | - } |
340 | | - }; |
341 | | - /** |
342 | | - * Registers a module, letting the system know about it and it's dependencies. loader.js files contain calls |
343 | | - * to this function. |
344 | | - */ |
345 | | - this.register = function( name, needs ) { |
346 | | - // Validate input |
347 | | - if ( typeof name !== 'string' ) { |
348 | | - throw new Error( 'name must be a string, not a ' + typeof name ); |
349 | | - } |
350 | | - if ( typeof registry[name] !== 'undefined' ) { |
351 | | - throw new Error( 'module already implemeneted: ' + name ); |
352 | | - } |
353 | | - // List the module as registered |
354 | | - registry[name] = { 'state': 'registered', 'needs': [] }; |
355 | | - // Allow needs to be given as a function which returns a string or array |
356 | | - if ( typeof needs === 'function' ) { |
357 | | - needs = needs(); |
358 | | - } |
359 | | - if ( typeof needs === 'string' ) { |
360 | | - // Allow needs to be given as a single module name |
361 | | - registry[name].needs = [needs]; |
362 | | - } else if ( typeof needs === 'object' ) { |
363 | | - // Allow needs to be given as an array of module names |
364 | | - registry[name].needs = needs; |
365 | | - } |
366 | | - }; |
367 | | - /** |
368 | | - * Implements a module, giving the system a course of action to take upon loading. Results of a request for |
369 | | - * one or more modules contain calls to this function. |
370 | | - */ |
371 | | - this.implement = function( name, script, style, localization ) { |
372 | | - // Automaically register module |
373 | | - if ( typeof registry[name] === 'undefined' ) { |
374 | | - that.register( name, needs ); |
375 | | - } |
376 | | - // Validate input |
377 | | - if ( typeof script !== 'function' ) { |
378 | | - throw new Error( 'script must be a function, not a ' + typeof script ); |
379 | | - } |
380 | | - if ( typeof style !== 'undefined' && typeof style !== 'string' ) { |
381 | | - throw new Error( 'style must be a string, not a ' + typeof style ); |
382 | | - } |
383 | | - if ( typeof localization !== 'undefined' && typeof localization !== 'object' ) { |
384 | | - throw new Error( 'localization must be an object, not a ' + typeof localization ); |
385 | | - } |
386 | | - if ( typeof registry[name] !== 'undefined' && typeof registry[name].script !== 'undefined' ) { |
387 | | - throw new Error( 'module already implemeneted: ' + name ); |
388 | | - } |
389 | | - // Mark module as loaded |
390 | | - registry[name].state = 'loaded'; |
391 | | - // Attach components |
392 | | - registry[name].script = script; |
393 | | - if ( typeof style === 'string' ) { |
394 | | - registry[name].style = style; |
395 | | - } |
396 | | - if ( typeof localization === 'object' ) { |
397 | | - registry[name].localization = localization; |
398 | | - } |
399 | | - // Execute or queue callback |
400 | | - if ( filter( ['ready'], registry[name].needs ).length == registry[name].needs.length ) { |
401 | | - execute( name ); |
402 | | - } else { |
403 | | - request( registry[name].needs, function() { execute( name ); } ); |
404 | | - } |
405 | | - }; |
406 | | - /** |
407 | | - * Executes a function as soon as one or more required modules are ready |
408 | | - * |
409 | | - * @param mixed string or array of strings of modules names the callback needs to be ready before executing |
410 | | - * @param function callback to execute when all needs are met |
411 | | - */ |
412 | | - this.using = function( needs, callback ) { |
413 | | - // Validate input |
414 | | - if ( typeof needs !== 'object' && typeof needs !== 'string' ) { |
415 | | - throw new Error( 'needs must be a string or an array, not a ' + typeof needs ) |
416 | | - } |
417 | | - if ( typeof callback !== 'function' ) { |
418 | | - throw new Error( 'callback must be a function, not a ' + typeof callback ) |
419 | | - } |
420 | | - if ( typeof needs === 'string' ) { |
421 | | - needs = [needs]; |
422 | | - } |
423 | | - // Execute or queue callback |
424 | | - if ( filter( ['ready'], needs ).length == needs.length ) { |
425 | | - callback(); |
426 | | - } else { |
427 | | - request( needs, callback ); |
428 | | - } |
429 | | - }; |
430 | | - |
431 | | - /* Event Bindings */ |
432 | | - |
433 | | - $( document ).ready( function() { |
434 | | - ready = true; |
435 | | - that.work(); |
436 | | - } ); |
437 | | - } |
438 | | - } |
439 | | -} ); |
440 | | -/* |
441 | | - * Site and user configurations |
442 | | - */ |
443 | | -mw.config = new mw.prototypes.Collection(); |
444 | | -/* |
445 | | - * MediaWiki ResourceLoader client |
446 | | - */ |
447 | | -mw.loader = new mw.prototypes.ResourceLoader(); |
448 | | -/* |
449 | | - * Localization system |
450 | | - */ |
451 | | -mw.msg = new mw.prototypes.Language(); |
452 | | -/* |
453 | | - * Debug logging |
454 | | - */ |
455 | | -/** |
456 | | -* Log a string msg to the console |
457 | | -* |
458 | | -* All mw.log statements will be removed on minification so lots of mw.log calls will not impact performance in non-debug |
459 | | -* mode. This is done using simple regular expressions, so the input of this function needs to not contain things like a |
460 | | -* self-executing closure. In the case that the browser does not have a console available, one is created by appending a |
461 | | -* <div> element to the bottom of the body and then appending a <div> element to that for each message. In the case that |
462 | | -* the browser does have a console available |
463 | | -* |
464 | | -* @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org> |
465 | | -* @param {String} string String to output to console |
466 | | -*/ |
467 | | -window.mw.log = function( string ) { |
468 | | - // Allow log messages to use a configured prefix |
469 | | - if ( mw.config.exists( 'mw.log.prefix' ) ) { |
470 | | - string = mw.config.get( 'mw.log.prefix' ) + string; |
471 | | - } |
472 | | - // Try to use an existing console |
473 | | - if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) { |
474 | | - window.console.log( string ); |
475 | | - } else { |
476 | | - // Show a log box for console-less browsers |
477 | | - var $log = $( '#mw_log_console' ); |
478 | | - if ( !$log.length ) { |
479 | | - $log = $( '<div id="mw_log_console"></div>' ) |
480 | | - .css( { |
481 | | - 'position': 'absolute', |
482 | | - 'overflow': 'auto', |
483 | | - 'z-index': 500, |
484 | | - 'bottom': '0px', |
485 | | - 'left': '0px', |
486 | | - 'right': '0px', |
487 | | - 'height': '150px', |
488 | | - 'background-color': 'white', |
489 | | - 'border-top': 'solid 1px #DDDDDD' |
490 | | - } ) |
491 | | - .appendTo( $( 'body' ) ); |
492 | | - } |
493 | | - if ( $log.length ) { |
494 | | - $log.append( |
495 | | - $( '<div>' + string + '</div>' ) |
496 | | - .css( { |
497 | | - 'border-bottom': 'solid 1px #DDDDDD', |
498 | | - 'font-size': 'small', |
499 | | - 'font-family': 'monospace', |
500 | | - 'padding': '0.125em 0.25em' |
501 | | - } ) |
502 | | - ); |
503 | | - } |
504 | | - } |
505 | | -}; |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/base/jquery/jquery.tabIndex.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +( function( $ ) { |
| 3 | + |
| 4 | +/** |
| 5 | + * Finds the highest tabindex in use. |
| 6 | + * |
| 7 | + * @return Integer of highest tabindex on the page |
| 8 | + */ |
| 9 | +$.fn.maxTabIndex( function() { |
| 10 | + var maxTabIndex = 0; |
| 11 | + $(this).find( '[tabindex]' ).each( function() { |
| 12 | + var tabIndex = parseInt( $(this).attr( 'tabindex' ) ); |
| 13 | + if ( tabIndex > maxTabIndex ) { |
| 14 | + maxTabIndex = tabIndex; |
| 15 | + } |
| 16 | + } ); |
| 17 | + return maxTabIndex; |
| 18 | +} ); |
| 19 | + |
| 20 | +} )(); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/base/jquery/jquery.tabIndex.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/base/jquery/jquery-1.4.2.js |
— | — | @@ -0,0 +1,6240 @@ |
| 2 | +/*! |
| 3 | + * jQuery JavaScript Library v1.4.2 |
| 4 | + * http://jquery.com/ |
| 5 | + * |
| 6 | + * Copyright 2010, John Resig |
| 7 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 8 | + * http://jquery.org/license |
| 9 | + * |
| 10 | + * Includes Sizzle.js |
| 11 | + * http://sizzlejs.com/ |
| 12 | + * Copyright 2010, The Dojo Foundation |
| 13 | + * Released under the MIT, BSD, and GPL Licenses. |
| 14 | + * |
| 15 | + * Date: Sat Feb 13 22:33:48 2010 -0500 |
| 16 | + */ |
| 17 | +(function( window, undefined ) { |
| 18 | + |
| 19 | +// Define a local copy of jQuery |
| 20 | +var jQuery = function( selector, context ) { |
| 21 | + // The jQuery object is actually just the init constructor 'enhanced' |
| 22 | + return new jQuery.fn.init( selector, context ); |
| 23 | + }, |
| 24 | + |
| 25 | + // Map over jQuery in case of overwrite |
| 26 | + _jQuery = window.jQuery, |
| 27 | + |
| 28 | + // Map over the $ in case of overwrite |
| 29 | + _$ = window.$, |
| 30 | + |
| 31 | + // Use the correct document accordingly with window argument (sandbox) |
| 32 | + document = window.document, |
| 33 | + |
| 34 | + // A central reference to the root jQuery(document) |
| 35 | + rootjQuery, |
| 36 | + |
| 37 | + // A simple way to check for HTML strings or ID strings |
| 38 | + // (both of which we optimize for) |
| 39 | + quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, |
| 40 | + |
| 41 | + // Is it a simple selector |
| 42 | + isSimple = /^.[^:#\[\.,]*$/, |
| 43 | + |
| 44 | + // Check if a string has a non-whitespace character in it |
| 45 | + rnotwhite = /\S/, |
| 46 | + |
| 47 | + // Used for trimming whitespace |
| 48 | + rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, |
| 49 | + |
| 50 | + // Match a standalone tag |
| 51 | + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, |
| 52 | + |
| 53 | + // Keep a UserAgent string for use with jQuery.browser |
| 54 | + userAgent = navigator.userAgent, |
| 55 | + |
| 56 | + // For matching the engine and version of the browser |
| 57 | + browserMatch, |
| 58 | + |
| 59 | + // Has the ready events already been bound? |
| 60 | + readyBound = false, |
| 61 | + |
| 62 | + // The functions to execute on DOM ready |
| 63 | + readyList = [], |
| 64 | + |
| 65 | + // The ready event handler |
| 66 | + DOMContentLoaded, |
| 67 | + |
| 68 | + // Save a reference to some core methods |
| 69 | + toString = Object.prototype.toString, |
| 70 | + hasOwnProperty = Object.prototype.hasOwnProperty, |
| 71 | + push = Array.prototype.push, |
| 72 | + slice = Array.prototype.slice, |
| 73 | + indexOf = Array.prototype.indexOf; |
| 74 | + |
| 75 | +jQuery.fn = jQuery.prototype = { |
| 76 | + init: function( selector, context ) { |
| 77 | + var match, elem, ret, doc; |
| 78 | + |
| 79 | + // Handle $(""), $(null), or $(undefined) |
| 80 | + if ( !selector ) { |
| 81 | + return this; |
| 82 | + } |
| 83 | + |
| 84 | + // Handle $(DOMElement) |
| 85 | + if ( selector.nodeType ) { |
| 86 | + this.context = this[0] = selector; |
| 87 | + this.length = 1; |
| 88 | + return this; |
| 89 | + } |
| 90 | + |
| 91 | + // The body element only exists once, optimize finding it |
| 92 | + if ( selector === "body" && !context ) { |
| 93 | + this.context = document; |
| 94 | + this[0] = document.body; |
| 95 | + this.selector = "body"; |
| 96 | + this.length = 1; |
| 97 | + return this; |
| 98 | + } |
| 99 | + |
| 100 | + // Handle HTML strings |
| 101 | + if ( typeof selector === "string" ) { |
| 102 | + // Are we dealing with HTML string or an ID? |
| 103 | + match = quickExpr.exec( selector ); |
| 104 | + |
| 105 | + // Verify a match, and that no context was specified for #id |
| 106 | + if ( match && (match[1] || !context) ) { |
| 107 | + |
| 108 | + // HANDLE: $(html) -> $(array) |
| 109 | + if ( match[1] ) { |
| 110 | + doc = (context ? context.ownerDocument || context : document); |
| 111 | + |
| 112 | + // If a single string is passed in and it's a single tag |
| 113 | + // just do a createElement and skip the rest |
| 114 | + ret = rsingleTag.exec( selector ); |
| 115 | + |
| 116 | + if ( ret ) { |
| 117 | + if ( jQuery.isPlainObject( context ) ) { |
| 118 | + selector = [ document.createElement( ret[1] ) ]; |
| 119 | + jQuery.fn.attr.call( selector, context, true ); |
| 120 | + |
| 121 | + } else { |
| 122 | + selector = [ doc.createElement( ret[1] ) ]; |
| 123 | + } |
| 124 | + |
| 125 | + } else { |
| 126 | + ret = buildFragment( [ match[1] ], [ doc ] ); |
| 127 | + selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; |
| 128 | + } |
| 129 | + |
| 130 | + return jQuery.merge( this, selector ); |
| 131 | + |
| 132 | + // HANDLE: $("#id") |
| 133 | + } else { |
| 134 | + elem = document.getElementById( match[2] ); |
| 135 | + |
| 136 | + if ( elem ) { |
| 137 | + // Handle the case where IE and Opera return items |
| 138 | + // by name instead of ID |
| 139 | + if ( elem.id !== match[2] ) { |
| 140 | + return rootjQuery.find( selector ); |
| 141 | + } |
| 142 | + |
| 143 | + // Otherwise, we inject the element directly into the jQuery object |
| 144 | + this.length = 1; |
| 145 | + this[0] = elem; |
| 146 | + } |
| 147 | + |
| 148 | + this.context = document; |
| 149 | + this.selector = selector; |
| 150 | + return this; |
| 151 | + } |
| 152 | + |
| 153 | + // HANDLE: $("TAG") |
| 154 | + } else if ( !context && /^\w+$/.test( selector ) ) { |
| 155 | + this.selector = selector; |
| 156 | + this.context = document; |
| 157 | + selector = document.getElementsByTagName( selector ); |
| 158 | + return jQuery.merge( this, selector ); |
| 159 | + |
| 160 | + // HANDLE: $(expr, $(...)) |
| 161 | + } else if ( !context || context.jquery ) { |
| 162 | + return (context || rootjQuery).find( selector ); |
| 163 | + |
| 164 | + // HANDLE: $(expr, context) |
| 165 | + // (which is just equivalent to: $(context).find(expr) |
| 166 | + } else { |
| 167 | + return jQuery( context ).find( selector ); |
| 168 | + } |
| 169 | + |
| 170 | + // HANDLE: $(function) |
| 171 | + // Shortcut for document ready |
| 172 | + } else if ( jQuery.isFunction( selector ) ) { |
| 173 | + return rootjQuery.ready( selector ); |
| 174 | + } |
| 175 | + |
| 176 | + if (selector.selector !== undefined) { |
| 177 | + this.selector = selector.selector; |
| 178 | + this.context = selector.context; |
| 179 | + } |
| 180 | + |
| 181 | + return jQuery.makeArray( selector, this ); |
| 182 | + }, |
| 183 | + |
| 184 | + // Start with an empty selector |
| 185 | + selector: "", |
| 186 | + |
| 187 | + // The current version of jQuery being used |
| 188 | + jquery: "1.4.2", |
| 189 | + |
| 190 | + // The default length of a jQuery object is 0 |
| 191 | + length: 0, |
| 192 | + |
| 193 | + // The number of elements contained in the matched element set |
| 194 | + size: function() { |
| 195 | + return this.length; |
| 196 | + }, |
| 197 | + |
| 198 | + toArray: function() { |
| 199 | + return slice.call( this, 0 ); |
| 200 | + }, |
| 201 | + |
| 202 | + // Get the Nth element in the matched element set OR |
| 203 | + // Get the whole matched element set as a clean array |
| 204 | + get: function( num ) { |
| 205 | + return num == null ? |
| 206 | + |
| 207 | + // Return a 'clean' array |
| 208 | + this.toArray() : |
| 209 | + |
| 210 | + // Return just the object |
| 211 | + ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); |
| 212 | + }, |
| 213 | + |
| 214 | + // Take an array of elements and push it onto the stack |
| 215 | + // (returning the new matched element set) |
| 216 | + pushStack: function( elems, name, selector ) { |
| 217 | + // Build a new jQuery matched element set |
| 218 | + var ret = jQuery(); |
| 219 | + |
| 220 | + if ( jQuery.isArray( elems ) ) { |
| 221 | + push.apply( ret, elems ); |
| 222 | + |
| 223 | + } else { |
| 224 | + jQuery.merge( ret, elems ); |
| 225 | + } |
| 226 | + |
| 227 | + // Add the old object onto the stack (as a reference) |
| 228 | + ret.prevObject = this; |
| 229 | + |
| 230 | + ret.context = this.context; |
| 231 | + |
| 232 | + if ( name === "find" ) { |
| 233 | + ret.selector = this.selector + (this.selector ? " " : "") + selector; |
| 234 | + } else if ( name ) { |
| 235 | + ret.selector = this.selector + "." + name + "(" + selector + ")"; |
| 236 | + } |
| 237 | + |
| 238 | + // Return the newly-formed element set |
| 239 | + return ret; |
| 240 | + }, |
| 241 | + |
| 242 | + // Execute a callback for every element in the matched set. |
| 243 | + // (You can seed the arguments with an array of args, but this is |
| 244 | + // only used internally.) |
| 245 | + each: function( callback, args ) { |
| 246 | + return jQuery.each( this, callback, args ); |
| 247 | + }, |
| 248 | + |
| 249 | + ready: function( fn ) { |
| 250 | + // Attach the listeners |
| 251 | + jQuery.bindReady(); |
| 252 | + |
| 253 | + // If the DOM is already ready |
| 254 | + if ( jQuery.isReady ) { |
| 255 | + // Execute the function immediately |
| 256 | + fn.call( document, jQuery ); |
| 257 | + |
| 258 | + // Otherwise, remember the function for later |
| 259 | + } else if ( readyList ) { |
| 260 | + // Add the function to the wait list |
| 261 | + readyList.push( fn ); |
| 262 | + } |
| 263 | + |
| 264 | + return this; |
| 265 | + }, |
| 266 | + |
| 267 | + eq: function( i ) { |
| 268 | + return i === -1 ? |
| 269 | + this.slice( i ) : |
| 270 | + this.slice( i, +i + 1 ); |
| 271 | + }, |
| 272 | + |
| 273 | + first: function() { |
| 274 | + return this.eq( 0 ); |
| 275 | + }, |
| 276 | + |
| 277 | + last: function() { |
| 278 | + return this.eq( -1 ); |
| 279 | + }, |
| 280 | + |
| 281 | + slice: function() { |
| 282 | + return this.pushStack( slice.apply( this, arguments ), |
| 283 | + "slice", slice.call(arguments).join(",") ); |
| 284 | + }, |
| 285 | + |
| 286 | + map: function( callback ) { |
| 287 | + return this.pushStack( jQuery.map(this, function( elem, i ) { |
| 288 | + return callback.call( elem, i, elem ); |
| 289 | + })); |
| 290 | + }, |
| 291 | + |
| 292 | + end: function() { |
| 293 | + return this.prevObject || jQuery(null); |
| 294 | + }, |
| 295 | + |
| 296 | + // For internal use only. |
| 297 | + // Behaves like an Array's method, not like a jQuery method. |
| 298 | + push: push, |
| 299 | + sort: [].sort, |
| 300 | + splice: [].splice |
| 301 | +}; |
| 302 | + |
| 303 | +// Give the init function the jQuery prototype for later instantiation |
| 304 | +jQuery.fn.init.prototype = jQuery.fn; |
| 305 | + |
| 306 | +jQuery.extend = jQuery.fn.extend = function() { |
| 307 | + // copy reference to target object |
| 308 | + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; |
| 309 | + |
| 310 | + // Handle a deep copy situation |
| 311 | + if ( typeof target === "boolean" ) { |
| 312 | + deep = target; |
| 313 | + target = arguments[1] || {}; |
| 314 | + // skip the boolean and the target |
| 315 | + i = 2; |
| 316 | + } |
| 317 | + |
| 318 | + // Handle case when target is a string or something (possible in deep copy) |
| 319 | + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
| 320 | + target = {}; |
| 321 | + } |
| 322 | + |
| 323 | + // extend jQuery itself if only one argument is passed |
| 324 | + if ( length === i ) { |
| 325 | + target = this; |
| 326 | + --i; |
| 327 | + } |
| 328 | + |
| 329 | + for ( ; i < length; i++ ) { |
| 330 | + // Only deal with non-null/undefined values |
| 331 | + if ( (options = arguments[ i ]) != null ) { |
| 332 | + // Extend the base object |
| 333 | + for ( name in options ) { |
| 334 | + src = target[ name ]; |
| 335 | + copy = options[ name ]; |
| 336 | + |
| 337 | + // Prevent never-ending loop |
| 338 | + if ( target === copy ) { |
| 339 | + continue; |
| 340 | + } |
| 341 | + |
| 342 | + // Recurse if we're merging object literal values or arrays |
| 343 | + if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { |
| 344 | + var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src |
| 345 | + : jQuery.isArray(copy) ? [] : {}; |
| 346 | + |
| 347 | + // Never move original objects, clone them |
| 348 | + target[ name ] = jQuery.extend( deep, clone, copy ); |
| 349 | + |
| 350 | + // Don't bring in undefined values |
| 351 | + } else if ( copy !== undefined ) { |
| 352 | + target[ name ] = copy; |
| 353 | + } |
| 354 | + } |
| 355 | + } |
| 356 | + } |
| 357 | + |
| 358 | + // Return the modified object |
| 359 | + return target; |
| 360 | +}; |
| 361 | + |
| 362 | +jQuery.extend({ |
| 363 | + noConflict: function( deep ) { |
| 364 | + window.$ = _$; |
| 365 | + |
| 366 | + if ( deep ) { |
| 367 | + window.jQuery = _jQuery; |
| 368 | + } |
| 369 | + |
| 370 | + return jQuery; |
| 371 | + }, |
| 372 | + |
| 373 | + // Is the DOM ready to be used? Set to true once it occurs. |
| 374 | + isReady: false, |
| 375 | + |
| 376 | + // Handle when the DOM is ready |
| 377 | + ready: function() { |
| 378 | + // Make sure that the DOM is not already loaded |
| 379 | + if ( !jQuery.isReady ) { |
| 380 | + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
| 381 | + if ( !document.body ) { |
| 382 | + return setTimeout( jQuery.ready, 13 ); |
| 383 | + } |
| 384 | + |
| 385 | + // Remember that the DOM is ready |
| 386 | + jQuery.isReady = true; |
| 387 | + |
| 388 | + // If there are functions bound, to execute |
| 389 | + if ( readyList ) { |
| 390 | + // Execute all of them |
| 391 | + var fn, i = 0; |
| 392 | + while ( (fn = readyList[ i++ ]) ) { |
| 393 | + fn.call( document, jQuery ); |
| 394 | + } |
| 395 | + |
| 396 | + // Reset the list of functions |
| 397 | + readyList = null; |
| 398 | + } |
| 399 | + |
| 400 | + // Trigger any bound ready events |
| 401 | + if ( jQuery.fn.triggerHandler ) { |
| 402 | + jQuery( document ).triggerHandler( "ready" ); |
| 403 | + } |
| 404 | + } |
| 405 | + }, |
| 406 | + |
| 407 | + bindReady: function() { |
| 408 | + if ( readyBound ) { |
| 409 | + return; |
| 410 | + } |
| 411 | + |
| 412 | + readyBound = true; |
| 413 | + |
| 414 | + // Catch cases where $(document).ready() is called after the |
| 415 | + // browser event has already occurred. |
| 416 | + if ( document.readyState === "complete" ) { |
| 417 | + return jQuery.ready(); |
| 418 | + } |
| 419 | + |
| 420 | + // Mozilla, Opera and webkit nightlies currently support this event |
| 421 | + if ( document.addEventListener ) { |
| 422 | + // Use the handy event callback |
| 423 | + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
| 424 | + |
| 425 | + // A fallback to window.onload, that will always work |
| 426 | + window.addEventListener( "load", jQuery.ready, false ); |
| 427 | + |
| 428 | + // If IE event model is used |
| 429 | + } else if ( document.attachEvent ) { |
| 430 | + // ensure firing before onload, |
| 431 | + // maybe late but safe also for iframes |
| 432 | + document.attachEvent("onreadystatechange", DOMContentLoaded); |
| 433 | + |
| 434 | + // A fallback to window.onload, that will always work |
| 435 | + window.attachEvent( "onload", jQuery.ready ); |
| 436 | + |
| 437 | + // If IE and not a frame |
| 438 | + // continually check to see if the document is ready |
| 439 | + var toplevel = false; |
| 440 | + |
| 441 | + try { |
| 442 | + toplevel = window.frameElement == null; |
| 443 | + } catch(e) {} |
| 444 | + |
| 445 | + if ( document.documentElement.doScroll && toplevel ) { |
| 446 | + doScrollCheck(); |
| 447 | + } |
| 448 | + } |
| 449 | + }, |
| 450 | + |
| 451 | + // See test/unit/core.js for details concerning isFunction. |
| 452 | + // Since version 1.3, DOM methods and functions like alert |
| 453 | + // aren't supported. They return false on IE (#2968). |
| 454 | + isFunction: function( obj ) { |
| 455 | + return toString.call(obj) === "[object Function]"; |
| 456 | + }, |
| 457 | + |
| 458 | + isArray: function( obj ) { |
| 459 | + return toString.call(obj) === "[object Array]"; |
| 460 | + }, |
| 461 | + |
| 462 | + isPlainObject: function( obj ) { |
| 463 | + // Must be an Object. |
| 464 | + // Because of IE, we also have to check the presence of the constructor property. |
| 465 | + // Make sure that DOM nodes and window objects don't pass through, as well |
| 466 | + if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { |
| 467 | + return false; |
| 468 | + } |
| 469 | + |
| 470 | + // Not own constructor property must be Object |
| 471 | + if ( obj.constructor |
| 472 | + && !hasOwnProperty.call(obj, "constructor") |
| 473 | + && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { |
| 474 | + return false; |
| 475 | + } |
| 476 | + |
| 477 | + // Own properties are enumerated firstly, so to speed up, |
| 478 | + // if last one is own, then all properties are own. |
| 479 | + |
| 480 | + var key; |
| 481 | + for ( key in obj ) {} |
| 482 | + |
| 483 | + return key === undefined || hasOwnProperty.call( obj, key ); |
| 484 | + }, |
| 485 | + |
| 486 | + isEmptyObject: function( obj ) { |
| 487 | + for ( var name in obj ) { |
| 488 | + return false; |
| 489 | + } |
| 490 | + return true; |
| 491 | + }, |
| 492 | + |
| 493 | + error: function( msg ) { |
| 494 | + throw msg; |
| 495 | + }, |
| 496 | + |
| 497 | + parseJSON: function( data ) { |
| 498 | + if ( typeof data !== "string" || !data ) { |
| 499 | + return null; |
| 500 | + } |
| 501 | + |
| 502 | + // Make sure leading/trailing whitespace is removed (IE can't handle it) |
| 503 | + data = jQuery.trim( data ); |
| 504 | + |
| 505 | + // Make sure the incoming data is actual JSON |
| 506 | + // Logic borrowed from http://json.org/json2.js |
| 507 | + if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") |
| 508 | + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") |
| 509 | + .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { |
| 510 | + |
| 511 | + // Try to use the native JSON parser first |
| 512 | + return window.JSON && window.JSON.parse ? |
| 513 | + window.JSON.parse( data ) : |
| 514 | + (new Function("return " + data))(); |
| 515 | + |
| 516 | + } else { |
| 517 | + jQuery.error( "Invalid JSON: " + data ); |
| 518 | + } |
| 519 | + }, |
| 520 | + |
| 521 | + noop: function() {}, |
| 522 | + |
| 523 | + // Evalulates a script in a global context |
| 524 | + globalEval: function( data ) { |
| 525 | + if ( data && rnotwhite.test(data) ) { |
| 526 | + // Inspired by code by Andrea Giammarchi |
| 527 | + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
| 528 | + var head = document.getElementsByTagName("head")[0] || document.documentElement, |
| 529 | + script = document.createElement("script"); |
| 530 | + |
| 531 | + script.type = "text/javascript"; |
| 532 | + |
| 533 | + if ( jQuery.support.scriptEval ) { |
| 534 | + script.appendChild( document.createTextNode( data ) ); |
| 535 | + } else { |
| 536 | + script.text = data; |
| 537 | + } |
| 538 | + |
| 539 | + // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
| 540 | + // This arises when a base node is used (#2709). |
| 541 | + head.insertBefore( script, head.firstChild ); |
| 542 | + head.removeChild( script ); |
| 543 | + } |
| 544 | + }, |
| 545 | + |
| 546 | + nodeName: function( elem, name ) { |
| 547 | + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
| 548 | + }, |
| 549 | + |
| 550 | + // args is for internal usage only |
| 551 | + each: function( object, callback, args ) { |
| 552 | + var name, i = 0, |
| 553 | + length = object.length, |
| 554 | + isObj = length === undefined || jQuery.isFunction(object); |
| 555 | + |
| 556 | + if ( args ) { |
| 557 | + if ( isObj ) { |
| 558 | + for ( name in object ) { |
| 559 | + if ( callback.apply( object[ name ], args ) === false ) { |
| 560 | + break; |
| 561 | + } |
| 562 | + } |
| 563 | + } else { |
| 564 | + for ( ; i < length; ) { |
| 565 | + if ( callback.apply( object[ i++ ], args ) === false ) { |
| 566 | + break; |
| 567 | + } |
| 568 | + } |
| 569 | + } |
| 570 | + |
| 571 | + // A special, fast, case for the most common use of each |
| 572 | + } else { |
| 573 | + if ( isObj ) { |
| 574 | + for ( name in object ) { |
| 575 | + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
| 576 | + break; |
| 577 | + } |
| 578 | + } |
| 579 | + } else { |
| 580 | + for ( var value = object[0]; |
| 581 | + i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} |
| 582 | + } |
| 583 | + } |
| 584 | + |
| 585 | + return object; |
| 586 | + }, |
| 587 | + |
| 588 | + trim: function( text ) { |
| 589 | + return (text || "").replace( rtrim, "" ); |
| 590 | + }, |
| 591 | + |
| 592 | + // results is for internal usage only |
| 593 | + makeArray: function( array, results ) { |
| 594 | + var ret = results || []; |
| 595 | + |
| 596 | + if ( array != null ) { |
| 597 | + // The window, strings (and functions) also have 'length' |
| 598 | + // The extra typeof function check is to prevent crashes |
| 599 | + // in Safari 2 (See: #3039) |
| 600 | + if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { |
| 601 | + push.call( ret, array ); |
| 602 | + } else { |
| 603 | + jQuery.merge( ret, array ); |
| 604 | + } |
| 605 | + } |
| 606 | + |
| 607 | + return ret; |
| 608 | + }, |
| 609 | + |
| 610 | + inArray: function( elem, array ) { |
| 611 | + if ( array.indexOf ) { |
| 612 | + return array.indexOf( elem ); |
| 613 | + } |
| 614 | + |
| 615 | + for ( var i = 0, length = array.length; i < length; i++ ) { |
| 616 | + if ( array[ i ] === elem ) { |
| 617 | + return i; |
| 618 | + } |
| 619 | + } |
| 620 | + |
| 621 | + return -1; |
| 622 | + }, |
| 623 | + |
| 624 | + merge: function( first, second ) { |
| 625 | + var i = first.length, j = 0; |
| 626 | + |
| 627 | + if ( typeof second.length === "number" ) { |
| 628 | + for ( var l = second.length; j < l; j++ ) { |
| 629 | + first[ i++ ] = second[ j ]; |
| 630 | + } |
| 631 | + |
| 632 | + } else { |
| 633 | + while ( second[j] !== undefined ) { |
| 634 | + first[ i++ ] = second[ j++ ]; |
| 635 | + } |
| 636 | + } |
| 637 | + |
| 638 | + first.length = i; |
| 639 | + |
| 640 | + return first; |
| 641 | + }, |
| 642 | + |
| 643 | + grep: function( elems, callback, inv ) { |
| 644 | + var ret = []; |
| 645 | + |
| 646 | + // Go through the array, only saving the items |
| 647 | + // that pass the validator function |
| 648 | + for ( var i = 0, length = elems.length; i < length; i++ ) { |
| 649 | + if ( !inv !== !callback( elems[ i ], i ) ) { |
| 650 | + ret.push( elems[ i ] ); |
| 651 | + } |
| 652 | + } |
| 653 | + |
| 654 | + return ret; |
| 655 | + }, |
| 656 | + |
| 657 | + // arg is for internal usage only |
| 658 | + map: function( elems, callback, arg ) { |
| 659 | + var ret = [], value; |
| 660 | + |
| 661 | + // Go through the array, translating each of the items to their |
| 662 | + // new value (or values). |
| 663 | + for ( var i = 0, length = elems.length; i < length; i++ ) { |
| 664 | + value = callback( elems[ i ], i, arg ); |
| 665 | + |
| 666 | + if ( value != null ) { |
| 667 | + ret[ ret.length ] = value; |
| 668 | + } |
| 669 | + } |
| 670 | + |
| 671 | + return ret.concat.apply( [], ret ); |
| 672 | + }, |
| 673 | + |
| 674 | + // A global GUID counter for objects |
| 675 | + guid: 1, |
| 676 | + |
| 677 | + proxy: function( fn, proxy, thisObject ) { |
| 678 | + if ( arguments.length === 2 ) { |
| 679 | + if ( typeof proxy === "string" ) { |
| 680 | + thisObject = fn; |
| 681 | + fn = thisObject[ proxy ]; |
| 682 | + proxy = undefined; |
| 683 | + |
| 684 | + } else if ( proxy && !jQuery.isFunction( proxy ) ) { |
| 685 | + thisObject = proxy; |
| 686 | + proxy = undefined; |
| 687 | + } |
| 688 | + } |
| 689 | + |
| 690 | + if ( !proxy && fn ) { |
| 691 | + proxy = function() { |
| 692 | + return fn.apply( thisObject || this, arguments ); |
| 693 | + }; |
| 694 | + } |
| 695 | + |
| 696 | + // Set the guid of unique handler to the same of original handler, so it can be removed |
| 697 | + if ( fn ) { |
| 698 | + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
| 699 | + } |
| 700 | + |
| 701 | + // So proxy can be declared as an argument |
| 702 | + return proxy; |
| 703 | + }, |
| 704 | + |
| 705 | + // Use of jQuery.browser is frowned upon. |
| 706 | + // More details: http://docs.jquery.com/Utilities/jQuery.browser |
| 707 | + uaMatch: function( ua ) { |
| 708 | + ua = ua.toLowerCase(); |
| 709 | + |
| 710 | + var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || |
| 711 | + /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || |
| 712 | + /(msie) ([\w.]+)/.exec( ua ) || |
| 713 | + !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || |
| 714 | + []; |
| 715 | + |
| 716 | + return { browser: match[1] || "", version: match[2] || "0" }; |
| 717 | + }, |
| 718 | + |
| 719 | + browser: {} |
| 720 | +}); |
| 721 | + |
| 722 | +browserMatch = jQuery.uaMatch( userAgent ); |
| 723 | +if ( browserMatch.browser ) { |
| 724 | + jQuery.browser[ browserMatch.browser ] = true; |
| 725 | + jQuery.browser.version = browserMatch.version; |
| 726 | +} |
| 727 | + |
| 728 | +// Deprecated, use jQuery.browser.webkit instead |
| 729 | +if ( jQuery.browser.webkit ) { |
| 730 | + jQuery.browser.safari = true; |
| 731 | +} |
| 732 | + |
| 733 | +if ( indexOf ) { |
| 734 | + jQuery.inArray = function( elem, array ) { |
| 735 | + return indexOf.call( array, elem ); |
| 736 | + }; |
| 737 | +} |
| 738 | + |
| 739 | +// All jQuery objects should point back to these |
| 740 | +rootjQuery = jQuery(document); |
| 741 | + |
| 742 | +// Cleanup functions for the document ready method |
| 743 | +if ( document.addEventListener ) { |
| 744 | + DOMContentLoaded = function() { |
| 745 | + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
| 746 | + jQuery.ready(); |
| 747 | + }; |
| 748 | + |
| 749 | +} else if ( document.attachEvent ) { |
| 750 | + DOMContentLoaded = function() { |
| 751 | + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
| 752 | + if ( document.readyState === "complete" ) { |
| 753 | + document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
| 754 | + jQuery.ready(); |
| 755 | + } |
| 756 | + }; |
| 757 | +} |
| 758 | + |
| 759 | +// The DOM ready check for Internet Explorer |
| 760 | +function doScrollCheck() { |
| 761 | + if ( jQuery.isReady ) { |
| 762 | + return; |
| 763 | + } |
| 764 | + |
| 765 | + try { |
| 766 | + // If IE is used, use the trick by Diego Perini |
| 767 | + // http://javascript.nwbox.com/IEContentLoaded/ |
| 768 | + document.documentElement.doScroll("left"); |
| 769 | + } catch( error ) { |
| 770 | + setTimeout( doScrollCheck, 1 ); |
| 771 | + return; |
| 772 | + } |
| 773 | + |
| 774 | + // and execute any waiting functions |
| 775 | + jQuery.ready(); |
| 776 | +} |
| 777 | + |
| 778 | +function evalScript( i, elem ) { |
| 779 | + if ( elem.src ) { |
| 780 | + jQuery.ajax({ |
| 781 | + url: elem.src, |
| 782 | + async: false, |
| 783 | + dataType: "script" |
| 784 | + }); |
| 785 | + } else { |
| 786 | + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
| 787 | + } |
| 788 | + |
| 789 | + if ( elem.parentNode ) { |
| 790 | + elem.parentNode.removeChild( elem ); |
| 791 | + } |
| 792 | +} |
| 793 | + |
| 794 | +// Mutifunctional method to get and set values to a collection |
| 795 | +// The value/s can be optionally by executed if its a function |
| 796 | +function access( elems, key, value, exec, fn, pass ) { |
| 797 | + var length = elems.length; |
| 798 | + |
| 799 | + // Setting many attributes |
| 800 | + if ( typeof key === "object" ) { |
| 801 | + for ( var k in key ) { |
| 802 | + access( elems, k, key[k], exec, fn, value ); |
| 803 | + } |
| 804 | + return elems; |
| 805 | + } |
| 806 | + |
| 807 | + // Setting one attribute |
| 808 | + if ( value !== undefined ) { |
| 809 | + // Optionally, function values get executed if exec is true |
| 810 | + exec = !pass && exec && jQuery.isFunction(value); |
| 811 | + |
| 812 | + for ( var i = 0; i < length; i++ ) { |
| 813 | + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
| 814 | + } |
| 815 | + |
| 816 | + return elems; |
| 817 | + } |
| 818 | + |
| 819 | + // Getting an attribute |
| 820 | + return length ? fn( elems[0], key ) : undefined; |
| 821 | +} |
| 822 | + |
| 823 | +function now() { |
| 824 | + return (new Date).getTime(); |
| 825 | +} |
| 826 | +(function() { |
| 827 | + |
| 828 | + jQuery.support = {}; |
| 829 | + |
| 830 | + var root = document.documentElement, |
| 831 | + script = document.createElement("script"), |
| 832 | + div = document.createElement("div"), |
| 833 | + id = "script" + now(); |
| 834 | + |
| 835 | + div.style.display = "none"; |
| 836 | + div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
| 837 | + |
| 838 | + var all = div.getElementsByTagName("*"), |
| 839 | + a = div.getElementsByTagName("a")[0]; |
| 840 | + |
| 841 | + // Can't get basic test support |
| 842 | + if ( !all || !all.length || !a ) { |
| 843 | + return; |
| 844 | + } |
| 845 | + |
| 846 | + jQuery.support = { |
| 847 | + // IE strips leading whitespace when .innerHTML is used |
| 848 | + leadingWhitespace: div.firstChild.nodeType === 3, |
| 849 | + |
| 850 | + // Make sure that tbody elements aren't automatically inserted |
| 851 | + // IE will insert them into empty tables |
| 852 | + tbody: !div.getElementsByTagName("tbody").length, |
| 853 | + |
| 854 | + // Make sure that link elements get serialized correctly by innerHTML |
| 855 | + // This requires a wrapper element in IE |
| 856 | + htmlSerialize: !!div.getElementsByTagName("link").length, |
| 857 | + |
| 858 | + // Get the style information from getAttribute |
| 859 | + // (IE uses .cssText insted) |
| 860 | + style: /red/.test( a.getAttribute("style") ), |
| 861 | + |
| 862 | + // Make sure that URLs aren't manipulated |
| 863 | + // (IE normalizes it by default) |
| 864 | + hrefNormalized: a.getAttribute("href") === "/a", |
| 865 | + |
| 866 | + // Make sure that element opacity exists |
| 867 | + // (IE uses filter instead) |
| 868 | + // Use a regex to work around a WebKit issue. See #5145 |
| 869 | + opacity: /^0.55$/.test( a.style.opacity ), |
| 870 | + |
| 871 | + // Verify style float existence |
| 872 | + // (IE uses styleFloat instead of cssFloat) |
| 873 | + cssFloat: !!a.style.cssFloat, |
| 874 | + |
| 875 | + // Make sure that if no value is specified for a checkbox |
| 876 | + // that it defaults to "on". |
| 877 | + // (WebKit defaults to "" instead) |
| 878 | + checkOn: div.getElementsByTagName("input")[0].value === "on", |
| 879 | + |
| 880 | + // Make sure that a selected-by-default option has a working selected property. |
| 881 | + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
| 882 | + optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, |
| 883 | + |
| 884 | + parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, |
| 885 | + |
| 886 | + // Will be defined later |
| 887 | + deleteExpando: true, |
| 888 | + checkClone: false, |
| 889 | + scriptEval: false, |
| 890 | + noCloneEvent: true, |
| 891 | + boxModel: null |
| 892 | + }; |
| 893 | + |
| 894 | + script.type = "text/javascript"; |
| 895 | + try { |
| 896 | + script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
| 897 | + } catch(e) {} |
| 898 | + |
| 899 | + root.insertBefore( script, root.firstChild ); |
| 900 | + |
| 901 | + // Make sure that the execution of code works by injecting a script |
| 902 | + // tag with appendChild/createTextNode |
| 903 | + // (IE doesn't support this, fails, and uses .text instead) |
| 904 | + if ( window[ id ] ) { |
| 905 | + jQuery.support.scriptEval = true; |
| 906 | + delete window[ id ]; |
| 907 | + } |
| 908 | + |
| 909 | + // Test to see if it's possible to delete an expando from an element |
| 910 | + // Fails in Internet Explorer |
| 911 | + try { |
| 912 | + delete script.test; |
| 913 | + |
| 914 | + } catch(e) { |
| 915 | + jQuery.support.deleteExpando = false; |
| 916 | + } |
| 917 | + |
| 918 | + root.removeChild( script ); |
| 919 | + |
| 920 | + if ( div.attachEvent && div.fireEvent ) { |
| 921 | + div.attachEvent("onclick", function click() { |
| 922 | + // Cloning a node shouldn't copy over any |
| 923 | + // bound event handlers (IE does this) |
| 924 | + jQuery.support.noCloneEvent = false; |
| 925 | + div.detachEvent("onclick", click); |
| 926 | + }); |
| 927 | + div.cloneNode(true).fireEvent("onclick"); |
| 928 | + } |
| 929 | + |
| 930 | + div = document.createElement("div"); |
| 931 | + div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; |
| 932 | + |
| 933 | + var fragment = document.createDocumentFragment(); |
| 934 | + fragment.appendChild( div.firstChild ); |
| 935 | + |
| 936 | + // WebKit doesn't clone checked state correctly in fragments |
| 937 | + jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; |
| 938 | + |
| 939 | + // Figure out if the W3C box model works as expected |
| 940 | + // document.body must exist before we can do this |
| 941 | + jQuery(function() { |
| 942 | + var div = document.createElement("div"); |
| 943 | + div.style.width = div.style.paddingLeft = "1px"; |
| 944 | + |
| 945 | + document.body.appendChild( div ); |
| 946 | + jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
| 947 | + document.body.removeChild( div ).style.display = 'none'; |
| 948 | + |
| 949 | + div = null; |
| 950 | + }); |
| 951 | + |
| 952 | + // Technique from Juriy Zaytsev |
| 953 | + // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ |
| 954 | + var eventSupported = function( eventName ) { |
| 955 | + var el = document.createElement("div"); |
| 956 | + eventName = "on" + eventName; |
| 957 | + |
| 958 | + var isSupported = (eventName in el); |
| 959 | + if ( !isSupported ) { |
| 960 | + el.setAttribute(eventName, "return;"); |
| 961 | + isSupported = typeof el[eventName] === "function"; |
| 962 | + } |
| 963 | + el = null; |
| 964 | + |
| 965 | + return isSupported; |
| 966 | + }; |
| 967 | + |
| 968 | + jQuery.support.submitBubbles = eventSupported("submit"); |
| 969 | + jQuery.support.changeBubbles = eventSupported("change"); |
| 970 | + |
| 971 | + // release memory in IE |
| 972 | + root = script = div = all = a = null; |
| 973 | +})(); |
| 974 | + |
| 975 | +jQuery.props = { |
| 976 | + "for": "htmlFor", |
| 977 | + "class": "className", |
| 978 | + readonly: "readOnly", |
| 979 | + maxlength: "maxLength", |
| 980 | + cellspacing: "cellSpacing", |
| 981 | + rowspan: "rowSpan", |
| 982 | + colspan: "colSpan", |
| 983 | + tabindex: "tabIndex", |
| 984 | + usemap: "useMap", |
| 985 | + frameborder: "frameBorder" |
| 986 | +}; |
| 987 | +var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
| 988 | + |
| 989 | +jQuery.extend({ |
| 990 | + cache: {}, |
| 991 | + |
| 992 | + expando:expando, |
| 993 | + |
| 994 | + // The following elements throw uncatchable exceptions if you |
| 995 | + // attempt to add expando properties to them. |
| 996 | + noData: { |
| 997 | + "embed": true, |
| 998 | + "object": true, |
| 999 | + "applet": true |
| 1000 | + }, |
| 1001 | + |
| 1002 | + data: function( elem, name, data ) { |
| 1003 | + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { |
| 1004 | + return; |
| 1005 | + } |
| 1006 | + |
| 1007 | + elem = elem == window ? |
| 1008 | + windowData : |
| 1009 | + elem; |
| 1010 | + |
| 1011 | + var id = elem[ expando ], cache = jQuery.cache, thisCache; |
| 1012 | + |
| 1013 | + if ( !id && typeof name === "string" && data === undefined ) { |
| 1014 | + return null; |
| 1015 | + } |
| 1016 | + |
| 1017 | + // Compute a unique ID for the element |
| 1018 | + if ( !id ) { |
| 1019 | + id = ++uuid; |
| 1020 | + } |
| 1021 | + |
| 1022 | + // Avoid generating a new cache unless none exists and we |
| 1023 | + // want to manipulate it. |
| 1024 | + if ( typeof name === "object" ) { |
| 1025 | + elem[ expando ] = id; |
| 1026 | + thisCache = cache[ id ] = jQuery.extend(true, {}, name); |
| 1027 | + |
| 1028 | + } else if ( !cache[ id ] ) { |
| 1029 | + elem[ expando ] = id; |
| 1030 | + cache[ id ] = {}; |
| 1031 | + } |
| 1032 | + |
| 1033 | + thisCache = cache[ id ]; |
| 1034 | + |
| 1035 | + // Prevent overriding the named cache with undefined values |
| 1036 | + if ( data !== undefined ) { |
| 1037 | + thisCache[ name ] = data; |
| 1038 | + } |
| 1039 | + |
| 1040 | + return typeof name === "string" ? thisCache[ name ] : thisCache; |
| 1041 | + }, |
| 1042 | + |
| 1043 | + removeData: function( elem, name ) { |
| 1044 | + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { |
| 1045 | + return; |
| 1046 | + } |
| 1047 | + |
| 1048 | + elem = elem == window ? |
| 1049 | + windowData : |
| 1050 | + elem; |
| 1051 | + |
| 1052 | + var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; |
| 1053 | + |
| 1054 | + // If we want to remove a specific section of the element's data |
| 1055 | + if ( name ) { |
| 1056 | + if ( thisCache ) { |
| 1057 | + // Remove the section of cache data |
| 1058 | + delete thisCache[ name ]; |
| 1059 | + |
| 1060 | + // If we've removed all the data, remove the element's cache |
| 1061 | + if ( jQuery.isEmptyObject(thisCache) ) { |
| 1062 | + jQuery.removeData( elem ); |
| 1063 | + } |
| 1064 | + } |
| 1065 | + |
| 1066 | + // Otherwise, we want to remove all of the element's data |
| 1067 | + } else { |
| 1068 | + if ( jQuery.support.deleteExpando ) { |
| 1069 | + delete elem[ jQuery.expando ]; |
| 1070 | + |
| 1071 | + } else if ( elem.removeAttribute ) { |
| 1072 | + elem.removeAttribute( jQuery.expando ); |
| 1073 | + } |
| 1074 | + |
| 1075 | + // Completely remove the data cache |
| 1076 | + delete cache[ id ]; |
| 1077 | + } |
| 1078 | + } |
| 1079 | +}); |
| 1080 | + |
| 1081 | +jQuery.fn.extend({ |
| 1082 | + data: function( key, value ) { |
| 1083 | + if ( typeof key === "undefined" && this.length ) { |
| 1084 | + return jQuery.data( this[0] ); |
| 1085 | + |
| 1086 | + } else if ( typeof key === "object" ) { |
| 1087 | + return this.each(function() { |
| 1088 | + jQuery.data( this, key ); |
| 1089 | + }); |
| 1090 | + } |
| 1091 | + |
| 1092 | + var parts = key.split("."); |
| 1093 | + parts[1] = parts[1] ? "." + parts[1] : ""; |
| 1094 | + |
| 1095 | + if ( value === undefined ) { |
| 1096 | + var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
| 1097 | + |
| 1098 | + if ( data === undefined && this.length ) { |
| 1099 | + data = jQuery.data( this[0], key ); |
| 1100 | + } |
| 1101 | + return data === undefined && parts[1] ? |
| 1102 | + this.data( parts[0] ) : |
| 1103 | + data; |
| 1104 | + } else { |
| 1105 | + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { |
| 1106 | + jQuery.data( this, key, value ); |
| 1107 | + }); |
| 1108 | + } |
| 1109 | + }, |
| 1110 | + |
| 1111 | + removeData: function( key ) { |
| 1112 | + return this.each(function() { |
| 1113 | + jQuery.removeData( this, key ); |
| 1114 | + }); |
| 1115 | + } |
| 1116 | +}); |
| 1117 | +jQuery.extend({ |
| 1118 | + queue: function( elem, type, data ) { |
| 1119 | + if ( !elem ) { |
| 1120 | + return; |
| 1121 | + } |
| 1122 | + |
| 1123 | + type = (type || "fx") + "queue"; |
| 1124 | + var q = jQuery.data( elem, type ); |
| 1125 | + |
| 1126 | + // Speed up dequeue by getting out quickly if this is just a lookup |
| 1127 | + if ( !data ) { |
| 1128 | + return q || []; |
| 1129 | + } |
| 1130 | + |
| 1131 | + if ( !q || jQuery.isArray(data) ) { |
| 1132 | + q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
| 1133 | + |
| 1134 | + } else { |
| 1135 | + q.push( data ); |
| 1136 | + } |
| 1137 | + |
| 1138 | + return q; |
| 1139 | + }, |
| 1140 | + |
| 1141 | + dequeue: function( elem, type ) { |
| 1142 | + type = type || "fx"; |
| 1143 | + |
| 1144 | + var queue = jQuery.queue( elem, type ), fn = queue.shift(); |
| 1145 | + |
| 1146 | + // If the fx queue is dequeued, always remove the progress sentinel |
| 1147 | + if ( fn === "inprogress" ) { |
| 1148 | + fn = queue.shift(); |
| 1149 | + } |
| 1150 | + |
| 1151 | + if ( fn ) { |
| 1152 | + // Add a progress sentinel to prevent the fx queue from being |
| 1153 | + // automatically dequeued |
| 1154 | + if ( type === "fx" ) { |
| 1155 | + queue.unshift("inprogress"); |
| 1156 | + } |
| 1157 | + |
| 1158 | + fn.call(elem, function() { |
| 1159 | + jQuery.dequeue(elem, type); |
| 1160 | + }); |
| 1161 | + } |
| 1162 | + } |
| 1163 | +}); |
| 1164 | + |
| 1165 | +jQuery.fn.extend({ |
| 1166 | + queue: function( type, data ) { |
| 1167 | + if ( typeof type !== "string" ) { |
| 1168 | + data = type; |
| 1169 | + type = "fx"; |
| 1170 | + } |
| 1171 | + |
| 1172 | + if ( data === undefined ) { |
| 1173 | + return jQuery.queue( this[0], type ); |
| 1174 | + } |
| 1175 | + return this.each(function( i, elem ) { |
| 1176 | + var queue = jQuery.queue( this, type, data ); |
| 1177 | + |
| 1178 | + if ( type === "fx" && queue[0] !== "inprogress" ) { |
| 1179 | + jQuery.dequeue( this, type ); |
| 1180 | + } |
| 1181 | + }); |
| 1182 | + }, |
| 1183 | + dequeue: function( type ) { |
| 1184 | + return this.each(function() { |
| 1185 | + jQuery.dequeue( this, type ); |
| 1186 | + }); |
| 1187 | + }, |
| 1188 | + |
| 1189 | + // Based off of the plugin by Clint Helfers, with permission. |
| 1190 | + // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
| 1191 | + delay: function( time, type ) { |
| 1192 | + time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
| 1193 | + type = type || "fx"; |
| 1194 | + |
| 1195 | + return this.queue( type, function() { |
| 1196 | + var elem = this; |
| 1197 | + setTimeout(function() { |
| 1198 | + jQuery.dequeue( elem, type ); |
| 1199 | + }, time ); |
| 1200 | + }); |
| 1201 | + }, |
| 1202 | + |
| 1203 | + clearQueue: function( type ) { |
| 1204 | + return this.queue( type || "fx", [] ); |
| 1205 | + } |
| 1206 | +}); |
| 1207 | +var rclass = /[\n\t]/g, |
| 1208 | + rspace = /\s+/, |
| 1209 | + rreturn = /\r/g, |
| 1210 | + rspecialurl = /href|src|style/, |
| 1211 | + rtype = /(button|input)/i, |
| 1212 | + rfocusable = /(button|input|object|select|textarea)/i, |
| 1213 | + rclickable = /^(a|area)$/i, |
| 1214 | + rradiocheck = /radio|checkbox/; |
| 1215 | + |
| 1216 | +jQuery.fn.extend({ |
| 1217 | + attr: function( name, value ) { |
| 1218 | + return access( this, name, value, true, jQuery.attr ); |
| 1219 | + }, |
| 1220 | + |
| 1221 | + removeAttr: function( name, fn ) { |
| 1222 | + return this.each(function(){ |
| 1223 | + jQuery.attr( this, name, "" ); |
| 1224 | + if ( this.nodeType === 1 ) { |
| 1225 | + this.removeAttribute( name ); |
| 1226 | + } |
| 1227 | + }); |
| 1228 | + }, |
| 1229 | + |
| 1230 | + addClass: function( value ) { |
| 1231 | + if ( jQuery.isFunction(value) ) { |
| 1232 | + return this.each(function(i) { |
| 1233 | + var self = jQuery(this); |
| 1234 | + self.addClass( value.call(this, i, self.attr("class")) ); |
| 1235 | + }); |
| 1236 | + } |
| 1237 | + |
| 1238 | + if ( value && typeof value === "string" ) { |
| 1239 | + var classNames = (value || "").split( rspace ); |
| 1240 | + |
| 1241 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 1242 | + var elem = this[i]; |
| 1243 | + |
| 1244 | + if ( elem.nodeType === 1 ) { |
| 1245 | + if ( !elem.className ) { |
| 1246 | + elem.className = value; |
| 1247 | + |
| 1248 | + } else { |
| 1249 | + var className = " " + elem.className + " ", setClass = elem.className; |
| 1250 | + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
| 1251 | + if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { |
| 1252 | + setClass += " " + classNames[c]; |
| 1253 | + } |
| 1254 | + } |
| 1255 | + elem.className = jQuery.trim( setClass ); |
| 1256 | + } |
| 1257 | + } |
| 1258 | + } |
| 1259 | + } |
| 1260 | + |
| 1261 | + return this; |
| 1262 | + }, |
| 1263 | + |
| 1264 | + removeClass: function( value ) { |
| 1265 | + if ( jQuery.isFunction(value) ) { |
| 1266 | + return this.each(function(i) { |
| 1267 | + var self = jQuery(this); |
| 1268 | + self.removeClass( value.call(this, i, self.attr("class")) ); |
| 1269 | + }); |
| 1270 | + } |
| 1271 | + |
| 1272 | + if ( (value && typeof value === "string") || value === undefined ) { |
| 1273 | + var classNames = (value || "").split(rspace); |
| 1274 | + |
| 1275 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 1276 | + var elem = this[i]; |
| 1277 | + |
| 1278 | + if ( elem.nodeType === 1 && elem.className ) { |
| 1279 | + if ( value ) { |
| 1280 | + var className = (" " + elem.className + " ").replace(rclass, " "); |
| 1281 | + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
| 1282 | + className = className.replace(" " + classNames[c] + " ", " "); |
| 1283 | + } |
| 1284 | + elem.className = jQuery.trim( className ); |
| 1285 | + |
| 1286 | + } else { |
| 1287 | + elem.className = ""; |
| 1288 | + } |
| 1289 | + } |
| 1290 | + } |
| 1291 | + } |
| 1292 | + |
| 1293 | + return this; |
| 1294 | + }, |
| 1295 | + |
| 1296 | + toggleClass: function( value, stateVal ) { |
| 1297 | + var type = typeof value, isBool = typeof stateVal === "boolean"; |
| 1298 | + |
| 1299 | + if ( jQuery.isFunction( value ) ) { |
| 1300 | + return this.each(function(i) { |
| 1301 | + var self = jQuery(this); |
| 1302 | + self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); |
| 1303 | + }); |
| 1304 | + } |
| 1305 | + |
| 1306 | + return this.each(function() { |
| 1307 | + if ( type === "string" ) { |
| 1308 | + // toggle individual class names |
| 1309 | + var className, i = 0, self = jQuery(this), |
| 1310 | + state = stateVal, |
| 1311 | + classNames = value.split( rspace ); |
| 1312 | + |
| 1313 | + while ( (className = classNames[ i++ ]) ) { |
| 1314 | + // check each className given, space seperated list |
| 1315 | + state = isBool ? state : !self.hasClass( className ); |
| 1316 | + self[ state ? "addClass" : "removeClass" ]( className ); |
| 1317 | + } |
| 1318 | + |
| 1319 | + } else if ( type === "undefined" || type === "boolean" ) { |
| 1320 | + if ( this.className ) { |
| 1321 | + // store className if set |
| 1322 | + jQuery.data( this, "__className__", this.className ); |
| 1323 | + } |
| 1324 | + |
| 1325 | + // toggle whole className |
| 1326 | + this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; |
| 1327 | + } |
| 1328 | + }); |
| 1329 | + }, |
| 1330 | + |
| 1331 | + hasClass: function( selector ) { |
| 1332 | + var className = " " + selector + " "; |
| 1333 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 1334 | + if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { |
| 1335 | + return true; |
| 1336 | + } |
| 1337 | + } |
| 1338 | + |
| 1339 | + return false; |
| 1340 | + }, |
| 1341 | + |
| 1342 | + val: function( value ) { |
| 1343 | + if ( value === undefined ) { |
| 1344 | + var elem = this[0]; |
| 1345 | + |
| 1346 | + if ( elem ) { |
| 1347 | + if ( jQuery.nodeName( elem, "option" ) ) { |
| 1348 | + return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
| 1349 | + } |
| 1350 | + |
| 1351 | + // We need to handle select boxes special |
| 1352 | + if ( jQuery.nodeName( elem, "select" ) ) { |
| 1353 | + var index = elem.selectedIndex, |
| 1354 | + values = [], |
| 1355 | + options = elem.options, |
| 1356 | + one = elem.type === "select-one"; |
| 1357 | + |
| 1358 | + // Nothing was selected |
| 1359 | + if ( index < 0 ) { |
| 1360 | + return null; |
| 1361 | + } |
| 1362 | + |
| 1363 | + // Loop through all the selected options |
| 1364 | + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
| 1365 | + var option = options[ i ]; |
| 1366 | + |
| 1367 | + if ( option.selected ) { |
| 1368 | + // Get the specifc value for the option |
| 1369 | + value = jQuery(option).val(); |
| 1370 | + |
| 1371 | + // We don't need an array for one selects |
| 1372 | + if ( one ) { |
| 1373 | + return value; |
| 1374 | + } |
| 1375 | + |
| 1376 | + // Multi-Selects return an array |
| 1377 | + values.push( value ); |
| 1378 | + } |
| 1379 | + } |
| 1380 | + |
| 1381 | + return values; |
| 1382 | + } |
| 1383 | + |
| 1384 | + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
| 1385 | + if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { |
| 1386 | + return elem.getAttribute("value") === null ? "on" : elem.value; |
| 1387 | + } |
| 1388 | + |
| 1389 | + |
| 1390 | + // Everything else, we just grab the value |
| 1391 | + return (elem.value || "").replace(rreturn, ""); |
| 1392 | + |
| 1393 | + } |
| 1394 | + |
| 1395 | + return undefined; |
| 1396 | + } |
| 1397 | + |
| 1398 | + var isFunction = jQuery.isFunction(value); |
| 1399 | + |
| 1400 | + return this.each(function(i) { |
| 1401 | + var self = jQuery(this), val = value; |
| 1402 | + |
| 1403 | + if ( this.nodeType !== 1 ) { |
| 1404 | + return; |
| 1405 | + } |
| 1406 | + |
| 1407 | + if ( isFunction ) { |
| 1408 | + val = value.call(this, i, self.val()); |
| 1409 | + } |
| 1410 | + |
| 1411 | + // Typecast each time if the value is a Function and the appended |
| 1412 | + // value is therefore different each time. |
| 1413 | + if ( typeof val === "number" ) { |
| 1414 | + val += ""; |
| 1415 | + } |
| 1416 | + |
| 1417 | + if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { |
| 1418 | + this.checked = jQuery.inArray( self.val(), val ) >= 0; |
| 1419 | + |
| 1420 | + } else if ( jQuery.nodeName( this, "select" ) ) { |
| 1421 | + var values = jQuery.makeArray(val); |
| 1422 | + |
| 1423 | + jQuery( "option", this ).each(function() { |
| 1424 | + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
| 1425 | + }); |
| 1426 | + |
| 1427 | + if ( !values.length ) { |
| 1428 | + this.selectedIndex = -1; |
| 1429 | + } |
| 1430 | + |
| 1431 | + } else { |
| 1432 | + this.value = val; |
| 1433 | + } |
| 1434 | + }); |
| 1435 | + } |
| 1436 | +}); |
| 1437 | + |
| 1438 | +jQuery.extend({ |
| 1439 | + attrFn: { |
| 1440 | + val: true, |
| 1441 | + css: true, |
| 1442 | + html: true, |
| 1443 | + text: true, |
| 1444 | + data: true, |
| 1445 | + width: true, |
| 1446 | + height: true, |
| 1447 | + offset: true |
| 1448 | + }, |
| 1449 | + |
| 1450 | + attr: function( elem, name, value, pass ) { |
| 1451 | + // don't set attributes on text and comment nodes |
| 1452 | + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
| 1453 | + return undefined; |
| 1454 | + } |
| 1455 | + |
| 1456 | + if ( pass && name in jQuery.attrFn ) { |
| 1457 | + return jQuery(elem)[name](value); |
| 1458 | + } |
| 1459 | + |
| 1460 | + var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
| 1461 | + // Whether we are setting (or getting) |
| 1462 | + set = value !== undefined; |
| 1463 | + |
| 1464 | + // Try to normalize/fix the name |
| 1465 | + name = notxml && jQuery.props[ name ] || name; |
| 1466 | + |
| 1467 | + // Only do all the following if this is a node (faster for style) |
| 1468 | + if ( elem.nodeType === 1 ) { |
| 1469 | + // These attributes require special treatment |
| 1470 | + var special = rspecialurl.test( name ); |
| 1471 | + |
| 1472 | + // Safari mis-reports the default selected property of an option |
| 1473 | + // Accessing the parent's selectedIndex property fixes it |
| 1474 | + if ( name === "selected" && !jQuery.support.optSelected ) { |
| 1475 | + var parent = elem.parentNode; |
| 1476 | + if ( parent ) { |
| 1477 | + parent.selectedIndex; |
| 1478 | + |
| 1479 | + // Make sure that it also works with optgroups, see #5701 |
| 1480 | + if ( parent.parentNode ) { |
| 1481 | + parent.parentNode.selectedIndex; |
| 1482 | + } |
| 1483 | + } |
| 1484 | + } |
| 1485 | + |
| 1486 | + // If applicable, access the attribute via the DOM 0 way |
| 1487 | + if ( name in elem && notxml && !special ) { |
| 1488 | + if ( set ) { |
| 1489 | + // We can't allow the type property to be changed (since it causes problems in IE) |
| 1490 | + if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { |
| 1491 | + jQuery.error( "type property can't be changed" ); |
| 1492 | + } |
| 1493 | + |
| 1494 | + elem[ name ] = value; |
| 1495 | + } |
| 1496 | + |
| 1497 | + // browsers index elements by id/name on forms, give priority to attributes. |
| 1498 | + if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { |
| 1499 | + return elem.getAttributeNode( name ).nodeValue; |
| 1500 | + } |
| 1501 | + |
| 1502 | + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
| 1503 | + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
| 1504 | + if ( name === "tabIndex" ) { |
| 1505 | + var attributeNode = elem.getAttributeNode( "tabIndex" ); |
| 1506 | + |
| 1507 | + return attributeNode && attributeNode.specified ? |
| 1508 | + attributeNode.value : |
| 1509 | + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
| 1510 | + 0 : |
| 1511 | + undefined; |
| 1512 | + } |
| 1513 | + |
| 1514 | + return elem[ name ]; |
| 1515 | + } |
| 1516 | + |
| 1517 | + if ( !jQuery.support.style && notxml && name === "style" ) { |
| 1518 | + if ( set ) { |
| 1519 | + elem.style.cssText = "" + value; |
| 1520 | + } |
| 1521 | + |
| 1522 | + return elem.style.cssText; |
| 1523 | + } |
| 1524 | + |
| 1525 | + if ( set ) { |
| 1526 | + // convert the value to a string (all browsers do this but IE) see #1070 |
| 1527 | + elem.setAttribute( name, "" + value ); |
| 1528 | + } |
| 1529 | + |
| 1530 | + var attr = !jQuery.support.hrefNormalized && notxml && special ? |
| 1531 | + // Some attributes require a special call on IE |
| 1532 | + elem.getAttribute( name, 2 ) : |
| 1533 | + elem.getAttribute( name ); |
| 1534 | + |
| 1535 | + // Non-existent attributes return null, we normalize to undefined |
| 1536 | + return attr === null ? undefined : attr; |
| 1537 | + } |
| 1538 | + |
| 1539 | + // elem is actually elem.style ... set the style |
| 1540 | + // Using attr for specific style information is now deprecated. Use style instead. |
| 1541 | + return jQuery.style( elem, name, value ); |
| 1542 | + } |
| 1543 | +}); |
| 1544 | +var rnamespaces = /\.(.*)$/, |
| 1545 | + fcleanup = function( nm ) { |
| 1546 | + return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { |
| 1547 | + return "\\" + ch; |
| 1548 | + }); |
| 1549 | + }; |
| 1550 | + |
| 1551 | +/* |
| 1552 | + * A number of helper functions used for managing events. |
| 1553 | + * Many of the ideas behind this code originated from |
| 1554 | + * Dean Edwards' addEvent library. |
| 1555 | + */ |
| 1556 | +jQuery.event = { |
| 1557 | + |
| 1558 | + // Bind an event to an element |
| 1559 | + // Original by Dean Edwards |
| 1560 | + add: function( elem, types, handler, data ) { |
| 1561 | + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
| 1562 | + return; |
| 1563 | + } |
| 1564 | + |
| 1565 | + // For whatever reason, IE has trouble passing the window object |
| 1566 | + // around, causing it to be cloned in the process |
| 1567 | + if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { |
| 1568 | + elem = window; |
| 1569 | + } |
| 1570 | + |
| 1571 | + var handleObjIn, handleObj; |
| 1572 | + |
| 1573 | + if ( handler.handler ) { |
| 1574 | + handleObjIn = handler; |
| 1575 | + handler = handleObjIn.handler; |
| 1576 | + } |
| 1577 | + |
| 1578 | + // Make sure that the function being executed has a unique ID |
| 1579 | + if ( !handler.guid ) { |
| 1580 | + handler.guid = jQuery.guid++; |
| 1581 | + } |
| 1582 | + |
| 1583 | + // Init the element's event structure |
| 1584 | + var elemData = jQuery.data( elem ); |
| 1585 | + |
| 1586 | + // If no elemData is found then we must be trying to bind to one of the |
| 1587 | + // banned noData elements |
| 1588 | + if ( !elemData ) { |
| 1589 | + return; |
| 1590 | + } |
| 1591 | + |
| 1592 | + var events = elemData.events = elemData.events || {}, |
| 1593 | + eventHandle = elemData.handle, eventHandle; |
| 1594 | + |
| 1595 | + if ( !eventHandle ) { |
| 1596 | + elemData.handle = eventHandle = function() { |
| 1597 | + // Handle the second event of a trigger and when |
| 1598 | + // an event is called after a page has unloaded |
| 1599 | + return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
| 1600 | + jQuery.event.handle.apply( eventHandle.elem, arguments ) : |
| 1601 | + undefined; |
| 1602 | + }; |
| 1603 | + } |
| 1604 | + |
| 1605 | + // Add elem as a property of the handle function |
| 1606 | + // This is to prevent a memory leak with non-native events in IE. |
| 1607 | + eventHandle.elem = elem; |
| 1608 | + |
| 1609 | + // Handle multiple events separated by a space |
| 1610 | + // jQuery(...).bind("mouseover mouseout", fn); |
| 1611 | + types = types.split(" "); |
| 1612 | + |
| 1613 | + var type, i = 0, namespaces; |
| 1614 | + |
| 1615 | + while ( (type = types[ i++ ]) ) { |
| 1616 | + handleObj = handleObjIn ? |
| 1617 | + jQuery.extend({}, handleObjIn) : |
| 1618 | + { handler: handler, data: data }; |
| 1619 | + |
| 1620 | + // Namespaced event handlers |
| 1621 | + if ( type.indexOf(".") > -1 ) { |
| 1622 | + namespaces = type.split("."); |
| 1623 | + type = namespaces.shift(); |
| 1624 | + handleObj.namespace = namespaces.slice(0).sort().join("."); |
| 1625 | + |
| 1626 | + } else { |
| 1627 | + namespaces = []; |
| 1628 | + handleObj.namespace = ""; |
| 1629 | + } |
| 1630 | + |
| 1631 | + handleObj.type = type; |
| 1632 | + handleObj.guid = handler.guid; |
| 1633 | + |
| 1634 | + // Get the current list of functions bound to this event |
| 1635 | + var handlers = events[ type ], |
| 1636 | + special = jQuery.event.special[ type ] || {}; |
| 1637 | + |
| 1638 | + // Init the event handler queue |
| 1639 | + if ( !handlers ) { |
| 1640 | + handlers = events[ type ] = []; |
| 1641 | + |
| 1642 | + // Check for a special event handler |
| 1643 | + // Only use addEventListener/attachEvent if the special |
| 1644 | + // events handler returns false |
| 1645 | + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
| 1646 | + // Bind the global event handler to the element |
| 1647 | + if ( elem.addEventListener ) { |
| 1648 | + elem.addEventListener( type, eventHandle, false ); |
| 1649 | + |
| 1650 | + } else if ( elem.attachEvent ) { |
| 1651 | + elem.attachEvent( "on" + type, eventHandle ); |
| 1652 | + } |
| 1653 | + } |
| 1654 | + } |
| 1655 | + |
| 1656 | + if ( special.add ) { |
| 1657 | + special.add.call( elem, handleObj ); |
| 1658 | + |
| 1659 | + if ( !handleObj.handler.guid ) { |
| 1660 | + handleObj.handler.guid = handler.guid; |
| 1661 | + } |
| 1662 | + } |
| 1663 | + |
| 1664 | + // Add the function to the element's handler list |
| 1665 | + handlers.push( handleObj ); |
| 1666 | + |
| 1667 | + // Keep track of which events have been used, for global triggering |
| 1668 | + jQuery.event.global[ type ] = true; |
| 1669 | + } |
| 1670 | + |
| 1671 | + // Nullify elem to prevent memory leaks in IE |
| 1672 | + elem = null; |
| 1673 | + }, |
| 1674 | + |
| 1675 | + global: {}, |
| 1676 | + |
| 1677 | + // Detach an event or set of events from an element |
| 1678 | + remove: function( elem, types, handler, pos ) { |
| 1679 | + // don't do events on text and comment nodes |
| 1680 | + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
| 1681 | + return; |
| 1682 | + } |
| 1683 | + |
| 1684 | + var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, |
| 1685 | + elemData = jQuery.data( elem ), |
| 1686 | + events = elemData && elemData.events; |
| 1687 | + |
| 1688 | + if ( !elemData || !events ) { |
| 1689 | + return; |
| 1690 | + } |
| 1691 | + |
| 1692 | + // types is actually an event object here |
| 1693 | + if ( types && types.type ) { |
| 1694 | + handler = types.handler; |
| 1695 | + types = types.type; |
| 1696 | + } |
| 1697 | + |
| 1698 | + // Unbind all events for the element |
| 1699 | + if ( !types || typeof types === "string" && types.charAt(0) === "." ) { |
| 1700 | + types = types || ""; |
| 1701 | + |
| 1702 | + for ( type in events ) { |
| 1703 | + jQuery.event.remove( elem, type + types ); |
| 1704 | + } |
| 1705 | + |
| 1706 | + return; |
| 1707 | + } |
| 1708 | + |
| 1709 | + // Handle multiple events separated by a space |
| 1710 | + // jQuery(...).unbind("mouseover mouseout", fn); |
| 1711 | + types = types.split(" "); |
| 1712 | + |
| 1713 | + while ( (type = types[ i++ ]) ) { |
| 1714 | + origType = type; |
| 1715 | + handleObj = null; |
| 1716 | + all = type.indexOf(".") < 0; |
| 1717 | + namespaces = []; |
| 1718 | + |
| 1719 | + if ( !all ) { |
| 1720 | + // Namespaced event handlers |
| 1721 | + namespaces = type.split("."); |
| 1722 | + type = namespaces.shift(); |
| 1723 | + |
| 1724 | + namespace = new RegExp("(^|\\.)" + |
| 1725 | + jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") |
| 1726 | + } |
| 1727 | + |
| 1728 | + eventType = events[ type ]; |
| 1729 | + |
| 1730 | + if ( !eventType ) { |
| 1731 | + continue; |
| 1732 | + } |
| 1733 | + |
| 1734 | + if ( !handler ) { |
| 1735 | + for ( var j = 0; j < eventType.length; j++ ) { |
| 1736 | + handleObj = eventType[ j ]; |
| 1737 | + |
| 1738 | + if ( all || namespace.test( handleObj.namespace ) ) { |
| 1739 | + jQuery.event.remove( elem, origType, handleObj.handler, j ); |
| 1740 | + eventType.splice( j--, 1 ); |
| 1741 | + } |
| 1742 | + } |
| 1743 | + |
| 1744 | + continue; |
| 1745 | + } |
| 1746 | + |
| 1747 | + special = jQuery.event.special[ type ] || {}; |
| 1748 | + |
| 1749 | + for ( var j = pos || 0; j < eventType.length; j++ ) { |
| 1750 | + handleObj = eventType[ j ]; |
| 1751 | + |
| 1752 | + if ( handler.guid === handleObj.guid ) { |
| 1753 | + // remove the given handler for the given type |
| 1754 | + if ( all || namespace.test( handleObj.namespace ) ) { |
| 1755 | + if ( pos == null ) { |
| 1756 | + eventType.splice( j--, 1 ); |
| 1757 | + } |
| 1758 | + |
| 1759 | + if ( special.remove ) { |
| 1760 | + special.remove.call( elem, handleObj ); |
| 1761 | + } |
| 1762 | + } |
| 1763 | + |
| 1764 | + if ( pos != null ) { |
| 1765 | + break; |
| 1766 | + } |
| 1767 | + } |
| 1768 | + } |
| 1769 | + |
| 1770 | + // remove generic event handler if no more handlers exist |
| 1771 | + if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { |
| 1772 | + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { |
| 1773 | + removeEvent( elem, type, elemData.handle ); |
| 1774 | + } |
| 1775 | + |
| 1776 | + ret = null; |
| 1777 | + delete events[ type ]; |
| 1778 | + } |
| 1779 | + } |
| 1780 | + |
| 1781 | + // Remove the expando if it's no longer used |
| 1782 | + if ( jQuery.isEmptyObject( events ) ) { |
| 1783 | + var handle = elemData.handle; |
| 1784 | + if ( handle ) { |
| 1785 | + handle.elem = null; |
| 1786 | + } |
| 1787 | + |
| 1788 | + delete elemData.events; |
| 1789 | + delete elemData.handle; |
| 1790 | + |
| 1791 | + if ( jQuery.isEmptyObject( elemData ) ) { |
| 1792 | + jQuery.removeData( elem ); |
| 1793 | + } |
| 1794 | + } |
| 1795 | + }, |
| 1796 | + |
| 1797 | + // bubbling is internal |
| 1798 | + trigger: function( event, data, elem /*, bubbling */ ) { |
| 1799 | + // Event object or event type |
| 1800 | + var type = event.type || event, |
| 1801 | + bubbling = arguments[3]; |
| 1802 | + |
| 1803 | + if ( !bubbling ) { |
| 1804 | + event = typeof event === "object" ? |
| 1805 | + // jQuery.Event object |
| 1806 | + event[expando] ? event : |
| 1807 | + // Object literal |
| 1808 | + jQuery.extend( jQuery.Event(type), event ) : |
| 1809 | + // Just the event type (string) |
| 1810 | + jQuery.Event(type); |
| 1811 | + |
| 1812 | + if ( type.indexOf("!") >= 0 ) { |
| 1813 | + event.type = type = type.slice(0, -1); |
| 1814 | + event.exclusive = true; |
| 1815 | + } |
| 1816 | + |
| 1817 | + // Handle a global trigger |
| 1818 | + if ( !elem ) { |
| 1819 | + // Don't bubble custom events when global (to avoid too much overhead) |
| 1820 | + event.stopPropagation(); |
| 1821 | + |
| 1822 | + // Only trigger if we've ever bound an event for it |
| 1823 | + if ( jQuery.event.global[ type ] ) { |
| 1824 | + jQuery.each( jQuery.cache, function() { |
| 1825 | + if ( this.events && this.events[type] ) { |
| 1826 | + jQuery.event.trigger( event, data, this.handle.elem ); |
| 1827 | + } |
| 1828 | + }); |
| 1829 | + } |
| 1830 | + } |
| 1831 | + |
| 1832 | + // Handle triggering a single element |
| 1833 | + |
| 1834 | + // don't do events on text and comment nodes |
| 1835 | + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
| 1836 | + return undefined; |
| 1837 | + } |
| 1838 | + |
| 1839 | + // Clean up in case it is reused |
| 1840 | + event.result = undefined; |
| 1841 | + event.target = elem; |
| 1842 | + |
| 1843 | + // Clone the incoming data, if any |
| 1844 | + data = jQuery.makeArray( data ); |
| 1845 | + data.unshift( event ); |
| 1846 | + } |
| 1847 | + |
| 1848 | + event.currentTarget = elem; |
| 1849 | + |
| 1850 | + // Trigger the event, it is assumed that "handle" is a function |
| 1851 | + var handle = jQuery.data( elem, "handle" ); |
| 1852 | + if ( handle ) { |
| 1853 | + handle.apply( elem, data ); |
| 1854 | + } |
| 1855 | + |
| 1856 | + var parent = elem.parentNode || elem.ownerDocument; |
| 1857 | + |
| 1858 | + // Trigger an inline bound script |
| 1859 | + try { |
| 1860 | + if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { |
| 1861 | + if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { |
| 1862 | + event.result = false; |
| 1863 | + } |
| 1864 | + } |
| 1865 | + |
| 1866 | + // prevent IE from throwing an error for some elements with some event types, see #3533 |
| 1867 | + } catch (e) {} |
| 1868 | + |
| 1869 | + if ( !event.isPropagationStopped() && parent ) { |
| 1870 | + jQuery.event.trigger( event, data, parent, true ); |
| 1871 | + |
| 1872 | + } else if ( !event.isDefaultPrevented() ) { |
| 1873 | + var target = event.target, old, |
| 1874 | + isClick = jQuery.nodeName(target, "a") && type === "click", |
| 1875 | + special = jQuery.event.special[ type ] || {}; |
| 1876 | + |
| 1877 | + if ( (!special._default || special._default.call( elem, event ) === false) && |
| 1878 | + !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { |
| 1879 | + |
| 1880 | + try { |
| 1881 | + if ( target[ type ] ) { |
| 1882 | + // Make sure that we don't accidentally re-trigger the onFOO events |
| 1883 | + old = target[ "on" + type ]; |
| 1884 | + |
| 1885 | + if ( old ) { |
| 1886 | + target[ "on" + type ] = null; |
| 1887 | + } |
| 1888 | + |
| 1889 | + jQuery.event.triggered = true; |
| 1890 | + target[ type ](); |
| 1891 | + } |
| 1892 | + |
| 1893 | + // prevent IE from throwing an error for some elements with some event types, see #3533 |
| 1894 | + } catch (e) {} |
| 1895 | + |
| 1896 | + if ( old ) { |
| 1897 | + target[ "on" + type ] = old; |
| 1898 | + } |
| 1899 | + |
| 1900 | + jQuery.event.triggered = false; |
| 1901 | + } |
| 1902 | + } |
| 1903 | + }, |
| 1904 | + |
| 1905 | + handle: function( event ) { |
| 1906 | + var all, handlers, namespaces, namespace, events; |
| 1907 | + |
| 1908 | + event = arguments[0] = jQuery.event.fix( event || window.event ); |
| 1909 | + event.currentTarget = this; |
| 1910 | + |
| 1911 | + // Namespaced event handlers |
| 1912 | + all = event.type.indexOf(".") < 0 && !event.exclusive; |
| 1913 | + |
| 1914 | + if ( !all ) { |
| 1915 | + namespaces = event.type.split("."); |
| 1916 | + event.type = namespaces.shift(); |
| 1917 | + namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); |
| 1918 | + } |
| 1919 | + |
| 1920 | + var events = jQuery.data(this, "events"), handlers = events[ event.type ]; |
| 1921 | + |
| 1922 | + if ( events && handlers ) { |
| 1923 | + // Clone the handlers to prevent manipulation |
| 1924 | + handlers = handlers.slice(0); |
| 1925 | + |
| 1926 | + for ( var j = 0, l = handlers.length; j < l; j++ ) { |
| 1927 | + var handleObj = handlers[ j ]; |
| 1928 | + |
| 1929 | + // Filter the functions by class |
| 1930 | + if ( all || namespace.test( handleObj.namespace ) ) { |
| 1931 | + // Pass in a reference to the handler function itself |
| 1932 | + // So that we can later remove it |
| 1933 | + event.handler = handleObj.handler; |
| 1934 | + event.data = handleObj.data; |
| 1935 | + event.handleObj = handleObj; |
| 1936 | + |
| 1937 | + var ret = handleObj.handler.apply( this, arguments ); |
| 1938 | + |
| 1939 | + if ( ret !== undefined ) { |
| 1940 | + event.result = ret; |
| 1941 | + if ( ret === false ) { |
| 1942 | + event.preventDefault(); |
| 1943 | + event.stopPropagation(); |
| 1944 | + } |
| 1945 | + } |
| 1946 | + |
| 1947 | + if ( event.isImmediatePropagationStopped() ) { |
| 1948 | + break; |
| 1949 | + } |
| 1950 | + } |
| 1951 | + } |
| 1952 | + } |
| 1953 | + |
| 1954 | + return event.result; |
| 1955 | + }, |
| 1956 | + |
| 1957 | + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
| 1958 | + |
| 1959 | + fix: function( event ) { |
| 1960 | + if ( event[ expando ] ) { |
| 1961 | + return event; |
| 1962 | + } |
| 1963 | + |
| 1964 | + // store a copy of the original event object |
| 1965 | + // and "clone" to set read-only properties |
| 1966 | + var originalEvent = event; |
| 1967 | + event = jQuery.Event( originalEvent ); |
| 1968 | + |
| 1969 | + for ( var i = this.props.length, prop; i; ) { |
| 1970 | + prop = this.props[ --i ]; |
| 1971 | + event[ prop ] = originalEvent[ prop ]; |
| 1972 | + } |
| 1973 | + |
| 1974 | + // Fix target property, if necessary |
| 1975 | + if ( !event.target ) { |
| 1976 | + event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
| 1977 | + } |
| 1978 | + |
| 1979 | + // check if target is a textnode (safari) |
| 1980 | + if ( event.target.nodeType === 3 ) { |
| 1981 | + event.target = event.target.parentNode; |
| 1982 | + } |
| 1983 | + |
| 1984 | + // Add relatedTarget, if necessary |
| 1985 | + if ( !event.relatedTarget && event.fromElement ) { |
| 1986 | + event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
| 1987 | + } |
| 1988 | + |
| 1989 | + // Calculate pageX/Y if missing and clientX/Y available |
| 1990 | + if ( event.pageX == null && event.clientX != null ) { |
| 1991 | + var doc = document.documentElement, body = document.body; |
| 1992 | + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
| 1993 | + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
| 1994 | + } |
| 1995 | + |
| 1996 | + // Add which for key events |
| 1997 | + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { |
| 1998 | + event.which = event.charCode || event.keyCode; |
| 1999 | + } |
| 2000 | + |
| 2001 | + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
| 2002 | + if ( !event.metaKey && event.ctrlKey ) { |
| 2003 | + event.metaKey = event.ctrlKey; |
| 2004 | + } |
| 2005 | + |
| 2006 | + // Add which for click: 1 === left; 2 === middle; 3 === right |
| 2007 | + // Note: button is not normalized, so don't use it |
| 2008 | + if ( !event.which && event.button !== undefined ) { |
| 2009 | + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
| 2010 | + } |
| 2011 | + |
| 2012 | + return event; |
| 2013 | + }, |
| 2014 | + |
| 2015 | + // Deprecated, use jQuery.guid instead |
| 2016 | + guid: 1E8, |
| 2017 | + |
| 2018 | + // Deprecated, use jQuery.proxy instead |
| 2019 | + proxy: jQuery.proxy, |
| 2020 | + |
| 2021 | + special: { |
| 2022 | + ready: { |
| 2023 | + // Make sure the ready event is setup |
| 2024 | + setup: jQuery.bindReady, |
| 2025 | + teardown: jQuery.noop |
| 2026 | + }, |
| 2027 | + |
| 2028 | + live: { |
| 2029 | + add: function( handleObj ) { |
| 2030 | + jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); |
| 2031 | + }, |
| 2032 | + |
| 2033 | + remove: function( handleObj ) { |
| 2034 | + var remove = true, |
| 2035 | + type = handleObj.origType.replace(rnamespaces, ""); |
| 2036 | + |
| 2037 | + jQuery.each( jQuery.data(this, "events").live || [], function() { |
| 2038 | + if ( type === this.origType.replace(rnamespaces, "") ) { |
| 2039 | + remove = false; |
| 2040 | + return false; |
| 2041 | + } |
| 2042 | + }); |
| 2043 | + |
| 2044 | + if ( remove ) { |
| 2045 | + jQuery.event.remove( this, handleObj.origType, liveHandler ); |
| 2046 | + } |
| 2047 | + } |
| 2048 | + |
| 2049 | + }, |
| 2050 | + |
| 2051 | + beforeunload: { |
| 2052 | + setup: function( data, namespaces, eventHandle ) { |
| 2053 | + // We only want to do this special case on windows |
| 2054 | + if ( this.setInterval ) { |
| 2055 | + this.onbeforeunload = eventHandle; |
| 2056 | + } |
| 2057 | + |
| 2058 | + return false; |
| 2059 | + }, |
| 2060 | + teardown: function( namespaces, eventHandle ) { |
| 2061 | + if ( this.onbeforeunload === eventHandle ) { |
| 2062 | + this.onbeforeunload = null; |
| 2063 | + } |
| 2064 | + } |
| 2065 | + } |
| 2066 | + } |
| 2067 | +}; |
| 2068 | + |
| 2069 | +var removeEvent = document.removeEventListener ? |
| 2070 | + function( elem, type, handle ) { |
| 2071 | + elem.removeEventListener( type, handle, false ); |
| 2072 | + } : |
| 2073 | + function( elem, type, handle ) { |
| 2074 | + elem.detachEvent( "on" + type, handle ); |
| 2075 | + }; |
| 2076 | + |
| 2077 | +jQuery.Event = function( src ) { |
| 2078 | + // Allow instantiation without the 'new' keyword |
| 2079 | + if ( !this.preventDefault ) { |
| 2080 | + return new jQuery.Event( src ); |
| 2081 | + } |
| 2082 | + |
| 2083 | + // Event object |
| 2084 | + if ( src && src.type ) { |
| 2085 | + this.originalEvent = src; |
| 2086 | + this.type = src.type; |
| 2087 | + // Event type |
| 2088 | + } else { |
| 2089 | + this.type = src; |
| 2090 | + } |
| 2091 | + |
| 2092 | + // timeStamp is buggy for some events on Firefox(#3843) |
| 2093 | + // So we won't rely on the native value |
| 2094 | + this.timeStamp = now(); |
| 2095 | + |
| 2096 | + // Mark it as fixed |
| 2097 | + this[ expando ] = true; |
| 2098 | +}; |
| 2099 | + |
| 2100 | +function returnFalse() { |
| 2101 | + return false; |
| 2102 | +} |
| 2103 | +function returnTrue() { |
| 2104 | + return true; |
| 2105 | +} |
| 2106 | + |
| 2107 | +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
| 2108 | +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
| 2109 | +jQuery.Event.prototype = { |
| 2110 | + preventDefault: function() { |
| 2111 | + this.isDefaultPrevented = returnTrue; |
| 2112 | + |
| 2113 | + var e = this.originalEvent; |
| 2114 | + if ( !e ) { |
| 2115 | + return; |
| 2116 | + } |
| 2117 | + |
| 2118 | + // if preventDefault exists run it on the original event |
| 2119 | + if ( e.preventDefault ) { |
| 2120 | + e.preventDefault(); |
| 2121 | + } |
| 2122 | + // otherwise set the returnValue property of the original event to false (IE) |
| 2123 | + e.returnValue = false; |
| 2124 | + }, |
| 2125 | + stopPropagation: function() { |
| 2126 | + this.isPropagationStopped = returnTrue; |
| 2127 | + |
| 2128 | + var e = this.originalEvent; |
| 2129 | + if ( !e ) { |
| 2130 | + return; |
| 2131 | + } |
| 2132 | + // if stopPropagation exists run it on the original event |
| 2133 | + if ( e.stopPropagation ) { |
| 2134 | + e.stopPropagation(); |
| 2135 | + } |
| 2136 | + // otherwise set the cancelBubble property of the original event to true (IE) |
| 2137 | + e.cancelBubble = true; |
| 2138 | + }, |
| 2139 | + stopImmediatePropagation: function() { |
| 2140 | + this.isImmediatePropagationStopped = returnTrue; |
| 2141 | + this.stopPropagation(); |
| 2142 | + }, |
| 2143 | + isDefaultPrevented: returnFalse, |
| 2144 | + isPropagationStopped: returnFalse, |
| 2145 | + isImmediatePropagationStopped: returnFalse |
| 2146 | +}; |
| 2147 | + |
| 2148 | +// Checks if an event happened on an element within another element |
| 2149 | +// Used in jQuery.event.special.mouseenter and mouseleave handlers |
| 2150 | +var withinElement = function( event ) { |
| 2151 | + // Check if mouse(over|out) are still within the same parent element |
| 2152 | + var parent = event.relatedTarget; |
| 2153 | + |
| 2154 | + // Firefox sometimes assigns relatedTarget a XUL element |
| 2155 | + // which we cannot access the parentNode property of |
| 2156 | + try { |
| 2157 | + // Traverse up the tree |
| 2158 | + while ( parent && parent !== this ) { |
| 2159 | + parent = parent.parentNode; |
| 2160 | + } |
| 2161 | + |
| 2162 | + if ( parent !== this ) { |
| 2163 | + // set the correct event type |
| 2164 | + event.type = event.data; |
| 2165 | + |
| 2166 | + // handle event if we actually just moused on to a non sub-element |
| 2167 | + jQuery.event.handle.apply( this, arguments ); |
| 2168 | + } |
| 2169 | + |
| 2170 | + // assuming we've left the element since we most likely mousedover a xul element |
| 2171 | + } catch(e) { } |
| 2172 | +}, |
| 2173 | + |
| 2174 | +// In case of event delegation, we only need to rename the event.type, |
| 2175 | +// liveHandler will take care of the rest. |
| 2176 | +delegate = function( event ) { |
| 2177 | + event.type = event.data; |
| 2178 | + jQuery.event.handle.apply( this, arguments ); |
| 2179 | +}; |
| 2180 | + |
| 2181 | +// Create mouseenter and mouseleave events |
| 2182 | +jQuery.each({ |
| 2183 | + mouseenter: "mouseover", |
| 2184 | + mouseleave: "mouseout" |
| 2185 | +}, function( orig, fix ) { |
| 2186 | + jQuery.event.special[ orig ] = { |
| 2187 | + setup: function( data ) { |
| 2188 | + jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); |
| 2189 | + }, |
| 2190 | + teardown: function( data ) { |
| 2191 | + jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); |
| 2192 | + } |
| 2193 | + }; |
| 2194 | +}); |
| 2195 | + |
| 2196 | +// submit delegation |
| 2197 | +if ( !jQuery.support.submitBubbles ) { |
| 2198 | + |
| 2199 | + jQuery.event.special.submit = { |
| 2200 | + setup: function( data, namespaces ) { |
| 2201 | + if ( this.nodeName.toLowerCase() !== "form" ) { |
| 2202 | + jQuery.event.add(this, "click.specialSubmit", function( e ) { |
| 2203 | + var elem = e.target, type = elem.type; |
| 2204 | + |
| 2205 | + if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
| 2206 | + return trigger( "submit", this, arguments ); |
| 2207 | + } |
| 2208 | + }); |
| 2209 | + |
| 2210 | + jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
| 2211 | + var elem = e.target, type = elem.type; |
| 2212 | + |
| 2213 | + if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
| 2214 | + return trigger( "submit", this, arguments ); |
| 2215 | + } |
| 2216 | + }); |
| 2217 | + |
| 2218 | + } else { |
| 2219 | + return false; |
| 2220 | + } |
| 2221 | + }, |
| 2222 | + |
| 2223 | + teardown: function( namespaces ) { |
| 2224 | + jQuery.event.remove( this, ".specialSubmit" ); |
| 2225 | + } |
| 2226 | + }; |
| 2227 | + |
| 2228 | +} |
| 2229 | + |
| 2230 | +// change delegation, happens here so we have bind. |
| 2231 | +if ( !jQuery.support.changeBubbles ) { |
| 2232 | + |
| 2233 | + var formElems = /textarea|input|select/i, |
| 2234 | + |
| 2235 | + changeFilters, |
| 2236 | + |
| 2237 | + getVal = function( elem ) { |
| 2238 | + var type = elem.type, val = elem.value; |
| 2239 | + |
| 2240 | + if ( type === "radio" || type === "checkbox" ) { |
| 2241 | + val = elem.checked; |
| 2242 | + |
| 2243 | + } else if ( type === "select-multiple" ) { |
| 2244 | + val = elem.selectedIndex > -1 ? |
| 2245 | + jQuery.map( elem.options, function( elem ) { |
| 2246 | + return elem.selected; |
| 2247 | + }).join("-") : |
| 2248 | + ""; |
| 2249 | + |
| 2250 | + } else if ( elem.nodeName.toLowerCase() === "select" ) { |
| 2251 | + val = elem.selectedIndex; |
| 2252 | + } |
| 2253 | + |
| 2254 | + return val; |
| 2255 | + }, |
| 2256 | + |
| 2257 | + testChange = function testChange( e ) { |
| 2258 | + var elem = e.target, data, val; |
| 2259 | + |
| 2260 | + if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { |
| 2261 | + return; |
| 2262 | + } |
| 2263 | + |
| 2264 | + data = jQuery.data( elem, "_change_data" ); |
| 2265 | + val = getVal(elem); |
| 2266 | + |
| 2267 | + // the current data will be also retrieved by beforeactivate |
| 2268 | + if ( e.type !== "focusout" || elem.type !== "radio" ) { |
| 2269 | + jQuery.data( elem, "_change_data", val ); |
| 2270 | + } |
| 2271 | + |
| 2272 | + if ( data === undefined || val === data ) { |
| 2273 | + return; |
| 2274 | + } |
| 2275 | + |
| 2276 | + if ( data != null || val ) { |
| 2277 | + e.type = "change"; |
| 2278 | + return jQuery.event.trigger( e, arguments[1], elem ); |
| 2279 | + } |
| 2280 | + }; |
| 2281 | + |
| 2282 | + jQuery.event.special.change = { |
| 2283 | + filters: { |
| 2284 | + focusout: testChange, |
| 2285 | + |
| 2286 | + click: function( e ) { |
| 2287 | + var elem = e.target, type = elem.type; |
| 2288 | + |
| 2289 | + if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { |
| 2290 | + return testChange.call( this, e ); |
| 2291 | + } |
| 2292 | + }, |
| 2293 | + |
| 2294 | + // Change has to be called before submit |
| 2295 | + // Keydown will be called before keypress, which is used in submit-event delegation |
| 2296 | + keydown: function( e ) { |
| 2297 | + var elem = e.target, type = elem.type; |
| 2298 | + |
| 2299 | + if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || |
| 2300 | + (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || |
| 2301 | + type === "select-multiple" ) { |
| 2302 | + return testChange.call( this, e ); |
| 2303 | + } |
| 2304 | + }, |
| 2305 | + |
| 2306 | + // Beforeactivate happens also before the previous element is blurred |
| 2307 | + // with this event you can't trigger a change event, but you can store |
| 2308 | + // information/focus[in] is not needed anymore |
| 2309 | + beforeactivate: function( e ) { |
| 2310 | + var elem = e.target; |
| 2311 | + jQuery.data( elem, "_change_data", getVal(elem) ); |
| 2312 | + } |
| 2313 | + }, |
| 2314 | + |
| 2315 | + setup: function( data, namespaces ) { |
| 2316 | + if ( this.type === "file" ) { |
| 2317 | + return false; |
| 2318 | + } |
| 2319 | + |
| 2320 | + for ( var type in changeFilters ) { |
| 2321 | + jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); |
| 2322 | + } |
| 2323 | + |
| 2324 | + return formElems.test( this.nodeName ); |
| 2325 | + }, |
| 2326 | + |
| 2327 | + teardown: function( namespaces ) { |
| 2328 | + jQuery.event.remove( this, ".specialChange" ); |
| 2329 | + |
| 2330 | + return formElems.test( this.nodeName ); |
| 2331 | + } |
| 2332 | + }; |
| 2333 | + |
| 2334 | + changeFilters = jQuery.event.special.change.filters; |
| 2335 | +} |
| 2336 | + |
| 2337 | +function trigger( type, elem, args ) { |
| 2338 | + args[0].type = type; |
| 2339 | + return jQuery.event.handle.apply( elem, args ); |
| 2340 | +} |
| 2341 | + |
| 2342 | +// Create "bubbling" focus and blur events |
| 2343 | +if ( document.addEventListener ) { |
| 2344 | + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
| 2345 | + jQuery.event.special[ fix ] = { |
| 2346 | + setup: function() { |
| 2347 | + this.addEventListener( orig, handler, true ); |
| 2348 | + }, |
| 2349 | + teardown: function() { |
| 2350 | + this.removeEventListener( orig, handler, true ); |
| 2351 | + } |
| 2352 | + }; |
| 2353 | + |
| 2354 | + function handler( e ) { |
| 2355 | + e = jQuery.event.fix( e ); |
| 2356 | + e.type = fix; |
| 2357 | + return jQuery.event.handle.call( this, e ); |
| 2358 | + } |
| 2359 | + }); |
| 2360 | +} |
| 2361 | + |
| 2362 | +jQuery.each(["bind", "one"], function( i, name ) { |
| 2363 | + jQuery.fn[ name ] = function( type, data, fn ) { |
| 2364 | + // Handle object literals |
| 2365 | + if ( typeof type === "object" ) { |
| 2366 | + for ( var key in type ) { |
| 2367 | + this[ name ](key, data, type[key], fn); |
| 2368 | + } |
| 2369 | + return this; |
| 2370 | + } |
| 2371 | + |
| 2372 | + if ( jQuery.isFunction( data ) ) { |
| 2373 | + fn = data; |
| 2374 | + data = undefined; |
| 2375 | + } |
| 2376 | + |
| 2377 | + var handler = name === "one" ? jQuery.proxy( fn, function( event ) { |
| 2378 | + jQuery( this ).unbind( event, handler ); |
| 2379 | + return fn.apply( this, arguments ); |
| 2380 | + }) : fn; |
| 2381 | + |
| 2382 | + if ( type === "unload" && name !== "one" ) { |
| 2383 | + this.one( type, data, fn ); |
| 2384 | + |
| 2385 | + } else { |
| 2386 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 2387 | + jQuery.event.add( this[i], type, handler, data ); |
| 2388 | + } |
| 2389 | + } |
| 2390 | + |
| 2391 | + return this; |
| 2392 | + }; |
| 2393 | +}); |
| 2394 | + |
| 2395 | +jQuery.fn.extend({ |
| 2396 | + unbind: function( type, fn ) { |
| 2397 | + // Handle object literals |
| 2398 | + if ( typeof type === "object" && !type.preventDefault ) { |
| 2399 | + for ( var key in type ) { |
| 2400 | + this.unbind(key, type[key]); |
| 2401 | + } |
| 2402 | + |
| 2403 | + } else { |
| 2404 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 2405 | + jQuery.event.remove( this[i], type, fn ); |
| 2406 | + } |
| 2407 | + } |
| 2408 | + |
| 2409 | + return this; |
| 2410 | + }, |
| 2411 | + |
| 2412 | + delegate: function( selector, types, data, fn ) { |
| 2413 | + return this.live( types, data, fn, selector ); |
| 2414 | + }, |
| 2415 | + |
| 2416 | + undelegate: function( selector, types, fn ) { |
| 2417 | + if ( arguments.length === 0 ) { |
| 2418 | + return this.unbind( "live" ); |
| 2419 | + |
| 2420 | + } else { |
| 2421 | + return this.die( types, null, fn, selector ); |
| 2422 | + } |
| 2423 | + }, |
| 2424 | + |
| 2425 | + trigger: function( type, data ) { |
| 2426 | + return this.each(function() { |
| 2427 | + jQuery.event.trigger( type, data, this ); |
| 2428 | + }); |
| 2429 | + }, |
| 2430 | + |
| 2431 | + triggerHandler: function( type, data ) { |
| 2432 | + if ( this[0] ) { |
| 2433 | + var event = jQuery.Event( type ); |
| 2434 | + event.preventDefault(); |
| 2435 | + event.stopPropagation(); |
| 2436 | + jQuery.event.trigger( event, data, this[0] ); |
| 2437 | + return event.result; |
| 2438 | + } |
| 2439 | + }, |
| 2440 | + |
| 2441 | + toggle: function( fn ) { |
| 2442 | + // Save reference to arguments for access in closure |
| 2443 | + var args = arguments, i = 1; |
| 2444 | + |
| 2445 | + // link all the functions, so any of them can unbind this click handler |
| 2446 | + while ( i < args.length ) { |
| 2447 | + jQuery.proxy( fn, args[ i++ ] ); |
| 2448 | + } |
| 2449 | + |
| 2450 | + return this.click( jQuery.proxy( fn, function( event ) { |
| 2451 | + // Figure out which function to execute |
| 2452 | + var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
| 2453 | + jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
| 2454 | + |
| 2455 | + // Make sure that clicks stop |
| 2456 | + event.preventDefault(); |
| 2457 | + |
| 2458 | + // and execute the function |
| 2459 | + return args[ lastToggle ].apply( this, arguments ) || false; |
| 2460 | + })); |
| 2461 | + }, |
| 2462 | + |
| 2463 | + hover: function( fnOver, fnOut ) { |
| 2464 | + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
| 2465 | + } |
| 2466 | +}); |
| 2467 | + |
| 2468 | +var liveMap = { |
| 2469 | + focus: "focusin", |
| 2470 | + blur: "focusout", |
| 2471 | + mouseenter: "mouseover", |
| 2472 | + mouseleave: "mouseout" |
| 2473 | +}; |
| 2474 | + |
| 2475 | +jQuery.each(["live", "die"], function( i, name ) { |
| 2476 | + jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { |
| 2477 | + var type, i = 0, match, namespaces, preType, |
| 2478 | + selector = origSelector || this.selector, |
| 2479 | + context = origSelector ? this : jQuery( this.context ); |
| 2480 | + |
| 2481 | + if ( jQuery.isFunction( data ) ) { |
| 2482 | + fn = data; |
| 2483 | + data = undefined; |
| 2484 | + } |
| 2485 | + |
| 2486 | + types = (types || "").split(" "); |
| 2487 | + |
| 2488 | + while ( (type = types[ i++ ]) != null ) { |
| 2489 | + match = rnamespaces.exec( type ); |
| 2490 | + namespaces = ""; |
| 2491 | + |
| 2492 | + if ( match ) { |
| 2493 | + namespaces = match[0]; |
| 2494 | + type = type.replace( rnamespaces, "" ); |
| 2495 | + } |
| 2496 | + |
| 2497 | + if ( type === "hover" ) { |
| 2498 | + types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); |
| 2499 | + continue; |
| 2500 | + } |
| 2501 | + |
| 2502 | + preType = type; |
| 2503 | + |
| 2504 | + if ( type === "focus" || type === "blur" ) { |
| 2505 | + types.push( liveMap[ type ] + namespaces ); |
| 2506 | + type = type + namespaces; |
| 2507 | + |
| 2508 | + } else { |
| 2509 | + type = (liveMap[ type ] || type) + namespaces; |
| 2510 | + } |
| 2511 | + |
| 2512 | + if ( name === "live" ) { |
| 2513 | + // bind live handler |
| 2514 | + context.each(function(){ |
| 2515 | + jQuery.event.add( this, liveConvert( type, selector ), |
| 2516 | + { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); |
| 2517 | + }); |
| 2518 | + |
| 2519 | + } else { |
| 2520 | + // unbind live handler |
| 2521 | + context.unbind( liveConvert( type, selector ), fn ); |
| 2522 | + } |
| 2523 | + } |
| 2524 | + |
| 2525 | + return this; |
| 2526 | + } |
| 2527 | +}); |
| 2528 | + |
| 2529 | +function liveHandler( event ) { |
| 2530 | + var stop, elems = [], selectors = [], args = arguments, |
| 2531 | + related, match, handleObj, elem, j, i, l, data, |
| 2532 | + events = jQuery.data( this, "events" ); |
| 2533 | + |
| 2534 | + // Make sure we avoid non-left-click bubbling in Firefox (#3861) |
| 2535 | + if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { |
| 2536 | + return; |
| 2537 | + } |
| 2538 | + |
| 2539 | + event.liveFired = this; |
| 2540 | + |
| 2541 | + var live = events.live.slice(0); |
| 2542 | + |
| 2543 | + for ( j = 0; j < live.length; j++ ) { |
| 2544 | + handleObj = live[j]; |
| 2545 | + |
| 2546 | + if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { |
| 2547 | + selectors.push( handleObj.selector ); |
| 2548 | + |
| 2549 | + } else { |
| 2550 | + live.splice( j--, 1 ); |
| 2551 | + } |
| 2552 | + } |
| 2553 | + |
| 2554 | + match = jQuery( event.target ).closest( selectors, event.currentTarget ); |
| 2555 | + |
| 2556 | + for ( i = 0, l = match.length; i < l; i++ ) { |
| 2557 | + for ( j = 0; j < live.length; j++ ) { |
| 2558 | + handleObj = live[j]; |
| 2559 | + |
| 2560 | + if ( match[i].selector === handleObj.selector ) { |
| 2561 | + elem = match[i].elem; |
| 2562 | + related = null; |
| 2563 | + |
| 2564 | + // Those two events require additional checking |
| 2565 | + if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { |
| 2566 | + related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; |
| 2567 | + } |
| 2568 | + |
| 2569 | + if ( !related || related !== elem ) { |
| 2570 | + elems.push({ elem: elem, handleObj: handleObj }); |
| 2571 | + } |
| 2572 | + } |
| 2573 | + } |
| 2574 | + } |
| 2575 | + |
| 2576 | + for ( i = 0, l = elems.length; i < l; i++ ) { |
| 2577 | + match = elems[i]; |
| 2578 | + event.currentTarget = match.elem; |
| 2579 | + event.data = match.handleObj.data; |
| 2580 | + event.handleObj = match.handleObj; |
| 2581 | + |
| 2582 | + if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { |
| 2583 | + stop = false; |
| 2584 | + break; |
| 2585 | + } |
| 2586 | + } |
| 2587 | + |
| 2588 | + return stop; |
| 2589 | +} |
| 2590 | + |
| 2591 | +function liveConvert( type, selector ) { |
| 2592 | + return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); |
| 2593 | +} |
| 2594 | + |
| 2595 | +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
| 2596 | + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
| 2597 | + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { |
| 2598 | + |
| 2599 | + // Handle event binding |
| 2600 | + jQuery.fn[ name ] = function( fn ) { |
| 2601 | + return fn ? this.bind( name, fn ) : this.trigger( name ); |
| 2602 | + }; |
| 2603 | + |
| 2604 | + if ( jQuery.attrFn ) { |
| 2605 | + jQuery.attrFn[ name ] = true; |
| 2606 | + } |
| 2607 | +}); |
| 2608 | + |
| 2609 | +// Prevent memory leaks in IE |
| 2610 | +// Window isn't included so as not to unbind existing unload events |
| 2611 | +// More info: |
| 2612 | +// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ |
| 2613 | +if ( window.attachEvent && !window.addEventListener ) { |
| 2614 | + window.attachEvent("onunload", function() { |
| 2615 | + for ( var id in jQuery.cache ) { |
| 2616 | + if ( jQuery.cache[ id ].handle ) { |
| 2617 | + // Try/Catch is to handle iframes being unloaded, see #4280 |
| 2618 | + try { |
| 2619 | + jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
| 2620 | + } catch(e) {} |
| 2621 | + } |
| 2622 | + } |
| 2623 | + }); |
| 2624 | +} |
| 2625 | +/*! |
| 2626 | + * Sizzle CSS Selector Engine - v1.0 |
| 2627 | + * Copyright 2009, The Dojo Foundation |
| 2628 | + * Released under the MIT, BSD, and GPL Licenses. |
| 2629 | + * More information: http://sizzlejs.com/ |
| 2630 | + */ |
| 2631 | +(function(){ |
| 2632 | + |
| 2633 | +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, |
| 2634 | + done = 0, |
| 2635 | + toString = Object.prototype.toString, |
| 2636 | + hasDuplicate = false, |
| 2637 | + baseHasDuplicate = true; |
| 2638 | + |
| 2639 | +// Here we check if the JavaScript engine is using some sort of |
| 2640 | +// optimization where it does not always call our comparision |
| 2641 | +// function. If that is the case, discard the hasDuplicate value. |
| 2642 | +// Thus far that includes Google Chrome. |
| 2643 | +[0, 0].sort(function(){ |
| 2644 | + baseHasDuplicate = false; |
| 2645 | + return 0; |
| 2646 | +}); |
| 2647 | + |
| 2648 | +var Sizzle = function(selector, context, results, seed) { |
| 2649 | + results = results || []; |
| 2650 | + var origContext = context = context || document; |
| 2651 | + |
| 2652 | + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
| 2653 | + return []; |
| 2654 | + } |
| 2655 | + |
| 2656 | + if ( !selector || typeof selector !== "string" ) { |
| 2657 | + return results; |
| 2658 | + } |
| 2659 | + |
| 2660 | + var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), |
| 2661 | + soFar = selector; |
| 2662 | + |
| 2663 | + // Reset the position of the chunker regexp (start from head) |
| 2664 | + while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { |
| 2665 | + soFar = m[3]; |
| 2666 | + |
| 2667 | + parts.push( m[1] ); |
| 2668 | + |
| 2669 | + if ( m[2] ) { |
| 2670 | + extra = m[3]; |
| 2671 | + break; |
| 2672 | + } |
| 2673 | + } |
| 2674 | + |
| 2675 | + if ( parts.length > 1 && origPOS.exec( selector ) ) { |
| 2676 | + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
| 2677 | + set = posProcess( parts[0] + parts[1], context ); |
| 2678 | + } else { |
| 2679 | + set = Expr.relative[ parts[0] ] ? |
| 2680 | + [ context ] : |
| 2681 | + Sizzle( parts.shift(), context ); |
| 2682 | + |
| 2683 | + while ( parts.length ) { |
| 2684 | + selector = parts.shift(); |
| 2685 | + |
| 2686 | + if ( Expr.relative[ selector ] ) { |
| 2687 | + selector += parts.shift(); |
| 2688 | + } |
| 2689 | + |
| 2690 | + set = posProcess( selector, set ); |
| 2691 | + } |
| 2692 | + } |
| 2693 | + } else { |
| 2694 | + // Take a shortcut and set the context if the root selector is an ID |
| 2695 | + // (but not if it'll be faster if the inner selector is an ID) |
| 2696 | + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
| 2697 | + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
| 2698 | + var ret = Sizzle.find( parts.shift(), context, contextXML ); |
| 2699 | + context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; |
| 2700 | + } |
| 2701 | + |
| 2702 | + if ( context ) { |
| 2703 | + var ret = seed ? |
| 2704 | + { expr: parts.pop(), set: makeArray(seed) } : |
| 2705 | + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
| 2706 | + set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; |
| 2707 | + |
| 2708 | + if ( parts.length > 0 ) { |
| 2709 | + checkSet = makeArray(set); |
| 2710 | + } else { |
| 2711 | + prune = false; |
| 2712 | + } |
| 2713 | + |
| 2714 | + while ( parts.length ) { |
| 2715 | + var cur = parts.pop(), pop = cur; |
| 2716 | + |
| 2717 | + if ( !Expr.relative[ cur ] ) { |
| 2718 | + cur = ""; |
| 2719 | + } else { |
| 2720 | + pop = parts.pop(); |
| 2721 | + } |
| 2722 | + |
| 2723 | + if ( pop == null ) { |
| 2724 | + pop = context; |
| 2725 | + } |
| 2726 | + |
| 2727 | + Expr.relative[ cur ]( checkSet, pop, contextXML ); |
| 2728 | + } |
| 2729 | + } else { |
| 2730 | + checkSet = parts = []; |
| 2731 | + } |
| 2732 | + } |
| 2733 | + |
| 2734 | + if ( !checkSet ) { |
| 2735 | + checkSet = set; |
| 2736 | + } |
| 2737 | + |
| 2738 | + if ( !checkSet ) { |
| 2739 | + Sizzle.error( cur || selector ); |
| 2740 | + } |
| 2741 | + |
| 2742 | + if ( toString.call(checkSet) === "[object Array]" ) { |
| 2743 | + if ( !prune ) { |
| 2744 | + results.push.apply( results, checkSet ); |
| 2745 | + } else if ( context && context.nodeType === 1 ) { |
| 2746 | + for ( var i = 0; checkSet[i] != null; i++ ) { |
| 2747 | + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
| 2748 | + results.push( set[i] ); |
| 2749 | + } |
| 2750 | + } |
| 2751 | + } else { |
| 2752 | + for ( var i = 0; checkSet[i] != null; i++ ) { |
| 2753 | + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
| 2754 | + results.push( set[i] ); |
| 2755 | + } |
| 2756 | + } |
| 2757 | + } |
| 2758 | + } else { |
| 2759 | + makeArray( checkSet, results ); |
| 2760 | + } |
| 2761 | + |
| 2762 | + if ( extra ) { |
| 2763 | + Sizzle( extra, origContext, results, seed ); |
| 2764 | + Sizzle.uniqueSort( results ); |
| 2765 | + } |
| 2766 | + |
| 2767 | + return results; |
| 2768 | +}; |
| 2769 | + |
| 2770 | +Sizzle.uniqueSort = function(results){ |
| 2771 | + if ( sortOrder ) { |
| 2772 | + hasDuplicate = baseHasDuplicate; |
| 2773 | + results.sort(sortOrder); |
| 2774 | + |
| 2775 | + if ( hasDuplicate ) { |
| 2776 | + for ( var i = 1; i < results.length; i++ ) { |
| 2777 | + if ( results[i] === results[i-1] ) { |
| 2778 | + results.splice(i--, 1); |
| 2779 | + } |
| 2780 | + } |
| 2781 | + } |
| 2782 | + } |
| 2783 | + |
| 2784 | + return results; |
| 2785 | +}; |
| 2786 | + |
| 2787 | +Sizzle.matches = function(expr, set){ |
| 2788 | + return Sizzle(expr, null, null, set); |
| 2789 | +}; |
| 2790 | + |
| 2791 | +Sizzle.find = function(expr, context, isXML){ |
| 2792 | + var set, match; |
| 2793 | + |
| 2794 | + if ( !expr ) { |
| 2795 | + return []; |
| 2796 | + } |
| 2797 | + |
| 2798 | + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
| 2799 | + var type = Expr.order[i], match; |
| 2800 | + |
| 2801 | + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { |
| 2802 | + var left = match[1]; |
| 2803 | + match.splice(1,1); |
| 2804 | + |
| 2805 | + if ( left.substr( left.length - 1 ) !== "\\" ) { |
| 2806 | + match[1] = (match[1] || "").replace(/\\/g, ""); |
| 2807 | + set = Expr.find[ type ]( match, context, isXML ); |
| 2808 | + if ( set != null ) { |
| 2809 | + expr = expr.replace( Expr.match[ type ], "" ); |
| 2810 | + break; |
| 2811 | + } |
| 2812 | + } |
| 2813 | + } |
| 2814 | + } |
| 2815 | + |
| 2816 | + if ( !set ) { |
| 2817 | + set = context.getElementsByTagName("*"); |
| 2818 | + } |
| 2819 | + |
| 2820 | + return {set: set, expr: expr}; |
| 2821 | +}; |
| 2822 | + |
| 2823 | +Sizzle.filter = function(expr, set, inplace, not){ |
| 2824 | + var old = expr, result = [], curLoop = set, match, anyFound, |
| 2825 | + isXMLFilter = set && set[0] && isXML(set[0]); |
| 2826 | + |
| 2827 | + while ( expr && set.length ) { |
| 2828 | + for ( var type in Expr.filter ) { |
| 2829 | + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { |
| 2830 | + var filter = Expr.filter[ type ], found, item, left = match[1]; |
| 2831 | + anyFound = false; |
| 2832 | + |
| 2833 | + match.splice(1,1); |
| 2834 | + |
| 2835 | + if ( left.substr( left.length - 1 ) === "\\" ) { |
| 2836 | + continue; |
| 2837 | + } |
| 2838 | + |
| 2839 | + if ( curLoop === result ) { |
| 2840 | + result = []; |
| 2841 | + } |
| 2842 | + |
| 2843 | + if ( Expr.preFilter[ type ] ) { |
| 2844 | + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
| 2845 | + |
| 2846 | + if ( !match ) { |
| 2847 | + anyFound = found = true; |
| 2848 | + } else if ( match === true ) { |
| 2849 | + continue; |
| 2850 | + } |
| 2851 | + } |
| 2852 | + |
| 2853 | + if ( match ) { |
| 2854 | + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
| 2855 | + if ( item ) { |
| 2856 | + found = filter( item, match, i, curLoop ); |
| 2857 | + var pass = not ^ !!found; |
| 2858 | + |
| 2859 | + if ( inplace && found != null ) { |
| 2860 | + if ( pass ) { |
| 2861 | + anyFound = true; |
| 2862 | + } else { |
| 2863 | + curLoop[i] = false; |
| 2864 | + } |
| 2865 | + } else if ( pass ) { |
| 2866 | + result.push( item ); |
| 2867 | + anyFound = true; |
| 2868 | + } |
| 2869 | + } |
| 2870 | + } |
| 2871 | + } |
| 2872 | + |
| 2873 | + if ( found !== undefined ) { |
| 2874 | + if ( !inplace ) { |
| 2875 | + curLoop = result; |
| 2876 | + } |
| 2877 | + |
| 2878 | + expr = expr.replace( Expr.match[ type ], "" ); |
| 2879 | + |
| 2880 | + if ( !anyFound ) { |
| 2881 | + return []; |
| 2882 | + } |
| 2883 | + |
| 2884 | + break; |
| 2885 | + } |
| 2886 | + } |
| 2887 | + } |
| 2888 | + |
| 2889 | + // Improper expression |
| 2890 | + if ( expr === old ) { |
| 2891 | + if ( anyFound == null ) { |
| 2892 | + Sizzle.error( expr ); |
| 2893 | + } else { |
| 2894 | + break; |
| 2895 | + } |
| 2896 | + } |
| 2897 | + |
| 2898 | + old = expr; |
| 2899 | + } |
| 2900 | + |
| 2901 | + return curLoop; |
| 2902 | +}; |
| 2903 | + |
| 2904 | +Sizzle.error = function( msg ) { |
| 2905 | + throw "Syntax error, unrecognized expression: " + msg; |
| 2906 | +}; |
| 2907 | + |
| 2908 | +var Expr = Sizzle.selectors = { |
| 2909 | + order: [ "ID", "NAME", "TAG" ], |
| 2910 | + match: { |
| 2911 | + ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, |
| 2912 | + CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, |
| 2913 | + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, |
| 2914 | + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
| 2915 | + TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, |
| 2916 | + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
| 2917 | + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
| 2918 | + PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ |
| 2919 | + }, |
| 2920 | + leftMatch: {}, |
| 2921 | + attrMap: { |
| 2922 | + "class": "className", |
| 2923 | + "for": "htmlFor" |
| 2924 | + }, |
| 2925 | + attrHandle: { |
| 2926 | + href: function(elem){ |
| 2927 | + return elem.getAttribute("href"); |
| 2928 | + } |
| 2929 | + }, |
| 2930 | + relative: { |
| 2931 | + "+": function(checkSet, part){ |
| 2932 | + var isPartStr = typeof part === "string", |
| 2933 | + isTag = isPartStr && !/\W/.test(part), |
| 2934 | + isPartStrNotTag = isPartStr && !isTag; |
| 2935 | + |
| 2936 | + if ( isTag ) { |
| 2937 | + part = part.toLowerCase(); |
| 2938 | + } |
| 2939 | + |
| 2940 | + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
| 2941 | + if ( (elem = checkSet[i]) ) { |
| 2942 | + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
| 2943 | + |
| 2944 | + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? |
| 2945 | + elem || false : |
| 2946 | + elem === part; |
| 2947 | + } |
| 2948 | + } |
| 2949 | + |
| 2950 | + if ( isPartStrNotTag ) { |
| 2951 | + Sizzle.filter( part, checkSet, true ); |
| 2952 | + } |
| 2953 | + }, |
| 2954 | + ">": function(checkSet, part){ |
| 2955 | + var isPartStr = typeof part === "string"; |
| 2956 | + |
| 2957 | + if ( isPartStr && !/\W/.test(part) ) { |
| 2958 | + part = part.toLowerCase(); |
| 2959 | + |
| 2960 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 2961 | + var elem = checkSet[i]; |
| 2962 | + if ( elem ) { |
| 2963 | + var parent = elem.parentNode; |
| 2964 | + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; |
| 2965 | + } |
| 2966 | + } |
| 2967 | + } else { |
| 2968 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 2969 | + var elem = checkSet[i]; |
| 2970 | + if ( elem ) { |
| 2971 | + checkSet[i] = isPartStr ? |
| 2972 | + elem.parentNode : |
| 2973 | + elem.parentNode === part; |
| 2974 | + } |
| 2975 | + } |
| 2976 | + |
| 2977 | + if ( isPartStr ) { |
| 2978 | + Sizzle.filter( part, checkSet, true ); |
| 2979 | + } |
| 2980 | + } |
| 2981 | + }, |
| 2982 | + "": function(checkSet, part, isXML){ |
| 2983 | + var doneName = done++, checkFn = dirCheck; |
| 2984 | + |
| 2985 | + if ( typeof part === "string" && !/\W/.test(part) ) { |
| 2986 | + var nodeCheck = part = part.toLowerCase(); |
| 2987 | + checkFn = dirNodeCheck; |
| 2988 | + } |
| 2989 | + |
| 2990 | + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
| 2991 | + }, |
| 2992 | + "~": function(checkSet, part, isXML){ |
| 2993 | + var doneName = done++, checkFn = dirCheck; |
| 2994 | + |
| 2995 | + if ( typeof part === "string" && !/\W/.test(part) ) { |
| 2996 | + var nodeCheck = part = part.toLowerCase(); |
| 2997 | + checkFn = dirNodeCheck; |
| 2998 | + } |
| 2999 | + |
| 3000 | + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
| 3001 | + } |
| 3002 | + }, |
| 3003 | + find: { |
| 3004 | + ID: function(match, context, isXML){ |
| 3005 | + if ( typeof context.getElementById !== "undefined" && !isXML ) { |
| 3006 | + var m = context.getElementById(match[1]); |
| 3007 | + return m ? [m] : []; |
| 3008 | + } |
| 3009 | + }, |
| 3010 | + NAME: function(match, context){ |
| 3011 | + if ( typeof context.getElementsByName !== "undefined" ) { |
| 3012 | + var ret = [], results = context.getElementsByName(match[1]); |
| 3013 | + |
| 3014 | + for ( var i = 0, l = results.length; i < l; i++ ) { |
| 3015 | + if ( results[i].getAttribute("name") === match[1] ) { |
| 3016 | + ret.push( results[i] ); |
| 3017 | + } |
| 3018 | + } |
| 3019 | + |
| 3020 | + return ret.length === 0 ? null : ret; |
| 3021 | + } |
| 3022 | + }, |
| 3023 | + TAG: function(match, context){ |
| 3024 | + return context.getElementsByTagName(match[1]); |
| 3025 | + } |
| 3026 | + }, |
| 3027 | + preFilter: { |
| 3028 | + CLASS: function(match, curLoop, inplace, result, not, isXML){ |
| 3029 | + match = " " + match[1].replace(/\\/g, "") + " "; |
| 3030 | + |
| 3031 | + if ( isXML ) { |
| 3032 | + return match; |
| 3033 | + } |
| 3034 | + |
| 3035 | + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
| 3036 | + if ( elem ) { |
| 3037 | + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { |
| 3038 | + if ( !inplace ) { |
| 3039 | + result.push( elem ); |
| 3040 | + } |
| 3041 | + } else if ( inplace ) { |
| 3042 | + curLoop[i] = false; |
| 3043 | + } |
| 3044 | + } |
| 3045 | + } |
| 3046 | + |
| 3047 | + return false; |
| 3048 | + }, |
| 3049 | + ID: function(match){ |
| 3050 | + return match[1].replace(/\\/g, ""); |
| 3051 | + }, |
| 3052 | + TAG: function(match, curLoop){ |
| 3053 | + return match[1].toLowerCase(); |
| 3054 | + }, |
| 3055 | + CHILD: function(match){ |
| 3056 | + if ( match[1] === "nth" ) { |
| 3057 | + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
| 3058 | + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
| 3059 | + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || |
| 3060 | + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
| 3061 | + |
| 3062 | + // calculate the numbers (first)n+(last) including if they are negative |
| 3063 | + match[2] = (test[1] + (test[2] || 1)) - 0; |
| 3064 | + match[3] = test[3] - 0; |
| 3065 | + } |
| 3066 | + |
| 3067 | + // TODO: Move to normal caching system |
| 3068 | + match[0] = done++; |
| 3069 | + |
| 3070 | + return match; |
| 3071 | + }, |
| 3072 | + ATTR: function(match, curLoop, inplace, result, not, isXML){ |
| 3073 | + var name = match[1].replace(/\\/g, ""); |
| 3074 | + |
| 3075 | + if ( !isXML && Expr.attrMap[name] ) { |
| 3076 | + match[1] = Expr.attrMap[name]; |
| 3077 | + } |
| 3078 | + |
| 3079 | + if ( match[2] === "~=" ) { |
| 3080 | + match[4] = " " + match[4] + " "; |
| 3081 | + } |
| 3082 | + |
| 3083 | + return match; |
| 3084 | + }, |
| 3085 | + PSEUDO: function(match, curLoop, inplace, result, not){ |
| 3086 | + if ( match[1] === "not" ) { |
| 3087 | + // If we're dealing with a complex expression, or a simple one |
| 3088 | + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { |
| 3089 | + match[3] = Sizzle(match[3], null, null, curLoop); |
| 3090 | + } else { |
| 3091 | + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
| 3092 | + if ( !inplace ) { |
| 3093 | + result.push.apply( result, ret ); |
| 3094 | + } |
| 3095 | + return false; |
| 3096 | + } |
| 3097 | + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
| 3098 | + return true; |
| 3099 | + } |
| 3100 | + |
| 3101 | + return match; |
| 3102 | + }, |
| 3103 | + POS: function(match){ |
| 3104 | + match.unshift( true ); |
| 3105 | + return match; |
| 3106 | + } |
| 3107 | + }, |
| 3108 | + filters: { |
| 3109 | + enabled: function(elem){ |
| 3110 | + return elem.disabled === false && elem.type !== "hidden"; |
| 3111 | + }, |
| 3112 | + disabled: function(elem){ |
| 3113 | + return elem.disabled === true; |
| 3114 | + }, |
| 3115 | + checked: function(elem){ |
| 3116 | + return elem.checked === true; |
| 3117 | + }, |
| 3118 | + selected: function(elem){ |
| 3119 | + // Accessing this property makes selected-by-default |
| 3120 | + // options in Safari work properly |
| 3121 | + elem.parentNode.selectedIndex; |
| 3122 | + return elem.selected === true; |
| 3123 | + }, |
| 3124 | + parent: function(elem){ |
| 3125 | + return !!elem.firstChild; |
| 3126 | + }, |
| 3127 | + empty: function(elem){ |
| 3128 | + return !elem.firstChild; |
| 3129 | + }, |
| 3130 | + has: function(elem, i, match){ |
| 3131 | + return !!Sizzle( match[3], elem ).length; |
| 3132 | + }, |
| 3133 | + header: function(elem){ |
| 3134 | + return /h\d/i.test( elem.nodeName ); |
| 3135 | + }, |
| 3136 | + text: function(elem){ |
| 3137 | + return "text" === elem.type; |
| 3138 | + }, |
| 3139 | + radio: function(elem){ |
| 3140 | + return "radio" === elem.type; |
| 3141 | + }, |
| 3142 | + checkbox: function(elem){ |
| 3143 | + return "checkbox" === elem.type; |
| 3144 | + }, |
| 3145 | + file: function(elem){ |
| 3146 | + return "file" === elem.type; |
| 3147 | + }, |
| 3148 | + password: function(elem){ |
| 3149 | + return "password" === elem.type; |
| 3150 | + }, |
| 3151 | + submit: function(elem){ |
| 3152 | + return "submit" === elem.type; |
| 3153 | + }, |
| 3154 | + image: function(elem){ |
| 3155 | + return "image" === elem.type; |
| 3156 | + }, |
| 3157 | + reset: function(elem){ |
| 3158 | + return "reset" === elem.type; |
| 3159 | + }, |
| 3160 | + button: function(elem){ |
| 3161 | + return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; |
| 3162 | + }, |
| 3163 | + input: function(elem){ |
| 3164 | + return /input|select|textarea|button/i.test(elem.nodeName); |
| 3165 | + } |
| 3166 | + }, |
| 3167 | + setFilters: { |
| 3168 | + first: function(elem, i){ |
| 3169 | + return i === 0; |
| 3170 | + }, |
| 3171 | + last: function(elem, i, match, array){ |
| 3172 | + return i === array.length - 1; |
| 3173 | + }, |
| 3174 | + even: function(elem, i){ |
| 3175 | + return i % 2 === 0; |
| 3176 | + }, |
| 3177 | + odd: function(elem, i){ |
| 3178 | + return i % 2 === 1; |
| 3179 | + }, |
| 3180 | + lt: function(elem, i, match){ |
| 3181 | + return i < match[3] - 0; |
| 3182 | + }, |
| 3183 | + gt: function(elem, i, match){ |
| 3184 | + return i > match[3] - 0; |
| 3185 | + }, |
| 3186 | + nth: function(elem, i, match){ |
| 3187 | + return match[3] - 0 === i; |
| 3188 | + }, |
| 3189 | + eq: function(elem, i, match){ |
| 3190 | + return match[3] - 0 === i; |
| 3191 | + } |
| 3192 | + }, |
| 3193 | + filter: { |
| 3194 | + PSEUDO: function(elem, match, i, array){ |
| 3195 | + var name = match[1], filter = Expr.filters[ name ]; |
| 3196 | + |
| 3197 | + if ( filter ) { |
| 3198 | + return filter( elem, i, match, array ); |
| 3199 | + } else if ( name === "contains" ) { |
| 3200 | + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; |
| 3201 | + } else if ( name === "not" ) { |
| 3202 | + var not = match[3]; |
| 3203 | + |
| 3204 | + for ( var i = 0, l = not.length; i < l; i++ ) { |
| 3205 | + if ( not[i] === elem ) { |
| 3206 | + return false; |
| 3207 | + } |
| 3208 | + } |
| 3209 | + |
| 3210 | + return true; |
| 3211 | + } else { |
| 3212 | + Sizzle.error( "Syntax error, unrecognized expression: " + name ); |
| 3213 | + } |
| 3214 | + }, |
| 3215 | + CHILD: function(elem, match){ |
| 3216 | + var type = match[1], node = elem; |
| 3217 | + switch (type) { |
| 3218 | + case 'only': |
| 3219 | + case 'first': |
| 3220 | + while ( (node = node.previousSibling) ) { |
| 3221 | + if ( node.nodeType === 1 ) { |
| 3222 | + return false; |
| 3223 | + } |
| 3224 | + } |
| 3225 | + if ( type === "first" ) { |
| 3226 | + return true; |
| 3227 | + } |
| 3228 | + node = elem; |
| 3229 | + case 'last': |
| 3230 | + while ( (node = node.nextSibling) ) { |
| 3231 | + if ( node.nodeType === 1 ) { |
| 3232 | + return false; |
| 3233 | + } |
| 3234 | + } |
| 3235 | + return true; |
| 3236 | + case 'nth': |
| 3237 | + var first = match[2], last = match[3]; |
| 3238 | + |
| 3239 | + if ( first === 1 && last === 0 ) { |
| 3240 | + return true; |
| 3241 | + } |
| 3242 | + |
| 3243 | + var doneName = match[0], |
| 3244 | + parent = elem.parentNode; |
| 3245 | + |
| 3246 | + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
| 3247 | + var count = 0; |
| 3248 | + for ( node = parent.firstChild; node; node = node.nextSibling ) { |
| 3249 | + if ( node.nodeType === 1 ) { |
| 3250 | + node.nodeIndex = ++count; |
| 3251 | + } |
| 3252 | + } |
| 3253 | + parent.sizcache = doneName; |
| 3254 | + } |
| 3255 | + |
| 3256 | + var diff = elem.nodeIndex - last; |
| 3257 | + if ( first === 0 ) { |
| 3258 | + return diff === 0; |
| 3259 | + } else { |
| 3260 | + return ( diff % first === 0 && diff / first >= 0 ); |
| 3261 | + } |
| 3262 | + } |
| 3263 | + }, |
| 3264 | + ID: function(elem, match){ |
| 3265 | + return elem.nodeType === 1 && elem.getAttribute("id") === match; |
| 3266 | + }, |
| 3267 | + TAG: function(elem, match){ |
| 3268 | + return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; |
| 3269 | + }, |
| 3270 | + CLASS: function(elem, match){ |
| 3271 | + return (" " + (elem.className || elem.getAttribute("class")) + " ") |
| 3272 | + .indexOf( match ) > -1; |
| 3273 | + }, |
| 3274 | + ATTR: function(elem, match){ |
| 3275 | + var name = match[1], |
| 3276 | + result = Expr.attrHandle[ name ] ? |
| 3277 | + Expr.attrHandle[ name ]( elem ) : |
| 3278 | + elem[ name ] != null ? |
| 3279 | + elem[ name ] : |
| 3280 | + elem.getAttribute( name ), |
| 3281 | + value = result + "", |
| 3282 | + type = match[2], |
| 3283 | + check = match[4]; |
| 3284 | + |
| 3285 | + return result == null ? |
| 3286 | + type === "!=" : |
| 3287 | + type === "=" ? |
| 3288 | + value === check : |
| 3289 | + type === "*=" ? |
| 3290 | + value.indexOf(check) >= 0 : |
| 3291 | + type === "~=" ? |
| 3292 | + (" " + value + " ").indexOf(check) >= 0 : |
| 3293 | + !check ? |
| 3294 | + value && result !== false : |
| 3295 | + type === "!=" ? |
| 3296 | + value !== check : |
| 3297 | + type === "^=" ? |
| 3298 | + value.indexOf(check) === 0 : |
| 3299 | + type === "$=" ? |
| 3300 | + value.substr(value.length - check.length) === check : |
| 3301 | + type === "|=" ? |
| 3302 | + value === check || value.substr(0, check.length + 1) === check + "-" : |
| 3303 | + false; |
| 3304 | + }, |
| 3305 | + POS: function(elem, match, i, array){ |
| 3306 | + var name = match[2], filter = Expr.setFilters[ name ]; |
| 3307 | + |
| 3308 | + if ( filter ) { |
| 3309 | + return filter( elem, i, match, array ); |
| 3310 | + } |
| 3311 | + } |
| 3312 | + } |
| 3313 | +}; |
| 3314 | + |
| 3315 | +var origPOS = Expr.match.POS; |
| 3316 | + |
| 3317 | +for ( var type in Expr.match ) { |
| 3318 | + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
| 3319 | + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ |
| 3320 | + return "\\" + (num - 0 + 1); |
| 3321 | + })); |
| 3322 | +} |
| 3323 | + |
| 3324 | +var makeArray = function(array, results) { |
| 3325 | + array = Array.prototype.slice.call( array, 0 ); |
| 3326 | + |
| 3327 | + if ( results ) { |
| 3328 | + results.push.apply( results, array ); |
| 3329 | + return results; |
| 3330 | + } |
| 3331 | + |
| 3332 | + return array; |
| 3333 | +}; |
| 3334 | + |
| 3335 | +// Perform a simple check to determine if the browser is capable of |
| 3336 | +// converting a NodeList to an array using builtin methods. |
| 3337 | +// Also verifies that the returned array holds DOM nodes |
| 3338 | +// (which is not the case in the Blackberry browser) |
| 3339 | +try { |
| 3340 | + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; |
| 3341 | + |
| 3342 | +// Provide a fallback method if it does not work |
| 3343 | +} catch(e){ |
| 3344 | + makeArray = function(array, results) { |
| 3345 | + var ret = results || []; |
| 3346 | + |
| 3347 | + if ( toString.call(array) === "[object Array]" ) { |
| 3348 | + Array.prototype.push.apply( ret, array ); |
| 3349 | + } else { |
| 3350 | + if ( typeof array.length === "number" ) { |
| 3351 | + for ( var i = 0, l = array.length; i < l; i++ ) { |
| 3352 | + ret.push( array[i] ); |
| 3353 | + } |
| 3354 | + } else { |
| 3355 | + for ( var i = 0; array[i]; i++ ) { |
| 3356 | + ret.push( array[i] ); |
| 3357 | + } |
| 3358 | + } |
| 3359 | + } |
| 3360 | + |
| 3361 | + return ret; |
| 3362 | + }; |
| 3363 | +} |
| 3364 | + |
| 3365 | +var sortOrder; |
| 3366 | + |
| 3367 | +if ( document.documentElement.compareDocumentPosition ) { |
| 3368 | + sortOrder = function( a, b ) { |
| 3369 | + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { |
| 3370 | + if ( a == b ) { |
| 3371 | + hasDuplicate = true; |
| 3372 | + } |
| 3373 | + return a.compareDocumentPosition ? -1 : 1; |
| 3374 | + } |
| 3375 | + |
| 3376 | + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
| 3377 | + if ( ret === 0 ) { |
| 3378 | + hasDuplicate = true; |
| 3379 | + } |
| 3380 | + return ret; |
| 3381 | + }; |
| 3382 | +} else if ( "sourceIndex" in document.documentElement ) { |
| 3383 | + sortOrder = function( a, b ) { |
| 3384 | + if ( !a.sourceIndex || !b.sourceIndex ) { |
| 3385 | + if ( a == b ) { |
| 3386 | + hasDuplicate = true; |
| 3387 | + } |
| 3388 | + return a.sourceIndex ? -1 : 1; |
| 3389 | + } |
| 3390 | + |
| 3391 | + var ret = a.sourceIndex - b.sourceIndex; |
| 3392 | + if ( ret === 0 ) { |
| 3393 | + hasDuplicate = true; |
| 3394 | + } |
| 3395 | + return ret; |
| 3396 | + }; |
| 3397 | +} else if ( document.createRange ) { |
| 3398 | + sortOrder = function( a, b ) { |
| 3399 | + if ( !a.ownerDocument || !b.ownerDocument ) { |
| 3400 | + if ( a == b ) { |
| 3401 | + hasDuplicate = true; |
| 3402 | + } |
| 3403 | + return a.ownerDocument ? -1 : 1; |
| 3404 | + } |
| 3405 | + |
| 3406 | + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
| 3407 | + aRange.setStart(a, 0); |
| 3408 | + aRange.setEnd(a, 0); |
| 3409 | + bRange.setStart(b, 0); |
| 3410 | + bRange.setEnd(b, 0); |
| 3411 | + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
| 3412 | + if ( ret === 0 ) { |
| 3413 | + hasDuplicate = true; |
| 3414 | + } |
| 3415 | + return ret; |
| 3416 | + }; |
| 3417 | +} |
| 3418 | + |
| 3419 | +// Utility function for retreiving the text value of an array of DOM nodes |
| 3420 | +function getText( elems ) { |
| 3421 | + var ret = "", elem; |
| 3422 | + |
| 3423 | + for ( var i = 0; elems[i]; i++ ) { |
| 3424 | + elem = elems[i]; |
| 3425 | + |
| 3426 | + // Get the text from text nodes and CDATA nodes |
| 3427 | + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { |
| 3428 | + ret += elem.nodeValue; |
| 3429 | + |
| 3430 | + // Traverse everything else, except comment nodes |
| 3431 | + } else if ( elem.nodeType !== 8 ) { |
| 3432 | + ret += getText( elem.childNodes ); |
| 3433 | + } |
| 3434 | + } |
| 3435 | + |
| 3436 | + return ret; |
| 3437 | +} |
| 3438 | + |
| 3439 | +// Check to see if the browser returns elements by name when |
| 3440 | +// querying by getElementById (and provide a workaround) |
| 3441 | +(function(){ |
| 3442 | + // We're going to inject a fake input element with a specified name |
| 3443 | + var form = document.createElement("div"), |
| 3444 | + id = "script" + (new Date).getTime(); |
| 3445 | + form.innerHTML = "<a name='" + id + "'/>"; |
| 3446 | + |
| 3447 | + // Inject it into the root element, check its status, and remove it quickly |
| 3448 | + var root = document.documentElement; |
| 3449 | + root.insertBefore( form, root.firstChild ); |
| 3450 | + |
| 3451 | + // The workaround has to do additional checks after a getElementById |
| 3452 | + // Which slows things down for other browsers (hence the branching) |
| 3453 | + if ( document.getElementById( id ) ) { |
| 3454 | + Expr.find.ID = function(match, context, isXML){ |
| 3455 | + if ( typeof context.getElementById !== "undefined" && !isXML ) { |
| 3456 | + var m = context.getElementById(match[1]); |
| 3457 | + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
| 3458 | + } |
| 3459 | + }; |
| 3460 | + |
| 3461 | + Expr.filter.ID = function(elem, match){ |
| 3462 | + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
| 3463 | + return elem.nodeType === 1 && node && node.nodeValue === match; |
| 3464 | + }; |
| 3465 | + } |
| 3466 | + |
| 3467 | + root.removeChild( form ); |
| 3468 | + root = form = null; // release memory in IE |
| 3469 | +})(); |
| 3470 | + |
| 3471 | +(function(){ |
| 3472 | + // Check to see if the browser returns only elements |
| 3473 | + // when doing getElementsByTagName("*") |
| 3474 | + |
| 3475 | + // Create a fake element |
| 3476 | + var div = document.createElement("div"); |
| 3477 | + div.appendChild( document.createComment("") ); |
| 3478 | + |
| 3479 | + // Make sure no comments are found |
| 3480 | + if ( div.getElementsByTagName("*").length > 0 ) { |
| 3481 | + Expr.find.TAG = function(match, context){ |
| 3482 | + var results = context.getElementsByTagName(match[1]); |
| 3483 | + |
| 3484 | + // Filter out possible comments |
| 3485 | + if ( match[1] === "*" ) { |
| 3486 | + var tmp = []; |
| 3487 | + |
| 3488 | + for ( var i = 0; results[i]; i++ ) { |
| 3489 | + if ( results[i].nodeType === 1 ) { |
| 3490 | + tmp.push( results[i] ); |
| 3491 | + } |
| 3492 | + } |
| 3493 | + |
| 3494 | + results = tmp; |
| 3495 | + } |
| 3496 | + |
| 3497 | + return results; |
| 3498 | + }; |
| 3499 | + } |
| 3500 | + |
| 3501 | + // Check to see if an attribute returns normalized href attributes |
| 3502 | + div.innerHTML = "<a href='#'></a>"; |
| 3503 | + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
| 3504 | + div.firstChild.getAttribute("href") !== "#" ) { |
| 3505 | + Expr.attrHandle.href = function(elem){ |
| 3506 | + return elem.getAttribute("href", 2); |
| 3507 | + }; |
| 3508 | + } |
| 3509 | + |
| 3510 | + div = null; // release memory in IE |
| 3511 | +})(); |
| 3512 | + |
| 3513 | +if ( document.querySelectorAll ) { |
| 3514 | + (function(){ |
| 3515 | + var oldSizzle = Sizzle, div = document.createElement("div"); |
| 3516 | + div.innerHTML = "<p class='TEST'></p>"; |
| 3517 | + |
| 3518 | + // Safari can't handle uppercase or unicode characters when |
| 3519 | + // in quirks mode. |
| 3520 | + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
| 3521 | + return; |
| 3522 | + } |
| 3523 | + |
| 3524 | + Sizzle = function(query, context, extra, seed){ |
| 3525 | + context = context || document; |
| 3526 | + |
| 3527 | + // Only use querySelectorAll on non-XML documents |
| 3528 | + // (ID selectors don't work in non-HTML documents) |
| 3529 | + if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
| 3530 | + try { |
| 3531 | + return makeArray( context.querySelectorAll(query), extra ); |
| 3532 | + } catch(e){} |
| 3533 | + } |
| 3534 | + |
| 3535 | + return oldSizzle(query, context, extra, seed); |
| 3536 | + }; |
| 3537 | + |
| 3538 | + for ( var prop in oldSizzle ) { |
| 3539 | + Sizzle[ prop ] = oldSizzle[ prop ]; |
| 3540 | + } |
| 3541 | + |
| 3542 | + div = null; // release memory in IE |
| 3543 | + })(); |
| 3544 | +} |
| 3545 | + |
| 3546 | +(function(){ |
| 3547 | + var div = document.createElement("div"); |
| 3548 | + |
| 3549 | + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
| 3550 | + |
| 3551 | + // Opera can't find a second classname (in 9.6) |
| 3552 | + // Also, make sure that getElementsByClassName actually exists |
| 3553 | + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { |
| 3554 | + return; |
| 3555 | + } |
| 3556 | + |
| 3557 | + // Safari caches class attributes, doesn't catch changes (in 3.2) |
| 3558 | + div.lastChild.className = "e"; |
| 3559 | + |
| 3560 | + if ( div.getElementsByClassName("e").length === 1 ) { |
| 3561 | + return; |
| 3562 | + } |
| 3563 | + |
| 3564 | + Expr.order.splice(1, 0, "CLASS"); |
| 3565 | + Expr.find.CLASS = function(match, context, isXML) { |
| 3566 | + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
| 3567 | + return context.getElementsByClassName(match[1]); |
| 3568 | + } |
| 3569 | + }; |
| 3570 | + |
| 3571 | + div = null; // release memory in IE |
| 3572 | +})(); |
| 3573 | + |
| 3574 | +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
| 3575 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 3576 | + var elem = checkSet[i]; |
| 3577 | + if ( elem ) { |
| 3578 | + elem = elem[dir]; |
| 3579 | + var match = false; |
| 3580 | + |
| 3581 | + while ( elem ) { |
| 3582 | + if ( elem.sizcache === doneName ) { |
| 3583 | + match = checkSet[elem.sizset]; |
| 3584 | + break; |
| 3585 | + } |
| 3586 | + |
| 3587 | + if ( elem.nodeType === 1 && !isXML ){ |
| 3588 | + elem.sizcache = doneName; |
| 3589 | + elem.sizset = i; |
| 3590 | + } |
| 3591 | + |
| 3592 | + if ( elem.nodeName.toLowerCase() === cur ) { |
| 3593 | + match = elem; |
| 3594 | + break; |
| 3595 | + } |
| 3596 | + |
| 3597 | + elem = elem[dir]; |
| 3598 | + } |
| 3599 | + |
| 3600 | + checkSet[i] = match; |
| 3601 | + } |
| 3602 | + } |
| 3603 | +} |
| 3604 | + |
| 3605 | +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
| 3606 | + for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
| 3607 | + var elem = checkSet[i]; |
| 3608 | + if ( elem ) { |
| 3609 | + elem = elem[dir]; |
| 3610 | + var match = false; |
| 3611 | + |
| 3612 | + while ( elem ) { |
| 3613 | + if ( elem.sizcache === doneName ) { |
| 3614 | + match = checkSet[elem.sizset]; |
| 3615 | + break; |
| 3616 | + } |
| 3617 | + |
| 3618 | + if ( elem.nodeType === 1 ) { |
| 3619 | + if ( !isXML ) { |
| 3620 | + elem.sizcache = doneName; |
| 3621 | + elem.sizset = i; |
| 3622 | + } |
| 3623 | + if ( typeof cur !== "string" ) { |
| 3624 | + if ( elem === cur ) { |
| 3625 | + match = true; |
| 3626 | + break; |
| 3627 | + } |
| 3628 | + |
| 3629 | + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
| 3630 | + match = elem; |
| 3631 | + break; |
| 3632 | + } |
| 3633 | + } |
| 3634 | + |
| 3635 | + elem = elem[dir]; |
| 3636 | + } |
| 3637 | + |
| 3638 | + checkSet[i] = match; |
| 3639 | + } |
| 3640 | + } |
| 3641 | +} |
| 3642 | + |
| 3643 | +var contains = document.compareDocumentPosition ? function(a, b){ |
| 3644 | + return !!(a.compareDocumentPosition(b) & 16); |
| 3645 | +} : function(a, b){ |
| 3646 | + return a !== b && (a.contains ? a.contains(b) : true); |
| 3647 | +}; |
| 3648 | + |
| 3649 | +var isXML = function(elem){ |
| 3650 | + // documentElement is verified for cases where it doesn't yet exist |
| 3651 | + // (such as loading iframes in IE - #4833) |
| 3652 | + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; |
| 3653 | + return documentElement ? documentElement.nodeName !== "HTML" : false; |
| 3654 | +}; |
| 3655 | + |
| 3656 | +var posProcess = function(selector, context){ |
| 3657 | + var tmpSet = [], later = "", match, |
| 3658 | + root = context.nodeType ? [context] : context; |
| 3659 | + |
| 3660 | + // Position selectors must be done after the filter |
| 3661 | + // And so must :not(positional) so we move all PSEUDOs to the end |
| 3662 | + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
| 3663 | + later += match[0]; |
| 3664 | + selector = selector.replace( Expr.match.PSEUDO, "" ); |
| 3665 | + } |
| 3666 | + |
| 3667 | + selector = Expr.relative[selector] ? selector + "*" : selector; |
| 3668 | + |
| 3669 | + for ( var i = 0, l = root.length; i < l; i++ ) { |
| 3670 | + Sizzle( selector, root[i], tmpSet ); |
| 3671 | + } |
| 3672 | + |
| 3673 | + return Sizzle.filter( later, tmpSet ); |
| 3674 | +}; |
| 3675 | + |
| 3676 | +// EXPOSE |
| 3677 | +jQuery.find = Sizzle; |
| 3678 | +jQuery.expr = Sizzle.selectors; |
| 3679 | +jQuery.expr[":"] = jQuery.expr.filters; |
| 3680 | +jQuery.unique = Sizzle.uniqueSort; |
| 3681 | +jQuery.text = getText; |
| 3682 | +jQuery.isXMLDoc = isXML; |
| 3683 | +jQuery.contains = contains; |
| 3684 | + |
| 3685 | +return; |
| 3686 | + |
| 3687 | +window.Sizzle = Sizzle; |
| 3688 | + |
| 3689 | +})(); |
| 3690 | +var runtil = /Until$/, |
| 3691 | + rparentsprev = /^(?:parents|prevUntil|prevAll)/, |
| 3692 | + // Note: This RegExp should be improved, or likely pulled from Sizzle |
| 3693 | + rmultiselector = /,/, |
| 3694 | + slice = Array.prototype.slice; |
| 3695 | + |
| 3696 | +// Implement the identical functionality for filter and not |
| 3697 | +var winnow = function( elements, qualifier, keep ) { |
| 3698 | + if ( jQuery.isFunction( qualifier ) ) { |
| 3699 | + return jQuery.grep(elements, function( elem, i ) { |
| 3700 | + return !!qualifier.call( elem, i, elem ) === keep; |
| 3701 | + }); |
| 3702 | + |
| 3703 | + } else if ( qualifier.nodeType ) { |
| 3704 | + return jQuery.grep(elements, function( elem, i ) { |
| 3705 | + return (elem === qualifier) === keep; |
| 3706 | + }); |
| 3707 | + |
| 3708 | + } else if ( typeof qualifier === "string" ) { |
| 3709 | + var filtered = jQuery.grep(elements, function( elem ) { |
| 3710 | + return elem.nodeType === 1; |
| 3711 | + }); |
| 3712 | + |
| 3713 | + if ( isSimple.test( qualifier ) ) { |
| 3714 | + return jQuery.filter(qualifier, filtered, !keep); |
| 3715 | + } else { |
| 3716 | + qualifier = jQuery.filter( qualifier, filtered ); |
| 3717 | + } |
| 3718 | + } |
| 3719 | + |
| 3720 | + return jQuery.grep(elements, function( elem, i ) { |
| 3721 | + return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
| 3722 | + }); |
| 3723 | +}; |
| 3724 | + |
| 3725 | +jQuery.fn.extend({ |
| 3726 | + find: function( selector ) { |
| 3727 | + var ret = this.pushStack( "", "find", selector ), length = 0; |
| 3728 | + |
| 3729 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 3730 | + length = ret.length; |
| 3731 | + jQuery.find( selector, this[i], ret ); |
| 3732 | + |
| 3733 | + if ( i > 0 ) { |
| 3734 | + // Make sure that the results are unique |
| 3735 | + for ( var n = length; n < ret.length; n++ ) { |
| 3736 | + for ( var r = 0; r < length; r++ ) { |
| 3737 | + if ( ret[r] === ret[n] ) { |
| 3738 | + ret.splice(n--, 1); |
| 3739 | + break; |
| 3740 | + } |
| 3741 | + } |
| 3742 | + } |
| 3743 | + } |
| 3744 | + } |
| 3745 | + |
| 3746 | + return ret; |
| 3747 | + }, |
| 3748 | + |
| 3749 | + has: function( target ) { |
| 3750 | + var targets = jQuery( target ); |
| 3751 | + return this.filter(function() { |
| 3752 | + for ( var i = 0, l = targets.length; i < l; i++ ) { |
| 3753 | + if ( jQuery.contains( this, targets[i] ) ) { |
| 3754 | + return true; |
| 3755 | + } |
| 3756 | + } |
| 3757 | + }); |
| 3758 | + }, |
| 3759 | + |
| 3760 | + not: function( selector ) { |
| 3761 | + return this.pushStack( winnow(this, selector, false), "not", selector); |
| 3762 | + }, |
| 3763 | + |
| 3764 | + filter: function( selector ) { |
| 3765 | + return this.pushStack( winnow(this, selector, true), "filter", selector ); |
| 3766 | + }, |
| 3767 | + |
| 3768 | + is: function( selector ) { |
| 3769 | + return !!selector && jQuery.filter( selector, this ).length > 0; |
| 3770 | + }, |
| 3771 | + |
| 3772 | + closest: function( selectors, context ) { |
| 3773 | + if ( jQuery.isArray( selectors ) ) { |
| 3774 | + var ret = [], cur = this[0], match, matches = {}, selector; |
| 3775 | + |
| 3776 | + if ( cur && selectors.length ) { |
| 3777 | + for ( var i = 0, l = selectors.length; i < l; i++ ) { |
| 3778 | + selector = selectors[i]; |
| 3779 | + |
| 3780 | + if ( !matches[selector] ) { |
| 3781 | + matches[selector] = jQuery.expr.match.POS.test( selector ) ? |
| 3782 | + jQuery( selector, context || this.context ) : |
| 3783 | + selector; |
| 3784 | + } |
| 3785 | + } |
| 3786 | + |
| 3787 | + while ( cur && cur.ownerDocument && cur !== context ) { |
| 3788 | + for ( selector in matches ) { |
| 3789 | + match = matches[selector]; |
| 3790 | + |
| 3791 | + if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { |
| 3792 | + ret.push({ selector: selector, elem: cur }); |
| 3793 | + delete matches[selector]; |
| 3794 | + } |
| 3795 | + } |
| 3796 | + cur = cur.parentNode; |
| 3797 | + } |
| 3798 | + } |
| 3799 | + |
| 3800 | + return ret; |
| 3801 | + } |
| 3802 | + |
| 3803 | + var pos = jQuery.expr.match.POS.test( selectors ) ? |
| 3804 | + jQuery( selectors, context || this.context ) : null; |
| 3805 | + |
| 3806 | + return this.map(function( i, cur ) { |
| 3807 | + while ( cur && cur.ownerDocument && cur !== context ) { |
| 3808 | + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { |
| 3809 | + return cur; |
| 3810 | + } |
| 3811 | + cur = cur.parentNode; |
| 3812 | + } |
| 3813 | + return null; |
| 3814 | + }); |
| 3815 | + }, |
| 3816 | + |
| 3817 | + // Determine the position of an element within |
| 3818 | + // the matched set of elements |
| 3819 | + index: function( elem ) { |
| 3820 | + if ( !elem || typeof elem === "string" ) { |
| 3821 | + return jQuery.inArray( this[0], |
| 3822 | + // If it receives a string, the selector is used |
| 3823 | + // If it receives nothing, the siblings are used |
| 3824 | + elem ? jQuery( elem ) : this.parent().children() ); |
| 3825 | + } |
| 3826 | + // Locate the position of the desired element |
| 3827 | + return jQuery.inArray( |
| 3828 | + // If it receives a jQuery object, the first element is used |
| 3829 | + elem.jquery ? elem[0] : elem, this ); |
| 3830 | + }, |
| 3831 | + |
| 3832 | + add: function( selector, context ) { |
| 3833 | + var set = typeof selector === "string" ? |
| 3834 | + jQuery( selector, context || this.context ) : |
| 3835 | + jQuery.makeArray( selector ), |
| 3836 | + all = jQuery.merge( this.get(), set ); |
| 3837 | + |
| 3838 | + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? |
| 3839 | + all : |
| 3840 | + jQuery.unique( all ) ); |
| 3841 | + }, |
| 3842 | + |
| 3843 | + andSelf: function() { |
| 3844 | + return this.add( this.prevObject ); |
| 3845 | + } |
| 3846 | +}); |
| 3847 | + |
| 3848 | +// A painfully simple check to see if an element is disconnected |
| 3849 | +// from a document (should be improved, where feasible). |
| 3850 | +function isDisconnected( node ) { |
| 3851 | + return !node || !node.parentNode || node.parentNode.nodeType === 11; |
| 3852 | +} |
| 3853 | + |
| 3854 | +jQuery.each({ |
| 3855 | + parent: function( elem ) { |
| 3856 | + var parent = elem.parentNode; |
| 3857 | + return parent && parent.nodeType !== 11 ? parent : null; |
| 3858 | + }, |
| 3859 | + parents: function( elem ) { |
| 3860 | + return jQuery.dir( elem, "parentNode" ); |
| 3861 | + }, |
| 3862 | + parentsUntil: function( elem, i, until ) { |
| 3863 | + return jQuery.dir( elem, "parentNode", until ); |
| 3864 | + }, |
| 3865 | + next: function( elem ) { |
| 3866 | + return jQuery.nth( elem, 2, "nextSibling" ); |
| 3867 | + }, |
| 3868 | + prev: function( elem ) { |
| 3869 | + return jQuery.nth( elem, 2, "previousSibling" ); |
| 3870 | + }, |
| 3871 | + nextAll: function( elem ) { |
| 3872 | + return jQuery.dir( elem, "nextSibling" ); |
| 3873 | + }, |
| 3874 | + prevAll: function( elem ) { |
| 3875 | + return jQuery.dir( elem, "previousSibling" ); |
| 3876 | + }, |
| 3877 | + nextUntil: function( elem, i, until ) { |
| 3878 | + return jQuery.dir( elem, "nextSibling", until ); |
| 3879 | + }, |
| 3880 | + prevUntil: function( elem, i, until ) { |
| 3881 | + return jQuery.dir( elem, "previousSibling", until ); |
| 3882 | + }, |
| 3883 | + siblings: function( elem ) { |
| 3884 | + return jQuery.sibling( elem.parentNode.firstChild, elem ); |
| 3885 | + }, |
| 3886 | + children: function( elem ) { |
| 3887 | + return jQuery.sibling( elem.firstChild ); |
| 3888 | + }, |
| 3889 | + contents: function( elem ) { |
| 3890 | + return jQuery.nodeName( elem, "iframe" ) ? |
| 3891 | + elem.contentDocument || elem.contentWindow.document : |
| 3892 | + jQuery.makeArray( elem.childNodes ); |
| 3893 | + } |
| 3894 | +}, function( name, fn ) { |
| 3895 | + jQuery.fn[ name ] = function( until, selector ) { |
| 3896 | + var ret = jQuery.map( this, fn, until ); |
| 3897 | + |
| 3898 | + if ( !runtil.test( name ) ) { |
| 3899 | + selector = until; |
| 3900 | + } |
| 3901 | + |
| 3902 | + if ( selector && typeof selector === "string" ) { |
| 3903 | + ret = jQuery.filter( selector, ret ); |
| 3904 | + } |
| 3905 | + |
| 3906 | + ret = this.length > 1 ? jQuery.unique( ret ) : ret; |
| 3907 | + |
| 3908 | + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { |
| 3909 | + ret = ret.reverse(); |
| 3910 | + } |
| 3911 | + |
| 3912 | + return this.pushStack( ret, name, slice.call(arguments).join(",") ); |
| 3913 | + }; |
| 3914 | +}); |
| 3915 | + |
| 3916 | +jQuery.extend({ |
| 3917 | + filter: function( expr, elems, not ) { |
| 3918 | + if ( not ) { |
| 3919 | + expr = ":not(" + expr + ")"; |
| 3920 | + } |
| 3921 | + |
| 3922 | + return jQuery.find.matches(expr, elems); |
| 3923 | + }, |
| 3924 | + |
| 3925 | + dir: function( elem, dir, until ) { |
| 3926 | + var matched = [], cur = elem[dir]; |
| 3927 | + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { |
| 3928 | + if ( cur.nodeType === 1 ) { |
| 3929 | + matched.push( cur ); |
| 3930 | + } |
| 3931 | + cur = cur[dir]; |
| 3932 | + } |
| 3933 | + return matched; |
| 3934 | + }, |
| 3935 | + |
| 3936 | + nth: function( cur, result, dir, elem ) { |
| 3937 | + result = result || 1; |
| 3938 | + var num = 0; |
| 3939 | + |
| 3940 | + for ( ; cur; cur = cur[dir] ) { |
| 3941 | + if ( cur.nodeType === 1 && ++num === result ) { |
| 3942 | + break; |
| 3943 | + } |
| 3944 | + } |
| 3945 | + |
| 3946 | + return cur; |
| 3947 | + }, |
| 3948 | + |
| 3949 | + sibling: function( n, elem ) { |
| 3950 | + var r = []; |
| 3951 | + |
| 3952 | + for ( ; n; n = n.nextSibling ) { |
| 3953 | + if ( n.nodeType === 1 && n !== elem ) { |
| 3954 | + r.push( n ); |
| 3955 | + } |
| 3956 | + } |
| 3957 | + |
| 3958 | + return r; |
| 3959 | + } |
| 3960 | +}); |
| 3961 | +var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, |
| 3962 | + rleadingWhitespace = /^\s+/, |
| 3963 | + rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, |
| 3964 | + rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, |
| 3965 | + rtagName = /<([\w:]+)/, |
| 3966 | + rtbody = /<tbody/i, |
| 3967 | + rhtml = /<|&#?\w+;/, |
| 3968 | + rnocache = /<script|<object|<embed|<option|<style/i, |
| 3969 | + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5) |
| 3970 | + fcloseTag = function( all, front, tag ) { |
| 3971 | + return rselfClosing.test( tag ) ? |
| 3972 | + all : |
| 3973 | + front + "></" + tag + ">"; |
| 3974 | + }, |
| 3975 | + wrapMap = { |
| 3976 | + option: [ 1, "<select multiple='multiple'>", "</select>" ], |
| 3977 | + legend: [ 1, "<fieldset>", "</fieldset>" ], |
| 3978 | + thead: [ 1, "<table>", "</table>" ], |
| 3979 | + tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
| 3980 | + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
| 3981 | + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], |
| 3982 | + area: [ 1, "<map>", "</map>" ], |
| 3983 | + _default: [ 0, "", "" ] |
| 3984 | + }; |
| 3985 | + |
| 3986 | +wrapMap.optgroup = wrapMap.option; |
| 3987 | +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
| 3988 | +wrapMap.th = wrapMap.td; |
| 3989 | + |
| 3990 | +// IE can't serialize <link> and <script> tags normally |
| 3991 | +if ( !jQuery.support.htmlSerialize ) { |
| 3992 | + wrapMap._default = [ 1, "div<div>", "</div>" ]; |
| 3993 | +} |
| 3994 | + |
| 3995 | +jQuery.fn.extend({ |
| 3996 | + text: function( text ) { |
| 3997 | + if ( jQuery.isFunction(text) ) { |
| 3998 | + return this.each(function(i) { |
| 3999 | + var self = jQuery(this); |
| 4000 | + self.text( text.call(this, i, self.text()) ); |
| 4001 | + }); |
| 4002 | + } |
| 4003 | + |
| 4004 | + if ( typeof text !== "object" && text !== undefined ) { |
| 4005 | + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
| 4006 | + } |
| 4007 | + |
| 4008 | + return jQuery.text( this ); |
| 4009 | + }, |
| 4010 | + |
| 4011 | + wrapAll: function( html ) { |
| 4012 | + if ( jQuery.isFunction( html ) ) { |
| 4013 | + return this.each(function(i) { |
| 4014 | + jQuery(this).wrapAll( html.call(this, i) ); |
| 4015 | + }); |
| 4016 | + } |
| 4017 | + |
| 4018 | + if ( this[0] ) { |
| 4019 | + // The elements to wrap the target around |
| 4020 | + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); |
| 4021 | + |
| 4022 | + if ( this[0].parentNode ) { |
| 4023 | + wrap.insertBefore( this[0] ); |
| 4024 | + } |
| 4025 | + |
| 4026 | + wrap.map(function() { |
| 4027 | + var elem = this; |
| 4028 | + |
| 4029 | + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
| 4030 | + elem = elem.firstChild; |
| 4031 | + } |
| 4032 | + |
| 4033 | + return elem; |
| 4034 | + }).append(this); |
| 4035 | + } |
| 4036 | + |
| 4037 | + return this; |
| 4038 | + }, |
| 4039 | + |
| 4040 | + wrapInner: function( html ) { |
| 4041 | + if ( jQuery.isFunction( html ) ) { |
| 4042 | + return this.each(function(i) { |
| 4043 | + jQuery(this).wrapInner( html.call(this, i) ); |
| 4044 | + }); |
| 4045 | + } |
| 4046 | + |
| 4047 | + return this.each(function() { |
| 4048 | + var self = jQuery( this ), contents = self.contents(); |
| 4049 | + |
| 4050 | + if ( contents.length ) { |
| 4051 | + contents.wrapAll( html ); |
| 4052 | + |
| 4053 | + } else { |
| 4054 | + self.append( html ); |
| 4055 | + } |
| 4056 | + }); |
| 4057 | + }, |
| 4058 | + |
| 4059 | + wrap: function( html ) { |
| 4060 | + return this.each(function() { |
| 4061 | + jQuery( this ).wrapAll( html ); |
| 4062 | + }); |
| 4063 | + }, |
| 4064 | + |
| 4065 | + unwrap: function() { |
| 4066 | + return this.parent().each(function() { |
| 4067 | + if ( !jQuery.nodeName( this, "body" ) ) { |
| 4068 | + jQuery( this ).replaceWith( this.childNodes ); |
| 4069 | + } |
| 4070 | + }).end(); |
| 4071 | + }, |
| 4072 | + |
| 4073 | + append: function() { |
| 4074 | + return this.domManip(arguments, true, function( elem ) { |
| 4075 | + if ( this.nodeType === 1 ) { |
| 4076 | + this.appendChild( elem ); |
| 4077 | + } |
| 4078 | + }); |
| 4079 | + }, |
| 4080 | + |
| 4081 | + prepend: function() { |
| 4082 | + return this.domManip(arguments, true, function( elem ) { |
| 4083 | + if ( this.nodeType === 1 ) { |
| 4084 | + this.insertBefore( elem, this.firstChild ); |
| 4085 | + } |
| 4086 | + }); |
| 4087 | + }, |
| 4088 | + |
| 4089 | + before: function() { |
| 4090 | + if ( this[0] && this[0].parentNode ) { |
| 4091 | + return this.domManip(arguments, false, function( elem ) { |
| 4092 | + this.parentNode.insertBefore( elem, this ); |
| 4093 | + }); |
| 4094 | + } else if ( arguments.length ) { |
| 4095 | + var set = jQuery(arguments[0]); |
| 4096 | + set.push.apply( set, this.toArray() ); |
| 4097 | + return this.pushStack( set, "before", arguments ); |
| 4098 | + } |
| 4099 | + }, |
| 4100 | + |
| 4101 | + after: function() { |
| 4102 | + if ( this[0] && this[0].parentNode ) { |
| 4103 | + return this.domManip(arguments, false, function( elem ) { |
| 4104 | + this.parentNode.insertBefore( elem, this.nextSibling ); |
| 4105 | + }); |
| 4106 | + } else if ( arguments.length ) { |
| 4107 | + var set = this.pushStack( this, "after", arguments ); |
| 4108 | + set.push.apply( set, jQuery(arguments[0]).toArray() ); |
| 4109 | + return set; |
| 4110 | + } |
| 4111 | + }, |
| 4112 | + |
| 4113 | + // keepData is for internal use only--do not document |
| 4114 | + remove: function( selector, keepData ) { |
| 4115 | + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { |
| 4116 | + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { |
| 4117 | + if ( !keepData && elem.nodeType === 1 ) { |
| 4118 | + jQuery.cleanData( elem.getElementsByTagName("*") ); |
| 4119 | + jQuery.cleanData( [ elem ] ); |
| 4120 | + } |
| 4121 | + |
| 4122 | + if ( elem.parentNode ) { |
| 4123 | + elem.parentNode.removeChild( elem ); |
| 4124 | + } |
| 4125 | + } |
| 4126 | + } |
| 4127 | + |
| 4128 | + return this; |
| 4129 | + }, |
| 4130 | + |
| 4131 | + empty: function() { |
| 4132 | + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { |
| 4133 | + // Remove element nodes and prevent memory leaks |
| 4134 | + if ( elem.nodeType === 1 ) { |
| 4135 | + jQuery.cleanData( elem.getElementsByTagName("*") ); |
| 4136 | + } |
| 4137 | + |
| 4138 | + // Remove any remaining nodes |
| 4139 | + while ( elem.firstChild ) { |
| 4140 | + elem.removeChild( elem.firstChild ); |
| 4141 | + } |
| 4142 | + } |
| 4143 | + |
| 4144 | + return this; |
| 4145 | + }, |
| 4146 | + |
| 4147 | + clone: function( events ) { |
| 4148 | + // Do the clone |
| 4149 | + var ret = this.map(function() { |
| 4150 | + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
| 4151 | + // IE copies events bound via attachEvent when |
| 4152 | + // using cloneNode. Calling detachEvent on the |
| 4153 | + // clone will also remove the events from the orignal |
| 4154 | + // In order to get around this, we use innerHTML. |
| 4155 | + // Unfortunately, this means some modifications to |
| 4156 | + // attributes in IE that are actually only stored |
| 4157 | + // as properties will not be copied (such as the |
| 4158 | + // the name attribute on an input). |
| 4159 | + var html = this.outerHTML, ownerDocument = this.ownerDocument; |
| 4160 | + if ( !html ) { |
| 4161 | + var div = ownerDocument.createElement("div"); |
| 4162 | + div.appendChild( this.cloneNode(true) ); |
| 4163 | + html = div.innerHTML; |
| 4164 | + } |
| 4165 | + |
| 4166 | + return jQuery.clean([html.replace(rinlinejQuery, "") |
| 4167 | + // Handle the case in IE 8 where action=/test/> self-closes a tag |
| 4168 | + .replace(/=([^="'>\s]+\/)>/g, '="$1">') |
| 4169 | + .replace(rleadingWhitespace, "")], ownerDocument)[0]; |
| 4170 | + } else { |
| 4171 | + return this.cloneNode(true); |
| 4172 | + } |
| 4173 | + }); |
| 4174 | + |
| 4175 | + // Copy the events from the original to the clone |
| 4176 | + if ( events === true ) { |
| 4177 | + cloneCopyEvent( this, ret ); |
| 4178 | + cloneCopyEvent( this.find("*"), ret.find("*") ); |
| 4179 | + } |
| 4180 | + |
| 4181 | + // Return the cloned set |
| 4182 | + return ret; |
| 4183 | + }, |
| 4184 | + |
| 4185 | + html: function( value ) { |
| 4186 | + if ( value === undefined ) { |
| 4187 | + return this[0] && this[0].nodeType === 1 ? |
| 4188 | + this[0].innerHTML.replace(rinlinejQuery, "") : |
| 4189 | + null; |
| 4190 | + |
| 4191 | + // See if we can take a shortcut and just use innerHTML |
| 4192 | + } else if ( typeof value === "string" && !rnocache.test( value ) && |
| 4193 | + (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && |
| 4194 | + !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { |
| 4195 | + |
| 4196 | + value = value.replace(rxhtmlTag, fcloseTag); |
| 4197 | + |
| 4198 | + try { |
| 4199 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 4200 | + // Remove element nodes and prevent memory leaks |
| 4201 | + if ( this[i].nodeType === 1 ) { |
| 4202 | + jQuery.cleanData( this[i].getElementsByTagName("*") ); |
| 4203 | + this[i].innerHTML = value; |
| 4204 | + } |
| 4205 | + } |
| 4206 | + |
| 4207 | + // If using innerHTML throws an exception, use the fallback method |
| 4208 | + } catch(e) { |
| 4209 | + this.empty().append( value ); |
| 4210 | + } |
| 4211 | + |
| 4212 | + } else if ( jQuery.isFunction( value ) ) { |
| 4213 | + this.each(function(i){ |
| 4214 | + var self = jQuery(this), old = self.html(); |
| 4215 | + self.empty().append(function(){ |
| 4216 | + return value.call( this, i, old ); |
| 4217 | + }); |
| 4218 | + }); |
| 4219 | + |
| 4220 | + } else { |
| 4221 | + this.empty().append( value ); |
| 4222 | + } |
| 4223 | + |
| 4224 | + return this; |
| 4225 | + }, |
| 4226 | + |
| 4227 | + replaceWith: function( value ) { |
| 4228 | + if ( this[0] && this[0].parentNode ) { |
| 4229 | + // Make sure that the elements are removed from the DOM before they are inserted |
| 4230 | + // this can help fix replacing a parent with child elements |
| 4231 | + if ( jQuery.isFunction( value ) ) { |
| 4232 | + return this.each(function(i) { |
| 4233 | + var self = jQuery(this), old = self.html(); |
| 4234 | + self.replaceWith( value.call( this, i, old ) ); |
| 4235 | + }); |
| 4236 | + } |
| 4237 | + |
| 4238 | + if ( typeof value !== "string" ) { |
| 4239 | + value = jQuery(value).detach(); |
| 4240 | + } |
| 4241 | + |
| 4242 | + return this.each(function() { |
| 4243 | + var next = this.nextSibling, parent = this.parentNode; |
| 4244 | + |
| 4245 | + jQuery(this).remove(); |
| 4246 | + |
| 4247 | + if ( next ) { |
| 4248 | + jQuery(next).before( value ); |
| 4249 | + } else { |
| 4250 | + jQuery(parent).append( value ); |
| 4251 | + } |
| 4252 | + }); |
| 4253 | + } else { |
| 4254 | + return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); |
| 4255 | + } |
| 4256 | + }, |
| 4257 | + |
| 4258 | + detach: function( selector ) { |
| 4259 | + return this.remove( selector, true ); |
| 4260 | + }, |
| 4261 | + |
| 4262 | + domManip: function( args, table, callback ) { |
| 4263 | + var results, first, value = args[0], scripts = [], fragment, parent; |
| 4264 | + |
| 4265 | + // We can't cloneNode fragments that contain checked, in WebKit |
| 4266 | + if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { |
| 4267 | + return this.each(function() { |
| 4268 | + jQuery(this).domManip( args, table, callback, true ); |
| 4269 | + }); |
| 4270 | + } |
| 4271 | + |
| 4272 | + if ( jQuery.isFunction(value) ) { |
| 4273 | + return this.each(function(i) { |
| 4274 | + var self = jQuery(this); |
| 4275 | + args[0] = value.call(this, i, table ? self.html() : undefined); |
| 4276 | + self.domManip( args, table, callback ); |
| 4277 | + }); |
| 4278 | + } |
| 4279 | + |
| 4280 | + if ( this[0] ) { |
| 4281 | + parent = value && value.parentNode; |
| 4282 | + |
| 4283 | + // If we're in a fragment, just use that instead of building a new one |
| 4284 | + if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { |
| 4285 | + results = { fragment: parent }; |
| 4286 | + |
| 4287 | + } else { |
| 4288 | + results = buildFragment( args, this, scripts ); |
| 4289 | + } |
| 4290 | + |
| 4291 | + fragment = results.fragment; |
| 4292 | + |
| 4293 | + if ( fragment.childNodes.length === 1 ) { |
| 4294 | + first = fragment = fragment.firstChild; |
| 4295 | + } else { |
| 4296 | + first = fragment.firstChild; |
| 4297 | + } |
| 4298 | + |
| 4299 | + if ( first ) { |
| 4300 | + table = table && jQuery.nodeName( first, "tr" ); |
| 4301 | + |
| 4302 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 4303 | + callback.call( |
| 4304 | + table ? |
| 4305 | + root(this[i], first) : |
| 4306 | + this[i], |
| 4307 | + i > 0 || results.cacheable || this.length > 1 ? |
| 4308 | + fragment.cloneNode(true) : |
| 4309 | + fragment |
| 4310 | + ); |
| 4311 | + } |
| 4312 | + } |
| 4313 | + |
| 4314 | + if ( scripts.length ) { |
| 4315 | + jQuery.each( scripts, evalScript ); |
| 4316 | + } |
| 4317 | + } |
| 4318 | + |
| 4319 | + return this; |
| 4320 | + |
| 4321 | + function root( elem, cur ) { |
| 4322 | + return jQuery.nodeName(elem, "table") ? |
| 4323 | + (elem.getElementsByTagName("tbody")[0] || |
| 4324 | + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
| 4325 | + elem; |
| 4326 | + } |
| 4327 | + } |
| 4328 | +}); |
| 4329 | + |
| 4330 | +function cloneCopyEvent(orig, ret) { |
| 4331 | + var i = 0; |
| 4332 | + |
| 4333 | + ret.each(function() { |
| 4334 | + if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) { |
| 4335 | + return; |
| 4336 | + } |
| 4337 | + |
| 4338 | + var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events; |
| 4339 | + |
| 4340 | + if ( events ) { |
| 4341 | + delete curData.handle; |
| 4342 | + curData.events = {}; |
| 4343 | + |
| 4344 | + for ( var type in events ) { |
| 4345 | + for ( var handler in events[ type ] ) { |
| 4346 | + jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
| 4347 | + } |
| 4348 | + } |
| 4349 | + } |
| 4350 | + }); |
| 4351 | +} |
| 4352 | + |
| 4353 | +function buildFragment( args, nodes, scripts ) { |
| 4354 | + var fragment, cacheable, cacheresults, |
| 4355 | + doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); |
| 4356 | + |
| 4357 | + // Only cache "small" (1/2 KB) strings that are associated with the main document |
| 4358 | + // Cloning options loses the selected state, so don't cache them |
| 4359 | + // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment |
| 4360 | + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache |
| 4361 | + if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && |
| 4362 | + !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { |
| 4363 | + |
| 4364 | + cacheable = true; |
| 4365 | + cacheresults = jQuery.fragments[ args[0] ]; |
| 4366 | + if ( cacheresults ) { |
| 4367 | + if ( cacheresults !== 1 ) { |
| 4368 | + fragment = cacheresults; |
| 4369 | + } |
| 4370 | + } |
| 4371 | + } |
| 4372 | + |
| 4373 | + if ( !fragment ) { |
| 4374 | + fragment = doc.createDocumentFragment(); |
| 4375 | + jQuery.clean( args, doc, fragment, scripts ); |
| 4376 | + } |
| 4377 | + |
| 4378 | + if ( cacheable ) { |
| 4379 | + jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; |
| 4380 | + } |
| 4381 | + |
| 4382 | + return { fragment: fragment, cacheable: cacheable }; |
| 4383 | +} |
| 4384 | + |
| 4385 | +jQuery.fragments = {}; |
| 4386 | + |
| 4387 | +jQuery.each({ |
| 4388 | + appendTo: "append", |
| 4389 | + prependTo: "prepend", |
| 4390 | + insertBefore: "before", |
| 4391 | + insertAfter: "after", |
| 4392 | + replaceAll: "replaceWith" |
| 4393 | +}, function( name, original ) { |
| 4394 | + jQuery.fn[ name ] = function( selector ) { |
| 4395 | + var ret = [], insert = jQuery( selector ), |
| 4396 | + parent = this.length === 1 && this[0].parentNode; |
| 4397 | + |
| 4398 | + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { |
| 4399 | + insert[ original ]( this[0] ); |
| 4400 | + return this; |
| 4401 | + |
| 4402 | + } else { |
| 4403 | + for ( var i = 0, l = insert.length; i < l; i++ ) { |
| 4404 | + var elems = (i > 0 ? this.clone(true) : this).get(); |
| 4405 | + jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
| 4406 | + ret = ret.concat( elems ); |
| 4407 | + } |
| 4408 | + |
| 4409 | + return this.pushStack( ret, name, insert.selector ); |
| 4410 | + } |
| 4411 | + }; |
| 4412 | +}); |
| 4413 | + |
| 4414 | +jQuery.extend({ |
| 4415 | + clean: function( elems, context, fragment, scripts ) { |
| 4416 | + context = context || document; |
| 4417 | + |
| 4418 | + // !context.createElement fails in IE with an error but returns typeof 'object' |
| 4419 | + if ( typeof context.createElement === "undefined" ) { |
| 4420 | + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
| 4421 | + } |
| 4422 | + |
| 4423 | + var ret = []; |
| 4424 | + |
| 4425 | + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { |
| 4426 | + if ( typeof elem === "number" ) { |
| 4427 | + elem += ""; |
| 4428 | + } |
| 4429 | + |
| 4430 | + if ( !elem ) { |
| 4431 | + continue; |
| 4432 | + } |
| 4433 | + |
| 4434 | + // Convert html string into DOM nodes |
| 4435 | + if ( typeof elem === "string" && !rhtml.test( elem ) ) { |
| 4436 | + elem = context.createTextNode( elem ); |
| 4437 | + |
| 4438 | + } else if ( typeof elem === "string" ) { |
| 4439 | + // Fix "XHTML"-style tags in all browsers |
| 4440 | + elem = elem.replace(rxhtmlTag, fcloseTag); |
| 4441 | + |
| 4442 | + // Trim whitespace, otherwise indexOf won't work as expected |
| 4443 | + var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), |
| 4444 | + wrap = wrapMap[ tag ] || wrapMap._default, |
| 4445 | + depth = wrap[0], |
| 4446 | + div = context.createElement("div"); |
| 4447 | + |
| 4448 | + // Go to html and back, then peel off extra wrappers |
| 4449 | + div.innerHTML = wrap[1] + elem + wrap[2]; |
| 4450 | + |
| 4451 | + // Move to the right depth |
| 4452 | + while ( depth-- ) { |
| 4453 | + div = div.lastChild; |
| 4454 | + } |
| 4455 | + |
| 4456 | + // Remove IE's autoinserted <tbody> from table fragments |
| 4457 | + if ( !jQuery.support.tbody ) { |
| 4458 | + |
| 4459 | + // String was a <table>, *may* have spurious <tbody> |
| 4460 | + var hasBody = rtbody.test(elem), |
| 4461 | + tbody = tag === "table" && !hasBody ? |
| 4462 | + div.firstChild && div.firstChild.childNodes : |
| 4463 | + |
| 4464 | + // String was a bare <thead> or <tfoot> |
| 4465 | + wrap[1] === "<table>" && !hasBody ? |
| 4466 | + div.childNodes : |
| 4467 | + []; |
| 4468 | + |
| 4469 | + for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
| 4470 | + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
| 4471 | + tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
| 4472 | + } |
| 4473 | + } |
| 4474 | + |
| 4475 | + } |
| 4476 | + |
| 4477 | + // IE completely kills leading whitespace when innerHTML is used |
| 4478 | + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
| 4479 | + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
| 4480 | + } |
| 4481 | + |
| 4482 | + elem = div.childNodes; |
| 4483 | + } |
| 4484 | + |
| 4485 | + if ( elem.nodeType ) { |
| 4486 | + ret.push( elem ); |
| 4487 | + } else { |
| 4488 | + ret = jQuery.merge( ret, elem ); |
| 4489 | + } |
| 4490 | + } |
| 4491 | + |
| 4492 | + if ( fragment ) { |
| 4493 | + for ( var i = 0; ret[i]; i++ ) { |
| 4494 | + if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
| 4495 | + scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
| 4496 | + |
| 4497 | + } else { |
| 4498 | + if ( ret[i].nodeType === 1 ) { |
| 4499 | + ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
| 4500 | + } |
| 4501 | + fragment.appendChild( ret[i] ); |
| 4502 | + } |
| 4503 | + } |
| 4504 | + } |
| 4505 | + |
| 4506 | + return ret; |
| 4507 | + }, |
| 4508 | + |
| 4509 | + cleanData: function( elems ) { |
| 4510 | + var data, id, cache = jQuery.cache, |
| 4511 | + special = jQuery.event.special, |
| 4512 | + deleteExpando = jQuery.support.deleteExpando; |
| 4513 | + |
| 4514 | + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { |
| 4515 | + id = elem[ jQuery.expando ]; |
| 4516 | + |
| 4517 | + if ( id ) { |
| 4518 | + data = cache[ id ]; |
| 4519 | + |
| 4520 | + if ( data.events ) { |
| 4521 | + for ( var type in data.events ) { |
| 4522 | + if ( special[ type ] ) { |
| 4523 | + jQuery.event.remove( elem, type ); |
| 4524 | + |
| 4525 | + } else { |
| 4526 | + removeEvent( elem, type, data.handle ); |
| 4527 | + } |
| 4528 | + } |
| 4529 | + } |
| 4530 | + |
| 4531 | + if ( deleteExpando ) { |
| 4532 | + delete elem[ jQuery.expando ]; |
| 4533 | + |
| 4534 | + } else if ( elem.removeAttribute ) { |
| 4535 | + elem.removeAttribute( jQuery.expando ); |
| 4536 | + } |
| 4537 | + |
| 4538 | + delete cache[ id ]; |
| 4539 | + } |
| 4540 | + } |
| 4541 | + } |
| 4542 | +}); |
| 4543 | +// exclude the following css properties to add px |
| 4544 | +var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
| 4545 | + ralpha = /alpha\([^)]*\)/, |
| 4546 | + ropacity = /opacity=([^)]*)/, |
| 4547 | + rfloat = /float/i, |
| 4548 | + rdashAlpha = /-([a-z])/ig, |
| 4549 | + rupper = /([A-Z])/g, |
| 4550 | + rnumpx = /^-?\d+(?:px)?$/i, |
| 4551 | + rnum = /^-?\d/, |
| 4552 | + |
| 4553 | + cssShow = { position: "absolute", visibility: "hidden", display:"block" }, |
| 4554 | + cssWidth = [ "Left", "Right" ], |
| 4555 | + cssHeight = [ "Top", "Bottom" ], |
| 4556 | + |
| 4557 | + // cache check for defaultView.getComputedStyle |
| 4558 | + getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, |
| 4559 | + // normalize float css property |
| 4560 | + styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", |
| 4561 | + fcamelCase = function( all, letter ) { |
| 4562 | + return letter.toUpperCase(); |
| 4563 | + }; |
| 4564 | + |
| 4565 | +jQuery.fn.css = function( name, value ) { |
| 4566 | + return access( this, name, value, true, function( elem, name, value ) { |
| 4567 | + if ( value === undefined ) { |
| 4568 | + return jQuery.curCSS( elem, name ); |
| 4569 | + } |
| 4570 | + |
| 4571 | + if ( typeof value === "number" && !rexclude.test(name) ) { |
| 4572 | + value += "px"; |
| 4573 | + } |
| 4574 | + |
| 4575 | + jQuery.style( elem, name, value ); |
| 4576 | + }); |
| 4577 | +}; |
| 4578 | + |
| 4579 | +jQuery.extend({ |
| 4580 | + style: function( elem, name, value ) { |
| 4581 | + // don't set styles on text and comment nodes |
| 4582 | + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
| 4583 | + return undefined; |
| 4584 | + } |
| 4585 | + |
| 4586 | + // ignore negative width and height values #1599 |
| 4587 | + if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) { |
| 4588 | + value = undefined; |
| 4589 | + } |
| 4590 | + |
| 4591 | + var style = elem.style || elem, set = value !== undefined; |
| 4592 | + |
| 4593 | + // IE uses filters for opacity |
| 4594 | + if ( !jQuery.support.opacity && name === "opacity" ) { |
| 4595 | + if ( set ) { |
| 4596 | + // IE has trouble with opacity if it does not have layout |
| 4597 | + // Force it by setting the zoom level |
| 4598 | + style.zoom = 1; |
| 4599 | + |
| 4600 | + // Set the alpha filter to set the opacity |
| 4601 | + var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"; |
| 4602 | + var filter = style.filter || jQuery.curCSS( elem, "filter" ) || ""; |
| 4603 | + style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity; |
| 4604 | + } |
| 4605 | + |
| 4606 | + return style.filter && style.filter.indexOf("opacity=") >= 0 ? |
| 4607 | + (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "": |
| 4608 | + ""; |
| 4609 | + } |
| 4610 | + |
| 4611 | + // Make sure we're using the right name for getting the float value |
| 4612 | + if ( rfloat.test( name ) ) { |
| 4613 | + name = styleFloat; |
| 4614 | + } |
| 4615 | + |
| 4616 | + name = name.replace(rdashAlpha, fcamelCase); |
| 4617 | + |
| 4618 | + if ( set ) { |
| 4619 | + style[ name ] = value; |
| 4620 | + } |
| 4621 | + |
| 4622 | + return style[ name ]; |
| 4623 | + }, |
| 4624 | + |
| 4625 | + css: function( elem, name, force, extra ) { |
| 4626 | + if ( name === "width" || name === "height" ) { |
| 4627 | + var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight; |
| 4628 | + |
| 4629 | + function getWH() { |
| 4630 | + val = name === "width" ? elem.offsetWidth : elem.offsetHeight; |
| 4631 | + |
| 4632 | + if ( extra === "border" ) { |
| 4633 | + return; |
| 4634 | + } |
| 4635 | + |
| 4636 | + jQuery.each( which, function() { |
| 4637 | + if ( !extra ) { |
| 4638 | + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
| 4639 | + } |
| 4640 | + |
| 4641 | + if ( extra === "margin" ) { |
| 4642 | + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
| 4643 | + } else { |
| 4644 | + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
| 4645 | + } |
| 4646 | + }); |
| 4647 | + } |
| 4648 | + |
| 4649 | + if ( elem.offsetWidth !== 0 ) { |
| 4650 | + getWH(); |
| 4651 | + } else { |
| 4652 | + jQuery.swap( elem, props, getWH ); |
| 4653 | + } |
| 4654 | + |
| 4655 | + return Math.max(0, Math.round(val)); |
| 4656 | + } |
| 4657 | + |
| 4658 | + return jQuery.curCSS( elem, name, force ); |
| 4659 | + }, |
| 4660 | + |
| 4661 | + curCSS: function( elem, name, force ) { |
| 4662 | + var ret, style = elem.style, filter; |
| 4663 | + |
| 4664 | + // IE uses filters for opacity |
| 4665 | + if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { |
| 4666 | + ret = ropacity.test(elem.currentStyle.filter || "") ? |
| 4667 | + (parseFloat(RegExp.$1) / 100) + "" : |
| 4668 | + ""; |
| 4669 | + |
| 4670 | + return ret === "" ? |
| 4671 | + "1" : |
| 4672 | + ret; |
| 4673 | + } |
| 4674 | + |
| 4675 | + // Make sure we're using the right name for getting the float value |
| 4676 | + if ( rfloat.test( name ) ) { |
| 4677 | + name = styleFloat; |
| 4678 | + } |
| 4679 | + |
| 4680 | + if ( !force && style && style[ name ] ) { |
| 4681 | + ret = style[ name ]; |
| 4682 | + |
| 4683 | + } else if ( getComputedStyle ) { |
| 4684 | + |
| 4685 | + // Only "float" is needed here |
| 4686 | + if ( rfloat.test( name ) ) { |
| 4687 | + name = "float"; |
| 4688 | + } |
| 4689 | + |
| 4690 | + name = name.replace( rupper, "-$1" ).toLowerCase(); |
| 4691 | + |
| 4692 | + var defaultView = elem.ownerDocument.defaultView; |
| 4693 | + |
| 4694 | + if ( !defaultView ) { |
| 4695 | + return null; |
| 4696 | + } |
| 4697 | + |
| 4698 | + var computedStyle = defaultView.getComputedStyle( elem, null ); |
| 4699 | + |
| 4700 | + if ( computedStyle ) { |
| 4701 | + ret = computedStyle.getPropertyValue( name ); |
| 4702 | + } |
| 4703 | + |
| 4704 | + // We should always get a number back from opacity |
| 4705 | + if ( name === "opacity" && ret === "" ) { |
| 4706 | + ret = "1"; |
| 4707 | + } |
| 4708 | + |
| 4709 | + } else if ( elem.currentStyle ) { |
| 4710 | + var camelCase = name.replace(rdashAlpha, fcamelCase); |
| 4711 | + |
| 4712 | + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
| 4713 | + |
| 4714 | + // From the awesome hack by Dean Edwards |
| 4715 | + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
| 4716 | + |
| 4717 | + // If we're not dealing with a regular pixel number |
| 4718 | + // but a number that has a weird ending, we need to convert it to pixels |
| 4719 | + if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { |
| 4720 | + // Remember the original values |
| 4721 | + var left = style.left, rsLeft = elem.runtimeStyle.left; |
| 4722 | + |
| 4723 | + // Put in the new values to get a computed value out |
| 4724 | + elem.runtimeStyle.left = elem.currentStyle.left; |
| 4725 | + style.left = camelCase === "fontSize" ? "1em" : (ret || 0); |
| 4726 | + ret = style.pixelLeft + "px"; |
| 4727 | + |
| 4728 | + // Revert the changed values |
| 4729 | + style.left = left; |
| 4730 | + elem.runtimeStyle.left = rsLeft; |
| 4731 | + } |
| 4732 | + } |
| 4733 | + |
| 4734 | + return ret; |
| 4735 | + }, |
| 4736 | + |
| 4737 | + // A method for quickly swapping in/out CSS properties to get correct calculations |
| 4738 | + swap: function( elem, options, callback ) { |
| 4739 | + var old = {}; |
| 4740 | + |
| 4741 | + // Remember the old values, and insert the new ones |
| 4742 | + for ( var name in options ) { |
| 4743 | + old[ name ] = elem.style[ name ]; |
| 4744 | + elem.style[ name ] = options[ name ]; |
| 4745 | + } |
| 4746 | + |
| 4747 | + callback.call( elem ); |
| 4748 | + |
| 4749 | + // Revert the old values |
| 4750 | + for ( var name in options ) { |
| 4751 | + elem.style[ name ] = old[ name ]; |
| 4752 | + } |
| 4753 | + } |
| 4754 | +}); |
| 4755 | + |
| 4756 | +if ( jQuery.expr && jQuery.expr.filters ) { |
| 4757 | + jQuery.expr.filters.hidden = function( elem ) { |
| 4758 | + var width = elem.offsetWidth, height = elem.offsetHeight, |
| 4759 | + skip = elem.nodeName.toLowerCase() === "tr"; |
| 4760 | + |
| 4761 | + return width === 0 && height === 0 && !skip ? |
| 4762 | + true : |
| 4763 | + width > 0 && height > 0 && !skip ? |
| 4764 | + false : |
| 4765 | + jQuery.curCSS(elem, "display") === "none"; |
| 4766 | + }; |
| 4767 | + |
| 4768 | + jQuery.expr.filters.visible = function( elem ) { |
| 4769 | + return !jQuery.expr.filters.hidden( elem ); |
| 4770 | + }; |
| 4771 | +} |
| 4772 | +var jsc = now(), |
| 4773 | + rscript = /<script(.|\s)*?\/script>/gi, |
| 4774 | + rselectTextarea = /select|textarea/i, |
| 4775 | + rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, |
| 4776 | + jsre = /=\?(&|$)/, |
| 4777 | + rquery = /\?/, |
| 4778 | + rts = /(\?|&)_=.*?(&|$)/, |
| 4779 | + rurl = /^(\w+:)?\/\/([^\/?#]+)/, |
| 4780 | + r20 = /%20/g, |
| 4781 | + |
| 4782 | + // Keep a copy of the old load method |
| 4783 | + _load = jQuery.fn.load; |
| 4784 | + |
| 4785 | +jQuery.fn.extend({ |
| 4786 | + load: function( url, params, callback ) { |
| 4787 | + if ( typeof url !== "string" ) { |
| 4788 | + return _load.call( this, url ); |
| 4789 | + |
| 4790 | + // Don't do a request if no elements are being requested |
| 4791 | + } else if ( !this.length ) { |
| 4792 | + return this; |
| 4793 | + } |
| 4794 | + |
| 4795 | + var off = url.indexOf(" "); |
| 4796 | + if ( off >= 0 ) { |
| 4797 | + var selector = url.slice(off, url.length); |
| 4798 | + url = url.slice(0, off); |
| 4799 | + } |
| 4800 | + |
| 4801 | + // Default to a GET request |
| 4802 | + var type = "GET"; |
| 4803 | + |
| 4804 | + // If the second parameter was provided |
| 4805 | + if ( params ) { |
| 4806 | + // If it's a function |
| 4807 | + if ( jQuery.isFunction( params ) ) { |
| 4808 | + // We assume that it's the callback |
| 4809 | + callback = params; |
| 4810 | + params = null; |
| 4811 | + |
| 4812 | + // Otherwise, build a param string |
| 4813 | + } else if ( typeof params === "object" ) { |
| 4814 | + params = jQuery.param( params, jQuery.ajaxSettings.traditional ); |
| 4815 | + type = "POST"; |
| 4816 | + } |
| 4817 | + } |
| 4818 | + |
| 4819 | + var self = this; |
| 4820 | + |
| 4821 | + // Request the remote document |
| 4822 | + jQuery.ajax({ |
| 4823 | + url: url, |
| 4824 | + type: type, |
| 4825 | + dataType: "html", |
| 4826 | + data: params, |
| 4827 | + complete: function( res, status ) { |
| 4828 | + // If successful, inject the HTML into all the matched elements |
| 4829 | + if ( status === "success" || status === "notmodified" ) { |
| 4830 | + // See if a selector was specified |
| 4831 | + self.html( selector ? |
| 4832 | + // Create a dummy div to hold the results |
| 4833 | + jQuery("<div />") |
| 4834 | + // inject the contents of the document in, removing the scripts |
| 4835 | + // to avoid any 'Permission Denied' errors in IE |
| 4836 | + .append(res.responseText.replace(rscript, "")) |
| 4837 | + |
| 4838 | + // Locate the specified elements |
| 4839 | + .find(selector) : |
| 4840 | + |
| 4841 | + // If not, just inject the full result |
| 4842 | + res.responseText ); |
| 4843 | + } |
| 4844 | + |
| 4845 | + if ( callback ) { |
| 4846 | + self.each( callback, [res.responseText, status, res] ); |
| 4847 | + } |
| 4848 | + } |
| 4849 | + }); |
| 4850 | + |
| 4851 | + return this; |
| 4852 | + }, |
| 4853 | + |
| 4854 | + serialize: function() { |
| 4855 | + return jQuery.param(this.serializeArray()); |
| 4856 | + }, |
| 4857 | + serializeArray: function() { |
| 4858 | + return this.map(function() { |
| 4859 | + return this.elements ? jQuery.makeArray(this.elements) : this; |
| 4860 | + }) |
| 4861 | + .filter(function() { |
| 4862 | + return this.name && !this.disabled && |
| 4863 | + (this.checked || rselectTextarea.test(this.nodeName) || |
| 4864 | + rinput.test(this.type)); |
| 4865 | + }) |
| 4866 | + .map(function( i, elem ) { |
| 4867 | + var val = jQuery(this).val(); |
| 4868 | + |
| 4869 | + return val == null ? |
| 4870 | + null : |
| 4871 | + jQuery.isArray(val) ? |
| 4872 | + jQuery.map( val, function( val, i ) { |
| 4873 | + return { name: elem.name, value: val }; |
| 4874 | + }) : |
| 4875 | + { name: elem.name, value: val }; |
| 4876 | + }).get(); |
| 4877 | + } |
| 4878 | +}); |
| 4879 | + |
| 4880 | +// Attach a bunch of functions for handling common AJAX events |
| 4881 | +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) { |
| 4882 | + jQuery.fn[o] = function( f ) { |
| 4883 | + return this.bind(o, f); |
| 4884 | + }; |
| 4885 | +}); |
| 4886 | + |
| 4887 | +jQuery.extend({ |
| 4888 | + |
| 4889 | + get: function( url, data, callback, type ) { |
| 4890 | + // shift arguments if data argument was omited |
| 4891 | + if ( jQuery.isFunction( data ) ) { |
| 4892 | + type = type || callback; |
| 4893 | + callback = data; |
| 4894 | + data = null; |
| 4895 | + } |
| 4896 | + |
| 4897 | + return jQuery.ajax({ |
| 4898 | + type: "GET", |
| 4899 | + url: url, |
| 4900 | + data: data, |
| 4901 | + success: callback, |
| 4902 | + dataType: type |
| 4903 | + }); |
| 4904 | + }, |
| 4905 | + |
| 4906 | + getScript: function( url, callback ) { |
| 4907 | + return jQuery.get(url, null, callback, "script"); |
| 4908 | + }, |
| 4909 | + |
| 4910 | + getJSON: function( url, data, callback ) { |
| 4911 | + return jQuery.get(url, data, callback, "json"); |
| 4912 | + }, |
| 4913 | + |
| 4914 | + post: function( url, data, callback, type ) { |
| 4915 | + // shift arguments if data argument was omited |
| 4916 | + if ( jQuery.isFunction( data ) ) { |
| 4917 | + type = type || callback; |
| 4918 | + callback = data; |
| 4919 | + data = {}; |
| 4920 | + } |
| 4921 | + |
| 4922 | + return jQuery.ajax({ |
| 4923 | + type: "POST", |
| 4924 | + url: url, |
| 4925 | + data: data, |
| 4926 | + success: callback, |
| 4927 | + dataType: type |
| 4928 | + }); |
| 4929 | + }, |
| 4930 | + |
| 4931 | + ajaxSetup: function( settings ) { |
| 4932 | + jQuery.extend( jQuery.ajaxSettings, settings ); |
| 4933 | + }, |
| 4934 | + |
| 4935 | + ajaxSettings: { |
| 4936 | + url: location.href, |
| 4937 | + global: true, |
| 4938 | + type: "GET", |
| 4939 | + contentType: "application/x-www-form-urlencoded", |
| 4940 | + processData: true, |
| 4941 | + async: true, |
| 4942 | + /* |
| 4943 | + timeout: 0, |
| 4944 | + data: null, |
| 4945 | + username: null, |
| 4946 | + password: null, |
| 4947 | + traditional: false, |
| 4948 | + */ |
| 4949 | + // Create the request object; Microsoft failed to properly |
| 4950 | + // implement the XMLHttpRequest in IE7 (can't request local files), |
| 4951 | + // so we use the ActiveXObject when it is available |
| 4952 | + // This function can be overriden by calling jQuery.ajaxSetup |
| 4953 | + xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? |
| 4954 | + function() { |
| 4955 | + return new window.XMLHttpRequest(); |
| 4956 | + } : |
| 4957 | + function() { |
| 4958 | + try { |
| 4959 | + return new window.ActiveXObject("Microsoft.XMLHTTP"); |
| 4960 | + } catch(e) {} |
| 4961 | + }, |
| 4962 | + accepts: { |
| 4963 | + xml: "application/xml, text/xml", |
| 4964 | + html: "text/html", |
| 4965 | + script: "text/javascript, application/javascript", |
| 4966 | + json: "application/json, text/javascript", |
| 4967 | + text: "text/plain", |
| 4968 | + _default: "*/*" |
| 4969 | + } |
| 4970 | + }, |
| 4971 | + |
| 4972 | + // Last-Modified header cache for next request |
| 4973 | + lastModified: {}, |
| 4974 | + etag: {}, |
| 4975 | + |
| 4976 | + ajax: function( origSettings ) { |
| 4977 | + var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings); |
| 4978 | + |
| 4979 | + var jsonp, status, data, |
| 4980 | + callbackContext = origSettings && origSettings.context || s, |
| 4981 | + type = s.type.toUpperCase(); |
| 4982 | + |
| 4983 | + // convert data if not already a string |
| 4984 | + if ( s.data && s.processData && typeof s.data !== "string" ) { |
| 4985 | + s.data = jQuery.param( s.data, s.traditional ); |
| 4986 | + } |
| 4987 | + |
| 4988 | + // Handle JSONP Parameter Callbacks |
| 4989 | + if ( s.dataType === "jsonp" ) { |
| 4990 | + if ( type === "GET" ) { |
| 4991 | + if ( !jsre.test( s.url ) ) { |
| 4992 | + s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
| 4993 | + } |
| 4994 | + } else if ( !s.data || !jsre.test(s.data) ) { |
| 4995 | + s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
| 4996 | + } |
| 4997 | + s.dataType = "json"; |
| 4998 | + } |
| 4999 | + |
| 5000 | + // Build temporary JSONP function |
| 5001 | + if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) { |
| 5002 | + jsonp = s.jsonpCallback || ("jsonp" + jsc++); |
| 5003 | + |
| 5004 | + // Replace the =? sequence both in the query string and the data |
| 5005 | + if ( s.data ) { |
| 5006 | + s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
| 5007 | + } |
| 5008 | + |
| 5009 | + s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
| 5010 | + |
| 5011 | + // We need to make sure |
| 5012 | + // that a JSONP style response is executed properly |
| 5013 | + s.dataType = "script"; |
| 5014 | + |
| 5015 | + // Handle JSONP-style loading |
| 5016 | + window[ jsonp ] = window[ jsonp ] || function( tmp ) { |
| 5017 | + data = tmp; |
| 5018 | + success(); |
| 5019 | + complete(); |
| 5020 | + // Garbage collect |
| 5021 | + window[ jsonp ] = undefined; |
| 5022 | + |
| 5023 | + try { |
| 5024 | + delete window[ jsonp ]; |
| 5025 | + } catch(e) {} |
| 5026 | + |
| 5027 | + if ( head ) { |
| 5028 | + head.removeChild( script ); |
| 5029 | + } |
| 5030 | + }; |
| 5031 | + } |
| 5032 | + |
| 5033 | + if ( s.dataType === "script" && s.cache === null ) { |
| 5034 | + s.cache = false; |
| 5035 | + } |
| 5036 | + |
| 5037 | + if ( s.cache === false && type === "GET" ) { |
| 5038 | + var ts = now(); |
| 5039 | + |
| 5040 | + // try replacing _= if it is there |
| 5041 | + var ret = s.url.replace(rts, "$1_=" + ts + "$2"); |
| 5042 | + |
| 5043 | + // if nothing was replaced, add timestamp to the end |
| 5044 | + s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); |
| 5045 | + } |
| 5046 | + |
| 5047 | + // If data is available, append data to url for get requests |
| 5048 | + if ( s.data && type === "GET" ) { |
| 5049 | + s.url += (rquery.test(s.url) ? "&" : "?") + s.data; |
| 5050 | + } |
| 5051 | + |
| 5052 | + // Watch for a new set of requests |
| 5053 | + if ( s.global && ! jQuery.active++ ) { |
| 5054 | + jQuery.event.trigger( "ajaxStart" ); |
| 5055 | + } |
| 5056 | + |
| 5057 | + // Matches an absolute URL, and saves the domain |
| 5058 | + var parts = rurl.exec( s.url ), |
| 5059 | + remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host); |
| 5060 | + |
| 5061 | + // If we're requesting a remote document |
| 5062 | + // and trying to load JSON or Script with a GET |
| 5063 | + if ( s.dataType === "script" && type === "GET" && remote ) { |
| 5064 | + var head = document.getElementsByTagName("head")[0] || document.documentElement; |
| 5065 | + var script = document.createElement("script"); |
| 5066 | + script.src = s.url; |
| 5067 | + if ( s.scriptCharset ) { |
| 5068 | + script.charset = s.scriptCharset; |
| 5069 | + } |
| 5070 | + |
| 5071 | + // Handle Script loading |
| 5072 | + if ( !jsonp ) { |
| 5073 | + var done = false; |
| 5074 | + |
| 5075 | + // Attach handlers for all browsers |
| 5076 | + script.onload = script.onreadystatechange = function() { |
| 5077 | + if ( !done && (!this.readyState || |
| 5078 | + this.readyState === "loaded" || this.readyState === "complete") ) { |
| 5079 | + done = true; |
| 5080 | + success(); |
| 5081 | + complete(); |
| 5082 | + |
| 5083 | + // Handle memory leak in IE |
| 5084 | + script.onload = script.onreadystatechange = null; |
| 5085 | + if ( head && script.parentNode ) { |
| 5086 | + head.removeChild( script ); |
| 5087 | + } |
| 5088 | + } |
| 5089 | + }; |
| 5090 | + } |
| 5091 | + |
| 5092 | + // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
| 5093 | + // This arises when a base node is used (#2709 and #4378). |
| 5094 | + head.insertBefore( script, head.firstChild ); |
| 5095 | + |
| 5096 | + // We handle everything using the script element injection |
| 5097 | + return undefined; |
| 5098 | + } |
| 5099 | + |
| 5100 | + var requestDone = false; |
| 5101 | + |
| 5102 | + // Create the request object |
| 5103 | + var xhr = s.xhr(); |
| 5104 | + |
| 5105 | + if ( !xhr ) { |
| 5106 | + return; |
| 5107 | + } |
| 5108 | + |
| 5109 | + // Open the socket |
| 5110 | + // Passing null username, generates a login popup on Opera (#2865) |
| 5111 | + if ( s.username ) { |
| 5112 | + xhr.open(type, s.url, s.async, s.username, s.password); |
| 5113 | + } else { |
| 5114 | + xhr.open(type, s.url, s.async); |
| 5115 | + } |
| 5116 | + |
| 5117 | + // Need an extra try/catch for cross domain requests in Firefox 3 |
| 5118 | + try { |
| 5119 | + // Set the correct header, if data is being sent |
| 5120 | + if ( s.data || origSettings && origSettings.contentType ) { |
| 5121 | + xhr.setRequestHeader("Content-Type", s.contentType); |
| 5122 | + } |
| 5123 | + |
| 5124 | + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 5125 | + if ( s.ifModified ) { |
| 5126 | + if ( jQuery.lastModified[s.url] ) { |
| 5127 | + xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); |
| 5128 | + } |
| 5129 | + |
| 5130 | + if ( jQuery.etag[s.url] ) { |
| 5131 | + xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); |
| 5132 | + } |
| 5133 | + } |
| 5134 | + |
| 5135 | + // Set header so the called script knows that it's an XMLHttpRequest |
| 5136 | + // Only send the header if it's not a remote XHR |
| 5137 | + if ( !remote ) { |
| 5138 | + xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
| 5139 | + } |
| 5140 | + |
| 5141 | + // Set the Accepts header for the server, depending on the dataType |
| 5142 | + xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
| 5143 | + s.accepts[ s.dataType ] + ", */*" : |
| 5144 | + s.accepts._default ); |
| 5145 | + } catch(e) {} |
| 5146 | + |
| 5147 | + // Allow custom headers/mimetypes and early abort |
| 5148 | + if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { |
| 5149 | + // Handle the global AJAX counter |
| 5150 | + if ( s.global && ! --jQuery.active ) { |
| 5151 | + jQuery.event.trigger( "ajaxStop" ); |
| 5152 | + } |
| 5153 | + |
| 5154 | + // close opended socket |
| 5155 | + xhr.abort(); |
| 5156 | + return false; |
| 5157 | + } |
| 5158 | + |
| 5159 | + if ( s.global ) { |
| 5160 | + trigger("ajaxSend", [xhr, s]); |
| 5161 | + } |
| 5162 | + |
| 5163 | + // Wait for a response to come back |
| 5164 | + var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) { |
| 5165 | + // The request was aborted |
| 5166 | + if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) { |
| 5167 | + // Opera doesn't call onreadystatechange before this point |
| 5168 | + // so we simulate the call |
| 5169 | + if ( !requestDone ) { |
| 5170 | + complete(); |
| 5171 | + } |
| 5172 | + |
| 5173 | + requestDone = true; |
| 5174 | + if ( xhr ) { |
| 5175 | + xhr.onreadystatechange = jQuery.noop; |
| 5176 | + } |
| 5177 | + |
| 5178 | + // The transfer is complete and the data is available, or the request timed out |
| 5179 | + } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { |
| 5180 | + requestDone = true; |
| 5181 | + xhr.onreadystatechange = jQuery.noop; |
| 5182 | + |
| 5183 | + status = isTimeout === "timeout" ? |
| 5184 | + "timeout" : |
| 5185 | + !jQuery.httpSuccess( xhr ) ? |
| 5186 | + "error" : |
| 5187 | + s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? |
| 5188 | + "notmodified" : |
| 5189 | + "success"; |
| 5190 | + |
| 5191 | + var errMsg; |
| 5192 | + |
| 5193 | + if ( status === "success" ) { |
| 5194 | + // Watch for, and catch, XML document parse errors |
| 5195 | + try { |
| 5196 | + // process the data (runs the xml through httpData regardless of callback) |
| 5197 | + data = jQuery.httpData( xhr, s.dataType, s ); |
| 5198 | + } catch(err) { |
| 5199 | + status = "parsererror"; |
| 5200 | + errMsg = err; |
| 5201 | + } |
| 5202 | + } |
| 5203 | + |
| 5204 | + // Make sure that the request was successful or notmodified |
| 5205 | + if ( status === "success" || status === "notmodified" ) { |
| 5206 | + // JSONP handles its own success callback |
| 5207 | + if ( !jsonp ) { |
| 5208 | + success(); |
| 5209 | + } |
| 5210 | + } else { |
| 5211 | + jQuery.handleError(s, xhr, status, errMsg); |
| 5212 | + } |
| 5213 | + |
| 5214 | + // Fire the complete handlers |
| 5215 | + complete(); |
| 5216 | + |
| 5217 | + if ( isTimeout === "timeout" ) { |
| 5218 | + xhr.abort(); |
| 5219 | + } |
| 5220 | + |
| 5221 | + // Stop memory leaks |
| 5222 | + if ( s.async ) { |
| 5223 | + xhr = null; |
| 5224 | + } |
| 5225 | + } |
| 5226 | + }; |
| 5227 | + |
| 5228 | + // Override the abort handler, if we can (IE doesn't allow it, but that's OK) |
| 5229 | + // Opera doesn't fire onreadystatechange at all on abort |
| 5230 | + try { |
| 5231 | + var oldAbort = xhr.abort; |
| 5232 | + xhr.abort = function() { |
| 5233 | + if ( xhr ) { |
| 5234 | + oldAbort.call( xhr ); |
| 5235 | + } |
| 5236 | + |
| 5237 | + onreadystatechange( "abort" ); |
| 5238 | + }; |
| 5239 | + } catch(e) { } |
| 5240 | + |
| 5241 | + // Timeout checker |
| 5242 | + if ( s.async && s.timeout > 0 ) { |
| 5243 | + setTimeout(function() { |
| 5244 | + // Check to see if the request is still happening |
| 5245 | + if ( xhr && !requestDone ) { |
| 5246 | + onreadystatechange( "timeout" ); |
| 5247 | + } |
| 5248 | + }, s.timeout); |
| 5249 | + } |
| 5250 | + |
| 5251 | + // Send the data |
| 5252 | + try { |
| 5253 | + xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); |
| 5254 | + } catch(e) { |
| 5255 | + jQuery.handleError(s, xhr, null, e); |
| 5256 | + // Fire the complete handlers |
| 5257 | + complete(); |
| 5258 | + } |
| 5259 | + |
| 5260 | + // firefox 1.5 doesn't fire statechange for sync requests |
| 5261 | + if ( !s.async ) { |
| 5262 | + onreadystatechange(); |
| 5263 | + } |
| 5264 | + |
| 5265 | + function success() { |
| 5266 | + // If a local callback was specified, fire it and pass it the data |
| 5267 | + if ( s.success ) { |
| 5268 | + s.success.call( callbackContext, data, status, xhr ); |
| 5269 | + } |
| 5270 | + |
| 5271 | + // Fire the global callback |
| 5272 | + if ( s.global ) { |
| 5273 | + trigger( "ajaxSuccess", [xhr, s] ); |
| 5274 | + } |
| 5275 | + } |
| 5276 | + |
| 5277 | + function complete() { |
| 5278 | + // Process result |
| 5279 | + if ( s.complete ) { |
| 5280 | + s.complete.call( callbackContext, xhr, status); |
| 5281 | + } |
| 5282 | + |
| 5283 | + // The request was completed |
| 5284 | + if ( s.global ) { |
| 5285 | + trigger( "ajaxComplete", [xhr, s] ); |
| 5286 | + } |
| 5287 | + |
| 5288 | + // Handle the global AJAX counter |
| 5289 | + if ( s.global && ! --jQuery.active ) { |
| 5290 | + jQuery.event.trigger( "ajaxStop" ); |
| 5291 | + } |
| 5292 | + } |
| 5293 | + |
| 5294 | + function trigger(type, args) { |
| 5295 | + (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); |
| 5296 | + } |
| 5297 | + |
| 5298 | + // return XMLHttpRequest to allow aborting the request etc. |
| 5299 | + return xhr; |
| 5300 | + }, |
| 5301 | + |
| 5302 | + handleError: function( s, xhr, status, e ) { |
| 5303 | + // If a local callback was specified, fire it |
| 5304 | + if ( s.error ) { |
| 5305 | + s.error.call( s.context || s, xhr, status, e ); |
| 5306 | + } |
| 5307 | + |
| 5308 | + // Fire the global callback |
| 5309 | + if ( s.global ) { |
| 5310 | + (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] ); |
| 5311 | + } |
| 5312 | + }, |
| 5313 | + |
| 5314 | + // Counter for holding the number of active queries |
| 5315 | + active: 0, |
| 5316 | + |
| 5317 | + // Determines if an XMLHttpRequest was successful or not |
| 5318 | + httpSuccess: function( xhr ) { |
| 5319 | + try { |
| 5320 | + // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
| 5321 | + return !xhr.status && location.protocol === "file:" || |
| 5322 | + // Opera returns 0 when status is 304 |
| 5323 | + ( xhr.status >= 200 && xhr.status < 300 ) || |
| 5324 | + xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; |
| 5325 | + } catch(e) {} |
| 5326 | + |
| 5327 | + return false; |
| 5328 | + }, |
| 5329 | + |
| 5330 | + // Determines if an XMLHttpRequest returns NotModified |
| 5331 | + httpNotModified: function( xhr, url ) { |
| 5332 | + var lastModified = xhr.getResponseHeader("Last-Modified"), |
| 5333 | + etag = xhr.getResponseHeader("Etag"); |
| 5334 | + |
| 5335 | + if ( lastModified ) { |
| 5336 | + jQuery.lastModified[url] = lastModified; |
| 5337 | + } |
| 5338 | + |
| 5339 | + if ( etag ) { |
| 5340 | + jQuery.etag[url] = etag; |
| 5341 | + } |
| 5342 | + |
| 5343 | + // Opera returns 0 when status is 304 |
| 5344 | + return xhr.status === 304 || xhr.status === 0; |
| 5345 | + }, |
| 5346 | + |
| 5347 | + httpData: function( xhr, type, s ) { |
| 5348 | + var ct = xhr.getResponseHeader("content-type") || "", |
| 5349 | + xml = type === "xml" || !type && ct.indexOf("xml") >= 0, |
| 5350 | + data = xml ? xhr.responseXML : xhr.responseText; |
| 5351 | + |
| 5352 | + if ( xml && data.documentElement.nodeName === "parsererror" ) { |
| 5353 | + jQuery.error( "parsererror" ); |
| 5354 | + } |
| 5355 | + |
| 5356 | + // Allow a pre-filtering function to sanitize the response |
| 5357 | + // s is checked to keep backwards compatibility |
| 5358 | + if ( s && s.dataFilter ) { |
| 5359 | + data = s.dataFilter( data, type ); |
| 5360 | + } |
| 5361 | + |
| 5362 | + // The filter can actually parse the response |
| 5363 | + if ( typeof data === "string" ) { |
| 5364 | + // Get the JavaScript object, if JSON is used. |
| 5365 | + if ( type === "json" || !type && ct.indexOf("json") >= 0 ) { |
| 5366 | + data = jQuery.parseJSON( data ); |
| 5367 | + |
| 5368 | + // If the type is "script", eval it in global context |
| 5369 | + } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) { |
| 5370 | + jQuery.globalEval( data ); |
| 5371 | + } |
| 5372 | + } |
| 5373 | + |
| 5374 | + return data; |
| 5375 | + }, |
| 5376 | + |
| 5377 | + // Serialize an array of form elements or a set of |
| 5378 | + // key/values into a query string |
| 5379 | + param: function( a, traditional ) { |
| 5380 | + var s = []; |
| 5381 | + |
| 5382 | + // Set traditional to true for jQuery <= 1.3.2 behavior. |
| 5383 | + if ( traditional === undefined ) { |
| 5384 | + traditional = jQuery.ajaxSettings.traditional; |
| 5385 | + } |
| 5386 | + |
| 5387 | + // If an array was passed in, assume that it is an array of form elements. |
| 5388 | + if ( jQuery.isArray(a) || a.jquery ) { |
| 5389 | + // Serialize the form elements |
| 5390 | + jQuery.each( a, function() { |
| 5391 | + add( this.name, this.value ); |
| 5392 | + }); |
| 5393 | + |
| 5394 | + } else { |
| 5395 | + // If traditional, encode the "old" way (the way 1.3.2 or older |
| 5396 | + // did it), otherwise encode params recursively. |
| 5397 | + for ( var prefix in a ) { |
| 5398 | + buildParams( prefix, a[prefix] ); |
| 5399 | + } |
| 5400 | + } |
| 5401 | + |
| 5402 | + // Return the resulting serialization |
| 5403 | + return s.join("&").replace(r20, "+"); |
| 5404 | + |
| 5405 | + function buildParams( prefix, obj ) { |
| 5406 | + if ( jQuery.isArray(obj) ) { |
| 5407 | + // Serialize array item. |
| 5408 | + jQuery.each( obj, function( i, v ) { |
| 5409 | + if ( traditional || /\[\]$/.test( prefix ) ) { |
| 5410 | + // Treat each array item as a scalar. |
| 5411 | + add( prefix, v ); |
| 5412 | + } else { |
| 5413 | + // If array item is non-scalar (array or object), encode its |
| 5414 | + // numeric index to resolve deserialization ambiguity issues. |
| 5415 | + // Note that rack (as of 1.0.0) can't currently deserialize |
| 5416 | + // nested arrays properly, and attempting to do so may cause |
| 5417 | + // a server error. Possible fixes are to modify rack's |
| 5418 | + // deserialization algorithm or to provide an option or flag |
| 5419 | + // to force array serialization to be shallow. |
| 5420 | + buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); |
| 5421 | + } |
| 5422 | + }); |
| 5423 | + |
| 5424 | + } else if ( !traditional && obj != null && typeof obj === "object" ) { |
| 5425 | + // Serialize object item. |
| 5426 | + jQuery.each( obj, function( k, v ) { |
| 5427 | + buildParams( prefix + "[" + k + "]", v ); |
| 5428 | + }); |
| 5429 | + |
| 5430 | + } else { |
| 5431 | + // Serialize scalar item. |
| 5432 | + add( prefix, obj ); |
| 5433 | + } |
| 5434 | + } |
| 5435 | + |
| 5436 | + function add( key, value ) { |
| 5437 | + // If value is a function, invoke it and return its value |
| 5438 | + value = jQuery.isFunction(value) ? value() : value; |
| 5439 | + s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); |
| 5440 | + } |
| 5441 | + } |
| 5442 | +}); |
| 5443 | +var elemdisplay = {}, |
| 5444 | + rfxtypes = /toggle|show|hide/, |
| 5445 | + rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/, |
| 5446 | + timerId, |
| 5447 | + fxAttrs = [ |
| 5448 | + // height animations |
| 5449 | + [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
| 5450 | + // width animations |
| 5451 | + [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
| 5452 | + // opacity animations |
| 5453 | + [ "opacity" ] |
| 5454 | + ]; |
| 5455 | + |
| 5456 | +jQuery.fn.extend({ |
| 5457 | + show: function( speed, callback ) { |
| 5458 | + if ( speed || speed === 0) { |
| 5459 | + return this.animate( genFx("show", 3), speed, callback); |
| 5460 | + |
| 5461 | + } else { |
| 5462 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 5463 | + var old = jQuery.data(this[i], "olddisplay"); |
| 5464 | + |
| 5465 | + this[i].style.display = old || ""; |
| 5466 | + |
| 5467 | + if ( jQuery.css(this[i], "display") === "none" ) { |
| 5468 | + var nodeName = this[i].nodeName, display; |
| 5469 | + |
| 5470 | + if ( elemdisplay[ nodeName ] ) { |
| 5471 | + display = elemdisplay[ nodeName ]; |
| 5472 | + |
| 5473 | + } else { |
| 5474 | + var elem = jQuery("<" + nodeName + " />").appendTo("body"); |
| 5475 | + |
| 5476 | + display = elem.css("display"); |
| 5477 | + |
| 5478 | + if ( display === "none" ) { |
| 5479 | + display = "block"; |
| 5480 | + } |
| 5481 | + |
| 5482 | + elem.remove(); |
| 5483 | + |
| 5484 | + elemdisplay[ nodeName ] = display; |
| 5485 | + } |
| 5486 | + |
| 5487 | + jQuery.data(this[i], "olddisplay", display); |
| 5488 | + } |
| 5489 | + } |
| 5490 | + |
| 5491 | + // Set the display of the elements in a second loop |
| 5492 | + // to avoid the constant reflow |
| 5493 | + for ( var j = 0, k = this.length; j < k; j++ ) { |
| 5494 | + this[j].style.display = jQuery.data(this[j], "olddisplay") || ""; |
| 5495 | + } |
| 5496 | + |
| 5497 | + return this; |
| 5498 | + } |
| 5499 | + }, |
| 5500 | + |
| 5501 | + hide: function( speed, callback ) { |
| 5502 | + if ( speed || speed === 0 ) { |
| 5503 | + return this.animate( genFx("hide", 3), speed, callback); |
| 5504 | + |
| 5505 | + } else { |
| 5506 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
| 5507 | + var old = jQuery.data(this[i], "olddisplay"); |
| 5508 | + if ( !old && old !== "none" ) { |
| 5509 | + jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); |
| 5510 | + } |
| 5511 | + } |
| 5512 | + |
| 5513 | + // Set the display of the elements in a second loop |
| 5514 | + // to avoid the constant reflow |
| 5515 | + for ( var j = 0, k = this.length; j < k; j++ ) { |
| 5516 | + this[j].style.display = "none"; |
| 5517 | + } |
| 5518 | + |
| 5519 | + return this; |
| 5520 | + } |
| 5521 | + }, |
| 5522 | + |
| 5523 | + // Save the old toggle function |
| 5524 | + _toggle: jQuery.fn.toggle, |
| 5525 | + |
| 5526 | + toggle: function( fn, fn2 ) { |
| 5527 | + var bool = typeof fn === "boolean"; |
| 5528 | + |
| 5529 | + if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { |
| 5530 | + this._toggle.apply( this, arguments ); |
| 5531 | + |
| 5532 | + } else if ( fn == null || bool ) { |
| 5533 | + this.each(function() { |
| 5534 | + var state = bool ? fn : jQuery(this).is(":hidden"); |
| 5535 | + jQuery(this)[ state ? "show" : "hide" ](); |
| 5536 | + }); |
| 5537 | + |
| 5538 | + } else { |
| 5539 | + this.animate(genFx("toggle", 3), fn, fn2); |
| 5540 | + } |
| 5541 | + |
| 5542 | + return this; |
| 5543 | + }, |
| 5544 | + |
| 5545 | + fadeTo: function( speed, to, callback ) { |
| 5546 | + return this.filter(":hidden").css("opacity", 0).show().end() |
| 5547 | + .animate({opacity: to}, speed, callback); |
| 5548 | + }, |
| 5549 | + |
| 5550 | + animate: function( prop, speed, easing, callback ) { |
| 5551 | + var optall = jQuery.speed(speed, easing, callback); |
| 5552 | + |
| 5553 | + if ( jQuery.isEmptyObject( prop ) ) { |
| 5554 | + return this.each( optall.complete ); |
| 5555 | + } |
| 5556 | + |
| 5557 | + return this[ optall.queue === false ? "each" : "queue" ](function() { |
| 5558 | + var opt = jQuery.extend({}, optall), p, |
| 5559 | + hidden = this.nodeType === 1 && jQuery(this).is(":hidden"), |
| 5560 | + self = this; |
| 5561 | + |
| 5562 | + for ( p in prop ) { |
| 5563 | + var name = p.replace(rdashAlpha, fcamelCase); |
| 5564 | + |
| 5565 | + if ( p !== name ) { |
| 5566 | + prop[ name ] = prop[ p ]; |
| 5567 | + delete prop[ p ]; |
| 5568 | + p = name; |
| 5569 | + } |
| 5570 | + |
| 5571 | + if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { |
| 5572 | + return opt.complete.call(this); |
| 5573 | + } |
| 5574 | + |
| 5575 | + if ( ( p === "height" || p === "width" ) && this.style ) { |
| 5576 | + // Store display property |
| 5577 | + opt.display = jQuery.css(this, "display"); |
| 5578 | + |
| 5579 | + // Make sure that nothing sneaks out |
| 5580 | + opt.overflow = this.style.overflow; |
| 5581 | + } |
| 5582 | + |
| 5583 | + if ( jQuery.isArray( prop[p] ) ) { |
| 5584 | + // Create (if needed) and add to specialEasing |
| 5585 | + (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; |
| 5586 | + prop[p] = prop[p][0]; |
| 5587 | + } |
| 5588 | + } |
| 5589 | + |
| 5590 | + if ( opt.overflow != null ) { |
| 5591 | + this.style.overflow = "hidden"; |
| 5592 | + } |
| 5593 | + |
| 5594 | + opt.curAnim = jQuery.extend({}, prop); |
| 5595 | + |
| 5596 | + jQuery.each( prop, function( name, val ) { |
| 5597 | + var e = new jQuery.fx( self, opt, name ); |
| 5598 | + |
| 5599 | + if ( rfxtypes.test(val) ) { |
| 5600 | + e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
| 5601 | + |
| 5602 | + } else { |
| 5603 | + var parts = rfxnum.exec(val), |
| 5604 | + start = e.cur(true) || 0; |
| 5605 | + |
| 5606 | + if ( parts ) { |
| 5607 | + var end = parseFloat( parts[2] ), |
| 5608 | + unit = parts[3] || "px"; |
| 5609 | + |
| 5610 | + // We need to compute starting value |
| 5611 | + if ( unit !== "px" ) { |
| 5612 | + self.style[ name ] = (end || 1) + unit; |
| 5613 | + start = ((end || 1) / e.cur(true)) * start; |
| 5614 | + self.style[ name ] = start + unit; |
| 5615 | + } |
| 5616 | + |
| 5617 | + // If a +=/-= token was provided, we're doing a relative animation |
| 5618 | + if ( parts[1] ) { |
| 5619 | + end = ((parts[1] === "-=" ? -1 : 1) * end) + start; |
| 5620 | + } |
| 5621 | + |
| 5622 | + e.custom( start, end, unit ); |
| 5623 | + |
| 5624 | + } else { |
| 5625 | + e.custom( start, val, "" ); |
| 5626 | + } |
| 5627 | + } |
| 5628 | + }); |
| 5629 | + |
| 5630 | + // For JS strict compliance |
| 5631 | + return true; |
| 5632 | + }); |
| 5633 | + }, |
| 5634 | + |
| 5635 | + stop: function( clearQueue, gotoEnd ) { |
| 5636 | + var timers = jQuery.timers; |
| 5637 | + |
| 5638 | + if ( clearQueue ) { |
| 5639 | + this.queue([]); |
| 5640 | + } |
| 5641 | + |
| 5642 | + this.each(function() { |
| 5643 | + // go in reverse order so anything added to the queue during the loop is ignored |
| 5644 | + for ( var i = timers.length - 1; i >= 0; i-- ) { |
| 5645 | + if ( timers[i].elem === this ) { |
| 5646 | + if (gotoEnd) { |
| 5647 | + // force the next step to be the last |
| 5648 | + timers[i](true); |
| 5649 | + } |
| 5650 | + |
| 5651 | + timers.splice(i, 1); |
| 5652 | + } |
| 5653 | + } |
| 5654 | + }); |
| 5655 | + |
| 5656 | + // start the next in the queue if the last step wasn't forced |
| 5657 | + if ( !gotoEnd ) { |
| 5658 | + this.dequeue(); |
| 5659 | + } |
| 5660 | + |
| 5661 | + return this; |
| 5662 | + } |
| 5663 | + |
| 5664 | +}); |
| 5665 | + |
| 5666 | +// Generate shortcuts for custom animations |
| 5667 | +jQuery.each({ |
| 5668 | + slideDown: genFx("show", 1), |
| 5669 | + slideUp: genFx("hide", 1), |
| 5670 | + slideToggle: genFx("toggle", 1), |
| 5671 | + fadeIn: { opacity: "show" }, |
| 5672 | + fadeOut: { opacity: "hide" } |
| 5673 | +}, function( name, props ) { |
| 5674 | + jQuery.fn[ name ] = function( speed, callback ) { |
| 5675 | + return this.animate( props, speed, callback ); |
| 5676 | + }; |
| 5677 | +}); |
| 5678 | + |
| 5679 | +jQuery.extend({ |
| 5680 | + speed: function( speed, easing, fn ) { |
| 5681 | + var opt = speed && typeof speed === "object" ? speed : { |
| 5682 | + complete: fn || !fn && easing || |
| 5683 | + jQuery.isFunction( speed ) && speed, |
| 5684 | + duration: speed, |
| 5685 | + easing: fn && easing || easing && !jQuery.isFunction(easing) && easing |
| 5686 | + }; |
| 5687 | + |
| 5688 | + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
| 5689 | + jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; |
| 5690 | + |
| 5691 | + // Queueing |
| 5692 | + opt.old = opt.complete; |
| 5693 | + opt.complete = function() { |
| 5694 | + if ( opt.queue !== false ) { |
| 5695 | + jQuery(this).dequeue(); |
| 5696 | + } |
| 5697 | + if ( jQuery.isFunction( opt.old ) ) { |
| 5698 | + opt.old.call( this ); |
| 5699 | + } |
| 5700 | + }; |
| 5701 | + |
| 5702 | + return opt; |
| 5703 | + }, |
| 5704 | + |
| 5705 | + easing: { |
| 5706 | + linear: function( p, n, firstNum, diff ) { |
| 5707 | + return firstNum + diff * p; |
| 5708 | + }, |
| 5709 | + swing: function( p, n, firstNum, diff ) { |
| 5710 | + return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
| 5711 | + } |
| 5712 | + }, |
| 5713 | + |
| 5714 | + timers: [], |
| 5715 | + |
| 5716 | + fx: function( elem, options, prop ) { |
| 5717 | + this.options = options; |
| 5718 | + this.elem = elem; |
| 5719 | + this.prop = prop; |
| 5720 | + |
| 5721 | + if ( !options.orig ) { |
| 5722 | + options.orig = {}; |
| 5723 | + } |
| 5724 | + } |
| 5725 | + |
| 5726 | +}); |
| 5727 | + |
| 5728 | +jQuery.fx.prototype = { |
| 5729 | + // Simple function for setting a style value |
| 5730 | + update: function() { |
| 5731 | + if ( this.options.step ) { |
| 5732 | + this.options.step.call( this.elem, this.now, this ); |
| 5733 | + } |
| 5734 | + |
| 5735 | + (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
| 5736 | + |
| 5737 | + // Set display property to block for height/width animations |
| 5738 | + if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) { |
| 5739 | + this.elem.style.display = "block"; |
| 5740 | + } |
| 5741 | + }, |
| 5742 | + |
| 5743 | + // Get the current size |
| 5744 | + cur: function( force ) { |
| 5745 | + if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { |
| 5746 | + return this.elem[ this.prop ]; |
| 5747 | + } |
| 5748 | + |
| 5749 | + var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
| 5750 | + return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
| 5751 | + }, |
| 5752 | + |
| 5753 | + // Start an animation from one number to another |
| 5754 | + custom: function( from, to, unit ) { |
| 5755 | + this.startTime = now(); |
| 5756 | + this.start = from; |
| 5757 | + this.end = to; |
| 5758 | + this.unit = unit || this.unit || "px"; |
| 5759 | + this.now = this.start; |
| 5760 | + this.pos = this.state = 0; |
| 5761 | + |
| 5762 | + var self = this; |
| 5763 | + function t( gotoEnd ) { |
| 5764 | + return self.step(gotoEnd); |
| 5765 | + } |
| 5766 | + |
| 5767 | + t.elem = this.elem; |
| 5768 | + |
| 5769 | + if ( t() && jQuery.timers.push(t) && !timerId ) { |
| 5770 | + timerId = setInterval(jQuery.fx.tick, 13); |
| 5771 | + } |
| 5772 | + }, |
| 5773 | + |
| 5774 | + // Simple 'show' function |
| 5775 | + show: function() { |
| 5776 | + // Remember where we started, so that we can go back to it later |
| 5777 | + this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); |
| 5778 | + this.options.show = true; |
| 5779 | + |
| 5780 | + // Begin the animation |
| 5781 | + // Make sure that we start at a small width/height to avoid any |
| 5782 | + // flash of content |
| 5783 | + this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); |
| 5784 | + |
| 5785 | + // Start by showing the element |
| 5786 | + jQuery( this.elem ).show(); |
| 5787 | + }, |
| 5788 | + |
| 5789 | + // Simple 'hide' function |
| 5790 | + hide: function() { |
| 5791 | + // Remember where we started, so that we can go back to it later |
| 5792 | + this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); |
| 5793 | + this.options.hide = true; |
| 5794 | + |
| 5795 | + // Begin the animation |
| 5796 | + this.custom(this.cur(), 0); |
| 5797 | + }, |
| 5798 | + |
| 5799 | + // Each step of an animation |
| 5800 | + step: function( gotoEnd ) { |
| 5801 | + var t = now(), done = true; |
| 5802 | + |
| 5803 | + if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
| 5804 | + this.now = this.end; |
| 5805 | + this.pos = this.state = 1; |
| 5806 | + this.update(); |
| 5807 | + |
| 5808 | + this.options.curAnim[ this.prop ] = true; |
| 5809 | + |
| 5810 | + for ( var i in this.options.curAnim ) { |
| 5811 | + if ( this.options.curAnim[i] !== true ) { |
| 5812 | + done = false; |
| 5813 | + } |
| 5814 | + } |
| 5815 | + |
| 5816 | + if ( done ) { |
| 5817 | + if ( this.options.display != null ) { |
| 5818 | + // Reset the overflow |
| 5819 | + this.elem.style.overflow = this.options.overflow; |
| 5820 | + |
| 5821 | + // Reset the display |
| 5822 | + var old = jQuery.data(this.elem, "olddisplay"); |
| 5823 | + this.elem.style.display = old ? old : this.options.display; |
| 5824 | + |
| 5825 | + if ( jQuery.css(this.elem, "display") === "none" ) { |
| 5826 | + this.elem.style.display = "block"; |
| 5827 | + } |
| 5828 | + } |
| 5829 | + |
| 5830 | + // Hide the element if the "hide" operation was done |
| 5831 | + if ( this.options.hide ) { |
| 5832 | + jQuery(this.elem).hide(); |
| 5833 | + } |
| 5834 | + |
| 5835 | + // Reset the properties, if the item has been hidden or shown |
| 5836 | + if ( this.options.hide || this.options.show ) { |
| 5837 | + for ( var p in this.options.curAnim ) { |
| 5838 | + jQuery.style(this.elem, p, this.options.orig[p]); |
| 5839 | + } |
| 5840 | + } |
| 5841 | + |
| 5842 | + // Execute the complete function |
| 5843 | + this.options.complete.call( this.elem ); |
| 5844 | + } |
| 5845 | + |
| 5846 | + return false; |
| 5847 | + |
| 5848 | + } else { |
| 5849 | + var n = t - this.startTime; |
| 5850 | + this.state = n / this.options.duration; |
| 5851 | + |
| 5852 | + // Perform the easing function, defaults to swing |
| 5853 | + var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; |
| 5854 | + var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); |
| 5855 | + this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); |
| 5856 | + this.now = this.start + ((this.end - this.start) * this.pos); |
| 5857 | + |
| 5858 | + // Perform the next step of the animation |
| 5859 | + this.update(); |
| 5860 | + } |
| 5861 | + |
| 5862 | + return true; |
| 5863 | + } |
| 5864 | +}; |
| 5865 | + |
| 5866 | +jQuery.extend( jQuery.fx, { |
| 5867 | + tick: function() { |
| 5868 | + var timers = jQuery.timers; |
| 5869 | + |
| 5870 | + for ( var i = 0; i < timers.length; i++ ) { |
| 5871 | + if ( !timers[i]() ) { |
| 5872 | + timers.splice(i--, 1); |
| 5873 | + } |
| 5874 | + } |
| 5875 | + |
| 5876 | + if ( !timers.length ) { |
| 5877 | + jQuery.fx.stop(); |
| 5878 | + } |
| 5879 | + }, |
| 5880 | + |
| 5881 | + stop: function() { |
| 5882 | + clearInterval( timerId ); |
| 5883 | + timerId = null; |
| 5884 | + }, |
| 5885 | + |
| 5886 | + speeds: { |
| 5887 | + slow: 600, |
| 5888 | + fast: 200, |
| 5889 | + // Default speed |
| 5890 | + _default: 400 |
| 5891 | + }, |
| 5892 | + |
| 5893 | + step: { |
| 5894 | + opacity: function( fx ) { |
| 5895 | + jQuery.style(fx.elem, "opacity", fx.now); |
| 5896 | + }, |
| 5897 | + |
| 5898 | + _default: function( fx ) { |
| 5899 | + if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { |
| 5900 | + fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; |
| 5901 | + } else { |
| 5902 | + fx.elem[ fx.prop ] = fx.now; |
| 5903 | + } |
| 5904 | + } |
| 5905 | + } |
| 5906 | +}); |
| 5907 | + |
| 5908 | +if ( jQuery.expr && jQuery.expr.filters ) { |
| 5909 | + jQuery.expr.filters.animated = function( elem ) { |
| 5910 | + return jQuery.grep(jQuery.timers, function( fn ) { |
| 5911 | + return elem === fn.elem; |
| 5912 | + }).length; |
| 5913 | + }; |
| 5914 | +} |
| 5915 | + |
| 5916 | +function genFx( type, num ) { |
| 5917 | + var obj = {}; |
| 5918 | + |
| 5919 | + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { |
| 5920 | + obj[ this ] = type; |
| 5921 | + }); |
| 5922 | + |
| 5923 | + return obj; |
| 5924 | +} |
| 5925 | +if ( "getBoundingClientRect" in document.documentElement ) { |
| 5926 | + jQuery.fn.offset = function( options ) { |
| 5927 | + var elem = this[0]; |
| 5928 | + |
| 5929 | + if ( options ) { |
| 5930 | + return this.each(function( i ) { |
| 5931 | + jQuery.offset.setOffset( this, options, i ); |
| 5932 | + }); |
| 5933 | + } |
| 5934 | + |
| 5935 | + if ( !elem || !elem.ownerDocument ) { |
| 5936 | + return null; |
| 5937 | + } |
| 5938 | + |
| 5939 | + if ( elem === elem.ownerDocument.body ) { |
| 5940 | + return jQuery.offset.bodyOffset( elem ); |
| 5941 | + } |
| 5942 | + |
| 5943 | + var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, |
| 5944 | + clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, |
| 5945 | + top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
| 5946 | + left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
| 5947 | + |
| 5948 | + return { top: top, left: left }; |
| 5949 | + }; |
| 5950 | + |
| 5951 | +} else { |
| 5952 | + jQuery.fn.offset = function( options ) { |
| 5953 | + var elem = this[0]; |
| 5954 | + |
| 5955 | + if ( options ) { |
| 5956 | + return this.each(function( i ) { |
| 5957 | + jQuery.offset.setOffset( this, options, i ); |
| 5958 | + }); |
| 5959 | + } |
| 5960 | + |
| 5961 | + if ( !elem || !elem.ownerDocument ) { |
| 5962 | + return null; |
| 5963 | + } |
| 5964 | + |
| 5965 | + if ( elem === elem.ownerDocument.body ) { |
| 5966 | + return jQuery.offset.bodyOffset( elem ); |
| 5967 | + } |
| 5968 | + |
| 5969 | + jQuery.offset.initialize(); |
| 5970 | + |
| 5971 | + var offsetParent = elem.offsetParent, prevOffsetParent = elem, |
| 5972 | + doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, |
| 5973 | + body = doc.body, defaultView = doc.defaultView, |
| 5974 | + prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, |
| 5975 | + top = elem.offsetTop, left = elem.offsetLeft; |
| 5976 | + |
| 5977 | + while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
| 5978 | + if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
| 5979 | + break; |
| 5980 | + } |
| 5981 | + |
| 5982 | + computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; |
| 5983 | + top -= elem.scrollTop; |
| 5984 | + left -= elem.scrollLeft; |
| 5985 | + |
| 5986 | + if ( elem === offsetParent ) { |
| 5987 | + top += elem.offsetTop; |
| 5988 | + left += elem.offsetLeft; |
| 5989 | + |
| 5990 | + if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { |
| 5991 | + top += parseFloat( computedStyle.borderTopWidth ) || 0; |
| 5992 | + left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
| 5993 | + } |
| 5994 | + |
| 5995 | + prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; |
| 5996 | + } |
| 5997 | + |
| 5998 | + if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { |
| 5999 | + top += parseFloat( computedStyle.borderTopWidth ) || 0; |
| 6000 | + left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
| 6001 | + } |
| 6002 | + |
| 6003 | + prevComputedStyle = computedStyle; |
| 6004 | + } |
| 6005 | + |
| 6006 | + if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { |
| 6007 | + top += body.offsetTop; |
| 6008 | + left += body.offsetLeft; |
| 6009 | + } |
| 6010 | + |
| 6011 | + if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
| 6012 | + top += Math.max( docElem.scrollTop, body.scrollTop ); |
| 6013 | + left += Math.max( docElem.scrollLeft, body.scrollLeft ); |
| 6014 | + } |
| 6015 | + |
| 6016 | + return { top: top, left: left }; |
| 6017 | + }; |
| 6018 | +} |
| 6019 | + |
| 6020 | +jQuery.offset = { |
| 6021 | + initialize: function() { |
| 6022 | + var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0, |
| 6023 | + html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; |
| 6024 | + |
| 6025 | + jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); |
| 6026 | + |
| 6027 | + container.innerHTML = html; |
| 6028 | + body.insertBefore( container, body.firstChild ); |
| 6029 | + innerDiv = container.firstChild; |
| 6030 | + checkDiv = innerDiv.firstChild; |
| 6031 | + td = innerDiv.nextSibling.firstChild.firstChild; |
| 6032 | + |
| 6033 | + this.doesNotAddBorder = (checkDiv.offsetTop !== 5); |
| 6034 | + this.doesAddBorderForTableAndCells = (td.offsetTop === 5); |
| 6035 | + |
| 6036 | + checkDiv.style.position = "fixed", checkDiv.style.top = "20px"; |
| 6037 | + // safari subtracts parent border width here which is 5px |
| 6038 | + this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); |
| 6039 | + checkDiv.style.position = checkDiv.style.top = ""; |
| 6040 | + |
| 6041 | + innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative"; |
| 6042 | + this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
| 6043 | + |
| 6044 | + this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
| 6045 | + |
| 6046 | + body.removeChild( container ); |
| 6047 | + body = container = innerDiv = checkDiv = table = td = null; |
| 6048 | + jQuery.offset.initialize = jQuery.noop; |
| 6049 | + }, |
| 6050 | + |
| 6051 | + bodyOffset: function( body ) { |
| 6052 | + var top = body.offsetTop, left = body.offsetLeft; |
| 6053 | + |
| 6054 | + jQuery.offset.initialize(); |
| 6055 | + |
| 6056 | + if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { |
| 6057 | + top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0; |
| 6058 | + left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0; |
| 6059 | + } |
| 6060 | + |
| 6061 | + return { top: top, left: left }; |
| 6062 | + }, |
| 6063 | + |
| 6064 | + setOffset: function( elem, options, i ) { |
| 6065 | + // set position first, in-case top/left are set even on static elem |
| 6066 | + if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) { |
| 6067 | + elem.style.position = "relative"; |
| 6068 | + } |
| 6069 | + var curElem = jQuery( elem ), |
| 6070 | + curOffset = curElem.offset(), |
| 6071 | + curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0, |
| 6072 | + curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0; |
| 6073 | + |
| 6074 | + if ( jQuery.isFunction( options ) ) { |
| 6075 | + options = options.call( elem, i, curOffset ); |
| 6076 | + } |
| 6077 | + |
| 6078 | + var props = { |
| 6079 | + top: (options.top - curOffset.top) + curTop, |
| 6080 | + left: (options.left - curOffset.left) + curLeft |
| 6081 | + }; |
| 6082 | + |
| 6083 | + if ( "using" in options ) { |
| 6084 | + options.using.call( elem, props ); |
| 6085 | + } else { |
| 6086 | + curElem.css( props ); |
| 6087 | + } |
| 6088 | + } |
| 6089 | +}; |
| 6090 | + |
| 6091 | + |
| 6092 | +jQuery.fn.extend({ |
| 6093 | + position: function() { |
| 6094 | + if ( !this[0] ) { |
| 6095 | + return null; |
| 6096 | + } |
| 6097 | + |
| 6098 | + var elem = this[0], |
| 6099 | + |
| 6100 | + // Get *real* offsetParent |
| 6101 | + offsetParent = this.offsetParent(), |
| 6102 | + |
| 6103 | + // Get correct offsets |
| 6104 | + offset = this.offset(), |
| 6105 | + parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); |
| 6106 | + |
| 6107 | + // Subtract element margins |
| 6108 | + // note: when an element has margin: auto the offsetLeft and marginLeft |
| 6109 | + // are the same in Safari causing offset.left to incorrectly be 0 |
| 6110 | + offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0; |
| 6111 | + offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0; |
| 6112 | + |
| 6113 | + // Add offsetParent borders |
| 6114 | + parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0; |
| 6115 | + parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0; |
| 6116 | + |
| 6117 | + // Subtract the two offsets |
| 6118 | + return { |
| 6119 | + top: offset.top - parentOffset.top, |
| 6120 | + left: offset.left - parentOffset.left |
| 6121 | + }; |
| 6122 | + }, |
| 6123 | + |
| 6124 | + offsetParent: function() { |
| 6125 | + return this.map(function() { |
| 6126 | + var offsetParent = this.offsetParent || document.body; |
| 6127 | + while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { |
| 6128 | + offsetParent = offsetParent.offsetParent; |
| 6129 | + } |
| 6130 | + return offsetParent; |
| 6131 | + }); |
| 6132 | + } |
| 6133 | +}); |
| 6134 | + |
| 6135 | + |
| 6136 | +// Create scrollLeft and scrollTop methods |
| 6137 | +jQuery.each( ["Left", "Top"], function( i, name ) { |
| 6138 | + var method = "scroll" + name; |
| 6139 | + |
| 6140 | + jQuery.fn[ method ] = function(val) { |
| 6141 | + var elem = this[0], win; |
| 6142 | + |
| 6143 | + if ( !elem ) { |
| 6144 | + return null; |
| 6145 | + } |
| 6146 | + |
| 6147 | + if ( val !== undefined ) { |
| 6148 | + // Set the scroll offset |
| 6149 | + return this.each(function() { |
| 6150 | + win = getWindow( this ); |
| 6151 | + |
| 6152 | + if ( win ) { |
| 6153 | + win.scrollTo( |
| 6154 | + !i ? val : jQuery(win).scrollLeft(), |
| 6155 | + i ? val : jQuery(win).scrollTop() |
| 6156 | + ); |
| 6157 | + |
| 6158 | + } else { |
| 6159 | + this[ method ] = val; |
| 6160 | + } |
| 6161 | + }); |
| 6162 | + } else { |
| 6163 | + win = getWindow( elem ); |
| 6164 | + |
| 6165 | + // Return the scroll offset |
| 6166 | + return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : |
| 6167 | + jQuery.support.boxModel && win.document.documentElement[ method ] || |
| 6168 | + win.document.body[ method ] : |
| 6169 | + elem[ method ]; |
| 6170 | + } |
| 6171 | + }; |
| 6172 | +}); |
| 6173 | + |
| 6174 | +function getWindow( elem ) { |
| 6175 | + return ("scrollTo" in elem && elem.document) ? |
| 6176 | + elem : |
| 6177 | + elem.nodeType === 9 ? |
| 6178 | + elem.defaultView || elem.parentWindow : |
| 6179 | + false; |
| 6180 | +} |
| 6181 | +// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
| 6182 | +jQuery.each([ "Height", "Width" ], function( i, name ) { |
| 6183 | + |
| 6184 | + var type = name.toLowerCase(); |
| 6185 | + |
| 6186 | + // innerHeight and innerWidth |
| 6187 | + jQuery.fn["inner" + name] = function() { |
| 6188 | + return this[0] ? |
| 6189 | + jQuery.css( this[0], type, false, "padding" ) : |
| 6190 | + null; |
| 6191 | + }; |
| 6192 | + |
| 6193 | + // outerHeight and outerWidth |
| 6194 | + jQuery.fn["outer" + name] = function( margin ) { |
| 6195 | + return this[0] ? |
| 6196 | + jQuery.css( this[0], type, false, margin ? "margin" : "border" ) : |
| 6197 | + null; |
| 6198 | + }; |
| 6199 | + |
| 6200 | + jQuery.fn[ type ] = function( size ) { |
| 6201 | + // Get window width or height |
| 6202 | + var elem = this[0]; |
| 6203 | + if ( !elem ) { |
| 6204 | + return size == null ? null : this; |
| 6205 | + } |
| 6206 | + |
| 6207 | + if ( jQuery.isFunction( size ) ) { |
| 6208 | + return this.each(function( i ) { |
| 6209 | + var self = jQuery( this ); |
| 6210 | + self[ type ]( size.call( this, i, self[ type ]() ) ); |
| 6211 | + }); |
| 6212 | + } |
| 6213 | + |
| 6214 | + return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window? |
| 6215 | + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
| 6216 | + elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || |
| 6217 | + elem.document.body[ "client" + name ] : |
| 6218 | + |
| 6219 | + // Get document width or height |
| 6220 | + (elem.nodeType === 9) ? // is it a document |
| 6221 | + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
| 6222 | + Math.max( |
| 6223 | + elem.documentElement["client" + name], |
| 6224 | + elem.body["scroll" + name], elem.documentElement["scroll" + name], |
| 6225 | + elem.body["offset" + name], elem.documentElement["offset" + name] |
| 6226 | + ) : |
| 6227 | + |
| 6228 | + // Get or set width or height on the element |
| 6229 | + size === undefined ? |
| 6230 | + // Get width or height on the element |
| 6231 | + jQuery.css( elem, type ) : |
| 6232 | + |
| 6233 | + // Set the width or height on the element (default to pixels if value is unitless) |
| 6234 | + this.css( type, typeof size === "string" ? size : size + "px" ); |
| 6235 | + }; |
| 6236 | + |
| 6237 | +}); |
| 6238 | +// Expose jQuery to the global object |
| 6239 | +window.jQuery = window.$ = jQuery; |
| 6240 | + |
| 6241 | +})(window); |
Property changes on: branches/resourceloader/phase3/resources/base/jquery/jquery-1.4.2.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6242 | + native |
Index: branches/resourceloader/phase3/resources/base/mw/mw.util.js |
— | — | @@ -1,267 +0,0 @@ |
2 | | -/** |
3 | | - * General purpose utilities |
4 | | - */ |
5 | | - |
6 | | -window.mw.util = new ( function() { |
7 | | - |
8 | | - /* Private Members */ |
9 | | - |
10 | | - var that = this; |
11 | | - // Decoded user agent string cache |
12 | | - var client = null; |
13 | | - |
14 | | - /* Public Functions */ |
15 | | - |
16 | | - /** |
17 | | - * Builds a url string from an object containing any of the following components: |
18 | | - * |
19 | | - * Component Example |
20 | | - * scheme "http" |
21 | | - * server "www.domain.com" |
22 | | - * path "path/to/my/file.html" |
23 | | - * query "this=thåt" or { 'this': 'thåt' } |
24 | | - * fragment "place_on_the_page" |
25 | | - * |
26 | | - * Results in: "http://www.domain.com/path/to/my/file.html?this=th%C3%A5t#place_on_the_page" |
27 | | - * |
28 | | - * All arguments to this function are assumed to be URL-encoded already, except for the |
29 | | - * query parameter if provided in object form. |
30 | | - */ |
31 | | - this.buildUrlString = function( components ) { |
32 | | - var url = ''; |
33 | | - if ( typeof components.scheme === 'string' ) { |
34 | | - url += components.scheme + '://'; |
35 | | - } |
36 | | - if ( typeof components.server === 'string' ) { |
37 | | - url += components.server + '/'; |
38 | | - } |
39 | | - if ( typeof components.path === 'string' ) { |
40 | | - url += components.path; |
41 | | - } |
42 | | - if ( typeof components.query === 'string' ) { |
43 | | - url += '?' + components.query; |
44 | | - } else if ( typeof components.query === 'object' ) { |
45 | | - url += '?' + that.buildQueryString( components.query ); |
46 | | - } |
47 | | - if ( typeof components.fragment === 'string' ) { |
48 | | - url += '#' + components.fragment; |
49 | | - } |
50 | | - return url; |
51 | | - }; |
52 | | - /** |
53 | | - * RFC 3986 compliant URI component encoder - with identical behavior as PHP's urlencode function. Note: PHP's |
54 | | - * urlencode function prior to version 5.3 also escapes tildes, this does not. The naming here is not the same |
55 | | - * as PHP because PHP can't decide out to name things (underscores sometimes?), much less set a reasonable |
56 | | - * precedence for how things should be named in other environments. We use camelCase and action-subject here. |
57 | | - */ |
58 | | - this.encodeUrlComponent = function( string ) { |
59 | | - return encodeURIComponent( new String( string ) ) |
60 | | - .replace(/!/g, '%21') |
61 | | - .replace(/'/g, '%27') |
62 | | - .replace(/\(/g, '%28') |
63 | | - .replace(/\)/g, '%29') |
64 | | - .replace(/\*/g, '%2A') |
65 | | - .replace(/%20/g, '+'); |
66 | | - }; |
67 | | - /** |
68 | | - * Builds a query string from an object with key and values |
69 | | - */ |
70 | | - this.buildQueryString = function( parameters ) { |
71 | | - if ( typeof parameters === 'object' ) { |
72 | | - var parts = []; |
73 | | - for ( var p in parameters ) { |
74 | | - parts[parts.length] = that.encodeUrlComponent( p ) + '=' + that.encodeUrlComponent( parameters[p] ); |
75 | | - } |
76 | | - return parts.join( '&' ); |
77 | | - } |
78 | | - return ''; |
79 | | - }; |
80 | | - /** |
81 | | - * Returns an object containing information about the browser |
82 | | - * |
83 | | - * The resulting client object will be in the following format: |
84 | | - * { |
85 | | - * 'name': 'firefox', |
86 | | - * 'layout': 'gecko', |
87 | | - * 'os': 'linux' |
88 | | - * 'version': '3.5.1', |
89 | | - * 'versionBase': '3', |
90 | | - * 'versionNumber': 3.5, |
91 | | - * } |
92 | | - */ |
93 | | - this.client = function() { |
94 | | - // Use the cached version if possible |
95 | | - if ( client === null ) { |
96 | | - |
97 | | - /* Configuration */ |
98 | | - |
99 | | - // Name of browsers or layout engines we don't recognize |
100 | | - var uk = 'unknown'; |
101 | | - // Generic version digit |
102 | | - var x = 'x'; |
103 | | - // Strings found in user agent strings that need to be conformed |
104 | | - var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3']; |
105 | | - // Translations for conforming user agent strings |
106 | | - var userAgentTranslations = [ |
107 | | - // Tons of browsers lie about being something they are not |
108 | | - [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], |
109 | | - // Chrome lives in the shadow of Safari still |
110 | | - ['Chrome Safari', 'Chrome'], |
111 | | - // KHTML is the layout engine not the browser - LIES! |
112 | | - ['KHTML', 'Konqueror'], |
113 | | - // Firefox nightly builds |
114 | | - ['Minefield', 'Firefox'], |
115 | | - // This helps keep differnt versions consistent |
116 | | - ['Navigator', 'Netscape'], |
117 | | - // This prevents version extraction issues, otherwise translation would happen later |
118 | | - ['PLAYSTATION 3', 'PS3'], |
119 | | - ]; |
120 | | - // Strings which precede a version number in a user agent string - combined and used as match 1 in |
121 | | - // version detectection |
122 | | - var versionPrefixes = [ |
123 | | - 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx', |
124 | | - 'msie', 'safari', 'ps3' |
125 | | - ]; |
126 | | - // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number |
127 | | - var versionSuffix = '(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\\)|\s|$)'; |
128 | | - // Names of known browsers |
129 | | - var browserNames = [ |
130 | | - 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod', |
131 | | - 'iphone', 'blackberry', 'ps3' |
132 | | - ]; |
133 | | - // Tanslations for conforming browser names |
134 | | - var browserTranslations = []; |
135 | | - // Names of known layout engines |
136 | | - var layoutNames = ['gecko', 'konqueror', 'msie', 'opera', 'webkit']; |
137 | | - // Translations for conforming layout names |
138 | | - var layoutTranslations = [['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto']]; |
139 | | - // Names of known operating systems |
140 | | - var osNames = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone']; |
141 | | - // Translations for conforming operating system names |
142 | | - var osTranslations = [['sunos', 'solaris']]; |
143 | | - |
144 | | - /* Functions */ |
145 | | - |
146 | | - // Performs multiple replacements on a string |
147 | | - function translate( source, translations ) { |
148 | | - for ( var i = 0; i < translations.length; i++ ) { |
149 | | - source = source.replace( translations[i][0], translations[i][1] ); |
150 | | - } |
151 | | - return source; |
152 | | - }; |
153 | | - |
154 | | - /* Pre-processing */ |
155 | | - |
156 | | - var userAgent = navigator.userAgent, match, browser = uk, layout = uk, os = uk, version = x; |
157 | | - if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( userAgent ) ) { |
158 | | - // Takes a userAgent string and translates given text into something we can more easily work with |
159 | | - userAgent = translate( userAgent, userAgentTranslations ); |
160 | | - } |
161 | | - // Everything will be in lowercase from now on |
162 | | - userAgent = userAgent.toLowerCase(); |
163 | | - |
164 | | - /* Extraction */ |
165 | | - |
166 | | - if ( match = new RegExp( '(' + browserNames.join( '|' ) + ')' ).exec( userAgent ) ) { |
167 | | - browser = translate( match[1], browserTranslations ); |
168 | | - } |
169 | | - if ( match = new RegExp( '(' + layoutNames.join( '|' ) + ')' ).exec( userAgent ) ) { |
170 | | - layout = translate( match[1], layoutTranslations ); |
171 | | - } |
172 | | - if ( match = new RegExp( '(' + osNames.join( '|' ) + ')' ).exec( navigator.platform.toLowerCase() ) ) { |
173 | | - var os = translate( match[1], osTranslations ); |
174 | | - } |
175 | | - if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( userAgent ) ) { |
176 | | - version = match[3]; |
177 | | - } |
178 | | - |
179 | | - /* Edge Cases -- did I mention about how user agent string lie? */ |
180 | | - |
181 | | - // Decode Safari's crazy 400+ version numbers |
182 | | - if ( name.match( /safari/ ) && version > 400 ) { |
183 | | - version = '2.0'; |
184 | | - } |
185 | | - // Expose Opera 10's lies about being Opera 9.8 |
186 | | - if ( name === 'opera' && version >= 9.8) { |
187 | | - version = userAgent.match( /version\/([0-9\.]*)/i )[1] || 10; |
188 | | - } |
189 | | - |
190 | | - /* Caching */ |
191 | | - |
192 | | - client = { |
193 | | - 'browser': browser, |
194 | | - 'layout': layout, |
195 | | - 'os': os, |
196 | | - 'version': version, |
197 | | - 'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ), |
198 | | - 'versionNumber': ( parseFloat( version, 10 ) || 0.0 ) |
199 | | - }; |
200 | | - } |
201 | | - return client; |
202 | | - }; |
203 | | - /** |
204 | | - * Checks the current browser against a support map object to determine if the browser has been black-listed or |
205 | | - * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body |
206 | | - * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed. |
207 | | - * |
208 | | - * A browser map is in the following format: |
209 | | - * { |
210 | | - * 'ltr': { |
211 | | - * // Multiple rules with configurable operators |
212 | | - * 'msie': [['>=', 7], ['!=', 9]], |
213 | | - * // Blocked entirely |
214 | | - * 'iphone': false |
215 | | - * }, |
216 | | - * 'rtl': { |
217 | | - * // Test against a string |
218 | | - * 'msie': [['!==', '8.1.2.3']], |
219 | | - * // RTL rules do not fall through to LTR rules, you must explicity set each of them |
220 | | - * 'iphone': false |
221 | | - * } |
222 | | - * } |
223 | | - * |
224 | | - * @param map Object of browser support map |
225 | | - * |
226 | | - * @return Boolean true if browser known or assumed to be supported, false if blacklisted |
227 | | - */ |
228 | | - this.testClient = function( map ) { |
229 | | - var client = this.client(); |
230 | | - // Check over each browser condition to determine if we are running in a compatible client |
231 | | - var browser = map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][client.browser]; |
232 | | - if ( typeof browser !== 'object' ) { |
233 | | - // Unknown, so we assume it's working |
234 | | - return true; |
235 | | - } |
236 | | - for ( var condition in browser ) { |
237 | | - var op = browser[condition][0]; |
238 | | - var val = browser[condition][1]; |
239 | | - if ( val === false ) { |
240 | | - return false; |
241 | | - } else if ( typeof val == 'string' ) { |
242 | | - if ( !( eval( 'client.version' + op + '"' + val + '"' ) ) ) { |
243 | | - return false; |
244 | | - } |
245 | | - } else if ( typeof val == 'number' ) { |
246 | | - if ( !( eval( 'client.versionNumber' + op + val ) ) ) { |
247 | | - return false; |
248 | | - } |
249 | | - } |
250 | | - } |
251 | | - return true; |
252 | | - }; |
253 | | - /** |
254 | | - * Finds the highest tabindex in use. |
255 | | - * |
256 | | - * @return Integer of highest tabindex on the page |
257 | | - */ |
258 | | - this.getMaxTabIndex = function() { |
259 | | - var maxTI = 0; |
260 | | - $( '[tabindex]' ).each( function() { |
261 | | - var ti = parseInt( $(this).attr( 'tabindex' ) ); |
262 | | - if ( ti > maxTI ) { |
263 | | - maxTI = ti; |
264 | | - } |
265 | | - } ); |
266 | | - return maxTI; |
267 | | - }; |
268 | | -} )(); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/base/mw/mw.js |
— | — | @@ -0,0 +1,742 @@ |
| 2 | +/* |
| 3 | + * JavaScript Backwards Compatibility |
| 4 | + */ |
| 5 | + |
| 6 | +// Make calling .indexOf() on an array work on older browsers |
| 7 | +if ( typeof Array.prototype.indexOf === 'undefined' ) { |
| 8 | + Array.prototype.indexOf = function( needle ) { |
| 9 | + for ( var i = 0; i < this.length; i++ ) { |
| 10 | + if ( this[i] === needle ) { |
| 11 | + return i; |
| 12 | + } |
| 13 | + } |
| 14 | + return -1; |
| 15 | + }; |
| 16 | +} |
| 17 | + |
| 18 | +/* |
| 19 | + * Core MediaWiki JavaScript Library |
| 20 | + */ |
| 21 | +( function() { |
| 22 | + |
| 23 | + /* Functions */ |
| 24 | + |
| 25 | + /** |
| 26 | + * Log a string msg to the console |
| 27 | + * |
| 28 | + * All mw.log statements will be removed on minification so lots of mw.log calls will not impact performance in non-debug |
| 29 | + * mode. This is done using simple regular expressions, so the input of this function needs to not contain things like a |
| 30 | + * self-executing closure. In the case that the browser does not have a console available, one is created by appending a |
| 31 | + * <div> element to the bottom of the body and then appending a <div> element to that for each message. In the case that |
| 32 | + * the browser does have a console available |
| 33 | + * |
| 34 | + * @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org> |
| 35 | + * @param {String} string String to output to console |
| 36 | + */ |
| 37 | + this.log = function( string ) { |
| 38 | + // Allow log messages to use a configured prefix |
| 39 | + if ( mw.config.exists( 'mw.log.prefix' ) ) { |
| 40 | + string = mw.config.get( 'mw.log.prefix' ) + string; |
| 41 | + } |
| 42 | + // Try to use an existing console |
| 43 | + if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) { |
| 44 | + window.console.log( string ); |
| 45 | + } else { |
| 46 | + // Show a log box for console-less browsers |
| 47 | + var $log = $( '#mw_log_console' ); |
| 48 | + if ( !$log.length ) { |
| 49 | + $log = $( '<div id="mw_log_console"></div>' ) |
| 50 | + .css( { |
| 51 | + 'position': 'absolute', |
| 52 | + 'overflow': 'auto', |
| 53 | + 'z-index': 500, |
| 54 | + 'bottom': '0px', |
| 55 | + 'left': '0px', |
| 56 | + 'right': '0px', |
| 57 | + 'height': '150px', |
| 58 | + 'background-color': 'white', |
| 59 | + 'border-top': 'solid 1px #DDDDDD' |
| 60 | + } ) |
| 61 | + .appendTo( $( 'body' ) ); |
| 62 | + } |
| 63 | + if ( $log.length ) { |
| 64 | + $log.append( |
| 65 | + $( '<div>' + string + '</div>' ) |
| 66 | + .css( { |
| 67 | + 'border-bottom': 'solid 1px #DDDDDD', |
| 68 | + 'font-size': 'small', |
| 69 | + 'font-family': 'monospace', |
| 70 | + 'padding': '0.125em 0.25em' |
| 71 | + } ) |
| 72 | + ); |
| 73 | + } |
| 74 | + } |
| 75 | + }; |
| 76 | + /* |
| 77 | + * An object which allows single and multiple existence, setting and getting on a list of key / value pairs |
| 78 | + */ |
| 79 | + this.config = new ( function() { |
| 80 | + |
| 81 | + /* Private Members */ |
| 82 | + |
| 83 | + var that = this; |
| 84 | + // List of configuration values |
| 85 | + var values = {}; |
| 86 | + |
| 87 | + /* Public Functions */ |
| 88 | + |
| 89 | + /** |
| 90 | + * Sets one or multiple configuration values using a key and a value or an object of keys and values |
| 91 | + */ |
| 92 | + this.set = function( keys, value ) { |
| 93 | + if ( typeof keys === 'object' ) { |
| 94 | + for ( var key in keys ) { |
| 95 | + values[key] = keys[key]; |
| 96 | + } |
| 97 | + } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { |
| 98 | + values[keys] = value; |
| 99 | + } |
| 100 | + }; |
| 101 | + /** |
| 102 | + * Gets one or multiple configuration values using a key and an optional fallback or an array of keys |
| 103 | + */ |
| 104 | + this.get = function( keys, fallback ) { |
| 105 | + if ( typeof keys === 'object' ) { |
| 106 | + var result = {}; |
| 107 | + for ( var k = 0; k < keys.length; k++ ) { |
| 108 | + if ( typeof values[keys[k]] !== 'undefined' ) { |
| 109 | + result[keys[k]] = values[keys[k]]; |
| 110 | + } |
| 111 | + } |
| 112 | + return result; |
| 113 | + } else if ( typeof values[keys] === 'undefined' ) { |
| 114 | + return typeof fallback !== 'undefined' ? fallback : null; |
| 115 | + } else { |
| 116 | + return values[keys]; |
| 117 | + } |
| 118 | + }; |
| 119 | + /** |
| 120 | + * Checks if one or multiple configuration fields exist |
| 121 | + */ |
| 122 | + this.exists = function( keys ) { |
| 123 | + if ( typeof keys === 'object' ) { |
| 124 | + for ( var k = 0; k < keys.length; k++ ) { |
| 125 | + if ( !( keys[k] in values ) ) { |
| 126 | + return false; |
| 127 | + } |
| 128 | + } |
| 129 | + return true; |
| 130 | + } else { |
| 131 | + return keys in values; |
| 132 | + } |
| 133 | + }; |
| 134 | + } )(); |
| 135 | + /* |
| 136 | + * Localization system |
| 137 | + */ |
| 138 | + this.msg = new ( function() { |
| 139 | + |
| 140 | + /* Private Members */ |
| 141 | + |
| 142 | + var that = this; |
| 143 | + // List of localized messages |
| 144 | + var messages = {}; |
| 145 | + |
| 146 | + /* Public Functions */ |
| 147 | + |
| 148 | + this.set = function( keys, value ) { |
| 149 | + if ( typeof keys === 'object' ) { |
| 150 | + for ( var key in keys ) { |
| 151 | + messages[key] = keys[key]; |
| 152 | + } |
| 153 | + } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { |
| 154 | + messages[keys] = value; |
| 155 | + } |
| 156 | + }; |
| 157 | + this.get = function( key, args ) { |
| 158 | + if ( !( key in messages ) ) { |
| 159 | + return '<' + key + '>'; |
| 160 | + } |
| 161 | + var msg = messages[key]; |
| 162 | + if ( typeof args == 'object' || typeof args == 'array' ) { |
| 163 | + for ( var argKey in args ) { |
| 164 | + msg = msg.replace( '\$' + ( parseInt( argKey ) + 1 ), args[argKey] ); |
| 165 | + } |
| 166 | + } else if ( typeof args == 'string' || typeof args == 'number' ) { |
| 167 | + msg = msg.replace( '$1', args ); |
| 168 | + } |
| 169 | + return msg; |
| 170 | + }; |
| 171 | + } )(); |
| 172 | + /* |
| 173 | + * Client-side module loader which integrates with the MediaWiki ResourceLoader |
| 174 | + */ |
| 175 | + this.loader = new ( function() { |
| 176 | + |
| 177 | + /* Private Members */ |
| 178 | + |
| 179 | + var that = this; |
| 180 | + var server = 'load.php'; |
| 181 | + /* |
| 182 | + * Mapping of registered modules |
| 183 | + * |
| 184 | + * Format: |
| 185 | + * { |
| 186 | + * 'moduleName': { |
| 187 | + * 'needs': ['required module', 'required module', ...], |
| 188 | + * 'state': 'registered, loading, loaded, or ready', |
| 189 | + * 'script': function() {}, |
| 190 | + * 'style': 'css code string', |
| 191 | + * 'localization': { 'key': 'value' } |
| 192 | + * } |
| 193 | + * } |
| 194 | + */ |
| 195 | + var registry = {}; |
| 196 | + // List of callbacks waiting on dependent modules to be loaded so they can be executed |
| 197 | + var queue = []; |
| 198 | + // Until document ready, load requests will be collected in a batch queue |
| 199 | + var batch = []; |
| 200 | + // True after document ready occurs |
| 201 | + var ready = false; |
| 202 | + |
| 203 | + /* Private Functions */ |
| 204 | + |
| 205 | + /** |
| 206 | + * Gets a list of modules names that a module needs in their proper dependency order |
| 207 | + * |
| 208 | + * @param string module name |
| 209 | + * @return |
| 210 | + * @throws Error if circular reference is detected |
| 211 | + */ |
| 212 | + function needs( module ) { |
| 213 | + if ( !( module in registry ) ) { |
| 214 | + // Undefined modules have no needs |
| 215 | + return []; |
| 216 | + } |
| 217 | + var resolved = []; |
| 218 | + var unresolved = []; |
| 219 | + if ( arguments.length === 3 ) { |
| 220 | + // Use arguemnts on inner call |
| 221 | + resolved = arguments[1]; |
| 222 | + unresolved = arguments[2]; |
| 223 | + } |
| 224 | + unresolved[unresolved.length] = module; |
| 225 | + for ( n in registry[module].needs ) { |
| 226 | + if ( resolved.indexOf( registry[module].needs[n] ) === -1 ) { |
| 227 | + if ( unresolved.indexOf( registry[module].needs[n] ) !== -1 ) { |
| 228 | + throw new Error( |
| 229 | + 'Circular reference detected: ' + module + ' -> ' + registry[module].needs[n] |
| 230 | + ); |
| 231 | + } |
| 232 | + needs( registry[module].needs[n], resolved, unresolved ); |
| 233 | + } |
| 234 | + } |
| 235 | + resolved[resolved.length] = module; |
| 236 | + unresolved.slice( unresolved.indexOf( module ), 1 ); |
| 237 | + if ( arguments.length === 1 ) { |
| 238 | + // Return resolved list on outer call |
| 239 | + return resolved; |
| 240 | + } |
| 241 | + }; |
| 242 | + /** |
| 243 | + * Narrows a list of module names down to those matching a specific state. Possible states are 'undefined', |
| 244 | + * 'registered', 'loading', 'loaded', or 'ready' |
| 245 | + * |
| 246 | + * @param mixed string or array of strings of module states to filter by |
| 247 | + * @param array list of module names to filter (optional, all modules will be used by default) |
| 248 | + * @return array list of filtered module names |
| 249 | + */ |
| 250 | + function filter( states, modules ) { |
| 251 | + var list = []; |
| 252 | + if ( typeof modules === 'undefined' ) { |
| 253 | + modules = []; |
| 254 | + for ( module in registry ) { |
| 255 | + modules[modules.length] = module; |
| 256 | + } |
| 257 | + } |
| 258 | + for ( var s in states ) { |
| 259 | + for ( var m in modules ) { |
| 260 | + if ( |
| 261 | + ( states[s] == 'undefined' && typeof registry[modules[m]] === 'undefined' ) || |
| 262 | + ( typeof registry[modules[m]] === 'object' && registry[modules[m]].state === states[s] ) |
| 263 | + ) { |
| 264 | + list[list.length] = modules[m]; |
| 265 | + } |
| 266 | + } |
| 267 | + } |
| 268 | + return list; |
| 269 | + } |
| 270 | + /** |
| 271 | + * Executes a loaded module, making it ready to use |
| 272 | + * |
| 273 | + * @param string module name to execute |
| 274 | + */ |
| 275 | + function execute( module ) { |
| 276 | + if ( typeof registry[module] === 'undefined' ) { |
| 277 | + throw new Error( 'module has not been registered: ' + module ); |
| 278 | + } |
| 279 | + switch ( registry[module].state ) { |
| 280 | + case 'registered': |
| 281 | + throw new Error( 'module has not completed loading: ' + module ); |
| 282 | + break; |
| 283 | + case 'loading': |
| 284 | + throw new Error( 'module has not completed loading: ' + module ); |
| 285 | + break; |
| 286 | + case 'ready': |
| 287 | + throw new Error( 'module has already been loaded: ' + module ); |
| 288 | + break; |
| 289 | + } |
| 290 | + // Add style sheet to document |
| 291 | + if ( typeof registry[module].style === 'string' && registry[module].style.length ) { |
| 292 | + $( 'head' ).append( '<style type="text/css">' + registry[module].style + '</style>' ); |
| 293 | + } |
| 294 | + // Add localizations to message system |
| 295 | + if ( typeof registry[module].localization === 'object' ) { |
| 296 | + mw.msg.set( registry[module].localization ); |
| 297 | + } |
| 298 | + // Execute script |
| 299 | + try { |
| 300 | + registry[module].script(); |
| 301 | + } catch( e ) { |
| 302 | + mw.log( 'Exception thrown by ' + module + ': ' + e.message ); |
| 303 | + } |
| 304 | + // Change state |
| 305 | + registry[module].state = 'ready'; |
| 306 | + |
| 307 | + // Execute all modules which were waiting for this to be ready |
| 308 | + for ( r in registry ) { |
| 309 | + if ( registry[r].state == 'loaded' ) { |
| 310 | + if ( filter( ['ready'], registry[r].needs ).length == registry[r].needs.length ) { |
| 311 | + execute( r ); |
| 312 | + } |
| 313 | + } |
| 314 | + } |
| 315 | + } |
| 316 | + /** |
| 317 | + * Adds a callback and it's needs to the queue |
| 318 | + * |
| 319 | + * @param array list of module names the callback needs to be ready before being executed |
| 320 | + * @param function callback to execute when needs are met |
| 321 | + */ |
| 322 | + function request( needs, callback ) { |
| 323 | + queue[queue.length] = { 'needs': filter( ['undefined', 'registered'], needs ), 'callback': callback }; |
| 324 | + } |
| 325 | + |
| 326 | + /* Public Functions */ |
| 327 | + |
| 328 | + /** |
| 329 | + * Processes the queue, loading and executing when things when ready. |
| 330 | + */ |
| 331 | + this.work = function() { |
| 332 | + // Appends a list of modules to the batch |
| 333 | + function append( modules ) { |
| 334 | + for ( m in modules ) { |
| 335 | + // Prevent requesting modules which are loading, loaded or ready |
| 336 | + if ( modules[m] in registry && registry[modules[m]].state == 'registered' ) { |
| 337 | + // Since the batch can live between calls to work until document ready, we need to make sure |
| 338 | + // we aren't making a duplicate entry |
| 339 | + if ( batch.indexOf( modules[m] ) == -1 ) { |
| 340 | + batch[batch.length] = modules[m]; |
| 341 | + registry[modules[m]].state = 'loading'; |
| 342 | + } |
| 343 | + } |
| 344 | + } |
| 345 | + } |
| 346 | + // Fill batch with modules that need to be loaded |
| 347 | + for ( var q in queue ) { |
| 348 | + append( queue[q].needs ); |
| 349 | + for ( n in queue[q].needs ) { |
| 350 | + append( needs( queue[q].needs[n] ) ); |
| 351 | + } |
| 352 | + } |
| 353 | + // After document ready, handle the batch |
| 354 | + if ( ready && batch.length ) { |
| 355 | + // Always order modules alphabetically to help reduce cache misses for otherwise identical content |
| 356 | + batch.sort(); |
| 357 | + |
| 358 | + var base = $.extend( {}, |
| 359 | + // Pass configuration values through the URL |
| 360 | + mw.config.get( [ 'user', 'skin', 'space', 'view', 'language' ] ), |
| 361 | + // Ensure request comes back in the proper mode (debug or not) |
| 362 | + { 'debug': typeof mw.debug !== 'undefined' ? '1' : '0' } |
| 363 | + ); |
| 364 | + var requests = []; |
| 365 | + if ( base.debug == '1' ) { |
| 366 | + for ( b in batch ) { |
| 367 | + requests[requests.length] = $.extend( { 'modules': batch[b] }, base ); |
| 368 | + } |
| 369 | + } else { |
| 370 | + requests[requests.length] = $.extend( { 'modules': batch.join( '|' ) }, base ); |
| 371 | + } |
| 372 | + // It may be more performant to do this with an Ajax call, but that's limited to same-domain, so we |
| 373 | + // can either auto-detect (if there really is any benefit) or just use this method, which is safe |
| 374 | + setTimeout( function() { |
| 375 | + // Clear the batch - this MUST happen before we append the script element to the body or it's |
| 376 | + // possible that the script will be locally cached, instantly load, and work the batch again, |
| 377 | + // all before we've cleared it causing each request to include modules which are already loaded |
| 378 | + batch = []; |
| 379 | + var html = ''; |
| 380 | + for ( r in requests ) { |
| 381 | + // Build out the HTML |
| 382 | + var src = mw.util.buildUrlString( { |
| 383 | + 'path': mw.config.get( 'wgScriptPath' ) + '/load.php', |
| 384 | + 'query': requests[r] |
| 385 | + } ); |
| 386 | + html += '<script type="text/javascript" src="' + src + '"></script>'; |
| 387 | + } |
| 388 | + // Append script to head |
| 389 | + $( 'head' ).append( html ); |
| 390 | + }, 0 ) |
| 391 | + } |
| 392 | + }; |
| 393 | + /** |
| 394 | + * Registers a module, letting the system know about it and it's dependencies. loader.js files contain calls |
| 395 | + * to this function. |
| 396 | + */ |
| 397 | + this.register = function( name, needs ) { |
| 398 | + // Validate input |
| 399 | + if ( typeof name !== 'string' ) { |
| 400 | + throw new Error( 'name must be a string, not a ' + typeof name ); |
| 401 | + } |
| 402 | + if ( typeof registry[name] !== 'undefined' ) { |
| 403 | + throw new Error( 'module already implemeneted: ' + name ); |
| 404 | + } |
| 405 | + // List the module as registered |
| 406 | + registry[name] = { 'state': 'registered', 'needs': [] }; |
| 407 | + // Allow needs to be given as a function which returns a string or array |
| 408 | + if ( typeof needs === 'function' ) { |
| 409 | + needs = needs(); |
| 410 | + } |
| 411 | + if ( typeof needs === 'string' ) { |
| 412 | + // Allow needs to be given as a single module name |
| 413 | + registry[name].needs = [needs]; |
| 414 | + } else if ( typeof needs === 'object' ) { |
| 415 | + // Allow needs to be given as an array of module names |
| 416 | + registry[name].needs = needs; |
| 417 | + } |
| 418 | + }; |
| 419 | + /** |
| 420 | + * Implements a module, giving the system a course of action to take upon loading. Results of a request for |
| 421 | + * one or more modules contain calls to this function. |
| 422 | + */ |
| 423 | + this.implement = function( name, script, style, localization ) { |
| 424 | + // Automaically register module |
| 425 | + if ( typeof registry[name] === 'undefined' ) { |
| 426 | + that.register( name, needs ); |
| 427 | + } |
| 428 | + // Validate input |
| 429 | + if ( typeof script !== 'function' ) { |
| 430 | + throw new Error( 'script must be a function, not a ' + typeof script ); |
| 431 | + } |
| 432 | + if ( typeof style !== 'undefined' && typeof style !== 'string' ) { |
| 433 | + throw new Error( 'style must be a string, not a ' + typeof style ); |
| 434 | + } |
| 435 | + if ( typeof localization !== 'undefined' && typeof localization !== 'object' ) { |
| 436 | + throw new Error( 'localization must be an object, not a ' + typeof localization ); |
| 437 | + } |
| 438 | + if ( typeof registry[name] !== 'undefined' && typeof registry[name].script !== 'undefined' ) { |
| 439 | + throw new Error( 'module already implemeneted: ' + name ); |
| 440 | + } |
| 441 | + // Mark module as loaded |
| 442 | + registry[name].state = 'loaded'; |
| 443 | + // Attach components |
| 444 | + registry[name].script = script; |
| 445 | + if ( typeof style === 'string' ) { |
| 446 | + registry[name].style = style; |
| 447 | + } |
| 448 | + if ( typeof localization === 'object' ) { |
| 449 | + registry[name].localization = localization; |
| 450 | + } |
| 451 | + // Execute or queue callback |
| 452 | + if ( filter( ['ready'], registry[name].needs ).length == registry[name].needs.length ) { |
| 453 | + execute( name ); |
| 454 | + } else { |
| 455 | + request( registry[name].needs, function() { execute( name ); } ); |
| 456 | + } |
| 457 | + }; |
| 458 | + /** |
| 459 | + * Executes a function as soon as one or more required modules are ready |
| 460 | + * |
| 461 | + * @param mixed string or array of strings of modules names the callback needs to be ready before executing |
| 462 | + * @param function callback to execute when all needs are met |
| 463 | + */ |
| 464 | + this.using = function( needs, callback ) { |
| 465 | + // Validate input |
| 466 | + if ( typeof needs !== 'object' && typeof needs !== 'string' ) { |
| 467 | + throw new Error( 'needs must be a string or an array, not a ' + typeof needs ) |
| 468 | + } |
| 469 | + if ( typeof callback !== 'function' ) { |
| 470 | + throw new Error( 'callback must be a function, not a ' + typeof callback ) |
| 471 | + } |
| 472 | + if ( typeof needs === 'string' ) { |
| 473 | + needs = [needs]; |
| 474 | + } |
| 475 | + // Execute or queue callback |
| 476 | + if ( filter( ['ready'], needs ).length == needs.length ) { |
| 477 | + callback(); |
| 478 | + } else { |
| 479 | + request( needs, callback ); |
| 480 | + } |
| 481 | + }; |
| 482 | + |
| 483 | + /* Event Bindings */ |
| 484 | + |
| 485 | + $( document ).ready( function() { |
| 486 | + ready = true; |
| 487 | + that.work(); |
| 488 | + } ); |
| 489 | + } )(); |
| 490 | + /** |
| 491 | + * General purpose utilities |
| 492 | + */ |
| 493 | + this.util = new ( function() { |
| 494 | + |
| 495 | + /* Private Members */ |
| 496 | + |
| 497 | + var that = this; |
| 498 | + // Decoded user agent string cache |
| 499 | + var client = null; |
| 500 | + |
| 501 | + /* Public Functions */ |
| 502 | + |
| 503 | + /** |
| 504 | + * Builds a url string from an object containing any of the following components: |
| 505 | + * |
| 506 | + * Component Example |
| 507 | + * scheme "http" |
| 508 | + * server "www.domain.com" |
| 509 | + * path "path/to/my/file.html" |
| 510 | + * query "this=thåt" or { 'this': 'thåt' } |
| 511 | + * fragment "place_on_the_page" |
| 512 | + * |
| 513 | + * Results in: "http://www.domain.com/path/to/my/file.html?this=th%C3%A5t#place_on_the_page" |
| 514 | + * |
| 515 | + * All arguments to this function are assumed to be URL-encoded already, except for the |
| 516 | + * query parameter if provided in object form. |
| 517 | + */ |
| 518 | + this.buildUrlString = function( components ) { |
| 519 | + var url = ''; |
| 520 | + if ( typeof components.scheme === 'string' ) { |
| 521 | + url += components.scheme + '://'; |
| 522 | + } |
| 523 | + if ( typeof components.server === 'string' ) { |
| 524 | + url += components.server + '/'; |
| 525 | + } |
| 526 | + if ( typeof components.path === 'string' ) { |
| 527 | + url += components.path; |
| 528 | + } |
| 529 | + if ( typeof components.query === 'string' ) { |
| 530 | + url += '?' + components.query; |
| 531 | + } else if ( typeof components.query === 'object' ) { |
| 532 | + url += '?' + that.buildQueryString( components.query ); |
| 533 | + } |
| 534 | + if ( typeof components.fragment === 'string' ) { |
| 535 | + url += '#' + components.fragment; |
| 536 | + } |
| 537 | + return url; |
| 538 | + }; |
| 539 | + /** |
| 540 | + * RFC 3986 compliant URI component encoder - with identical behavior as PHP's urlencode function. Note: PHP's |
| 541 | + * urlencode function prior to version 5.3 also escapes tildes, this does not. The naming here is not the same |
| 542 | + * as PHP because PHP can't decide out to name things (underscores sometimes?), much less set a reasonable |
| 543 | + * precedence for how things should be named in other environments. We use camelCase and action-subject here. |
| 544 | + */ |
| 545 | + this.encodeUrlComponent = function( string ) { |
| 546 | + return encodeURIComponent( new String( string ) ) |
| 547 | + .replace(/!/g, '%21') |
| 548 | + .replace(/'/g, '%27') |
| 549 | + .replace(/\(/g, '%28') |
| 550 | + .replace(/\)/g, '%29') |
| 551 | + .replace(/\*/g, '%2A') |
| 552 | + .replace(/%20/g, '+'); |
| 553 | + }; |
| 554 | + /** |
| 555 | + * Builds a query string from an object with key and values |
| 556 | + */ |
| 557 | + this.buildQueryString = function( parameters ) { |
| 558 | + if ( typeof parameters === 'object' ) { |
| 559 | + var parts = []; |
| 560 | + for ( var p in parameters ) { |
| 561 | + parts[parts.length] = that.encodeUrlComponent( p ) + '=' + that.encodeUrlComponent( parameters[p] ); |
| 562 | + } |
| 563 | + return parts.join( '&' ); |
| 564 | + } |
| 565 | + return ''; |
| 566 | + }; |
| 567 | + /** |
| 568 | + * Returns an object containing information about the browser |
| 569 | + * |
| 570 | + * The resulting client object will be in the following format: |
| 571 | + * { |
| 572 | + * 'name': 'firefox', |
| 573 | + * 'layout': 'gecko', |
| 574 | + * 'os': 'linux' |
| 575 | + * 'version': '3.5.1', |
| 576 | + * 'versionBase': '3', |
| 577 | + * 'versionNumber': 3.5, |
| 578 | + * } |
| 579 | + */ |
| 580 | + this.client = function() { |
| 581 | + // Use the cached version if possible |
| 582 | + if ( client === null ) { |
| 583 | + |
| 584 | + /* Configuration */ |
| 585 | + |
| 586 | + // Name of browsers or layout engines we don't recognize |
| 587 | + var uk = 'unknown'; |
| 588 | + // Generic version digit |
| 589 | + var x = 'x'; |
| 590 | + // Strings found in user agent strings that need to be conformed |
| 591 | + var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3']; |
| 592 | + // Translations for conforming user agent strings |
| 593 | + var userAgentTranslations = [ |
| 594 | + // Tons of browsers lie about being something they are not |
| 595 | + [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], |
| 596 | + // Chrome lives in the shadow of Safari still |
| 597 | + ['Chrome Safari', 'Chrome'], |
| 598 | + // KHTML is the layout engine not the browser - LIES! |
| 599 | + ['KHTML', 'Konqueror'], |
| 600 | + // Firefox nightly builds |
| 601 | + ['Minefield', 'Firefox'], |
| 602 | + // This helps keep differnt versions consistent |
| 603 | + ['Navigator', 'Netscape'], |
| 604 | + // This prevents version extraction issues, otherwise translation would happen later |
| 605 | + ['PLAYSTATION 3', 'PS3'], |
| 606 | + ]; |
| 607 | + // Strings which precede a version number in a user agent string - combined and used as match 1 in |
| 608 | + // version detectection |
| 609 | + var versionPrefixes = [ |
| 610 | + 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx', |
| 611 | + 'msie', 'safari', 'ps3' |
| 612 | + ]; |
| 613 | + // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number |
| 614 | + var versionSuffix = '(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\\)|\s|$)'; |
| 615 | + // Names of known browsers |
| 616 | + var browserNames = [ |
| 617 | + 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod', |
| 618 | + 'iphone', 'blackberry', 'ps3' |
| 619 | + ]; |
| 620 | + // Tanslations for conforming browser names |
| 621 | + var browserTranslations = []; |
| 622 | + // Names of known layout engines |
| 623 | + var layoutNames = ['gecko', 'konqueror', 'msie', 'opera', 'webkit']; |
| 624 | + // Translations for conforming layout names |
| 625 | + var layoutTranslations = [['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto']]; |
| 626 | + // Names of known operating systems |
| 627 | + var osNames = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone']; |
| 628 | + // Translations for conforming operating system names |
| 629 | + var osTranslations = [['sunos', 'solaris']]; |
| 630 | + |
| 631 | + /* Functions */ |
| 632 | + |
| 633 | + // Performs multiple replacements on a string |
| 634 | + function translate( source, translations ) { |
| 635 | + for ( var i = 0; i < translations.length; i++ ) { |
| 636 | + source = source.replace( translations[i][0], translations[i][1] ); |
| 637 | + } |
| 638 | + return source; |
| 639 | + }; |
| 640 | + |
| 641 | + /* Pre-processing */ |
| 642 | + |
| 643 | + var userAgent = navigator.userAgent, match, browser = uk, layout = uk, os = uk, version = x; |
| 644 | + if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( userAgent ) ) { |
| 645 | + // Takes a userAgent string and translates given text into something we can more easily work with |
| 646 | + userAgent = translate( userAgent, userAgentTranslations ); |
| 647 | + } |
| 648 | + // Everything will be in lowercase from now on |
| 649 | + userAgent = userAgent.toLowerCase(); |
| 650 | + |
| 651 | + /* Extraction */ |
| 652 | + |
| 653 | + if ( match = new RegExp( '(' + browserNames.join( '|' ) + ')' ).exec( userAgent ) ) { |
| 654 | + browser = translate( match[1], browserTranslations ); |
| 655 | + } |
| 656 | + if ( match = new RegExp( '(' + layoutNames.join( '|' ) + ')' ).exec( userAgent ) ) { |
| 657 | + layout = translate( match[1], layoutTranslations ); |
| 658 | + } |
| 659 | + if ( match = new RegExp( '(' + osNames.join( '|' ) + ')' ).exec( navigator.platform.toLowerCase() ) ) { |
| 660 | + var os = translate( match[1], osTranslations ); |
| 661 | + } |
| 662 | + if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( userAgent ) ) { |
| 663 | + version = match[3]; |
| 664 | + } |
| 665 | + |
| 666 | + /* Edge Cases -- did I mention about how user agent string lie? */ |
| 667 | + |
| 668 | + // Decode Safari's crazy 400+ version numbers |
| 669 | + if ( name.match( /safari/ ) && version > 400 ) { |
| 670 | + version = '2.0'; |
| 671 | + } |
| 672 | + // Expose Opera 10's lies about being Opera 9.8 |
| 673 | + if ( name === 'opera' && version >= 9.8) { |
| 674 | + version = userAgent.match( /version\/([0-9\.]*)/i )[1] || 10; |
| 675 | + } |
| 676 | + |
| 677 | + /* Caching */ |
| 678 | + |
| 679 | + client = { |
| 680 | + 'browser': browser, |
| 681 | + 'layout': layout, |
| 682 | + 'os': os, |
| 683 | + 'version': version, |
| 684 | + 'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ), |
| 685 | + 'versionNumber': ( parseFloat( version, 10 ) || 0.0 ) |
| 686 | + }; |
| 687 | + } |
| 688 | + return client; |
| 689 | + }; |
| 690 | + /** |
| 691 | + * Checks the current browser against a support map object to determine if the browser has been black-listed or |
| 692 | + * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body |
| 693 | + * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed. |
| 694 | + * |
| 695 | + * A browser map is in the following format: |
| 696 | + * { |
| 697 | + * 'ltr': { |
| 698 | + * // Multiple rules with configurable operators |
| 699 | + * 'msie': [['>=', 7], ['!=', 9]], |
| 700 | + * // Blocked entirely |
| 701 | + * 'iphone': false |
| 702 | + * }, |
| 703 | + * 'rtl': { |
| 704 | + * // Test against a string |
| 705 | + * 'msie': [['!==', '8.1.2.3']], |
| 706 | + * // RTL rules do not fall through to LTR rules, you must explicity set each of them |
| 707 | + * 'iphone': false |
| 708 | + * } |
| 709 | + * } |
| 710 | + * |
| 711 | + * @param map Object of browser support map |
| 712 | + * |
| 713 | + * @return Boolean true if browser known or assumed to be supported, false if blacklisted |
| 714 | + */ |
| 715 | + this.testClient = function( map ) { |
| 716 | + var client = this.client(); |
| 717 | + // Check over each browser condition to determine if we are running in a compatible client |
| 718 | + var browser = map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][client.browser]; |
| 719 | + if ( typeof browser !== 'object' ) { |
| 720 | + // Unknown, so we assume it's working |
| 721 | + return true; |
| 722 | + } |
| 723 | + for ( var condition in browser ) { |
| 724 | + var op = browser[condition][0]; |
| 725 | + var val = browser[condition][1]; |
| 726 | + if ( val === false ) { |
| 727 | + return false; |
| 728 | + } else if ( typeof val == 'string' ) { |
| 729 | + if ( !( eval( 'client.version' + op + '"' + val + '"' ) ) ) { |
| 730 | + return false; |
| 731 | + } |
| 732 | + } else if ( typeof val == 'number' ) { |
| 733 | + if ( !( eval( 'client.versionNumber' + op + val ) ) ) { |
| 734 | + return false; |
| 735 | + } |
| 736 | + } |
| 737 | + } |
| 738 | + return true; |
| 739 | + }; |
| 740 | + } )(); |
| 741 | + // Attach to window |
| 742 | + window.mw = $.extend( 'mw' in window ? window.mw : {}, this ); |
| 743 | +} )(); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/base/mw/mw.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 744 | + native |