| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 /* prevent execution of jQuery if included more than once */ 2 if(typeof window.jQuery == "undefined") { 3 /* 4 * jQuery 1.1.2 - New Wave Javascript 5 * 6 * Copyright (c) 2007 John Resig (jquery.com) 7 * Dual licensed under the MIT (MIT-LICENSE.txt) 8 * and GPL (GPL-LICENSE.txt) licenses. 9 * 10 * $Date: 2007-04-28 11:33:25 -0400 (Sat, 28 Apr 2007) $ 11 * $Rev: 1809 $ 12 */ 13 14 // Global undefined variable 15 window.undefined = window.undefined; 16 var jQuery = function(a,c) { 17 // If the context is global, return a new object 18 if ( window == this ) 19 return new jQuery(a,c); 20 21 // Make sure that a selection was provided 22 a = a || document; 23 24 // HANDLE: $(function) 25 // Shortcut for document ready 26 if ( jQuery.isFunction(a) ) 27 return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); 28 29 // Handle HTML strings 30 if ( typeof a == "string" ) { 31 // HANDLE: $(html) -> $(array) 32 var m = /^[^<]*(<(.|\s)+>)[^>]*$/.exec(a); 33 if ( m ) 34 a = jQuery.clean( [ m[1] ] ); 35 36 // HANDLE: $(expr) 37 else 38 return new jQuery( c ).find( a ); 39 } 40 41 return this.setArray( 42 // HANDLE: $(array) 43 a.constructor == Array && a || 44 45 // HANDLE: $(arraylike) 46 // Watch for when an array-like object is passed as the selector 47 (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || 48 49 // HANDLE: $(*) 50 [ a ] ); 51 }; 52 53 // Map over the $ in case of overwrite 54 if ( typeof $ != "undefined" ) 55 jQuery._$ = $; 56 57 // Map the jQuery namespace to the '$' one 58 var $ = jQuery; 59 60 jQuery.fn = jQuery.prototype = { 61 jquery: "1.1.2", 62 63 size: function() { 64 return this.length; 65 }, 66 67 length: 0, 68 69 get: function( num ) { 70 return num == undefined ? 71 72 // Return a 'clean' array 73 jQuery.makeArray( this ) : 74 75 // Return just the object 76 this[num]; 77 }, 78 pushStack: function( a ) { 79 var ret = jQuery(a); 80 ret.prevObject = this; 81 return ret; 82 }, 83 setArray: function( a ) { 84 this.length = 0; 85 [].push.apply( this, a ); 86 return this; 87 }, 88 each: function( fn, args ) { 89 return jQuery.each( this, fn, args ); 90 }, 91 index: function( obj ) { 92 var pos = -1; 93 this.each(function(i){ 94 if ( this == obj ) pos = i; 95 }); 96 return pos; 97 }, 98 99 attr: function( key, value, type ) { 100 var obj = key; 101 102 // Look for the case where we're accessing a style value 103 if ( key.constructor == String ) 104 if ( value == undefined ) 105 return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; 106 else { 107 obj = {}; 108 obj[ key ] = value; 109 } 110 111 // Check to see if we're setting style values 112 return this.each(function(index){ 113 // Set all the styles 114 for ( var prop in obj ) 115 jQuery.attr( 116 type ? this.style : this, 117 prop, jQuery.prop(this, obj[prop], type, index, prop) 118 ); 119 }); 120 }, 121 122 css: function( key, value ) { 123 return this.attr( key, value, "curCSS" ); 124 }, 125 126 text: function(e) { 127 if ( typeof e == "string" ) 128 return this.empty().append( document.createTextNode( e ) ); 129 130 var t = ""; 131 jQuery.each( e || this, function(){ 132 jQuery.each( this.childNodes, function(){ 133 if ( this.nodeType != 8 ) 134 t += this.nodeType != 1 ? 135 this.nodeValue : jQuery.fn.text([ this ]); 136 }); 137 }); 138 return t; 139 }, 140 141 wrap: function() { 142 // The elements to wrap the target around 143 var a, args = arguments; 144 145 // Wrap each of the matched elements individually 146 return this.each(function(){ 147 if ( !a ) 148 a = jQuery.clean(args, this.ownerDocument); 149 150 // Clone the structure that we're using to wrap 151 var b = a[0].cloneNode(true); 152 153 // Insert it before the element to be wrapped 154 this.parentNode.insertBefore( b, this ); 155 156 // Find the deepest point in the wrap structure 157 while ( b.firstChild ) 158 b = b.firstChild; 159 160 // Move the matched element to within the wrap structure 161 b.appendChild( this ); 162 }); 163 }, 164 append: function() { 165 return this.domManip(arguments, true, 1, function(a){ 166 this.appendChild( a ); 167 }); 168 }, 169 prepend: function() { 170 return this.domManip(arguments, true, -1, function(a){ 171 this.insertBefore( a, this.firstChild ); 172 }); 173 }, 174 before: function() { 175 return this.domManip(arguments, false, 1, function(a){ 176 this.parentNode.insertBefore( a, this ); 177 }); 178 }, 179 after: function() { 180 return this.domManip(arguments, false, -1, function(a){ 181 this.parentNode.insertBefore( a, this.nextSibling ); 182 }); 183 }, 184 end: function() { 185 return this.prevObject || jQuery([]); 186 }, 187 find: function(t) { 188 return this.pushStack( jQuery.unique( jQuery.map( this, function(a){ 189 return jQuery.find(t,a); 190 }) ), t ); 191 }, 192 clone: function(deep) { 193 return this.pushStack( jQuery.map( this, function(a){ 194 var a = a.cloneNode( deep != undefined ? deep : true ); 195 a.$events = null; // drop $events expando to avoid firing incorrect events 196 return a; 197 }) ); 198 }, 199 200 filter: function(t) { 201 return this.pushStack( 202 jQuery.isFunction( t ) && 203 jQuery.grep(this, function(el, index){ 204 return t.apply(el, [index]) 205 }) || 206 207 jQuery.multiFilter(t,this) ); 208 }, 209 210 not: function(t) { 211 return this.pushStack( 212 t.constructor == String && 213 jQuery.multiFilter(t, this, true) || 214 215 jQuery.grep(this, function(a) { 216 return ( t.constructor == Array || t.jquery ) 217 ? jQuery.inArray( a, t ) < 0 218 : a != t; 219 }) 220 ); 221 }, 222 223 add: function(t) { 224 return this.pushStack( jQuery.merge( 225 this.get(), 226 t.constructor == String ? 227 jQuery(t).get() : 228 t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ? 229 t : [t] ) 230 ); 231 }, 232 is: function(expr) { 233 return expr ? jQuery.multiFilter(expr,this).length > 0 : false; 234 }, 235 236 val: function( val ) { 237 return val == undefined ? 238 ( this.length ? this[0].value : null ) : 239 this.attr( "value", val ); 240 }, 241 242 html: function( val ) { 243 return val == undefined ? 244 ( this.length ? this[0].innerHTML : null ) : 245 this.empty().append( val ); 246 }, 247 domManip: function(args, table, dir, fn){ 248 var clone = this.length > 1, a; 249 250 return this.each(function(){ 251 if ( !a ) { 252 a = jQuery.clean(args, this.ownerDocument); 253 if ( dir < 0 ) 254 a.reverse(); 255 } 256 257 var obj = this; 258 259 if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") ) 260 obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody")); 261 262 jQuery.each( a, function(){ 263 fn.apply( obj, [ clone ? this.cloneNode(true) : this ] ); 264 }); 265 266 }); 267 } 268 }; 269 270 jQuery.extend = jQuery.fn.extend = function() { 271 // copy reference to target object 272 var resolver, prop, target = arguments[0], 273 a = 1; 274 275 // extend jQuery itself if only one argument is passed 276 if ( arguments.length == 1 ) { 277 target = this; 278 a = 0; 279 } else if (jQuery.isFunction(arguments[a])) { 280 resolver = arguments[a++]; 281 } 282 283 while (prop = arguments[a++]) 284 // Extend the base object 285 for ( var i in prop ) { 286 if (resolver && target[i] && prop[i]) { 287 target[i] = resolver(target[i], prop[i]); 288 } else { 289 target[i] = prop[i]; 290 } 291 } 292 293 // Return the modified object 294 return target; 295 }; 296 297 jQuery.extend({ 298 noConflict: function() { 299 if ( jQuery._$ ) 300 $ = jQuery._$; 301 return jQuery; 302 }, 303 304 // This may seem like some crazy code, but trust me when I say that this 305 // is the only cross-browser way to do this. --John 306 isFunction: function( fn ) { 307 return !!fn && typeof fn != "string" && !fn.nodeName && 308 fn.constructor != Array && /function/i.test( fn + "" ); 309 }, 310 311 // check if an element is in a XML document 312 isXMLDoc: function(elem) { 313 return elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 314 }, 315 316 nodeName: function( elem, name ) { 317 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); 318 }, 319 // args is for internal usage only 320 each: function( obj, fn, args ) { 321 if ( obj.length == undefined ) 322 for ( var i in obj ) 323 fn.apply( obj[i], args || [i, obj[i]] ); 324 else 325 for ( var i = 0, ol = obj.length; i < ol; i++ ) 326 if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break; 327 return obj; 328 }, 329 330 prop: function(elem, value, type, index, prop){ 331 // Handle executable functions 332 if ( jQuery.isFunction( value ) ) 333 value = value.call( elem, [index] ); 334 335 // exclude the following css properties to add px 336 var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; 337 338 // Handle passing in a number to a CSS property 339 return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ? 340 value + "px" : 341 value; 342 }, 343 344 className: { 345 // internal only, use addClass("class") 346 add: function( elem, c ){ 347 jQuery.each( c.split(/\s+/), function(i, cur){ 348 if ( !jQuery.className.has( elem.className, cur ) ) 349 elem.className += ( elem.className ? " " : "" ) + cur; 350 }); 351 }, 352 353 // internal only, use removeClass("class") 354 remove: function( elem, c ){ 355 elem.className = c ? 356 jQuery.grep( elem.className.split(/\s+/), function(cur){ 357 return !jQuery.className.has( c, cur ); 358 }).join(" ") : ""; 359 }, 360 361 // internal only, use is(".class") 362 has: function( t, c ) { 363 return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1; 364 } 365 }, 366 swap: function(e,o,f) { 367 for ( var i in o ) { 368 e.style["old"+i] = e.style[i]; 369 e.style[i] = o[i]; 370 } 371 f.apply( e, [] ); 372 for ( var i in o ) 373 e.style[i] = e.style["old"+i]; 374 }, 375 376 css: function(e,p) { 377 if ( p == "height" || p == "width" ) { 378 var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; 379 380 jQuery.each( d, function(){ 381 old["padding" + this] = 0; 382 old["border" + this + "Width"] = 0; 383 }); 384 385 jQuery.swap( e, old, function() { 386 if ( jQuery(e).is(':visible') ) { 387 oHeight = e.offsetHeight; 388 oWidth = e.offsetWidth; 389 } else { 390 e = jQuery(e.cloneNode(true)) 391 .find(":radio").removeAttr("checked").end() 392 .css({ 393 visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0" 394 }).appendTo(e.parentNode)[0]; 395 396 var parPos = jQuery.css(e.parentNode,"position") || "static"; 397 if ( parPos == "static" ) 398 e.parentNode.style.position = "relative"; 399 400 oHeight = e.clientHeight; 401 oWidth = e.clientWidth; 402 403 if ( parPos == "static" ) 404 e.parentNode.style.position = "static"; 405 406 e.parentNode.removeChild(e); 407 } 408 }); 409 410 return p == "height" ? oHeight : oWidth; 411 } 412 413 return jQuery.curCSS( e, p ); 414 }, 415 416 curCSS: function(elem, prop, force) { 417 var ret; 418 419 if (prop == "opacity" && jQuery.browser.msie) { 420 ret = jQuery.attr(elem.style, "opacity"); 421 return ret == "" ? "1" : ret; 422 } 423 424 if (prop == "float" || prop == "cssFloat") 425 prop = jQuery.browser.msie ? "styleFloat" : "cssFloat"; 426 427 if (!force && elem.style[prop]) 428 ret = elem.style[prop]; 429 430 else if (document.defaultView && document.defaultView.getComputedStyle) { 431 432 if (prop == "cssFloat" || prop == "styleFloat") 433 prop = "float"; 434 435 prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase(); 436 var cur = document.defaultView.getComputedStyle(elem, null); 437 438 if ( cur ) 439 ret = cur.getPropertyValue(prop); 440 else if ( prop == "display" ) 441 ret = "none"; 442 else 443 jQuery.swap(elem, { display: "block" }, function() { 444 var c = document.defaultView.getComputedStyle(this, ""); 445 ret = c && c.getPropertyValue(prop) || ""; 446 }); 447 448 } else if (elem.currentStyle) { 449 var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();}); 450 ret = elem.currentStyle[prop] || elem.currentStyle[newProp]; 451 } 452 453 return ret; 454 }, 455 456 clean: function(a, doc) { 457 var r = []; 458 doc = doc || document; 459 460 jQuery.each( a, function(i,arg){ 461 if ( !arg ) return; 462 463 if ( arg.constructor == Number ) 464 arg = arg.toString(); 465 466 // Convert html string into DOM nodes 467 if ( typeof arg == "string" ) { 468 // Trim whitespace, otherwise indexOf won't work as expected 469 var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = []; 470 471 var wrap = 472 // option or optgroup 473 !s.indexOf("<opt") && 474 [1, "<select>", "</select>"] || 475 476 !s.indexOf("<leg") && 477 [1, "<fieldset>", "</fieldset>"] || 478 479 (!s.indexOf("<thead") || !s.indexOf("<tbody") || !s.indexOf("<tfoot")) && 480 [1, "<table>", "</table>"] || 481 482 !s.indexOf("<tr") && 483 [2, "<table><tbody>", "</tbody></table>"] || 484 485 // <thead> matched above 486 (!s.indexOf("<td") || !s.indexOf("<th")) && 487 [3, "<table><tbody><tr>", "</tr></tbody></table>"] || 488 489 [0,"",""]; 490 491 // Go to html and back, then peel off extra wrappers 492 div.innerHTML = wrap[1] + arg + wrap[2]; 493 494 // Move to the right depth 495 while ( wrap[0]-- ) 496 div = div.firstChild; 497 498 // Remove IE's autoinserted <tbody> from table fragments 499 if ( jQuery.browser.msie ) { 500 501 // String was a <table>, *may* have spurious <tbody> 502 if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 ) 503 tb = div.firstChild && div.firstChild.childNodes; 504 505 // String was a bare <thead> or <tfoot> 506 else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 ) 507 tb = div.childNodes; 508 509 for ( var n = tb.length-1; n >= 0 ; --n ) 510 if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length ) 511 tb[n].parentNode.removeChild(tb[n]); 512 513 } 514 515 arg = jQuery.makeArray( div.childNodes ); 516 } 517 518 if ( arg.length === 0 && !jQuery(arg).is("form, select") ) 519 return; 520 521 if ( arg[0] == undefined || jQuery(arg).is("form, select") ) 522 r.push( arg ); 523 else 524 r = jQuery.merge( r, arg ); 525 526 }); 527 528 return r; 529 }, 530 531 attr: function(elem, name, value){ 532 var fix = jQuery.isXMLDoc(elem) ? {} : { 533 "for": "htmlFor", 534 "class": "className", 535 "float": jQuery.browser.msie ? "styleFloat" : "cssFloat", 536 cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat", 537 innerHTML: "innerHTML", 538 className: "className", 539 value: "value", 540 disabled: "disabled", 541 checked: "checked", 542 readonly: "readOnly", 543 selected: "selected" 544 }; 545 546 // IE actually uses filters for opacity ... elem is actually elem.style 547 if ( name == "opacity" && jQuery.browser.msie ) { 548 if ( value != undefined ) { 549 // IE has trouble with opacity if it does not have layout 550 // Force it by setting the zoom level 551 elem.zoom = 1; 552 553 // Set the alpha filter to set the opacity 554 elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") + 555 (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); 556 } 557 558 return elem.filter ? 559 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : ""; 560 } 561 562 // Certain attributes only work when accessed via the old DOM 0 way 563 if ( fix[name] ) { 564 if ( value != undefined ) elem[fix[name]] = value; 565 return elem[fix[name]]; 566 567 } else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") ) 568 return elem.getAttributeNode(name).nodeValue; 569 570 // IE elem.getAttribute passes even for style 571 else if ( elem.tagName ) { 572 if ( value != undefined ) elem.setAttribute( name, value ); 573 if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) 574 return elem.getAttribute( name, 2 ); 575 return elem.getAttribute( name ); 576 577 // elem is actually elem.style ... set the style 578 } else { 579 name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();}); 580 if ( value != undefined ) elem[name] = value; 581 return elem[name]; 582 } 583 }, 584 trim: function(t){ 585 return t.replace(/^\s+|\s+$/g, ""); 586 }, 587 588 makeArray: function( a ) { 589 var r = []; 590 591 // Need to use typeof to fight Safari childNodes crashes 592 if ( typeof a != "array" ) 593 for ( var i = 0, al = a.length; i < al; i++ ) 594 r.push( a[i] ); 595 else 596 r = a.slice( 0 ); 597 598 return r; 599 }, 600 601 inArray: function( b, a ) { 602 for ( var i = 0, al = a.length; i < al; i++ ) 603 if ( a[i] == b ) 604 return i; 605 return -1; 606 }, 607 merge: function(first, second) { 608 // We have to loop this way because IE & Opera overwrite the length 609 // expando of getElementsByTagName 610 for ( var i = 0; second[i]; i++ ) 611 first.push(second[i]); 612 return first; 613 }, 614 615 unique: function(first) { 616 var r = [], num = jQuery.mergeNum++; 617 618 for ( var i = 0, fl = first.length; i < fl; i++ ) 619 if ( first[i].mergeNum != num ) { 620 first[i].mergeNum = num; 621 r.push(first[i]); 622 } 623 624 return r; 625 }, 626 627 mergeNum: 0, 628 grep: function(elems, fn, inv) { 629 // If a string is passed in for the function, make a function 630 // for it (a handy shortcut) 631 if ( typeof fn == "string" ) 632 fn = new Function("a","i","return " + fn); 633 634 var result = []; 635 636 // Go through the array, only saving the items 637 // that pass the validator function 638 for ( var i = 0, el = elems.length; i < el; i++ ) 639 if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) ) 640 result.push( elems[i] ); 641 642 return result; 643 }, 644 map: function(elems, fn) { 645 // If a string is passed in for the function, make a function 646 // for it (a handy shortcut) 647 if ( typeof fn == "string" ) 648 fn = new Function("a","return " + fn); 649 650 var result = [], r = []; 651 652 // Go through the array, translating each of the items to their 653 // new value (or values). 654 for ( var i = 0, el = elems.length; i < el; i++ ) { 655 var val = fn(elems[i],i); 656 657 if ( val !== null && val != undefined ) { 658 if ( val.constructor != Array ) val = [val]; 659 result = result.concat( val ); 660 } 661 } 662 663 return result; 664 } 665 }); 666 667 /* 668 * Whether the W3C compliant box model is being used. 669 * 670 * @property 671 * @name $.boxModel 672 * @type Boolean 673 * @cat JavaScript 674 */ 675 new function() { 676 var b = navigator.userAgent.toLowerCase(); 677 678 // Figure out what browser is being used 679 jQuery.browser = { 680 version: b.match(/.+[xiae][\/ ]([\d.]+)/)[1], 681 safari: /webkit/.test(b), 682 opera: /opera/.test(b), 683 msie: /msie/.test(b) && !/opera/.test(b), 684 mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b) 685 }; 686 687 // Check to see if the W3C box model is being used 688 jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat"; 689 }; 690 691 jQuery.each({ 692 parent: "a.parentNode", 693 parents: "jQuery.parents(a)", 694 next: "jQuery.nth(a,2,'nextSibling')", 695 prev: "jQuery.nth(a,2,'previousSibling')", 696 siblings: "jQuery.sibling(a.parentNode.firstChild,a)", 697 children: "jQuery.sibling(a.firstChild)" 698 }, function(i,n){ 699 jQuery.fn[ i ] = function(a) { 700 var ret = jQuery.map(this,n); 701 if ( a && typeof a == "string" ) 702 ret = jQuery.multiFilter(a,ret); 703 return this.pushStack( ret ); 704 }; 705 }); 706 707 jQuery.each({ 708 appendTo: "append", 709 prependTo: "prepend", 710 insertBefore: "before", 711 insertAfter: "after" 712 }, function(i,n){ 713 jQuery.fn[ i ] = function(){ 714 var a = arguments; 715 return this.each(function(){ 716 for ( var j = 0, al = a.length; j < al; j++ ) 717 jQuery(a[j])[n]( this ); 718 }); 719 }; 720 }); 721 722 jQuery.each( { 723 removeAttr: function( key ) { 724 jQuery.attr( this, key, "" ); 725 this.removeAttribute( key ); 726 }, 727 addClass: function(c){ 728 jQuery.className.add(this,c); 729 }, 730 removeClass: function(c){ 731 jQuery.className.remove(this,c); 732 }, 733 toggleClass: function( c ){ 734 jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c); 735 }, 736 remove: function(a){ 737 if ( !a || jQuery.filter( a, [this] ).r.length ) 738 this.parentNode.removeChild( this ); 739 }, 740 empty: function() { 741 while ( this.firstChild ) 742 this.removeChild( this.firstChild ); 743 } 744 }, function(i,n){ 745 jQuery.fn[ i ] = function() { 746 return this.each( n, arguments ); 747 }; 748 }); 749 750 jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){ 751 jQuery.fn[ n ] = function(num,fn) { 752 return this.filter( ":" + n + "(" + num + ")", fn ); 753 }; 754 }); 755 756 jQuery.each( [ "height", "width" ], function(i,n){ 757 jQuery.fn[ n ] = function(h) { 758 return h == undefined ? 759 ( this.length ? jQuery.css( this[0], n ) : null ) : 760 this.css( n, h.constructor == String ? h : h + "px" ); 761 }; 762 }); 763 jQuery.extend({ 764 expr: { 765 "": "m[2]=='*'||jQuery.nodeName(a,m[2])", 766 "#": "a.getAttribute('id')==m[2]", 767 ":": { 768 // Position Checks 769 lt: "i<m[3]-0", 770 gt: "i>m[3]-0", 771 nth: "m[3]-0==i", 772 eq: "m[3]-0==i", 773 first: "i==0", 774 last: "i==r.length-1", 775 even: "i%2==0", 776 odd: "i%2", 777 778 // Child Checks 779 "nth-child": "jQuery.nth(a.parentNode.firstChild,m[3],'nextSibling',a)==a", 780 "first-child": "jQuery.nth(a.parentNode.firstChild,1,'nextSibling')==a", 781 "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", 782 "only-child": "jQuery.sibling(a.parentNode.firstChild).length==1", 783 784 // Parent Checks 785 parent: "a.firstChild", 786 empty: "!a.firstChild", 787 788 // Text Check 789 contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0", 790 791 // Visibility 792 visible: 'a.type!="hidden"&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"', 793 hidden: 'a.type=="hidden"||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"', 794 795 // Form attributes 796 enabled: "!a.disabled", 797 disabled: "a.disabled", 798 checked: "a.checked", 799 selected: "a.selected||jQuery.attr(a,'selected')", 800 801 // Form elements 802 text: "a.type=='text'", 803 radio: "a.type=='radio'", 804 checkbox: "a.type=='checkbox'", 805 file: "a.type=='file'", 806 password: "a.type=='password'", 807 submit: "a.type=='submit'", 808 image: "a.type=='image'", 809 reset: "a.type=='reset'", 810 button: 'a.type=="button"||jQuery.nodeName(a,"button")', 811 input: "/input|select|textarea|button/i.test(a.nodeName)" 812 }, 813 ".": "jQuery.className.has(a,m[2])", 814 "@": { 815 "=": "z==m[4]", 816 "!=": "z!=m[4]", 817 "^=": "z&&!z.indexOf(m[4])", 818 "$=": "z&&z.substr(z.length - m[4].length,m[4].length)==m[4]", 819 "*=": "z&&z.indexOf(m[4])>=0", 820 "": "z", 821 // these are for evaling in a regexp. 822 "=~": "eval(m[4]).test(z)", 823 "!~": "!eval(m[4]).test(z)", 824 _resort: function(m){ 825 return ["", m[1], m[3], m[2], m[5]]; 826 }, 827 _prefix: "z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);" 828 }, 829 "[": "jQuery.find(m[2],a).length" 830 }, 831 832 // The regular expressions that power the parsing engine 833 parse: [ 834 // Match: [@value='test'], [@foo] 835 /^\[ *(@)([\w-]+) *([!*$^=!~]*) *('?"?)(.*?)\4 *\]/, 836 837 // Match: [div], [div p] 838 /^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/, 839 840 // Match: :contains('foo') 841 /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, 842 843 // Match: :even, :last-chlid, #id, .class 844 new RegExp("^([:.#]*)(" + 845 ( jQuery.chars = "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)" ) + "+)") 846 ], 847 848 token: [ 849 /^(\/?\.\.)/, "a.parentNode", 850 /^(>|\/)/, "jQuery.sibling(a.firstChild)", 851 /^(\+)/, "jQuery.nth(a,2,'nextSibling')", 852 /^(~)/, function(a){ 853 var s = jQuery.sibling(a.parentNode.firstChild); 854 return s.slice(jQuery.inArray(a,s) + 1); 855 } 856 ], 857 858 multiFilter: function( expr, elems, not ) { 859 var old, cur = []; 860 861 while ( expr && expr != old ) { 862 old = expr; 863 var f = jQuery.filter( expr, elems, not ); 864 expr = f.t.replace(/^\s*,\s*/, "" ); 865 cur = not ? elems = f.r : jQuery.merge( cur, f.r ); 866 } 867 868 return cur; 869 }, 870 find: function( t, context ) { 871 // Quickly handle non-string expressions 872 if ( typeof t != "string" ) 873 return [ t ]; 874 875 // Make sure that the context is a DOM Element 876 if ( context && !context.nodeType ) 877 context = null; 878 879 // Set the correct context (if none is provided) 880 context = context || document; 881 882 // Handle the common XPath // expression 883 if ( !t.indexOf("//") ) { 884 context = context.documentElement; 885 t = t.substr(2,t.length); 886 887 // And the / root expression 888 } else if ( !t.indexOf("/") && !context.ownerDocument ) { 889 context = context.documentElement; 890 t = t.substr(1,t.length); 891 if ( t.indexOf("/") >= 1 ) 892 t = t.substr(t.indexOf("/"),t.length); 893 } 894 895 // Initialize the search 896 var ret = [context], done = [], last; 897 898 // Continue while a selector expression exists, and while 899 // we're no longer looping upon ourselves 900 while ( t && last != t ) { 901 var r = []; 902 last = t; 903 904 t = jQuery.trim(t).replace( /^\/\//, "" ); 905 906 var foundToken = false; 907 908 // An attempt at speeding up child selectors that 909 // point to a specific element tag 910 var re = new RegExp("^[/>]\\s*(" + jQuery.chars + "+)"); 911 var m = re.exec(t); 912 913 if ( m ) { 914 // Perform our own iteration and filter 915 for ( var i = 0; ret[i]; i++ ) 916 for ( var c = ret[i].firstChild; c; c = c.nextSibling ) 917 if ( c.nodeType == 1 && ( m[1] == "*" || jQuery.nodeName(c, m[1]) ) ) 918 r.push( c ); 919 920 ret = r; 921 t = t.replace( re, "" ); 922 if ( t.indexOf(" ") == 0 ) continue; 923 foundToken = true; 924 } else { 925 // Look for pre-defined expression tokens 926 for ( var i = 0, tl = jQuery.token.length; i < tl; i += 2 ) { 927 // Attempt to match each, individual, token in 928 // the specified order 929 var re = jQuery.token[i], fn = jQuery.token[i+1]; 930 var m = re.exec(t); 931 932 // If the token match was found 933 if ( m ) { 934 // Map it against the token's handler 935 r = ret = jQuery.map( ret, jQuery.isFunction( fn ) ? 936 fn : new Function( "a", "return " + fn ) ); 937 938 // And remove the token 939 t = jQuery.trim( t.replace( re, "" ) ); 940 foundToken = true; 941 break; 942 } 943 } 944 } 945 946 // See if there's still an expression, and that we haven't already 947 // matched a token 948 if ( t && !foundToken ) { 949 // Handle multiple expressions 950 if ( !t.indexOf(",") ) { 951 // Clean the result set 952 if ( ret[0] == context ) ret.shift(); 953 954 // Merge the result sets 955 done = jQuery.merge( done, ret ); 956 957 // Reset the context 958 r = ret = [context]; 959 960 // Touch up the selector string 961 t = " " + t.substr(1,t.length); 962 963 } else { 964 // Optomize for the case nodeName#idName 965 var re2 = new RegExp("^(" + jQuery.chars + "+)(#)(" + jQuery.chars + "+)"); 966 var m = re2.exec(t); 967 968 // Re-organize the results, so that they're consistent 969 if ( m ) { 970 m = [ 0, m[2], m[3], m[1] ]; 971 972 } else { 973 // Otherwise, do a traditional filter check for 974 // ID, class, and element selectors 975 re2 = new RegExp("^([#.]?)(" + jQuery.chars + "*)"); 976 m = re2.exec(t); 977 } 978 979 m[2] = m[2].replace(/\\/g, ""); 980 981 var elem = ret[ret.length-1]; 982 983 // Try to do a global search by ID, where we can 984 if ( m[1] == "#" && elem && elem.getElementById ) { 985 // Optimization for HTML document case 986 var oid = elem.getElementById(m[2]); 987 988 // Do a quick check for the existence of the actual ID attribute 989 // to avoid selecting by the name attribute in IE 990 if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && oid.id != m[2] ) 991 oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; 992 993 // Do a quick check for node name (where applicable) so 994 // that div#foo searches will be really fast 995 ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; 996 } else { 997 // We need to find all descendant elements 998 for ( var i = 0; ret[i]; i++ ) { 999 // Grab the tag name being searched for 1000 var tag = m[1] != "" || m[0] == "" ? "*" : m[2]; 1001 1002 // Handle IE7 being really dumb about <object>s 1003 if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) 1004 tag = "param"; 1005 1006 r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); 1007 } 1008 1009 // It's faster to filter by class and be done with it 1010 if ( m[1] == "." ) 1011 r = jQuery.classFilter( r, m[2] ); 1012 1013 // Same with ID filtering 1014 if ( m[1] == "#" ) { 1015 var tmp = []; 1016 1017 // Try to find the element with the ID 1018 for ( var i = 0; r[i]; i++ ) 1019 if ( r[i].getAttribute("id") == m[2] ) { 1020 tmp = [ r[i] ]; 1021 break; 1022 } 1023 1024 r = tmp; 1025 } 1026 1027 ret = r; 1028 } 1029 1030 t = t.replace( re2, "" ); 1031 } 1032 1033 } 1034 1035 // If a selector string still exists 1036 if ( t ) { 1037 // Attempt to filter it 1038 var val = jQuery.filter(t,r); 1039 ret = r = val.r; 1040 t = jQuery.trim(val.t); 1041 } 1042 } 1043 1044 // An error occurred with the selector; 1045 // just return an empty set instead 1046 if ( t ) 1047 ret = []; 1048 1049