Index: branches/new-upload/phase3/js2/mwEmbed/jquery/jquery.ui-1.7.1/jquery-1.3.2.js |
— | — | @@ -1,4376 +0,0 @@ |
2 | | -/*! |
3 | | - * jQuery JavaScript Library v1.3.2 |
4 | | - * http://jquery.com/ |
5 | | - * |
6 | | - * Copyright (c) 2009 John Resig |
7 | | - * Dual licensed under the MIT and GPL licenses. |
8 | | - * http://docs.jquery.com/License |
9 | | - * |
10 | | - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) |
11 | | - * Revision: 6246 |
12 | | - */ |
13 | | -(function(){ |
14 | | - |
15 | | -var |
16 | | - // Will speed up references to window, and allows munging its name. |
17 | | - window = this, |
18 | | - // Will speed up references to undefined, and allows munging its name. |
19 | | - undefined, |
20 | | - // Map over jQuery in case of overwrite |
21 | | - _jQuery = window.jQuery, |
22 | | - // Map over the $ in case of overwrite |
23 | | - _$ = window.$, |
24 | | - |
25 | | - jQuery = window.jQuery = window.$ = function( selector, context ) { |
26 | | - // The jQuery object is actually just the init constructor 'enhanced' |
27 | | - return new jQuery.fn.init( selector, context ); |
28 | | - }, |
29 | | - |
30 | | - // A simple way to check for HTML strings or ID strings |
31 | | - // (both of which we optimize for) |
32 | | - quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
33 | | - // Is it a simple selector |
34 | | - isSimple = /^.[^:#\[\.,]*$/; |
35 | | - |
36 | | -jQuery.fn = jQuery.prototype = { |
37 | | - init: function( selector, context ) { |
38 | | - // Make sure that a selection was provided |
39 | | - selector = selector || document; |
40 | | - |
41 | | - // Handle $(DOMElement) |
42 | | - if ( selector.nodeType ) { |
43 | | - this[0] = selector; |
44 | | - this.length = 1; |
45 | | - this.context = selector; |
46 | | - return this; |
47 | | - } |
48 | | - // Handle HTML strings |
49 | | - if ( typeof selector === "string" ) { |
50 | | - // Are we dealing with HTML string or an ID? |
51 | | - var match = quickExpr.exec( selector ); |
52 | | - |
53 | | - // Verify a match, and that no context was specified for #id |
54 | | - if ( match && (match[1] || !context) ) { |
55 | | - |
56 | | - // HANDLE: $(html) -> $(array) |
57 | | - if ( match[1] ) |
58 | | - selector = jQuery.clean( [ match[1] ], context ); |
59 | | - |
60 | | - // HANDLE: $("#id") |
61 | | - else { |
62 | | - var elem = document.getElementById( match[3] ); |
63 | | - |
64 | | - // Handle the case where IE and Opera return items |
65 | | - // by name instead of ID |
66 | | - if ( elem && elem.id != match[3] ) |
67 | | - return jQuery().find( selector ); |
68 | | - |
69 | | - // Otherwise, we inject the element directly into the jQuery object |
70 | | - var ret = jQuery( elem || [] ); |
71 | | - ret.context = document; |
72 | | - ret.selector = selector; |
73 | | - return ret; |
74 | | - } |
75 | | - |
76 | | - // HANDLE: $(expr, [context]) |
77 | | - // (which is just equivalent to: $(content).find(expr) |
78 | | - } else |
79 | | - return jQuery( context ).find( selector ); |
80 | | - |
81 | | - // HANDLE: $(function) |
82 | | - // Shortcut for document ready |
83 | | - } else if ( jQuery.isFunction( selector ) ) |
84 | | - return jQuery( document ).ready( selector ); |
85 | | - |
86 | | - // Make sure that old selector state is passed along |
87 | | - if ( selector.selector && selector.context ) { |
88 | | - this.selector = selector.selector; |
89 | | - this.context = selector.context; |
90 | | - } |
91 | | - |
92 | | - return this.setArray(jQuery.isArray( selector ) ? |
93 | | - selector : |
94 | | - jQuery.makeArray(selector)); |
95 | | - }, |
96 | | - |
97 | | - // Start with an empty selector |
98 | | - selector: "", |
99 | | - |
100 | | - // The current version of jQuery being used |
101 | | - jquery: "1.3.2", |
102 | | - |
103 | | - // The number of elements contained in the matched element set |
104 | | - size: function() { |
105 | | - return this.length; |
106 | | - }, |
107 | | - |
108 | | - // Get the Nth element in the matched element set OR |
109 | | - // Get the whole matched element set as a clean array |
110 | | - get: function( num ) { |
111 | | - return num === undefined ? |
112 | | - |
113 | | - // Return a 'clean' array |
114 | | - Array.prototype.slice.call( this ) : |
115 | | - |
116 | | - // Return just the object |
117 | | - this[ num ]; |
118 | | - }, |
119 | | - |
120 | | - // Take an array of elements and push it onto the stack |
121 | | - // (returning the new matched element set) |
122 | | - pushStack: function( elems, name, selector ) { |
123 | | - // Build a new jQuery matched element set |
124 | | - var ret = jQuery( elems ); |
125 | | - |
126 | | - // Add the old object onto the stack (as a reference) |
127 | | - ret.prevObject = this; |
128 | | - |
129 | | - ret.context = this.context; |
130 | | - |
131 | | - if ( name === "find" ) |
132 | | - ret.selector = this.selector + (this.selector ? " " : "") + selector; |
133 | | - else if ( name ) |
134 | | - ret.selector = this.selector + "." + name + "(" + selector + ")"; |
135 | | - |
136 | | - // Return the newly-formed element set |
137 | | - return ret; |
138 | | - }, |
139 | | - |
140 | | - // Force the current matched set of elements to become |
141 | | - // the specified array of elements (destroying the stack in the process) |
142 | | - // You should use pushStack() in order to do this, but maintain the stack |
143 | | - setArray: function( elems ) { |
144 | | - // Resetting the length to 0, then using the native Array push |
145 | | - // is a super-fast way to populate an object with array-like properties |
146 | | - this.length = 0; |
147 | | - Array.prototype.push.apply( this, elems ); |
148 | | - |
149 | | - return this; |
150 | | - }, |
151 | | - |
152 | | - // Execute a callback for every element in the matched set. |
153 | | - // (You can seed the arguments with an array of args, but this is |
154 | | - // only used internally.) |
155 | | - each: function( callback, args ) { |
156 | | - return jQuery.each( this, callback, args ); |
157 | | - }, |
158 | | - |
159 | | - // Determine the position of an element within |
160 | | - // the matched set of elements |
161 | | - index: function( elem ) { |
162 | | - // Locate the position of the desired element |
163 | | - return jQuery.inArray( |
164 | | - // If it receives a jQuery object, the first element is used |
165 | | - elem && elem.jquery ? elem[0] : elem |
166 | | - , this ); |
167 | | - }, |
168 | | - |
169 | | - attr: function( name, value, type ) { |
170 | | - var options = name; |
171 | | - |
172 | | - // Look for the case where we're accessing a style value |
173 | | - if ( typeof name === "string" ) |
174 | | - if ( value === undefined ) |
175 | | - return this[0] && jQuery[ type || "attr" ]( this[0], name ); |
176 | | - |
177 | | - else { |
178 | | - options = {}; |
179 | | - options[ name ] = value; |
180 | | - } |
181 | | - |
182 | | - // Check to see if we're setting style values |
183 | | - return this.each(function(i){ |
184 | | - // Set all the styles |
185 | | - for ( name in options ) |
186 | | - jQuery.attr( |
187 | | - type ? |
188 | | - this.style : |
189 | | - this, |
190 | | - name, jQuery.prop( this, options[ name ], type, i, name ) |
191 | | - ); |
192 | | - }); |
193 | | - }, |
194 | | - |
195 | | - css: function( key, value ) { |
196 | | - // ignore negative width and height values |
197 | | - if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
198 | | - value = undefined; |
199 | | - return this.attr( key, value, "curCSS" ); |
200 | | - }, |
201 | | - |
202 | | - text: function( text ) { |
203 | | - if ( typeof text !== "object" && text != null ) |
204 | | - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
205 | | - |
206 | | - var ret = ""; |
207 | | - |
208 | | - jQuery.each( text || this, function(){ |
209 | | - jQuery.each( this.childNodes, function(){ |
210 | | - if ( this.nodeType != 8 ) |
211 | | - ret += this.nodeType != 1 ? |
212 | | - this.nodeValue : |
213 | | - jQuery.fn.text( [ this ] ); |
214 | | - }); |
215 | | - }); |
216 | | - |
217 | | - return ret; |
218 | | - }, |
219 | | - |
220 | | - wrapAll: function( html ) { |
221 | | - if ( this[0] ) { |
222 | | - // The elements to wrap the target around |
223 | | - var wrap = jQuery( html, this[0].ownerDocument ).clone(); |
224 | | - |
225 | | - if ( this[0].parentNode ) |
226 | | - wrap.insertBefore( this[0] ); |
227 | | - |
228 | | - wrap.map(function(){ |
229 | | - var elem = this; |
230 | | - |
231 | | - while ( elem.firstChild ) |
232 | | - elem = elem.firstChild; |
233 | | - |
234 | | - return elem; |
235 | | - }).append(this); |
236 | | - } |
237 | | - |
238 | | - return this; |
239 | | - }, |
240 | | - |
241 | | - wrapInner: function( html ) { |
242 | | - return this.each(function(){ |
243 | | - jQuery( this ).contents().wrapAll( html ); |
244 | | - }); |
245 | | - }, |
246 | | - |
247 | | - wrap: function( html ) { |
248 | | - return this.each(function(){ |
249 | | - jQuery( this ).wrapAll( html ); |
250 | | - }); |
251 | | - }, |
252 | | - |
253 | | - append: function() { |
254 | | - return this.domManip(arguments, true, function(elem){ |
255 | | - if (this.nodeType == 1) |
256 | | - this.appendChild( elem ); |
257 | | - }); |
258 | | - }, |
259 | | - |
260 | | - prepend: function() { |
261 | | - return this.domManip(arguments, true, function(elem){ |
262 | | - if (this.nodeType == 1) |
263 | | - this.insertBefore( elem, this.firstChild ); |
264 | | - }); |
265 | | - }, |
266 | | - |
267 | | - before: function() { |
268 | | - return this.domManip(arguments, false, function(elem){ |
269 | | - this.parentNode.insertBefore( elem, this ); |
270 | | - }); |
271 | | - }, |
272 | | - |
273 | | - after: function() { |
274 | | - return this.domManip(arguments, false, function(elem){ |
275 | | - this.parentNode.insertBefore( elem, this.nextSibling ); |
276 | | - }); |
277 | | - }, |
278 | | - |
279 | | - end: function() { |
280 | | - return this.prevObject || jQuery( [] ); |
281 | | - }, |
282 | | - |
283 | | - // For internal use only. |
284 | | - // Behaves like an Array's method, not like a jQuery method. |
285 | | - push: [].push, |
286 | | - sort: [].sort, |
287 | | - splice: [].splice, |
288 | | - |
289 | | - find: function( selector ) { |
290 | | - if ( this.length === 1 ) { |
291 | | - var ret = this.pushStack( [], "find", selector ); |
292 | | - ret.length = 0; |
293 | | - jQuery.find( selector, this[0], ret ); |
294 | | - return ret; |
295 | | - } else { |
296 | | - return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ |
297 | | - return jQuery.find( selector, elem ); |
298 | | - })), "find", selector ); |
299 | | - } |
300 | | - }, |
301 | | - |
302 | | - clone: function( events ) { |
303 | | - // Do the clone |
304 | | - var ret = this.map(function(){ |
305 | | - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
306 | | - // IE copies events bound via attachEvent when |
307 | | - // using cloneNode. Calling detachEvent on the |
308 | | - // clone will also remove the events from the orignal |
309 | | - // In order to get around this, we use innerHTML. |
310 | | - // Unfortunately, this means some modifications to |
311 | | - // attributes in IE that are actually only stored |
312 | | - // as properties will not be copied (such as the |
313 | | - // the name attribute on an input). |
314 | | - var html = this.outerHTML; |
315 | | - if ( !html ) { |
316 | | - var div = this.ownerDocument.createElement("div"); |
317 | | - div.appendChild( this.cloneNode(true) ); |
318 | | - html = div.innerHTML; |
319 | | - } |
320 | | - |
321 | | - return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; |
322 | | - } else |
323 | | - return this.cloneNode(true); |
324 | | - }); |
325 | | - |
326 | | - // Copy the events from the original to the clone |
327 | | - if ( events === true ) { |
328 | | - var orig = this.find("*").andSelf(), i = 0; |
329 | | - |
330 | | - ret.find("*").andSelf().each(function(){ |
331 | | - if ( this.nodeName !== orig[i].nodeName ) |
332 | | - return; |
333 | | - |
334 | | - var events = jQuery.data( orig[i], "events" ); |
335 | | - |
336 | | - for ( var type in events ) { |
337 | | - for ( var handler in events[ type ] ) { |
338 | | - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
339 | | - } |
340 | | - } |
341 | | - |
342 | | - i++; |
343 | | - }); |
344 | | - } |
345 | | - |
346 | | - // Return the cloned set |
347 | | - return ret; |
348 | | - }, |
349 | | - |
350 | | - filter: function( selector ) { |
351 | | - return this.pushStack( |
352 | | - jQuery.isFunction( selector ) && |
353 | | - jQuery.grep(this, function(elem, i){ |
354 | | - return selector.call( elem, i ); |
355 | | - }) || |
356 | | - |
357 | | - jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ |
358 | | - return elem.nodeType === 1; |
359 | | - }) ), "filter", selector ); |
360 | | - }, |
361 | | - |
362 | | - closest: function( selector ) { |
363 | | - var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
364 | | - closer = 0; |
365 | | - |
366 | | - return this.map(function(){ |
367 | | - var cur = this; |
368 | | - while ( cur && cur.ownerDocument ) { |
369 | | - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
370 | | - jQuery.data(cur, "closest", closer); |
371 | | - return cur; |
372 | | - } |
373 | | - cur = cur.parentNode; |
374 | | - closer++; |
375 | | - } |
376 | | - }); |
377 | | - }, |
378 | | - |
379 | | - not: function( selector ) { |
380 | | - if ( typeof selector === "string" ) |
381 | | - // test special case where just one selector is passed in |
382 | | - if ( isSimple.test( selector ) ) |
383 | | - return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); |
384 | | - else |
385 | | - selector = jQuery.multiFilter( selector, this ); |
386 | | - |
387 | | - var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
388 | | - return this.filter(function() { |
389 | | - return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
390 | | - }); |
391 | | - }, |
392 | | - |
393 | | - add: function( selector ) { |
394 | | - return this.pushStack( jQuery.unique( jQuery.merge( |
395 | | - this.get(), |
396 | | - typeof selector === "string" ? |
397 | | - jQuery( selector ) : |
398 | | - jQuery.makeArray( selector ) |
399 | | - ))); |
400 | | - }, |
401 | | - |
402 | | - is: function( selector ) { |
403 | | - return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
404 | | - }, |
405 | | - |
406 | | - hasClass: function( selector ) { |
407 | | - return !!selector && this.is( "." + selector ); |
408 | | - }, |
409 | | - |
410 | | - val: function( value ) { |
411 | | - if ( value === undefined ) { |
412 | | - var elem = this[0]; |
413 | | - |
414 | | - if ( elem ) { |
415 | | - if( jQuery.nodeName( elem, 'option' ) ) |
416 | | - return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
417 | | - |
418 | | - // We need to handle select boxes special |
419 | | - if ( jQuery.nodeName( elem, "select" ) ) { |
420 | | - var index = elem.selectedIndex, |
421 | | - values = [], |
422 | | - options = elem.options, |
423 | | - one = elem.type == "select-one"; |
424 | | - |
425 | | - // Nothing was selected |
426 | | - if ( index < 0 ) |
427 | | - return null; |
428 | | - |
429 | | - // Loop through all the selected options |
430 | | - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
431 | | - var option = options[ i ]; |
432 | | - |
433 | | - if ( option.selected ) { |
434 | | - // Get the specifc value for the option |
435 | | - value = jQuery(option).val(); |
436 | | - |
437 | | - // We don't need an array for one selects |
438 | | - if ( one ) |
439 | | - return value; |
440 | | - |
441 | | - // Multi-Selects return an array |
442 | | - values.push( value ); |
443 | | - } |
444 | | - } |
445 | | - |
446 | | - return values; |
447 | | - } |
448 | | - |
449 | | - // Everything else, we just grab the value |
450 | | - return (elem.value || "").replace(/\r/g, ""); |
451 | | - |
452 | | - } |
453 | | - |
454 | | - return undefined; |
455 | | - } |
456 | | - |
457 | | - if ( typeof value === "number" ) |
458 | | - value += ''; |
459 | | - |
460 | | - return this.each(function(){ |
461 | | - if ( this.nodeType != 1 ) |
462 | | - return; |
463 | | - |
464 | | - if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) |
465 | | - this.checked = (jQuery.inArray(this.value, value) >= 0 || |
466 | | - jQuery.inArray(this.name, value) >= 0); |
467 | | - |
468 | | - else if ( jQuery.nodeName( this, "select" ) ) { |
469 | | - var values = jQuery.makeArray(value); |
470 | | - |
471 | | - jQuery( "option", this ).each(function(){ |
472 | | - this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
473 | | - jQuery.inArray( this.text, values ) >= 0); |
474 | | - }); |
475 | | - |
476 | | - if ( !values.length ) |
477 | | - this.selectedIndex = -1; |
478 | | - |
479 | | - } else |
480 | | - this.value = value; |
481 | | - }); |
482 | | - }, |
483 | | - |
484 | | - html: function( value ) { |
485 | | - return value === undefined ? |
486 | | - (this[0] ? |
487 | | - this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : |
488 | | - null) : |
489 | | - this.empty().append( value ); |
490 | | - }, |
491 | | - |
492 | | - replaceWith: function( value ) { |
493 | | - return this.after( value ).remove(); |
494 | | - }, |
495 | | - |
496 | | - eq: function( i ) { |
497 | | - return this.slice( i, +i + 1 ); |
498 | | - }, |
499 | | - |
500 | | - slice: function() { |
501 | | - return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
502 | | - "slice", Array.prototype.slice.call(arguments).join(",") ); |
503 | | - }, |
504 | | - |
505 | | - map: function( callback ) { |
506 | | - return this.pushStack( jQuery.map(this, function(elem, i){ |
507 | | - return callback.call( elem, i, elem ); |
508 | | - })); |
509 | | - }, |
510 | | - |
511 | | - andSelf: function() { |
512 | | - return this.add( this.prevObject ); |
513 | | - }, |
514 | | - |
515 | | - domManip: function( args, table, callback ) { |
516 | | - if ( this[0] ) { |
517 | | - var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), |
518 | | - scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), |
519 | | - first = fragment.firstChild; |
520 | | - |
521 | | - if ( first ) |
522 | | - for ( var i = 0, l = this.length; i < l; i++ ) |
523 | | - callback.call( root(this[i], first), this.length > 1 || i > 0 ? |
524 | | - fragment.cloneNode(true) : fragment ); |
525 | | - |
526 | | - if ( scripts ) |
527 | | - jQuery.each( scripts, evalScript ); |
528 | | - } |
529 | | - |
530 | | - return this; |
531 | | - |
532 | | - function root( elem, cur ) { |
533 | | - return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
534 | | - (elem.getElementsByTagName("tbody")[0] || |
535 | | - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
536 | | - elem; |
537 | | - } |
538 | | - } |
539 | | -}; |
540 | | - |
541 | | -// Give the init function the jQuery prototype for later instantiation |
542 | | -jQuery.fn.init.prototype = jQuery.fn; |
543 | | - |
544 | | -function evalScript( i, elem ) { |
545 | | - if ( elem.src ) |
546 | | - jQuery.ajax({ |
547 | | - url: elem.src, |
548 | | - async: false, |
549 | | - dataType: "script" |
550 | | - }); |
551 | | - |
552 | | - else |
553 | | - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
554 | | - |
555 | | - if ( elem.parentNode ) |
556 | | - elem.parentNode.removeChild( elem ); |
557 | | -} |
558 | | - |
559 | | -function now(){ |
560 | | - return +new Date; |
561 | | -} |
562 | | - |
563 | | -jQuery.extend = jQuery.fn.extend = function() { |
564 | | - // copy reference to target object |
565 | | - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
566 | | - |
567 | | - // Handle a deep copy situation |
568 | | - if ( typeof target === "boolean" ) { |
569 | | - deep = target; |
570 | | - target = arguments[1] || {}; |
571 | | - // skip the boolean and the target |
572 | | - i = 2; |
573 | | - } |
574 | | - |
575 | | - // Handle case when target is a string or something (possible in deep copy) |
576 | | - if ( typeof target !== "object" && !jQuery.isFunction(target) ) |
577 | | - target = {}; |
578 | | - |
579 | | - // extend jQuery itself if only one argument is passed |
580 | | - if ( length == i ) { |
581 | | - target = this; |
582 | | - --i; |
583 | | - } |
584 | | - |
585 | | - for ( ; i < length; i++ ) |
586 | | - // Only deal with non-null/undefined values |
587 | | - if ( (options = arguments[ i ]) != null ) |
588 | | - // Extend the base object |
589 | | - for ( var name in options ) { |
590 | | - var src = target[ name ], copy = options[ name ]; |
591 | | - |
592 | | - // Prevent never-ending loop |
593 | | - if ( target === copy ) |
594 | | - continue; |
595 | | - |
596 | | - // Recurse if we're merging object values |
597 | | - if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
598 | | - target[ name ] = jQuery.extend( deep, |
599 | | - // Never move original objects, clone them |
600 | | - src || ( copy.length != null ? [ ] : { } ) |
601 | | - , copy ); |
602 | | - |
603 | | - // Don't bring in undefined values |
604 | | - else if ( copy !== undefined ) |
605 | | - target[ name ] = copy; |
606 | | - |
607 | | - } |
608 | | - |
609 | | - // Return the modified object |
610 | | - return target; |
611 | | -}; |
612 | | - |
613 | | -// exclude the following css properties to add px |
614 | | -var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
615 | | - // cache defaultView |
616 | | - defaultView = document.defaultView || {}, |
617 | | - toString = Object.prototype.toString; |
618 | | - |
619 | | -jQuery.extend({ |
620 | | - noConflict: function( deep ) { |
621 | | - window.$ = _$; |
622 | | - |
623 | | - if ( deep ) |
624 | | - window.jQuery = _jQuery; |
625 | | - |
626 | | - return jQuery; |
627 | | - }, |
628 | | - |
629 | | - // See test/unit/core.js for details concerning isFunction. |
630 | | - // Since version 1.3, DOM methods and functions like alert |
631 | | - // aren't supported. They return false on IE (#2968). |
632 | | - isFunction: function( obj ) { |
633 | | - return toString.call(obj) === "[object Function]"; |
634 | | - }, |
635 | | - |
636 | | - isArray: function( obj ) { |
637 | | - return toString.call(obj) === "[object Array]"; |
638 | | - }, |
639 | | - |
640 | | - // check if an element is in a (or is an) XML document |
641 | | - isXMLDoc: function( elem ) { |
642 | | - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
643 | | - !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); |
644 | | - }, |
645 | | - |
646 | | - // Evalulates a script in a global context |
647 | | - globalEval: function( data ) { |
648 | | - if ( data && /\S/.test(data) ) { |
649 | | - // Inspired by code by Andrea Giammarchi |
650 | | - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
651 | | - var head = document.getElementsByTagName("head")[0] || document.documentElement, |
652 | | - script = document.createElement("script"); |
653 | | - |
654 | | - script.type = "text/javascript"; |
655 | | - if ( jQuery.support.scriptEval ) |
656 | | - script.appendChild( document.createTextNode( data ) ); |
657 | | - else |
658 | | - script.text = data; |
659 | | - |
660 | | - // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
661 | | - // This arises when a base node is used (#2709). |
662 | | - head.insertBefore( script, head.firstChild ); |
663 | | - head.removeChild( script ); |
664 | | - } |
665 | | - }, |
666 | | - |
667 | | - nodeName: function( elem, name ) { |
668 | | - return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
669 | | - }, |
670 | | - |
671 | | - // args is for internal usage only |
672 | | - each: function( object, callback, args ) { |
673 | | - var name, i = 0, length = object.length; |
674 | | - |
675 | | - if ( args ) { |
676 | | - if ( length === undefined ) { |
677 | | - for ( name in object ) |
678 | | - if ( callback.apply( object[ name ], args ) === false ) |
679 | | - break; |
680 | | - } else |
681 | | - for ( ; i < length; ) |
682 | | - if ( callback.apply( object[ i++ ], args ) === false ) |
683 | | - break; |
684 | | - |
685 | | - // A special, fast, case for the most common use of each |
686 | | - } else { |
687 | | - if ( length === undefined ) { |
688 | | - for ( name in object ) |
689 | | - if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
690 | | - break; |
691 | | - } else |
692 | | - for ( var value = object[0]; |
693 | | - i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
694 | | - } |
695 | | - |
696 | | - return object; |
697 | | - }, |
698 | | - |
699 | | - prop: function( elem, value, type, i, name ) { |
700 | | - // Handle executable functions |
701 | | - if ( jQuery.isFunction( value ) ) |
702 | | - value = value.call( elem, i ); |
703 | | - |
704 | | - // Handle passing in a number to a CSS property |
705 | | - return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? |
706 | | - value + "px" : |
707 | | - value; |
708 | | - }, |
709 | | - |
710 | | - className: { |
711 | | - // internal only, use addClass("class") |
712 | | - add: function( elem, classNames ) { |
713 | | - jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
714 | | - if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
715 | | - elem.className += (elem.className ? " " : "") + className; |
716 | | - }); |
717 | | - }, |
718 | | - |
719 | | - // internal only, use removeClass("class") |
720 | | - remove: function( elem, classNames ) { |
721 | | - if (elem.nodeType == 1) |
722 | | - elem.className = classNames !== undefined ? |
723 | | - jQuery.grep(elem.className.split(/\s+/), function(className){ |
724 | | - return !jQuery.className.has( classNames, className ); |
725 | | - }).join(" ") : |
726 | | - ""; |
727 | | - }, |
728 | | - |
729 | | - // internal only, use hasClass("class") |
730 | | - has: function( elem, className ) { |
731 | | - return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
732 | | - } |
733 | | - }, |
734 | | - |
735 | | - // A method for quickly swapping in/out CSS properties to get correct calculations |
736 | | - swap: function( elem, options, callback ) { |
737 | | - var old = {}; |
738 | | - // Remember the old values, and insert the new ones |
739 | | - for ( var name in options ) { |
740 | | - old[ name ] = elem.style[ name ]; |
741 | | - elem.style[ name ] = options[ name ]; |
742 | | - } |
743 | | - |
744 | | - callback.call( elem ); |
745 | | - |
746 | | - // Revert the old values |
747 | | - for ( var name in options ) |
748 | | - elem.style[ name ] = old[ name ]; |
749 | | - }, |
750 | | - |
751 | | - css: function( elem, name, force, extra ) { |
752 | | - if ( name == "width" || name == "height" ) { |
753 | | - var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
754 | | - |
755 | | - function getWH() { |
756 | | - val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
757 | | - |
758 | | - if ( extra === "border" ) |
759 | | - return; |
760 | | - |
761 | | - jQuery.each( which, function() { |
762 | | - if ( !extra ) |
763 | | - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
764 | | - if ( extra === "margin" ) |
765 | | - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
766 | | - else |
767 | | - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
768 | | - }); |
769 | | - } |
770 | | - |
771 | | - if ( elem.offsetWidth !== 0 ) |
772 | | - getWH(); |
773 | | - else |
774 | | - jQuery.swap( elem, props, getWH ); |
775 | | - |
776 | | - return Math.max(0, Math.round(val)); |
777 | | - } |
778 | | - |
779 | | - return jQuery.curCSS( elem, name, force ); |
780 | | - }, |
781 | | - |
782 | | - curCSS: function( elem, name, force ) { |
783 | | - var ret, style = elem.style; |
784 | | - |
785 | | - // We need to handle opacity special in IE |
786 | | - if ( name == "opacity" && !jQuery.support.opacity ) { |
787 | | - ret = jQuery.attr( style, "opacity" ); |
788 | | - |
789 | | - return ret == "" ? |
790 | | - "1" : |
791 | | - ret; |
792 | | - } |
793 | | - |
794 | | - // Make sure we're using the right name for getting the float value |
795 | | - if ( name.match( /float/i ) ) |
796 | | - name = styleFloat; |
797 | | - |
798 | | - if ( !force && style && style[ name ] ) |
799 | | - ret = style[ name ]; |
800 | | - |
801 | | - else if ( defaultView.getComputedStyle ) { |
802 | | - |
803 | | - // Only "float" is needed here |
804 | | - if ( name.match( /float/i ) ) |
805 | | - name = "float"; |
806 | | - |
807 | | - name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
808 | | - |
809 | | - var computedStyle = defaultView.getComputedStyle( elem, null ); |
810 | | - |
811 | | - if ( computedStyle ) |
812 | | - ret = computedStyle.getPropertyValue( name ); |
813 | | - |
814 | | - // We should always get a number back from opacity |
815 | | - if ( name == "opacity" && ret == "" ) |
816 | | - ret = "1"; |
817 | | - |
818 | | - } else if ( elem.currentStyle ) { |
819 | | - var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
820 | | - return letter.toUpperCase(); |
821 | | - }); |
822 | | - |
823 | | - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
824 | | - |
825 | | - // From the awesome hack by Dean Edwards |
826 | | - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
827 | | - |
828 | | - // If we're not dealing with a regular pixel number |
829 | | - // but a number that has a weird ending, we need to convert it to pixels |
830 | | - if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
831 | | - // Remember the original values |
832 | | - var left = style.left, rsLeft = elem.runtimeStyle.left; |
833 | | - |
834 | | - // Put in the new values to get a computed value out |
835 | | - elem.runtimeStyle.left = elem.currentStyle.left; |
836 | | - style.left = ret || 0; |
837 | | - ret = style.pixelLeft + "px"; |
838 | | - |
839 | | - // Revert the changed values |
840 | | - style.left = left; |
841 | | - elem.runtimeStyle.left = rsLeft; |
842 | | - } |
843 | | - } |
844 | | - |
845 | | - return ret; |
846 | | - }, |
847 | | - |
848 | | - clean: function( elems, context, fragment ) { |
849 | | - context = context || document; |
850 | | - |
851 | | - // !context.createElement fails in IE with an error but returns typeof 'object' |
852 | | - if ( typeof context.createElement === "undefined" ) |
853 | | - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
854 | | - |
855 | | - // If a single string is passed in and it's a single tag |
856 | | - // just do a createElement and skip the rest |
857 | | - if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { |
858 | | - var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); |
859 | | - if ( match ) |
860 | | - return [ context.createElement( match[1] ) ]; |
861 | | - } |
862 | | - |
863 | | - var ret = [], scripts = [], div = context.createElement("div"); |
864 | | - |
865 | | - jQuery.each(elems, function(i, elem){ |
866 | | - if ( typeof elem === "number" ) |
867 | | - elem += ''; |
868 | | - |
869 | | - if ( !elem ) |
870 | | - return; |
871 | | - |
872 | | - // Convert html string into DOM nodes |
873 | | - if ( typeof elem === "string" ) { |
874 | | - // Fix "XHTML"-style tags in all browsers |
875 | | - elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
876 | | - return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
877 | | - all : |
878 | | - front + "></" + tag + ">"; |
879 | | - }); |
880 | | - |
881 | | - // Trim whitespace, otherwise indexOf won't work as expected |
882 | | - var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); |
883 | | - |
884 | | - var wrap = |
885 | | - // option or optgroup |
886 | | - !tags.indexOf("<opt") && |
887 | | - [ 1, "<select multiple='multiple'>", "</select>" ] || |
888 | | - |
889 | | - !tags.indexOf("<leg") && |
890 | | - [ 1, "<fieldset>", "</fieldset>" ] || |
891 | | - |
892 | | - tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
893 | | - [ 1, "<table>", "</table>" ] || |
894 | | - |
895 | | - !tags.indexOf("<tr") && |
896 | | - [ 2, "<table><tbody>", "</tbody></table>" ] || |
897 | | - |
898 | | - // <thead> matched above |
899 | | - (!tags.indexOf("<td") || !tags.indexOf("<th")) && |
900 | | - [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
901 | | - |
902 | | - !tags.indexOf("<col") && |
903 | | - [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
904 | | - |
905 | | - // IE can't serialize <link> and <script> tags normally |
906 | | - !jQuery.support.htmlSerialize && |
907 | | - [ 1, "div<div>", "</div>" ] || |
908 | | - |
909 | | - [ 0, "", "" ]; |
910 | | - |
911 | | - // Go to html and back, then peel off extra wrappers |
912 | | - div.innerHTML = wrap[1] + elem + wrap[2]; |
913 | | - |
914 | | - // Move to the right depth |
915 | | - while ( wrap[0]-- ) |
916 | | - div = div.lastChild; |
917 | | - |
918 | | - // Remove IE's autoinserted <tbody> from table fragments |
919 | | - if ( !jQuery.support.tbody ) { |
920 | | - |
921 | | - // String was a <table>, *may* have spurious <tbody> |
922 | | - var hasBody = /<tbody/i.test(elem), |
923 | | - tbody = !tags.indexOf("<table") && !hasBody ? |
924 | | - div.firstChild && div.firstChild.childNodes : |
925 | | - |
926 | | - // String was a bare <thead> or <tfoot> |
927 | | - wrap[1] == "<table>" && !hasBody ? |
928 | | - div.childNodes : |
929 | | - []; |
930 | | - |
931 | | - for ( var j = tbody.length - 1; j >= 0 ; --j ) |
932 | | - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
933 | | - tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
934 | | - |
935 | | - } |
936 | | - |
937 | | - // IE completely kills leading whitespace when innerHTML is used |
938 | | - if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) |
939 | | - div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
940 | | - |
941 | | - elem = jQuery.makeArray( div.childNodes ); |
942 | | - } |
943 | | - |
944 | | - if ( elem.nodeType ) |
945 | | - ret.push( elem ); |
946 | | - else |
947 | | - ret = jQuery.merge( ret, elem ); |
948 | | - |
949 | | - }); |
950 | | - |
951 | | - if ( fragment ) { |
952 | | - for ( var i = 0; ret[i]; i++ ) { |
953 | | - if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
954 | | - scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
955 | | - } else { |
956 | | - if ( ret[i].nodeType === 1 ) |
957 | | - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
958 | | - fragment.appendChild( ret[i] ); |
959 | | - } |
960 | | - } |
961 | | - |
962 | | - return scripts; |
963 | | - } |
964 | | - |
965 | | - return ret; |
966 | | - }, |
967 | | - |
968 | | - attr: function( elem, name, value ) { |
969 | | - // don't set attributes on text and comment nodes |
970 | | - if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
971 | | - return undefined; |
972 | | - |
973 | | - var notxml = !jQuery.isXMLDoc( elem ), |
974 | | - // Whether we are setting (or getting) |
975 | | - set = value !== undefined; |
976 | | - |
977 | | - // Try to normalize/fix the name |
978 | | - name = notxml && jQuery.props[ name ] || name; |
979 | | - |
980 | | - // Only do all the following if this is a node (faster for style) |
981 | | - // IE elem.getAttribute passes even for style |
982 | | - if ( elem.tagName ) { |
983 | | - |
984 | | - // These attributes require special treatment |
985 | | - var special = /href|src|style/.test( name ); |
986 | | - |
987 | | - // Safari mis-reports the default selected property of a hidden option |
988 | | - // Accessing the parent's selectedIndex property fixes it |
989 | | - if ( name == "selected" && elem.parentNode ) |
990 | | - elem.parentNode.selectedIndex; |
991 | | - |
992 | | - // If applicable, access the attribute via the DOM 0 way |
993 | | - if ( name in elem && notxml && !special ) { |
994 | | - if ( set ){ |
995 | | - // We can't allow the type property to be changed (since it causes problems in IE) |
996 | | - if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) |
997 | | - throw "type property can't be changed"; |
998 | | - |
999 | | - elem[ name ] = value; |
1000 | | - } |
1001 | | - |
1002 | | - // browsers index elements by id/name on forms, give priority to attributes. |
1003 | | - if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
1004 | | - return elem.getAttributeNode( name ).nodeValue; |
1005 | | - |
1006 | | - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
1007 | | - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
1008 | | - if ( name == "tabIndex" ) { |
1009 | | - var attributeNode = elem.getAttributeNode( "tabIndex" ); |
1010 | | - return attributeNode && attributeNode.specified |
1011 | | - ? attributeNode.value |
1012 | | - : elem.nodeName.match(/(button|input|object|select|textarea)/i) |
1013 | | - ? 0 |
1014 | | - : elem.nodeName.match(/^(a|area)$/i) && elem.href |
1015 | | - ? 0 |
1016 | | - : undefined; |
1017 | | - } |
1018 | | - |
1019 | | - return elem[ name ]; |
1020 | | - } |
1021 | | - |
1022 | | - if ( !jQuery.support.style && notxml && name == "style" ) |
1023 | | - return jQuery.attr( elem.style, "cssText", value ); |
1024 | | - |
1025 | | - if ( set ) |
1026 | | - // convert the value to a string (all browsers do this but IE) see #1070 |
1027 | | - elem.setAttribute( name, "" + value ); |
1028 | | - |
1029 | | - var attr = !jQuery.support.hrefNormalized && notxml && special |
1030 | | - // Some attributes require a special call on IE |
1031 | | - ? elem.getAttribute( name, 2 ) |
1032 | | - : elem.getAttribute( name ); |
1033 | | - |
1034 | | - // Non-existent attributes return null, we normalize to undefined |
1035 | | - return attr === null ? undefined : attr; |
1036 | | - } |
1037 | | - |
1038 | | - // elem is actually elem.style ... set the style |
1039 | | - |
1040 | | - // IE uses filters for opacity |
1041 | | - if ( !jQuery.support.opacity && name == "opacity" ) { |
1042 | | - if ( set ) { |
1043 | | - // IE has trouble with opacity if it does not have layout |
1044 | | - // Force it by setting the zoom level |
1045 | | - elem.zoom = 1; |
1046 | | - |
1047 | | - // Set the alpha filter to set the opacity |
1048 | | - elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
1049 | | - (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
1050 | | - } |
1051 | | - |
1052 | | - return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? |
1053 | | - (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
1054 | | - ""; |
1055 | | - } |
1056 | | - |
1057 | | - name = name.replace(/-([a-z])/ig, function(all, letter){ |
1058 | | - return letter.toUpperCase(); |
1059 | | - }); |
1060 | | - |
1061 | | - if ( set ) |
1062 | | - elem[ name ] = value; |
1063 | | - |
1064 | | - return elem[ name ]; |
1065 | | - }, |
1066 | | - |
1067 | | - trim: function( text ) { |
1068 | | - return (text || "").replace( /^\s+|\s+$/g, "" ); |
1069 | | - }, |
1070 | | - |
1071 | | - makeArray: function( array ) { |
1072 | | - var ret = []; |
1073 | | - |
1074 | | - if( array != null ){ |
1075 | | - var i = array.length; |
1076 | | - // The window, strings (and functions) also have 'length' |
1077 | | - if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) |
1078 | | - ret[0] = array; |
1079 | | - else |
1080 | | - while( i ) |
1081 | | - ret[--i] = array[i]; |
1082 | | - } |
1083 | | - |
1084 | | - return ret; |
1085 | | - }, |
1086 | | - |
1087 | | - inArray: function( elem, array ) { |
1088 | | - for ( var i = 0, length = array.length; i < length; i++ ) |
1089 | | - // Use === because on IE, window == document |
1090 | | - if ( array[ i ] === elem ) |
1091 | | - return i; |
1092 | | - |
1093 | | - return -1; |
1094 | | - }, |
1095 | | - |
1096 | | - merge: function( first, second ) { |
1097 | | - // We have to loop this way because IE & Opera overwrite the length |
1098 | | - // expando of getElementsByTagName |
1099 | | - var i = 0, elem, pos = first.length; |
1100 | | - // Also, we need to make sure that the correct elements are being returned |
1101 | | - // (IE returns comment nodes in a '*' query) |
1102 | | - if ( !jQuery.support.getAll ) { |
1103 | | - while ( (elem = second[ i++ ]) != null ) |
1104 | | - if ( elem.nodeType != 8 ) |
1105 | | - first[ pos++ ] = elem; |
1106 | | - |
1107 | | - } else |
1108 | | - while ( (elem = second[ i++ ]) != null ) |
1109 | | - first[ pos++ ] = elem; |
1110 | | - |
1111 | | - return first; |
1112 | | - }, |
1113 | | - |
1114 | | - unique: function( array ) { |
1115 | | - var ret = [], done = {}; |
1116 | | - |
1117 | | - try { |
1118 | | - |
1119 | | - for ( var i = 0, length = array.length; i < length; i++ ) { |
1120 | | - var id = jQuery.data( array[ i ] ); |
1121 | | - |
1122 | | - if ( !done[ id ] ) { |
1123 | | - done[ id ] = true; |
1124 | | - ret.push( array[ i ] ); |
1125 | | - } |
1126 | | - } |
1127 | | - |
1128 | | - } catch( e ) { |
1129 | | - ret = array; |
1130 | | - } |
1131 | | - |
1132 | | - return ret; |
1133 | | - }, |
1134 | | - |
1135 | | - grep: function( elems, callback, inv ) { |
1136 | | - var ret = []; |
1137 | | - |
1138 | | - // Go through the array, only saving the items |
1139 | | - // that pass the validator function |
1140 | | - for ( var i = 0, length = elems.length; i < length; i++ ) |
1141 | | - if ( !inv != !callback( elems[ i ], i ) ) |
1142 | | - ret.push( elems[ i ] ); |
1143 | | - |
1144 | | - return ret; |
1145 | | - }, |
1146 | | - |
1147 | | - map: function( elems, callback ) { |
1148 | | - var ret = []; |
1149 | | - |
1150 | | - // Go through the array, translating each of the items to their |
1151 | | - // new value (or values). |
1152 | | - for ( var i = 0, length = elems.length; i < length; i++ ) { |
1153 | | - var value = callback( elems[ i ], i ); |
1154 | | - |
1155 | | - if ( value != null ) |
1156 | | - ret[ ret.length ] = value; |
1157 | | - } |
1158 | | - |
1159 | | - return ret.concat.apply( [], ret ); |
1160 | | - } |
1161 | | -}); |
1162 | | - |
1163 | | -// Use of jQuery.browser is deprecated. |
1164 | | -// It's included for backwards compatibility and plugins, |
1165 | | -// although they should work to migrate away. |
1166 | | - |
1167 | | -var userAgent = navigator.userAgent.toLowerCase(); |
1168 | | - |
1169 | | -// Figure out what browser is being used |
1170 | | -jQuery.browser = { |
1171 | | - version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
1172 | | - safari: /webkit/.test( userAgent ), |
1173 | | - opera: /opera/.test( userAgent ), |
1174 | | - msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
1175 | | - mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
1176 | | -}; |
1177 | | - |
1178 | | -jQuery.each({ |
1179 | | - parent: function(elem){return elem.parentNode;}, |
1180 | | - parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
1181 | | - next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
1182 | | - prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
1183 | | - nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
1184 | | - prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
1185 | | - siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
1186 | | - children: function(elem){return jQuery.sibling(elem.firstChild);}, |
1187 | | - contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
1188 | | -}, function(name, fn){ |
1189 | | - jQuery.fn[ name ] = function( selector ) { |
1190 | | - var ret = jQuery.map( this, fn ); |
1191 | | - |
1192 | | - if ( selector && typeof selector == "string" ) |
1193 | | - ret = jQuery.multiFilter( selector, ret ); |
1194 | | - |
1195 | | - return this.pushStack( jQuery.unique( ret ), name, selector ); |
1196 | | - }; |
1197 | | -}); |
1198 | | - |
1199 | | -jQuery.each({ |
1200 | | - appendTo: "append", |
1201 | | - prependTo: "prepend", |
1202 | | - insertBefore: "before", |
1203 | | - insertAfter: "after", |
1204 | | - replaceAll: "replaceWith" |
1205 | | -}, function(name, original){ |
1206 | | - jQuery.fn[ name ] = function( selector ) { |
1207 | | - var ret = [], insert = jQuery( selector ); |
1208 | | - |
1209 | | - for ( var i = 0, l = insert.length; i < l; i++ ) { |
1210 | | - var elems = (i > 0 ? this.clone(true) : this).get(); |
1211 | | - jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
1212 | | - ret = ret.concat( elems ); |
1213 | | - } |
1214 | | - |
1215 | | - return this.pushStack( ret, name, selector ); |
1216 | | - }; |
1217 | | -}); |
1218 | | - |
1219 | | -jQuery.each({ |
1220 | | - removeAttr: function( name ) { |
1221 | | - jQuery.attr( this, name, "" ); |
1222 | | - if (this.nodeType == 1) |
1223 | | - this.removeAttribute( name ); |
1224 | | - }, |
1225 | | - |
1226 | | - addClass: function( classNames ) { |
1227 | | - jQuery.className.add( this, classNames ); |
1228 | | - }, |
1229 | | - |
1230 | | - removeClass: function( classNames ) { |
1231 | | - jQuery.className.remove( this, classNames ); |
1232 | | - }, |
1233 | | - |
1234 | | - toggleClass: function( classNames, state ) { |
1235 | | - if( typeof state !== "boolean" ) |
1236 | | - state = !jQuery.className.has( this, classNames ); |
1237 | | - jQuery.className[ state ? "add" : "remove" ]( this, classNames ); |
1238 | | - }, |
1239 | | - |
1240 | | - remove: function( selector ) { |
1241 | | - if ( !selector || jQuery.filter( selector, [ this ] ).length ) { |
1242 | | - // Prevent memory leaks |
1243 | | - jQuery( "*", this ).add([this]).each(function(){ |
1244 | | - jQuery.event.remove(this); |
1245 | | - jQuery.removeData(this); |
1246 | | - }); |
1247 | | - if (this.parentNode) |
1248 | | - this.parentNode.removeChild( this ); |
1249 | | - } |
1250 | | - }, |
1251 | | - |
1252 | | - empty: function() { |
1253 | | - // Remove element nodes and prevent memory leaks |
1254 | | - jQuery(this).children().remove(); |
1255 | | - |
1256 | | - // Remove any remaining nodes |
1257 | | - while ( this.firstChild ) |
1258 | | - this.removeChild( this.firstChild ); |
1259 | | - } |
1260 | | -}, function(name, fn){ |
1261 | | - jQuery.fn[ name ] = function(){ |
1262 | | - return this.each( fn, arguments ); |
1263 | | - }; |
1264 | | -}); |
1265 | | - |
1266 | | -// Helper function used by the dimensions and offset modules |
1267 | | -function num(elem, prop) { |
1268 | | - return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; |
1269 | | -} |
1270 | | -var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
1271 | | - |
1272 | | -jQuery.extend({ |
1273 | | - cache: {}, |
1274 | | - |
1275 | | - data: function( elem, name, data ) { |
1276 | | - elem = elem == window ? |
1277 | | - windowData : |
1278 | | - elem; |
1279 | | - |
1280 | | - var id = elem[ expando ]; |
1281 | | - |
1282 | | - // Compute a unique ID for the element |
1283 | | - if ( !id ) |
1284 | | - id = elem[ expando ] = ++uuid; |
1285 | | - |
1286 | | - // Only generate the data cache if we're |
1287 | | - // trying to access or manipulate it |
1288 | | - if ( name && !jQuery.cache[ id ] ) |
1289 | | - jQuery.cache[ id ] = {}; |
1290 | | - |
1291 | | - // Prevent overriding the named cache with undefined values |
1292 | | - if ( data !== undefined ) |
1293 | | - jQuery.cache[ id ][ name ] = data; |
1294 | | - |
1295 | | - // Return the named cache data, or the ID for the element |
1296 | | - return name ? |
1297 | | - jQuery.cache[ id ][ name ] : |
1298 | | - id; |
1299 | | - }, |
1300 | | - |
1301 | | - removeData: function( elem, name ) { |
1302 | | - elem = elem == window ? |
1303 | | - windowData : |
1304 | | - elem; |
1305 | | - |
1306 | | - var id = elem[ expando ]; |
1307 | | - |
1308 | | - // If we want to remove a specific section of the element's data |
1309 | | - if ( name ) { |
1310 | | - if ( jQuery.cache[ id ] ) { |
1311 | | - // Remove the section of cache data |
1312 | | - delete jQuery.cache[ id ][ name ]; |
1313 | | - |
1314 | | - // If we've removed all the data, remove the element's cache |
1315 | | - name = ""; |
1316 | | - |
1317 | | - for ( name in jQuery.cache[ id ] ) |
1318 | | - break; |
1319 | | - |
1320 | | - if ( !name ) |
1321 | | - jQuery.removeData( elem ); |
1322 | | - } |
1323 | | - |
1324 | | - // Otherwise, we want to remove all of the element's data |
1325 | | - } else { |
1326 | | - // Clean up the element expando |
1327 | | - try { |
1328 | | - delete elem[ expando ]; |
1329 | | - } catch(e){ |
1330 | | - // IE has trouble directly removing the expando |
1331 | | - // but it's ok with using removeAttribute |
1332 | | - if ( elem.removeAttribute ) |
1333 | | - elem.removeAttribute( expando ); |
1334 | | - } |
1335 | | - |
1336 | | - // Completely remove the data cache |
1337 | | - delete jQuery.cache[ id ]; |
1338 | | - } |
1339 | | - }, |
1340 | | - queue: function( elem, type, data ) { |
1341 | | - if ( elem ){ |
1342 | | - |
1343 | | - type = (type || "fx") + "queue"; |
1344 | | - |
1345 | | - var q = jQuery.data( elem, type ); |
1346 | | - |
1347 | | - if ( !q || jQuery.isArray(data) ) |
1348 | | - q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
1349 | | - else if( data ) |
1350 | | - q.push( data ); |
1351 | | - |
1352 | | - } |
1353 | | - return q; |
1354 | | - }, |
1355 | | - |
1356 | | - dequeue: function( elem, type ){ |
1357 | | - var queue = jQuery.queue( elem, type ), |
1358 | | - fn = queue.shift(); |
1359 | | - |
1360 | | - if( !type || type === "fx" ) |
1361 | | - fn = queue[0]; |
1362 | | - |
1363 | | - if( fn !== undefined ) |
1364 | | - fn.call(elem); |
1365 | | - } |
1366 | | -}); |
1367 | | - |
1368 | | -jQuery.fn.extend({ |
1369 | | - data: function( key, value ){ |
1370 | | - var parts = key.split("."); |
1371 | | - parts[1] = parts[1] ? "." + parts[1] : ""; |
1372 | | - |
1373 | | - if ( value === undefined ) { |
1374 | | - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
1375 | | - |
1376 | | - if ( data === undefined && this.length ) |
1377 | | - data = jQuery.data( this[0], key ); |
1378 | | - |
1379 | | - return data === undefined && parts[1] ? |
1380 | | - this.data( parts[0] ) : |
1381 | | - data; |
1382 | | - } else |
1383 | | - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ |
1384 | | - jQuery.data( this, key, value ); |
1385 | | - }); |
1386 | | - }, |
1387 | | - |
1388 | | - removeData: function( key ){ |
1389 | | - return this.each(function(){ |
1390 | | - jQuery.removeData( this, key ); |
1391 | | - }); |
1392 | | - }, |
1393 | | - queue: function(type, data){ |
1394 | | - if ( typeof type !== "string" ) { |
1395 | | - data = type; |
1396 | | - type = "fx"; |
1397 | | - } |
1398 | | - |
1399 | | - if ( data === undefined ) |
1400 | | - return jQuery.queue( this[0], type ); |
1401 | | - |
1402 | | - return this.each(function(){ |
1403 | | - var queue = jQuery.queue( this, type, data ); |
1404 | | - |
1405 | | - if( type == "fx" && queue.length == 1 ) |
1406 | | - queue[0].call(this); |
1407 | | - }); |
1408 | | - }, |
1409 | | - dequeue: function(type){ |
1410 | | - return this.each(function(){ |
1411 | | - jQuery.dequeue( this, type ); |
1412 | | - }); |
1413 | | - } |
1414 | | -});/*! |
1415 | | - * Sizzle CSS Selector Engine - v0.9.3 |
1416 | | - * Copyright 2009, The Dojo Foundation |
1417 | | - * Released under the MIT, BSD, and GPL Licenses. |
1418 | | - * More information: http://sizzlejs.com/ |
1419 | | - */ |
1420 | | -(function(){ |
1421 | | - |
1422 | | -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
1423 | | - done = 0, |
1424 | | - toString = Object.prototype.toString; |
1425 | | - |
1426 | | -var Sizzle = function(selector, context, results, seed) { |
1427 | | - results = results || []; |
1428 | | - context = context || document; |
1429 | | - |
1430 | | - if ( context.nodeType !== 1 && context.nodeType !== 9 ) |
1431 | | - return []; |
1432 | | - |
1433 | | - if ( !selector || typeof selector !== "string" ) { |
1434 | | - return results; |
1435 | | - } |
1436 | | - |
1437 | | - var parts = [], m, set, checkSet, check, mode, extra, prune = true; |
1438 | | - |
1439 | | - // Reset the position of the chunker regexp (start from head) |
1440 | | - chunker.lastIndex = 0; |
1441 | | - |
1442 | | - while ( (m = chunker.exec(selector)) !== null ) { |
1443 | | - parts.push( m[1] ); |
1444 | | - |
1445 | | - if ( m[2] ) { |
1446 | | - extra = RegExp.rightContext; |
1447 | | - break; |
1448 | | - } |
1449 | | - } |
1450 | | - |
1451 | | - if ( parts.length > 1 && origPOS.exec( selector ) ) { |
1452 | | - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
1453 | | - set = posProcess( parts[0] + parts[1], context ); |
1454 | | - } else { |
1455 | | - set = Expr.relative[ parts[0] ] ? |
1456 | | - [ context ] : |
1457 | | - Sizzle( parts.shift(), context ); |
1458 | | - |
1459 | | - while ( parts.length ) { |
1460 | | - selector = parts.shift(); |
1461 | | - |
1462 | | - if ( Expr.relative[ selector ] ) |
1463 | | - selector += parts.shift(); |
1464 | | - |
1465 | | - set = posProcess( selector, set ); |
1466 | | - } |
1467 | | - } |
1468 | | - } else { |
1469 | | - var ret = seed ? |
1470 | | - { expr: parts.pop(), set: makeArray(seed) } : |
1471 | | - Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) ); |
1472 | | - set = Sizzle.filter( ret.expr, ret.set ); |
1473 | | - |
1474 | | - if ( parts.length > 0 ) { |
1475 | | - checkSet = makeArray(set); |
1476 | | - } else { |
1477 | | - prune = false; |
1478 | | - } |
1479 | | - |
1480 | | - while ( parts.length ) { |
1481 | | - var cur = parts.pop(), pop = cur; |
1482 | | - |
1483 | | - if ( !Expr.relative[ cur ] ) { |
1484 | | - cur = ""; |
1485 | | - } else { |
1486 | | - pop = parts.pop(); |
1487 | | - } |
1488 | | - |
1489 | | - if ( pop == null ) { |
1490 | | - pop = context; |
1491 | | - } |
1492 | | - |
1493 | | - Expr.relative[ cur ]( checkSet, pop, isXML(context) ); |
1494 | | - } |
1495 | | - } |
1496 | | - |
1497 | | - if ( !checkSet ) { |
1498 | | - checkSet = set; |
1499 | | - } |
1500 | | - |
1501 | | - if ( !checkSet ) { |
1502 | | - throw "Syntax error, unrecognized expression: " + (cur || selector); |
1503 | | - } |
1504 | | - |
1505 | | - if ( toString.call(checkSet) === "[object Array]" ) { |
1506 | | - if ( !prune ) { |
1507 | | - results.push.apply( results, checkSet ); |
1508 | | - } else if ( context.nodeType === 1 ) { |
1509 | | - for ( var i = 0; checkSet[i] != null; i++ ) { |
1510 | | - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
1511 | | - results.push( set[i] ); |
1512 | | - } |
1513 | | - } |
1514 | | - } else { |
1515 | | - for ( var i = 0; checkSet[i] != null; i++ ) { |
1516 | | - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
1517 | | - results.push( set[i] ); |
1518 | | - } |
1519 | | - } |
1520 | | - } |
1521 | | - } else { |
1522 | | - makeArray( checkSet, results ); |
1523 | | - } |
1524 | | - |
1525 | | - if ( extra ) { |
1526 | | - Sizzle( extra, context, results, seed ); |
1527 | | - |
1528 | | - if ( sortOrder ) { |
1529 | | - hasDuplicate = false; |
1530 | | - results.sort(sortOrder); |
1531 | | - |
1532 | | - if ( hasDuplicate ) { |
1533 | | - for ( var i = 1; i < results.length; i++ ) { |
1534 | | - if ( results[i] === results[i-1] ) { |
1535 | | - results.splice(i--, 1); |
1536 | | - } |
1537 | | - } |
1538 | | - } |
1539 | | - } |
1540 | | - } |
1541 | | - |
1542 | | - return results; |
1543 | | -}; |
1544 | | - |
1545 | | -Sizzle.matches = function(expr, set){ |
1546 | | - return Sizzle(expr, null, null, set); |
1547 | | -}; |
1548 | | - |
1549 | | -Sizzle.find = function(expr, context, isXML){ |
1550 | | - var set, match; |
1551 | | - |
1552 | | - if ( !expr ) { |
1553 | | - return []; |
1554 | | - } |
1555 | | - |
1556 | | - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
1557 | | - var type = Expr.order[i], match; |
1558 | | - |
1559 | | - if ( (match = Expr.match[ type ].exec( expr )) ) { |
1560 | | - var left = RegExp.leftContext; |
1561 | | - |
1562 | | - if ( left.substr( left.length - 1 ) !== "\\" ) { |
1563 | | - match[1] = (match[1] || "").replace(/\\/g, ""); |
1564 | | - set = Expr.find[ type ]( match, context, isXML ); |
1565 | | - if ( set != null ) { |
1566 | | - expr = expr.replace( Expr.match[ type ], "" ); |
1567 | | - break; |
1568 | | - } |
1569 | | - } |
1570 | | - } |
1571 | | - } |
1572 | | - |
1573 | | - if ( !set ) { |
1574 | | - set = context.getElementsByTagName("*"); |
1575 | | - } |
1576 | | - |
1577 | | - return {set: set, expr: expr}; |
1578 | | -}; |
1579 | | - |
1580 | | -Sizzle.filter = function(expr, set, inplace, not){ |
1581 | | - var old = expr, result = [], curLoop = set, match, anyFound, |
1582 | | - isXMLFilter = set && set[0] && isXML(set[0]); |
1583 | | - |
1584 | | - while ( expr && set.length ) { |
1585 | | - for ( var type in Expr.filter ) { |
1586 | | - if ( (match = Expr.match[ type ].exec( expr )) != null ) { |
1587 | | - var filter = Expr.filter[ type ], found, item; |
1588 | | - anyFound = false; |
1589 | | - |
1590 | | - if ( curLoop == result ) { |
1591 | | - result = []; |
1592 | | - } |
1593 | | - |
1594 | | - if ( Expr.preFilter[ type ] ) { |
1595 | | - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
1596 | | - |
1597 | | - if ( !match ) { |
1598 | | - anyFound = found = true; |
1599 | | - } else if ( match === true ) { |
1600 | | - continue; |
1601 | | - } |
1602 | | - } |
1603 | | - |
1604 | | - if ( match ) { |
1605 | | - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
1606 | | - if ( item ) { |
1607 | | - found = filter( item, match, i, curLoop ); |
1608 | | - var pass = not ^ !!found; |
1609 | | - |
1610 | | - if ( inplace && found != null ) { |
1611 | | - if ( pass ) { |
1612 | | - anyFound = true; |
1613 | | - } else { |
1614 | | - curLoop[i] = false; |
1615 | | - } |
1616 | | - } else if ( pass ) { |
1617 | | - result.push( item ); |
1618 | | - anyFound = true; |
1619 | | - } |
1620 | | - } |
1621 | | - } |
1622 | | - } |
1623 | | - |
1624 | | - if ( found !== undefined ) { |
1625 | | - if ( !inplace ) { |
1626 | | - curLoop = result; |
1627 | | - } |
1628 | | - |
1629 | | - expr = expr.replace( Expr.match[ type ], "" ); |
1630 | | - |
1631 | | - if ( !anyFound ) { |
1632 | | - return []; |
1633 | | - } |
1634 | | - |
1635 | | - break; |
1636 | | - } |
1637 | | - } |
1638 | | - } |
1639 | | - |
1640 | | - // Improper expression |
1641 | | - if ( expr == old ) { |
1642 | | - if ( anyFound == null ) { |
1643 | | - throw "Syntax error, unrecognized expression: " + expr; |
1644 | | - } else { |
1645 | | - break; |
1646 | | - } |
1647 | | - } |
1648 | | - |
1649 | | - old = expr; |
1650 | | - } |
1651 | | - |
1652 | | - return curLoop; |
1653 | | -}; |
1654 | | - |
1655 | | -var Expr = Sizzle.selectors = { |
1656 | | - order: [ "ID", "NAME", "TAG" ], |
1657 | | - match: { |
1658 | | - ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
1659 | | - CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
1660 | | - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, |
1661 | | - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
1662 | | - TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, |
1663 | | - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
1664 | | - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
1665 | | - PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ |
1666 | | - }, |
1667 | | - attrMap: { |
1668 | | - "class": "className", |
1669 | | - "for": "htmlFor" |
1670 | | - }, |
1671 | | - attrHandle: { |
1672 | | - href: function(elem){ |
1673 | | - return elem.getAttribute("href"); |
1674 | | - } |
1675 | | - }, |
1676 | | - relative: { |
1677 | | - "+": function(checkSet, part, isXML){ |
1678 | | - var isPartStr = typeof part === "string", |
1679 | | - isTag = isPartStr && !/\W/.test(part), |
1680 | | - isPartStrNotTag = isPartStr && !isTag; |
1681 | | - |
1682 | | - if ( isTag && !isXML ) { |
1683 | | - part = part.toUpperCase(); |
1684 | | - } |
1685 | | - |
1686 | | - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
1687 | | - if ( (elem = checkSet[i]) ) { |
1688 | | - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
1689 | | - |
1690 | | - checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? |
1691 | | - elem || false : |
1692 | | - elem === part; |
1693 | | - } |
1694 | | - } |
1695 | | - |
1696 | | - if ( isPartStrNotTag ) { |
1697 | | - Sizzle.filter( part, checkSet, true ); |
1698 | | - } |
1699 | | - }, |
1700 | | - ">": function(checkSet, part, isXML){ |
1701 | | - var isPartStr = typeof part === "string"; |
1702 | | - |
1703 | | - if ( isPartStr && !/\W/.test(part) ) { |
1704 | | - part = isXML ? part : part.toUpperCase(); |
1705 | | - |
1706 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
1707 | | - var elem = checkSet[i]; |
1708 | | - if ( elem ) { |
1709 | | - var parent = elem.parentNode; |
1710 | | - checkSet[i] = parent.nodeName === part ? parent : false; |
1711 | | - } |
1712 | | - } |
1713 | | - } else { |
1714 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
1715 | | - var elem = checkSet[i]; |
1716 | | - if ( elem ) { |
1717 | | - checkSet[i] = isPartStr ? |
1718 | | - elem.parentNode : |
1719 | | - elem.parentNode === part; |
1720 | | - } |
1721 | | - } |
1722 | | - |
1723 | | - if ( isPartStr ) { |
1724 | | - Sizzle.filter( part, checkSet, true ); |
1725 | | - } |
1726 | | - } |
1727 | | - }, |
1728 | | - "": function(checkSet, part, isXML){ |
1729 | | - var doneName = done++, checkFn = dirCheck; |
1730 | | - |
1731 | | - if ( !part.match(/\W/) ) { |
1732 | | - var nodeCheck = part = isXML ? part : part.toUpperCase(); |
1733 | | - checkFn = dirNodeCheck; |
1734 | | - } |
1735 | | - |
1736 | | - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
1737 | | - }, |
1738 | | - "~": function(checkSet, part, isXML){ |
1739 | | - var doneName = done++, checkFn = dirCheck; |
1740 | | - |
1741 | | - if ( typeof part === "string" && !part.match(/\W/) ) { |
1742 | | - var nodeCheck = part = isXML ? part : part.toUpperCase(); |
1743 | | - checkFn = dirNodeCheck; |
1744 | | - } |
1745 | | - |
1746 | | - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
1747 | | - } |
1748 | | - }, |
1749 | | - find: { |
1750 | | - ID: function(match, context, isXML){ |
1751 | | - if ( typeof context.getElementById !== "undefined" && !isXML ) { |
1752 | | - var m = context.getElementById(match[1]); |
1753 | | - return m ? [m] : []; |
1754 | | - } |
1755 | | - }, |
1756 | | - NAME: function(match, context, isXML){ |
1757 | | - if ( typeof context.getElementsByName !== "undefined" ) { |
1758 | | - var ret = [], results = context.getElementsByName(match[1]); |
1759 | | - |
1760 | | - for ( var i = 0, l = results.length; i < l; i++ ) { |
1761 | | - if ( results[i].getAttribute("name") === match[1] ) { |
1762 | | - ret.push( results[i] ); |
1763 | | - } |
1764 | | - } |
1765 | | - |
1766 | | - return ret.length === 0 ? null : ret; |
1767 | | - } |
1768 | | - }, |
1769 | | - TAG: function(match, context){ |
1770 | | - return context.getElementsByTagName(match[1]); |
1771 | | - } |
1772 | | - }, |
1773 | | - preFilter: { |
1774 | | - CLASS: function(match, curLoop, inplace, result, not, isXML){ |
1775 | | - match = " " + match[1].replace(/\\/g, "") + " "; |
1776 | | - |
1777 | | - if ( isXML ) { |
1778 | | - return match; |
1779 | | - } |
1780 | | - |
1781 | | - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
1782 | | - if ( elem ) { |
1783 | | - if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { |
1784 | | - if ( !inplace ) |
1785 | | - result.push( elem ); |
1786 | | - } else if ( inplace ) { |
1787 | | - curLoop[i] = false; |
1788 | | - } |
1789 | | - } |
1790 | | - } |
1791 | | - |
1792 | | - return false; |
1793 | | - }, |
1794 | | - ID: function(match){ |
1795 | | - return match[1].replace(/\\/g, ""); |
1796 | | - }, |
1797 | | - TAG: function(match, curLoop){ |
1798 | | - for ( var i = 0; curLoop[i] === false; i++ ){} |
1799 | | - return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); |
1800 | | - }, |
1801 | | - CHILD: function(match){ |
1802 | | - if ( match[1] == "nth" ) { |
1803 | | - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
1804 | | - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
1805 | | - match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || |
1806 | | - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
1807 | | - |
1808 | | - // calculate the numbers (first)n+(last) including if they are negative |
1809 | | - match[2] = (test[1] + (test[2] || 1)) - 0; |
1810 | | - match[3] = test[3] - 0; |
1811 | | - } |
1812 | | - |
1813 | | - // TODO: Move to normal caching system |
1814 | | - match[0] = done++; |
1815 | | - |
1816 | | - return match; |
1817 | | - }, |
1818 | | - ATTR: function(match, curLoop, inplace, result, not, isXML){ |
1819 | | - var name = match[1].replace(/\\/g, ""); |
1820 | | - |
1821 | | - if ( !isXML && Expr.attrMap[name] ) { |
1822 | | - match[1] = Expr.attrMap[name]; |
1823 | | - } |
1824 | | - |
1825 | | - if ( match[2] === "~=" ) { |
1826 | | - match[4] = " " + match[4] + " "; |
1827 | | - } |
1828 | | - |
1829 | | - return match; |
1830 | | - }, |
1831 | | - PSEUDO: function(match, curLoop, inplace, result, not){ |
1832 | | - if ( match[1] === "not" ) { |
1833 | | - // If we're dealing with a complex expression, or a simple one |
1834 | | - if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { |
1835 | | - match[3] = Sizzle(match[3], null, null, curLoop); |
1836 | | - } else { |
1837 | | - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
1838 | | - if ( !inplace ) { |
1839 | | - result.push.apply( result, ret ); |
1840 | | - } |
1841 | | - return false; |
1842 | | - } |
1843 | | - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
1844 | | - return true; |
1845 | | - } |
1846 | | - |
1847 | | - return match; |
1848 | | - }, |
1849 | | - POS: function(match){ |
1850 | | - match.unshift( true ); |
1851 | | - return match; |
1852 | | - } |
1853 | | - }, |
1854 | | - filters: { |
1855 | | - enabled: function(elem){ |
1856 | | - return elem.disabled === false && elem.type !== "hidden"; |
1857 | | - }, |
1858 | | - disabled: function(elem){ |
1859 | | - return elem.disabled === true; |
1860 | | - }, |
1861 | | - checked: function(elem){ |
1862 | | - return elem.checked === true; |
1863 | | - }, |
1864 | | - selected: function(elem){ |
1865 | | - // Accessing this property makes selected-by-default |
1866 | | - // options in Safari work properly |
1867 | | - elem.parentNode.selectedIndex; |
1868 | | - return elem.selected === true; |
1869 | | - }, |
1870 | | - parent: function(elem){ |
1871 | | - return !!elem.firstChild; |
1872 | | - }, |
1873 | | - empty: function(elem){ |
1874 | | - return !elem.firstChild; |
1875 | | - }, |
1876 | | - has: function(elem, i, match){ |
1877 | | - return !!Sizzle( match[3], elem ).length; |
1878 | | - }, |
1879 | | - header: function(elem){ |
1880 | | - return /h\d/i.test( elem.nodeName ); |
1881 | | - }, |
1882 | | - text: function(elem){ |
1883 | | - return "text" === elem.type; |
1884 | | - }, |
1885 | | - radio: function(elem){ |
1886 | | - return "radio" === elem.type; |
1887 | | - }, |
1888 | | - checkbox: function(elem){ |
1889 | | - return "checkbox" === elem.type; |
1890 | | - }, |
1891 | | - file: function(elem){ |
1892 | | - return "file" === elem.type; |
1893 | | - }, |
1894 | | - password: function(elem){ |
1895 | | - return "password" === elem.type; |
1896 | | - }, |
1897 | | - submit: function(elem){ |
1898 | | - return "submit" === elem.type; |
1899 | | - }, |
1900 | | - image: function(elem){ |
1901 | | - return "image" === elem.type; |
1902 | | - }, |
1903 | | - reset: function(elem){ |
1904 | | - return "reset" === elem.type; |
1905 | | - }, |
1906 | | - button: function(elem){ |
1907 | | - return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; |
1908 | | - }, |
1909 | | - input: function(elem){ |
1910 | | - return /input|select|textarea|button/i.test(elem.nodeName); |
1911 | | - } |
1912 | | - }, |
1913 | | - setFilters: { |
1914 | | - first: function(elem, i){ |
1915 | | - return i === 0; |
1916 | | - }, |
1917 | | - last: function(elem, i, match, array){ |
1918 | | - return i === array.length - 1; |
1919 | | - }, |
1920 | | - even: function(elem, i){ |
1921 | | - return i % 2 === 0; |
1922 | | - }, |
1923 | | - odd: function(elem, i){ |
1924 | | - return i % 2 === 1; |
1925 | | - }, |
1926 | | - lt: function(elem, i, match){ |
1927 | | - return i < match[3] - 0; |
1928 | | - }, |
1929 | | - gt: function(elem, i, match){ |
1930 | | - return i > match[3] - 0; |
1931 | | - }, |
1932 | | - nth: function(elem, i, match){ |
1933 | | - return match[3] - 0 == i; |
1934 | | - }, |
1935 | | - eq: function(elem, i, match){ |
1936 | | - return match[3] - 0 == i; |
1937 | | - } |
1938 | | - }, |
1939 | | - filter: { |
1940 | | - PSEUDO: function(elem, match, i, array){ |
1941 | | - var name = match[1], filter = Expr.filters[ name ]; |
1942 | | - |
1943 | | - if ( filter ) { |
1944 | | - return filter( elem, i, match, array ); |
1945 | | - } else if ( name === "contains" ) { |
1946 | | - return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; |
1947 | | - } else if ( name === "not" ) { |
1948 | | - var not = match[3]; |
1949 | | - |
1950 | | - for ( var i = 0, l = not.length; i < l; i++ ) { |
1951 | | - if ( not[i] === elem ) { |
1952 | | - return false; |
1953 | | - } |
1954 | | - } |
1955 | | - |
1956 | | - return true; |
1957 | | - } |
1958 | | - }, |
1959 | | - CHILD: function(elem, match){ |
1960 | | - var type = match[1], node = elem; |
1961 | | - switch (type) { |
1962 | | - case 'only': |
1963 | | - case 'first': |
1964 | | - while (node = node.previousSibling) { |
1965 | | - if ( node.nodeType === 1 ) return false; |
1966 | | - } |
1967 | | - if ( type == 'first') return true; |
1968 | | - node = elem; |
1969 | | - case 'last': |
1970 | | - while (node = node.nextSibling) { |
1971 | | - if ( node.nodeType === 1 ) return false; |
1972 | | - } |
1973 | | - return true; |
1974 | | - case 'nth': |
1975 | | - var first = match[2], last = match[3]; |
1976 | | - |
1977 | | - if ( first == 1 && last == 0 ) { |
1978 | | - return true; |
1979 | | - } |
1980 | | - |
1981 | | - var doneName = match[0], |
1982 | | - parent = elem.parentNode; |
1983 | | - |
1984 | | - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
1985 | | - var count = 0; |
1986 | | - for ( node = parent.firstChild; node; node = node.nextSibling ) { |
1987 | | - if ( node.nodeType === 1 ) { |
1988 | | - node.nodeIndex = ++count; |
1989 | | - } |
1990 | | - } |
1991 | | - parent.sizcache = doneName; |
1992 | | - } |
1993 | | - |
1994 | | - var diff = elem.nodeIndex - last; |
1995 | | - if ( first == 0 ) { |
1996 | | - return diff == 0; |
1997 | | - } else { |
1998 | | - return ( diff % first == 0 && diff / first >= 0 ); |
1999 | | - } |
2000 | | - } |
2001 | | - }, |
2002 | | - ID: function(elem, match){ |
2003 | | - return elem.nodeType === 1 && elem.getAttribute("id") === match; |
2004 | | - }, |
2005 | | - TAG: function(elem, match){ |
2006 | | - return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; |
2007 | | - }, |
2008 | | - CLASS: function(elem, match){ |
2009 | | - return (" " + (elem.className || elem.getAttribute("class")) + " ") |
2010 | | - .indexOf( match ) > -1; |
2011 | | - }, |
2012 | | - ATTR: function(elem, match){ |
2013 | | - var name = match[1], |
2014 | | - result = Expr.attrHandle[ name ] ? |
2015 | | - Expr.attrHandle[ name ]( elem ) : |
2016 | | - elem[ name ] != null ? |
2017 | | - elem[ name ] : |
2018 | | - elem.getAttribute( name ), |
2019 | | - value = result + "", |
2020 | | - type = match[2], |
2021 | | - check = match[4]; |
2022 | | - |
2023 | | - return result == null ? |
2024 | | - type === "!=" : |
2025 | | - type === "=" ? |
2026 | | - value === check : |
2027 | | - type === "*=" ? |
2028 | | - value.indexOf(check) >= 0 : |
2029 | | - type === "~=" ? |
2030 | | - (" " + value + " ").indexOf(check) >= 0 : |
2031 | | - !check ? |
2032 | | - value && result !== false : |
2033 | | - type === "!=" ? |
2034 | | - value != check : |
2035 | | - type === "^=" ? |
2036 | | - value.indexOf(check) === 0 : |
2037 | | - type === "$=" ? |
2038 | | - value.substr(value.length - check.length) === check : |
2039 | | - type === "|=" ? |
2040 | | - value === check || value.substr(0, check.length + 1) === check + "-" : |
2041 | | - false; |
2042 | | - }, |
2043 | | - POS: function(elem, match, i, array){ |
2044 | | - var name = match[2], filter = Expr.setFilters[ name ]; |
2045 | | - |
2046 | | - if ( filter ) { |
2047 | | - return filter( elem, i, match, array ); |
2048 | | - } |
2049 | | - } |
2050 | | - } |
2051 | | -}; |
2052 | | - |
2053 | | -var origPOS = Expr.match.POS; |
2054 | | - |
2055 | | -for ( var type in Expr.match ) { |
2056 | | - Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
2057 | | -} |
2058 | | - |
2059 | | -var makeArray = function(array, results) { |
2060 | | - array = Array.prototype.slice.call( array ); |
2061 | | - |
2062 | | - if ( results ) { |
2063 | | - results.push.apply( results, array ); |
2064 | | - return results; |
2065 | | - } |
2066 | | - |
2067 | | - return array; |
2068 | | -}; |
2069 | | - |
2070 | | -// Perform a simple check to determine if the browser is capable of |
2071 | | -// converting a NodeList to an array using builtin methods. |
2072 | | -try { |
2073 | | - Array.prototype.slice.call( document.documentElement.childNodes ); |
2074 | | - |
2075 | | -// Provide a fallback method if it does not work |
2076 | | -} catch(e){ |
2077 | | - makeArray = function(array, results) { |
2078 | | - var ret = results || []; |
2079 | | - |
2080 | | - if ( toString.call(array) === "[object Array]" ) { |
2081 | | - Array.prototype.push.apply( ret, array ); |
2082 | | - } else { |
2083 | | - if ( typeof array.length === "number" ) { |
2084 | | - for ( var i = 0, l = array.length; i < l; i++ ) { |
2085 | | - ret.push( array[i] ); |
2086 | | - } |
2087 | | - } else { |
2088 | | - for ( var i = 0; array[i]; i++ ) { |
2089 | | - ret.push( array[i] ); |
2090 | | - } |
2091 | | - } |
2092 | | - } |
2093 | | - |
2094 | | - return ret; |
2095 | | - }; |
2096 | | -} |
2097 | | - |
2098 | | -var sortOrder; |
2099 | | - |
2100 | | -if ( document.documentElement.compareDocumentPosition ) { |
2101 | | - sortOrder = function( a, b ) { |
2102 | | - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
2103 | | - if ( ret === 0 ) { |
2104 | | - hasDuplicate = true; |
2105 | | - } |
2106 | | - return ret; |
2107 | | - }; |
2108 | | -} else if ( "sourceIndex" in document.documentElement ) { |
2109 | | - sortOrder = function( a, b ) { |
2110 | | - var ret = a.sourceIndex - b.sourceIndex; |
2111 | | - if ( ret === 0 ) { |
2112 | | - hasDuplicate = true; |
2113 | | - } |
2114 | | - return ret; |
2115 | | - }; |
2116 | | -} else if ( document.createRange ) { |
2117 | | - sortOrder = function( a, b ) { |
2118 | | - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
2119 | | - aRange.selectNode(a); |
2120 | | - aRange.collapse(true); |
2121 | | - bRange.selectNode(b); |
2122 | | - bRange.collapse(true); |
2123 | | - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
2124 | | - if ( ret === 0 ) { |
2125 | | - hasDuplicate = true; |
2126 | | - } |
2127 | | - return ret; |
2128 | | - }; |
2129 | | -} |
2130 | | - |
2131 | | -// Check to see if the browser returns elements by name when |
2132 | | -// querying by getElementById (and provide a workaround) |
2133 | | -(function(){ |
2134 | | - // We're going to inject a fake input element with a specified name |
2135 | | - var form = document.createElement("form"), |
2136 | | - id = "script" + (new Date).getTime(); |
2137 | | - form.innerHTML = "<input name='" + id + "'/>"; |
2138 | | - |
2139 | | - // Inject it into the root element, check its status, and remove it quickly |
2140 | | - var root = document.documentElement; |
2141 | | - root.insertBefore( form, root.firstChild ); |
2142 | | - |
2143 | | - // The workaround has to do additional checks after a getElementById |
2144 | | - // Which slows things down for other browsers (hence the branching) |
2145 | | - if ( !!document.getElementById( id ) ) { |
2146 | | - Expr.find.ID = function(match, context, isXML){ |
2147 | | - if ( typeof context.getElementById !== "undefined" && !isXML ) { |
2148 | | - var m = context.getElementById(match[1]); |
2149 | | - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
2150 | | - } |
2151 | | - }; |
2152 | | - |
2153 | | - Expr.filter.ID = function(elem, match){ |
2154 | | - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
2155 | | - return elem.nodeType === 1 && node && node.nodeValue === match; |
2156 | | - }; |
2157 | | - } |
2158 | | - |
2159 | | - root.removeChild( form ); |
2160 | | -})(); |
2161 | | - |
2162 | | -(function(){ |
2163 | | - // Check to see if the browser returns only elements |
2164 | | - // when doing getElementsByTagName("*") |
2165 | | - |
2166 | | - // Create a fake element |
2167 | | - var div = document.createElement("div"); |
2168 | | - div.appendChild( document.createComment("") ); |
2169 | | - |
2170 | | - // Make sure no comments are found |
2171 | | - if ( div.getElementsByTagName("*").length > 0 ) { |
2172 | | - Expr.find.TAG = function(match, context){ |
2173 | | - var results = context.getElementsByTagName(match[1]); |
2174 | | - |
2175 | | - // Filter out possible comments |
2176 | | - if ( match[1] === "*" ) { |
2177 | | - var tmp = []; |
2178 | | - |
2179 | | - for ( var i = 0; results[i]; i++ ) { |
2180 | | - if ( results[i].nodeType === 1 ) { |
2181 | | - tmp.push( results[i] ); |
2182 | | - } |
2183 | | - } |
2184 | | - |
2185 | | - results = tmp; |
2186 | | - } |
2187 | | - |
2188 | | - return results; |
2189 | | - }; |
2190 | | - } |
2191 | | - |
2192 | | - // Check to see if an attribute returns normalized href attributes |
2193 | | - div.innerHTML = "<a href='#'></a>"; |
2194 | | - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
2195 | | - div.firstChild.getAttribute("href") !== "#" ) { |
2196 | | - Expr.attrHandle.href = function(elem){ |
2197 | | - return elem.getAttribute("href", 2); |
2198 | | - }; |
2199 | | - } |
2200 | | -})(); |
2201 | | - |
2202 | | -if ( document.querySelectorAll ) (function(){ |
2203 | | - var oldSizzle = Sizzle, div = document.createElement("div"); |
2204 | | - div.innerHTML = "<p class='TEST'></p>"; |
2205 | | - |
2206 | | - // Safari can't handle uppercase or unicode characters when |
2207 | | - // in quirks mode. |
2208 | | - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
2209 | | - return; |
2210 | | - } |
2211 | | - |
2212 | | - Sizzle = function(query, context, extra, seed){ |
2213 | | - context = context || document; |
2214 | | - |
2215 | | - // Only use querySelectorAll on non-XML documents |
2216 | | - // (ID selectors don't work in non-HTML documents) |
2217 | | - if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
2218 | | - try { |
2219 | | - return makeArray( context.querySelectorAll(query), extra ); |
2220 | | - } catch(e){} |
2221 | | - } |
2222 | | - |
2223 | | - return oldSizzle(query, context, extra, seed); |
2224 | | - }; |
2225 | | - |
2226 | | - Sizzle.find = oldSizzle.find; |
2227 | | - Sizzle.filter = oldSizzle.filter; |
2228 | | - Sizzle.selectors = oldSizzle.selectors; |
2229 | | - Sizzle.matches = oldSizzle.matches; |
2230 | | -})(); |
2231 | | - |
2232 | | -if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ |
2233 | | - var div = document.createElement("div"); |
2234 | | - div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
2235 | | - |
2236 | | - // Opera can't find a second classname (in 9.6) |
2237 | | - if ( div.getElementsByClassName("e").length === 0 ) |
2238 | | - return; |
2239 | | - |
2240 | | - // Safari caches class attributes, doesn't catch changes (in 3.2) |
2241 | | - div.lastChild.className = "e"; |
2242 | | - |
2243 | | - if ( div.getElementsByClassName("e").length === 1 ) |
2244 | | - return; |
2245 | | - |
2246 | | - Expr.order.splice(1, 0, "CLASS"); |
2247 | | - Expr.find.CLASS = function(match, context, isXML) { |
2248 | | - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
2249 | | - return context.getElementsByClassName(match[1]); |
2250 | | - } |
2251 | | - }; |
2252 | | -})(); |
2253 | | - |
2254 | | -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
2255 | | - var sibDir = dir == "previousSibling" && !isXML; |
2256 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
2257 | | - var elem = checkSet[i]; |
2258 | | - if ( elem ) { |
2259 | | - if ( sibDir && elem.nodeType === 1 ){ |
2260 | | - elem.sizcache = doneName; |
2261 | | - elem.sizset = i; |
2262 | | - } |
2263 | | - elem = elem[dir]; |
2264 | | - var match = false; |
2265 | | - |
2266 | | - while ( elem ) { |
2267 | | - if ( elem.sizcache === doneName ) { |
2268 | | - match = checkSet[elem.sizset]; |
2269 | | - break; |
2270 | | - } |
2271 | | - |
2272 | | - if ( elem.nodeType === 1 && !isXML ){ |
2273 | | - elem.sizcache = doneName; |
2274 | | - elem.sizset = i; |
2275 | | - } |
2276 | | - |
2277 | | - if ( elem.nodeName === cur ) { |
2278 | | - match = elem; |
2279 | | - break; |
2280 | | - } |
2281 | | - |
2282 | | - elem = elem[dir]; |
2283 | | - } |
2284 | | - |
2285 | | - checkSet[i] = match; |
2286 | | - } |
2287 | | - } |
2288 | | -} |
2289 | | - |
2290 | | -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
2291 | | - var sibDir = dir == "previousSibling" && !isXML; |
2292 | | - for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
2293 | | - var elem = checkSet[i]; |
2294 | | - if ( elem ) { |
2295 | | - if ( sibDir && elem.nodeType === 1 ) { |
2296 | | - elem.sizcache = doneName; |
2297 | | - elem.sizset = i; |
2298 | | - } |
2299 | | - elem = elem[dir]; |
2300 | | - var match = false; |
2301 | | - |
2302 | | - while ( elem ) { |
2303 | | - if ( elem.sizcache === doneName ) { |
2304 | | - match = checkSet[elem.sizset]; |
2305 | | - break; |
2306 | | - } |
2307 | | - |
2308 | | - if ( elem.nodeType === 1 ) { |
2309 | | - if ( !isXML ) { |
2310 | | - elem.sizcache = doneName; |
2311 | | - elem.sizset = i; |
2312 | | - } |
2313 | | - if ( typeof cur !== "string" ) { |
2314 | | - if ( elem === cur ) { |
2315 | | - match = true; |
2316 | | - break; |
2317 | | - } |
2318 | | - |
2319 | | - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
2320 | | - match = elem; |
2321 | | - break; |
2322 | | - } |
2323 | | - } |
2324 | | - |
2325 | | - elem = elem[dir]; |
2326 | | - } |
2327 | | - |
2328 | | - checkSet[i] = match; |
2329 | | - } |
2330 | | - } |
2331 | | -} |
2332 | | - |
2333 | | -var contains = document.compareDocumentPosition ? function(a, b){ |
2334 | | - return a.compareDocumentPosition(b) & 16; |
2335 | | -} : function(a, b){ |
2336 | | - return a !== b && (a.contains ? a.contains(b) : true); |
2337 | | -}; |
2338 | | - |
2339 | | -var isXML = function(elem){ |
2340 | | - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
2341 | | - !!elem.ownerDocument && isXML( elem.ownerDocument ); |
2342 | | -}; |
2343 | | - |
2344 | | -var posProcess = function(selector, context){ |
2345 | | - var tmpSet = [], later = "", match, |
2346 | | - root = context.nodeType ? [context] : context; |
2347 | | - |
2348 | | - // Position selectors must be done after the filter |
2349 | | - // And so must :not(positional) so we move all PSEUDOs to the end |
2350 | | - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
2351 | | - later += match[0]; |
2352 | | - selector = selector.replace( Expr.match.PSEUDO, "" ); |
2353 | | - } |
2354 | | - |
2355 | | - selector = Expr.relative[selector] ? selector + "*" : selector; |
2356 | | - |
2357 | | - for ( var i = 0, l = root.length; i < l; i++ ) { |
2358 | | - Sizzle( selector, root[i], tmpSet ); |
2359 | | - } |
2360 | | - |
2361 | | - return Sizzle.filter( later, tmpSet ); |
2362 | | -}; |
2363 | | - |
2364 | | -// EXPOSE |
2365 | | -jQuery.find = Sizzle; |
2366 | | -jQuery.filter = Sizzle.filter; |
2367 | | -jQuery.expr = Sizzle.selectors; |
2368 | | -jQuery.expr[":"] = jQuery.expr.filters; |
2369 | | - |
2370 | | -Sizzle.selectors.filters.hidden = function(elem){ |
2371 | | - return elem.offsetWidth === 0 || elem.offsetHeight === 0; |
2372 | | -}; |
2373 | | - |
2374 | | -Sizzle.selectors.filters.visible = function(elem){ |
2375 | | - return elem.offsetWidth > 0 || elem.offsetHeight > 0; |
2376 | | -}; |
2377 | | - |
2378 | | -Sizzle.selectors.filters.animated = function(elem){ |
2379 | | - return jQuery.grep(jQuery.timers, function(fn){ |
2380 | | - return elem === fn.elem; |
2381 | | - }).length; |
2382 | | -}; |
2383 | | - |
2384 | | -jQuery.multiFilter = function( expr, elems, not ) { |
2385 | | - if ( not ) { |
2386 | | - expr = ":not(" + expr + ")"; |
2387 | | - } |
2388 | | - |
2389 | | - return Sizzle.matches(expr, elems); |
2390 | | -}; |
2391 | | - |
2392 | | -jQuery.dir = function( elem, dir ){ |
2393 | | - var matched = [], cur = elem[dir]; |
2394 | | - while ( cur && cur != document ) { |
2395 | | - if ( cur.nodeType == 1 ) |
2396 | | - matched.push( cur ); |
2397 | | - cur = cur[dir]; |
2398 | | - } |
2399 | | - return matched; |
2400 | | -}; |
2401 | | - |
2402 | | -jQuery.nth = function(cur, result, dir, elem){ |
2403 | | - result = result || 1; |
2404 | | - var num = 0; |
2405 | | - |
2406 | | - for ( ; cur; cur = cur[dir] ) |
2407 | | - if ( cur.nodeType == 1 && ++num == result ) |
2408 | | - break; |
2409 | | - |
2410 | | - return cur; |
2411 | | -}; |
2412 | | - |
2413 | | -jQuery.sibling = function(n, elem){ |
2414 | | - var r = []; |
2415 | | - |
2416 | | - for ( ; n; n = n.nextSibling ) { |
2417 | | - if ( n.nodeType == 1 && n != elem ) |
2418 | | - r.push( n ); |
2419 | | - } |
2420 | | - |
2421 | | - return r; |
2422 | | -}; |
2423 | | - |
2424 | | -return; |
2425 | | - |
2426 | | -window.Sizzle = Sizzle; |
2427 | | - |
2428 | | -})(); |
2429 | | -/* |
2430 | | - * A number of helper functions used for managing events. |
2431 | | - * Many of the ideas behind this code originated from |
2432 | | - * Dean Edwards' addEvent library. |
2433 | | - */ |
2434 | | -jQuery.event = { |
2435 | | - |
2436 | | - // Bind an event to an element |
2437 | | - // Original by Dean Edwards |
2438 | | - add: function(elem, types, handler, data) { |
2439 | | - if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
2440 | | - return; |
2441 | | - |
2442 | | - // For whatever reason, IE has trouble passing the window object |
2443 | | - // around, causing it to be cloned in the process |
2444 | | - if ( elem.setInterval && elem != window ) |
2445 | | - elem = window; |
2446 | | - |
2447 | | - // Make sure that the function being executed has a unique ID |
2448 | | - if ( !handler.guid ) |
2449 | | - handler.guid = this.guid++; |
2450 | | - |
2451 | | - // if data is passed, bind to handler |
2452 | | - if ( data !== undefined ) { |
2453 | | - // Create temporary function pointer to original handler |
2454 | | - var fn = handler; |
2455 | | - |
2456 | | - // Create unique handler function, wrapped around original handler |
2457 | | - handler = this.proxy( fn ); |
2458 | | - |
2459 | | - // Store data in unique handler |
2460 | | - handler.data = data; |
2461 | | - } |
2462 | | - |
2463 | | - // Init the element's event structure |
2464 | | - var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), |
2465 | | - handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ |
2466 | | - // Handle the second event of a trigger and when |
2467 | | - // an event is called after a page has unloaded |
2468 | | - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
2469 | | - jQuery.event.handle.apply(arguments.callee.elem, arguments) : |
2470 | | - undefined; |
2471 | | - }); |
2472 | | - // Add elem as a property of the handle function |
2473 | | - // This is to prevent a memory leak with non-native |
2474 | | - // event in IE. |
2475 | | - handle.elem = elem; |
2476 | | - |
2477 | | - // Handle multiple events separated by a space |
2478 | | - // jQuery(...).bind("mouseover mouseout", fn); |
2479 | | - jQuery.each(types.split(/\s+/), function(index, type) { |
2480 | | - // Namespaced event handlers |
2481 | | - var namespaces = type.split("."); |
2482 | | - type = namespaces.shift(); |
2483 | | - handler.type = namespaces.slice().sort().join("."); |
2484 | | - |
2485 | | - // Get the current list of functions bound to this event |
2486 | | - var handlers = events[type]; |
2487 | | - |
2488 | | - if ( jQuery.event.specialAll[type] ) |
2489 | | - jQuery.event.specialAll[type].setup.call(elem, data, namespaces); |
2490 | | - |
2491 | | - // Init the event handler queue |
2492 | | - if (!handlers) { |
2493 | | - handlers = events[type] = {}; |
2494 | | - |
2495 | | - // Check for a special event handler |
2496 | | - // Only use addEventListener/attachEvent if the special |
2497 | | - // events handler returns false |
2498 | | - if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) { |
2499 | | - // Bind the global event handler to the element |
2500 | | - if (elem.addEventListener) |
2501 | | - elem.addEventListener(type, handle, false); |
2502 | | - else if (elem.attachEvent) |
2503 | | - elem.attachEvent("on" + type, handle); |
2504 | | - } |
2505 | | - } |
2506 | | - |
2507 | | - // Add the function to the element's handler list |
2508 | | - handlers[handler.guid] = handler; |
2509 | | - |
2510 | | - // Keep track of which events have been used, for global triggering |
2511 | | - jQuery.event.global[type] = true; |
2512 | | - }); |
2513 | | - |
2514 | | - // Nullify elem to prevent memory leaks in IE |
2515 | | - elem = null; |
2516 | | - }, |
2517 | | - |
2518 | | - guid: 1, |
2519 | | - global: {}, |
2520 | | - |
2521 | | - // Detach an event or set of events from an element |
2522 | | - remove: function(elem, types, handler) { |
2523 | | - // don't do events on text and comment nodes |
2524 | | - if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
2525 | | - return; |
2526 | | - |
2527 | | - var events = jQuery.data(elem, "events"), ret, index; |
2528 | | - |
2529 | | - if ( events ) { |
2530 | | - // Unbind all events for the element |
2531 | | - if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") ) |
2532 | | - for ( var type in events ) |
2533 | | - this.remove( elem, type + (types || "") ); |
2534 | | - else { |
2535 | | - // types is actually an event object here |
2536 | | - if ( types.type ) { |
2537 | | - handler = types.handler; |
2538 | | - types = types.type; |
2539 | | - } |
2540 | | - |
2541 | | - // Handle multiple events seperated by a space |
2542 | | - // jQuery(...).unbind("mouseover mouseout", fn); |
2543 | | - jQuery.each(types.split(/\s+/), function(index, type){ |
2544 | | - // Namespaced event handlers |
2545 | | - var namespaces = type.split("."); |
2546 | | - type = namespaces.shift(); |
2547 | | - var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
2548 | | - |
2549 | | - if ( events[type] ) { |
2550 | | - // remove the given handler for the given type |
2551 | | - if ( handler ) |
2552 | | - delete events[type][handler.guid]; |
2553 | | - |
2554 | | - // remove all handlers for the given type |
2555 | | - else |
2556 | | - for ( var handle in events[type] ) |
2557 | | - // Handle the removal of namespaced events |
2558 | | - if ( namespace.test(events[type][handle].type) ) |
2559 | | - delete events[type][handle]; |
2560 | | - |
2561 | | - if ( jQuery.event.specialAll[type] ) |
2562 | | - jQuery.event.specialAll[type].teardown.call(elem, namespaces); |
2563 | | - |
2564 | | - // remove generic event handler if no more handlers exist |
2565 | | - for ( ret in events[type] ) break; |
2566 | | - if ( !ret ) { |
2567 | | - if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) { |
2568 | | - if (elem.removeEventListener) |
2569 | | - elem.removeEventListener(type, jQuery.data(elem, "handle"), false); |
2570 | | - else if (elem.detachEvent) |
2571 | | - elem.detachEvent("on" + type, jQuery.data(elem, "handle")); |
2572 | | - } |
2573 | | - ret = null; |
2574 | | - delete events[type]; |
2575 | | - } |
2576 | | - } |
2577 | | - }); |
2578 | | - } |
2579 | | - |
2580 | | - // Remove the expando if it's no longer used |
2581 | | - for ( ret in events ) break; |
2582 | | - if ( !ret ) { |
2583 | | - var handle = jQuery.data( elem, "handle" ); |
2584 | | - if ( handle ) handle.elem = null; |
2585 | | - jQuery.removeData( elem, "events" ); |
2586 | | - jQuery.removeData( elem, "handle" ); |
2587 | | - } |
2588 | | - } |
2589 | | - }, |
2590 | | - |
2591 | | - // bubbling is internal |
2592 | | - trigger: function( event, data, elem, bubbling ) { |
2593 | | - // Event object or event type |
2594 | | - var type = event.type || event; |
2595 | | - |
2596 | | - if( !bubbling ){ |
2597 | | - event = typeof event === "object" ? |
2598 | | - // jQuery.Event object |
2599 | | - event[expando] ? event : |
2600 | | - // Object literal |
2601 | | - jQuery.extend( jQuery.Event(type), event ) : |
2602 | | - // Just the event type (string) |
2603 | | - jQuery.Event(type); |
2604 | | - |
2605 | | - if ( type.indexOf("!") >= 0 ) { |
2606 | | - event.type = type = type.slice(0, -1); |
2607 | | - event.exclusive = true; |
2608 | | - } |
2609 | | - |
2610 | | - // Handle a global trigger |
2611 | | - if ( !elem ) { |
2612 | | - // Don't bubble custom events when global (to avoid too much overhead) |
2613 | | - event.stopPropagation(); |
2614 | | - // Only trigger if we've ever bound an event for it |
2615 | | - if ( this.global[type] ) |
2616 | | - jQuery.each( jQuery.cache, function(){ |
2617 | | - if ( this.events && this.events[type] ) |
2618 | | - jQuery.event.trigger( event, data, this.handle.elem ); |
2619 | | - }); |
2620 | | - } |
2621 | | - |
2622 | | - // Handle triggering a single element |
2623 | | - |
2624 | | - // don't do events on text and comment nodes |
2625 | | - if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) |
2626 | | - return undefined; |
2627 | | - |
2628 | | - // Clean up in case it is reused |
2629 | | - event.result = undefined; |
2630 | | - event.target = elem; |
2631 | | - |
2632 | | - // Clone the incoming data, if any |
2633 | | - data = jQuery.makeArray(data); |
2634 | | - data.unshift( event ); |
2635 | | - } |
2636 | | - |
2637 | | - event.currentTarget = elem; |
2638 | | - |
2639 | | - // Trigger the event, it is assumed that "handle" is a function |
2640 | | - var handle = jQuery.data(elem, "handle"); |
2641 | | - if ( handle ) |
2642 | | - handle.apply( elem, data ); |
2643 | | - |
2644 | | - // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) |
2645 | | - if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) |
2646 | | - event.result = false; |
2647 | | - |
2648 | | - // Trigger the native events (except for clicks on links) |
2649 | | - if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { |
2650 | | - this.triggered = true; |
2651 | | - try { |
2652 | | - elem[ type ](); |
2653 | | - // prevent IE from throwing an error for some hidden elements |
2654 | | - } catch (e) {} |
2655 | | - } |
2656 | | - |
2657 | | - this.triggered = false; |
2658 | | - |
2659 | | - if ( !event.isPropagationStopped() ) { |
2660 | | - var parent = elem.parentNode || elem.ownerDocument; |
2661 | | - if ( parent ) |
2662 | | - jQuery.event.trigger(event, data, parent, true); |
2663 | | - } |
2664 | | - }, |
2665 | | - |
2666 | | - handle: function(event) { |
2667 | | - // returned undefined or false |
2668 | | - var all, handlers; |
2669 | | - |
2670 | | - event = arguments[0] = jQuery.event.fix( event || window.event ); |
2671 | | - event.currentTarget = this; |
2672 | | - |
2673 | | - // Namespaced event handlers |
2674 | | - var namespaces = event.type.split("."); |
2675 | | - event.type = namespaces.shift(); |
2676 | | - |
2677 | | - // Cache this now, all = true means, any handler |
2678 | | - all = !namespaces.length && !event.exclusive; |
2679 | | - |
2680 | | - var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
2681 | | - |
2682 | | - handlers = ( jQuery.data(this, "events") || {} )[event.type]; |
2683 | | - |
2684 | | - for ( var j in handlers ) { |
2685 | | - var handler = handlers[j]; |
2686 | | - |
2687 | | - // Filter the functions by class |
2688 | | - if ( all || namespace.test(handler.type) ) { |
2689 | | - // Pass in a reference to the handler function itself |
2690 | | - // So that we can later remove it |
2691 | | - event.handler = handler; |
2692 | | - event.data = handler.data; |
2693 | | - |
2694 | | - var ret = handler.apply(this, arguments); |
2695 | | - |
2696 | | - if( ret !== undefined ){ |
2697 | | - event.result = ret; |
2698 | | - if ( ret === false ) { |
2699 | | - event.preventDefault(); |
2700 | | - event.stopPropagation(); |
2701 | | - } |
2702 | | - } |
2703 | | - |
2704 | | - if( event.isImmediatePropagationStopped() ) |
2705 | | - break; |
2706 | | - |
2707 | | - } |
2708 | | - } |
2709 | | - }, |
2710 | | - |
2711 | | - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
2712 | | - |
2713 | | - fix: function(event) { |
2714 | | - if ( event[expando] ) |
2715 | | - return event; |
2716 | | - |
2717 | | - // store a copy of the original event object |
2718 | | - // and "clone" to set read-only properties |
2719 | | - var originalEvent = event; |
2720 | | - event = jQuery.Event( originalEvent ); |
2721 | | - |
2722 | | - for ( var i = this.props.length, prop; i; ){ |
2723 | | - prop = this.props[ --i ]; |
2724 | | - event[ prop ] = originalEvent[ prop ]; |
2725 | | - } |
2726 | | - |
2727 | | - // Fix target property, if necessary |
2728 | | - if ( !event.target ) |
2729 | | - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
2730 | | - |
2731 | | - // check if target is a textnode (safari) |
2732 | | - if ( event.target.nodeType == 3 ) |
2733 | | - event.target = event.target.parentNode; |
2734 | | - |
2735 | | - // Add relatedTarget, if necessary |
2736 | | - if ( !event.relatedTarget && event.fromElement ) |
2737 | | - event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; |
2738 | | - |
2739 | | - // Calculate pageX/Y if missing and clientX/Y available |
2740 | | - if ( event.pageX == null && event.clientX != null ) { |
2741 | | - var doc = document.documentElement, body = document.body; |
2742 | | - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); |
2743 | | - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); |
2744 | | - } |
2745 | | - |
2746 | | - // Add which for key events |
2747 | | - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) |
2748 | | - event.which = event.charCode || event.keyCode; |
2749 | | - |
2750 | | - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
2751 | | - if ( !event.metaKey && event.ctrlKey ) |
2752 | | - event.metaKey = event.ctrlKey; |
2753 | | - |
2754 | | - // Add which for click: 1 == left; 2 == middle; 3 == right |
2755 | | - // Note: button is not normalized, so don't use it |
2756 | | - if ( !event.which && event.button ) |
2757 | | - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
2758 | | - |
2759 | | - return event; |
2760 | | - }, |
2761 | | - |
2762 | | - proxy: function( fn, proxy ){ |
2763 | | - proxy = proxy || function(){ return fn.apply(this, arguments); }; |
2764 | | - // Set the guid of unique handler to the same of original handler, so it can be removed |
2765 | | - proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; |
2766 | | - // So proxy can be declared as an argument |
2767 | | - return proxy; |
2768 | | - }, |
2769 | | - |
2770 | | - special: { |
2771 | | - ready: { |
2772 | | - // Make sure the ready event is setup |
2773 | | - setup: bindReady, |
2774 | | - teardown: function() {} |
2775 | | - } |
2776 | | - }, |
2777 | | - |
2778 | | - specialAll: { |
2779 | | - live: { |
2780 | | - setup: function( selector, namespaces ){ |
2781 | | - jQuery.event.add( this, namespaces[0], liveHandler ); |
2782 | | - }, |
2783 | | - teardown: function( namespaces ){ |
2784 | | - if ( namespaces.length ) { |
2785 | | - var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); |
2786 | | - |
2787 | | - jQuery.each( (jQuery.data(this, "events").live || {}), function(){ |
2788 | | - if ( name.test(this.type) ) |
2789 | | - remove++; |
2790 | | - }); |
2791 | | - |
2792 | | - if ( remove < 1 ) |
2793 | | - jQuery.event.remove( this, namespaces[0], liveHandler ); |
2794 | | - } |
2795 | | - } |
2796 | | - } |
2797 | | - } |
2798 | | -}; |
2799 | | - |
2800 | | -jQuery.Event = function( src ){ |
2801 | | - // Allow instantiation without the 'new' keyword |
2802 | | - if( !this.preventDefault ) |
2803 | | - return new jQuery.Event(src); |
2804 | | - |
2805 | | - // Event object |
2806 | | - if( src && src.type ){ |
2807 | | - this.originalEvent = src; |
2808 | | - this.type = src.type; |
2809 | | - // Event type |
2810 | | - }else |
2811 | | - this.type = src; |
2812 | | - |
2813 | | - // timeStamp is buggy for some events on Firefox(#3843) |
2814 | | - // So we won't rely on the native value |
2815 | | - this.timeStamp = now(); |
2816 | | - |
2817 | | - // Mark it as fixed |
2818 | | - this[expando] = true; |
2819 | | -}; |
2820 | | - |
2821 | | -function returnFalse(){ |
2822 | | - return false; |
2823 | | -} |
2824 | | -function returnTrue(){ |
2825 | | - return true; |
2826 | | -} |
2827 | | - |
2828 | | -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
2829 | | -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
2830 | | -jQuery.Event.prototype = { |
2831 | | - preventDefault: function() { |
2832 | | - this.isDefaultPrevented = returnTrue; |
2833 | | - |
2834 | | - var e = this.originalEvent; |
2835 | | - if( !e ) |
2836 | | - return; |
2837 | | - // if preventDefault exists run it on the original event |
2838 | | - if (e.preventDefault) |
2839 | | - e.preventDefault(); |
2840 | | - // otherwise set the returnValue property of the original event to false (IE) |
2841 | | - e.returnValue = false; |
2842 | | - }, |
2843 | | - stopPropagation: function() { |
2844 | | - this.isPropagationStopped = returnTrue; |
2845 | | - |
2846 | | - var e = this.originalEvent; |
2847 | | - if( !e ) |
2848 | | - return; |
2849 | | - // if stopPropagation exists run it on the original event |
2850 | | - if (e.stopPropagation) |
2851 | | - e.stopPropagation(); |
2852 | | - // otherwise set the cancelBubble property of the original event to true (IE) |
2853 | | - e.cancelBubble = true; |
2854 | | - }, |
2855 | | - stopImmediatePropagation:function(){ |
2856 | | - this.isImmediatePropagationStopped = returnTrue; |
2857 | | - this.stopPropagation(); |
2858 | | - }, |
2859 | | - isDefaultPrevented: returnFalse, |
2860 | | - isPropagationStopped: returnFalse, |
2861 | | - isImmediatePropagationStopped: returnFalse |
2862 | | -}; |
2863 | | -// Checks if an event happened on an element within another element |
2864 | | -// Used in jQuery.event.special.mouseenter and mouseleave handlers |
2865 | | -var withinElement = function(event) { |
2866 | | - // Check if mouse(over|out) are still within the same parent element |
2867 | | - var parent = event.relatedTarget; |
2868 | | - // Traverse up the tree |
2869 | | - while ( parent && parent != this ) |
2870 | | - try { parent = parent.parentNode; } |
2871 | | - catch(e) { parent = this; } |
2872 | | - |
2873 | | - if( parent != this ){ |
2874 | | - // set the correct event type |
2875 | | - event.type = event.data; |
2876 | | - // handle event if we actually just moused on to a non sub-element |
2877 | | - jQuery.event.handle.apply( this, arguments ); |
2878 | | - } |
2879 | | -}; |
2880 | | - |
2881 | | -jQuery.each({ |
2882 | | - mouseover: 'mouseenter', |
2883 | | - mouseout: 'mouseleave' |
2884 | | -}, function( orig, fix ){ |
2885 | | - jQuery.event.special[ fix ] = { |
2886 | | - setup: function(){ |
2887 | | - jQuery.event.add( this, orig, withinElement, fix ); |
2888 | | - }, |
2889 | | - teardown: function(){ |
2890 | | - jQuery.event.remove( this, orig, withinElement ); |
2891 | | - } |
2892 | | - }; |
2893 | | -}); |
2894 | | - |
2895 | | -jQuery.fn.extend({ |
2896 | | - bind: function( type, data, fn ) { |
2897 | | - return type == "unload" ? this.one(type, data, fn) : this.each(function(){ |
2898 | | - jQuery.event.add( this, type, fn || data, fn && data ); |
2899 | | - }); |
2900 | | - }, |
2901 | | - |
2902 | | - one: function( type, data, fn ) { |
2903 | | - var one = jQuery.event.proxy( fn || data, function(event) { |
2904 | | - jQuery(this).unbind(event, one); |
2905 | | - return (fn || data).apply( this, arguments ); |
2906 | | - }); |
2907 | | - return this.each(function(){ |
2908 | | - jQuery.event.add( this, type, one, fn && data); |
2909 | | - }); |
2910 | | - }, |
2911 | | - |
2912 | | - unbind: function( type, fn ) { |
2913 | | - return this.each(function(){ |
2914 | | - jQuery.event.remove( this, type, fn ); |
2915 | | - }); |
2916 | | - }, |
2917 | | - |
2918 | | - trigger: function( type, data ) { |
2919 | | - return this.each(function(){ |
2920 | | - jQuery.event.trigger( type, data, this ); |
2921 | | - }); |
2922 | | - }, |
2923 | | - |
2924 | | - triggerHandler: function( type, data ) { |
2925 | | - if( this[0] ){ |
2926 | | - var event = jQuery.Event(type); |
2927 | | - event.preventDefault(); |
2928 | | - event.stopPropagation(); |
2929 | | - jQuery.event.trigger( event, data, this[0] ); |
2930 | | - return event.result; |
2931 | | - } |
2932 | | - }, |
2933 | | - |
2934 | | - toggle: function( fn ) { |
2935 | | - // Save reference to arguments for access in closure |
2936 | | - var args = arguments, i = 1; |
2937 | | - |
2938 | | - // link all the functions, so any of them can unbind this click handler |
2939 | | - while( i < args.length ) |
2940 | | - jQuery.event.proxy( fn, args[i++] ); |
2941 | | - |
2942 | | - return this.click( jQuery.event.proxy( fn, function(event) { |
2943 | | - // Figure out which function to execute |
2944 | | - this.lastToggle = ( this.lastToggle || 0 ) % i; |
2945 | | - |
2946 | | - // Make sure that clicks stop |
2947 | | - event.preventDefault(); |
2948 | | - |
2949 | | - // and execute the function |
2950 | | - return args[ this.lastToggle++ ].apply( this, arguments ) || false; |
2951 | | - })); |
2952 | | - }, |
2953 | | - |
2954 | | - hover: function(fnOver, fnOut) { |
2955 | | - return this.mouseenter(fnOver).mouseleave(fnOut); |
2956 | | - }, |
2957 | | - |
2958 | | - ready: function(fn) { |
2959 | | - // Attach the listeners |
2960 | | - bindReady(); |
2961 | | - |
2962 | | - // If the DOM is already ready |
2963 | | - if ( jQuery.isReady ) |
2964 | | - // Execute the function immediately |
2965 | | - fn.call( document, jQuery ); |
2966 | | - |
2967 | | - // Otherwise, remember the function for later |
2968 | | - else |
2969 | | - // Add the function to the wait list |
2970 | | - jQuery.readyList.push( fn ); |
2971 | | - |
2972 | | - return this; |
2973 | | - }, |
2974 | | - |
2975 | | - live: function( type, fn ){ |
2976 | | - var proxy = jQuery.event.proxy( fn ); |
2977 | | - proxy.guid += this.selector + type; |
2978 | | - |
2979 | | - jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy ); |
2980 | | - |
2981 | | - return this; |
2982 | | - }, |
2983 | | - |
2984 | | - die: function( type, fn ){ |
2985 | | - jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); |
2986 | | - return this; |
2987 | | - } |
2988 | | -}); |
2989 | | - |
2990 | | -function liveHandler( event ){ |
2991 | | - var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"), |
2992 | | - stop = true, |
2993 | | - elems = []; |
2994 | | - |
2995 | | - jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){ |
2996 | | - if ( check.test(fn.type) ) { |
2997 | | - var elem = jQuery(event.target).closest(fn.data)[0]; |
2998 | | - if ( elem ) |
2999 | | - elems.push({ elem: elem, fn: fn }); |
3000 | | - } |
3001 | | - }); |
3002 | | - |
3003 | | - elems.sort(function(a,b) { |
3004 | | - return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest"); |
3005 | | - }); |
3006 | | - |
3007 | | - jQuery.each(elems, function(){ |
3008 | | - if ( this.fn.call(this.elem, event, this.fn.data) === false ) |
3009 | | - return (stop = false); |
3010 | | - }); |
3011 | | - |
3012 | | - return stop; |
3013 | | -} |
3014 | | - |
3015 | | -function liveConvert(type, selector){ |
3016 | | - return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); |
3017 | | -} |
3018 | | - |
3019 | | -jQuery.extend({ |
3020 | | - isReady: false, |
3021 | | - readyList: [], |
3022 | | - // Handle when the DOM is ready |
3023 | | - ready: function() { |
3024 | | - // Make sure that the DOM is not already loaded |
3025 | | - if ( !jQuery.isReady ) { |
3026 | | - // Remember that the DOM is ready |
3027 | | - jQuery.isReady = true; |
3028 | | - |
3029 | | - // If there are functions bound, to execute |
3030 | | - if ( jQuery.readyList ) { |
3031 | | - // Execute all of them |
3032 | | - jQuery.each( jQuery.readyList, function(){ |
3033 | | - this.call( document, jQuery ); |
3034 | | - }); |
3035 | | - |
3036 | | - // Reset the list of functions |
3037 | | - jQuery.readyList = null; |
3038 | | - } |
3039 | | - |
3040 | | - // Trigger any bound ready events |
3041 | | - jQuery(document).triggerHandler("ready"); |
3042 | | - } |
3043 | | - } |
3044 | | -}); |
3045 | | - |
3046 | | -var readyBound = false; |
3047 | | - |
3048 | | -function bindReady(){ |
3049 | | - if ( readyBound ) return; |
3050 | | - readyBound = true; |
3051 | | - |
3052 | | - // Mozilla, Opera and webkit nightlies currently support this event |
3053 | | - if ( document.addEventListener ) { |
3054 | | - // Use the handy event callback |
3055 | | - document.addEventListener( "DOMContentLoaded", function(){ |
3056 | | - document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); |
3057 | | - jQuery.ready(); |
3058 | | - }, false ); |
3059 | | - |
3060 | | - // If IE event model is used |
3061 | | - } else if ( document.attachEvent ) { |
3062 | | - // ensure firing before onload, |
3063 | | - // maybe late but safe also for iframes |
3064 | | - document.attachEvent("onreadystatechange", function(){ |
3065 | | - if ( document.readyState === "complete" ) { |
3066 | | - document.detachEvent( "onreadystatechange", arguments.callee ); |
3067 | | - jQuery.ready(); |
3068 | | - } |
3069 | | - }); |
3070 | | - |
3071 | | - // If IE and not an iframe |
3072 | | - // continually check to see if the document is ready |
3073 | | - if ( document.documentElement.doScroll && window == window.top ) (function(){ |
3074 | | - if ( jQuery.isReady ) return; |
3075 | | - |
3076 | | - try { |
3077 | | - // If IE is used, use the trick by Diego Perini |
3078 | | - // http://javascript.nwbox.com/IEContentLoaded/ |
3079 | | - document.documentElement.doScroll("left"); |
3080 | | - } catch( error ) { |
3081 | | - setTimeout( arguments.callee, 0 ); |
3082 | | - return; |
3083 | | - } |
3084 | | - |
3085 | | - // and execute any waiting functions |
3086 | | - jQuery.ready(); |
3087 | | - })(); |
3088 | | - } |
3089 | | - |
3090 | | - // A fallback to window.onload, that will always work |
3091 | | - jQuery.event.add( window, "load", jQuery.ready ); |
3092 | | -} |
3093 | | - |
3094 | | -jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
3095 | | - "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + |
3096 | | - "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ |
3097 | | - |
3098 | | - // Handle event binding |
3099 | | - jQuery.fn[name] = function(fn){ |
3100 | | - return fn ? this.bind(name, fn) : this.trigger(name); |
3101 | | - }; |
3102 | | -}); |
3103 | | - |
3104 | | -// Prevent memory leaks in IE |
3105 | | -// And prevent errors on refresh with events like mouseover in other browsers |
3106 | | -// Window isn't included so as not to unbind existing unload events |
3107 | | -jQuery( window ).bind( 'unload', function(){ |
3108 | | - for ( var id in jQuery.cache ) |
3109 | | - // Skip the window |
3110 | | - if ( id != 1 && jQuery.cache[ id ].handle ) |
3111 | | - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
3112 | | -}); |
3113 | | -(function(){ |
3114 | | - |
3115 | | - jQuery.support = {}; |
3116 | | - |
3117 | | - var root = document.documentElement, |
3118 | | - script = document.createElement("script"), |
3119 | | - div = document.createElement("div"), |
3120 | | - id = "script" + (new Date).getTime(); |
3121 | | - |
3122 | | - div.style.display = "none"; |
3123 | | - div.innerHTML = ' <link/><table></table><a href="https://www.mediawiki.org/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>'; |
3124 | | - |
3125 | | - var all = div.getElementsByTagName("*"), |
3126 | | - a = div.getElementsByTagName("a")[0]; |
3127 | | - |
3128 | | - // Can't get basic test support |
3129 | | - if ( !all || !all.length || !a ) { |
3130 | | - return; |
3131 | | - } |
3132 | | - |
3133 | | - jQuery.support = { |
3134 | | - // IE strips leading whitespace when .innerHTML is used |
3135 | | - leadingWhitespace: div.firstChild.nodeType == 3, |
3136 | | - |
3137 | | - // Make sure that tbody elements aren't automatically inserted |
3138 | | - // IE will insert them into empty tables |
3139 | | - tbody: !div.getElementsByTagName("tbody").length, |
3140 | | - |
3141 | | - // Make sure that you can get all elements in an <object> element |
3142 | | - // IE 7 always returns no results |
3143 | | - objectAll: !!div.getElementsByTagName("object")[0] |
3144 | | - .getElementsByTagName("*").length, |
3145 | | - |
3146 | | - // Make sure that link elements get serialized correctly by innerHTML |
3147 | | - // This requires a wrapper element in IE |
3148 | | - htmlSerialize: !!div.getElementsByTagName("link").length, |
3149 | | - |
3150 | | - // Get the style information from getAttribute |
3151 | | - // (IE uses .cssText insted) |
3152 | | - style: /red/.test( a.getAttribute("style") ), |
3153 | | - |
3154 | | - // Make sure that URLs aren't manipulated |
3155 | | - // (IE normalizes it by default) |
3156 | | - hrefNormalized: a.getAttribute("href") === "/a", |
3157 | | - |
3158 | | - // Make sure that element opacity exists |
3159 | | - // (IE uses filter instead) |
3160 | | - opacity: a.style.opacity === "0.5", |
3161 | | - |
3162 | | - // Verify style float existence |
3163 | | - // (IE uses styleFloat instead of cssFloat) |
3164 | | - cssFloat: !!a.style.cssFloat, |
3165 | | - |
3166 | | - // Will be defined later |
3167 | | - scriptEval: false, |
3168 | | - noCloneEvent: true, |
3169 | | - boxModel: null |
3170 | | - }; |
3171 | | - |
3172 | | - script.type = "text/javascript"; |
3173 | | - try { |
3174 | | - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
3175 | | - } catch(e){} |
3176 | | - |
3177 | | - root.insertBefore( script, root.firstChild ); |
3178 | | - |
3179 | | - // Make sure that the execution of code works by injecting a script |
3180 | | - // tag with appendChild/createTextNode |
3181 | | - // (IE doesn't support this, fails, and uses .text instead) |
3182 | | - if ( window[ id ] ) { |
3183 | | - jQuery.support.scriptEval = true; |
3184 | | - delete window[ id ]; |
3185 | | - } |
3186 | | - |
3187 | | - root.removeChild( script ); |
3188 | | - |
3189 | | - if ( div.attachEvent && div.fireEvent ) { |
3190 | | - div.attachEvent("onclick", function(){ |
3191 | | - // Cloning a node shouldn't copy over any |
3192 | | - // bound event handlers (IE does this) |
3193 | | - jQuery.support.noCloneEvent = false; |
3194 | | - div.detachEvent("onclick", arguments.callee); |
3195 | | - }); |
3196 | | - div.cloneNode(true).fireEvent("onclick"); |
3197 | | - } |
3198 | | - |
3199 | | - // Figure out if the W3C box model works as expected |
3200 | | - // document.body must exist before we can do this |
3201 | | - jQuery(function(){ |
3202 | | - var div = document.createElement("div"); |
3203 | | - div.style.width = div.style.paddingLeft = "1px"; |
3204 | | - |
3205 | | - document.body.appendChild( div ); |
3206 | | - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
3207 | | - document.body.removeChild( div ).style.display = 'none'; |
3208 | | - }); |
3209 | | -})(); |
3210 | | - |
3211 | | -var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; |
3212 | | - |
3213 | | -jQuery.props = { |
3214 | | - "for": "htmlFor", |
3215 | | - "class": "className", |
3216 | | - "float": styleFloat, |
3217 | | - cssFloat: styleFloat, |
3218 | | - styleFloat: styleFloat, |
3219 | | - readonly: "readOnly", |
3220 | | - maxlength: "maxLength", |
3221 | | - cellspacing: "cellSpacing", |
3222 | | - rowspan: "rowSpan", |
3223 | | - tabindex: "tabIndex" |
3224 | | -}; |
3225 | | -jQuery.fn.extend({ |
3226 | | - // Keep a copy of the old load |
3227 | | - _load: jQuery.fn.load, |
3228 | | - |
3229 | | - load: function( url, params, callback ) { |
3230 | | - if ( typeof url !== "string" ) |
3231 | | - return this._load( url ); |
3232 | | - |
3233 | | - var off = url.indexOf(" "); |
3234 | | - if ( off >= 0 ) { |
3235 | | - var selector = url.slice(off, url.length); |
3236 | | - url = url.slice(0, off); |
3237 | | - } |
3238 | | - |
3239 | | - // Default to a GET request |
3240 | | - var type = "GET"; |
3241 | | - |
3242 | | - // If the second parameter was provided |
3243 | | - if ( params ) |
3244 | | - // If it's a function |
3245 | | - if ( jQuery.isFunction( params ) ) { |
3246 | | - // We assume that it's the callback |
3247 | | - callback = params; |
3248 | | - params = null; |
3249 | | - |
3250 | | - // Otherwise, build a param string |
3251 | | - } else if( typeof params === "object" ) { |
3252 | | - params = jQuery.param( params ); |
3253 | | - type = "POST"; |
3254 | | - } |
3255 | | - |
3256 | | - var self = this; |
3257 | | - |
3258 | | - // Request the remote document |
3259 | | - jQuery.ajax({ |
3260 | | - url: url, |
3261 | | - type: type, |
3262 | | - dataType: "html", |
3263 | | - data: params, |
3264 | | - complete: function(res, status){ |
3265 | | - // If successful, inject the HTML into all the matched elements |
3266 | | - if ( status == "success" || status == "notmodified" ) |
3267 | | - // See if a selector was specified |
3268 | | - self.html( selector ? |
3269 | | - // Create a dummy div to hold the results |
3270 | | - jQuery("<div/>") |
3271 | | - // inject the contents of the document in, removing the scripts |
3272 | | - // to avoid any 'Permission Denied' errors in IE |
3273 | | - .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
3274 | | - |
3275 | | - // Locate the specified elements |
3276 | | - .find(selector) : |
3277 | | - |
3278 | | - // If not, just inject the full result |
3279 | | - res.responseText ); |
3280 | | - |
3281 | | - if( callback ) |
3282 | | - self.each( callback, [res.responseText, status, res] ); |
3283 | | - } |
3284 | | - }); |
3285 | | - return this; |
3286 | | - }, |
3287 | | - |
3288 | | - serialize: function() { |
3289 | | - return jQuery.param(this.serializeArray()); |
3290 | | - }, |
3291 | | - serializeArray: function() { |
3292 | | - return this.map(function(){ |
3293 | | - return this.elements ? jQuery.makeArray(this.elements) : this; |
3294 | | - }) |
3295 | | - .filter(function(){ |
3296 | | - return this.name && !this.disabled && |
3297 | | - (this.checked || /select|textarea/i.test(this.nodeName) || |
3298 | | - /text|hidden|password|search/i.test(this.type)); |
3299 | | - }) |
3300 | | - .map(function(i, elem){ |
3301 | | - var val = jQuery(this).val(); |
3302 | | - return val == null ? null : |
3303 | | - jQuery.isArray(val) ? |
3304 | | - jQuery.map( val, function(val, i){ |
3305 | | - return {name: elem.name, value: val}; |
3306 | | - }) : |
3307 | | - {name: elem.name, value: val}; |
3308 | | - }).get(); |
3309 | | - } |
3310 | | -}); |
3311 | | - |
3312 | | -// Attach a bunch of functions for handling common AJAX events |
3313 | | -jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ |
3314 | | - jQuery.fn[o] = function(f){ |
3315 | | - return this.bind(o, f); |
3316 | | - }; |
3317 | | -}); |
3318 | | - |
3319 | | -var jsc = now(); |
3320 | | - |
3321 | | -jQuery.extend({ |
3322 | | - |
3323 | | - get: function( url, data, callback, type ) { |
3324 | | - // shift arguments if data argument was ommited |
3325 | | - if ( jQuery.isFunction( data ) ) { |
3326 | | - callback = data; |
3327 | | - data = null; |
3328 | | - } |
3329 | | - |
3330 | | - return jQuery.ajax({ |
3331 | | - type: "GET", |
3332 | | - url: url, |
3333 | | - data: data, |
3334 | | - success: callback, |
3335 | | - dataType: type |
3336 | | - }); |
3337 | | - }, |
3338 | | - |
3339 | | - getScript: function( url, callback ) { |
3340 | | - return jQuery.get(url, null, callback, "script"); |
3341 | | - }, |
3342 | | - |
3343 | | - getJSON: function( url, data, callback ) { |
3344 | | - return jQuery.get(url, data, callback, "json"); |
3345 | | - }, |
3346 | | - |
3347 | | - post: function( url, data, callback, type ) { |
3348 | | - if ( jQuery.isFunction( data ) ) { |
3349 | | - callback = data; |
3350 | | - data = {}; |
3351 | | - } |
3352 | | - |
3353 | | - return jQuery.ajax({ |
3354 | | - type: "POST", |
3355 | | - url: url, |
3356 | | - data: data, |
3357 | | - success: callback, |
3358 | | - dataType: type |
3359 | | - }); |
3360 | | - }, |
3361 | | - |
3362 | | - ajaxSetup: function( settings ) { |
3363 | | - jQuery.extend( jQuery.ajaxSettings, settings ); |
3364 | | - }, |
3365 | | - |
3366 | | - ajaxSettings: { |
3367 | | - url: location.href, |
3368 | | - global: true, |
3369 | | - type: "GET", |
3370 | | - contentType: "application/x-www-form-urlencoded", |
3371 | | - processData: true, |
3372 | | - async: true, |
3373 | | - /* |
3374 | | - timeout: 0, |
3375 | | - data: null, |
3376 | | - username: null, |
3377 | | - password: null, |
3378 | | - */ |
3379 | | - // Create the request object; Microsoft failed to properly |
3380 | | - // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
3381 | | - // This function can be overriden by calling jQuery.ajaxSetup |
3382 | | - xhr:function(){ |
3383 | | - return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
3384 | | - }, |
3385 | | - accepts: { |
3386 | | - xml: "application/xml, text/xml", |
3387 | | - html: "text/html", |
3388 | | - script: "text/javascript, application/javascript", |
3389 | | - json: "application/json, text/javascript", |
3390 | | - text: "text/plain", |
3391 | | - _default: "*/*" |
3392 | | - } |
3393 | | - }, |
3394 | | - |
3395 | | - // Last-Modified header cache for next request |
3396 | | - lastModified: {}, |
3397 | | - |
3398 | | - ajax: function( s ) { |
3399 | | - // Extend the settings, but re-extend 's' so that it can be |
3400 | | - // checked again later (in the test suite, specifically) |
3401 | | - s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
3402 | | - |
3403 | | - var jsonp, jsre = /=\?(&|$)/g, status, data, |
3404 | | - type = s.type.toUpperCase(); |
3405 | | - |
3406 | | - // convert data if not already a string |
3407 | | - if ( s.data && s.processData && typeof s.data !== "string" ) |
3408 | | - s.data = jQuery.param(s.data); |
3409 | | - |
3410 | | - // Handle JSONP Parameter Callbacks |
3411 | | - if ( s.dataType == "jsonp" ) { |
3412 | | - if ( type == "GET" ) { |
3413 | | - if ( !s.url.match(jsre) ) |
3414 | | - s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
3415 | | - } else if ( !s.data || !s.data.match(jsre) ) |
3416 | | - s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
3417 | | - s.dataType = "json"; |
3418 | | - } |
3419 | | - |
3420 | | - // Build temporary JSONP function |
3421 | | - if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
3422 | | - jsonp = "jsonp" + jsc++; |
3423 | | - |
3424 | | - // Replace the =? sequence both in the query string and the data |
3425 | | - if ( s.data ) |
3426 | | - s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
3427 | | - s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
3428 | | - |
3429 | | - // We need to make sure |
3430 | | - // that a JSONP style response is executed properly |
3431 | | - s.dataType = "script"; |
3432 | | - |
3433 | | - // Handle JSONP-style loading |
3434 | | - window[ jsonp ] = function(tmp){ |
3435 | | - data = tmp; |
3436 | | - success(); |
3437 | | - complete(); |
3438 | | - // Garbage collect |
3439 | | - window[ jsonp ] = undefined; |
3440 | | - try{ delete window[ jsonp ]; } catch(e){} |
3441 | | - if ( head ) |
3442 | | - head.removeChild( script ); |
3443 | | - }; |
3444 | | - } |
3445 | | - |
3446 | | - if ( s.dataType == "script" && s.cache == null ) |
3447 | | - s.cache = false; |
3448 | | - |
3449 | | - if ( s.cache === false && type == "GET" ) { |
3450 | | - var ts = now(); |
3451 | | - // try replacing _= if it is there |
3452 | | - var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); |
3453 | | - // if nothing was replaced, add timestamp to the end |
3454 | | - s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); |
3455 | | - } |
3456 | | - |
3457 | | - // If data is available, append data to url for get requests |
3458 | | - if ( s.data && type == "GET" ) { |
3459 | | - s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
3460 | | - |
3461 | | - // IE likes to send both get and post data, prevent this |
3462 | | - s.data = null; |
3463 | | - } |
3464 | | - |
3465 | | - // Watch for a new set of requests |
3466 | | - if ( s.global && ! jQuery.active++ ) |
3467 | | - jQuery.event.trigger( "ajaxStart" ); |
3468 | | - |
3469 | | - // Matches an absolute URL, and saves the domain |
3470 | | - var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url ); |
3471 | | - |
3472 | | - // If we're requesting a remote document |
3473 | | - // and trying to load JSON or Script with a GET |
3474 | | - if ( s.dataType == "script" && type == "GET" && parts |
3475 | | - && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){ |
3476 | | - |
3477 | | - var head = document.getElementsByTagName("head")[0]; |
3478 | | - var script = document.createElement("script"); |
3479 | | - script.src = s.url; |
3480 | | - if (s.scriptCharset) |
3481 | | - script.charset = s.scriptCharset; |
3482 | | - |
3483 | | - // Handle Script loading |
3484 | | - if ( !jsonp ) { |
3485 | | - var done = false; |
3486 | | - |
3487 | | - // Attach handlers for all browsers |
3488 | | - script.onload = script.onreadystatechange = function(){ |
3489 | | - if ( !done && (!this.readyState || |
3490 | | - this.readyState == "loaded" || this.readyState == "complete") ) { |
3491 | | - done = true; |
3492 | | - success(); |
3493 | | - complete(); |
3494 | | - |
3495 | | - // Handle memory leak in IE |
3496 | | - script.onload = script.onreadystatechange = null; |
3497 | | - head.removeChild( script ); |
3498 | | - } |
3499 | | - }; |
3500 | | - } |
3501 | | - |
3502 | | - head.appendChild(script); |
3503 | | - |
3504 | | - // We handle everything using the script element injection |
3505 | | - return undefined; |
3506 | | - } |
3507 | | - |
3508 | | - var requestDone = false; |
3509 | | - |
3510 | | - // Create the request object |
3511 | | - var xhr = s.xhr(); |
3512 | | - |
3513 | | - // Open the socket |
3514 | | - // Passing null username, generates a login popup on Opera (#2865) |
3515 | | - if( s.username ) |
3516 | | - xhr.open(type, s.url, s.async, s.username, s.password); |
3517 | | - else |
3518 | | - xhr.open(type, s.url, s.async); |
3519 | | - |
3520 | | - // Need an extra try/catch for cross domain requests in Firefox 3 |
3521 | | - try { |
3522 | | - // Set the correct header, if data is being sent |
3523 | | - if ( s.data ) |
3524 | | - xhr.setRequestHeader("Content-Type", s.contentType); |
3525 | | - |
3526 | | - // Set the If-Modified-Since header, if ifModified mode. |
3527 | | - if ( s.ifModified ) |
3528 | | - xhr.setRequestHeader("If-Modified-Since", |
3529 | | - jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
3530 | | - |
3531 | | - // Set header so the called script knows that it's an XMLHttpRequest |
3532 | | - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
3533 | | - |
3534 | | - // Set the Accepts header for the server, depending on the dataType |
3535 | | - xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
3536 | | - s.accepts[ s.dataType ] + ", */*" : |
3537 | | - s.accepts._default ); |
3538 | | - } catch(e){} |
3539 | | - |
3540 | | - // Allow custom headers/mimetypes and early abort |
3541 | | - if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { |
3542 | | - // Handle the global AJAX counter |
3543 | | - if ( s.global && ! --jQuery.active ) |
3544 | | - jQuery.event.trigger( "ajaxStop" ); |
3545 | | - // close opended socket |
3546 | | - xhr.abort(); |
3547 | | - return false; |
3548 | | - } |
3549 | | - |
3550 | | - if ( s.global ) |
3551 | | - jQuery.event.trigger("ajaxSend", [xhr, s]); |
3552 | | - |
3553 | | - // Wait for a response to come back |
3554 | | - var onreadystatechange = function(isTimeout){ |
3555 | | - // The request was aborted, clear the interval and decrement jQuery.active |
3556 | | - if (xhr.readyState == 0) { |
3557 | | - if (ival) { |
3558 | | - // clear poll interval |
3559 | | - clearInterval(ival); |
3560 | | - ival = null; |
3561 | | - // Handle the global AJAX counter |
3562 | | - if ( s.global && ! --jQuery.active ) |
3563 | | - jQuery.event.trigger( "ajaxStop" ); |
3564 | | - } |
3565 | | - // The transfer is complete and the data is available, or the request timed out |
3566 | | - } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { |
3567 | | - requestDone = true; |
3568 | | - |
3569 | | - // clear poll interval |
3570 | | - if (ival) { |
3571 | | - clearInterval(ival); |
3572 | | - ival = null; |
3573 | | - } |
3574 | | - |
3575 | | - status = isTimeout == "timeout" ? "timeout" : |
3576 | | - !jQuery.httpSuccess( xhr ) ? "error" : |
3577 | | - s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : |
3578 | | - "success"; |
3579 | | - |
3580 | | - if ( status == "success" ) { |
3581 | | - // Watch for, and catch, XML document parse errors |
3582 | | - try { |
3583 | | - // process the data (runs the xml through httpData regardless of callback) |
3584 | | - data = jQuery.httpData( xhr, s.dataType, s ); |
3585 | | - } catch(e) { |
3586 | | - status = "parsererror"; |
3587 | | - } |
3588 | | - } |
3589 | | - |
3590 | | - // Make sure that the request was successful or notmodified |
3591 | | - if ( status == "success" ) { |
3592 | | - // Cache Last-Modified header, if ifModified mode. |
3593 | | - var modRes; |
3594 | | - try { |
3595 | | - modRes = xhr.getResponseHeader("Last-Modified"); |
3596 | | - } catch(e) {} // swallow exception thrown by FF if header is not available |
3597 | | - |
3598 | | - if ( s.ifModified && modRes ) |
3599 | | - jQuery.lastModified[s.url] = modRes; |
3600 | | - |
3601 | | - // JSONP handles its own success callback |
3602 | | - if ( !jsonp ) |
3603 | | - success(); |
3604 | | - } else |
3605 | | - jQuery.handleError(s, xhr, status); |
3606 | | - |
3607 | | - // Fire the complete handlers |
3608 | | - complete(); |
3609 | | - |
3610 | | - if ( isTimeout ) |
3611 | | - xhr.abort(); |
3612 | | - |
3613 | | - // Stop memory leaks |
3614 | | - if ( s.async ) |
3615 | | - xhr = null; |
3616 | | - } |
3617 | | - }; |
3618 | | - |
3619 | | - if ( s.async ) { |
3620 | | - // don't attach the handler to the request, just poll it instead |
3621 | | - var ival = setInterval(onreadystatechange, 13); |
3622 | | - |
3623 | | - // Timeout checker |
3624 | | - if ( s.timeout > 0 ) |
3625 | | - setTimeout(function(){ |
3626 | | - // Check to see if the request is still happening |
3627 | | - if ( xhr && !requestDone ) |
3628 | | - onreadystatechange( "timeout" ); |
3629 | | - }, s.timeout); |
3630 | | - } |
3631 | | - |
3632 | | - // Send the data |
3633 | | - try { |
3634 | | - xhr.send(s.data); |
3635 | | - } catch(e) { |
3636 | | - jQuery.handleError(s, xhr, null, e); |
3637 | | - } |
3638 | | - |
3639 | | - // firefox 1.5 doesn't fire statechange for sync requests |
3640 | | - if ( !s.async ) |
3641 | | - onreadystatechange(); |
3642 | | - |
3643 | | - function success(){ |
3644 | | - // If a local callback was specified, fire it and pass it the data |
3645 | | - if ( s.success ) |
3646 | | - s.success( data, status ); |
3647 | | - |
3648 | | - // Fire the global callback |
3649 | | - if ( s.global ) |
3650 | | - jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); |
3651 | | - } |
3652 | | - |
3653 | | - function complete(){ |
3654 | | - // Process result |
3655 | | - if ( s.complete ) |
3656 | | - s.complete(xhr, status); |
3657 | | - |
3658 | | - // The request was completed |
3659 | | - if ( s.global ) |
3660 | | - jQuery.event.trigger( "ajaxComplete", [xhr, s] ); |
3661 | | - |
3662 | | - // Handle the global AJAX counter |
3663 | | - if ( s.global && ! --jQuery.active ) |
3664 | | - jQuery.event.trigger( "ajaxStop" ); |
3665 | | - } |
3666 | | - |
3667 | | - // return XMLHttpRequest to allow aborting the request etc. |
3668 | | - return xhr; |
3669 | | - }, |
3670 | | - |
3671 | | - handleError: function( s, xhr, status, e ) { |
3672 | | - // If a local callback was specified, fire it |
3673 | | - if ( s.error ) s.error( xhr, status, e ); |
3674 | | - |
3675 | | - // Fire the global callback |
3676 | | - if ( s.global ) |
3677 | | - jQuery.event.trigger( "ajaxError", [xhr, s, e] ); |
3678 | | - }, |
3679 | | - |
3680 | | - // Counter for holding the number of active queries |
3681 | | - active: 0, |
3682 | | - |
3683 | | - // Determines if an XMLHttpRequest was successful or not |
3684 | | - httpSuccess: function( xhr ) { |
3685 | | - try { |
3686 | | - // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
3687 | | - return !xhr.status && location.protocol == "file:" || |
3688 | | - ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; |
3689 | | - } catch(e){} |
3690 | | - return false; |
3691 | | - }, |
3692 | | - |
3693 | | - // Determines if an XMLHttpRequest returns NotModified |
3694 | | - httpNotModified: function( xhr, url ) { |
3695 | | - try { |
3696 | | - var xhrRes = xhr.getResponseHeader("Last-Modified"); |
3697 | | - |
3698 | | - // Firefox always returns 200. check Last-Modified date |
3699 | | - return xhr.status == 304 || xhrRes == jQuery.lastModified[url]; |
3700 | | - } catch(e){} |
3701 | | - return false; |
3702 | | - }, |
3703 | | - |
3704 | | - httpData: function( xhr, type, s ) { |
3705 | | - var ct = xhr.getResponseHeader("content-type"), |
3706 | | - xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, |
3707 | | - data = xml ? xhr.responseXML : xhr.responseText; |
3708 | | - |
3709 | | - if ( xml && data.documentElement.tagName == "parsererror" ) |
3710 | | - throw "parsererror"; |
3711 | | - |
3712 | | - // Allow a pre-filtering function to sanitize the response |
3713 | | - // s != null is checked to keep backwards compatibility |
3714 | | - if( s && s.dataFilter ) |
3715 | | - data = s.dataFilter( data, type ); |
3716 | | - |
3717 | | - // The filter can actually parse the response |
3718 | | - if( typeof data === "string" ){ |
3719 | | - |
3720 | | - // If the type is "script", eval it in global context |
3721 | | - if ( type == "script" ) |
3722 | | - jQuery.globalEval( data ); |
3723 | | - |
3724 | | - // Get the JavaScript object, if JSON is used. |
3725 | | - if ( type == "json" ) |
3726 | | - data = window["eval"]("(" + data + ")"); |
3727 | | - } |
3728 | | - |
3729 | | - return data; |
3730 | | - }, |
3731 | | - |
3732 | | - // Serialize an array of form elements or a set of |
3733 | | - // key/values into a query string |
3734 | | - param: function( a ) { |
3735 | | - var s = [ ]; |
3736 | | - |
3737 | | - function add( key, value ){ |
3738 | | - s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); |
3739 | | - }; |
3740 | | - |
3741 | | - // If an array was passed in, assume that it is an array |
3742 | | - // of form elements |
3743 | | - if ( jQuery.isArray(a) || a.jquery ) |
3744 | | - // Serialize the form elements |
3745 | | - jQuery.each( a, function(){ |
3746 | | - add( this.name, this.value ); |
3747 | | - }); |
3748 | | - |
3749 | | - // Otherwise, assume that it's an object of key/value pairs |
3750 | | - else |
3751 | | - // Serialize the key/values |
3752 | | - for ( var j in a ) |
3753 | | - // If the value is an array then the key names need to be repeated |
3754 | | - if ( jQuery.isArray(a[j]) ) |
3755 | | - jQuery.each( a[j], function(){ |
3756 | | - add( j, this ); |
3757 | | - }); |
3758 | | - else |
3759 | | - add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); |
3760 | | - |
3761 | | - // Return the resulting serialization |
3762 | | - return s.join("&").replace(/%20/g, "+"); |
3763 | | - } |
3764 | | - |
3765 | | -}); |
3766 | | -var elemdisplay = {}, |
3767 | | - timerId, |
3768 | | - fxAttrs = [ |
3769 | | - // height animations |
3770 | | - [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
3771 | | - // width animations |
3772 | | - [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
3773 | | - // opacity animations |
3774 | | - [ "opacity" ] |
3775 | | - ]; |
3776 | | - |
3777 | | -function genFx( type, num ){ |
3778 | | - var obj = {}; |
3779 | | - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){ |
3780 | | - obj[ this ] = type; |
3781 | | - }); |
3782 | | - return obj; |
3783 | | -} |
3784 | | - |
3785 | | -jQuery.fn.extend({ |
3786 | | - show: function(speed,callback){ |
3787 | | - if ( speed ) { |
3788 | | - return this.animate( genFx("show", 3), speed, callback); |
3789 | | - } else { |
3790 | | - for ( var i = 0, l = this.length; i < l; i++ ){ |
3791 | | - var old = jQuery.data(this[i], "olddisplay"); |
3792 | | - |
3793 | | - this[i].style.display = old || ""; |
3794 | | - |
3795 | | - if ( jQuery.css(this[i], "display") === "none" ) { |
3796 | | - var tagName = this[i].tagName, display; |
3797 | | - |
3798 | | - if ( elemdisplay[ tagName ] ) { |
3799 | | - display = elemdisplay[ tagName ]; |
3800 | | - } else { |
3801 | | - var elem = jQuery("<" + tagName + " />").appendTo("body"); |
3802 | | - |
3803 | | - display = elem.css("display"); |
3804 | | - if ( display === "none" ) |
3805 | | - display = "block"; |
3806 | | - |
3807 | | - elem.remove(); |
3808 | | - |
3809 | | - elemdisplay[ tagName ] = display; |
3810 | | - } |
3811 | | - |
3812 | | - jQuery.data(this[i], "olddisplay", display); |
3813 | | - } |
3814 | | - } |
3815 | | - |
3816 | | - // Set the display of the elements in a second loop |
3817 | | - // to avoid the constant reflow |
3818 | | - for ( var i = 0, l = this.length; i < l; i++ ){ |
3819 | | - this[i].style.display = jQuery.data(this[i], "olddisplay") || ""; |
3820 | | - } |
3821 | | - |
3822 | | - return this; |
3823 | | - } |
3824 | | - }, |
3825 | | - |
3826 | | - hide: function(speed,callback){ |
3827 | | - if ( speed ) { |
3828 | | - return this.animate( genFx("hide", 3), speed, callback); |
3829 | | - } else { |
3830 | | - for ( var i = 0, l = this.length; i < l; i++ ){ |
3831 | | - var old = jQuery.data(this[i], "olddisplay"); |
3832 | | - if ( !old && old !== "none" ) |
3833 | | - jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); |
3834 | | - } |
3835 | | - |
3836 | | - // Set the display of the elements in a second loop |
3837 | | - // to avoid the constant reflow |
3838 | | - for ( var i = 0, l = this.length; i < l; i++ ){ |
3839 | | - this[i].style.display = "none"; |
3840 | | - } |
3841 | | - |
3842 | | - return this; |
3843 | | - } |
3844 | | - }, |
3845 | | - |
3846 | | - // Save the old toggle function |
3847 | | - _toggle: jQuery.fn.toggle, |
3848 | | - |
3849 | | - toggle: function( fn, fn2 ){ |
3850 | | - var bool = typeof fn === "boolean"; |
3851 | | - |
3852 | | - return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
3853 | | - this._toggle.apply( this, arguments ) : |
3854 | | - fn == null || bool ? |
3855 | | - this.each(function(){ |
3856 | | - var state = bool ? fn : jQuery(this).is(":hidden"); |
3857 | | - jQuery(this)[ state ? "show" : "hide" ](); |
3858 | | - }) : |
3859 | | - this.animate(genFx("toggle", 3), fn, fn2); |
3860 | | - }, |
3861 | | - |
3862 | | - fadeTo: function(speed,to,callback){ |
3863 | | - return this.animate({opacity: to}, speed, callback); |
3864 | | - }, |
3865 | | - |
3866 | | - animate: function( prop, speed, easing, callback ) { |
3867 | | - var optall = jQuery.speed(speed, easing, callback); |
3868 | | - |
3869 | | - return this[ optall.queue === false ? "each" : "queue" ](function(){ |
3870 | | - |
3871 | | - var opt = jQuery.extend({}, optall), p, |
3872 | | - hidden = this.nodeType == 1 && jQuery(this).is(":hidden"), |
3873 | | - self = this; |
3874 | | - |
3875 | | - for ( p in prop ) { |
3876 | | - if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
3877 | | - return opt.complete.call(this); |
3878 | | - |
3879 | | - if ( ( p == "height" || p == "width" ) && this.style ) { |
3880 | | - // Store display property |
3881 | | - opt.display = jQuery.css(this, "display"); |
3882 | | - |
3883 | | - // Make sure that nothing sneaks out |
3884 | | - opt.overflow = this.style.overflow; |
3885 | | - } |
3886 | | - } |
3887 | | - |
3888 | | - if ( opt.overflow != null ) |
3889 | | - this.style.overflow = "hidden"; |
3890 | | - |
3891 | | - opt.curAnim = jQuery.extend({}, prop); |
3892 | | - |
3893 | | - jQuery.each( prop, function(name, val){ |
3894 | | - var e = new jQuery.fx( self, opt, name ); |
3895 | | - |
3896 | | - if ( /toggle|show|hide/.test(val) ) |
3897 | | - e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
3898 | | - else { |
3899 | | - var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
3900 | | - start = e.cur(true) || 0; |
3901 | | - |
3902 | | - if ( parts ) { |
3903 | | - var end = parseFloat(parts[2]), |
3904 | | - unit = parts[3] || "px"; |
3905 | | - |
3906 | | - // We need to compute starting value |
3907 | | - if ( unit != "px" ) { |
3908 | | - self.style[ name ] = (end || 1) + unit; |
3909 | | - start = ((end || 1) / e.cur(true)) * start; |
3910 | | - self.style[ name ] = start + unit; |
3911 | | - } |
3912 | | - |
3913 | | - // If a +=/-= token was provided, we're doing a relative animation |
3914 | | - if ( parts[1] ) |
3915 | | - end = ((parts[1] == "-=" ? -1 : 1) * end) + start; |
3916 | | - |
3917 | | - e.custom( start, end, unit ); |
3918 | | - } else |
3919 | | - e.custom( start, val, "" ); |
3920 | | - } |
3921 | | - }); |
3922 | | - |
3923 | | - // For JS strict compliance |
3924 | | - return true; |
3925 | | - }); |
3926 | | - }, |
3927 | | - |
3928 | | - stop: function(clearQueue, gotoEnd){ |
3929 | | - var timers = jQuery.timers; |
3930 | | - |
3931 | | - if (clearQueue) |
3932 | | - this.queue([]); |
3933 | | - |
3934 | | - this.each(function(){ |
3935 | | - // go in reverse order so anything added to the queue during the loop is ignored |
3936 | | - for ( var i = timers.length - 1; i >= 0; i-- ) |
3937 | | - if ( timers[i].elem == this ) { |
3938 | | - if (gotoEnd) |
3939 | | - // force the next step to be the last |
3940 | | - timers[i](true); |
3941 | | - timers.splice(i, 1); |
3942 | | - } |
3943 | | - }); |
3944 | | - |
3945 | | - // start the next in the queue if the last step wasn't forced |
3946 | | - if (!gotoEnd) |
3947 | | - this.dequeue(); |
3948 | | - |
3949 | | - return this; |
3950 | | - } |
3951 | | - |
3952 | | -}); |
3953 | | - |
3954 | | -// Generate shortcuts for custom animations |
3955 | | -jQuery.each({ |
3956 | | - slideDown: genFx("show", 1), |
3957 | | - slideUp: genFx("hide", 1), |
3958 | | - slideToggle: genFx("toggle", 1), |
3959 | | - fadeIn: { opacity: "show" }, |
3960 | | - fadeOut: { opacity: "hide" } |
3961 | | -}, function( name, props ){ |
3962 | | - jQuery.fn[ name ] = function( speed, callback ){ |
3963 | | - return this.animate( props, speed, callback ); |
3964 | | - }; |
3965 | | -}); |
3966 | | - |
3967 | | -jQuery.extend({ |
3968 | | - |
3969 | | - speed: function(speed, easing, fn) { |
3970 | | - var opt = typeof speed === "object" ? speed : { |
3971 | | - complete: fn || !fn && easing || |
3972 | | - jQuery.isFunction( speed ) && speed, |
3973 | | - duration: speed, |
3974 | | - easing: fn && easing || easing && !jQuery.isFunction(easing) && easing |
3975 | | - }; |
3976 | | - |
3977 | | - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
3978 | | - jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; |
3979 | | - |
3980 | | - // Queueing |
3981 | | - opt.old = opt.complete; |
3982 | | - opt.complete = function(){ |
3983 | | - if ( opt.queue !== false ) |
3984 | | - jQuery(this).dequeue(); |
3985 | | - if ( jQuery.isFunction( opt.old ) ) |
3986 | | - opt.old.call( this ); |
3987 | | - }; |
3988 | | - |
3989 | | - return opt; |
3990 | | - }, |
3991 | | - |
3992 | | - easing: { |
3993 | | - linear: function( p, n, firstNum, diff ) { |
3994 | | - return firstNum + diff * p; |
3995 | | - }, |
3996 | | - swing: function( p, n, firstNum, diff ) { |
3997 | | - return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
3998 | | - } |
3999 | | - }, |
4000 | | - |
4001 | | - timers: [], |
4002 | | - |
4003 | | - fx: function( elem, options, prop ){ |
4004 | | - this.options = options; |
4005 | | - this.elem = elem; |
4006 | | - this.prop = prop; |
4007 | | - |
4008 | | - if ( !options.orig ) |
4009 | | - options.orig = {}; |
4010 | | - } |
4011 | | - |
4012 | | -}); |
4013 | | - |
4014 | | -jQuery.fx.prototype = { |
4015 | | - |
4016 | | - // Simple function for setting a style value |
4017 | | - update: function(){ |
4018 | | - if ( this.options.step ) |
4019 | | - this.options.step.call( this.elem, this.now, this ); |
4020 | | - |
4021 | | - (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
4022 | | - |
4023 | | - // Set display property to block for height/width animations |
4024 | | - if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style ) |
4025 | | - this.elem.style.display = "block"; |
4026 | | - }, |
4027 | | - |
4028 | | - // Get the current size |
4029 | | - cur: function(force){ |
4030 | | - if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) |
4031 | | - return this.elem[ this.prop ]; |
4032 | | - |
4033 | | - var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
4034 | | - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
4035 | | - }, |
4036 | | - |
4037 | | - // Start an animation from one number to another |
4038 | | - custom: function(from, to, unit){ |
4039 | | - this.startTime = now(); |
4040 | | - this.start = from; |
4041 | | - this.end = to; |
4042 | | - this.unit = unit || this.unit || "px"; |
4043 | | - this.now = this.start; |
4044 | | - this.pos = this.state = 0; |
4045 | | - |
4046 | | - var self = this; |
4047 | | - function t(gotoEnd){ |
4048 | | - return self.step(gotoEnd); |
4049 | | - } |
4050 | | - |
4051 | | - t.elem = this.elem; |
4052 | | - |
4053 | | - if ( t() && jQuery.timers.push(t) && !timerId ) { |
4054 | | - timerId = setInterval(function(){ |
4055 | | - var timers = jQuery.timers; |
4056 | | - |
4057 | | - for ( var i = 0; i < timers.length; i++ ) |
4058 | | - if ( !timers[i]() ) |
4059 | | - timers.splice(i--, 1); |
4060 | | - |
4061 | | - if ( !timers.length ) { |
4062 | | - clearInterval( timerId ); |
4063 | | - timerId = undefined; |
4064 | | - } |
4065 | | - }, 13); |
4066 | | - } |
4067 | | - }, |
4068 | | - |
4069 | | - // Simple 'show' function |
4070 | | - show: function(){ |
4071 | | - // Remember where we started, so that we can go back to it later |
4072 | | - this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
4073 | | - this.options.show = true; |
4074 | | - |
4075 | | - // Begin the animation |
4076 | | - // Make sure that we start at a small width/height to avoid any |
4077 | | - // flash of content |
4078 | | - this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur()); |
4079 | | - |
4080 | | - // Start by showing the element |
4081 | | - jQuery(this.elem).show(); |
4082 | | - }, |
4083 | | - |
4084 | | - // Simple 'hide' function |
4085 | | - hide: function(){ |
4086 | | - // Remember where we started, so that we can go back to it later |
4087 | | - this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
4088 | | - this.options.hide = true; |
4089 | | - |
4090 | | - // Begin the animation |
4091 | | - this.custom(this.cur(), 0); |
4092 | | - }, |
4093 | | - |
4094 | | - // Each step of an animation |
4095 | | - step: function(gotoEnd){ |
4096 | | - var t = now(); |
4097 | | - |
4098 | | - if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
4099 | | - this.now = this.end; |
4100 | | - this.pos = this.state = 1; |
4101 | | - this.update(); |
4102 | | - |
4103 | | - this.options.curAnim[ this.prop ] = true; |
4104 | | - |
4105 | | - var done = true; |
4106 | | - for ( var i in this.options.curAnim ) |
4107 | | - if ( this.options.curAnim[i] !== true ) |
4108 | | - done = false; |
4109 | | - |
4110 | | - if ( done ) { |
4111 | | - if ( this.options.display != null ) { |
4112 | | - // Reset the overflow |
4113 | | - this.elem.style.overflow = this.options.overflow; |
4114 | | - |
4115 | | - // Reset the display |
4116 | | - this.elem.style.display = this.options.display; |
4117 | | - if ( jQuery.css(this.elem, "display") == "none" ) |
4118 | | - this.elem.style.display = "block"; |
4119 | | - } |
4120 | | - |
4121 | | - // Hide the element if the "hide" operation was done |
4122 | | - if ( this.options.hide ) |
4123 | | - jQuery(this.elem).hide(); |
4124 | | - |
4125 | | - // Reset the properties, if the item has been hidden or shown |
4126 | | - if ( this.options.hide || this.options.show ) |
4127 | | - for ( var p in this.options.curAnim ) |
4128 | | - jQuery.attr(this.elem.style, p, this.options.orig[p]); |
4129 | | - |
4130 | | - // Execute the complete function |
4131 | | - this.options.complete.call( this.elem ); |
4132 | | - } |
4133 | | - |
4134 | | - return false; |
4135 | | - } else { |
4136 | | - var n = t - this.startTime; |
4137 | | - this.state = n / this.options.duration; |
4138 | | - |
4139 | | - // Perform the easing function, defaults to swing |
4140 | | - this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); |
4141 | | - this.now = this.start + ((this.end - this.start) * this.pos); |
4142 | | - |
4143 | | - // Perform the next step of the animation |
4144 | | - this.update(); |
4145 | | - } |
4146 | | - |
4147 | | - return true; |
4148 | | - } |
4149 | | - |
4150 | | -}; |
4151 | | - |
4152 | | -jQuery.extend( jQuery.fx, { |
4153 | | - speeds:{ |
4154 | | - slow: 600, |
4155 | | - fast: 200, |
4156 | | - // Default speed |
4157 | | - _default: 400 |
4158 | | - }, |
4159 | | - step: { |
4160 | | - |
4161 | | - opacity: function(fx){ |
4162 | | - jQuery.attr(fx.elem.style, "opacity", fx.now); |
4163 | | - }, |
4164 | | - |
4165 | | - _default: function(fx){ |
4166 | | - if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) |
4167 | | - fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
4168 | | - else |
4169 | | - fx.elem[ fx.prop ] = fx.now; |
4170 | | - } |
4171 | | - } |
4172 | | -}); |
4173 | | -if ( document.documentElement["getBoundingClientRect"] ) |
4174 | | - jQuery.fn.offset = function() { |
4175 | | - if ( !this[0] ) return { top: 0, left: 0 }; |
4176 | | - if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); |
4177 | | - var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement, |
4178 | | - clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, |
4179 | | - top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
4180 | | - left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
4181 | | - return { top: top, left: left }; |
4182 | | - }; |
4183 | | -else |
4184 | | - jQuery.fn.offset = function() { |
4185 | | - if ( !this[0] ) return { top: 0, left: 0 }; |
4186 | | - if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); |
4187 | | - jQuery.offset.initialized || jQuery.offset.initialize(); |
4188 | | - |
4189 | | - var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem, |
4190 | | - doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, |
4191 | | - body = doc.body, defaultView = doc.defaultView, |
4192 | | - prevComputedStyle = defaultView.getComputedStyle(elem, null), |
4193 | | - top = elem.offsetTop, left = elem.offsetLeft; |
4194 | | - |
4195 | | - while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
4196 | | - computedStyle = defaultView.getComputedStyle(elem, null); |
4197 | | - top -= elem.scrollTop, left -= elem.scrollLeft; |
4198 | | - if ( elem === offsetParent ) { |
4199 | | - top += elem.offsetTop, left += elem.offsetLeft; |
4200 | | - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) |
4201 | | - top += parseInt( computedStyle.borderTopWidth, 10) || 0, |
4202 | | - left += parseInt( computedStyle.borderLeftWidth, 10) || 0; |
4203 | | - prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; |
4204 | | - } |
4205 | | - if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) |
4206 | | - top += parseInt( computedStyle.borderTopWidth, 10) || 0, |
4207 | | - left += parseInt( computedStyle.borderLeftWidth, 10) || 0; |
4208 | | - prevComputedStyle = computedStyle; |
4209 | | - } |
4210 | | - |
4211 | | - if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) |
4212 | | - top += body.offsetTop, |
4213 | | - left += body.offsetLeft; |
4214 | | - |
4215 | | - if ( prevComputedStyle.position === "fixed" ) |
4216 | | - top += Math.max(docElem.scrollTop, body.scrollTop), |
4217 | | - left += Math.max(docElem.scrollLeft, body.scrollLeft); |
4218 | | - |
4219 | | - return { top: top, left: left }; |
4220 | | - }; |
4221 | | - |
4222 | | -jQuery.offset = { |
4223 | | - initialize: function() { |
4224 | | - if ( this.initialized ) return; |
4225 | | - var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop, |
4226 | | - 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>'; |
4227 | | - |
4228 | | - rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' }; |
4229 | | - for ( prop in rules ) container.style[prop] = rules[prop]; |
4230 | | - |
4231 | | - container.innerHTML = html; |
4232 | | - body.insertBefore(container, body.firstChild); |
4233 | | - innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild; |
4234 | | - |
4235 | | - this.doesNotAddBorder = (checkDiv.offsetTop !== 5); |
4236 | | - this.doesAddBorderForTableAndCells = (td.offsetTop === 5); |
4237 | | - |
4238 | | - innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; |
4239 | | - this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
4240 | | - |
4241 | | - body.style.marginTop = '1px'; |
4242 | | - this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0); |
4243 | | - body.style.marginTop = bodyMarginTop; |
4244 | | - |
4245 | | - body.removeChild(container); |
4246 | | - this.initialized = true; |
4247 | | - }, |
4248 | | - |
4249 | | - bodyOffset: function(body) { |
4250 | | - jQuery.offset.initialized || jQuery.offset.initialize(); |
4251 | | - var top = body.offsetTop, left = body.offsetLeft; |
4252 | | - if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) |
4253 | | - top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0, |
4254 | | - left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0; |
4255 | | - return { top: top, left: left }; |
4256 | | - } |
4257 | | -}; |
4258 | | - |
4259 | | - |
4260 | | -jQuery.fn.extend({ |
4261 | | - position: function() { |
4262 | | - var left = 0, top = 0, results; |
4263 | | - |
4264 | | - if ( this[0] ) { |
4265 | | - // Get *real* offsetParent |
4266 | | - var offsetParent = this.offsetParent(), |
4267 | | - |
4268 | | - // Get correct offsets |
4269 | | - offset = this.offset(), |
4270 | | - parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); |
4271 | | - |
4272 | | - // Subtract element margins |
4273 | | - // note: when an element has margin: auto the offsetLeft and marginLeft |
4274 | | - // are the same in Safari causing offset.left to incorrectly be 0 |
4275 | | - offset.top -= num( this, 'marginTop' ); |
4276 | | - offset.left -= num( this, 'marginLeft' ); |
4277 | | - |
4278 | | - // Add offsetParent borders |
4279 | | - parentOffset.top += num( offsetParent, 'borderTopWidth' ); |
4280 | | - parentOffset.left += num( offsetParent, 'borderLeftWidth' ); |
4281 | | - |
4282 | | - // Subtract the two offsets |
4283 | | - results = { |
4284 | | - top: offset.top - parentOffset.top, |
4285 | | - left: offset.left - parentOffset.left |
4286 | | - }; |
4287 | | - } |
4288 | | - |
4289 | | - return results; |
4290 | | - }, |
4291 | | - |
4292 | | - offsetParent: function() { |
4293 | | - var offsetParent = this[0].offsetParent || document.body; |
4294 | | - while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) |
4295 | | - offsetParent = offsetParent.offsetParent; |
4296 | | - return jQuery(offsetParent); |
4297 | | - } |
4298 | | -}); |
4299 | | - |
4300 | | - |
4301 | | -// Create scrollLeft and scrollTop methods |
4302 | | -jQuery.each( ['Left', 'Top'], function(i, name) { |
4303 | | - var method = 'scroll' + name; |
4304 | | - |
4305 | | - jQuery.fn[ method ] = function(val) { |
4306 | | - if (!this[0]) return null; |
4307 | | - |
4308 | | - return val !== undefined ? |
4309 | | - |
4310 | | - // Set the scroll offset |
4311 | | - this.each(function() { |
4312 | | - this == window || this == document ? |
4313 | | - window.scrollTo( |
4314 | | - !i ? val : jQuery(window).scrollLeft(), |
4315 | | - i ? val : jQuery(window).scrollTop() |
4316 | | - ) : |
4317 | | - this[ method ] = val; |
4318 | | - }) : |
4319 | | - |
4320 | | - // Return the scroll offset |
4321 | | - this[0] == window || this[0] == document ? |
4322 | | - self[ i ? 'pageYOffset' : 'pageXOffset' ] || |
4323 | | - jQuery.boxModel && document.documentElement[ method ] || |
4324 | | - document.body[ method ] : |
4325 | | - this[0][ method ]; |
4326 | | - }; |
4327 | | -}); |
4328 | | -// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
4329 | | -jQuery.each([ "Height", "Width" ], function(i, name){ |
4330 | | - |
4331 | | - var tl = i ? "Left" : "Top", // top or left |
4332 | | - br = i ? "Right" : "Bottom", // bottom or right |
4333 | | - lower = name.toLowerCase(); |
4334 | | - |
4335 | | - // innerHeight and innerWidth |
4336 | | - jQuery.fn["inner" + name] = function(){ |
4337 | | - return this[0] ? |
4338 | | - jQuery.css( this[0], lower, false, "padding" ) : |
4339 | | - null; |
4340 | | - }; |
4341 | | - |
4342 | | - // outerHeight and outerWidth |
4343 | | - jQuery.fn["outer" + name] = function(margin) { |
4344 | | - return this[0] ? |
4345 | | - jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : |
4346 | | - null; |
4347 | | - }; |
4348 | | - |
4349 | | - var type = name.toLowerCase(); |
4350 | | - |
4351 | | - jQuery.fn[ type ] = function( size ) { |
4352 | | - // Get window width or height |
4353 | | - return this[0] == window ? |
4354 | | - // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
4355 | | - document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || |
4356 | | - document.body[ "client" + name ] : |
4357 | | - |
4358 | | - // Get document width or height |
4359 | | - this[0] == document ? |
4360 | | - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
4361 | | - Math.max( |
4362 | | - document.documentElement["client" + name], |
4363 | | - document.body["scroll" + name], document.documentElement["scroll" + name], |
4364 | | - document.body["offset" + name], document.documentElement["offset" + name] |
4365 | | - ) : |
4366 | | - |
4367 | | - // Get or set width or height on the element |
4368 | | - size === undefined ? |
4369 | | - // Get width or height on the element |
4370 | | - (this.length ? jQuery.css( this[0], type ) : null) : |
4371 | | - |
4372 | | - // Set the width or height on the element (default to pixels if value is unitless) |
4373 | | - this.css( type, typeof size === "string" ? size : size + "px" ); |
4374 | | - }; |
4375 | | - |
4376 | | -}); |
4377 | | -})(); |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -7,7 +7,9 @@ |
8 | 8 | metavid |
9 | 9 | and archive.org |
10 | 10 | */ |
11 | | -loadGM( { "mv_media_search" : "Media Search", |
| 11 | +loadGM({ |
| 12 | + "add_media_wizard": "Add Media Wizard", |
| 13 | + "mv_media_search" : "Media Search", |
12 | 14 | "rsd_box_layout" : "Box layout", |
13 | 15 | "rsd_list_layout" : "List Layout", |
14 | 16 | "rsd_results_desc" : "Results ", |
— | — | @@ -26,13 +28,14 @@ |
27 | 29 | "cc_nd_title": "No Derivative Works", |
28 | 30 | "cc_sa_title": "Share Alike", |
29 | 31 | "cc_pd_title": "Public Domain", |
30 | | - "unknown_license": "Unknown License", |
| 32 | + "unknown_license": "Unknown License", |
31 | 33 | |
32 | 34 | "no_import_by_url": "This User or Wiki <b>can not</b> import assets from remote URLs. <br> If permissions are set you may have to enable $wgAllowCopyUploads, <a href=\"http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads\">more info</a>" |
33 | 35 | }); |
34 | 36 | var default_remote_search_options = { |
35 | 37 | 'profile':'mediawiki_edit', |
36 | | - 'target_id':null, //the div that will hold the search interface |
| 38 | + 'target_container':null, //the div that will hold the search interface |
| 39 | + 'target_invocation': null, //the button or link that will invoke the search interface |
37 | 40 | |
38 | 41 | 'default_provider_id':'all', //all or one of the content_providers ids |
39 | 42 | |
— | — | @@ -50,8 +53,7 @@ |
51 | 54 | 'cFileNS':'File', //what is the cannonical namespace for images |
52 | 55 | //@@todo (should get that from the api or inpage vars) |
53 | 56 | |
54 | | - 'enable_upload_tab':true, // if we want to enable an uploads tab: |
55 | | - 'enable_combined_tab':false |
| 57 | + 'enable_upload_tab':true, // if we want to enable an uploads tab: |
56 | 58 | } |
57 | 59 | |
58 | 60 | if(typeof wgServer == 'undefined') |
— | — | @@ -295,7 +297,8 @@ |
296 | 298 | cUpLoader : null, |
297 | 299 | cEdit : null, |
298 | 300 | |
299 | | - init : function( initObj ){ |
| 301 | + init: function( initObj ){ |
| 302 | + var _this = this; |
300 | 303 | js_log('remoteSearchDriver:init'); |
301 | 304 | for( var i in default_remote_search_options ) { |
302 | 305 | if( initObj[i]){ |
— | — | @@ -315,24 +318,123 @@ |
316 | 319 | } |
317 | 320 | //overwrite the default query if a text selection was made: |
318 | 321 | if(this.target_textbox) |
319 | | - this.getTexboxSelection(); |
| 322 | + this.getTexboxSelection(); |
| 323 | + |
| 324 | + //set up the target invocation: |
| 325 | + if($j(this.target_invocation).length==0){ |
| 326 | + js_error("RemoteSearchDriver:: no target invocation provided") |
| 327 | + }else{ |
| 328 | + $j(this.target_invocation).css('cursor','pointer').attr('title', gM('add_media_wizard')).click(function(){ |
| 329 | + _this.doInitDisplay(); |
| 330 | + }); |
| 331 | + } |
320 | 332 | }, |
321 | 333 | doInitDisplay:function(){ |
| 334 | + //setup the parent container: |
| 335 | + this.init_modal(); |
| 336 | + //fill in the html: |
322 | 337 | this.init_interface_html(); |
| 338 | + //bind actions: |
323 | 339 | this.add_interface_bindings(); |
324 | 340 | }, |
325 | 341 | //gets the in and out points for insert position or grabs the selected text for search |
326 | | - getTexboxSelection:function(){ |
327 | | - if(this.caret_pos){ |
328 | | - if(this.caret_pos.s && this.caret_pos.e && |
| 342 | + getTexboxSelection:function(){ |
| 343 | + //update the caretPos |
| 344 | + this.getCaretPos(); |
| 345 | + |
| 346 | + //if we have highlighted text use that as the query: (would be fun to add context menu) |
| 347 | + if( this.caret_pos.selection ) |
| 348 | + this.default_query = this.caret_pos.selection |
| 349 | + |
| 350 | + }, |
| 351 | + getCaretPos:function(){ |
| 352 | + this.caret_pos={}; |
| 353 | + var txtarea = $j(this.target_textbox).get(0); |
| 354 | + var getTextCusorStartPos = function (o){ |
| 355 | + if (o.createTextRange) { |
| 356 | + var r = document.selection.createRange().duplicate() |
| 357 | + r.moveEnd('character', o.value.length) |
| 358 | + if (r.text == '') return o.value.length |
| 359 | + return o.value.lastIndexOf(r.text) |
| 360 | + } else return o.selectionStart |
| 361 | + } |
| 362 | + var getTextCusorEndPos = function (o){ |
| 363 | + if (o.createTextRange) { |
| 364 | + var r = document.selection.createRange().duplicate(); |
| 365 | + r.moveStart('character', -o.value.length); |
| 366 | + return r.text.length; |
| 367 | + } else{ |
| 368 | + return o.selectionEnd |
| 369 | + } |
| 370 | + } |
| 371 | + this.caret_pos.s = getTextCusorStartPos( txtarea ); |
| 372 | + this.caret_pos.e = getTextCusorEndPos( txtarea ); |
| 373 | + this.caret_pos.text = txtarea.value; |
| 374 | + if(this.caret_pos.s && this.caret_pos.e && |
329 | 375 | (this.caret_pos.s != this.caret_pos.e)) |
330 | | - this.default_query = this.caret_pos.text.substring(this.caret_pos.s, this.caret_pos.e).replace(/ /g, '\xa0') || '\xa0' |
| 376 | + this.caret_pos.selection = this.caret_pos.text.substring(this.caret_pos.s, this.caret_pos.e).replace(/ /g, '\xa0') || '\xa0'; |
| 377 | + |
| 378 | + //restore text value: (creating textRanges sometimes screws with the text content) |
| 379 | + $j(this.target_textbox).val(this.caret_pos.text); |
| 380 | + }, |
| 381 | + init_modal:function(){ |
| 382 | + var _this = this; |
| 383 | + //add the parent target_container if not provided or missing |
| 384 | + if(!_this.target_container || $j(_this.target_container).length==0){ |
| 385 | + $j('body').append('<div id="rsd_modal_target" title="' + gM('add_media_wizard') + '" ></div>'); |
| 386 | + _this.target_container = '#rsd_modal_target'; |
| 387 | + js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id')); |
| 388 | + js_log('added target id:' + $j(_this.target_container).attr('id')); |
| 389 | + //get layout |
| 390 | + layout = _this.getMaxModalLayout(); |
| 391 | + $j(_this.target_container).dialog({ |
| 392 | + bgiframe: true, |
| 393 | + autoOpen: true, |
| 394 | + height: layout.h , |
| 395 | + width: layout.w, |
| 396 | + position: [layout.t,layout.r], |
| 397 | + modal: true, |
| 398 | + buttons: { |
| 399 | + 'Cancel': function() { |
| 400 | + $j(this).dialog('close'); |
| 401 | + } |
| 402 | + }, |
| 403 | + close: function() { |
| 404 | + js_log('closed modal'); |
| 405 | + } |
| 406 | + }); |
| 407 | + //for some reaons the width does not "stick on init: |
| 408 | + //$j(_this.target_container).dialog('option', 'width', 800); |
| 409 | + var resizeTimer = false; |
| 410 | + $j(window).bind('resize', function() { |
| 411 | + var adjustModal = function(){ |
| 412 | + var layout = _this.getMaxModalLayout(); |
| 413 | + js_log("should adjust: h " + layout.h + ' width:' + layout.w); |
| 414 | + $j(_this.target_container).dialog('option', 'width', layout.w); |
| 415 | + $j(_this.target_container).dialog('option', 'height', layout.h); |
| 416 | + } |
| 417 | + if (resizeTimer) clearTimeout(resizeTimer); |
| 418 | + var resizeTimer = setTimeout(adjustModal, 100); |
| 419 | + }); |
| 420 | + } |
| 421 | + }, |
| 422 | + getMaxModalLayout:function(border){ |
| 423 | + if(!border) |
| 424 | + border = 50; |
| 425 | + js_log('setting h:' + (parseInt( $j(document).height() ) - parseInt(border*2)) + ' from:' + $j(document).height() ); |
| 426 | + return { |
| 427 | + 'h': parseInt( $j(document).height() ) - parseInt(border*2), |
| 428 | + 'w': parseInt( $j(document).width() ) - parseInt(border*2), |
| 429 | + 'r': border, |
| 430 | + 't': border |
331 | 431 | } |
332 | | - }, |
| 432 | + }, |
333 | 433 | //sets up the initial html interface |
334 | 434 | init_interface_html:function(){ |
335 | 435 | var _this = this; |
336 | 436 | var dq = (this.default_query)? this.default_query : ''; |
| 437 | + js_log('f::init_interface_html'); |
| 438 | + |
337 | 439 | var out = '<div class="rsd_control_container" style="width:100%">' + |
338 | 440 | '<form id="rsd_form" action="javascript:return false;" method="GET">'+ |
339 | 441 | '<table style="width:100%;background-color:transparent;">' + |
— | — | @@ -375,12 +477,14 @@ |
376 | 478 | } |
377 | 479 | out+='<div style="clear:both"/><a id="mso_selprovider_close" href="#">'+gM('close')+'</a></div>'; |
378 | 480 | out+='</div>'; |
| 481 | + |
379 | 482 | //close up the control container: |
380 | 483 | out+='</div>'; |
| 484 | + |
381 | 485 | //search provider tabs based on "checked" and "enabled" and "combined tab" |
382 | 486 | out+='<div id="rsd_results_container"></div>'; |
383 | 487 | |
384 | | - $j('#'+ this.target_id ).html( out ); |
| 488 | + $j(this.target_container).html( out ); |
385 | 489 | //draw the tabs: |
386 | 490 | this.drawTabs(); |
387 | 491 | //run the default search: |
— | — | @@ -389,7 +493,8 @@ |
390 | 494 | }, |
391 | 495 | add_interface_bindings:function(){ |
392 | 496 | var _this = this; |
393 | | - js_log("f:add_interface_bindings:"); |
| 497 | + js_log("f:add_interface_bindings:"); |
| 498 | + |
394 | 499 | //setup for this.main_search_options: |
395 | 500 | $j('#mso_cancel').unbind().click(function(){ |
396 | 501 | _this.closeAll(); |
— | — | @@ -419,17 +524,15 @@ |
420 | 525 | }, |
421 | 526 | doUploadInteface:function(){ |
422 | 527 | var _this = this; |
423 | | - mv_set_loading('#rsd_results'); |
| 528 | + mv_set_loading('#tab-upload'); |
424 | 529 | |
425 | | - //load the (firefog enhanced) upload manager: |
426 | | - |
427 | | - //load the upload.js from mediaWiki: |
| 530 | + //todo @this |
428 | 531 | mvJsLoader.doLoad( {'mvUploader': 'libAddMedia/mvClipEdit.js'},function(){ |
429 | 532 | _this.cUpLoader = new mvUploader({ |
430 | | - 'target_div': 'rsd_results', |
| 533 | + 'target_div': '#tab-upload', |
431 | 534 | 'upload_done_action:': function( rTitle){ |
432 | 535 | //set to loading: |
433 | | - mv_set_loading('#rsd_results'); |
| 536 | + mv_set_loading('#tab-upload'); |
434 | 537 | //do a direct api query for resource info (to build rObj |
435 | 538 | _this.getResourceFromTitle( rTitle, function(rObj){ |
436 | 539 | //call resource Edit: |
— | — | @@ -443,44 +546,36 @@ |
444 | 547 | runSearch: function(){ |
445 | 548 | js_log("f:runSearch"); |
446 | 549 | //draw_direct_flag |
447 | | - var draw_direct_flag = true; |
448 | | - //set loading div: |
449 | | - mv_set_loading('#rsd_results'); |
| 550 | + var draw_direct_flag = true; |
450 | 551 | |
451 | | - //get a remote search object for each search provider and run the search |
| 552 | + //set the display item if not already set: |
452 | 553 | for(var cp_id in this.content_providers){ |
453 | | - var cp = this.content_providers[ cp_id ]; |
454 | | - |
455 | | - //only run the search for default item (unless combined is selected) |
456 | | - if( !cp.d || this.disp_item == 'combined' ) |
457 | | - continue; |
458 | | - |
459 | | - //set display if unset |
460 | | - if( !this.disp_item ) |
461 | | - this.disp_item = cp_id; |
462 | | - |
463 | | - //check if we need to update: |
464 | | - if( typeof cp.sObj != 'undefined' ){ |
465 | | - if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset){ |
466 | | - js_log('last query is: ' + cp.sObj.last_query + ' matches: ' + $j('#rsd_q').val() ); |
467 | | - }else{ |
468 | | - js_log('last query is: ' + cp.sObj.last_query + ' not match: ' + $j('#rsd_q').val() ); |
469 | | - draw_direct_flag = false; |
| 554 | + if( this.content_providers[ cp_id ].d ){ |
| 555 | + if (!this.disp_item ){ |
| 556 | + this.disp_item = cp_id; |
| 557 | + break; |
470 | 558 | } |
| 559 | + } |
| 560 | + } |
| 561 | + cp = this.content_providers[this.disp_item]; |
| 562 | + //set the content to loading while we do the search: |
| 563 | + $j('#tab-' + this.disp_item).html( mv_get_loading_img() ); |
| 564 | + |
| 565 | + //check if we need to update: |
| 566 | + if( typeof cp.sObj != 'undefined' ){ |
| 567 | + if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset){ |
| 568 | + js_log('last query is: ' + cp.sObj.last_query + ' matches: ' + $j('#rsd_q').val() ); |
471 | 569 | }else{ |
| 570 | + js_log('last query is: ' + cp.sObj.last_query + ' not match: ' + $j('#rsd_q').val() ); |
472 | 571 | draw_direct_flag = false; |
473 | 572 | } |
474 | | - if( !draw_direct_flag ){ |
475 | | - //make sure the search library is loaded and issue the search request |
476 | | - this.getLibSearchResults( cp ); |
477 | | - } |
| 573 | + }else{ |
| 574 | + draw_direct_flag = false; |
478 | 575 | } |
479 | | - |
480 | | - //draw the results without running a query |
481 | | - if( draw_direct_flag ){ |
482 | | - js_log('do drawOutputResults direct') |
483 | | - this.drawOutputResults(); |
484 | | - } |
| 576 | + if( !draw_direct_flag ){ |
| 577 | + //make sure the search library is loaded and issue the search request |
| 578 | + this.getLibSearchResults( cp ); |
| 579 | + } |
485 | 580 | }, |
486 | 581 | //issue a api request & cache the result |
487 | 582 | //this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | insted of 'autodetect' or 'none' |
— | — | @@ -622,44 +717,55 @@ |
623 | 718 | drawTabs: function(){ |
624 | 719 | var _this = this; |
625 | 720 | //add the tabs to the rsd_results container: |
626 | | - var o='<div class="rsd_tabs_container" style="position:absolute;top:41px;width:100%;left:12px;height:25px;">'; |
627 | | - //o+= '<ul class="rsd_cp_tabs" style="margin: 0 0 0 0;position:absolute;top:0px;padding:0;">'; //no idea why margin does not overwrite from the css |
628 | | - //output combined tab: |
629 | | - if(_this.enable_combined_tab) |
630 | | - o+='<div id="rsd_tab_combined" class="rsd_cp_tab"><img src="' + mv_skin_img_path + 'remote_cp/combined_tab.png"></div>'; |
631 | | - |
| 721 | + var o='<div id="rsd_tabs_container" style="width:100%;">'; |
| 722 | + o+= '<ul>'; |
| 723 | + var tabc = ''; |
632 | 724 | for(var cp_id in this.content_providers){ |
633 | | - var cp = this.content_providers[cp_id]; |
634 | | - if( cp.enabled && cp.checked){ |
635 | | - var class_attr = 'class="rsd_cp_tab'; |
636 | | - //add selected if so: |
637 | | - class_attr+= (cp.d)?' rsd_selected"':'"'; |
638 | | - o+='<div id="rsd_tab_'+cp_id+'" ' + class_attr + '>'; |
639 | | - if(cp.tab_img === true){ |
640 | | - o+='<img alt="' + cp.title +'" src="' + mv_skin_img_path + 'remote_cp/' + cp_id + '_tab.png"></div>'; |
641 | | - }else if(typeof cp.tab_img=='string'){ |
642 | | - o+='<img alt="' + cp.title +'" src="' + cp.tab_img + '"></li>'; |
643 | | - }else if(cp.tab_img === false){ |
644 | | - o+= cp.title; |
645 | | - } |
646 | | - } |
| 725 | + var cp = this.content_providers[cp_id]; |
| 726 | + if( cp.enabled && cp.checked){ |
| 727 | + var class_attr = 'class="rsd_cp_tab'; |
| 728 | + //add selected if so: |
| 729 | + class_attr+= (cp.d)?' rsd_selected"':'"'; |
| 730 | + o+='<li id="rsd_tab_' + cp_id + '" ' + class_attr + '>'; |
| 731 | + o+='<a href="#tab-' + cp_id + '">'; |
| 732 | + if(cp.tab_img === true){ |
| 733 | + o+='<img alt="' + cp.title +'" src="' + mv_skin_img_path + 'remote_cp/' + cp_id + '_tab.png">'; |
| 734 | + }else{ |
| 735 | + o+= cp.title; |
| 736 | + } |
| 737 | + o+='</a>'; |
| 738 | + o+='</li>'; |
| 739 | + } |
| 740 | + |
| 741 | + tabc+='<div id="tab-'+ cp_id +'" class="rsd_results"/>'; |
| 742 | + |
647 | 743 | } |
648 | | - //do an upload tab if enabled: |
649 | | - if( this.enable_upload_tab ){ |
650 | | - var class_attr = 'class="rsd_cp_tab'; |
651 | | - class_attr+= ( this.disp_item =='upload' ) ?' rsd_selected"':'"'; |
652 | | - o+='<div id="rsd_tab_upload" ' + class_attr + '> ' + gM('upload') + '</div>'; |
653 | | - } |
654 | | - //o+='</ul>'; |
655 | | - o+='</div>'; |
656 | | - //outout the resource results holder |
657 | | - o+='<div id="rsd_results" />'; |
| 744 | + //do an upload tab if enabled: |
| 745 | + if( this.enable_upload_tab ){ |
| 746 | + var class_attr = 'class="rsd_cp_tab'; |
| 747 | + class_attr+= ( this.disp_item =='upload' ) ?' rsd_selected"':'"'; |
| 748 | + o+='<li id="rsd_tab_upload" ' + class_attr + '><a href="#tab-upload">' + gM('upload') + '</a></li>'; |
| 749 | + tabc+='<div id="tab-upload" />'; |
| 750 | + } |
| 751 | + o+='</ul>'; |
| 752 | + //output the tab content containers: |
| 753 | + o+=tabc; |
| 754 | + o+='</div>'; //close tab container |
| 755 | + |
| 756 | + //output the respective results holders |
658 | 757 | $j('#rsd_results_container').html(o); |
659 | 758 | |
660 | | - //setup bindings for tabs: |
661 | | - $j('.rsd_cp_tab').click(function(){ |
| 759 | + //setup bindings for tabs make them sortable: (@@todo remember order) |
| 760 | + $j("#rsd_tabs_container").tabs({ |
| 761 | + select: function(event, ui) { |
| 762 | + js_log($j(this).id); |
| 763 | + } |
| 764 | + //add sorting |
| 765 | + }).find(".ui-tabs-nav").sortable({axis:'x'}); |
| 766 | + |
| 767 | + /*$j('.rsd_cp_tab').click(function(){ |
662 | 768 | _this.selectTab( $j(this).attr('id').replace(/rsd_tab_/, '') ); |
663 | | - }); |
| 769 | + });*/ |
664 | 770 | |
665 | 771 | //setup key binding |
666 | 772 | $j().keyup(function(e){ |
— | — | @@ -709,76 +815,72 @@ |
710 | 816 | drawOutputResults: function(){ |
711 | 817 | js_log('f:drawOutputResults'); |
712 | 818 | var _this = this; |
713 | | - var o=''; |
714 | | - $j('#rsd_results').empty(); |
| 819 | + var o=''; |
| 820 | + |
| 821 | + var cp_id = this.disp_item; |
| 822 | + var cp = this.content_providers[this.disp_item]; |
| 823 | + |
| 824 | + //empty the existing results: |
| 825 | + $j('#tab-' + cp_id).empty(); |
| 826 | + |
715 | 827 | //output the results bar / controls |
716 | 828 | _this.setResultBarControl(); |
717 | 829 | |
718 | 830 | var drawResultCount =0; |
719 | 831 | |
720 | | - //output all the results (hide based on tab selection) |
721 | | - for( var cp_id in this.content_providers ){ |
722 | | - cp = this.content_providers[ cp_id ]; |
723 | | - //output results based on display mode & input: |
724 | | - if( typeof cp['sObj'] != 'undefined' ){ |
725 | | - $j.each(cp.sObj.resultsObj, function(rInx, rItem){ |
726 | | - var disp = ( cp.d ) ? '' : 'display:none;'; |
727 | | - |
728 | | - if( _this.result_display_mode == 'box' ){ |
729 | | - o+='<div id="mv_result_' + rInx + '" class="mv_clip_box_result" style="' + disp + 'width:' + |
730 | | - _this.thumb_width + 'px;height:'+ (_this.thumb_width-20) +'px;position:relative;">'; |
731 | | - //check for missing poster types for audio |
732 | | - if( rItem.mime=='audio/ogg' && !rItem.poster ){ |
733 | | - rItem.poster = mv_skin_img_path + 'sound_music_icon-80.png'; |
734 | | - } |
735 | | - //get a thumb with proper resolution transform if possible: |
736 | | - o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx + |
737 | | - '" style="width:' + _this.thumb_width + 'px;" src="' + |
738 | | - cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } ) |
739 | | - + '">'; |
740 | | - //add a linkback to resource page in upper right: |
741 | | - if( rItem.link ) |
742 | | - o+='<a target="_new" style="position:absolute;top:0px;right:0px" title="' + |
743 | | - gM('resource_description_page') + |
744 | | - '" href="' + rItem.link + '"><img src="' + stylepath + |
745 | | - '/common/images/magnify-clip.png"></a>'; |
746 | | - //add license icons if present |
747 | | - if( rItem.license ) |
748 | | - o+= _this.getlicenseImgSet( rItem.license ); |
749 | | - o+='</div>'; |
750 | | - }else if(_this.result_display_mode == 'list'){ |
751 | | - o+='<div id="mv_result_' + rInx + '" class="mv_clip_list_result" style="' + disp + 'width:90%">'; |
752 | | - o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx +'" style="float:left;width:' + |
753 | | - _this.thumb_width + 'px; padding:5px;" src="' + |
754 | | - cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } ) |
755 | | - + '">'; |
756 | | - |
757 | | - //add license icons if present |
758 | | - if( rItem.license ) |
759 | | - o+= _this.getlicenseImgSet( rItem.license ); |
760 | | - |
761 | | - o+= rItem.desc ; |
762 | | - o+='<div style="clear:both" />'; |
763 | | - o+='</div>'; |
764 | | - } |
765 | | - |
766 | | - if( cp.d ) |
767 | | - drawResultCount++; |
768 | | - }); |
769 | | - } |
770 | | - } |
771 | | - //put in the new output: |
772 | | - $j('#rsd_results').append( o ); |
| 832 | + //output all the results for the current disp_item |
| 833 | + if( typeof cp['sObj'] != 'undefined' ){ |
| 834 | + $j.each(cp.sObj.resultsObj, function(rInx, rItem){ |
| 835 | + if( _this.result_display_mode == 'box' ){ |
| 836 | + o+='<div id="mv_result_' + rInx + '" class="mv_clip_box_result" style="width:' + |
| 837 | + _this.thumb_width + 'px;height:'+ (_this.thumb_width-20) +'px;position:relative;">'; |
| 838 | + //check for missing poster types for audio |
| 839 | + if( rItem.mime=='audio/ogg' && !rItem.poster ){ |
| 840 | + rItem.poster = mv_skin_img_path + 'sound_music_icon-80.png'; |
| 841 | + } |
| 842 | + //get a thumb with proper resolution transform if possible: |
| 843 | + o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx + |
| 844 | + '" style="width:' + _this.thumb_width + 'px;" src="' + |
| 845 | + cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } ) |
| 846 | + + '">'; |
| 847 | + //add a linkback to resource page in upper right: |
| 848 | + if( rItem.link ) |
| 849 | + o+='<a target="_new" style="position:absolute;top:0px;right:0px" title="' + |
| 850 | + gM('resource_description_page') + |
| 851 | + '" href="' + rItem.link + '"><img src="' + stylepath + |
| 852 | + '/common/images/magnify-clip.png"></a>'; |
| 853 | + //add license icons if present |
| 854 | + if( rItem.license ) |
| 855 | + o+= _this.getlicenseImgSet( rItem.license ); |
| 856 | + o+='</div>'; |
| 857 | + }else if(_this.result_display_mode == 'list'){ |
| 858 | + o+='<div id="mv_result_' + rInx + '" class="mv_clip_list_result" style="width:90%">'; |
| 859 | + o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx +'" style="float:left;width:' + |
| 860 | + _this.thumb_width + 'px; padding:5px;" src="' + |
| 861 | + cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } ) |
| 862 | + + '">'; |
| 863 | + |
| 864 | + //add license icons if present |
| 865 | + if( rItem.license ) |
| 866 | + o+= _this.getlicenseImgSet( rItem.license ); |
| 867 | + |
| 868 | + o+= rItem.desc ; |
| 869 | + o+='<div style="clear:both" />'; |
| 870 | + o+='</div>'; |
| 871 | + } |
| 872 | + drawResultCount++; |
| 873 | + }); |
| 874 | + //put in the tab output (plus clear the output) |
| 875 | + $j('#tab-' + cp_id).append( o + '<div style="clear:both"/>'); |
| 876 | + } |
773 | 877 | |
774 | 878 | js_log( ' drawResultCount :: ' + drawResultCount + ' append: ' + $j('#rsd_q').val() ); |
775 | 879 | |
776 | 880 | //remove any old search res |
777 | 881 | $j('#rsd_no_search_res').remove(); |
778 | 882 | if( drawResultCount == 0 ) |
779 | | - $j('#rsd_results').append( '<span style="padding:10px">' + gM( 'rsd_no_results', $j('#rsd_q').val() ) + '</span>'); |
| 883 | + $j('#tab-' + cp_id).append( '<span style="padding:10px">' + gM( 'rsd_no_results', $j('#rsd_q').val() ) + '</span>'); |
780 | 884 | |
781 | | - //remove rss only display class if present |
782 | | - $j('#rsd_results .mv_rss_view_only').remove(); |
783 | 885 | this.addResultBindings(); |
784 | 886 | }, |
785 | 887 | addResultBindings:function(){ |
— | — | @@ -825,7 +927,7 @@ |
826 | 928 | //so that transcripts show ontop |
827 | 929 | var overflow_style = ( mediaType =='video' )?'':'overflow:auto;'; |
828 | 930 | //append to the top level of model window: |
829 | | - $j( '#'+ _this.target_id ).append('<div id="rsd_resource_edit" '+ |
| 931 | + $j( _this.target_container ).append('<div id="rsd_resource_edit" '+ |
830 | 932 | 'style="position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#FFF;">' + |
831 | 933 | '<h3 id="rsd_resource_title" style="margin:4px;">' + gM('rsd_resource_edit', rObj.title ) +'</h3>'+ |
832 | 934 | '<div id="clip_edit_disp" style="position:absolute;'+overflow_style+'top:35px;left:5px;bottom:0px;'+ |
— | — | @@ -838,7 +940,7 @@ |
839 | 941 | '</div>'+ |
840 | 942 | '</div>'); |
841 | 943 | |
842 | | - js_log('did append to: '+ _this.target_id ); |
| 944 | + js_log('did append to: '+ _this.target_container ); |
843 | 945 | |
844 | 946 | $j('#rsd_resource_edit').css('opacity',0); |
845 | 947 | |
— | — | @@ -947,7 +1049,7 @@ |
948 | 1050 | // normally this meta should be provided in the search result (but archive.org has a seperate query for more meida meta) |
949 | 1051 | rObj.pSobj.getEmbedTimeMeta( rObj, function(){ |
950 | 1052 | //make sure we have the embedVideo libs: |
951 | | - mvJsLoader.embedVideoCheck(function(){ |
| 1053 | + mvJsLoader.embedVideoCheck( function(){ |
952 | 1054 | js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) ); |
953 | 1055 | $j('#clip_edit_disp').append( |
954 | 1056 | rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
— | — | @@ -957,7 +1059,7 @@ |
958 | 1060 | //grab any information that we got from the ROE xml or parsed from the media file |
959 | 1061 | rObj.pSobj.getEmbedObjParsedInfo( rObj, 'embed_vid' ); |
960 | 1062 | //add the re-sizable to the doLoad request: |
961 | | - clibs['$j.ui.resizable'] ='jquery/jquery.ui-1.7.1/ui/ui.resizable.js'; |
| 1063 | + clibs['$j.ui.resizable'] ='jquery/' + jQueryUiVN + '/ui/ui.resizable.js'; |
962 | 1064 | clibs['$j.fn.hoverIntent'] ='jquery/plugins/jquery.hoverIntent.js'; |
963 | 1065 | mvJsLoader.doLoad(clibs, function(){ |
964 | 1066 | //make sure the rsd_edit_img is hidden: |
— | — | @@ -1051,7 +1153,7 @@ |
1052 | 1154 | |
1053 | 1155 | $j('#rsd_resource_import').remove();//remove any old resource imports |
1054 | 1156 | //@@ show user dialog to import the resource |
1055 | | - $j( '#'+ _this.target_id ).append('<div id="rsd_resource_import" '+ |
| 1157 | + $j( _this.target_container ).append('<div id="rsd_resource_import" '+ |
1056 | 1158 | 'style="position:absolute;top:50px;left:50px;right:50px;bottom:50px;background-color:#FFF;border:solid thick red;z-index:3">' + |
1057 | 1159 | '<h3 style="color:red">Resource: <span style="color:black">' + rObj.title + '</span> needs to be imported</h3>'+ |
1058 | 1160 | '<div id="rsd_preview_import_container" style="position:absolute;width:50%;bottom:0px;left:0px;overflow:auto;top:30px;">' + |
— | — | @@ -1192,7 +1294,7 @@ |
1193 | 1295 | var _this = this; |
1194 | 1296 | this.checkImportResource( rObj, function(){ |
1195 | 1297 | //put another window ontop: |
1196 | | - $j( '#'+ _this.target_id ).append('<div id="rsd_resource_preview" '+ |
| 1298 | + $j( _this.target_container ).append('<div id="rsd_resource_preview" '+ |
1197 | 1299 | 'style="position:absolute;z-index:4;top:0px;left:0px;width:100%;height:100%;background-color:#FFF;">' + |
1198 | 1300 | '<h3>preview insert of resource: ' + rObj.title + '</h3>'+ |
1199 | 1301 | '<div id="rsd_preview_display" style="position:absolute;width:100%;top:30px;bottom:30px;overflow:auto;">' + |
— | — | @@ -1269,86 +1371,78 @@ |
1270 | 1372 | if( this.content_providers[this.disp_item] ){ |
1271 | 1373 | var cp = this.content_providers[this.disp_item]; |
1272 | 1374 | about_desc ='<span style="position:relative;top:0px;font-style:italic;">' + |
1273 | | - ' <i> Results From <a href="'+ cp.homepage + '" target="_new" >'+ cp.title +'</a> </i></span>'; |
| 1375 | + ' <i> Results From <a href="'+ cp.homepage + '" target="_new" >'+ cp.title +'</a> </i></span>'; |
| 1376 | + $j('#tab-'+this.disp_item).append( '<div id="rds_results_bar">'+ |
| 1377 | + '<span style="position:relative;top:0px;font-style:italic;">'+ |
| 1378 | + gM('rsd_layout')+' '+ |
| 1379 | + '</span>'+ |
| 1380 | + '<img id="msc_box_layout" ' + |
| 1381 | + 'title = "' + gM('rsd_box_layout') + '" '+ |
| 1382 | + 'src = "' + ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) + '" ' + |
| 1383 | + 'style="width:20px;height:20px;cursor:pointer;"> ' + |
| 1384 | + '<img id="msc_list_layout" '+ |
| 1385 | + 'title = "' + gM('rsd_list_layout') + '" '+ |
| 1386 | + 'src = "' + ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) + '" '+ |
| 1387 | + 'style="width:20px;height:20px;cursor:pointer;">'+ |
| 1388 | + '<span id="rsd_paging_ctrl" style="float:right;top:5px;"></span>'+ |
| 1389 | + about_desc + |
| 1390 | + '</div>' |
| 1391 | + ); |
| 1392 | + //get paging with bindings: |
| 1393 | + this.getPaging('#rsd_paging_ctrl'); |
| 1394 | + |
| 1395 | + $j('#msc_box_layout').hover(function(){ |
| 1396 | + $j(this).attr("src", box_dark_url ); |
| 1397 | + }, function(){ |
| 1398 | + $j(this).attr("src", ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) ); |
| 1399 | + }).click(function(){ |
| 1400 | + $j(this).attr("src", box_dark_url); |
| 1401 | + $j('#msc_list_layout').attr("src", list_light_url); |
| 1402 | + _this.setDispMode('box'); |
| 1403 | + }); |
| 1404 | + |
| 1405 | + $j('#msc_list_layout').hover(function(){ |
| 1406 | + $j(this).attr("src", list_dark_url); |
| 1407 | + }, function(){ |
| 1408 | + $j(this).attr("src", ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) ); |
| 1409 | + }).click(function(){ |
| 1410 | + $j(this).attr("src", list_dark_url); |
| 1411 | + $j('#msc_box_layout').attr("src", box_light_url); |
| 1412 | + _this.setDispMode('list'); |
| 1413 | + }); |
1274 | 1414 | } |
1275 | | - $j('#rsd_results').append( '<div id="rds_results_bar">'+ |
1276 | | - '<span style="position:relative;top:0px;font-style:italic;">'+ |
1277 | | - gM('rsd_layout')+' '+ |
1278 | | - '</span>'+ |
1279 | | - '<img id="msc_box_layout" ' + |
1280 | | - 'title = "' + gM('rsd_box_layout') + '" '+ |
1281 | | - 'src = "' + ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) + '" ' + |
1282 | | - 'style="width:20px;height:20px;cursor:pointer;"> ' + |
1283 | | - '<img id="msc_list_layout" '+ |
1284 | | - 'title = "' + gM('rsd_list_layout') + '" '+ |
1285 | | - 'src = "' + ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) + '" '+ |
1286 | | - 'style="width:20px;height:20px;cursor:pointer;">'+ |
1287 | | - '<span id="rsd_paging_ctrl" style="position:absolute;right:5px;top:5px;"></span>'+ |
1288 | | - about_desc + |
1289 | | - '</div>' |
1290 | | - ); |
1291 | | - //get paging with bindings: |
1292 | | - this.getPaging('#rsd_paging_ctrl'); |
1293 | | - |
1294 | | - $j('#msc_box_layout').hover(function(){ |
1295 | | - $j(this).attr("src", box_dark_url ); |
1296 | | - }, function(){ |
1297 | | - $j(this).attr("src", ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) ); |
1298 | | - }).click(function(){ |
1299 | | - $j(this).attr("src", box_dark_url); |
1300 | | - $j('#msc_list_layout').attr("src", list_light_url); |
1301 | | - _this.setDispMode('box'); |
| 1415 | + }, |
| 1416 | + getPaging:function(target){ |
| 1417 | + var _this = this; |
| 1418 | + var cp_id = this.disp_item; |
| 1419 | + var cp = this.content_providers[ this.disp_item ]; |
| 1420 | + //js_log('getPaging:'+ cp_id + ' len: ' + cp.sObj.num_results); |
| 1421 | + var to_num = ( cp.limit > cp.sObj.num_results )? |
| 1422 | + (cp.offset + cp.sObj.num_results): |
| 1423 | + (cp.offset + cp.limit); |
| 1424 | + var out = gM('rsd_results_desc') + ' ' + (cp.offset+1) + ' to ' + to_num; |
| 1425 | + //check if we have more results (next prev link) |
| 1426 | + if( cp.offset >= cp.limit ) |
| 1427 | + out+=' <a href="#" id="rsd_pprev">' + gM('rsd_results_prev') + ' ' + cp.limit + '</a>'; |
| 1428 | + |
| 1429 | + if( cp.sObj.more_results ) |
| 1430 | + out+=' <a href="#" id="rsd_pnext">' + gM('rsd_results_next') + ' ' + cp.limit + '</a>'; |
| 1431 | + |
| 1432 | + $j(target).html(out); |
| 1433 | + //set bindings |
| 1434 | + $j('#rsd_pnext').click(function(){ |
| 1435 | + cp.offset += cp.limit; |
| 1436 | + _this.runSearch(); |
1302 | 1437 | }); |
1303 | | - |
1304 | | - $j('#msc_list_layout').hover(function(){ |
1305 | | - $j(this).attr("src", list_dark_url); |
1306 | | - }, function(){ |
1307 | | - $j(this).attr("src", ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) ); |
1308 | | - }).click(function(){ |
1309 | | - $j(this).attr("src", list_dark_url); |
1310 | | - $j('#msc_box_layout').attr("src", box_light_url); |
1311 | | - _this.setDispMode('list'); |
| 1438 | + $j('#rsd_pprev').click(function(){ |
| 1439 | + cp.offset -= cp.limit; |
| 1440 | + if(cp.offset<0) |
| 1441 | + cp.offset=0; |
| 1442 | + _this.runSearch(); |
1312 | 1443 | }); |
1313 | | - }, |
1314 | | - getPaging:function(target){ |
1315 | | - var _this = this; |
1316 | | - //if more than one repository displayed (disable paging) |
1317 | | - if(this.disp_item == 'combined'){ |
1318 | | - $j(target).html('no paging for combined results'); |
1319 | | - return ; |
1320 | | - } |
1321 | | - for(var cp_id in this.content_providers){ |
1322 | | - if(this.disp_item == cp_id){ |
1323 | | - var cp = this.content_providers[ cp_id ]; |
1324 | | - //js_log('getPaging:'+ cp_id + ' len: ' + cp.sObj.num_results); |
1325 | | - var to_num = ( cp.limit > cp.sObj.num_results )? |
1326 | | - (cp.offset + cp.sObj.num_results): |
1327 | | - (cp.offset + cp.limit); |
1328 | | - var out = gM('rsd_results_desc') + ' ' + (cp.offset+1) + ' to ' + to_num; |
1329 | | - //check if we have more results (next prev link) |
1330 | | - if( cp.offset >= cp.limit ) |
1331 | | - out+=' <a href="#" id="rsd_pprev">' + gM('rsd_results_prev') + ' ' + cp.limit + '</a>'; |
1332 | | - |
1333 | | - if( cp.sObj.more_results ) |
1334 | | - out+=' <a href="#" id="rsd_pnext">' + gM('rsd_results_next') + ' ' + cp.limit + '</a>'; |
1335 | | - |
1336 | | - $j(target).html(out); |
1337 | | - //set bindings |
1338 | | - $j('#rsd_pnext').click(function(){ |
1339 | | - cp.offset += cp.limit; |
1340 | | - _this.runSearch(); |
1341 | | - }); |
1342 | | - $j('#rsd_pprev').click(function(){ |
1343 | | - cp.offset -= cp.limit; |
1344 | | - if(cp.offset<0) |
1345 | | - cp.offset=0; |
1346 | | - _this.runSearch(); |
1347 | | - }); |
1348 | | - |
1349 | | - return; |
1350 | | - } |
1351 | | - } |
1352 | 1444 | |
| 1445 | + return; |
| 1446 | + |
1353 | 1447 | }, |
1354 | 1448 | selectTab:function( selected_cp_id ){ |
1355 | 1449 | js_log('select tab: ' + selected_cp_id); |
— | — | @@ -1356,7 +1450,7 @@ |
1357 | 1451 | //set display to unselected: |
1358 | 1452 | for(var cp_id in this.content_providers){ |
1359 | 1453 | cp = this.content_providers[ cp_id ]; |
1360 | | - if( (selected_cp_id == 'combined' && cp.checked ) || selected_cp_id == cp_id){ |
| 1454 | + if( cp.checked || selected_cp_id == cp_id){ |
1361 | 1455 | cp.d = 1; |
1362 | 1456 | }else{ |
1363 | 1457 | cp.d = 0; |
Index: branches/new-upload/phase3/js2/mwEmbed/libSequencer/mvSequencer.js |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | }, function(){ |
131 | 131 | this_seq.mySearch = new seqRemoteSearchDriver({ |
132 | 132 | 'p_seq':this_seq, |
133 | | - 'target_id':'cliplib_ic', |
| 133 | + 'target_container':'#cliplib_ic', |
134 | 134 | 'local_wiki_api_url': this_seq.getLocalApiUrl(), |
135 | 135 | 'instance_name': this_seq.instance_name + '.mySearch' |
136 | 136 | }); |
— | — | @@ -461,7 +461,7 @@ |
462 | 462 | |
463 | 463 | //propagate the edit tokens |
464 | 464 | //if on an edit page just grab from the form: |
465 | | - this.sequenceEditToken = $j('input[@wpEditToken]').val(); |
| 465 | + this.sequenceEditToken = $j('input[wpEditToken]').val(); |
466 | 466 | if(typeof this.sequenceEditToken == 'undefined'){ |
467 | 467 | var reqObj = { |
468 | 468 | 'action':'query', |
Index: branches/new-upload/phase3/js2/mwEmbed/skins/mvpcf/styles.css |
— | — | @@ -484,6 +484,7 @@ |
485 | 485 | |
486 | 486 | #SEQUENCER CSS: |
487 | 487 | #resizable css: |
| 488 | +/* |
488 | 489 | .ui-resizable-handle { position: absolute; background: #ddd; display: none; } |
489 | 490 | .ui-resizable .ui-resizable-handle { display: block } |
490 | 491 | .ui-resizable-e { z-index:5; position:absolute; cursor: e-resize; |
— | — | @@ -503,7 +504,8 @@ |
504 | 505 | right:10px; |
505 | 506 | height:19px; |
506 | 507 | } |
507 | | - |
| 508 | +*/ |
| 509 | +/* |
508 | 510 | div.rsd_cp_tab_container{ |
509 | 511 | display:inline; |
510 | 512 | margin:0; |
— | — | @@ -544,10 +546,12 @@ |
545 | 547 | z-index:200; |
546 | 548 | overflow:auto; |
547 | 549 | } |
548 | | -#rsd_results { |
| 550 | +*/ |
| 551 | + |
| 552 | +/*#rsd_results { |
549 | 553 | border-top:0; |
550 | 554 | border:1px solid #777; |
551 | | - position:relative; |
| 555 | + /*position:relative;*/ |
552 | 556 | background:#FFF; |
553 | 557 | left:2px; |
554 | 558 | right:2px; |
— | — | @@ -555,7 +559,7 @@ |
556 | 560 | overflow:auto; |
557 | 561 | position:absolute; |
558 | 562 | top:75px; |
559 | | -} |
| 563 | +}*/ |
560 | 564 | #rsd_resource_edit{ |
561 | 565 | z-index:2; |
562 | 566 | } |
Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -28,6 +28,9 @@ |
29 | 29 | //the name of the player skin (default is mvpcf) |
30 | 30 | if(!mv_skin_name) |
31 | 31 | var mv_skin_name = 'mvpcf'; |
| 32 | + |
| 33 | +if(!mwjQueryUiSkin) |
| 34 | + var mwjQueryUiSkin = 'smoothness'; |
32 | 35 | |
33 | 36 | //whether or not to load java from an iframe. |
34 | 37 | //note: this is necessary for remote embedding because of java security model) |
— | — | @@ -59,9 +62,11 @@ |
60 | 63 | if( !mv_embed_path ){ |
61 | 64 | var mv_embed_path = getMvEmbedPath(); |
62 | 65 | } |
| 66 | +jQueryUiVN = 'jquery.ui-1.7.1'; |
63 | 67 | |
64 | 68 | |
65 | 69 | //setup the skin path: |
| 70 | +var mv_jquery_skin_path = mv_embed_path + 'jquery/' + jQueryUiVN + '/themes/' + mwjQueryUiSkin + '/'; |
66 | 71 | var mv_skin_img_path = mv_embed_path + 'skins/' + mv_skin_name + '/images/'; |
67 | 72 | var mv_default_thumb_url = mv_skin_img_path + 'vid_default_thumb.jpg'; |
68 | 73 | |
— | — | @@ -77,9 +82,11 @@ |
78 | 83 | |
79 | 84 | //all default msg in [English] should be overwritten by the CMS language msg system. |
80 | 85 | loadGM({ |
81 | | - "loading_txt":"loading <blink>...</blink>", |
82 | | - |
| 86 | + "loading_txt":"loading <blink>...</blink>", |
| 87 | + "loading_title" : "Loading...", |
| 88 | + |
83 | 89 | "loading_plugin" : "loading plugin<blink>...</blink>", |
| 90 | + |
84 | 91 | "select_playback" : "Set Playback Preference", |
85 | 92 | "link_back" : "Link Back", |
86 | 93 | "error_load_lib" : "mv_embed: Unable to load required javascript libraries\n insert script via DOM has failed, try reloading? ", |
— | — | @@ -385,10 +392,10 @@ |
386 | 393 | _this.jQueryCheck(function(){ |
387 | 394 | _this.doLoad({ |
388 | 395 | 'embedVideo' : 'libEmbedVideo/mv_baseEmbed.js', |
389 | | - '$j.cookie' : 'jquery/jquery.ui-1.7.1/external/cookie/jquery.cookie.js', |
390 | | - '$j.ui.mouse' : 'jquery/jquery.ui-1.7.1/ui/ui.core.js', |
391 | | - '$j.ui.droppable' : 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js', |
392 | | - '$j.ui.draggable' : 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js' |
| 396 | + '$j.cookie' : 'jquery/' + jQueryUiVN + '/external/cookie/jquery.cookie.js', |
| 397 | + '$j.ui.mouse' : 'jquery/' + jQueryUiVN + '/ui/ui.core.js', |
| 398 | + '$j.ui.droppable' : 'jquery/' + jQueryUiVN + '/ui/ui.droppable.js', |
| 399 | + '$j.ui.draggable' : 'jquery/' + jQueryUiVN + '/ui/ui.draggable.js' |
393 | 400 | },function(){ |
394 | 401 | //set up embedTypes (load from cookie if possible) |
395 | 402 | embedTypes.init(); |
— | — | @@ -467,6 +474,7 @@ |
468 | 475 | func(); |
469 | 476 | }); |
470 | 477 | }else{ |
| 478 | + //if using mwAddOnloadHook we need to get jQuery into place (if its not already included) |
471 | 479 | mvJsLoader.jQueryCheckFlag = true; |
472 | 480 | mvJsLoader.addLoadEvent( func ); |
473 | 481 | }; |
— | — | @@ -544,66 +552,99 @@ |
545 | 553 | //backup "onload" method in case on DOMContentLoaded does not exist |
546 | 554 | window.onload = function(){ mwdomReady() }; |
547 | 555 | } |
548 | | - |
549 | | -/* init remote search */ |
550 | | -function mv_do_remote_search( initObj ){ |
551 | | - js_log(':::::mv_do_remote_search::::'); |
552 | | - |
553 | | - //issue a load skin request: |
554 | | - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'); |
555 | | - |
556 | | - //insure we have the basic libs (jquery etc) : |
557 | | - mvJsLoader.jQueryCheck(function(){ |
558 | | - //load search specifc extra stuff |
559 | | - mvJsLoader.doLoad({ |
560 | | - 'remoteSearchDriver':'libAddMedia/remoteSearchDriver.js' |
561 | | - }, function(){ |
562 | | - initObj['instance_name']= 'rsdMVRS'; |
563 | | - rsdMVRS = new remoteSearchDriver( initObj ); |
564 | | - rsdMVRS.doInitDisplay(); |
565 | | - }); |
566 | | - }); |
| 556 | +/* |
| 557 | + * should depreciate and use jquery.ui.dialog instead |
| 558 | + */ |
| 559 | +function mv_write_modal(content, speed){ |
| 560 | + $j('#modalbox,#mv_overlay').remove(); |
| 561 | + $j('body').append('<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+ |
| 562 | + 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+ |
| 563 | + content + |
| 564 | + '</div>'+ |
| 565 | + '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+ |
| 566 | + 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+ |
| 567 | + 'opacity: 0.6;"/>'); |
| 568 | + $j('#modalbox,#mv_overlay').show( speed ); |
567 | 569 | } |
| 570 | +function mv_remove_modal(speed){ |
| 571 | + $j('#modalbox,#mv_overlay').remove( speed); |
| 572 | +} |
568 | 573 | |
569 | 574 | /* |
570 | 575 | * stores all the mwEmbed jQuery specific bindings |
571 | 576 | * (setup after jQuery is avaliable) |
572 | 577 | * lets you call rewrites in a jquery "way" |
573 | 578 | * |
574 | | - * @@todo eventually we should refactor mwCode over to jQuery style plugins |
575 | | - * ( but for now mv_embed.js will bridge this gap ) |
| 579 | + * @@ eventually we should refactor mwCode over to jQuery style plugins |
| 580 | + * and mv_embed.js will just hanndle dependency mapping and loading. |
| 581 | + * |
576 | 582 | */ |
577 | 583 | function mv_jqueryBindings(){ |
578 | 584 | js_log('mv_jqueryBindings'); |
579 | 585 | (function($) { |
580 | 586 | |
581 | | - $.fn.firefogg = function( initObj, callback ) { |
582 | | - //set "selector" in the initObj |
| 587 | + $.fn.addMediaWiz = function( iObj ){ |
| 588 | + //first set the cursor for the button to "loading" |
| 589 | + $j(this.selector).css('cursor','wait').attr('title', gM('loading_title')); |
| 590 | + |
| 591 | + iObj['target_invocation'] = this.selector; |
| 592 | + //load the mv_embed_base skin: |
| 593 | + var cssReq = new Array( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css' ); |
| 594 | + |
| 595 | + //more cache efficent to just load the entire skin (only 25k or so) |
| 596 | + //we could group skin requests but would hurt our caching |
| 597 | + cssReq.push( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
| 598 | + |
| 599 | + loadExternalCss( cssReq ); |
| 600 | + |
| 601 | + //load all the req libs: |
| 602 | + mvJsLoader.jQueryCheck(function(){ |
| 603 | + //load search specifc extra stuff |
| 604 | + mvJsLoader.doLoad({ |
| 605 | + 'remoteSearchDriver': 'libAddMedia/remoteSearchDriver.js', |
| 606 | + '$j.cookie' : 'jquery/' + jQueryUiVN + '/external/cookie/jquery.cookie.js', |
| 607 | + '$j.ui' : 'jquery/' + jQueryUiVN + '/ui/ui.core.js', |
| 608 | + '$j.ui.resizable' : 'jquery/' + jQueryUiVN + '/ui/ui.resizable.js', |
| 609 | + '$j.ui.draggable' : 'jquery/' + jQueryUiVN + '/ui/ui.draggable.js', |
| 610 | + '$j.ui.dialog' : 'jquery/' + jQueryUiVN + '/ui/ui.dialog.js', |
| 611 | + '$j.ui.tabs' : 'jquery/' + jQueryUiVN + '/ui/ui.tabs.js', |
| 612 | + '$j.ui.sortable' : 'jquery/' + jQueryUiVN + '/ui/ui.sortable.js' |
| 613 | + }, function(){ |
| 614 | + iObj['instance_name']= 'rsdMVRS'; |
| 615 | + _global['rsdMVRS'] = new remoteSearchDriver( iObj ); |
| 616 | + }); |
| 617 | + }); |
| 618 | + } |
583 | 619 | |
| 620 | + $.fn.firefogg = function( iObj, callback ) { |
| 621 | + //set "selector" in the iObj |
| 622 | + |
584 | 623 | // @@todo should refactor mvAdvFirefogg as jQuery plugin |
585 | | - initObj['selector'] = this.selector; |
| 624 | + iObj['selector'] = this.selector; |
586 | 625 | |
587 | 626 | loadSet = { |
588 | 627 | 'mvBaseUploadInterface' : 'libAddMedia/mvBaseUploadInterface.js', |
589 | 628 | 'mvFirefogg' : 'libAddMedia/mvFirefogg.js' |
590 | 629 | }; |
591 | 630 | //see if we need to load the advanced firefog controls and associated ui components: |
592 | | - if( initObj.encoder_interface ){ |
| 631 | + if( iObj.encoder_interface ){ |
593 | 632 | //@@todo would be nice to have a "dependency" map we could use/ |
594 | 633 | loadSet['mvAdvFirefogg'] = 'libAddMedia/mvAdvFirefogg.js'; |
595 | | - loadSet['$j.cookie'] = 'jquery/jquery.ui-1.7.1/external/cookie/jquery.cookie.js'; |
596 | | - loadSet['$j.ui'] = 'jquery/jquery.ui-1.7.1/ui/ui.core.js'; |
597 | | - loadSet['$j.ui.accordion'] = 'jquery/jquery.ui-1.7.1/ui/ui.accordion.js'; |
598 | | - loadSet['$j.ui.slider'] = 'jquery/jquery.ui-1.7.1/ui/ui.slider.js'; |
| 634 | + loadSet['$j.cookie'] = 'jquery/' + jQueryUiVN + '/external/cookie/jquery.cookie.js'; |
| 635 | + loadSet['$j.ui'] = 'jquery/' + jQueryUiVN + '/ui/ui.core.js'; |
| 636 | + loadSet['$j.ui.accordion'] = 'jquery/' + jQueryUiVN + '/ui/ui.accordion.js'; |
| 637 | + loadSet['$j.ui.slider'] = 'jquery/' + jQueryUiVN + '/ui/ui.slider.js'; |
| 638 | + |
| 639 | + //load jquery ui css: |
599 | 640 | } |
600 | 641 | //make sure we have everything loaded that we need: |
601 | 642 | mvJsLoader.doLoad( loadSet, function(){ |
602 | | - js_log('firefogg libs loaded. target select:' + initObj.selector); |
| 643 | + js_log('firefogg libs loaded. target select:' + iObj.selector); |
603 | 644 | //select interface provicer based on if we want to include the encoder interface or not: |
604 | | - if(initObj.encoder_interface){ |
605 | | - var myFogg = new mvAdvFirefogg( initObj ); |
| 645 | + if(iObj.encoder_interface){ |
| 646 | + var myFogg = new mvAdvFirefogg( iObj ); |
606 | 647 | }else{ |
607 | | - var myFogg = new mvFirefogg( initObj ); |
| 648 | + var myFogg = new mvFirefogg( iObj ); |
608 | 649 | } |
609 | 650 | |
610 | 651 | if(myFogg) |
— | — | @@ -625,31 +666,26 @@ |
626 | 667 | //load playlist object and drag,drop,resize,hoverintent,libs |
627 | 668 | mvJsLoader.doLoad({ |
628 | 669 | 'mvPlayList':'libSequencer/mvPlayList.js', |
629 | | - '$j.ui' :'jquery/jquery.ui-1.7.1/ui/ui.core.js', |
630 | | - '$j.ui.sortable':'jquery/jquery.ui-1.7.1/ui/ui.sortable.js', |
631 | | - '$j.ui.resizable':'jquery/jquery.ui-1.7.1/ui/ui.resizable.js', |
632 | | - '$j.contextMenu':'jquery/plugins/jquery.contextMenu.js' |
633 | | - },function(){ |
634 | | - //debugger; |
635 | | - //load the sequencer |
636 | | - mvJsLoader.doLoad({ |
637 | | - 'mvSequencer':'libSequencer/mvSequencer.js' |
638 | | - },function(){ |
639 | | - js_log('calling new mvSequencer'); |
640 | | - //init the sequence object (it will take over from there) no more than one mvSeq obj: |
641 | | - if(!_global['mvSeq']){ |
642 | | - _global['mvSeq'] = new mvSequencer(initObj); |
643 | | - }else{ |
644 | | - js_log('mvSeq already init'); |
645 | | - } |
646 | | - }); |
| 670 | + '$j.ui' :'jquery/' + jQueryUiVN + '/ui/ui.core.js', |
| 671 | + '$j.ui.sortable':'jquery/' + jQueryUiVN + '/ui/ui.sortable.js', |
| 672 | + '$j.ui.resizable':'jquery/' + jQueryUiVN + '/ui/ui.resizable.js', |
| 673 | + '$j.contextMenu':'jquery/plugins/jquery.contextMenu.js', |
| 674 | + 'mvSequencer':'libSequencer/mvSequencer.js' |
| 675 | + },function(){ |
| 676 | + js_log('calling new mvSequencer'); |
| 677 | + //init the sequence object (it will take over from there) no more than one mvSeq obj: |
| 678 | + if(!_global['mvSeq']){ |
| 679 | + _global['mvSeq'] = new mvSequencer(initObj); |
| 680 | + }else{ |
| 681 | + js_log('mvSeq already init'); |
| 682 | + } |
647 | 683 | }); |
648 | 684 | }); |
649 | 685 | } |
650 | 686 | /* |
651 | 687 | * utility functions: |
652 | 688 | */ |
653 | | -//simple url re-writer for standard temporal and size request urls: |
| 689 | +//simple url re-writer for rewriting urls (could probably be refactored into an inline regular expresion) |
654 | 690 | function getURLParamReplace( url, opt ){ |
655 | 691 | var pSrc = parseUri( url ); |
656 | 692 | if(pSrc.protocol != '' ){ |
— | — | @@ -665,8 +701,7 @@ |
666 | 702 | val = opt[ key ]; |
667 | 703 | new_url+= amp + key + '=' + val; |
668 | 704 | amp = '&'; |
669 | | - }; |
670 | | - |
| 705 | + }; |
671 | 706 | return new_url; |
672 | 707 | } |
673 | 708 | /** |
— | — | @@ -902,10 +937,19 @@ |
903 | 938 | return false; |
904 | 939 | } |
905 | 940 | function loadExternalCss(url){ |
906 | | - if( !styleSheetPresent(url) ){ |
907 | | - if( url.indexOf('?') == -1 ){ |
908 | | - url+='?'+getMvUniqueReqId(); |
| 941 | + //if could have script loader group thes css request |
| 942 | + //but debatable it may hurt more than it helps with caching and all |
| 943 | + if(typeof url =='object'){ |
| 944 | + for(var i in url){ |
| 945 | + loadExternalCss ( url[i] ); |
909 | 946 | } |
| 947 | + return ; |
| 948 | + } |
| 949 | + |
| 950 | + if( url.indexOf('?') == -1 ){ |
| 951 | + url+='?'+getMvUniqueReqId(); |
| 952 | + } |
| 953 | + if(!styleSheetPresent(url) ){ |
910 | 954 | js_log('load css: ' + url); |
911 | 955 | var e = document.createElement("link"); |
912 | 956 | e.href = url; |
Index: branches/new-upload/phase3/js2/uploadPage.js |
— | — | @@ -9,18 +9,18 @@ |
10 | 10 | var mwUploadHelper = { |
11 | 11 | init:function(){ |
12 | 12 | if( wgEnableFirefogg ){ |
13 | | - //setup the upload handler to firefogg (supports our upload proccess) |
| 13 | + //setup the upload handler to firefogg (supports our upload proccess) (will auto-magically work with the http uploads too) |
14 | 14 | $j('#wpUploadFile').firefogg({ |
15 | 15 | //an api url (we won't submit directly to action of the form) |
16 | 16 | 'api_url' : wgServer + wgScriptPath + '/api.php', |
17 | 17 | 'form_rewrite': true, |
18 | 18 | |
19 | 19 | 'new_source_cb' : function( filename ){ |
20 | | - $j('#wpDestFile').val( filename ); |
21 | | - mwUploadHelper.doDestCheck(); |
| 20 | + $j('#wpDestFile').val( filename ); |
| 21 | + mwUploadHelper.doDestCheck(); |
22 | 22 | } |
23 | 23 | }); |
24 | | - }else{ |
| 24 | + }else{ |
25 | 25 | //Add basic upload profile support ( http status monitoring, progress box for browsers that support it etc.) |
26 | 26 | if($j('#wpUploadFileURL').length != 0){ |
27 | 27 | mvJsLoader.doLoad({ |
Index: branches/new-upload/phase3/js2/editPage.js |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +/* |
| 3 | + * js2 style replacement for mediaWiki edit.js |
| 4 | + * |
| 5 | + */ |
| 6 | + |
| 7 | +//setup configuration vars: |
| 8 | +if(!mwAddMediaConfig) |
| 9 | + var mwAddMediaConfig = { |
| 10 | + 'profile':'mediawiki_edit', |
| 11 | + 'target_textbox': '#wpTextbox1', |
| 12 | + //note selections in the textbox will take over the default query |
| 13 | + 'default_query': wgTitle, |
| 14 | + 'target_title':wgPageName, |
| 15 | + //here we can setup the conten provider overides |
| 16 | + 'cpconfig': {}, |
| 17 | + |
| 18 | + //the local wiki api url: |
| 19 | + 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' |
| 20 | + }; |
| 21 | + |
| 22 | + |
| 23 | +mwAddOnloadHook( function(){ |
| 24 | + mwEditPageHelper.init(); |
| 25 | +}); |
| 26 | +var mwEditPageHelper = { |
| 27 | + init:function(){ |
| 28 | + var _this = this; |
| 29 | + //add the add-media-wizard button |
| 30 | + $j('#toolbar').append('<img style="cursor:pointer" id="btn-add-media-wiz" src="' + mv_skin_img_path + 'Button_add_media.png">'); |
| 31 | + $j('#btn-add-media-wiz').addMediaWiz( |
| 32 | + mwAddMediaConfig |
| 33 | + ); |
| 34 | + } |
| 35 | +} |
Index: branches/new-upload/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1016,7 +1016,7 @@ |
1017 | 1017 | 'media_tip' => 'File link', |
1018 | 1018 | 'sig_tip' => 'Your signature with timestamp', |
1019 | 1019 | 'hr_tip' => 'Horizontal line (use sparingly)', |
1020 | | -'add_media_wizard'=> 'Add Media Wizard', |
| 1020 | +'add_media_wizard'=> 'Run Add Media Wizard', |
1021 | 1021 | |
1022 | 1022 | # Edit pages |
1023 | 1023 | 'summary' => 'Summary:', |