PageRenderTime 41ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/files/galleriffic/2.0/js/jquery-1.3.2.js

https://gitlab.com/Mirros/jsdelivr
JavaScript | 1803 lines | 1287 code | 314 blank | 202 comment | 387 complexity | c10454a1cd819207b74103af5e3852af MD5 | raw file
  1. /*!
  2. * jQuery JavaScript Library v1.3.2
  3. * http://jquery.com/
  4. *
  5. * Copyright (c) 2009 John Resig
  6. * Dual licensed under the MIT and GPL licenses.
  7. * http://docs.jquery.com/License
  8. *
  9. * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
  10. * Revision: 6246
  11. */
  12. (function(){
  13. var
  14. // Will speed up references to window, and allows munging its name.
  15. window = this,
  16. // Will speed up references to undefined, and allows munging its name.
  17. undefined,
  18. // Map over jQuery in case of overwrite
  19. _jQuery = window.jQuery,
  20. // Map over the $ in case of overwrite
  21. _$ = window.$,
  22. jQuery = window.jQuery = window.$ = function( selector, context ) {
  23. // The jQuery object is actually just the init constructor 'enhanced'
  24. return new jQuery.fn.init( selector, context );
  25. },
  26. // A simple way to check for HTML strings or ID strings
  27. // (both of which we optimize for)
  28. quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
  29. // Is it a simple selector
  30. isSimple = /^.[^:#\[\.,]*$/;
  31. jQuery.fn = jQuery.prototype = {
  32. init: function( selector, context ) {
  33. // Make sure that a selection was provided
  34. selector = selector || document;
  35. // Handle $(DOMElement)
  36. if ( selector.nodeType ) {
  37. this[0] = selector;
  38. this.length = 1;
  39. this.context = selector;
  40. return this;
  41. }
  42. // Handle HTML strings
  43. if ( typeof selector === "string" ) {
  44. // Are we dealing with HTML string or an ID?
  45. var match = quickExpr.exec( selector );
  46. // Verify a match, and that no context was specified for #id
  47. if ( match && (match[1] || !context) ) {
  48. // HANDLE: $(html) -> $(array)
  49. if ( match[1] )
  50. selector = jQuery.clean( [ match[1] ], context );
  51. // HANDLE: $("#id")
  52. else {
  53. var elem = document.getElementById( match[3] );
  54. // Handle the case where IE and Opera return items
  55. // by name instead of ID
  56. if ( elem && elem.id != match[3] )
  57. return jQuery().find( selector );
  58. // Otherwise, we inject the element directly into the jQuery object
  59. var ret = jQuery( elem || [] );
  60. ret.context = document;
  61. ret.selector = selector;
  62. return ret;
  63. }
  64. // HANDLE: $(expr, [context])
  65. // (which is just equivalent to: $(content).find(expr)
  66. } else
  67. return jQuery( context ).find( selector );
  68. // HANDLE: $(function)
  69. // Shortcut for document ready
  70. } else if ( jQuery.isFunction( selector ) )
  71. return jQuery( document ).ready( selector );
  72. // Make sure that old selector state is passed along
  73. if ( selector.selector && selector.context ) {
  74. this.selector = selector.selector;
  75. this.context = selector.context;
  76. }
  77. return this.setArray(jQuery.isArray( selector ) ?
  78. selector :
  79. jQuery.makeArray(selector));
  80. },
  81. // Start with an empty selector
  82. selector: "",
  83. // The current version of jQuery being used
  84. jquery: "1.3.2",
  85. // The number of elements contained in the matched element set
  86. size: function() {
  87. return this.length;
  88. },
  89. // Get the Nth element in the matched element set OR
  90. // Get the whole matched element set as a clean array
  91. get: function( num ) {
  92. return num === undefined ?
  93. // Return a 'clean' array
  94. Array.prototype.slice.call( this ) :
  95. // Return just the object
  96. this[ num ];
  97. },
  98. // Take an array of elements and push it onto the stack
  99. // (returning the new matched element set)
  100. pushStack: function( elems, name, selector ) {
  101. // Build a new jQuery matched element set
  102. var ret = jQuery( elems );
  103. // Add the old object onto the stack (as a reference)
  104. ret.prevObject = this;
  105. ret.context = this.context;
  106. if ( name === "find" )
  107. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  108. else if ( name )
  109. ret.selector = this.selector + "." + name + "(" + selector + ")";
  110. // Return the newly-formed element set
  111. return ret;
  112. },
  113. // Force the current matched set of elements to become
  114. // the specified array of elements (destroying the stack in the process)
  115. // You should use pushStack() in order to do this, but maintain the stack
  116. setArray: function( elems ) {
  117. // Resetting the length to 0, then using the native Array push
  118. // is a super-fast way to populate an object with array-like properties
  119. this.length = 0;
  120. Array.prototype.push.apply( this, elems );
  121. return this;
  122. },
  123. // Execute a callback for every element in the matched set.
  124. // (You can seed the arguments with an array of args, but this is
  125. // only used internally.)
  126. each: function( callback, args ) {
  127. return jQuery.each( this, callback, args );
  128. },
  129. // Determine the position of an element within
  130. // the matched set of elements
  131. index: function( elem ) {
  132. // Locate the position of the desired element
  133. return jQuery.inArray(
  134. // If it receives a jQuery object, the first element is used
  135. elem && elem.jquery ? elem[0] : elem
  136. , this );
  137. },
  138. attr: function( name, value, type ) {
  139. var options = name;
  140. // Look for the case where we're accessing a style value
  141. if ( typeof name === "string" )
  142. if ( value === undefined )
  143. return this[0] && jQuery[ type || "attr" ]( this[0], name );
  144. else {
  145. options = {};
  146. options[ name ] = value;
  147. }
  148. // Check to see if we're setting style values
  149. return this.each(function(i){
  150. // Set all the styles
  151. for ( name in options )
  152. jQuery.attr(
  153. type ?
  154. this.style :
  155. this,
  156. name, jQuery.prop( this, options[ name ], type, i, name )
  157. );
  158. });
  159. },
  160. css: function( key, value ) {
  161. // ignore negative width and height values
  162. if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  163. value = undefined;
  164. return this.attr( key, value, "curCSS" );
  165. },
  166. text: function( text ) {
  167. if ( typeof text !== "object" && text != null )
  168. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  169. var ret = "";
  170. jQuery.each( text || this, function(){
  171. jQuery.each( this.childNodes, function(){
  172. if ( this.nodeType != 8 )
  173. ret += this.nodeType != 1 ?
  174. this.nodeValue :
  175. jQuery.fn.text( [ this ] );
  176. });
  177. });
  178. return ret;
  179. },
  180. wrapAll: function( html ) {
  181. if ( this[0] ) {
  182. // The elements to wrap the target around
  183. var wrap = jQuery( html, this[0].ownerDocument ).clone();
  184. if ( this[0].parentNode )
  185. wrap.insertBefore( this[0] );
  186. wrap.map(function(){
  187. var elem = this;
  188. while ( elem.firstChild )
  189. elem = elem.firstChild;
  190. return elem;
  191. }).append(this);
  192. }
  193. return this;
  194. },
  195. wrapInner: function( html ) {
  196. return this.each(function(){
  197. jQuery( this ).contents().wrapAll( html );
  198. });
  199. },
  200. wrap: function( html ) {
  201. return this.each(function(){
  202. jQuery( this ).wrapAll( html );
  203. });
  204. },
  205. append: function() {
  206. return this.domManip(arguments, true, function(elem){
  207. if (this.nodeType == 1)
  208. this.appendChild( elem );
  209. });
  210. },
  211. prepend: function() {
  212. return this.domManip(arguments, true, function(elem){
  213. if (this.nodeType == 1)
  214. this.insertBefore( elem, this.firstChild );
  215. });
  216. },
  217. before: function() {
  218. return this.domManip(arguments, false, function(elem){
  219. this.parentNode.insertBefore( elem, this );
  220. });
  221. },
  222. after: function() {
  223. return this.domManip(arguments, false, function(elem){
  224. this.parentNode.insertBefore( elem, this.nextSibling );
  225. });
  226. },
  227. end: function() {
  228. return this.prevObject || jQuery( [] );
  229. },
  230. // For internal use only.
  231. // Behaves like an Array's method, not like a jQuery method.
  232. push: [].push,
  233. sort: [].sort,
  234. splice: [].splice,
  235. find: function( selector ) {
  236. if ( this.length === 1 ) {
  237. var ret = this.pushStack( [], "find", selector );
  238. ret.length = 0;
  239. jQuery.find( selector, this[0], ret );
  240. return ret;
  241. } else {
  242. return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
  243. return jQuery.find( selector, elem );
  244. })), "find", selector );
  245. }
  246. },
  247. clone: function( events ) {
  248. // Do the clone
  249. var ret = this.map(function(){
  250. if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
  251. // IE copies events bound via attachEvent when
  252. // using cloneNode. Calling detachEvent on the
  253. // clone will also remove the events from the orignal
  254. // In order to get around this, we use innerHTML.
  255. // Unfortunately, this means some modifications to
  256. // attributes in IE that are actually only stored
  257. // as properties will not be copied (such as the
  258. // the name attribute on an input).
  259. var html = this.outerHTML;
  260. if ( !html ) {
  261. var div = this.ownerDocument.createElement("div");
  262. div.appendChild( this.cloneNode(true) );
  263. html = div.innerHTML;
  264. }
  265. return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
  266. } else
  267. return this.cloneNode(true);
  268. });
  269. // Copy the events from the original to the clone
  270. if ( events === true ) {
  271. var orig = this.find("*").andSelf(), i = 0;
  272. ret.find("*").andSelf().each(function(){
  273. if ( this.nodeName !== orig[i].nodeName )
  274. return;
  275. var events = jQuery.data( orig[i], "events" );
  276. for ( var type in events ) {
  277. for ( var handler in events[ type ] ) {
  278. jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
  279. }
  280. }
  281. i++;
  282. });
  283. }
  284. // Return the cloned set
  285. return ret;
  286. },
  287. filter: function( selector ) {
  288. return this.pushStack(
  289. jQuery.isFunction( selector ) &&
  290. jQuery.grep(this, function(elem, i){
  291. return selector.call( elem, i );
  292. }) ||
  293. jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
  294. return elem.nodeType === 1;
  295. }) ), "filter", selector );
  296. },
  297. closest: function( selector ) {
  298. var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
  299. closer = 0;
  300. return this.map(function(){
  301. var cur = this;
  302. while ( cur && cur.ownerDocument ) {
  303. if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
  304. jQuery.data(cur, "closest", closer);
  305. return cur;
  306. }
  307. cur = cur.parentNode;
  308. closer++;
  309. }
  310. });
  311. },
  312. not: function( selector ) {
  313. if ( typeof selector === "string" )
  314. // test special case where just one selector is passed in
  315. if ( isSimple.test( selector ) )
  316. return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
  317. else
  318. selector = jQuery.multiFilter( selector, this );
  319. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  320. return this.filter(function() {
  321. return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  322. });
  323. },
  324. add: function( selector ) {
  325. return this.pushStack( jQuery.unique( jQuery.merge(
  326. this.get(),
  327. typeof selector === "string" ?
  328. jQuery( selector ) :
  329. jQuery.makeArray( selector )
  330. )));
  331. },
  332. is: function( selector ) {
  333. return !!selector && jQuery.multiFilter( selector, this ).length > 0;
  334. },
  335. hasClass: function( selector ) {
  336. return !!selector && this.is( "." + selector );
  337. },
  338. val: function( value ) {
  339. if ( value === undefined ) {
  340. var elem = this[0];
  341. if ( elem ) {
  342. if( jQuery.nodeName( elem, 'option' ) )
  343. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  344. // We need to handle select boxes special
  345. if ( jQuery.nodeName( elem, "select" ) ) {
  346. var index = elem.selectedIndex,
  347. values = [],
  348. options = elem.options,
  349. one = elem.type == "select-one";
  350. // Nothing was selected
  351. if ( index < 0 )
  352. return null;
  353. // Loop through all the selected options
  354. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  355. var option = options[ i ];
  356. if ( option.selected ) {
  357. // Get the specifc value for the option
  358. value = jQuery(option).val();
  359. // We don't need an array for one selects
  360. if ( one )
  361. return value;
  362. // Multi-Selects return an array
  363. values.push( value );
  364. }
  365. }
  366. return values;
  367. }
  368. // Everything else, we just grab the value
  369. return (elem.value || "").replace(/\r/g, "");
  370. }
  371. return undefined;
  372. }
  373. if ( typeof value === "number" )
  374. value += '';
  375. return this.each(function(){
  376. if ( this.nodeType != 1 )
  377. return;
  378. if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
  379. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  380. jQuery.inArray(this.name, value) >= 0);
  381. else if ( jQuery.nodeName( this, "select" ) ) {
  382. var values = jQuery.makeArray(value);
  383. jQuery( "option", this ).each(function(){
  384. this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  385. jQuery.inArray( this.text, values ) >= 0);
  386. });
  387. if ( !values.length )
  388. this.selectedIndex = -1;
  389. } else
  390. this.value = value;
  391. });
  392. },
  393. html: function( value ) {
  394. return value === undefined ?
  395. (this[0] ?
  396. this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
  397. null) :
  398. this.empty().append( value );
  399. },
  400. replaceWith: function( value ) {
  401. return this.after( value ).remove();
  402. },
  403. eq: function( i ) {
  404. return this.slice( i, +i + 1 );
  405. },
  406. slice: function() {
  407. return this.pushStack( Array.prototype.slice.apply( this, arguments ),
  408. "slice", Array.prototype.slice.call(arguments).join(",") );
  409. },
  410. map: function( callback ) {
  411. return this.pushStack( jQuery.map(this, function(elem, i){
  412. return callback.call( elem, i, elem );
  413. }));
  414. },
  415. andSelf: function() {
  416. return this.add( this.prevObject );
  417. },
  418. domManip: function( args, table, callback ) {
  419. if ( this[0] ) {
  420. var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
  421. scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
  422. first = fragment.firstChild;
  423. if ( first )
  424. for ( var i = 0, l = this.length; i < l; i++ )
  425. callback.call( root(this[i], first), this.length > 1 || i > 0 ?
  426. fragment.cloneNode(true) : fragment );
  427. if ( scripts )
  428. jQuery.each( scripts, evalScript );
  429. }
  430. return this;
  431. function root( elem, cur ) {
  432. return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
  433. (elem.getElementsByTagName("tbody")[0] ||
  434. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  435. elem;
  436. }
  437. }
  438. };
  439. // Give the init function the jQuery prototype for later instantiation
  440. jQuery.fn.init.prototype = jQuery.fn;
  441. function evalScript( i, elem ) {
  442. if ( elem.src )
  443. jQuery.ajax({
  444. url: elem.src,
  445. async: false,
  446. dataType: "script"
  447. });
  448. else
  449. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  450. if ( elem.parentNode )
  451. elem.parentNode.removeChild( elem );
  452. }
  453. function now(){
  454. return +new Date;
  455. }
  456. jQuery.extend = jQuery.fn.extend = function() {
  457. // copy reference to target object
  458. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  459. // Handle a deep copy situation
  460. if ( typeof target === "boolean" ) {
  461. deep = target;
  462. target = arguments[1] || {};
  463. // skip the boolean and the target
  464. i = 2;
  465. }
  466. // Handle case when target is a string or something (possible in deep copy)
  467. if ( typeof target !== "object" && !jQuery.isFunction(target) )
  468. target = {};
  469. // extend jQuery itself if only one argument is passed
  470. if ( length == i ) {
  471. target = this;
  472. --i;
  473. }
  474. for ( ; i < length; i++ )
  475. // Only deal with non-null/undefined values
  476. if ( (options = arguments[ i ]) != null )
  477. // Extend the base object
  478. for ( var name in options ) {
  479. var src = target[ name ], copy = options[ name ];
  480. // Prevent never-ending loop
  481. if ( target === copy )
  482. continue;
  483. // Recurse if we're merging object values
  484. if ( deep && copy && typeof copy === "object" && !copy.nodeType )
  485. target[ name ] = jQuery.extend( deep,
  486. // Never move original objects, clone them
  487. src || ( copy.length != null ? [ ] : { } )
  488. , copy );
  489. // Don't bring in undefined values
  490. else if ( copy !== undefined )
  491. target[ name ] = copy;
  492. }
  493. // Return the modified object
  494. return target;
  495. };
  496. // exclude the following css properties to add px
  497. var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  498. // cache defaultView
  499. defaultView = document.defaultView || {},
  500. toString = Object.prototype.toString;
  501. jQuery.extend({
  502. noConflict: function( deep ) {
  503. window.$ = _$;
  504. if ( deep )
  505. window.jQuery = _jQuery;
  506. return jQuery;
  507. },
  508. // See test/unit/core.js for details concerning isFunction.
  509. // Since version 1.3, DOM methods and functions like alert
  510. // aren't supported. They return false on IE (#2968).
  511. isFunction: function( obj ) {
  512. return toString.call(obj) === "[object Function]";
  513. },
  514. isArray: function( obj ) {
  515. return toString.call(obj) === "[object Array]";
  516. },
  517. // check if an element is in a (or is an) XML document
  518. isXMLDoc: function( elem ) {
  519. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  520. !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
  521. },
  522. // Evalulates a script in a global context
  523. globalEval: function( data ) {
  524. if ( data && /\S/.test(data) ) {
  525. // Inspired by code by Andrea Giammarchi
  526. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  527. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  528. script = document.createElement("script");
  529. script.type = "text/javascript";
  530. if ( jQuery.support.scriptEval )
  531. script.appendChild( document.createTextNode( data ) );
  532. else
  533. script.text = data;
  534. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  535. // This arises when a base node is used (#2709).
  536. head.insertBefore( script, head.firstChild );
  537. head.removeChild( script );
  538. }
  539. },
  540. nodeName: function( elem, name ) {
  541. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  542. },
  543. // args is for internal usage only
  544. each: function( object, callback, args ) {
  545. var name, i = 0, length = object.length;
  546. if ( args ) {
  547. if ( length === undefined ) {
  548. for ( name in object )
  549. if ( callback.apply( object[ name ], args ) === false )
  550. break;
  551. } else
  552. for ( ; i < length; )
  553. if ( callback.apply( object[ i++ ], args ) === false )
  554. break;
  555. // A special, fast, case for the most common use of each
  556. } else {
  557. if ( length === undefined ) {
  558. for ( name in object )
  559. if ( callback.call( object[ name ], name, object[ name ] ) === false )
  560. break;
  561. } else
  562. for ( var value = object[0];
  563. i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  564. }
  565. return object;
  566. },
  567. prop: function( elem, value, type, i, name ) {
  568. // Handle executable functions
  569. if ( jQuery.isFunction( value ) )
  570. value = value.call( elem, i );
  571. // Handle passing in a number to a CSS property
  572. return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
  573. value + "px" :
  574. value;
  575. },
  576. className: {
  577. // internal only, use addClass("class")
  578. add: function( elem, classNames ) {
  579. jQuery.each((classNames || "").split(/\s+/), function(i, className){
  580. if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  581. elem.className += (elem.className ? " " : "") + className;
  582. });
  583. },
  584. // internal only, use removeClass("class")
  585. remove: function( elem, classNames ) {
  586. if (elem.nodeType == 1)
  587. elem.className = classNames !== undefined ?
  588. jQuery.grep(elem.className.split(/\s+/), function(className){
  589. return !jQuery.className.has( classNames, className );
  590. }).join(" ") :
  591. "";
  592. },
  593. // internal only, use hasClass("class")
  594. has: function( elem, className ) {
  595. return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  596. }
  597. },
  598. // A method for quickly swapping in/out CSS properties to get correct calculations
  599. swap: function( elem, options, callback ) {
  600. var old = {};
  601. // Remember the old values, and insert the new ones
  602. for ( var name in options ) {
  603. old[ name ] = elem.style[ name ];
  604. elem.style[ name ] = options[ name ];
  605. }
  606. callback.call( elem );
  607. // Revert the old values
  608. for ( var name in options )
  609. elem.style[ name ] = old[ name ];
  610. },
  611. css: function( elem, name, force, extra ) {
  612. if ( name == "width" || name == "height" ) {
  613. var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  614. function getWH() {
  615. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  616. if ( extra === "border" )
  617. return;
  618. jQuery.each( which, function() {
  619. if ( !extra )
  620. val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  621. if ( extra === "margin" )
  622. val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
  623. else
  624. val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  625. });
  626. }
  627. if ( elem.offsetWidth !== 0 )
  628. getWH();
  629. else
  630. jQuery.swap( elem, props, getWH );
  631. return Math.max(0, Math.round(val));
  632. }
  633. return jQuery.curCSS( elem, name, force );
  634. },
  635. curCSS: function( elem, name, force ) {
  636. var ret, style = elem.style;
  637. // We need to handle opacity special in IE
  638. if ( name == "opacity" && !jQuery.support.opacity ) {
  639. ret = jQuery.attr( style, "opacity" );
  640. return ret == "" ?
  641. "1" :
  642. ret;
  643. }
  644. // Make sure we're using the right name for getting the float value
  645. if ( name.match( /float/i ) )
  646. name = styleFloat;
  647. if ( !force && style && style[ name ] )
  648. ret = style[ name ];
  649. else if ( defaultView.getComputedStyle ) {
  650. // Only "float" is needed here
  651. if ( name.match( /float/i ) )
  652. name = "float";
  653. name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  654. var computedStyle = defaultView.getComputedStyle( elem, null );
  655. if ( computedStyle )
  656. ret = computedStyle.getPropertyValue( name );
  657. // We should always get a number back from opacity
  658. if ( name == "opacity" && ret == "" )
  659. ret = "1";
  660. } else if ( elem.currentStyle ) {
  661. var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  662. return letter.toUpperCase();
  663. });
  664. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  665. // From the awesome hack by Dean Edwards
  666. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  667. // If we're not dealing with a regular pixel number
  668. // but a number that has a weird ending, we need to convert it to pixels
  669. if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  670. // Remember the original values
  671. var left = style.left, rsLeft = elem.runtimeStyle.left;
  672. // Put in the new values to get a computed value out
  673. elem.runtimeStyle.left = elem.currentStyle.left;
  674. style.left = ret || 0;
  675. ret = style.pixelLeft + "px";
  676. // Revert the changed values
  677. style.left = left;
  678. elem.runtimeStyle.left = rsLeft;
  679. }
  680. }
  681. return ret;
  682. },
  683. clean: function( elems, context, fragment ) {
  684. context = context || document;
  685. // !context.createElement fails in IE with an error but returns typeof 'object'
  686. if ( typeof context.createElement === "undefined" )
  687. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  688. // If a single string is passed in and it's a single tag
  689. // just do a createElement and skip the rest
  690. if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
  691. var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
  692. if ( match )
  693. return [ context.createElement( match[1] ) ];
  694. }
  695. var ret = [], scripts = [], div = context.createElement("div");
  696. jQuery.each(elems, function(i, elem){
  697. if ( typeof elem === "number" )
  698. elem += '';
  699. if ( !elem )
  700. return;
  701. // Convert html string into DOM nodes
  702. if ( typeof elem === "string" ) {
  703. // Fix "XHTML"-style tags in all browsers
  704. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  705. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  706. all :
  707. front + "></" + tag + ">";
  708. });
  709. // Trim whitespace, otherwise indexOf won't work as expected
  710. var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
  711. var wrap =
  712. // option or optgroup
  713. !tags.indexOf("<opt") &&
  714. [ 1, "<select multiple='multiple'>", "</select>" ] ||
  715. !tags.indexOf("<leg") &&
  716. [ 1, "<fieldset>", "</fieldset>" ] ||
  717. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  718. [ 1, "<table>", "</table>" ] ||
  719. !tags.indexOf("<tr") &&
  720. [ 2, "<table><tbody>", "</tbody></table>" ] ||
  721. // <thead> matched above
  722. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  723. [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  724. !tags.indexOf("<col") &&
  725. [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  726. // IE can't serialize <link> and <script> tags normally
  727. !jQuery.support.htmlSerialize &&
  728. [ 1, "div<div>", "</div>" ] ||
  729. [ 0, "", "" ];
  730. // Go to html and back, then peel off extra wrappers
  731. div.innerHTML = wrap[1] + elem + wrap[2];
  732. // Move to the right depth
  733. while ( wrap[0]-- )
  734. div = div.lastChild;
  735. // Remove IE's autoinserted <tbody> from table fragments
  736. if ( !jQuery.support.tbody ) {
  737. // String was a <table>, *may* have spurious <tbody>
  738. var hasBody = /<tbody/i.test(elem),
  739. tbody = !tags.indexOf("<table") && !hasBody ?
  740. div.firstChild && div.firstChild.childNodes :
  741. // String was a bare <thead> or <tfoot>
  742. wrap[1] == "<table>" && !hasBody ?
  743. div.childNodes :
  744. [];
  745. for ( var j = tbody.length - 1; j >= 0 ; --j )
  746. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  747. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  748. }
  749. // IE completely kills leading whitespace when innerHTML is used
  750. if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
  751. div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  752. elem = jQuery.makeArray( div.childNodes );
  753. }
  754. if ( elem.nodeType )
  755. ret.push( elem );
  756. else
  757. ret = jQuery.merge( ret, elem );
  758. });
  759. if ( fragment ) {
  760. for ( var i = 0; ret[i]; i++ ) {
  761. if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  762. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  763. } else {
  764. if ( ret[i].nodeType === 1 )
  765. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  766. fragment.appendChild( ret[i] );
  767. }
  768. }
  769. return scripts;
  770. }
  771. return ret;
  772. },
  773. attr: function( elem, name, value ) {
  774. // don't set attributes on text and comment nodes
  775. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  776. return undefined;
  777. var notxml = !jQuery.isXMLDoc( elem ),
  778. // Whether we are setting (or getting)
  779. set = value !== undefined;
  780. // Try to normalize/fix the name
  781. name = notxml && jQuery.props[ name ] || name;
  782. // Only do all the following if this is a node (faster for style)
  783. // IE elem.getAttribute passes even for style
  784. if ( elem.tagName ) {
  785. // These attributes require special treatment
  786. var special = /href|src|style/.test( name );
  787. // Safari mis-reports the default selected property of a hidden option
  788. // Accessing the parent's selectedIndex property fixes it
  789. if ( name == "selected" && elem.parentNode )
  790. elem.parentNode.selectedIndex;
  791. // If applicable, access the attribute via the DOM 0 way
  792. if ( name in elem && notxml && !special ) {
  793. if ( set ){
  794. // We can't allow the type property to be changed (since it causes problems in IE)
  795. if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  796. throw "type property can't be changed";
  797. elem[ name ] = value;
  798. }
  799. // browsers index elements by id/name on forms, give priority to attributes.
  800. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
  801. return elem.getAttributeNode( name ).nodeValue;
  802. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  803. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  804. if ( name == "tabIndex" ) {
  805. var attributeNode = elem.getAttributeNode( "tabIndex" );
  806. return attributeNode && attributeNode.specified
  807. ? attributeNode.value
  808. : elem.nodeName.match(/(button|input|object|select|textarea)/i)
  809. ? 0
  810. : elem.nodeName.match(/^(a|area)$/i) && elem.href
  811. ? 0
  812. : undefined;
  813. }
  814. return elem[ name ];
  815. }
  816. if ( !jQuery.support.style && notxml && name == "style" )
  817. return jQuery.attr( elem.style, "cssText", value );
  818. if ( set )
  819. // convert the value to a string (all browsers do this but IE) see #1070
  820. elem.setAttribute( name, "" + value );
  821. var attr = !jQuery.support.hrefNormalized && notxml && special
  822. // Some attributes require a special call on IE
  823. ? elem.getAttribute( name, 2 )
  824. : elem.getAttribute( name );
  825. // Non-existent attributes return null, we normalize to undefined
  826. return attr === null ? undefined : attr;
  827. }
  828. // elem is actually elem.style ... set the style
  829. // IE uses filters for opacity
  830. if ( !jQuery.support.opacity && name == "opacity" ) {
  831. if ( set ) {
  832. // IE has trouble with opacity if it does not have layout
  833. // Force it by setting the zoom level
  834. elem.zoom = 1;
  835. // Set the alpha filter to set the opacity
  836. elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  837. (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  838. }
  839. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  840. (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
  841. "";
  842. }
  843. name = name.replace(/-([a-z])/ig, function(all, letter){
  844. return letter.toUpperCase();
  845. });
  846. if ( set )
  847. elem[ name ] = value;
  848. return elem[ name ];
  849. },
  850. trim: function( text ) {
  851. return (text || "").replace( /^\s+|\s+$/g, "" );
  852. },
  853. makeArray: function( array ) {
  854. var ret = [];
  855. if( array != null ){
  856. var i = array.length;
  857. // The window, strings (and functions) also have 'length'
  858. if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
  859. ret[0] = array;
  860. else
  861. while( i )
  862. ret[--i] = array[i];
  863. }
  864. return ret;
  865. },
  866. inArray: function( elem, array ) {
  867. for ( var i = 0, length = array.length; i < length; i++ )
  868. // Use === because on IE, window == document
  869. if ( array[ i ] === elem )
  870. return i;
  871. return -1;
  872. },
  873. merge: function( first, second ) {
  874. // We have to loop this way because IE & Opera overwrite the length
  875. // expando of getElementsByTagName
  876. var i = 0, elem, pos = first.length;
  877. // Also, we need to make sure that the correct elements are being returned
  878. // (IE returns comment nodes in a '*' query)
  879. if ( !jQuery.support.getAll ) {
  880. while ( (elem = second[ i++ ]) != null )
  881. if ( elem.nodeType != 8 )
  882. first[ pos++ ] = elem;
  883. } else
  884. while ( (elem = second[ i++ ]) != null )
  885. first[ pos++ ] = elem;
  886. return first;
  887. },
  888. unique: function( array ) {
  889. var ret = [], done = {};
  890. try {
  891. for ( var i = 0, length = array.length; i < length; i++ ) {
  892. var id = jQuery.data( array[ i ] );
  893. if ( !done[ id ] ) {
  894. done[ id ] = true;
  895. ret.push( array[ i ] );
  896. }
  897. }
  898. } catch( e ) {
  899. ret = array;
  900. }
  901. return ret;
  902. },
  903. grep: function( elems, callback, inv ) {
  904. var ret = [];
  905. // Go through the array, only saving the items
  906. // that pass the validator function
  907. for ( var i = 0, length = elems.length; i < length; i++ )
  908. if ( !inv != !callback( elems[ i ], i ) )
  909. ret.push( elems[ i ] );
  910. return ret;
  911. },
  912. map: function( elems, callback ) {
  913. var ret = [];
  914. // Go through the array, translating each of the items to their
  915. // new value (or values).
  916. for ( var i = 0, length = elems.length; i < length; i++ ) {
  917. var value = callback( elems[ i ], i );
  918. if ( value != null )
  919. ret[ ret.length ] = value;
  920. }
  921. return ret.concat.apply( [], ret );
  922. }
  923. });
  924. // Use of jQuery.browser is deprecated.
  925. // It's included for backwards compatibility and plugins,
  926. // although they should work to migrate away.
  927. var userAgent = navigator.userAgent.toLowerCase();
  928. // Figure out what browser is being used
  929. jQuery.browser = {
  930. version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
  931. safari: /webkit/.test( userAgent ),
  932. opera: /opera/.test( userAgent ),
  933. msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  934. mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  935. };
  936. jQuery.each({
  937. parent: function(elem){return elem.parentNode;},
  938. parents: function(elem){return jQuery.dir(elem,"parentNode");},
  939. next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
  940. prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
  941. nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
  942. prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
  943. siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
  944. children: function(elem){return jQuery.sibling(elem.firstChild);},
  945. contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
  946. }, function(name, fn){
  947. jQuery.fn[ name ] = function( selector ) {
  948. var ret = jQuery.map( this, fn );
  949. if ( selector && typeof selector == "string" )
  950. ret = jQuery.multiFilter( selector, ret );
  951. return this.pushStack( jQuery.unique( ret ), name, selector );
  952. };
  953. });
  954. jQuery.each({
  955. appendTo: "append",
  956. prependTo: "prepend",
  957. insertBefore: "before",
  958. insertAfter: "after",
  959. replaceAll: "replaceWith"
  960. }, function(name, original){
  961. jQuery.fn[ name ] = function( selector ) {
  962. var ret = [], insert = jQuery( selector );
  963. for ( var i = 0, l = insert.length; i < l; i++ ) {
  964. var elems = (i > 0 ? this.clone(true) : this).get();
  965. jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
  966. ret = ret.concat( elems );
  967. }
  968. return this.pushStack( ret, name, selector );
  969. };
  970. });
  971. jQuery.each({
  972. removeAttr: function( name ) {
  973. jQuery.attr( this, name, "" );
  974. if (this.nodeType == 1)
  975. this.removeAttribute( name );
  976. },
  977. addClass: function( classNames ) {
  978. jQuery.className.add( this, classNames );
  979. },
  980. removeClass: function( classNames ) {
  981. jQuery.className.remove( this, classNames );
  982. },
  983. toggleClass: function( classNames, state ) {
  984. if( typeof state !== "boolean" )
  985. state = !jQuery.className.has( this, classNames );
  986. jQuery.className[ state ? "add" : "remove" ]( this, classNames );
  987. },
  988. remove: function( selector ) {
  989. if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
  990. // Prevent memory leaks
  991. jQuery( "*", this ).add([this]).each(function(){
  992. jQuery.event.remove(this);
  993. jQuery.removeData(this);
  994. });
  995. if (this.parentNode)
  996. this.parentNode.removeChild( this );
  997. }
  998. },
  999. empty: function() {
  1000. // Remove element nodes and prevent memory leaks
  1001. jQuery(this).children().remove();
  1002. // Remove any remaining nodes
  1003. while ( this.firstChild )
  1004. this.removeChild( this.firstChild );
  1005. }
  1006. }, function(name, fn){
  1007. jQuery.fn[ name ] = function(){
  1008. return this.each( fn, arguments );
  1009. };
  1010. });
  1011. // Helper function used by the dimensions and offset modules
  1012. function num(elem, prop) {
  1013. return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
  1014. }
  1015. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  1016. jQuery.extend({
  1017. cache: {},
  1018. data: function( elem, name, data ) {
  1019. elem = elem == window ?
  1020. windowData :
  1021. elem;
  1022. var id = elem[ expando ];
  1023. // Compute a unique ID for the element
  1024. if ( !id )
  1025. id = elem[ expando ] = ++uuid;
  1026. // Only generate the data cache if we're
  1027. // trying to access or manipulate it
  1028. if ( name && !jQuery.cache[ id ] )
  1029. jQuery.cache[ id ] = {};
  1030. // Prevent overriding the named cache with undefined values
  1031. if ( data !== undefined )
  1032. jQuery.cache[ id ][ name ] = data;
  1033. // Return the named cache data, or the ID for the element
  1034. return name ?
  1035. jQuery.cache[ id ][ name ] :
  1036. id;
  1037. },
  1038. removeData: function( elem, name ) {
  1039. elem = elem == window ?
  1040. windowData :
  1041. elem;
  1042. var id = elem[ expando ];
  1043. // If we want to remove a specific section of the element's data
  1044. if ( name ) {
  1045. if ( jQuery.cache[ id ] ) {
  1046. // Remove the section of cache data
  1047. delete jQuery.cache[ id ][ name ];
  1048. // If we've removed all the data, remove the element's cache
  1049. name = "";
  1050. for ( name in jQuery.cache[ id ] )
  1051. break;
  1052. if ( !name )
  1053. jQuery.removeData( elem );
  1054. }
  1055. // Otherwise, we want to remove all of the element's data
  1056. } else {
  1057. // Clean up the element expando
  1058. try {
  1059. delete elem[ expando ];
  1060. } catch(e){
  1061. // IE has trouble directly removing the expando
  1062. // but it's ok with using removeAttribute
  1063. if ( elem.removeAttribute )
  1064. elem.removeAttribute( expando );
  1065. }
  1066. // Completely remove the data cache
  1067. delete jQuery.cache[ id ];
  1068. }
  1069. },
  1070. queue: function( elem, type, data ) {
  1071. if ( elem ){
  1072. type = (type || "fx") + "queue";
  1073. var q = jQuery.data( elem, type );
  1074. if ( !q || jQuery.isArray(data) )
  1075. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  1076. else if( data )
  1077. q.push( data );
  1078. }
  1079. return q;
  1080. },
  1081. dequeue: function( elem, type ){
  1082. var queue = jQuery.queue( elem, type ),
  1083. fn = queue.shift();
  1084. if( !type || type === "fx" )
  1085. fn = queue[0];
  1086. if( fn !== undefined )
  1087. fn.call(elem);
  1088. }
  1089. });
  1090. jQuery.fn.extend({
  1091. data: function( key, value ){
  1092. var parts = key.split(".");
  1093. parts[1] = parts[1] ? "." + parts[1] : "";
  1094. if ( value === undefined ) {
  1095. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1096. if ( data === undefined && this.length )
  1097. data = jQuery.data( this[0], key );
  1098. return data === undefined && parts[1] ?
  1099. this.data( parts[0] ) :
  1100. data;
  1101. } else
  1102. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
  1103. jQuery.data( this, key, value );
  1104. });
  1105. },
  1106. removeData: function( key ){
  1107. return this.each(function(){
  1108. jQuery.removeData( this, key );
  1109. });
  1110. },
  1111. queue: function(type, data){
  1112. if ( typeof type !== "string" ) {
  1113. data = type;
  1114. type = "fx";
  1115. }
  1116. if ( data === undefined )
  1117. return jQuery.queue( this[0], type );
  1118. return this.each(function(){
  1119. var queue = jQuery.queue( this, type, data );
  1120. if( type == "fx" && queue.length == 1 )
  1121. queue[0].call(this);
  1122. });
  1123. },
  1124. dequeue: function(type){
  1125. return this.each(function(){
  1126. jQuery.dequeue( this, type );
  1127. });
  1128. }
  1129. });/*!
  1130. * Sizzle CSS Selector Engine - v0.9.3
  1131. * Copyright 2009, The Dojo Foundation
  1132. * Released under the MIT, BSD, and GPL Licenses.
  1133. * More information: http://sizzlejs.com/
  1134. */
  1135. (function(){
  1136. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
  1137. done = 0,
  1138. toString = Object.prototype.toString;
  1139. var Sizzle = function(selector, context, results, seed) {
  1140. results = results || [];
  1141. context = context || document;
  1142. if ( context.nodeType !== 1 && context.nodeType !== 9 )
  1143. return [];
  1144. if ( !selector || typeof selector !== "string" ) {
  1145. return results;
  1146. }
  1147. var parts = [], m, set, checkSet, check, mode, extra, prune = true;
  1148. // Reset the position of the chunker regexp (start from head)
  1149. chunker.lastIndex = 0;
  1150. while ( (m = chunker.exec(selector)) !== null ) {
  1151. parts.push( m[1] );
  1152. if ( m[2] ) {
  1153. extra = RegExp.rightContext;
  1154. break;
  1155. }
  1156. }
  1157. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  1158. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  1159. set = posProcess( parts[0] + parts[1], context );
  1160. } else {
  1161. set = Expr.relative[ parts[0] ] ?
  1162. [ context ] :
  1163. Sizzle( parts.shift(), context );
  1164. while ( parts.length ) {
  1165. selector = parts.shift();
  1166. if ( Expr.relative[ selector ] )
  1167. selector += parts.shift();
  1168. set = posProcess( selector, set );
  1169. }
  1170. }
  1171. } else {
  1172. var ret = seed ?
  1173. { expr: parts.pop(), set: makeArray(seed) } :
  1174. Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
  1175. set = Sizzle.filter( ret.expr, ret.set );
  1176. if ( parts.length > 0 ) {
  1177. checkSet = makeArray(set);
  1178. } else {
  1179. prune = false;
  1180. }
  1181. while ( parts.length ) {
  1182. var cur = parts.pop(), pop = cur;
  1183. if ( !Expr.relative[ cur ] ) {
  1184. cur = "";
  1185. } else {
  1186. pop = parts.pop();
  1187. }
  1188. if ( pop == null ) {
  1189. pop = context;
  1190. }
  1191. Expr.relative[ cur ]( checkSet, pop, isXML(context) );
  1192. }
  1193. }
  1194. if ( !checkSet ) {
  1195. checkSet = set;
  1196. }
  1197. if ( !checkSet ) {
  1198. throw "Syntax error, unrecognized expression: " + (cur || selector);
  1199. }
  1200. if ( toString.call(checkSet) === "[object Array]" ) {
  1201. if ( !prune ) {
  1202. results.push.apply( results, checkSet );
  1203. } else if ( context.nodeType === 1 ) {
  1204. for ( var i = 0; checkSet[i] != null; i++ ) {
  1205. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
  1206. results.push( set[i] );
  1207. }
  1208. }
  1209. } else {
  1210. for ( var i = 0; checkSet[i] != null; i++ ) {
  1211. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  1212. results.push( set[i] );
  1213. }
  1214. }
  1215. }
  1216. } else {
  1217. makeArray( checkSet, results );
  1218. }
  1219. if ( extra ) {
  1220. Sizzle( extra, context, results, seed );
  1221. if ( sortOrder ) {
  1222. hasDuplicate = false;
  1223. results.sort(sortOrder);
  1224. if ( hasDuplicate ) {
  1225. for ( var i = 1; i < results.length; i++ ) {
  1226. if ( results[i] === results[i-1] ) {
  1227. results.splice(i--, 1);
  1228. }
  1229. }
  1230. }
  1231. }
  1232. }
  1233. return results;
  1234. };
  1235. Sizzle.matches = function(expr, set){
  1236. return Sizzle(expr, null, null, set);
  1237. };
  1238. Sizzle.find = function(expr, context, isXML){
  1239. var set, match;
  1240. if ( !expr ) {
  1241. return [];
  1242. }
  1243. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  1244. var type = Expr.order[i], match;
  1245. if ( (match = Expr.match[ type ].exec( expr )) ) {
  1246. var left = RegExp.leftContext;
  1247. if ( left.substr( left.length - 1 ) !== "\\" ) {
  1248. match[1] = (match[1] || "").replace(/\\/g, "");
  1249. set = Expr.find[ type ]( match, context, isXML );
  1250. if ( set != null ) {
  1251. expr = expr.replace( Expr.match[ type ], "" );
  1252. break;
  1253. }
  1254. }
  1255. }
  1256. }
  1257. if ( !set ) {
  1258. set = context.getElementsByTagName("*");
  1259. }
  1260. return {set: set, expr: expr};
  1261. };
  1262. Sizzle.filter = function(expr, set, inplace, not){
  1263. var old = expr, result = [], curLoop = set, match, anyFound,
  1264. isXMLFilter = set && set[0] && isXML(set[0]);
  1265. while ( expr && set.length ) {
  1266. for ( var type in Expr.filter ) {
  1267. if ( (match = Expr.match[ type ].exec( expr )) != null ) {
  1268. var filter = Expr.filter[ type ], found, item;
  1269. anyFound = false;
  1270. if ( curLoop == result ) {
  1271. result = [];
  1272. }
  1273. if ( Expr.preFilter[ type ] ) {
  1274. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  1275. if ( !match ) {
  1276. anyFound = found = true;
  1277. } else if ( match === true ) {
  1278. continue;
  1279. }
  1280. }
  1281. if ( match ) {
  1282. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  1283. if ( item ) {
  1284. found = filter( item, match, i, curLoop );
  1285. var pass = not ^ !!found;
  1286. if ( inplace && found != null ) {
  1287. if ( pass ) {
  1288. anyFound = true;
  1289. } else {
  1290. curLoop[i] = false;
  1291. }
  1292. } else if ( pass ) {
  1293. result.push( item );
  1294. anyFound = true;
  1295. }
  1296. }
  1297. }
  1298. }
  1299. if ( found !== undefined ) {
  1300. if ( !inplace ) {
  1301. curLoop = result;
  1302. }
  1303. expr = expr.replace( Expr.match[ type ], "" );
  1304. if ( !anyFound ) {
  1305. return [];
  1306. }
  1307. break;
  1308. }
  1309. }
  1310. }
  1311. // Improper expression
  1312. if ( expr == old ) {
  1313. if ( anyFound == null ) {
  1314. throw "Syntax error, unrecognized expression: " + expr;
  1315. } else {
  1316. break;
  1317. }
  1318. }
  1319. old = expr;
  1320. }
  1321. return curLoop;
  1322. };
  1323. var Expr = Sizzle.selectors = {
  1324. order: [ "ID", "NAME", "TAG" ],
  1325. match: {
  1326. ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1327. CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1328. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
  1329. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  1330. TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
  1331. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
  1332. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
  1333. PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
  1334. },
  1335. attrMap: {
  1336. "class": "className",
  1337. "for": "htmlFor"
  1338. },
  1339. attrHandle: {
  1340. href: function(elem){
  1341. return elem.getAttribute("href");
  1342. }
  1343. },
  1344. relative: {
  1345. "+": function(checkSet, part, isXML){
  1346. var isPartStr = typeof part === "string",
  1347. isTag = isPartStr && !/\W/.test(part),
  1348. isPartStrNotTag = isPartStr && !isTag;
  1349. if ( isTag && !isXML ) {
  1350. part = part.toUpperCase();
  1351. }
  1352. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  1353. if ( (elem = checkSet[i]) ) {
  1354. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  1355. checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
  1356. elem || false :
  1357. elem === part;
  1358. }
  1359. }
  1360. if ( isPartStrNotTag ) {
  1361. Sizzle.filter( part, checkSet, true );
  1362. }
  1363. },
  1364. ">": function(checkSet, part, isXML){
  1365. var isPartStr = typeof part === "string";
  1366. if ( isPartStr && !/\W/.test(part) ) {
  1367. part = isXML ? part : part.toUpperCase();
  1368. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1369. var elem = checkSet[i];
  1370. if ( elem ) {
  1371. var parent = elem.parentNode;
  1372. checkSet[i] = parent.nodeName === part ? parent : false;
  1373. }
  1374. }
  1375. } else {
  1376. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1377. var elem = checkSet[i];
  1378. if ( elem ) {
  1379. checkSet[i] = isPartStr ?
  1380. elem.parentNode :
  1381. elem.parentNode === part;
  1382. }
  1383. }
  1384. if ( isPartStr ) {
  1385. Sizzle.filter( part, checkSet, true );
  1386. }
  1387. }
  1388. },
  1389. "": function(checkSet, part, isXML){
  1390. var doneName = done++, checkFn = dirCheck;
  1391. if ( !part.match(/\W/) ) {
  1392. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1393. checkFn = dirNodeCheck;
  1394. }
  1395. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  1396. },
  1397. "~": function(checkSet, part, isXML){
  1398. var doneName = done++, checkFn = dirCheck;
  1399. if ( typeof part === "string" && !part.match(/\W/) ) {
  1400. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1401. checkFn = dirNodeCheck;
  1402. }
  1403. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  1404. }
  1405. },
  1406. find: {
  1407. ID: function(match, context, isXML){
  1408. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  1409. var m = context.getElementById(match[1]);
  1410. return m ? [m] : [];
  1411. }
  1412. },
  1413. NAME: function(match, context, isXML){
  1414. if ( typeof context.getElementsByName !== "undefined" ) {
  1415. var ret = [], results = context.getElementsByName(match[1]);
  1416. for ( var i = 0, l = results.length; i < l; i++ ) {
  1417. if ( results[i].getAttribute("name") === match[1] ) {
  1418. ret.push( results[i] );
  1419. }
  1420. }
  1421. return ret.length === 0 ? null : ret;
  1422. }
  1423. },
  1424. TAG: function(match, context){
  1425. return context.getElementsByTagName(match[1]);
  1426. }
  1427. },
  1428. preFilter: {
  1429. CLASS: function(match, curLoop, inplace, result, not, isXML){
  1430. match = " " + match[1].replace(/\\/g, "") + " ";
  1431. if ( isXML ) {
  1432. return match;
  1433. }
  1434. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  1435. if ( elem ) {
  1436. if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
  1437. if ( !inplace )
  1438. result.push( elem );
  1439. } else if ( inplace ) {
  1440. curLoop[i] = false;
  1441. }
  1442. }
  1443. }
  1444. return false;
  1445. },
  1446. ID: function(match){
  1447. return match[1].replace(/\\/g, "");
  1448. },
  1449. TAG: function(match, curLoop){
  1450. for ( var i = 0; curLoop[i] === false; i++ ){}
  1451. return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
  1452. },
  1453. CHILD: function(match){
  1454. if ( match[1] == "nth" ) {
  1455. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1456. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.e