Best JavaScript code snippet using cypress
jquery.js
Source:jquery.js
1/*!2 * jquery javascript library v1.5.13 * http://jquery.com/4 *5 * copyright 2011, john resig6 * dual licensed under the mit or gpl version 2 licenses.7 * http://jquery.org/license8 *9 * includes sizzle.js10 * http://sizzlejs.com/11 * copyright 2011, the dojo foundation12 * released under the mit, bsd, and gpl licenses.13 *14 * date: wed feb 23 13:55:29 2011 -050015 */16(function( window, undefined ) {17// use the correct document accordingly with window argument (sandbox)18var document = window.document;19var jquery = (function() {20// define a local copy of jquery21var jquery = function( selector, context ) {22 // the jquery object is actually just the init constructor 'enhanced'23 return new jquery.fn.init( selector, context, rootjquery );24 },25 // map over jquery in case of overwrite26 _jquery = window.jquery,27 // map over the $ in case of overwrite28 _$ = window.$,29 // a central reference to the root jquery(document)30 rootjquery,31 // a simple way to check for html strings or id strings32 // (both of which we optimize for)33 quickexpr = /^(?:[^<]*(<[\w\w]+>)[^>]*$|#([\w\-]+)$)/,34 // check if a string has a non-whitespace character in it35 rnotwhite = /\s/,36 // used for trimming whitespace37 trimleft = /^\s+/,38 trimright = /\s+$/,39 // check for digits40 rdigit = /\d/,41 // match a standalone tag42 rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,43 // json regexp44 rvalidchars = /^[\],:{}\s]*$/,45 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fa-f]{4})/g,46 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/g,47 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,48 // useragent regexp49 rwebkit = /(webkit)[ \/]([\w.]+)/,50 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,51 rmsie = /(msie) ([\w.]+)/,52 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,53 // keep a useragent string for use with jquery.browser54 useragent = navigator.useragent,55 // for matching the engine and version of the browser56 browsermatch,57 // has the ready events already been bound?58 readybound = false,59 // the deferred used on dom ready60 readylist,61 // promise methods62 promisemethods = "then done fail isresolved isrejected promise".split( " " ),63 // the ready event handler64 domcontentloaded,65 // save a reference to some core methods66 tostring = object.prototype.tostring,67 hasown = object.prototype.hasownproperty,68 push = array.prototype.push,69 slice = array.prototype.slice,70 trim = string.prototype.trim,71 indexof = array.prototype.indexof,72 // [[class]] -> type pairs73 class2type = {};74jquery.fn = jquery.prototype = {75 constructor: jquery,76 init: function( selector, context, rootjquery ) {77 var match, elem, ret, doc;78 // handle $(""), $(null), or $(undefined)79 if ( !selector ) {80 return this;81 }82 // handle $(domelement)83 if ( selector.nodetype ) {84 this.context = this[0] = selector;85 this.length = 1;86 return this;87 }88 // the body element only exists once, optimize finding it89 if ( selector === "body" && !context && document.body ) {90 this.context = document;91 this[0] = document.body;92 this.selector = "body";93 this.length = 1;94 return this;95 }96 // handle html strings97 if ( typeof selector === "string" ) {98 // are we dealing with html string or an id?99 match = quickexpr.exec( selector );100 // verify a match, and that no context was specified for #id101 if ( match && (match[1] || !context) ) {102 // handle: $(html) -> $(array)103 if ( match[1] ) {104 context = context instanceof jquery ? context[0] : context;105 doc = (context ? context.ownerdocument || context : document);106 // if a single string is passed in and it's a single tag107 // just do a createelement and skip the rest108 ret = rsingletag.exec( selector );109 if ( ret ) {110 if ( jquery.isplainobject( context ) ) {111 selector = [ document.createelement( ret[1] ) ];112 jquery.fn.attr.call( selector, context, true );113 } else {114 selector = [ doc.createelement( ret[1] ) ];115 }116 } else {117 ret = jquery.buildfragment( [ match[1] ], [ doc ] );118 selector = (ret.cacheable ? jquery.clone(ret.fragment) : ret.fragment).childnodes;119 }120 return jquery.merge( this, selector );121 // handle: $("#id")122 } else {123 elem = document.getelementbyid( match[2] );124 // check parentnode to catch when blackberry 4.6 returns125 // nodes that are no longer in the document #6963126 if ( elem && elem.parentnode ) {127 // handle the case where ie and opera return items128 // by name instead of id129 if ( elem.id !== match[2] ) {130 return rootjquery.find( selector );131 }132 // otherwise, we inject the element directly into the jquery object133 this.length = 1;134 this[0] = elem;135 }136 this.context = document;137 this.selector = selector;138 return this;139 }140 // handle: $(expr, $(...))141 } else if ( !context || context.jquery ) {142 return (context || rootjquery).find( selector );143 // handle: $(expr, context)144 // (which is just equivalent to: $(context).find(expr)145 } else {146 return this.constructor( context ).find( selector );147 }148 // handle: $(function)149 // shortcut for document ready150 } else if ( jquery.isfunction( selector ) ) {151 return rootjquery.ready( selector );152 }153 if (selector.selector !== undefined) {154 this.selector = selector.selector;155 this.context = selector.context;156 }157 return jquery.makearray( selector, this );158 },159 // start with an empty selector160 selector: "",161 // the current version of jquery being used162 jquery: "1.5.1",163 // the default length of a jquery object is 0164 length: 0,165 // the number of elements contained in the matched element set166 size: function() {167 return this.length;168 },169 toarray: function() {170 return slice.call( this, 0 );171 },172 // get the nth element in the matched element set or173 // get the whole matched element set as a clean array174 get: function( num ) {175 return num == null ?176 // return a 'clean' array177 this.toarray() :178 // return just the object179 ( num < 0 ? this[ this.length + num ] : this[ num ] );180 },181 // take an array of elements and push it onto the stack182 // (returning the new matched element set)183 pushstack: function( elems, name, selector ) {184 // build a new jquery matched element set185 var ret = this.constructor();186 if ( jquery.isarray( elems ) ) {187 push.apply( ret, elems );188 } else {189 jquery.merge( ret, elems );190 }191 // add the old object onto the stack (as a reference)192 ret.prevobject = this;193 ret.context = this.context;194 if ( name === "find" ) {195 ret.selector = this.selector + (this.selector ? " " : "") + selector;196 } else if ( name ) {197 ret.selector = this.selector + "." + name + "(" + selector + ")";198 }199 // return the newly-formed element set200 return ret;201 },202 // execute a callback for every element in the matched set.203 // (you can seed the arguments with an array of args, but this is204 // only used internally.)205 each: function( callback, args ) {206 return jquery.each( this, callback, args );207 },208 ready: function( fn ) {209 // attach the listeners210 jquery.bindready();211 // add the callback212 readylist.done( fn );213 return this;214 },215 eq: function( i ) {216 return i === -1 ?217 this.slice( i ) :218 this.slice( i, +i + 1 );219 },220 first: function() {221 return this.eq( 0 );222 },223 last: function() {224 return this.eq( -1 );225 },226 slice: function() {227 return this.pushstack( slice.apply( this, arguments ),228 "slice", slice.call(arguments).join(",") );229 },230 map: function( callback ) {231 return this.pushstack( jquery.map(this, function( elem, i ) {232 return callback.call( elem, i, elem );233 }));234 },235 end: function() {236 return this.prevobject || this.constructor(null);237 },238 // for internal use only.239 // behaves like an array's method, not like a jquery method.240 push: push,241 sort: [].sort,242 splice: [].splice243};244// give the init function the jquery prototype for later instantiation245jquery.fn.init.prototype = jquery.fn;246jquery.extend = jquery.fn.extend = function() {247 var options, name, src, copy, copyisarray, clone,248 target = arguments[0] || {},249 i = 1,250 length = arguments.length,251 deep = false;252 // handle a deep copy situation253 if ( typeof target === "boolean" ) {254 deep = target;255 target = arguments[1] || {};256 // skip the boolean and the target257 i = 2;258 }259 // handle case when target is a string or something (possible in deep copy)260 if ( typeof target !== "object" && !jquery.isfunction(target) ) {261 target = {};262 }263 // extend jquery itself if only one argument is passed264 if ( length === i ) {265 target = this;266 --i;267 }268 for ( ; i < length; i++ ) {269 // only deal with non-null/undefined values270 if ( (options = arguments[ i ]) != null ) {271 // extend the base object272 for ( name in options ) {273 src = target[ name ];274 copy = options[ name ];275 // prevent never-ending loop276 if ( target === copy ) {277 continue;278 }279 // recurse if we're merging plain objects or arrays280 if ( deep && copy && ( jquery.isplainobject(copy) || (copyisarray = jquery.isarray(copy)) ) ) {281 if ( copyisarray ) {282 copyisarray = false;283 clone = src && jquery.isarray(src) ? src : [];284 } else {285 clone = src && jquery.isplainobject(src) ? src : {};286 }287 // never move original objects, clone them288 target[ name ] = jquery.extend( deep, clone, copy );289 // don't bring in undefined values290 } else if ( copy !== undefined ) {291 target[ name ] = copy;292 }293 }294 }295 }296 // return the modified object297 return target;298};299jquery.extend({300 noconflict: function( deep ) {301 window.$ = _$;302 if ( deep ) {303 window.jquery = _jquery;304 }305 return jquery;306 },307 // is the dom ready to be used? set to true once it occurs.308 isready: false,309 // a counter to track how many items to wait for before310 // the ready event fires. see #6781311 readywait: 1,312 // handle when the dom is ready313 ready: function( wait ) {314 // a third-party is pushing the ready event forwards315 if ( wait === true ) {316 jquery.readywait--;317 }318 // make sure that the dom is not already loaded319 if ( !jquery.readywait || (wait !== true && !jquery.isready) ) {320 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).321 if ( !document.body ) {322 return settimeout( jquery.ready, 1 );323 }324 // remember that the dom is ready325 jquery.isready = true;326 // if a normal dom ready event fired, decrement, and wait if need be327 if ( wait !== true && --jquery.readywait > 0 ) {328 return;329 }330 // if there are functions bound, to execute331 readylist.resolvewith( document, [ jquery ] );332 // trigger any bound ready events333 if ( jquery.fn.trigger ) {334 jquery( document ).trigger( "ready" ).unbind( "ready" );335 }336 }337 },338 bindready: function() {339 if ( readybound ) {340 return;341 }342 readybound = true;343 // catch cases where $(document).ready() is called after the344 // browser event has already occurred.345 if ( document.readystate === "complete" ) {346 // handle it asynchronously to allow scripts the opportunity to delay ready347 return settimeout( jquery.ready, 1 );348 }349 // mozilla, opera and webkit nightlies currently support this event350 if ( document.addeventlistener ) {351 // use the handy event callback352 document.addeventlistener( "domcontentloaded", domcontentloaded, false );353 // a fallback to window.onload, that will always work354 window.addeventlistener( "load", jquery.ready, false );355 // if ie event model is used356 } else if ( document.attachevent ) {357 // ensure firing before onload,358 // maybe late but safe also for iframes359 document.attachevent("onreadystatechange", domcontentloaded);360 // a fallback to window.onload, that will always work361 window.attachevent( "onload", jquery.ready );362 // if ie and not a frame363 // continually check to see if the document is ready364 var toplevel = false;365 try {366 toplevel = window.frameelement == null;367 } catch(e) {}368 if ( document.documentelement.doscroll && toplevel ) {369 doscrollcheck();370 }371 }372 },373 // see test/unit/core.js for details concerning isfunction.374 // since version 1.3, dom methods and functions like alert375 // aren't supported. they return false on ie (#2968).376 isfunction: function( obj ) {377 return jquery.type(obj) === "function";378 },379 isarray: array.isarray || function( obj ) {380 return jquery.type(obj) === "array";381 },382 // a crude way of determining if an object is a window383 iswindow: function( obj ) {384 return obj && typeof obj === "object" && "setinterval" in obj;385 },386 isnan: function( obj ) {387 return obj == null || !rdigit.test( obj ) || isnan( obj );388 },389 type: function( obj ) {390 return obj == null ?391 string( obj ) :392 class2type[ tostring.call(obj) ] || "object";393 },394 isplainobject: function( obj ) {395 // must be an object.396 // because of ie, we also have to check the presence of the constructor property.397 // make sure that dom nodes and window objects don't pass through, as well398 if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) {399 return false;400 }401 // not own constructor property must be object402 if ( obj.constructor &&403 !hasown.call(obj, "constructor") &&404 !hasown.call(obj.constructor.prototype, "isprototypeof") ) {405 return false;406 }407 // own properties are enumerated firstly, so to speed up,408 // if last one is own, then all properties are own.409 var key;410 for ( key in obj ) {}411 return key === undefined || hasown.call( obj, key );412 },413 isemptyobject: function( obj ) {414 for ( var name in obj ) {415 return false;416 }417 return true;418 },419 error: function( msg ) {420 throw msg;421 },422 parsejson: function( data ) {423 if ( typeof data !== "string" || !data ) {424 return null;425 }426 // make sure leading/trailing whitespace is removed (ie can't handle it)427 data = jquery.trim( data );428 // make sure the incoming data is actual json429 // logic borrowed from http://json.org/json2.js430 if ( rvalidchars.test(data.replace(rvalidescape, "@")431 .replace(rvalidtokens, "]")432 .replace(rvalidbraces, "")) ) {433 // try to use the native json parser first434 return window.json && window.json.parse ?435 window.json.parse( data ) :436 (new function("return " + data))();437 } else {438 jquery.error( "invalid json: " + data );439 }440 },441 // cross-browser xml parsing442 // (xml & tmp used internally)443 parsexml: function( data , xml , tmp ) {444 if ( window.domparser ) { // standard445 tmp = new domparser();446 xml = tmp.parsefromstring( data , "text/xml" );447 } else { // ie448 xml = new activexobject( "microsoft.xmldom" );449 xml.async = "false";450 xml.loadxml( data );451 }452 tmp = xml.documentelement;453 if ( ! tmp || ! tmp.nodename || tmp.nodename === "parsererror" ) {454 jquery.error( "invalid xml: " + data );455 }456 return xml;457 },458 noop: function() {},459 // evalulates a script in a global context460 globaleval: function( data ) {461 if ( data && rnotwhite.test(data) ) {462 // inspired by code by andrea giammarchi463 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html464 var head = document.head || document.getelementsbytagname( "head" )[0] || document.documentelement,465 script = document.createelement( "script" );466 if ( jquery.support.scripteval() ) {467 script.appendchild( document.createtextnode( data ) );468 } else {469 script.text = data;470 }471 // use insertbefore instead of appendchild to circumvent an ie6 bug.472 // this arises when a base node is used (#2709).473 head.insertbefore( script, head.firstchild );474 head.removechild( script );475 }476 },477 nodename: function( elem, name ) {478 return elem.nodename && elem.nodename.touppercase() === name.touppercase();479 },480 // args is for internal usage only481 each: function( object, callback, args ) {482 var name, i = 0,483 length = object.length,484 isobj = length === undefined || jquery.isfunction(object);485 if ( args ) {486 if ( isobj ) {487 for ( name in object ) {488 if ( callback.apply( object[ name ], args ) === false ) {489 break;490 }491 }492 } else {493 for ( ; i < length; ) {494 if ( callback.apply( object[ i++ ], args ) === false ) {495 break;496 }497 }498 }499 // a special, fast, case for the most common use of each500 } else {501 if ( isobj ) {502 for ( name in object ) {503 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {504 break;505 }506 }507 } else {508 for ( var value = object[0];509 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}510 }511 }512 return object;513 },514 // use native string.trim function wherever possible515 trim: trim ?516 function( text ) {517 return text == null ?518 "" :519 trim.call( text );520 } :521 // otherwise use our own trimming functionality522 function( text ) {523 return text == null ?524 "" :525 text.tostring().replace( trimleft, "" ).replace( trimright, "" );526 },527 // results is for internal usage only528 makearray: function( array, results ) {529 var ret = results || [];530 if ( array != null ) {531 // the window, strings (and functions) also have 'length'532 // the extra typeof function check is to prevent crashes533 // in safari 2 (see: #3039)534 // tweaked logic slightly to handle blackberry 4.7 regexp issues #6930535 var type = jquery.type(array);536 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jquery.iswindow( array ) ) {537 push.call( ret, array );538 } else {539 jquery.merge( ret, array );540 }541 }542 return ret;543 },544 inarray: function( elem, array ) {545 if ( array.indexof ) {546 return array.indexof( elem );547 }548 for ( var i = 0, length = array.length; i < length; i++ ) {549 if ( array[ i ] === elem ) {550 return i;551 }552 }553 return -1;554 },555 merge: function( first, second ) {556 var i = first.length,557 j = 0;558 if ( typeof second.length === "number" ) {559 for ( var l = second.length; j < l; j++ ) {560 first[ i++ ] = second[ j ];561 }562 } else {563 while ( second[j] !== undefined ) {564 first[ i++ ] = second[ j++ ];565 }566 }567 first.length = i;568 return first;569 },570 grep: function( elems, callback, inv ) {571 var ret = [], retval;572 inv = !!inv;573 // go through the array, only saving the items574 // that pass the validator function575 for ( var i = 0, length = elems.length; i < length; i++ ) {576 retval = !!callback( elems[ i ], i );577 if ( inv !== retval ) {578 ret.push( elems[ i ] );579 }580 }581 return ret;582 },583 // arg is for internal usage only584 map: function( elems, callback, arg ) {585 var ret = [], value;586 // go through the array, translating each of the items to their587 // new value (or values).588 for ( var i = 0, length = elems.length; i < length; i++ ) {589 value = callback( elems[ i ], i, arg );590 if ( value != null ) {591 ret[ ret.length ] = value;592 }593 }594 // flatten any nested arrays595 return ret.concat.apply( [], ret );596 },597 // a global guid counter for objects598 guid: 1,599 proxy: function( fn, proxy, thisobject ) {600 if ( arguments.length === 2 ) {601 if ( typeof proxy === "string" ) {602 thisobject = fn;603 fn = thisobject[ proxy ];604 proxy = undefined;605 } else if ( proxy && !jquery.isfunction( proxy ) ) {606 thisobject = proxy;607 proxy = undefined;608 }609 }610 if ( !proxy && fn ) {611 proxy = function() {612 return fn.apply( thisobject || this, arguments );613 };614 }615 // set the guid of unique handler to the same of original handler, so it can be removed616 if ( fn ) {617 proxy.guid = fn.guid = fn.guid || proxy.guid || jquery.guid++;618 }619 // so proxy can be declared as an argument620 return proxy;621 },622 // mutifunctional method to get and set values to a collection623 // the value/s can be optionally by executed if its a function624 access: function( elems, key, value, exec, fn, pass ) {625 var length = elems.length;626 // setting many attributes627 if ( typeof key === "object" ) {628 for ( var k in key ) {629 jquery.access( elems, k, key[k], exec, fn, value );630 }631 return elems;632 }633 // setting one attribute634 if ( value !== undefined ) {635 // optionally, function values get executed if exec is true636 exec = !pass && exec && jquery.isfunction(value);637 for ( var i = 0; i < length; i++ ) {638 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );639 }640 return elems;641 }642 // getting an attribute643 return length ? fn( elems[0], key ) : undefined;644 },645 now: function() {646 return (new date()).gettime();647 },648 // create a simple deferred (one callbacks list)649 _deferred: function() {650 var // callbacks list651 callbacks = [],652 // stored [ context , args ]653 fired,654 // to avoid firing when already doing so655 firing,656 // flag to know if the deferred has been cancelled657 cancelled,658 // the deferred itself659 deferred = {660 // done( f1, f2, ...)661 done: function() {662 if ( !cancelled ) {663 var args = arguments,664 i,665 length,666 elem,667 type,668 _fired;669 if ( fired ) {670 _fired = fired;671 fired = 0;672 }673 for ( i = 0, length = args.length; i < length; i++ ) {674 elem = args[ i ];675 type = jquery.type( elem );676 if ( type === "array" ) {677 deferred.done.apply( deferred, elem );678 } else if ( type === "function" ) {679 callbacks.push( elem );680 }681 }682 if ( _fired ) {683 deferred.resolvewith( _fired[ 0 ], _fired[ 1 ] );684 }685 }686 return this;687 },688 // resolve with given context and args689 resolvewith: function( context, args ) {690 if ( !cancelled && !fired && !firing ) {691 firing = 1;692 try {693 while( callbacks[ 0 ] ) {694 callbacks.shift().apply( context, args );695 }696 }697 // we have to add a catch block for698 // ie prior to 8 or else the finally699 // block will never get executed700 catch (e) {701 throw e;702 }703 finally {704 fired = [ context, args ];705 firing = 0;706 }707 }708 return this;709 },710 // resolve with this as context and given arguments711 resolve: function() {712 deferred.resolvewith( jquery.isfunction( this.promise ) ? this.promise() : this, arguments );713 return this;714 },715 // has this deferred been resolved?716 isresolved: function() {717 return !!( firing || fired );718 },719 // cancel720 cancel: function() {721 cancelled = 1;722 callbacks = [];723 return this;724 }725 };726 return deferred;727 },728 // full fledged deferred (two callbacks list)729 deferred: function( func ) {730 var deferred = jquery._deferred(),731 faildeferred = jquery._deferred(),732 promise;733 // add errordeferred methods, then and promise734 jquery.extend( deferred, {735 then: function( donecallbacks, failcallbacks ) {736 deferred.done( donecallbacks ).fail( failcallbacks );737 return this;738 },739 fail: faildeferred.done,740 rejectwith: faildeferred.resolvewith,741 reject: faildeferred.resolve,742 isrejected: faildeferred.isresolved,743 // get a promise for this deferred744 // if obj is provided, the promise aspect is added to the object745 promise: function( obj ) {746 if ( obj == null ) {747 if ( promise ) {748 return promise;749 }750 promise = obj = {};751 }752 var i = promisemethods.length;753 while( i-- ) {754 obj[ promisemethods[i] ] = deferred[ promisemethods[i] ];755 }756 return obj;757 }758 } );759 // make sure only one callback list will be used760 deferred.done( faildeferred.cancel ).fail( deferred.cancel );761 // unexpose cancel762 delete deferred.cancel;763 // call given func if any764 if ( func ) {765 func.call( deferred, deferred );766 }767 return deferred;768 },769 // deferred helper770 when: function( object ) {771 var lastindex = arguments.length,772 deferred = lastindex <= 1 && object && jquery.isfunction( object.promise ) ?773 object :774 jquery.deferred(),775 promise = deferred.promise();776 if ( lastindex > 1 ) {777 var array = slice.call( arguments, 0 ),778 count = lastindex,779 icallback = function( index ) {780 return function( value ) {781 array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;782 if ( !( --count ) ) {783 deferred.resolvewith( promise, array );784 }785 };786 };787 while( ( lastindex-- ) ) {788 object = array[ lastindex ];789 if ( object && jquery.isfunction( object.promise ) ) {790 object.promise().then( icallback(lastindex), deferred.reject );791 } else {792 --count;793 }794 }795 if ( !count ) {796 deferred.resolvewith( promise, array );797 }798 } else if ( deferred !== object ) {799 deferred.resolve( object );800 }801 return promise;802 },803 // use of jquery.browser is frowned upon.804 // more details: http://docs.jquery.com/utilities/jquery.browser805 uamatch: function( ua ) {806 ua = ua.tolowercase();807 var match = rwebkit.exec( ua ) ||808 ropera.exec( ua ) ||809 rmsie.exec( ua ) ||810 ua.indexof("compatible") < 0 && rmozilla.exec( ua ) ||811 [];812 return { browser: match[1] || "", version: match[2] || "0" };813 },814 sub: function() {815 function jquerysubclass( selector, context ) {816 return new jquerysubclass.fn.init( selector, context );817 }818 jquery.extend( true, jquerysubclass, this );819 jquerysubclass.superclass = this;820 jquerysubclass.fn = jquerysubclass.prototype = this();821 jquerysubclass.fn.constructor = jquerysubclass;822 jquerysubclass.subclass = this.subclass;823 jquerysubclass.fn.init = function init( selector, context ) {824 if ( context && context instanceof jquery && !(context instanceof jquerysubclass) ) {825 context = jquerysubclass(context);826 }827 return jquery.fn.init.call( this, selector, context, rootjquerysubclass );828 };829 jquerysubclass.fn.init.prototype = jquerysubclass.fn;830 var rootjquerysubclass = jquerysubclass(document);831 return jquerysubclass;832 },833 browser: {}834});835// create readylist deferred836readylist = jquery._deferred();837// populate the class2type map838jquery.each("boolean number string function array date regexp object".split(" "), function(i, name) {839 class2type[ "[object " + name + "]" ] = name.tolowercase();840});841browsermatch = jquery.uamatch( useragent );842if ( browsermatch.browser ) {843 jquery.browser[ browsermatch.browser ] = true;844 jquery.browser.version = browsermatch.version;845}846// deprecated, use jquery.browser.webkit instead847if ( jquery.browser.webkit ) {848 jquery.browser.safari = true;849}850if ( indexof ) {851 jquery.inarray = function( elem, array ) {852 return indexof.call( array, elem );853 };854}855// ie doesn't match non-breaking spaces with \s856if ( rnotwhite.test( "\xa0" ) ) {857 trimleft = /^[\s\xa0]+/;858 trimright = /[\s\xa0]+$/;859}860// all jquery objects should point back to these861rootjquery = jquery(document);862// cleanup functions for the document ready method863if ( document.addeventlistener ) {864 domcontentloaded = function() {865 document.removeeventlistener( "domcontentloaded", domcontentloaded, false );866 jquery.ready();867 };868} else if ( document.attachevent ) {869 domcontentloaded = function() {870 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).871 if ( document.readystate === "complete" ) {872 document.detachevent( "onreadystatechange", domcontentloaded );873 jquery.ready();874 }875 };876}877// the dom ready check for internet explorer878function doscrollcheck() {879 if ( jquery.isready ) {880 return;881 }882 try {883 // if ie is used, use the trick by diego perini884 // http://javascript.nwbox.com/iecontentloaded/885 document.documentelement.doscroll("left");886 } catch(e) {887 settimeout( doscrollcheck, 1 );888 return;889 }890 // and execute any waiting functions891 jquery.ready();892}893// expose jquery to the global object894return jquery;895})();896(function() {897 jquery.support = {};898 var div = document.createelement("div");899 div.style.display = "none";900 div.innerhtml = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";901 var all = div.getelementsbytagname("*"),902 a = div.getelementsbytagname("a")[0],903 select = document.createelement("select"),904 opt = select.appendchild( document.createelement("option") ),905 input = div.getelementsbytagname("input")[0];906 // can't get basic test support907 if ( !all || !all.length || !a ) {908 return;909 }910 jquery.support = {911 // ie strips leading whitespace when .innerhtml is used912 leadingwhitespace: div.firstchild.nodetype === 3,913 // make sure that tbody elements aren't automatically inserted914 // ie will insert them into empty tables915 tbody: !div.getelementsbytagname("tbody").length,916 // make sure that link elements get serialized correctly by innerhtml917 // this requires a wrapper element in ie918 htmlserialize: !!div.getelementsbytagname("link").length,919 // get the style information from getattribute920 // (ie uses .csstext insted)921 style: /red/.test( a.getattribute("style") ),922 // make sure that urls aren't manipulated923 // (ie normalizes it by default)924 hrefnormalized: a.getattribute("href") === "/a",925 // make sure that element opacity exists926 // (ie uses filter instead)927 // use a regex to work around a webkit issue. see #5145928 opacity: /^0.55$/.test( a.style.opacity ),929 // verify style float existence930 // (ie uses stylefloat instead of cssfloat)931 cssfloat: !!a.style.cssfloat,932 // make sure that if no value is specified for a checkbox933 // that it defaults to "on".934 // (webkit defaults to "" instead)935 checkon: input.value === "on",936 // make sure that a selected-by-default option has a working selected property.937 // (webkit defaults to false instead of true, ie too, if it's in an optgroup)938 optselected: opt.selected,939 // will be defined later940 deleteexpando: true,941 optdisabled: false,942 checkclone: false,943 nocloneevent: true,944 noclonechecked: true,945 boxmodel: null,946 inlineblockneedslayout: false,947 shrinkwrapblocks: false,948 reliablehiddenoffsets: true949 };950 input.checked = true;951 jquery.support.noclonechecked = input.clonenode( true ).checked;952 // make sure that the options inside disabled selects aren't marked as disabled953 // (webkit marks them as diabled)954 select.disabled = true;955 jquery.support.optdisabled = !opt.disabled;956 var _scripteval = null;957 jquery.support.scripteval = function() {958 if ( _scripteval === null ) {959 var root = document.documentelement,960 script = document.createelement("script"),961 id = "script" + jquery.now();962 try {963 script.appendchild( document.createtextnode( "window." + id + "=1;" ) );964 } catch(e) {}965 root.insertbefore( script, root.firstchild );966 // make sure that the execution of code works by injecting a script967 // tag with appendchild/createtextnode968 // (ie doesn't support this, fails, and uses .text instead)969 if ( window[ id ] ) {970 _scripteval = true;971 delete window[ id ];972 } else {973 _scripteval = false;974 }975 root.removechild( script );976 // release memory in ie977 root = script = id = null;978 }979 return _scripteval;980 };981 // test to see if it's possible to delete an expando from an element982 // fails in internet explorer983 try {984 delete div.test;985 } catch(e) {986 jquery.support.deleteexpando = false;987 }988 if ( !div.addeventlistener && div.attachevent && div.fireevent ) {989 div.attachevent("onclick", function click() {990 // cloning a node shouldn't copy over any991 // bound event handlers (ie does this)992 jquery.support.nocloneevent = false;993 div.detachevent("onclick", click);994 });995 div.clonenode(true).fireevent("onclick");996 }997 div = document.createelement("div");998 div.innerhtml = "<input type='radio' name='radiotest' checked='checked'/>";999 var fragment = document.createdocumentfragment();1000 fragment.appendchild( div.firstchild );1001 // webkit doesn't clone checked state correctly in fragments1002 jquery.support.checkclone = fragment.clonenode(true).clonenode(true).lastchild.checked;1003 // figure out if the w3c box model works as expected1004 // document.body must exist before we can do this1005 jquery(function() {1006 var div = document.createelement("div"),1007 body = document.getelementsbytagname("body")[0];1008 // frameset documents with no body should not run this code1009 if ( !body ) {1010 return;1011 }1012 div.style.width = div.style.paddingleft = "1px";1013 body.appendchild( div );1014 jquery.boxmodel = jquery.support.boxmodel = div.offsetwidth === 2;1015 if ( "zoom" in div.style ) {1016 // check if natively block-level elements act like inline-block1017 // elements when setting their display to 'inline' and giving1018 // them layout1019 // (ie < 8 does this)1020 div.style.display = "inline";1021 div.style.zoom = 1;1022 jquery.support.inlineblockneedslayout = div.offsetwidth === 2;1023 // check if elements with layout shrink-wrap their children1024 // (ie 6 does this)1025 div.style.display = "";1026 div.innerhtml = "<div style='width:4px;'></div>";1027 jquery.support.shrinkwrapblocks = div.offsetwidth !== 2;1028 }1029 div.innerhtml = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";1030 var tds = div.getelementsbytagname("td");1031 // check if table cells still have offsetwidth/height when they are set1032 // to display:none and there are still other visible table cells in a1033 // table row; if so, offsetwidth/height are not reliable for use when1034 // determining if an element has been hidden directly using1035 // display:none (it is still safe to use offsets if a parent element is1036 // hidden; don safety goggles and see bug #4512 for more information).1037 // (only ie 8 fails this test)1038 jquery.support.reliablehiddenoffsets = tds[0].offsetheight === 0;1039 tds[0].style.display = "";1040 tds[1].style.display = "none";1041 // check if empty table cells still have offsetwidth/height1042 // (ie < 8 fail this test)1043 jquery.support.reliablehiddenoffsets = jquery.support.reliablehiddenoffsets && tds[0].offsetheight === 0;1044 div.innerhtml = "";1045 body.removechild( div ).style.display = "none";1046 div = tds = null;1047 });1048 // technique from juriy zaytsev1049 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/1050 var eventsupported = function( eventname ) {1051 var el = document.createelement("div");1052 eventname = "on" + eventname;1053 // we only care about the case where non-standard event systems1054 // are used, namely in ie. short-circuiting here helps us to1055 // avoid an eval call (in setattribute) which can cause csp1056 // to go haywire. see: https://developer.mozilla.org/en/security/csp1057 if ( !el.attachevent ) {1058 return true;1059 }1060 var issupported = (eventname in el);1061 if ( !issupported ) {1062 el.setattribute(eventname, "return;");1063 issupported = typeof el[eventname] === "function";1064 }1065 el = null;1066 return issupported;1067 };1068 jquery.support.submitbubbles = eventsupported("submit");1069 jquery.support.changebubbles = eventsupported("change");1070 // release memory in ie1071 div = all = a = null;1072})();1073var rbrace = /^(?:\{.*\}|\[.*\])$/;1074jquery.extend({1075 cache: {},1076 // please use with caution1077 uuid: 0,1078 // unique for each copy of jquery on the page1079 // non-digits removed to match rinlinejquery1080 expando: "jquery" + ( jquery.fn.jquery + math.random() ).replace( /\d/g, "" ),1081 // the following elements throw uncatchable exceptions if you1082 // attempt to add expando properties to them.1083 nodata: {1084 "embed": true,1085 // ban all objects except for flash (which handle expandos)1086 "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",1087 "applet": true1088 },1089 hasdata: function( elem ) {1090 elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];1091 return !!elem && !isemptydataobject( elem );1092 },1093 data: function( elem, name, data, pvt /* internal use only */ ) {1094 if ( !jquery.acceptdata( elem ) ) {1095 return;1096 }1097 var internalkey = jquery.expando, getbyname = typeof name === "string", thiscache,1098 // we have to handle dom nodes and js objects differently because ie6-71099 // can't gc object references properly across the dom-js boundary1100 isnode = elem.nodetype,1101 // only dom nodes need the global jquery cache; js object data is1102 // attached directly to the object so gc can occur automatically1103 cache = isnode ? jquery.cache : elem,1104 // only defining an id for js objects if its cache already exists allows1105 // the code to shortcut on the same path as a dom node with no cache1106 id = isnode ? elem[ jquery.expando ] : elem[ jquery.expando ] && jquery.expando;1107 // avoid doing any more work than we need to when trying to get data on an1108 // object that has no data at all1109 if ( (!id || (pvt && id && !cache[ id ][ internalkey ])) && getbyname && data === undefined ) {1110 return;1111 }1112 if ( !id ) {1113 // only dom nodes need a new unique id for each element since their data1114 // ends up in the global cache1115 if ( isnode ) {1116 elem[ jquery.expando ] = id = ++jquery.uuid;1117 } else {1118 id = jquery.expando;1119 }1120 }1121 if ( !cache[ id ] ) {1122 cache[ id ] = {};1123 // todo: this is a hack for 1.5 only. avoids exposing jquery1124 // metadata on plain js objects when the object is serialized using1125 // json.stringify1126 if ( !isnode ) {1127 cache[ id ].tojson = jquery.noop;1128 }1129 }1130 // an object can be passed to jquery.data instead of a key/value pair; this gets1131 // shallow copied over onto the existing cache1132 if ( typeof name === "object" || typeof name === "function" ) {1133 if ( pvt ) {1134 cache[ id ][ internalkey ] = jquery.extend(cache[ id ][ internalkey ], name);1135 } else {1136 cache[ id ] = jquery.extend(cache[ id ], name);1137 }1138 }1139 thiscache = cache[ id ];1140 // internal jquery data is stored in a separate object inside the object's data1141 // cache in order to avoid key collisions between internal data and user-defined1142 // data1143 if ( pvt ) {1144 if ( !thiscache[ internalkey ] ) {1145 thiscache[ internalkey ] = {};1146 }1147 thiscache = thiscache[ internalkey ];1148 }1149 if ( data !== undefined ) {1150 thiscache[ name ] = data;1151 }1152 // todo: this is a hack for 1.5 only. it will be removed in 1.6. users should1153 // not attempt to inspect the internal events object using jquery.data, as this1154 // internal data object is undocumented and subject to change.1155 if ( name === "events" && !thiscache[name] ) {1156 return thiscache[ internalkey ] && thiscache[ internalkey ].events;1157 }1158 return getbyname ? thiscache[ name ] : thiscache;1159 },1160 removedata: function( elem, name, pvt /* internal use only */ ) {1161 if ( !jquery.acceptdata( elem ) ) {1162 return;1163 }1164 var internalkey = jquery.expando, isnode = elem.nodetype,1165 // see jquery.data for more information1166 cache = isnode ? jquery.cache : elem,1167 // see jquery.data for more information1168 id = isnode ? elem[ jquery.expando ] : jquery.expando;1169 // if there is already no cache entry for this object, there is no1170 // purpose in continuing1171 if ( !cache[ id ] ) {1172 return;1173 }1174 if ( name ) {1175 var thiscache = pvt ? cache[ id ][ internalkey ] : cache[ id ];1176 if ( thiscache ) {1177 delete thiscache[ name ];1178 // if there is no data left in the cache, we want to continue1179 // and let the cache object itself get destroyed1180 if ( !isemptydataobject(thiscache) ) {1181 return;1182 }1183 }1184 }1185 // see jquery.data for more information1186 if ( pvt ) {1187 delete cache[ id ][ internalkey ];1188 // don't destroy the parent cache unless the internal data object1189 // had been the only thing left in it1190 if ( !isemptydataobject(cache[ id ]) ) {1191 return;1192 }1193 }1194 var internalcache = cache[ id ][ internalkey ];1195 // browsers that fail expando deletion also refuse to delete expandos on1196 // the window, but it will allow it on all other js objects; other browsers1197 // don't care1198 if ( jquery.support.deleteexpando || cache != window ) {1199 delete cache[ id ];1200 } else {1201 cache[ id ] = null;1202 }1203 // we destroyed the entire user cache at once because it's faster than1204 // iterating through each key, but we need to continue to persist internal1205 // data if it existed1206 if ( internalcache ) {1207 cache[ id ] = {};1208 // todo: this is a hack for 1.5 only. avoids exposing jquery1209 // metadata on plain js objects when the object is serialized using1210 // json.stringify1211 if ( !isnode ) {1212 cache[ id ].tojson = jquery.noop;1213 }1214 cache[ id ][ internalkey ] = internalcache;1215 // otherwise, we need to eliminate the expando on the node to avoid1216 // false lookups in the cache for entries that no longer exist1217 } else if ( isnode ) {1218 // ie does not allow us to delete expando properties from nodes,1219 // nor does it have a removeattribute function on document nodes;1220 // we must handle all of these cases1221 if ( jquery.support.deleteexpando ) {1222 delete elem[ jquery.expando ];1223 } else if ( elem.removeattribute ) {1224 elem.removeattribute( jquery.expando );1225 } else {1226 elem[ jquery.expando ] = null;1227 }1228 }1229 },1230 // for internal use only.1231 _data: function( elem, name, data ) {1232 return jquery.data( elem, name, data, true );1233 },1234 // a method for determining if a dom node can handle the data expando1235 acceptdata: function( elem ) {1236 if ( elem.nodename ) {1237 var match = jquery.nodata[ elem.nodename.tolowercase() ];1238 if ( match ) {1239 return !(match === true || elem.getattribute("classid") !== match);1240 }1241 }1242 return true;1243 }1244});1245jquery.fn.extend({1246 data: function( key, value ) {1247 var data = null;1248 if ( typeof key === "undefined" ) {1249 if ( this.length ) {1250 data = jquery.data( this[0] );1251 if ( this[0].nodetype === 1 ) {1252 var attr = this[0].attributes, name;1253 for ( var i = 0, l = attr.length; i < l; i++ ) {1254 name = attr[i].name;1255 if ( name.indexof( "data-" ) === 0 ) {1256 name = name.substr( 5 );1257 dataattr( this[0], name, data[ name ] );1258 }1259 }1260 }1261 }1262 return data;1263 } else if ( typeof key === "object" ) {1264 return this.each(function() {1265 jquery.data( this, key );1266 });1267 }1268 var parts = key.split(".");1269 parts[1] = parts[1] ? "." + parts[1] : "";1270 if ( value === undefined ) {1271 data = this.triggerhandler("getdata" + parts[1] + "!", [parts[0]]);1272 // try to fetch any internally stored data first1273 if ( data === undefined && this.length ) {1274 data = jquery.data( this[0], key );1275 data = dataattr( this[0], key, data );1276 }1277 return data === undefined && parts[1] ?1278 this.data( parts[0] ) :1279 data;1280 } else {1281 return this.each(function() {1282 var $this = jquery( this ),1283 args = [ parts[0], value ];1284 $this.triggerhandler( "setdata" + parts[1] + "!", args );1285 jquery.data( this, key, value );1286 $this.triggerhandler( "changedata" + parts[1] + "!", args );1287 });1288 }1289 },1290 removedata: function( key ) {1291 return this.each(function() {1292 jquery.removedata( this, key );1293 });1294 }1295});1296function dataattr( elem, key, data ) {1297 // if nothing was found internally, try to fetch any1298 // data from the html5 data-* attribute1299 if ( data === undefined && elem.nodetype === 1 ) {1300 data = elem.getattribute( "data-" + key );1301 if ( typeof data === "string" ) {1302 try {1303 data = data === "true" ? true :1304 data === "false" ? false :1305 data === "null" ? null :1306 !jquery.isnan( data ) ? parsefloat( data ) :1307 rbrace.test( data ) ? jquery.parsejson( data ) :1308 data;1309 } catch( e ) {}1310 // make sure we set the data so it isn't changed later1311 jquery.data( elem, key, data );1312 } else {1313 data = undefined;1314 }1315 }1316 return data;1317}1318// todo: this is a hack for 1.5 only to allow objects with a single tojson1319// property to be considered empty objects; this property always exists in1320// order to make sure json.stringify does not expose internal metadata1321function isemptydataobject( obj ) {1322 for ( var name in obj ) {1323 if ( name !== "tojson" ) {1324 return false;1325 }1326 }1327 return true;1328}1329jquery.extend({1330 queue: function( elem, type, data ) {1331 if ( !elem ) {1332 return;1333 }1334 type = (type || "fx") + "queue";1335 var q = jquery._data( elem, type );1336 // speed up dequeue by getting out quickly if this is just a lookup1337 if ( !data ) {1338 return q || [];1339 }1340 if ( !q || jquery.isarray(data) ) {1341 q = jquery._data( elem, type, jquery.makearray(data) );1342 } else {1343 q.push( data );1344 }1345 return q;1346 },1347 dequeue: function( elem, type ) {1348 type = type || "fx";1349 var queue = jquery.queue( elem, type ),1350 fn = queue.shift();1351 // if the fx queue is dequeued, always remove the progress sentinel1352 if ( fn === "inprogress" ) {1353 fn = queue.shift();1354 }1355 if ( fn ) {1356 // add a progress sentinel to prevent the fx queue from being1357 // automatically dequeued1358 if ( type === "fx" ) {1359 queue.unshift("inprogress");1360 }1361 fn.call(elem, function() {1362 jquery.dequeue(elem, type);1363 });1364 }1365 if ( !queue.length ) {1366 jquery.removedata( elem, type + "queue", true );1367 }1368 }1369});1370jquery.fn.extend({1371 queue: function( type, data ) {1372 if ( typeof type !== "string" ) {1373 data = type;1374 type = "fx";1375 }1376 if ( data === undefined ) {1377 return jquery.queue( this[0], type );1378 }1379 return this.each(function( i ) {1380 var queue = jquery.queue( this, type, data );1381 if ( type === "fx" && queue[0] !== "inprogress" ) {1382 jquery.dequeue( this, type );1383 }1384 });1385 },1386 dequeue: function( type ) {1387 return this.each(function() {1388 jquery.dequeue( this, type );1389 });1390 },1391 // based off of the plugin by clint helfers, with permission.1392 // http://blindsignals.com/index.php/2009/07/jquery-delay/1393 delay: function( time, type ) {1394 time = jquery.fx ? jquery.fx.speeds[time] || time : time;1395 type = type || "fx";1396 return this.queue( type, function() {1397 var elem = this;1398 settimeout(function() {1399 jquery.dequeue( elem, type );1400 }, time );1401 });1402 },1403 clearqueue: function( type ) {1404 return this.queue( type || "fx", [] );1405 }1406});1407var rclass = /[\n\t\r]/g,1408 rspaces = /\s+/,1409 rreturn = /\r/g,1410 rspecialurl = /^(?:href|src|style)$/,1411 rtype = /^(?:button|input)$/i,1412 rfocusable = /^(?:button|input|object|select|textarea)$/i,1413 rclickable = /^a(?:rea)?$/i,1414 rradiocheck = /^(?:radio|checkbox)$/i;1415jquery.props = {1416 "for": "htmlfor",1417 "class": "classname",1418 readonly: "readonly",1419 maxlength: "maxlength",1420 cellspacing: "cellspacing",1421 rowspan: "rowspan",1422 colspan: "colspan",1423 tabindex: "tabindex",1424 usemap: "usemap",1425 frameborder: "frameborder"1426};1427jquery.fn.extend({1428 attr: function( name, value ) {1429 return jquery.access( this, name, value, true, jquery.attr );1430 },1431 removeattr: function( name, fn ) {1432 return this.each(function(){1433 jquery.attr( this, name, "" );1434 if ( this.nodetype === 1 ) {1435 this.removeattribute( name );1436 }1437 });1438 },1439 addclass: function( value ) {1440 if ( jquery.isfunction(value) ) {1441 return this.each(function(i) {1442 var self = jquery(this);1443 self.addclass( value.call(this, i, self.attr("class")) );1444 });1445 }1446 if ( value && typeof value === "string" ) {1447 var classnames = (value || "").split( rspaces );1448 for ( var i = 0, l = this.length; i < l; i++ ) {1449 var elem = this[i];1450 if ( elem.nodetype === 1 ) {1451 if ( !elem.classname ) {1452 elem.classname = value;1453 } else {1454 var classname = " " + elem.classname + " ",1455 setclass = elem.classname;1456 for ( var c = 0, cl = classnames.length; c < cl; c++ ) {1457 if ( classname.indexof( " " + classnames[c] + " " ) < 0 ) {1458 setclass += " " + classnames[c];1459 }1460 }1461 elem.classname = jquery.trim( setclass );1462 }1463 }1464 }1465 }1466 return this;1467 },1468 removeclass: function( value ) {1469 if ( jquery.isfunction(value) ) {1470 return this.each(function(i) {1471 var self = jquery(this);1472 self.removeclass( value.call(this, i, self.attr("class")) );1473 });1474 }1475 if ( (value && typeof value === "string") || value === undefined ) {1476 var classnames = (value || "").split( rspaces );1477 for ( var i = 0, l = this.length; i < l; i++ ) {1478 var elem = this[i];1479 if ( elem.nodetype === 1 && elem.classname ) {1480 if ( value ) {1481 var classname = (" " + elem.classname + " ").replace(rclass, " ");1482 for ( var c = 0, cl = classnames.length; c < cl; c++ ) {1483 classname = classname.replace(" " + classnames[c] + " ", " ");1484 }1485 elem.classname = jquery.trim( classname );1486 } else {1487 elem.classname = "";1488 }1489 }1490 }1491 }1492 return this;1493 },1494 toggleclass: function( value, stateval ) {1495 var type = typeof value,1496 isbool = typeof stateval === "boolean";1497 if ( jquery.isfunction( value ) ) {1498 return this.each(function(i) {1499 var self = jquery(this);1500 self.toggleclass( value.call(this, i, self.attr("class"), stateval), stateval );1501 });1502 }1503 return this.each(function() {1504 if ( type === "string" ) {1505 // toggle individual class names1506 var classname,1507 i = 0,1508 self = jquery( this ),1509 state = stateval,1510 classnames = value.split( rspaces );1511 while ( (classname = classnames[ i++ ]) ) {1512 // check each classname given, space seperated list1513 state = isbool ? state : !self.hasclass( classname );1514 self[ state ? "addclass" : "removeclass" ]( classname );1515 }1516 } else if ( type === "undefined" || type === "boolean" ) {1517 if ( this.classname ) {1518 // store classname if set1519 jquery._data( this, "__classname__", this.classname );1520 }1521 // toggle whole classname1522 this.classname = this.classname || value === false ? "" : jquery._data( this, "__classname__" ) || "";1523 }1524 });1525 },1526 hasclass: function( selector ) {1527 var classname = " " + selector + " ";1528 for ( var i = 0, l = this.length; i < l; i++ ) {1529 if ( (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) > -1 ) {1530 return true;1531 }1532 }1533 return false;1534 },1535 val: function( value ) {1536 if ( !arguments.length ) {1537 var elem = this[0];1538 if ( elem ) {1539 if ( jquery.nodename( elem, "option" ) ) {1540 // attributes.value is undefined in blackberry 4.7 but1541 // uses .value. see #69321542 var val = elem.attributes.value;1543 return !val || val.specified ? elem.value : elem.text;1544 }1545 // we need to handle select boxes special1546 if ( jquery.nodename( elem, "select" ) ) {1547 var index = elem.selectedindex,1548 values = [],1549 options = elem.options,1550 one = elem.type === "select-one";1551 // nothing was selected1552 if ( index < 0 ) {1553 return null;1554 }1555 // loop through all the selected options1556 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {1557 var option = options[ i ];1558 // don't return options that are disabled or in a disabled optgroup1559 if ( option.selected && (jquery.support.optdisabled ? !option.disabled : option.getattribute("disabled") === null) &&1560 (!option.parentnode.disabled || !jquery.nodename( option.parentnode, "optgroup" )) ) {1561 // get the specific value for the option1562 value = jquery(option).val();1563 // we don't need an array for one selects1564 if ( one ) {1565 return value;1566 }1567 // multi-selects return an array1568 values.push( value );1569 }1570 }1571 // fixes bug #2551 -- select.val() broken in ie after form.reset()1572 if ( one && !values.length && options.length ) {1573 return jquery( options[ index ] ).val();1574 }1575 return values;1576 }1577 // handle the case where in webkit "" is returned instead of "on" if a value isn't specified1578 if ( rradiocheck.test( elem.type ) && !jquery.support.checkon ) {1579 return elem.getattribute("value") === null ? "on" : elem.value;1580 }1581 // everything else, we just grab the value1582 return (elem.value || "").replace(rreturn, "");1583 }1584 return undefined;1585 }1586 var isfunction = jquery.isfunction(value);1587 return this.each(function(i) {1588 var self = jquery(this), val = value;1589 if ( this.nodetype !== 1 ) {1590 return;1591 }1592 if ( isfunction ) {1593 val = value.call(this, i, self.val());1594 }1595 // treat null/undefined as ""; convert numbers to string1596 if ( val == null ) {1597 val = "";1598 } else if ( typeof val === "number" ) {1599 val += "";1600 } else if ( jquery.isarray(val) ) {1601 val = jquery.map(val, function (value) {1602 return value == null ? "" : value + "";1603 });1604 }1605 if ( jquery.isarray(val) && rradiocheck.test( this.type ) ) {1606 this.checked = jquery.inarray( self.val(), val ) >= 0;1607 } else if ( jquery.nodename( this, "select" ) ) {1608 var values = jquery.makearray(val);1609 jquery( "option", this ).each(function() {1610 this.selected = jquery.inarray( jquery(this).val(), values ) >= 0;1611 });1612 if ( !values.length ) {1613 this.selectedindex = -1;1614 }1615 } else {1616 this.value = val;1617 }1618 });1619 }1620});1621jquery.extend({1622 attrfn: {1623 val: true,1624 css: true,1625 html: true,1626 text: true,1627 data: true,1628 width: true,1629 height: true,1630 offset: true1631 },1632 attr: function( elem, name, value, pass ) {1633 // don't get/set attributes on text, comment and attribute nodes1634 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || elem.nodetype === 2 ) {1635 return undefined;1636 }1637 if ( pass && name in jquery.attrfn ) {1638 return jquery(elem)[name](value);1639 }1640 var notxml = elem.nodetype !== 1 || !jquery.isxmldoc( elem ),1641 // whether we are setting (or getting)1642 set = value !== undefined;1643 // try to normalize/fix the name1644 name = notxml && jquery.props[ name ] || name;1645 // only do all the following if this is a node (faster for style)1646 if ( elem.nodetype === 1 ) {1647 // these attributes require special treatment1648 var special = rspecialurl.test( name );1649 // safari mis-reports the default selected property of an option1650 // accessing the parent's selectedindex property fixes it1651 if ( name === "selected" && !jquery.support.optselected ) {1652 var parent = elem.parentnode;1653 if ( parent ) {1654 parent.selectedindex;1655 // make sure that it also works with optgroups, see #57011656 if ( parent.parentnode ) {1657 parent.parentnode.selectedindex;1658 }1659 }1660 }1661 // if applicable, access the attribute via the dom 0 way1662 // 'in' checks fail in blackberry 4.7 #69311663 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {1664 if ( set ) {1665 // we can't allow the type property to be changed (since it causes problems in ie)1666 if ( name === "type" && rtype.test( elem.nodename ) && elem.parentnode ) {1667 jquery.error( "type property can't be changed" );1668 }1669 if ( value === null ) {1670 if ( elem.nodetype === 1 ) {1671 elem.removeattribute( name );1672 }1673 } else {1674 elem[ name ] = value;1675 }1676 }1677 // browsers index elements by id/name on forms, give priority to attributes.1678 if ( jquery.nodename( elem, "form" ) && elem.getattributenode(name) ) {1679 return elem.getattributenode( name ).nodevalue;1680 }1681 // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set1682 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/1683 if ( name === "tabindex" ) {1684 var attributenode = elem.getattributenode( "tabindex" );1685 return attributenode && attributenode.specified ?1686 attributenode.value :1687 rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ?1688 0 :1689 undefined;1690 }1691 return elem[ name ];1692 }1693 if ( !jquery.support.style && notxml && name === "style" ) {1694 if ( set ) {1695 elem.style.csstext = "" + value;1696 }1697 return elem.style.csstext;1698 }1699 if ( set ) {1700 // convert the value to a string (all browsers do this but ie) see #10701701 elem.setattribute( name, "" + value );1702 }1703 // ensure that missing attributes return undefined1704 // blackberry 4.7 returns "" from getattribute #69381705 if ( !elem.attributes[ name ] && (elem.hasattribute && !elem.hasattribute( name )) ) {1706 return undefined;1707 }1708 var attr = !jquery.support.hrefnormalized && notxml && special ?1709 // some attributes require a special call on ie1710 elem.getattribute( name, 2 ) :1711 elem.getattribute( name );1712 // non-existent attributes return null, we normalize to undefined1713 return attr === null ? undefined : attr;1714 }1715 // handle everything which isn't a dom element node1716 if ( set ) {1717 elem[ name ] = value;1718 }1719 return elem[ name ];1720 }1721});1722var rnamespaces = /\.(.*)$/,1723 rformelems = /^(?:textarea|input|select)$/i,1724 rperiod = /\./g,1725 rspace = / /g,1726 rescape = /[^\w\s.|`]/g,1727 fcleanup = function( nm ) {1728 return nm.replace(rescape, "\\$&");1729 };1730/*1731 * a number of helper functions used for managing events.1732 * many of the ideas behind this code originated from1733 * dean edwards' addevent library.1734 */1735jquery.event = {1736 // bind an event to an element1737 // original by dean edwards1738 add: function( elem, types, handler, data ) {1739 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {1740 return;1741 }1742 // todo :: use a try/catch until it's safe to pull this out (likely 1.6)1743 // minor release fix for bug #80181744 try {1745 // for whatever reason, ie has trouble passing the window object1746 // around, causing it to be cloned in the process1747 if ( jquery.iswindow( elem ) && ( elem !== window && !elem.frameelement ) ) {1748 elem = window;1749 }1750 }1751 catch ( e ) {}1752 if ( handler === false ) {1753 handler = returnfalse;1754 } else if ( !handler ) {1755 // fixes bug #7229. fix recommended by jdalton1756 return;1757 }1758 var handleobjin, handleobj;1759 if ( handler.handler ) {1760 handleobjin = handler;1761 handler = handleobjin.handler;1762 }1763 // make sure that the function being executed has a unique id1764 if ( !handler.guid ) {1765 handler.guid = jquery.guid++;1766 }1767 // init the element's event structure1768 var elemdata = jquery._data( elem );1769 // if no elemdata is found then we must be trying to bind to one of the1770 // banned nodata elements1771 if ( !elemdata ) {1772 return;1773 }1774 var events = elemdata.events,1775 eventhandle = elemdata.handle;1776 if ( !events ) {1777 elemdata.events = events = {};1778 }1779 if ( !eventhandle ) {1780 elemdata.handle = eventhandle = function() {1781 // handle the second event of a trigger and when1782 // an event is called after a page has unloaded1783 return typeof jquery !== "undefined" && !jquery.event.triggered ?1784 jquery.event.handle.apply( eventhandle.elem, arguments ) :1785 undefined;1786 };1787 }1788 // add elem as a property of the handle function1789 // this is to prevent a memory leak with non-native events in ie.1790 eventhandle.elem = elem;1791 // handle multiple events separated by a space1792 // jquery(...).bind("mouseover mouseout", fn);1793 types = types.split(" ");1794 var type, i = 0, namespaces;1795 while ( (type = types[ i++ ]) ) {1796 handleobj = handleobjin ?1797 jquery.extend({}, handleobjin) :1798 { handler: handler, data: data };1799 // namespaced event handlers1800 if ( type.indexof(".") > -1 ) {1801 namespaces = type.split(".");1802 type = namespaces.shift();1803 handleobj.namespace = namespaces.slice(0).sort().join(".");1804 } else {1805 namespaces = [];1806 handleobj.namespace = "";1807 }1808 handleobj.type = type;1809 if ( !handleobj.guid ) {1810 handleobj.guid = handler.guid;1811 }1812 // get the current list of functions bound to this event1813 var handlers = events[ type ],1814 special = jquery.event.special[ type ] || {};1815 // init the event handler queue1816 if ( !handlers ) {1817 handlers = events[ type ] = [];1818 // check for a special event handler1819 // only use addeventlistener/attachevent if the special1820 // events handler returns false1821 if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) {1822 // bind the global event handler to the element1823 if ( elem.addeventlistener ) {1824 elem.addeventlistener( type, eventhandle, false );1825 } else if ( elem.attachevent ) {1826 elem.attachevent( "on" + type, eventhandle );1827 }1828 }1829 }1830 if ( special.add ) {1831 special.add.call( elem, handleobj );1832 if ( !handleobj.handler.guid ) {1833 handleobj.handler.guid = handler.guid;1834 }1835 }1836 // add the function to the element's handler list1837 handlers.push( handleobj );1838 // keep track of which events have been used, for global triggering1839 jquery.event.global[ type ] = true;1840 }1841 // nullify elem to prevent memory leaks in ie1842 elem = null;1843 },1844 global: {},1845 // detach an event or set of events from an element1846 remove: function( elem, types, handler, pos ) {1847 // don't do events on text and comment nodes1848 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {1849 return;1850 }1851 if ( handler === false ) {1852 handler = returnfalse;1853 }1854 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventtype, handleobj, origtype,1855 elemdata = jquery.hasdata( elem ) && jquery._data( elem ),1856 events = elemdata && elemdata.events;1857 if ( !elemdata || !events ) {1858 return;1859 }1860 // types is actually an event object here1861 if ( types && types.type ) {1862 handler = types.handler;1863 types = types.type;1864 }1865 // unbind all events for the element1866 if ( !types || typeof types === "string" && types.charat(0) === "." ) {1867 types = types || "";1868 for ( type in events ) {1869 jquery.event.remove( elem, type + types );1870 }1871 return;1872 }1873 // handle multiple events separated by a space1874 // jquery(...).unbind("mouseover mouseout", fn);1875 types = types.split(" ");1876 while ( (type = types[ i++ ]) ) {1877 origtype = type;1878 handleobj = null;1879 all = type.indexof(".") < 0;1880 namespaces = [];1881 if ( !all ) {1882 // namespaced event handlers1883 namespaces = type.split(".");1884 type = namespaces.shift();1885 namespace = new regexp("(^|\\.)" +1886 jquery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");1887 }1888 eventtype = events[ type ];1889 if ( !eventtype ) {1890 continue;1891 }1892 if ( !handler ) {1893 for ( j = 0; j < eventtype.length; j++ ) {1894 handleobj = eventtype[ j ];1895 if ( all || namespace.test( handleobj.namespace ) ) {1896 jquery.event.remove( elem, origtype, handleobj.handler, j );1897 eventtype.splice( j--, 1 );1898 }1899 }1900 continue;1901 }1902 special = jquery.event.special[ type ] || {};1903 for ( j = pos || 0; j < eventtype.length; j++ ) {1904 handleobj = eventtype[ j ];1905 if ( handler.guid === handleobj.guid ) {1906 // remove the given handler for the given type1907 if ( all || namespace.test( handleobj.namespace ) ) {1908 if ( pos == null ) {1909 eventtype.splice( j--, 1 );1910 }1911 if ( special.remove ) {1912 special.remove.call( elem, handleobj );1913 }1914 }1915 if ( pos != null ) {1916 break;1917 }1918 }1919 }1920 // remove generic event handler if no more handlers exist1921 if ( eventtype.length === 0 || pos != null && eventtype.length === 1 ) {1922 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {1923 jquery.removeevent( elem, type, elemdata.handle );1924 }1925 ret = null;1926 delete events[ type ];1927 }1928 }1929 // remove the expando if it's no longer used1930 if ( jquery.isemptyobject( events ) ) {1931 var handle = elemdata.handle;1932 if ( handle ) {1933 handle.elem = null;1934 }1935 delete elemdata.events;1936 delete elemdata.handle;1937 if ( jquery.isemptyobject( elemdata ) ) {1938 jquery.removedata( elem, undefined, true );1939 }1940 }1941 },1942 // bubbling is internal1943 trigger: function( event, data, elem /*, bubbling */ ) {1944 // event object or event type1945 var type = event.type || event,1946 bubbling = arguments[3];1947 if ( !bubbling ) {1948 event = typeof event === "object" ?1949 // jquery.event object1950 event[ jquery.expando ] ? event :1951 // object literal1952 jquery.extend( jquery.event(type), event ) :1953 // just the event type (string)1954 jquery.event(type);1955 if ( type.indexof("!") >= 0 ) {1956 event.type = type = type.slice(0, -1);1957 event.exclusive = true;1958 }1959 // handle a global trigger1960 if ( !elem ) {1961 // don't bubble custom events when global (to avoid too much overhead)1962 event.stoppropagation();1963 // only trigger if we've ever bound an event for it1964 if ( jquery.event.global[ type ] ) {1965 // xxx this code smells terrible. event.js should not be directly1966 // inspecting the data cache1967 jquery.each( jquery.cache, function() {1968 // internalkey variable is just used to make it easier to find1969 // and potentially change this stuff later; currently it just1970 // points to jquery.expando1971 var internalkey = jquery.expando,1972 internalcache = this[ internalkey ];1973 if ( internalcache && internalcache.events && internalcache.events[ type ] ) {1974 jquery.event.trigger( event, data, internalcache.handle.elem );1975 }1976 });1977 }1978 }1979 // handle triggering a single element1980 // don't do events on text and comment nodes1981 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 ) {1982 return undefined;1983 }1984 // clean up in case it is reused1985 event.result = undefined;1986 event.target = elem;1987 // clone the incoming data, if any1988 data = jquery.makearray( data );1989 data.unshift( event );1990 }1991 event.currenttarget = elem;1992 // trigger the event, it is assumed that "handle" is a function1993 var handle = jquery._data( elem, "handle" );1994 if ( handle ) {1995 handle.apply( elem, data );1996 }1997 var parent = elem.parentnode || elem.ownerdocument;1998 // trigger an inline bound script1999 try {2000 if ( !(elem && elem.nodename && jquery.nodata[elem.nodename.tolowercase()]) ) {2001 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {2002 event.result = false;2003 event.preventdefault();2004 }2005 }2006 // prevent ie from throwing an error for some elements with some event types, see #35332007 } catch (inlineerror) {}2008 if ( !event.ispropagationstopped() && parent ) {2009 jquery.event.trigger( event, data, parent, true );2010 } else if ( !event.isdefaultprevented() ) {2011 var old,2012 target = event.target,2013 targettype = type.replace( rnamespaces, "" ),2014 isclick = jquery.nodename( target, "a" ) && targettype === "click",2015 special = jquery.event.special[ targettype ] || {};2016 if ( (!special._default || special._default.call( elem, event ) === false) &&2017 !isclick && !(target && target.nodename && jquery.nodata[target.nodename.tolowercase()]) ) {2018 try {2019 if ( target[ targettype ] ) {2020 // make sure that we don't accidentally re-trigger the onfoo events2021 old = target[ "on" + targettype ];2022 if ( old ) {2023 target[ "on" + targettype ] = null;2024 }2025 jquery.event.triggered = true;2026 target[ targettype ]();2027 }2028 // prevent ie from throwing an error for some elements with some event types, see #35332029 } catch (triggererror) {}2030 if ( old ) {2031 target[ "on" + targettype ] = old;2032 }2033 jquery.event.triggered = false;2034 }2035 }2036 },2037 handle: function( event ) {2038 var all, handlers, namespaces, namespace_re, events,2039 namespace_sort = [],2040 args = jquery.makearray( arguments );2041 event = args[0] = jquery.event.fix( event || window.event );2042 event.currenttarget = this;2043 // namespaced event handlers2044 all = event.type.indexof(".") < 0 && !event.exclusive;2045 if ( !all ) {2046 namespaces = event.type.split(".");2047 event.type = namespaces.shift();2048 namespace_sort = namespaces.slice(0).sort();2049 namespace_re = new regexp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");2050 }2051 event.namespace = event.namespace || namespace_sort.join(".");2052 events = jquery._data(this, "events");2053 handlers = (events || {})[ event.type ];2054 if ( events && handlers ) {2055 // clone the handlers to prevent manipulation2056 handlers = handlers.slice(0);2057 for ( var j = 0, l = handlers.length; j < l; j++ ) {2058 var handleobj = handlers[ j ];2059 // filter the functions by class2060 if ( all || namespace_re.test( handleobj.namespace ) ) {2061 // pass in a reference to the handler function itself2062 // so that we can later remove it2063 event.handler = handleobj.handler;2064 event.data = handleobj.data;2065 event.handleobj = handleobj;2066 var ret = handleobj.handler.apply( this, args );2067 if ( ret !== undefined ) {2068 event.result = ret;2069 if ( ret === false ) {2070 event.preventdefault();2071 event.stoppropagation();2072 }2073 }2074 if ( event.isimmediatepropagationstopped() ) {2075 break;2076 }2077 }2078 }2079 }2080 return event.result;2081 },2082 props: "altkey attrchange attrname bubbles button cancelable charcode clientx clienty ctrlkey currenttarget data detail eventphase fromelement handler keycode layerx layery metakey newvalue offsetx offsety pagex pagey prevvalue relatednode relatedtarget screenx screeny shiftkey srcelement target toelement view wheeldelta which".split(" "),2083 fix: function( event ) {2084 if ( event[ jquery.expando ] ) {2085 return event;2086 }2087 // store a copy of the original event object2088 // and "clone" to set read-only properties2089 var originalevent = event;2090 event = jquery.event( originalevent );2091 for ( var i = this.props.length, prop; i; ) {2092 prop = this.props[ --i ];2093 event[ prop ] = originalevent[ prop ];2094 }2095 // fix target property, if necessary2096 if ( !event.target ) {2097 // fixes #1925 where srcelement might not be defined either2098 event.target = event.srcelement || document;2099 }2100 // check if target is a textnode (safari)2101 if ( event.target.nodetype === 3 ) {2102 event.target = event.target.parentnode;2103 }2104 // add relatedtarget, if necessary2105 if ( !event.relatedtarget && event.fromelement ) {2106 event.relatedtarget = event.fromelement === event.target ? event.toelement : event.fromelement;2107 }2108 // calculate pagex/y if missing and clientx/y available2109 if ( event.pagex == null && event.clientx != null ) {2110 var doc = document.documentelement,2111 body = document.body;2112 event.pagex = event.clientx + (doc && doc.scrollleft || body && body.scrollleft || 0) - (doc && doc.clientleft || body && body.clientleft || 0);2113 event.pagey = event.clienty + (doc && doc.scrolltop || body && body.scrolltop || 0) - (doc && doc.clienttop || body && body.clienttop || 0);2114 }2115 // add which for key events2116 if ( event.which == null && (event.charcode != null || event.keycode != null) ) {2117 event.which = event.charcode != null ? event.charcode : event.keycode;2118 }2119 // add metakey to non-mac browsers (use ctrl for pc's and meta for macs)2120 if ( !event.metakey && event.ctrlkey ) {2121 event.metakey = event.ctrlkey;2122 }2123 // add which for click: 1 === left; 2 === middle; 3 === right2124 // note: button is not normalized, so don't use it2125 if ( !event.which && event.button !== undefined ) {2126 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));2127 }2128 return event;2129 },2130 // deprecated, use jquery.guid instead2131 guid: 1e8,2132 // deprecated, use jquery.proxy instead2133 proxy: jquery.proxy,2134 special: {2135 ready: {2136 // make sure the ready event is setup2137 setup: jquery.bindready,2138 teardown: jquery.noop2139 },2140 live: {2141 add: function( handleobj ) {2142 jquery.event.add( this,2143 liveconvert( handleobj.origtype, handleobj.selector ),2144 jquery.extend({}, handleobj, {handler: livehandler, guid: handleobj.handler.guid}) );2145 },2146 remove: function( handleobj ) {2147 jquery.event.remove( this, liveconvert( handleobj.origtype, handleobj.selector ), handleobj );2148 }2149 },2150 beforeunload: {2151 setup: function( data, namespaces, eventhandle ) {2152 // we only want to do this special case on windows2153 if ( jquery.iswindow( this ) ) {2154 this.onbeforeunload = eventhandle;2155 }2156 },2157 teardown: function( namespaces, eventhandle ) {2158 if ( this.onbeforeunload === eventhandle ) {2159 this.onbeforeunload = null;2160 }2161 }2162 }2163 }2164};2165jquery.removeevent = document.removeeventlistener ?2166 function( elem, type, handle ) {2167 if ( elem.removeeventlistener ) {2168 elem.removeeventlistener( type, handle, false );2169 }2170 } :2171 function( elem, type, handle ) {2172 if ( elem.detachevent ) {2173 elem.detachevent( "on" + type, handle );2174 }2175 };2176jquery.event = function( src ) {2177 // allow instantiation without the 'new' keyword2178 if ( !this.preventdefault ) {2179 return new jquery.event( src );2180 }2181 // event object2182 if ( src && src.type ) {2183 this.originalevent = src;2184 this.type = src.type;2185 // events bubbling up the document may have been marked as prevented2186 // by a handler lower down the tree; reflect the correct value.2187 this.isdefaultprevented = (src.defaultprevented || src.returnvalue === false ||2188 src.getpreventdefault && src.getpreventdefault()) ? returntrue : returnfalse;2189 // event type2190 } else {2191 this.type = src;2192 }2193 // timestamp is buggy for some events on firefox(#3843)2194 // so we won't rely on the native value2195 this.timestamp = jquery.now();2196 // mark it as fixed2197 this[ jquery.expando ] = true;2198};2199function returnfalse() {2200 return false;2201}2202function returntrue() {2203 return true;2204}2205// jquery.event is based on dom3 events as specified by the ecmascript language binding2206// http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html2207jquery.event.prototype = {2208 preventdefault: function() {2209 this.isdefaultprevented = returntrue;2210 var e = this.originalevent;2211 if ( !e ) {2212 return;2213 }2214 // if preventdefault exists run it on the original event2215 if ( e.preventdefault ) {2216 e.preventdefault();2217 // otherwise set the returnvalue property of the original event to false (ie)2218 } else {2219 e.returnvalue = false;2220 }2221 },2222 stoppropagation: function() {2223 this.ispropagationstopped = returntrue;2224 var e = this.originalevent;2225 if ( !e ) {2226 return;2227 }2228 // if stoppropagation exists run it on the original event2229 if ( e.stoppropagation ) {2230 e.stoppropagation();2231 }2232 // otherwise set the cancelbubble property of the original event to true (ie)2233 e.cancelbubble = true;2234 },2235 stopimmediatepropagation: function() {2236 this.isimmediatepropagationstopped = returntrue;2237 this.stoppropagation();2238 },2239 isdefaultprevented: returnfalse,2240 ispropagationstopped: returnfalse,2241 isimmediatepropagationstopped: returnfalse2242};2243// checks if an event happened on an element within another element2244// used in jquery.event.special.mouseenter and mouseleave handlers2245var withinelement = function( event ) {2246 // check if mouse(over|out) are still within the same parent element2247 var parent = event.relatedtarget;2248 // firefox sometimes assigns relatedtarget a xul element2249 // which we cannot access the parentnode property of2250 try {2251 // chrome does something similar, the parentnode property2252 // can be accessed but is null.2253 if ( parent !== document && !parent.parentnode ) {2254 return;2255 }2256 // traverse up the tree2257 while ( parent && parent !== this ) {2258 parent = parent.parentnode;2259 }2260 if ( parent !== this ) {2261 // set the correct event type2262 event.type = event.data;2263 // handle event if we actually just moused on to a non sub-element2264 jquery.event.handle.apply( this, arguments );2265 }2266 // assuming we've left the element since we most likely mousedover a xul element2267 } catch(e) { }2268},2269// in case of event delegation, we only need to rename the event.type,2270// livehandler will take care of the rest.2271delegate = function( event ) {2272 event.type = event.data;2273 jquery.event.handle.apply( this, arguments );2274};2275// create mouseenter and mouseleave events2276jquery.each({2277 mouseenter: "mouseover",2278 mouseleave: "mouseout"2279}, function( orig, fix ) {2280 jquery.event.special[ orig ] = {2281 setup: function( data ) {2282 jquery.event.add( this, fix, data && data.selector ? delegate : withinelement, orig );2283 },2284 teardown: function( data ) {2285 jquery.event.remove( this, fix, data && data.selector ? delegate : withinelement );2286 }2287 };2288});2289// submit delegation2290if ( !jquery.support.submitbubbles ) {2291 jquery.event.special.submit = {2292 setup: function( data, namespaces ) {2293 if ( this.nodename && this.nodename.tolowercase() !== "form" ) {2294 jquery.event.add(this, "click.specialsubmit", function( e ) {2295 var elem = e.target,2296 type = elem.type;2297 if ( (type === "submit" || type === "image") && jquery( elem ).closest("form").length ) {2298 trigger( "submit", this, arguments );2299 }2300 });2301 jquery.event.add(this, "keypress.specialsubmit", function( e ) {2302 var elem = e.target,2303 type = elem.type;2304 if ( (type === "text" || type === "password") && jquery( elem ).closest("form").length && e.keycode === 13 ) {2305 trigger( "submit", this, arguments );2306 }2307 });2308 } else {2309 return false;2310 }2311 },2312 teardown: function( namespaces ) {2313 jquery.event.remove( this, ".specialsubmit" );2314 }2315 };2316}2317// change delegation, happens here so we have bind.2318if ( !jquery.support.changebubbles ) {2319 var changefilters,2320 getval = function( elem ) {2321 var type = elem.type, val = elem.value;2322 if ( type === "radio" || type === "checkbox" ) {2323 val = elem.checked;2324 } else if ( type === "select-multiple" ) {2325 val = elem.selectedindex > -1 ?2326 jquery.map( elem.options, function( elem ) {2327 return elem.selected;2328 }).join("-") :2329 "";2330 } else if ( elem.nodename.tolowercase() === "select" ) {2331 val = elem.selectedindex;2332 }2333 return val;2334 },2335 testchange = function testchange( e ) {2336 var elem = e.target, data, val;2337 if ( !rformelems.test( elem.nodename ) || elem.readonly ) {2338 return;2339 }2340 data = jquery._data( elem, "_change_data" );2341 val = getval(elem);2342 // the current data will be also retrieved by beforeactivate2343 if ( e.type !== "focusout" || elem.type !== "radio" ) {2344 jquery._data( elem, "_change_data", val );2345 }2346 if ( data === undefined || val === data ) {2347 return;2348 }2349 if ( data != null || val ) {2350 e.type = "change";2351 e.livefired = undefined;2352 jquery.event.trigger( e, arguments[1], elem );2353 }2354 };2355 jquery.event.special.change = {2356 filters: {2357 focusout: testchange,2358 beforedeactivate: testchange,2359 click: function( e ) {2360 var elem = e.target, type = elem.type;2361 if ( type === "radio" || type === "checkbox" || elem.nodename.tolowercase() === "select" ) {2362 testchange.call( this, e );2363 }2364 },2365 // change has to be called before submit2366 // keydown will be called before keypress, which is used in submit-event delegation2367 keydown: function( e ) {2368 var elem = e.target, type = elem.type;2369 if ( (e.keycode === 13 && elem.nodename.tolowercase() !== "textarea") ||2370 (e.keycode === 32 && (type === "checkbox" || type === "radio")) ||2371 type === "select-multiple" ) {2372 testchange.call( this, e );2373 }2374 },2375 // beforeactivate happens also before the previous element is blurred2376 // with this event you can't trigger a change event, but you can store2377 // information2378 beforeactivate: function( e ) {2379 var elem = e.target;2380 jquery._data( elem, "_change_data", getval(elem) );2381 }2382 },2383 setup: function( data, namespaces ) {2384 if ( this.type === "file" ) {2385 return false;2386 }2387 for ( var type in changefilters ) {2388 jquery.event.add( this, type + ".specialchange", changefilters[type] );2389 }2390 return rformelems.test( this.nodename );2391 },2392 teardown: function( namespaces ) {2393 jquery.event.remove( this, ".specialchange" );2394 return rformelems.test( this.nodename );2395 }2396 };2397 changefilters = jquery.event.special.change.filters;2398 // handle when the input is .focus()'d2399 changefilters.focus = changefilters.beforeactivate;2400}2401function trigger( type, elem, args ) {2402 // piggyback on a donor event to simulate a different one.2403 // fake originalevent to avoid donor's stoppropagation, but if the2404 // simulated event prevents default then we do the same on the donor.2405 // don't pass args or remember livefired; they apply to the donor event.2406 var event = jquery.extend( {}, args[ 0 ] );2407 event.type = type;2408 event.originalevent = {};2409 event.livefired = undefined;2410 jquery.event.handle.call( elem, event );2411 if ( event.isdefaultprevented() ) {2412 args[ 0 ].preventdefault();2413 }2414}2415// create "bubbling" focus and blur events2416if ( document.addeventlistener ) {2417 jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {2418 jquery.event.special[ fix ] = {2419 setup: function() {2420 this.addeventlistener( orig, handler, true );2421 },2422 teardown: function() {2423 this.removeeventlistener( orig, handler, true );2424 }2425 };2426 function handler( e ) {2427 e = jquery.event.fix( e );2428 e.type = fix;2429 return jquery.event.handle.call( this, e );2430 }2431 });2432}2433jquery.each(["bind", "one"], function( i, name ) {2434 jquery.fn[ name ] = function( type, data, fn ) {2435 // handle object literals2436 if ( typeof type === "object" ) {2437 for ( var key in type ) {2438 this[ name ](key, data, type[key], fn);2439 }2440 return this;2441 }2442 if ( jquery.isfunction( data ) || data === false ) {2443 fn = data;2444 data = undefined;2445 }2446 var handler = name === "one" ? jquery.proxy( fn, function( event ) {2447 jquery( this ).unbind( event, handler );2448 return fn.apply( this, arguments );2449 }) : fn;2450 if ( type === "unload" && name !== "one" ) {2451 this.one( type, data, fn );2452 } else {2453 for ( var i = 0, l = this.length; i < l; i++ ) {2454 jquery.event.add( this[i], type, handler, data );2455 }2456 }2457 return this;2458 };2459});2460jquery.fn.extend({2461 unbind: function( type, fn ) {2462 // handle object literals2463 if ( typeof type === "object" && !type.preventdefault ) {2464 for ( var key in type ) {2465 this.unbind(key, type[key]);2466 }2467 } else {2468 for ( var i = 0, l = this.length; i < l; i++ ) {2469 jquery.event.remove( this[i], type, fn );2470 }2471 }2472 return this;2473 },2474 delegate: function( selector, types, data, fn ) {2475 return this.live( types, data, fn, selector );2476 },2477 undelegate: function( selector, types, fn ) {2478 if ( arguments.length === 0 ) {2479 return this.unbind( "live" );2480 } else {2481 return this.die( types, null, fn, selector );2482 }2483 },2484 trigger: function( type, data ) {2485 return this.each(function() {2486 jquery.event.trigger( type, data, this );2487 });2488 },2489 triggerhandler: function( type, data ) {2490 if ( this[0] ) {2491 var event = jquery.event( type );2492 event.preventdefault();2493 event.stoppropagation();2494 jquery.event.trigger( event, data, this[0] );2495 return event.result;2496 }2497 },2498 toggle: function( fn ) {2499 // save reference to arguments for access in closure2500 var args = arguments,2501 i = 1;2502 // link all the functions, so any of them can unbind this click handler2503 while ( i < args.length ) {2504 jquery.proxy( fn, args[ i++ ] );2505 }2506 return this.click( jquery.proxy( fn, function( event ) {2507 // figure out which function to execute2508 var lasttoggle = ( jquery._data( this, "lasttoggle" + fn.guid ) || 0 ) % i;2509 jquery._data( this, "lasttoggle" + fn.guid, lasttoggle + 1 );2510 // make sure that clicks stop2511 event.preventdefault();2512 // and execute the function2513 return args[ lasttoggle ].apply( this, arguments ) || false;2514 }));2515 },2516 hover: function( fnover, fnout ) {2517 return this.mouseenter( fnover ).mouseleave( fnout || fnover );2518 }2519});2520var livemap = {2521 focus: "focusin",2522 blur: "focusout",2523 mouseenter: "mouseover",2524 mouseleave: "mouseout"2525};2526jquery.each(["live", "die"], function( i, name ) {2527 jquery.fn[ name ] = function( types, data, fn, origselector /* internal use only */ ) {2528 var type, i = 0, match, namespaces, pretype,2529 selector = origselector || this.selector,2530 context = origselector ? this : jquery( this.context );2531 if ( typeof types === "object" && !types.preventdefault ) {2532 for ( var key in types ) {2533 context[ name ]( key, data, types[key], selector );2534 }2535 return this;2536 }2537 if ( jquery.isfunction( data ) ) {2538 fn = data;2539 data = undefined;2540 }2541 types = (types || "").split(" ");2542 while ( (type = types[ i++ ]) != null ) {2543 match = rnamespaces.exec( type );2544 namespaces = "";2545 if ( match ) {2546 namespaces = match[0];2547 type = type.replace( rnamespaces, "" );2548 }2549 if ( type === "hover" ) {2550 types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );2551 continue;2552 }2553 pretype = type;2554 if ( type === "focus" || type === "blur" ) {2555 types.push( livemap[ type ] + namespaces );2556 type = type + namespaces;2557 } else {2558 type = (livemap[ type ] || type) + namespaces;2559 }2560 if ( name === "live" ) {2561 // bind live handler2562 for ( var j = 0, l = context.length; j < l; j++ ) {2563 jquery.event.add( context[j], "live." + liveconvert( type, selector ),2564 { data: data, selector: selector, handler: fn, origtype: type, orighandler: fn, pretype: pretype } );2565 }2566 } else {2567 // unbind live handler2568 context.unbind( "live." + liveconvert( type, selector ), fn );2569 }2570 }2571 return this;2572 };2573});2574function livehandler( event ) {2575 var stop, maxlevel, related, match, handleobj, elem, j, i, l, data, close, namespace, ret,2576 elems = [],2577 selectors = [],2578 events = jquery._data( this, "events" );2579 // make sure we avoid non-left-click bubbling in firefox (#3861) and disabled elements in ie (#6911)2580 if ( event.livefired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {2581 return;2582 }2583 if ( event.namespace ) {2584 namespace = new regexp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");2585 }2586 event.livefired = this;2587 var live = events.live.slice(0);2588 for ( j = 0; j < live.length; j++ ) {2589 handleobj = live[j];2590 if ( handleobj.origtype.replace( rnamespaces, "" ) === event.type ) {2591 selectors.push( handleobj.selector );2592 } else {2593 live.splice( j--, 1 );2594 }2595 }2596 match = jquery( event.target ).closest( selectors, event.currenttarget );2597 for ( i = 0, l = match.length; i < l; i++ ) {2598 close = match[i];2599 for ( j = 0; j < live.length; j++ ) {2600 handleobj = live[j];2601 if ( close.selector === handleobj.selector && (!namespace || namespace.test( handleobj.namespace )) && !close.elem.disabled ) {2602 elem = close.elem;2603 related = null;2604 // those two events require additional checking2605 if ( handleobj.pretype === "mouseenter" || handleobj.pretype === "mouseleave" ) {2606 event.type = handleobj.pretype;2607 related = jquery( event.relatedtarget ).closest( handleobj.selector )[0];2608 }2609 if ( !related || related !== elem ) {2610 elems.push({ elem: elem, handleobj: handleobj, level: close.level });2611 }2612 }2613 }2614 }2615 for ( i = 0, l = elems.length; i < l; i++ ) {2616 match = elems[i];2617 if ( maxlevel && match.level > maxlevel ) {2618 break;2619 }2620 event.currenttarget = match.elem;2621 event.data = match.handleobj.data;2622 event.handleobj = match.handleobj;2623 ret = match.handleobj.orighandler.apply( match.elem, arguments );2624 if ( ret === false || event.ispropagationstopped() ) {2625 maxlevel = match.level;2626 if ( ret === false ) {2627 stop = false;2628 }2629 if ( event.isimmediatepropagationstopped() ) {2630 break;2631 }2632 }2633 }2634 return stop;2635}2636function liveconvert( type, selector ) {2637 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");2638}2639jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +2640 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +2641 "change select submit keydown keypress keyup error").split(" "), function( i, name ) {2642 // handle event binding2643 jquery.fn[ name ] = function( data, fn ) {2644 if ( fn == null ) {2645 fn = data;2646 data = null;2647 }2648 return arguments.length > 0 ?2649 this.bind( name, data, fn ) :2650 this.trigger( name );2651 };2652 if ( jquery.attrfn ) {2653 jquery.attrfn[ name ] = true;2654 }2655});2656/*!2657 * sizzle css selector engine2658 * copyright 2011, the dojo foundation2659 * released under the mit, bsd, and gpl licenses.2660 * more information: http://sizzlejs.com/2661 */2662(function(){2663var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,2664 done = 0,2665 tostring = object.prototype.tostring,2666 hasduplicate = false,2667 basehasduplicate = true,2668 rbackslash = /\\/g,2669 rnonword = /\w/;2670// here we check if the javascript engine is using some sort of2671// optimization where it does not always call our comparision2672// function. if that is the case, discard the hasduplicate value.2673// thus far that includes google chrome.2674[0, 0].sort(function() {2675 basehasduplicate = false;2676 return 0;2677});2678var sizzle = function( selector, context, results, seed ) {2679 results = results || [];2680 context = context || document;2681 var origcontext = context;2682 if ( context.nodetype !== 1 && context.nodetype !== 9 ) {2683 return [];2684 }2685 2686 if ( !selector || typeof selector !== "string" ) {2687 return results;2688 }2689 var m, set, checkset, extra, ret, cur, pop, i,2690 prune = true,2691 contextxml = sizzle.isxml( context ),2692 parts = [],2693 sofar = selector;2694 2695 // reset the position of the chunker regexp (start from head)2696 do {2697 chunker.exec( "" );2698 m = chunker.exec( sofar );2699 if ( m ) {2700 sofar = m[3];2701 2702 parts.push( m[1] );2703 2704 if ( m[2] ) {2705 extra = m[3];2706 break;2707 }2708 }2709 } while ( m );2710 if ( parts.length > 1 && origpos.exec( selector ) ) {2711 if ( parts.length === 2 && expr.relative[ parts[0] ] ) {2712 set = posprocess( parts[0] + parts[1], context );2713 } else {2714 set = expr.relative[ parts[0] ] ?2715 [ context ] :2716 sizzle( parts.shift(), context );2717 while ( parts.length ) {2718 selector = parts.shift();2719 if ( expr.relative[ selector ] ) {2720 selector += parts.shift();2721 }2722 2723 set = posprocess( selector, set );2724 }2725 }2726 } else {2727 // take a shortcut and set the context if the root selector is an id2728 // (but not if it'll be faster if the inner selector is an id)2729 if ( !seed && parts.length > 1 && context.nodetype === 9 && !contextxml &&2730 expr.match.id.test(parts[0]) && !expr.match.id.test(parts[parts.length - 1]) ) {2731 ret = sizzle.find( parts.shift(), context, contextxml );2732 context = ret.expr ?2733 sizzle.filter( ret.expr, ret.set )[0] :2734 ret.set[0];2735 }2736 if ( context ) {2737 ret = seed ?2738 { expr: parts.pop(), set: makearray(seed) } :2739 sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentnode ? context.parentnode : context, contextxml );2740 set = ret.expr ?2741 sizzle.filter( ret.expr, ret.set ) :2742 ret.set;2743 if ( parts.length > 0 ) {2744 checkset = makearray( set );2745 } else {2746 prune = false;2747 }2748 while ( parts.length ) {2749 cur = parts.pop();2750 pop = cur;2751 if ( !expr.relative[ cur ] ) {2752 cur = "";2753 } else {2754 pop = parts.pop();2755 }2756 if ( pop == null ) {2757 pop = context;2758 }2759 expr.relative[ cur ]( checkset, pop, contextxml );2760 }2761 } else {2762 checkset = parts = [];2763 }2764 }2765 if ( !checkset ) {2766 checkset = set;2767 }2768 if ( !checkset ) {2769 sizzle.error( cur || selector );2770 }2771 if ( tostring.call(checkset) === "[object array]" ) {2772 if ( !prune ) {2773 results.push.apply( results, checkset );2774 } else if ( context && context.nodetype === 1 ) {2775 for ( i = 0; checkset[i] != null; i++ ) {2776 if ( checkset[i] && (checkset[i] === true || checkset[i].nodetype === 1 && sizzle.contains(context, checkset[i])) ) {2777 results.push( set[i] );2778 }2779 }2780 } else {2781 for ( i = 0; checkset[i] != null; i++ ) {2782 if ( checkset[i] && checkset[i].nodetype === 1 ) {2783 results.push( set[i] );2784 }2785 }2786 }2787 } else {2788 makearray( checkset, results );2789 }2790 if ( extra ) {2791 sizzle( extra, origcontext, results, seed );2792 sizzle.uniquesort( results );2793 }2794 return results;2795};2796sizzle.uniquesort = function( results ) {2797 if ( sortorder ) {2798 hasduplicate = basehasduplicate;2799 results.sort( sortorder );2800 if ( hasduplicate ) {2801 for ( var i = 1; i < results.length; i++ ) {2802 if ( results[i] === results[ i - 1 ] ) {2803 results.splice( i--, 1 );2804 }2805 }2806 }2807 }2808 return results;2809};2810sizzle.matches = function( expr, set ) {2811 return sizzle( expr, null, null, set );2812};2813sizzle.matchesselector = function( node, expr ) {2814 return sizzle( expr, null, null, [node] ).length > 0;2815};2816sizzle.find = function( expr, context, isxml ) {2817 var set;2818 if ( !expr ) {2819 return [];2820 }2821 for ( var i = 0, l = expr.order.length; i < l; i++ ) {2822 var match,2823 type = expr.order[i];2824 2825 if ( (match = expr.leftmatch[ type ].exec( expr )) ) {2826 var left = match[1];2827 match.splice( 1, 1 );2828 if ( left.substr( left.length - 1 ) !== "\\" ) {2829 match[1] = (match[1] || "").replace( rbackslash, "" );2830 set = expr.find[ type ]( match, context, isxml );2831 if ( set != null ) {2832 expr = expr.replace( expr.match[ type ], "" );2833 break;2834 }2835 }2836 }2837 }2838 if ( !set ) {2839 set = typeof context.getelementsbytagname !== "undefined" ?2840 context.getelementsbytagname( "*" ) :2841 [];2842 }2843 return { set: set, expr: expr };2844};2845sizzle.filter = function( expr, set, inplace, not ) {2846 var match, anyfound,2847 old = expr,2848 result = [],2849 curloop = set,2850 isxmlfilter = set && set[0] && sizzle.isxml( set[0] );2851 while ( expr && set.length ) {2852 for ( var type in expr.filter ) {2853 if ( (match = expr.leftmatch[ type ].exec( expr )) != null && match[2] ) {2854 var found, item,2855 filter = expr.filter[ type ],2856 left = match[1];2857 anyfound = false;2858 match.splice(1,1);2859 if ( left.substr( left.length - 1 ) === "\\" ) {2860 continue;2861 }2862 if ( curloop === result ) {2863 result = [];2864 }2865 if ( expr.prefilter[ type ] ) {2866 match = expr.prefilter[ type ]( match, curloop, inplace, result, not, isxmlfilter );2867 if ( !match ) {2868 anyfound = found = true;2869 } else if ( match === true ) {2870 continue;2871 }2872 }2873 if ( match ) {2874 for ( var i = 0; (item = curloop[i]) != null; i++ ) {2875 if ( item ) {2876 found = filter( item, match, i, curloop );2877 var pass = not ^ !!found;2878 if ( inplace && found != null ) {2879 if ( pass ) {2880 anyfound = true;2881 } else {2882 curloop[i] = false;2883 }2884 } else if ( pass ) {2885 result.push( item );2886 anyfound = true;2887 }2888 }2889 }2890 }2891 if ( found !== undefined ) {2892 if ( !inplace ) {2893 curloop = result;2894 }2895 expr = expr.replace( expr.match[ type ], "" );2896 if ( !anyfound ) {2897 return [];2898 }2899 break;2900 }2901 }2902 }2903 // improper expression2904 if ( expr === old ) {2905 if ( anyfound == null ) {2906 sizzle.error( expr );2907 } else {2908 break;2909 }2910 }2911 old = expr;2912 }2913 return curloop;2914};2915sizzle.error = function( msg ) {2916 throw "syntax error, unrecognized expression: " + msg;2917};2918var expr = sizzle.selectors = {2919 order: [ "id", "name", "tag" ],2920 match: {2921 id: /#((?:[\w\u00c0-\uffff\-]|\\.)+)/,2922 class: /\.((?:[\w\u00c0-\uffff\-]|\\.)+)/,2923 name: /\[name=['"]*((?:[\w\u00c0-\uffff\-]|\\.)+)['"]*\]/,2924 attr: /\[\s*((?:[\w\u00c0-\uffff\-]|\\.)+)\s*(?:(\s?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uffff\-]|\\.)*)|)|)\s*\]/,2925 tag: /^((?:[\w\u00c0-\uffff\*\-]|\\.)+)/,2926 child: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,2927 pos: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,2928 pseudo: /:((?:[\w\u00c0-\uffff\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/2929 },2930 leftmatch: {},2931 attrmap: {2932 "class": "classname",2933 "for": "htmlfor"2934 },2935 attrhandle: {2936 href: function( elem ) {2937 return elem.getattribute( "href" );2938 },2939 type: function( elem ) {2940 return elem.getattribute( "type" );2941 }2942 },2943 relative: {2944 "+": function(checkset, part){2945 var ispartstr = typeof part === "string",2946 istag = ispartstr && !rnonword.test( part ),2947 ispartstrnottag = ispartstr && !istag;2948 if ( istag ) {2949 part = part.tolowercase();2950 }2951 for ( var i = 0, l = checkset.length, elem; i < l; i++ ) {2952 if ( (elem = checkset[i]) ) {2953 while ( (elem = elem.previoussibling) && elem.nodetype !== 1 ) {}2954 checkset[i] = ispartstrnottag || elem && elem.nodename.tolowercase() === part ?2955 elem || false :2956 elem === part;2957 }2958 }2959 if ( ispartstrnottag ) {2960 sizzle.filter( part, checkset, true );2961 }2962 },2963 ">": function( checkset, part ) {2964 var elem,2965 ispartstr = typeof part === "string",2966 i = 0,2967 l = checkset.length;2968 if ( ispartstr && !rnonword.test( part ) ) {2969 part = part.tolowercase();2970 for ( ; i < l; i++ ) {2971 elem = checkset[i];2972 if ( elem ) {2973 var parent = elem.parentnode;2974 checkset[i] = parent.nodename.tolowercase() === part ? parent : false;2975 }2976 }2977 } else {2978 for ( ; i < l; i++ ) {2979 elem = checkset[i];2980 if ( elem ) {2981 checkset[i] = ispartstr ?2982 elem.parentnode :2983 elem.parentnode === part;2984 }2985 }2986 if ( ispartstr ) {2987 sizzle.filter( part, checkset, true );2988 }2989 }2990 },2991 "": function(checkset, part, isxml){2992 var nodecheck,2993 donename = done++,2994 checkfn = dircheck;2995 if ( typeof part === "string" && !rnonword.test( part ) ) {2996 part = part.tolowercase();2997 nodecheck = part;2998 checkfn = dirnodecheck;2999 }3000 checkfn( "parentnode", part, donename, checkset, nodecheck, isxml );3001 },3002 "~": function( checkset, part, isxml ) {3003 var nodecheck,3004 donename = done++,3005 checkfn = dircheck;3006 if ( typeof part === "string" && !rnonword.test( part ) ) {3007 part = part.tolowercase();3008 nodecheck = part;3009 checkfn = dirnodecheck;3010 }3011 checkfn( "previoussibling", part, donename, checkset, nodecheck, isxml );3012 }3013 },3014 find: {3015 id: function( match, context, isxml ) {3016 if ( typeof context.getelementbyid !== "undefined" && !isxml ) {3017 var m = context.getelementbyid(match[1]);3018 // check parentnode to catch when blackberry 4.6 returns3019 // nodes that are no longer in the document #69633020 return m && m.parentnode ? [m] : [];3021 }3022 },3023 name: function( match, context ) {3024 if ( typeof context.getelementsbyname !== "undefined" ) {3025 var ret = [],3026 results = context.getelementsbyname( match[1] );3027 for ( var i = 0, l = results.length; i < l; i++ ) {3028 if ( results[i].getattribute("name") === match[1] ) {3029 ret.push( results[i] );3030 }3031 }3032 return ret.length === 0 ? null : ret;3033 }3034 },3035 tag: function( match, context ) {3036 if ( typeof context.getelementsbytagname !== "undefined" ) {3037 return context.getelementsbytagname( match[1] );3038 }3039 }3040 },3041 prefilter: {3042 class: function( match, curloop, inplace, result, not, isxml ) {3043 match = " " + match[1].replace( rbackslash, "" ) + " ";3044 if ( isxml ) {3045 return match;3046 }3047 for ( var i = 0, elem; (elem = curloop[i]) != null; i++ ) {3048 if ( elem ) {3049 if ( not ^ (elem.classname && (" " + elem.classname + " ").replace(/[\t\n\r]/g, " ").indexof(match) >= 0) ) {3050 if ( !inplace ) {3051 result.push( elem );3052 }3053 } else if ( inplace ) {3054 curloop[i] = false;3055 }3056 }3057 }3058 return false;3059 },3060 id: function( match ) {3061 return match[1].replace( rbackslash, "" );3062 },3063 tag: function( match, curloop ) {3064 return match[1].replace( rbackslash, "" ).tolowercase();3065 },3066 child: function( match ) {3067 if ( match[1] === "nth" ) {3068 if ( !match[2] ) {3069 sizzle.error( match[0] );3070 }3071 match[2] = match[2].replace(/^\+|\s*/g, '');3072 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'3073 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(3074 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||3075 !/\d/.test( match[2] ) && "0n+" + match[2] || match[2]);3076 // calculate the numbers (first)n+(last) including if they are negative3077 match[2] = (test[1] + (test[2] || 1)) - 0;3078 match[3] = test[3] - 0;3079 }3080 else if ( match[2] ) {3081 sizzle.error( match[0] );3082 }3083 // todo: move to normal caching system3084 match[0] = done++;3085 return match;3086 },3087 attr: function( match, curloop, inplace, result, not, isxml ) {3088 var name = match[1] = match[1].replace( rbackslash, "" );3089 3090 if ( !isxml && expr.attrmap[name] ) {3091 match[1] = expr.attrmap[name];3092 }3093 // handle if an un-quoted value was used3094 match[4] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );3095 if ( match[2] === "~=" ) {3096 match[4] = " " + match[4] + " ";3097 }3098 return match;3099 },3100 pseudo: function( match, curloop, inplace, result, not ) {3101 if ( match[1] === "not" ) {3102 // if we're dealing with a complex expression, or a simple one3103 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {3104 match[3] = sizzle(match[3], null, null, curloop);3105 } else {3106 var ret = sizzle.filter(match[3], curloop, inplace, true ^ not);3107 if ( !inplace ) {3108 result.push.apply( result, ret );3109 }3110 return false;3111 }3112 } else if ( expr.match.pos.test( match[0] ) || expr.match.child.test( match[0] ) ) {3113 return true;3114 }3115 3116 return match;3117 },3118 pos: function( match ) {3119 match.unshift( true );3120 return match;3121 }3122 },3123 3124 filters: {3125 enabled: function( elem ) {3126 return elem.disabled === false && elem.type !== "hidden";3127 },3128 disabled: function( elem ) {3129 return elem.disabled === true;3130 },3131 checked: function( elem ) {3132 return elem.checked === true;3133 },3134 3135 selected: function( elem ) {3136 // accessing this property makes selected-by-default3137 // options in safari work properly3138 if ( elem.parentnode ) {3139 elem.parentnode.selectedindex;3140 }3141 3142 return elem.selected === true;3143 },3144 parent: function( elem ) {3145 return !!elem.firstchild;3146 },3147 empty: function( elem ) {3148 return !elem.firstchild;3149 },3150 has: function( elem, i, match ) {3151 return !!sizzle( match[3], elem ).length;3152 },3153 header: function( elem ) {3154 return (/h\d/i).test( elem.nodename );3155 },3156 text: function( elem ) {3157 // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc) 3158 // use getattribute instead to test this case3159 return "text" === elem.getattribute( 'type' );3160 },3161 radio: function( elem ) {3162 return "radio" === elem.type;3163 },3164 checkbox: function( elem ) {3165 return "checkbox" === elem.type;3166 },3167 file: function( elem ) {3168 return "file" === elem.type;3169 },3170 password: function( elem ) {3171 return "password" === elem.type;3172 },3173 submit: function( elem ) {3174 return "submit" === elem.type;3175 },3176 image: function( elem ) {3177 return "image" === elem.type;3178 },3179 reset: function( elem ) {3180 return "reset" === elem.type;3181 },3182 button: function( elem ) {3183 return "button" === elem.type || elem.nodename.tolowercase() === "button";3184 },3185 input: function( elem ) {3186 return (/input|select|textarea|button/i).test( elem.nodename );3187 }3188 },3189 setfilters: {3190 first: function( elem, i ) {3191 return i === 0;3192 },3193 last: function( elem, i, match, array ) {3194 return i === array.length - 1;3195 },3196 even: function( elem, i ) {3197 return i % 2 === 0;3198 },3199 odd: function( elem, i ) {3200 return i % 2 === 1;3201 },3202 lt: function( elem, i, match ) {3203 return i < match[3] - 0;3204 },3205 gt: function( elem, i, match ) {3206 return i > match[3] - 0;3207 },3208 nth: function( elem, i, match ) {3209 return match[3] - 0 === i;3210 },3211 eq: function( elem, i, match ) {3212 return match[3] - 0 === i;3213 }3214 },3215 filter: {3216 pseudo: function( elem, match, i, array ) {3217 var name = match[1],3218 filter = expr.filters[ name ];3219 if ( filter ) {3220 return filter( elem, i, match, array );3221 } else if ( name === "contains" ) {3222 return (elem.textcontent || elem.innertext || sizzle.gettext([ elem ]) || "").indexof(match[3]) >= 0;3223 } else if ( name === "not" ) {3224 var not = match[3];3225 for ( var j = 0, l = not.length; j < l; j++ ) {3226 if ( not[j] === elem ) {3227 return false;3228 }3229 }3230 return true;3231 } else {3232 sizzle.error( name );3233 }3234 },3235 child: function( elem, match ) {3236 var type = match[1],3237 node = elem;3238 switch ( type ) {3239 case "only":3240 case "first":3241 while ( (node = node.previoussibling) ) {3242 if ( node.nodetype === 1 ) { 3243 return false; 3244 }3245 }3246 if ( type === "first" ) { 3247 return true; 3248 }3249 node = elem;3250 case "last":3251 while ( (node = node.nextsibling) ) {3252 if ( node.nodetype === 1 ) { 3253 return false; 3254 }3255 }3256 return true;3257 case "nth":3258 var first = match[2],3259 last = match[3];3260 if ( first === 1 && last === 0 ) {3261 return true;3262 }3263 3264 var donename = match[0],3265 parent = elem.parentnode;3266 3267 if ( parent && (parent.sizcache !== donename || !elem.nodeindex) ) {3268 var count = 0;3269 3270 for ( node = parent.firstchild; node; node = node.nextsibling ) {3271 if ( node.nodetype === 1 ) {3272 node.nodeindex = ++count;3273 }3274 } 3275 parent.sizcache = donename;3276 }3277 3278 var diff = elem.nodeindex - last;3279 if ( first === 0 ) {3280 return diff === 0;3281 } else {3282 return ( diff % first === 0 && diff / first >= 0 );3283 }3284 }3285 },3286 id: function( elem, match ) {3287 return elem.nodetype === 1 && elem.getattribute("id") === match;3288 },3289 tag: function( elem, match ) {3290 return (match === "*" && elem.nodetype === 1) || elem.nodename.tolowercase() === match;3291 },3292 3293 class: function( elem, match ) {3294 return (" " + (elem.classname || elem.getattribute("class")) + " ")3295 .indexof( match ) > -1;3296 },3297 attr: function( elem, match ) {3298 var name = match[1],3299 result = expr.attrhandle[ name ] ?3300 expr.attrhandle[ name ]( elem ) :3301 elem[ name ] != null ?3302 elem[ name ] :3303 elem.getattribute( name ),3304 value = result + "",3305 type = match[2],3306 check = match[4];3307 return result == null ?3308 type === "!=" :3309 type === "=" ?3310 value === check :3311 type === "*=" ?3312 value.indexof(check) >= 0 :3313 type === "~=" ?3314 (" " + value + " ").indexof(check) >= 0 :3315 !check ?3316 value && result !== false :3317 type === "!=" ?3318 value !== check :3319 type === "^=" ?3320 value.indexof(check) === 0 :3321 type === "$=" ?3322 value.substr(value.length - check.length) === check :3323 type === "|=" ?3324 value === check || value.substr(0, check.length + 1) === check + "-" :3325 false;3326 },3327 pos: function( elem, match, i, array ) {3328 var name = match[2],3329 filter = expr.setfilters[ name ];3330 if ( filter ) {3331 return filter( elem, i, match, array );3332 }3333 }3334 }3335};3336var origpos = expr.match.pos,3337 fescape = function(all, num){3338 return "\\" + (num - 0 + 1);3339 };3340for ( var type in expr.match ) {3341 expr.match[ type ] = new regexp( expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );3342 expr.leftmatch[ type ] = new regexp( /(^(?:.|\r|\n)*?)/.source + expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );3343}3344var makearray = function( array, results ) {3345 array = array.prototype.slice.call( array, 0 );3346 if ( results ) {3347 results.push.apply( results, array );3348 return results;3349 }3350 3351 return array;3352};3353// perform a simple check to determine if the browser is capable of3354// converting a nodelist to an array using builtin methods.3355// also verifies that the returned array holds dom nodes3356// (which is not the case in the blackberry browser)3357try {3358 array.prototype.slice.call( document.documentelement.childnodes, 0 )[0].nodetype;3359// provide a fallback method if it does not work3360} catch( e ) {3361 makearray = function( array, results ) {3362 var i = 0,3363 ret = results || [];3364 if ( tostring.call(array) === "[object array]" ) {3365 array.prototype.push.apply( ret, array );3366 } else {3367 if ( typeof array.length === "number" ) {3368 for ( var l = array.length; i < l; i++ ) {3369 ret.push( array[i] );3370 }3371 } else {3372 for ( ; array[i]; i++ ) {3373 ret.push( array[i] );3374 }3375 }3376 }3377 return ret;3378 };3379}3380var sortorder, siblingcheck;3381if ( document.documentelement.comparedocumentposition ) {3382 sortorder = function( a, b ) {3383 if ( a === b ) {3384 hasduplicate = true;3385 return 0;3386 }3387 if ( !a.comparedocumentposition || !b.comparedocumentposition ) {3388 return a.comparedocumentposition ? -1 : 1;3389 }3390 return a.comparedocumentposition(b) & 4 ? -1 : 1;3391 };3392} else {3393 sortorder = function( a, b ) {3394 var al, bl,3395 ap = [],3396 bp = [],3397 aup = a.parentnode,3398 bup = b.parentnode,3399 cur = aup;3400 // the nodes are identical, we can exit early3401 if ( a === b ) {3402 hasduplicate = true;3403 return 0;3404 // if the nodes are siblings (or identical) we can do a quick check3405 } else if ( aup === bup ) {3406 return siblingcheck( a, b );3407 // if no parents were found then the nodes are disconnected3408 } else if ( !aup ) {3409 return -1;3410 } else if ( !bup ) {3411 return 1;3412 }3413 // otherwise they're somewhere else in the tree so we need3414 // to build up a full list of the parentnodes for comparison3415 while ( cur ) {3416 ap.unshift( cur );3417 cur = cur.parentnode;3418 }3419 cur = bup;3420 while ( cur ) {3421 bp.unshift( cur );3422 cur = cur.parentnode;3423 }3424 al = ap.length;3425 bl = bp.length;3426 // start walking down the tree looking for a discrepancy3427 for ( var i = 0; i < al && i < bl; i++ ) {3428 if ( ap[i] !== bp[i] ) {3429 return siblingcheck( ap[i], bp[i] );3430 }3431 }3432 // we ended someplace up the tree so do a sibling check3433 return i === al ?3434 siblingcheck( a, bp[i], -1 ) :3435 siblingcheck( ap[i], b, 1 );3436 };3437 siblingcheck = function( a, b, ret ) {3438 if ( a === b ) {3439 return ret;3440 }3441 var cur = a.nextsibling;3442 while ( cur ) {3443 if ( cur === b ) {3444 return -1;3445 }3446 cur = cur.nextsibling;3447 }3448 return 1;3449 };3450}3451// utility function for retreiving the text value of an array of dom nodes3452sizzle.gettext = function( elems ) {3453 var ret = "", elem;3454 for ( var i = 0; elems[i]; i++ ) {3455 elem = elems[i];3456 // get the text from text nodes and cdata nodes3457 if ( elem.nodetype === 3 || elem.nodetype === 4 ) {3458 ret += elem.nodevalue;3459 // traverse everything else, except comment nodes3460 } else if ( elem.nodetype !== 8 ) {3461 ret += sizzle.gettext( elem.childnodes );3462 }3463 }3464 return ret;3465};3466// check to see if the browser returns elements by name when3467// querying by getelementbyid (and provide a workaround)3468(function(){3469 // we're going to inject a fake input element with a specified name3470 var form = document.createelement("div"),3471 id = "script" + (new date()).gettime(),3472 root = document.documentelement;3473 form.innerhtml = "<a name='" + id + "'/>";3474 // inject it into the root element, check its status, and remove it quickly3475 root.insertbefore( form, root.firstchild );3476 // the workaround has to do additional checks after a getelementbyid3477 // which slows things down for other browsers (hence the branching)3478 if ( document.getelementbyid( id ) ) {3479 expr.find.id = function( match, context, isxml ) {3480 if ( typeof context.getelementbyid !== "undefined" && !isxml ) {3481 var m = context.getelementbyid(match[1]);3482 return m ?3483 m.id === match[1] || typeof m.getattributenode !== "undefined" && m.getattributenode("id").nodevalue === match[1] ?3484 [m] :3485 undefined :3486 [];3487 }3488 };3489 expr.filter.id = function( elem, match ) {3490 var node = typeof elem.getattributenode !== "undefined" && elem.getattributenode("id");3491 return elem.nodetype === 1 && node && node.nodevalue === match;3492 };3493 }3494 root.removechild( form );3495 // release memory in ie3496 root = form = null;3497})();3498(function(){3499 // check to see if the browser returns only elements3500 // when doing getelementsbytagname("*")3501 // create a fake element3502 var div = document.createelement("div");3503 div.appendchild( document.createcomment("") );3504 // make sure no comments are found3505 if ( div.getelementsbytagname("*").length > 0 ) {3506 expr.find.tag = function( match, context ) {3507 var results = context.getelementsbytagname( match[1] );3508 // filter out possible comments3509 if ( match[1] === "*" ) {3510 var tmp = [];3511 for ( var i = 0; results[i]; i++ ) {3512 if ( results[i].nodetype === 1 ) {3513 tmp.push( results[i] );3514 }3515 }3516 results = tmp;3517 }3518 return results;3519 };3520 }3521 // check to see if an attribute returns normalized href attributes3522 div.innerhtml = "<a href='#'></a>";3523 if ( div.firstchild && typeof div.firstchild.getattribute !== "undefined" &&3524 div.firstchild.getattribute("href") !== "#" ) {3525 expr.attrhandle.href = function( elem ) {3526 return elem.getattribute( "href", 2 );3527 };3528 }3529 // release memory in ie3530 div = null;3531})();3532if ( document.queryselectorall ) {3533 (function(){3534 var oldsizzle = sizzle,3535 div = document.createelement("div"),3536 id = "__sizzle__";3537 div.innerhtml = "<p class='test'></p>";3538 // safari can't handle uppercase or unicode characters when3539 // in quirks mode.3540 if ( div.queryselectorall && div.queryselectorall(".test").length === 0 ) {3541 return;3542 }3543 3544 sizzle = function( query, context, extra, seed ) {3545 context = context || document;3546 // only use queryselectorall on non-xml documents3547 // (id selectors don't work in non-html documents)3548 if ( !seed && !sizzle.isxml(context) ) {3549 // see if we find a selector to speed up3550 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );3551 3552 if ( match && (context.nodetype === 1 || context.nodetype === 9) ) {3553 // speed-up: sizzle("tag")3554 if ( match[1] ) {3555 return makearray( context.getelementsbytagname( query ), extra );3556 3557 // speed-up: sizzle(".class")3558 } else if ( match[2] && expr.find.class && context.getelementsbyclassname ) {3559 return makearray( context.getelementsbyclassname( match[2] ), extra );3560 }3561 }3562 3563 if ( context.nodetype === 9 ) {3564 // speed-up: sizzle("body")3565 // the body element only exists once, optimize finding it3566 if ( query === "body" && context.body ) {3567 return makearray( [ context.body ], extra );3568 3569 // speed-up: sizzle("#id")3570 } else if ( match && match[3] ) {3571 var elem = context.getelementbyid( match[3] );3572 // check parentnode to catch when blackberry 4.6 returns3573 // nodes that are no longer in the document #69633574 if ( elem && elem.parentnode ) {3575 // handle the case where ie and opera return items3576 // by name instead of id3577 if ( elem.id === match[3] ) {3578 return makearray( [ elem ], extra );3579 }3580 3581 } else {3582 return makearray( [], extra );3583 }3584 }3585 3586 try {3587 return makearray( context.queryselectorall(query), extra );3588 } catch(qsaerror) {}3589 // qsa works strangely on element-rooted queries3590 // we can work around this by specifying an extra id on the root3591 // and working up from there (thanks to andrew dupont for the technique)3592 // ie 8 doesn't work on object elements3593 } else if ( context.nodetype === 1 && context.nodename.tolowercase() !== "object" ) {3594 var oldcontext = context,3595 old = context.getattribute( "id" ),3596 nid = old || id,3597 hasparent = context.parentnode,3598 relativehierarchyselector = /^\s*[+~]/.test( query );3599 if ( !old ) {3600 context.setattribute( "id", nid );3601 } else {3602 nid = nid.replace( /'/g, "\\$&" );3603 }3604 if ( relativehierarchyselector && hasparent ) {3605 context = context.parentnode;3606 }3607 try {3608 if ( !relativehierarchyselector || hasparent ) {3609 return makearray( context.queryselectorall( "[id='" + nid + "'] " + query ), extra );3610 }3611 } catch(pseudoerror) {3612 } finally {3613 if ( !old ) {3614 oldcontext.removeattribute( "id" );3615 }3616 }3617 }3618 }3619 3620 return oldsizzle(query, context, extra, seed);3621 };3622 for ( var prop in oldsizzle ) {3623 sizzle[ prop ] = oldsizzle[ prop ];3624 }3625 // release memory in ie3626 div = null;3627 })();3628}3629(function(){3630 var html = document.documentelement,3631 matches = html.matchesselector || html.mozmatchesselector || html.webkitmatchesselector || html.msmatchesselector,3632 pseudoworks = false;3633 try {3634 // this should fail with an exception3635 // gecko does not error, returns false instead3636 matches.call( document.documentelement, "[test!='']:sizzle" );3637 3638 } catch( pseudoerror ) {3639 pseudoworks = true;3640 }3641 if ( matches ) {3642 sizzle.matchesselector = function( node, expr ) {3643 // make sure that attribute selectors are quoted3644 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");3645 if ( !sizzle.isxml( node ) ) {3646 try { 3647 if ( pseudoworks || !expr.match.pseudo.test( expr ) && !/!=/.test( expr ) ) {3648 return matches.call( node, expr );3649 }3650 } catch(e) {}3651 }3652 return sizzle(expr, null, null, [node]).length > 0;3653 };3654 }3655})();3656(function(){3657 var div = document.createelement("div");3658 div.innerhtml = "<div class='test e'></div><div class='test'></div>";3659 // opera can't find a second classname (in 9.6)3660 // also, make sure that getelementsbyclassname actually exists3661 if ( !div.getelementsbyclassname || div.getelementsbyclassname("e").length === 0 ) {3662 return;3663 }3664 // safari caches class attributes, doesn't catch changes (in 3.2)3665 div.lastchild.classname = "e";3666 if ( div.getelementsbyclassname("e").length === 1 ) {3667 return;3668 }3669 3670 expr.order.splice(1, 0, "class");3671 expr.find.class = function( match, context, isxml ) {3672 if ( typeof context.getelementsbyclassname !== "undefined" && !isxml ) {3673 return context.getelementsbyclassname(match[1]);3674 }3675 };3676 // release memory in ie3677 div = null;3678})();3679function dirnodecheck( dir, cur, donename, checkset, nodecheck, isxml ) {3680 for ( var i = 0, l = checkset.length; i < l; i++ ) {3681 var elem = checkset[i];3682 if ( elem ) {3683 var match = false;3684 elem = elem[dir];3685 while ( elem ) {3686 if ( elem.sizcache === donename ) {3687 match = checkset[elem.sizset];3688 break;3689 }3690 if ( elem.nodetype === 1 && !isxml ){3691 elem.sizcache = donename;3692 elem.sizset = i;3693 }3694 if ( elem.nodename.tolowercase() === cur ) {3695 match = elem;3696 break;3697 }3698 elem = elem[dir];3699 }3700 checkset[i] = match;3701 }3702 }3703}3704function dircheck( dir, cur, donename, checkset, nodecheck, isxml ) {3705 for ( var i = 0, l = checkset.length; i < l; i++ ) {3706 var elem = checkset[i];3707 if ( elem ) {3708 var match = false;3709 3710 elem = elem[dir];3711 while ( elem ) {3712 if ( elem.sizcache === donename ) {3713 match = checkset[elem.sizset];3714 break;3715 }3716 if ( elem.nodetype === 1 ) {3717 if ( !isxml ) {3718 elem.sizcache = donename;3719 elem.sizset = i;3720 }3721 if ( typeof cur !== "string" ) {3722 if ( elem === cur ) {3723 match = true;3724 break;3725 }3726 } else if ( sizzle.filter( cur, [elem] ).length > 0 ) {3727 match = elem;3728 break;3729 }3730 }3731 elem = elem[dir];3732 }3733 checkset[i] = match;3734 }3735 }3736}3737if ( document.documentelement.contains ) {3738 sizzle.contains = function( a, b ) {3739 return a !== b && (a.contains ? a.contains(b) : true);3740 };3741} else if ( document.documentelement.comparedocumentposition ) {3742 sizzle.contains = function( a, b ) {3743 return !!(a.comparedocumentposition(b) & 16);3744 };3745} else {3746 sizzle.contains = function() {3747 return false;3748 };3749}3750sizzle.isxml = function( elem ) {3751 // documentelement is verified for cases where it doesn't yet exist3752 // (such as loading iframes in ie - #4833) 3753 var documentelement = (elem ? elem.ownerdocument || elem : 0).documentelement;3754 return documentelement ? documentelement.nodename !== "html" : false;3755};3756var posprocess = function( selector, context ) {3757 var match,3758 tmpset = [],3759 later = "",3760 root = context.nodetype ? [context] : context;3761 // position selectors must be done after the filter3762 // and so must :not(positional) so we move all pseudos to the end3763 while ( (match = expr.match.pseudo.exec( selector )) ) {3764 later += match[0];3765 selector = selector.replace( expr.match.pseudo, "" );3766 }3767 selector = expr.relative[selector] ? selector + "*" : selector;3768 for ( var i = 0, l = root.length; i < l; i++ ) {3769 sizzle( selector, root[i], tmpset );3770 }3771 return sizzle.filter( later, tmpset );3772};3773// expose3774jquery.find = sizzle;3775jquery.expr = sizzle.selectors;3776jquery.expr[":"] = jquery.expr.filters;3777jquery.unique = sizzle.uniquesort;3778jquery.text = sizzle.gettext;3779jquery.isxmldoc = sizzle.isxml;3780jquery.contains = sizzle.contains;3781})();3782var runtil = /until$/,3783 rparentsprev = /^(?:parents|prevuntil|prevall)/,3784 // note: this regexp should be improved, or likely pulled from sizzle3785 rmultiselector = /,/,3786 issimple = /^.[^:#\[\.,]*$/,3787 slice = array.prototype.slice,3788 pos = jquery.expr.match.pos,3789 // methods guaranteed to produce a unique set when starting from a unique set3790 guaranteedunique = {3791 children: true,3792 contents: true,3793 next: true,3794 prev: true3795 };3796jquery.fn.extend({3797 find: function( selector ) {3798 var ret = this.pushstack( "", "find", selector ),3799 length = 0;3800 for ( var i = 0, l = this.length; i < l; i++ ) {3801 length = ret.length;3802 jquery.find( selector, this[i], ret );3803 if ( i > 0 ) {3804 // make sure that the results are unique3805 for ( var n = length; n < ret.length; n++ ) {3806 for ( var r = 0; r < length; r++ ) {3807 if ( ret[r] === ret[n] ) {3808 ret.splice(n--, 1);3809 break;3810 }3811 }3812 }3813 }3814 }3815 return ret;3816 },3817 has: function( target ) {3818 var targets = jquery( target );3819 return this.filter(function() {3820 for ( var i = 0, l = targets.length; i < l; i++ ) {3821 if ( jquery.contains( this, targets[i] ) ) {3822 return true;3823 }3824 }3825 });3826 },3827 not: function( selector ) {3828 return this.pushstack( winnow(this, selector, false), "not", selector);3829 },3830 filter: function( selector ) {3831 return this.pushstack( winnow(this, selector, true), "filter", selector );3832 },3833 is: function( selector ) {3834 return !!selector && jquery.filter( selector, this ).length > 0;3835 },3836 closest: function( selectors, context ) {3837 var ret = [], i, l, cur = this[0];3838 if ( jquery.isarray( selectors ) ) {3839 var match, selector,3840 matches = {},3841 level = 1;3842 if ( cur && selectors.length ) {3843 for ( i = 0, l = selectors.length; i < l; i++ ) {3844 selector = selectors[i];3845 if ( !matches[selector] ) {3846 matches[selector] = jquery.expr.match.pos.test( selector ) ?3847 jquery( selector, context || this.context ) :3848 selector;3849 }3850 }3851 while ( cur && cur.ownerdocument && cur !== context ) {3852 for ( selector in matches ) {3853 match = matches[selector];3854 if ( match.jquery ? match.index(cur) > -1 : jquery(cur).is(match) ) {3855 ret.push({ selector: selector, elem: cur, level: level });3856 }3857 }3858 cur = cur.parentnode;3859 level++;3860 }3861 }3862 return ret;3863 }3864 var pos = pos.test( selectors ) ?3865 jquery( selectors, context || this.context ) : null;3866 for ( i = 0, l = this.length; i < l; i++ ) {3867 cur = this[i];3868 while ( cur ) {3869 if ( pos ? pos.index(cur) > -1 : jquery.find.matchesselector(cur, selectors) ) {3870 ret.push( cur );3871 break;3872 } else {3873 cur = cur.parentnode;3874 if ( !cur || !cur.ownerdocument || cur === context ) {3875 break;3876 }3877 }3878 }3879 }3880 ret = ret.length > 1 ? jquery.unique(ret) : ret;3881 return this.pushstack( ret, "closest", selectors );3882 },3883 // determine the position of an element within3884 // the matched set of elements3885 index: function( elem ) {3886 if ( !elem || typeof elem === "string" ) {3887 return jquery.inarray( this[0],3888 // if it receives a string, the selector is used3889 // if it receives nothing, the siblings are used3890 elem ? jquery( elem ) : this.parent().children() );3891 }3892 // locate the position of the desired element3893 return jquery.inarray(3894 // if it receives a jquery object, the first element is used3895 elem.jquery ? elem[0] : elem, this );3896 },3897 add: function( selector, context ) {3898 var set = typeof selector === "string" ?3899 jquery( selector, context ) :3900 jquery.makearray( selector ),3901 all = jquery.merge( this.get(), set );3902 return this.pushstack( isdisconnected( set[0] ) || isdisconnected( all[0] ) ?3903 all :3904 jquery.unique( all ) );3905 },3906 andself: function() {3907 return this.add( this.prevobject );3908 }3909});3910// a painfully simple check to see if an element is disconnected3911// from a document (should be improved, where feasible).3912function isdisconnected( node ) {3913 return !node || !node.parentnode || node.parentnode.nodetype === 11;3914}3915jquery.each({3916 parent: function( elem ) {3917 var parent = elem.parentnode;3918 return parent && parent.nodetype !== 11 ? parent : null;3919 },3920 parents: function( elem ) {3921 return jquery.dir( elem, "parentnode" );3922 },3923 parentsuntil: function( elem, i, until ) {3924 return jquery.dir( elem, "parentnode", until );3925 },3926 next: function( elem ) {3927 return jquery.nth( elem, 2, "nextsibling" );3928 },3929 prev: function( elem ) {3930 return jquery.nth( elem, 2, "previoussibling" );3931 },3932 nextall: function( elem ) {3933 return jquery.dir( elem, "nextsibling" );3934 },3935 prevall: function( elem ) {3936 return jquery.dir( elem, "previoussibling" );3937 },3938 nextuntil: function( elem, i, until ) {3939 return jquery.dir( elem, "nextsibling", until );3940 },3941 prevuntil: function( elem, i, until ) {3942 return jquery.dir( elem, "previoussibling", until );3943 },3944 siblings: function( elem ) {3945 return jquery.sibling( elem.parentnode.firstchild, elem );3946 },3947 children: function( elem ) {3948 return jquery.sibling( elem.firstchild );3949 },3950 contents: function( elem ) {3951 return jquery.nodename( elem, "iframe" ) ?3952 elem.contentdocument || elem.contentwindow.document :3953 jquery.makearray( elem.childnodes );3954 }3955}, function( name, fn ) {3956 jquery.fn[ name ] = function( until, selector ) {3957 var ret = jquery.map( this, fn, until ),3958 // the variable 'args' was introduced in3959 // https://github.com/jquery/jquery/commit/52a02383960 // to work around a bug in chrome 10 (dev) and should be removed when the bug is fixed.3961 // http://code.google.com/p/v8/issues/detail?id=10503962 args = slice.call(arguments);3963 if ( !runtil.test( name ) ) {3964 selector = until;3965 }3966 if ( selector && typeof selector === "string" ) {3967 ret = jquery.filter( selector, ret );3968 }3969 ret = this.length > 1 && !guaranteedunique[ name ] ? jquery.unique( ret ) : ret;3970 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {3971 ret = ret.reverse();3972 }3973 return this.pushstack( ret, name, args.join(",") );3974 };3975});3976jquery.extend({3977 filter: function( expr, elems, not ) {3978 if ( not ) {3979 expr = ":not(" + expr + ")";3980 }3981 return elems.length === 1 ?3982 jquery.find.matchesselector(elems[0], expr) ? [ elems[0] ] : [] :3983 jquery.find.matches(expr, elems);3984 },3985 dir: function( elem, dir, until ) {3986 var matched = [],3987 cur = elem[ dir ];3988 while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) {3989 if ( cur.nodetype === 1 ) {3990 matched.push( cur );3991 }3992 cur = cur[dir];3993 }3994 return matched;3995 },3996 nth: function( cur, result, dir, elem ) {3997 result = result || 1;3998 var num = 0;3999 for ( ; cur; cur = cur[dir] ) {4000 if ( cur.nodetype === 1 && ++num === result ) {4001 break;4002 }4003 }4004 return cur;4005 },4006 sibling: function( n, elem ) {4007 var r = [];4008 for ( ; n; n = n.nextsibling ) {4009 if ( n.nodetype === 1 && n !== elem ) {4010 r.push( n );4011 }4012 }4013 return r;4014 }4015});4016// implement the identical functionality for filter and not4017function winnow( elements, qualifier, keep ) {4018 if ( jquery.isfunction( qualifier ) ) {4019 return jquery.grep(elements, function( elem, i ) {4020 var retval = !!qualifier.call( elem, i, elem );4021 return retval === keep;4022 });4023 } else if ( qualifier.nodetype ) {4024 return jquery.grep(elements, function( elem, i ) {4025 return (elem === qualifier) === keep;4026 });4027 } else if ( typeof qualifier === "string" ) {4028 var filtered = jquery.grep(elements, function( elem ) {4029 return elem.nodetype === 1;4030 });4031 if ( issimple.test( qualifier ) ) {4032 return jquery.filter(qualifier, filtered, !keep);4033 } else {4034 qualifier = jquery.filter( qualifier, filtered );4035 }4036 }4037 return jquery.grep(elements, function( elem, i ) {4038 return (jquery.inarray( elem, qualifier ) >= 0) === keep;4039 });4040}4041var rinlinejquery = / jquery\d+="(?:\d+|null)"/g,4042 rleadingwhitespace = /^\s+/,4043 rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,4044 rtagname = /<([\w:]+)/,4045 rtbody = /<tbody/i,4046 rhtml = /<|&#?\w+;/,4047 rnocache = /<(?:script|object|embed|option|style)/i,4048 // checked="checked" or checked4049 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,4050 wrapmap = {4051 option: [ 1, "<select multiple='multiple'>", "</select>" ],4052 legend: [ 1, "<fieldset>", "</fieldset>" ],4053 thead: [ 1, "<table>", "</table>" ],4054 tr: [ 2, "<table><tbody>", "</tbody></table>" ],4055 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],4056 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],4057 area: [ 1, "<map>", "</map>" ],4058 _default: [ 0, "", "" ]4059 };4060wrapmap.optgroup = wrapmap.option;4061wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead;4062wrapmap.th = wrapmap.td;4063// ie can't serialize <link> and <script> tags normally4064if ( !jquery.support.htmlserialize ) {4065 wrapmap._default = [ 1, "div<div>", "</div>" ];4066}4067jquery.fn.extend({4068 text: function( text ) {4069 if ( jquery.isfunction(text) ) {4070 return this.each(function(i) {4071 var self = jquery( this );4072 self.text( text.call(this, i, self.text()) );4073 });4074 }4075 if ( typeof text !== "object" && text !== undefined ) {4076 return this.empty().append( (this[0] && this[0].ownerdocument || document).createtextnode( text ) );4077 }4078 return jquery.text( this );4079 },4080 wrapall: function( html ) {4081 if ( jquery.isfunction( html ) ) {4082 return this.each(function(i) {4083 jquery(this).wrapall( html.call(this, i) );4084 });4085 }4086 if ( this[0] ) {4087 // the elements to wrap the target around4088 var wrap = jquery( html, this[0].ownerdocument ).eq(0).clone(true);4089 if ( this[0].parentnode ) {4090 wrap.insertbefore( this[0] );4091 }4092 wrap.map(function() {4093 var elem = this;4094 while ( elem.firstchild && elem.firstchild.nodetype === 1 ) {4095 elem = elem.firstchild;4096 }4097 return elem;4098 }).append(this);4099 }4100 return this;4101 },4102 wrapinner: function( html ) {4103 if ( jquery.isfunction( html ) ) {4104 return this.each(function(i) {4105 jquery(this).wrapinner( html.call(this, i) );4106 });4107 }4108 return this.each(function() {4109 var self = jquery( this ),4110 contents = self.contents();4111 if ( contents.length ) {4112 contents.wrapall( html );4113 } else {4114 self.append( html );4115 }4116 });4117 },4118 wrap: function( html ) {4119 return this.each(function() {4120 jquery( this ).wrapall( html );4121 });4122 },4123 unwrap: function() {4124 return this.parent().each(function() {4125 if ( !jquery.nodename( this, "body" ) ) {4126 jquery( this ).replacewith( this.childnodes );4127 }4128 }).end();4129 },4130 append: function() {4131 return this.dommanip(arguments, true, function( elem ) {4132 if ( this.nodetype === 1 ) {4133 this.appendchild( elem );4134 }4135 });4136 },4137 prepend: function() {4138 return this.dommanip(arguments, true, function( elem ) {4139 if ( this.nodetype === 1 ) {4140 this.insertbefore( elem, this.firstchild );4141 }4142 });4143 },4144 before: function() {4145 if ( this[0] && this[0].parentnode ) {4146 return this.dommanip(arguments, false, function( elem ) {4147 this.parentnode.insertbefore( elem, this );4148 });4149 } else if ( arguments.length ) {4150 var set = jquery(arguments[0]);4151 set.push.apply( set, this.toarray() );4152 return this.pushstack( set, "before", arguments );4153 }4154 },4155 after: function() {4156 if ( this[0] && this[0].parentnode ) {4157 return this.dommanip(arguments, false, function( elem ) {4158 this.parentnode.insertbefore( elem, this.nextsibling );4159 });4160 } else if ( arguments.length ) {4161 var set = this.pushstack( this, "after", arguments );4162 set.push.apply( set, jquery(arguments[0]).toarray() );4163 return set;4164 }4165 },4166 // keepdata is for internal use only--do not document4167 remove: function( selector, keepdata ) {4168 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {4169 if ( !selector || jquery.filter( selector, [ elem ] ).length ) {4170 if ( !keepdata && elem.nodetype === 1 ) {4171 jquery.cleandata( elem.getelementsbytagname("*") );4172 jquery.cleandata( [ elem ] );4173 }4174 if ( elem.parentnode ) {4175 elem.parentnode.removechild( elem );4176 }4177 }4178 }4179 return this;4180 },4181 empty: function() {4182 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {4183 // remove element nodes and prevent memory leaks4184 if ( elem.nodetype === 1 ) {4185 jquery.cleandata( elem.getelementsbytagname("*") );4186 }4187 // remove any remaining nodes4188 while ( elem.firstchild ) {4189 elem.removechild( elem.firstchild );4190 }4191 }4192 return this;4193 },4194 clone: function( dataandevents, deepdataandevents ) {4195 dataandevents = dataandevents == null ? false : dataandevents;4196 deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents;4197 return this.map( function () {4198 return jquery.clone( this, dataandevents, deepdataandevents );4199 });4200 },4201 html: function( value ) {4202 if ( value === undefined ) {4203 return this[0] && this[0].nodetype === 1 ?4204 this[0].innerhtml.replace(rinlinejquery, "") :4205 null;4206 // see if we can take a shortcut and just use innerhtml4207 } else if ( typeof value === "string" && !rnocache.test( value ) &&4208 (jquery.support.leadingwhitespace || !rleadingwhitespace.test( value )) &&4209 !wrapmap[ (rtagname.exec( value ) || ["", ""])[1].tolowercase() ] ) {4210 value = value.replace(rxhtmltag, "<$1></$2>");4211 try {4212 for ( var i = 0, l = this.length; i < l; i++ ) {4213 // remove element nodes and prevent memory leaks4214 if ( this[i].nodetype === 1 ) {4215 jquery.cleandata( this[i].getelementsbytagname("*") );4216 this[i].innerhtml = value;4217 }4218 }4219 // if using innerhtml throws an exception, use the fallback method4220 } catch(e) {4221 this.empty().append( value );4222 }4223 } else if ( jquery.isfunction( value ) ) {4224 this.each(function(i){4225 var self = jquery( this );4226 self.html( value.call(this, i, self.html()) );4227 });4228 } else {4229 this.empty().append( value );4230 }4231 return this;4232 },4233 replacewith: function( value ) {4234 if ( this[0] && this[0].parentnode ) {4235 // make sure that the elements are removed from the dom before they are inserted4236 // this can help fix replacing a parent with child elements4237 if ( jquery.isfunction( value ) ) {4238 return this.each(function(i) {4239 var self = jquery(this), old = self.html();4240 self.replacewith( value.call( this, i, old ) );4241 });4242 }4243 if ( typeof value !== "string" ) {4244 value = jquery( value ).detach();4245 }4246 return this.each(function() {4247 var next = this.nextsibling,4248 parent = this.parentnode;4249 jquery( this ).remove();4250 if ( next ) {4251 jquery(next).before( value );4252 } else {4253 jquery(parent).append( value );4254 }4255 });4256 } else {4257 return this.pushstack( jquery(jquery.isfunction(value) ? value() : value), "replacewith", value );4258 }4259 },4260 detach: function( selector ) {4261 return this.remove( selector, true );4262 },4263 dommanip: function( args, table, callback ) {4264 var results, first, fragment, parent,4265 value = args[0],4266 scripts = [];4267 // we can't clonenode fragments that contain checked, in webkit4268 if ( !jquery.support.checkclone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {4269 return this.each(function() {4270 jquery(this).dommanip( args, table, callback, true );4271 });4272 }4273 if ( jquery.isfunction(value) ) {4274 return this.each(function(i) {4275 var self = jquery(this);4276 args[0] = value.call(this, i, table ? self.html() : undefined);4277 self.dommanip( args, table, callback );4278 });4279 }4280 if ( this[0] ) {4281 parent = value && value.parentnode;4282 // if we're in a fragment, just use that instead of building a new one4283 if ( jquery.support.parentnode && parent && parent.nodetype === 11 && parent.childnodes.length === this.length ) {4284 results = { fragment: parent };4285 } else {4286 results = jquery.buildfragment( args, this, scripts );4287 }4288 fragment = results.fragment;4289 if ( fragment.childnodes.length === 1 ) {4290 first = fragment = fragment.firstchild;4291 } else {4292 first = fragment.firstchild;4293 }4294 if ( first ) {4295 table = table && jquery.nodename( first, "tr" );4296 for ( var i = 0, l = this.length, lastindex = l - 1; i < l; i++ ) {4297 callback.call(4298 table ?4299 root(this[i], first) :4300 this[i],4301 // make sure that we do not leak memory by inadvertently discarding4302 // the original fragment (which might have attached data) instead of4303 // using it; in addition, use the original fragment object for the last4304 // item instead of first because it can end up being emptied incorrectly4305 // in certain situations (bug #8070).4306 // fragments from the fragment cache must always be cloned and never used4307 // in place.4308 results.cacheable || (l > 1 && i < lastindex) ?4309 jquery.clone( fragment, true, true ) :4310 fragment4311 );4312 }4313 }4314 if ( scripts.length ) {4315 jquery.each( scripts, evalscript );4316 }4317 }4318 return this;4319 }4320});4321function root( elem, cur ) {4322 return jquery.nodename(elem, "table") ?4323 (elem.getelementsbytagname("tbody")[0] ||4324 elem.appendchild(elem.ownerdocument.createelement("tbody"))) :4325 elem;4326}4327function clonecopyevent( src, dest ) {4328 if ( dest.nodetype !== 1 || !jquery.hasdata( src ) ) {4329 return;4330 }4331 var internalkey = jquery.expando,4332 olddata = jquery.data( src ),4333 curdata = jquery.data( dest, olddata );4334 // switch to use the internal data object, if it exists, for the next4335 // stage of data copying4336 if ( (olddata = olddata[ internalkey ]) ) {4337 var events = olddata.events;4338 curdata = curdata[ internalkey ] = jquery.extend({}, olddata);4339 if ( events ) {4340 delete curdata.handle;4341 curdata.events = {};4342 for ( var type in events ) {4343 for ( var i = 0, l = events[ type ].length; i < l; i++ ) {4344 jquery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );4345 }4346 }4347 }4348 }4349}4350function clonefixattributes(src, dest) {4351 // we do not need to do anything for non-elements4352 if ( dest.nodetype !== 1 ) {4353 return;4354 }4355 var nodename = dest.nodename.tolowercase();4356 // clearattributes removes the attributes, which we don't want,4357 // but also removes the attachevent events, which we *do* want4358 dest.clearattributes();4359 // mergeattributes, in contrast, only merges back on the4360 // original attributes, not the events4361 dest.mergeattributes(src);4362 // ie6-8 fail to clone children inside object elements that use4363 // the proprietary classid attribute value (rather than the type4364 // attribute) to identify the type of content to display4365 if ( nodename === "object" ) {4366 dest.outerhtml = src.outerhtml;4367 } else if ( nodename === "input" && (src.type === "checkbox" || src.type === "radio") ) {4368 // ie6-8 fails to persist the checked state of a cloned checkbox4369 // or radio button. worse, ie6-7 fail to give the cloned element4370 // a checked appearance if the defaultchecked value isn't also set4371 if ( src.checked ) {4372 dest.defaultchecked = dest.checked = src.checked;4373 }4374 // ie6-7 get confused and end up setting the value of a cloned4375 // checkbox/radio button to an empty string instead of "on"4376 if ( dest.value !== src.value ) {4377 dest.value = src.value;4378 }4379 // ie6-8 fails to return the selected option to the default selected4380 // state when cloning options4381 } else if ( nodename === "option" ) {4382 dest.selected = src.defaultselected;4383 // ie6-8 fails to set the defaultvalue to the correct value when4384 // cloning other types of input fields4385 } else if ( nodename === "input" || nodename === "textarea" ) {4386 dest.defaultvalue = src.defaultvalue;4387 }4388 // event data gets referenced instead of copied if the expando4389 // gets copied too4390 dest.removeattribute( jquery.expando );4391}4392jquery.buildfragment = function( args, nodes, scripts ) {4393 var fragment, cacheable, cacheresults,4394 doc = (nodes && nodes[0] ? nodes[0].ownerdocument || nodes[0] : document);4395 // only cache "small" (1/2 kb) html strings that are associated with the main document4396 // cloning options loses the selected state, so don't cache them4397 // ie 6 doesn't like it when you put <object> or <embed> elements in a fragment4398 // also, webkit does not clone 'checked' attributes on clonenode, so don't cache4399 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&4400 args[0].charat(0) === "<" && !rnocache.test( args[0] ) && (jquery.support.checkclone || !rchecked.test( args[0] )) ) {4401 cacheable = true;4402 cacheresults = jquery.fragments[ args[0] ];4403 if ( cacheresults ) {4404 if ( cacheresults !== 1 ) {4405 fragment = cacheresults;4406 }4407 }4408 }4409 if ( !fragment ) {4410 fragment = doc.createdocumentfragment();4411 jquery.clean( args, doc, fragment, scripts );4412 }4413 if ( cacheable ) {4414 jquery.fragments[ args[0] ] = cacheresults ? fragment : 1;4415 }4416 return { fragment: fragment, cacheable: cacheable };4417};4418jquery.fragments = {};4419jquery.each({4420 appendto: "append",4421 prependto: "prepend",4422 insertbefore: "before",4423 insertafter: "after",4424 replaceall: "replacewith"4425}, function( name, original ) {4426 jquery.fn[ name ] = function( selector ) {4427 var ret = [],4428 insert = jquery( selector ),4429 parent = this.length === 1 && this[0].parentnode;4430 if ( parent && parent.nodetype === 11 && parent.childnodes.length === 1 && insert.length === 1 ) {4431 insert[ original ]( this[0] );4432 return this;4433 } else {4434 for ( var i = 0, l = insert.length; i < l; i++ ) {4435 var elems = (i > 0 ? this.clone(true) : this).get();4436 jquery( insert[i] )[ original ]( elems );4437 ret = ret.concat( elems );4438 }4439 return this.pushstack( ret, name, insert.selector );4440 }4441 };4442});4443function getall( elem ) {4444 if ( "getelementsbytagname" in elem ) {4445 return elem.getelementsbytagname( "*" );4446 4447 } else if ( "queryselectorall" in elem ) {4448 return elem.queryselectorall( "*" );4449 } else {4450 return [];4451 }4452}4453jquery.extend({4454 clone: function( elem, dataandevents, deepdataandevents ) {4455 var clone = elem.clonenode(true),4456 srcelements,4457 destelements,4458 i;4459 if ( (!jquery.support.nocloneevent || !jquery.support.noclonechecked) &&4460 (elem.nodetype === 1 || elem.nodetype === 11) && !jquery.isxmldoc(elem) ) {4461 // ie copies events bound via attachevent when using clonenode.4462 // calling detachevent on the clone will also remove the events4463 // from the original. in order to get around this, we use some4464 // proprietary methods to clear the events. thanks to mootools4465 // guys for this hotness.4466 clonefixattributes( elem, clone );4467 // using sizzle here is crazy slow, so we use getelementsbytagname4468 // instead4469 srcelements = getall( elem );4470 destelements = getall( clone );4471 // weird iteration because ie will replace the length property4472 // with an element if you are cloning the body and one of the4473 // elements on the page has a name or id of "length"4474 for ( i = 0; srcelements[i]; ++i ) {4475 clonefixattributes( srcelements[i], destelements[i] );4476 }4477 }4478 // copy the events from the original to the clone4479 if ( dataandevents ) {4480 clonecopyevent( elem, clone );4481 if ( deepdataandevents ) {4482 srcelements = getall( elem );4483 destelements = getall( clone );4484 for ( i = 0; srcelements[i]; ++i ) {4485 clonecopyevent( srcelements[i], destelements[i] );4486 }4487 }4488 }4489 // return the cloned set4490 return clone;4491},4492 clean: function( elems, context, fragment, scripts ) {4493 context = context || document;4494 // !context.createelement fails in ie with an error but returns typeof 'object'4495 if ( typeof context.createelement === "undefined" ) {4496 context = context.ownerdocument || context[0] && context[0].ownerdocument || document;4497 }4498 var ret = [];4499 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {4500 if ( typeof elem === "number" ) {4501 elem += "";4502 }4503 if ( !elem ) {4504 continue;4505 }4506 // convert html string into dom nodes4507 if ( typeof elem === "string" && !rhtml.test( elem ) ) {4508 elem = context.createtextnode( elem );4509 } else if ( typeof elem === "string" ) {4510 // fix "xhtml"-style tags in all browsers4511 elem = elem.replace(rxhtmltag, "<$1></$2>");4512 // trim whitespace, otherwise indexof won't work as expected4513 var tag = (rtagname.exec( elem ) || ["", ""])[1].tolowercase(),4514 wrap = wrapmap[ tag ] || wrapmap._default,4515 depth = wrap[0],4516 div = context.createelement("div");4517 // go to html and back, then peel off extra wrappers4518 div.innerhtml = wrap[1] + elem + wrap[2];4519 // move to the right depth4520 while ( depth-- ) {4521 div = div.lastchild;4522 }4523 // remove ie's autoinserted <tbody> from table fragments4524 if ( !jquery.support.tbody ) {4525 // string was a <table>, *may* have spurious <tbody>4526 var hasbody = rtbody.test(elem),4527 tbody = tag === "table" && !hasbody ?4528 div.firstchild && div.firstchild.childnodes :4529 // string was a bare <thead> or <tfoot>4530 wrap[1] === "<table>" && !hasbody ?4531 div.childnodes :4532 [];4533 for ( var j = tbody.length - 1; j >= 0 ; --j ) {4534 if ( jquery.nodename( tbody[ j ], "tbody" ) && !tbody[ j ].childnodes.length ) {4535 tbody[ j ].parentnode.removechild( tbody[ j ] );4536 }4537 }4538 }4539 // ie completely kills leading whitespace when innerhtml is used4540 if ( !jquery.support.leadingwhitespace && rleadingwhitespace.test( elem ) ) {4541 div.insertbefore( context.createtextnode( rleadingwhitespace.exec(elem)[0] ), div.firstchild );4542 }4543 elem = div.childnodes;4544 }4545 if ( elem.nodetype ) {4546 ret.push( elem );4547 } else {4548 ret = jquery.merge( ret, elem );4549 }4550 }4551 if ( fragment ) {4552 for ( i = 0; ret[i]; i++ ) {4553 if ( scripts && jquery.nodename( ret[i], "script" ) && (!ret[i].type || ret[i].type.tolowercase() === "text/javascript") ) {4554 scripts.push( ret[i].parentnode ? ret[i].parentnode.removechild( ret[i] ) : ret[i] );4555 } else {4556 if ( ret[i].nodetype === 1 ) {4557 ret.splice.apply( ret, [i + 1, 0].concat(jquery.makearray(ret[i].getelementsbytagname("script"))) );4558 }4559 fragment.appendchild( ret[i] );4560 }4561 }4562 }4563 return ret;4564 },4565 cleandata: function( elems ) {4566 var data, id, cache = jquery.cache, internalkey = jquery.expando, special = jquery.event.special,4567 deleteexpando = jquery.support.deleteexpando;4568 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {4569 if ( elem.nodename && jquery.nodata[elem.nodename.tolowercase()] ) {4570 continue;4571 }4572 id = elem[ jquery.expando ];4573 if ( id ) {4574 data = cache[ id ] && cache[ id ][ internalkey ];4575 if ( data && data.events ) {4576 for ( var type in data.events ) {4577 if ( special[ type ] ) {4578 jquery.event.remove( elem, type );4579 // this is a shortcut to avoid jquery.event.remove's overhead4580 } else {4581 jquery.removeevent( elem, type, data.handle );4582 }4583 }4584 // null the dom reference to avoid ie6/7/8 leak (#7054)4585 if ( data.handle ) {4586 data.handle.elem = null;4587 }4588 }4589 if ( deleteexpando ) {4590 delete elem[ jquery.expando ];4591 } else if ( elem.removeattribute ) {4592 elem.removeattribute( jquery.expando );4593 }4594 delete cache[ id ];4595 }4596 }4597 }4598});4599function evalscript( i, elem ) {4600 if ( elem.src ) {4601 jquery.ajax({4602 url: elem.src,4603 async: false,4604 datatype: "script"4605 });4606 } else {4607 jquery.globaleval( elem.text || elem.textcontent || elem.innerhtml || "" );4608 }4609 if ( elem.parentnode ) {4610 elem.parentnode.removechild( elem );4611 }4612}4613var ralpha = /alpha\([^)]*\)/i,4614 ropacity = /opacity=([^)]*)/,4615 rdashalpha = /-([a-z])/ig,4616 rupper = /([a-z])/g,4617 rnumpx = /^-?\d+(?:px)?$/i,4618 rnum = /^-?\d/,4619 cssshow = { position: "absolute", visibility: "hidden", display: "block" },4620 csswidth = [ "left", "right" ],4621 cssheight = [ "top", "bottom" ],4622 curcss,4623 getcomputedstyle,4624 currentstyle,4625 fcamelcase = function( all, letter ) {4626 return letter.touppercase();4627 };4628jquery.fn.css = function( name, value ) {4629 // setting 'undefined' is a no-op4630 if ( arguments.length === 2 && value === undefined ) {4631 return this;4632 }4633 return jquery.access( this, name, value, true, function( elem, name, value ) {4634 return value !== undefined ?4635 jquery.style( elem, name, value ) :4636 jquery.css( elem, name );4637 });4638};4639jquery.extend({4640 // add in style property hooks for overriding the default4641 // behavior of getting and setting a style property4642 csshooks: {4643 opacity: {4644 get: function( elem, computed ) {4645 if ( computed ) {4646 // we should always get a number back from opacity4647 var ret = curcss( elem, "opacity", "opacity" );4648 return ret === "" ? "1" : ret;4649 } else {4650 return elem.style.opacity;4651 }4652 }4653 }4654 },4655 // exclude the following css properties to add px4656 cssnumber: {4657 "zindex": true,4658 "fontweight": true,4659 "opacity": true,4660 "zoom": true,4661 "lineheight": true4662 },4663 // add in properties whose names you wish to fix before4664 // setting or getting the value4665 cssprops: {4666 // normalize float css property4667 "float": jquery.support.cssfloat ? "cssfloat" : "stylefloat"4668 },4669 // get and set the style property on a dom node4670 style: function( elem, name, value, extra ) {4671 // don't set styles on text and comment nodes4672 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || !elem.style ) {4673 return;4674 }4675 // make sure that we're working with the right name4676 var ret, origname = jquery.camelcase( name ),4677 style = elem.style, hooks = jquery.csshooks[ origname ];4678 name = jquery.cssprops[ origname ] || origname;4679 // check if we're setting a value4680 if ( value !== undefined ) {4681 // make sure that nan and null values aren't set. see: #71164682 if ( typeof value === "number" && isnan( value ) || value == null ) {4683 return;4684 }4685 // if a number was passed in, add 'px' to the (except for certain css properties)4686 if ( typeof value === "number" && !jquery.cssnumber[ origname ] ) {4687 value += "px";4688 }4689 // if a hook was provided, use that value, otherwise just set the specified value4690 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {4691 // wrapped to prevent ie from throwing errors when 'invalid' values are provided4692 // fixes bug #55094693 try {4694 style[ name ] = value;4695 } catch(e) {}4696 }4697 } else {4698 // if a hook was provided get the non-computed value from there4699 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {4700 return ret;4701 }4702 // otherwise just get the value from the style object4703 return style[ name ];4704 }4705 },4706 css: function( elem, name, extra ) {4707 // make sure that we're working with the right name4708 var ret, origname = jquery.camelcase( name ),4709 hooks = jquery.csshooks[ origname ];4710 name = jquery.cssprops[ origname ] || origname;4711 // if a hook was provided get the computed value from there4712 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {4713 return ret;4714 // otherwise, if a way to get the computed value exists, use that4715 } else if ( curcss ) {4716 return curcss( elem, name, origname );4717 }4718 },4719 // a method for quickly swapping in/out css properties to get correct calculations4720 swap: function( elem, options, callback ) {4721 var old = {};4722 // remember the old values, and insert the new ones4723 for ( var name in options ) {4724 old[ name ] = elem.style[ name ];4725 elem.style[ name ] = options[ name ];4726 }4727 callback.call( elem );4728 // revert the old values4729 for ( name in options ) {4730 elem.style[ name ] = old[ name ];4731 }4732 },4733 camelcase: function( string ) {4734 return string.replace( rdashalpha, fcamelcase );4735 }4736});4737// deprecated, use jquery.css() instead4738jquery.curcss = jquery.css;4739jquery.each(["height", "width"], function( i, name ) {4740 jquery.csshooks[ name ] = {4741 get: function( elem, computed, extra ) {4742 var val;4743 if ( computed ) {4744 if ( elem.offsetwidth !== 0 ) {4745 val = getwh( elem, name, extra );4746 } else {4747 jquery.swap( elem, cssshow, function() {4748 val = getwh( elem, name, extra );4749 });4750 }4751 if ( val <= 0 ) {4752 val = curcss( elem, name, name );4753 if ( val === "0px" && currentstyle ) {4754 val = currentstyle( elem, name, name );4755 }4756 if ( val != null ) {4757 // should return "auto" instead of 0, use 0 for4758 // temporary backwards-compat4759 return val === "" || val === "auto" ? "0px" : val;4760 }4761 }4762 if ( val < 0 || val == null ) {4763 val = elem.style[ name ];4764 // should return "auto" instead of 0, use 0 for4765 // temporary backwards-compat4766 return val === "" || val === "auto" ? "0px" : val;4767 }4768 return typeof val === "string" ? val : val + "px";4769 }4770 },4771 set: function( elem, value ) {4772 if ( rnumpx.test( value ) ) {4773 // ignore negative width and height values #15994774 value = parsefloat(value);4775 if ( value >= 0 ) {4776 return value + "px";4777 }4778 } else {4779 return value;4780 }4781 }4782 };4783});4784if ( !jquery.support.opacity ) {4785 jquery.csshooks.opacity = {4786 get: function( elem, computed ) {4787 // ie uses filters for opacity4788 return ropacity.test((computed && elem.currentstyle ? elem.currentstyle.filter : elem.style.filter) || "") ?4789 (parsefloat(regexp.$1) / 100) + "" :4790 computed ? "1" : "";4791 },4792 set: function( elem, value ) {4793 var style = elem.style;4794 // ie has trouble with opacity if it does not have layout4795 // force it by setting the zoom level4796 style.zoom = 1;4797 // set the alpha filter to set the opacity4798 var opacity = jquery.isnan(value) ?4799 "" :4800 "alpha(opacity=" + value * 100 + ")",4801 filter = style.filter || "";4802 style.filter = ralpha.test(filter) ?4803 filter.replace(ralpha, opacity) :4804 style.filter + ' ' + opacity;4805 }4806 };4807}4808if ( document.defaultview && document.defaultview.getcomputedstyle ) {4809 getcomputedstyle = function( elem, newname, name ) {4810 var ret, defaultview, computedstyle;4811 name = name.replace( rupper, "-$1" ).tolowercase();4812 if ( !(defaultview = elem.ownerdocument.defaultview) ) {4813 return undefined;4814 }4815 if ( (computedstyle = defaultview.getcomputedstyle( elem, null )) ) {4816 ret = computedstyle.getpropertyvalue( name );4817 if ( ret === "" && !jquery.contains( elem.ownerdocument.documentelement, elem ) ) {4818 ret = jquery.style( elem, name );4819 }4820 }4821 return ret;4822 };4823}4824if ( document.documentelement.currentstyle ) {4825 currentstyle = function( elem, name ) {4826 var left,4827 ret = elem.currentstyle && elem.currentstyle[ name ],4828 rsleft = elem.runtimestyle && elem.runtimestyle[ name ],4829 style = elem.style;4830 // from the awesome hack by dean edwards4831 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022914832 // if we're not dealing with a regular pixel number4833 // but a number that has a weird ending, we need to convert it to pixels4834 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {4835 // remember the original values4836 left = style.left;4837 // put in the new values to get a computed value out4838 if ( rsleft ) {4839 elem.runtimestyle.left = elem.currentstyle.left;4840 }4841 style.left = name === "fontsize" ? "1em" : (ret || 0);4842 ret = style.pixelleft + "px";4843 // revert the changed values4844 style.left = left;4845 if ( rsleft ) {4846 elem.runtimestyle.left = rsleft;4847 }4848 }4849 return ret === "" ? "auto" : ret;4850 };4851}4852curcss = getcomputedstyle || currentstyle;4853function getwh( elem, name, extra ) {4854 var which = name === "width" ? csswidth : cssheight,4855 val = name === "width" ? elem.offsetwidth : elem.offsetheight;4856 if ( extra === "border" ) {4857 return val;4858 }4859 jquery.each( which, function() {4860 if ( !extra ) {4861 val -= parsefloat(jquery.css( elem, "padding" + this )) || 0;4862 }4863 if ( extra === "margin" ) {4864 val += parsefloat(jquery.css( elem, "margin" + this )) || 0;4865 } else {4866 val -= parsefloat(jquery.css( elem, "border" + this + "width" )) || 0;4867 }4868 });4869 return val;4870}4871if ( jquery.expr && jquery.expr.filters ) {4872 jquery.expr.filters.hidden = function( elem ) {4873 var width = elem.offsetwidth,4874 height = elem.offsetheight;4875 return (width === 0 && height === 0) || (!jquery.support.reliablehiddenoffsets && (elem.style.display || jquery.css( elem, "display" )) === "none");4876 };4877 jquery.expr.filters.visible = function( elem ) {4878 return !jquery.expr.filters.hidden( elem );4879 };4880}4881var r20 = /%20/g,4882 rbracket = /\[\]$/,4883 rcrlf = /\r?\n/g,4884 rhash = /#.*$/,4885 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // ie leaves an \r character at eol4886 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,4887 // #7653, #8125, #8152: local protocol detection4888 rlocalprotocol = /(?:^file|^widget|\-extension):$/,4889 rnocontent = /^(?:get|head)$/,4890 rprotocol = /^\/\//,4891 rquery = /\?/,4892 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,4893 rselecttextarea = /^(?:select|textarea)/i,4894 rspacesajax = /\s+/,4895 rts = /([?&])_=[^&]*/,4896 rucheaders = /(^|\-)([a-z])/g,4897 rucheadersfunc = function( _, $1, $2 ) {4898 return $1 + $2.touppercase();4899 },4900 rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,4901 // keep a copy of the old load method4902 _load = jquery.fn.load,4903 /* prefilters4904 * 1) they are useful to introduce custom datatypes (see ajax/jsonp.js for an example)4905 * 2) these are called:4906 * - before asking for a transport4907 * - after param serialization (s.data is a string if s.processdata is true)4908 * 3) key is the datatype4909 * 4) the catchall symbol "*" can be used4910 * 5) execution will start with transport datatype and then continue down to "*" if needed4911 */4912 prefilters = {},4913 /* transports bindings4914 * 1) key is the datatype4915 * 2) the catchall symbol "*" can be used4916 * 3) selection will start with transport datatype and then go to "*" if needed4917 */4918 transports = {},4919 // document location4920 ajaxlocation,4921 // document location segments4922 ajaxlocparts;4923// #8138, ie may throw an exception when accessing4924// a field from document.location if document.domain has been set4925try {4926 ajaxlocation = document.location.href;4927} catch( e ) {4928 // use the href attribute of an a element4929 // since ie will modify it given document.location4930 ajaxlocation = document.createelement( "a" );4931 ajaxlocation.href = "";4932 ajaxlocation = ajaxlocation.href;4933}4934// segment location into parts4935ajaxlocparts = rurl.exec( ajaxlocation.tolowercase() );4936// base "constructor" for jquery.ajaxprefilter and jquery.ajaxtransport4937function addtoprefiltersortransports( structure ) {4938 // datatypeexpression is optional and defaults to "*"4939 return function( datatypeexpression, func ) {4940 if ( typeof datatypeexpression !== "string" ) {4941 func = datatypeexpression;4942 datatypeexpression = "*";4943 }4944 if ( jquery.isfunction( func ) ) {4945 var datatypes = datatypeexpression.tolowercase().split( rspacesajax ),4946 i = 0,4947 length = datatypes.length,4948 datatype,4949 list,4950 placebefore;4951 // for each datatype in the datatypeexpression4952 for(; i < length; i++ ) {4953 datatype = datatypes[ i ];4954 // we control if we're asked to add before4955 // any existing element4956 placebefore = /^\+/.test( datatype );4957 if ( placebefore ) {4958 datatype = datatype.substr( 1 ) || "*";4959 }4960 list = structure[ datatype ] = structure[ datatype ] || [];4961 // then we add to the structure accordingly4962 list[ placebefore ? "unshift" : "push" ]( func );4963 }4964 }4965 };4966}4967//base inspection function for prefilters and transports4968function inspectprefiltersortransports( structure, options, originaloptions, jqxhr,4969 datatype /* internal */, inspected /* internal */ ) {4970 datatype = datatype || options.datatypes[ 0 ];4971 inspected = inspected || {};4972 inspected[ datatype ] = true;4973 var list = structure[ datatype ],4974 i = 0,4975 length = list ? list.length : 0,4976 executeonly = ( structure === prefilters ),4977 selection;4978 for(; i < length && ( executeonly || !selection ); i++ ) {4979 selection = list[ i ]( options, originaloptions, jqxhr );4980 // if we got redirected to another datatype4981 // we try there if executing only and not done already4982 if ( typeof selection === "string" ) {4983 if ( !executeonly || inspected[ selection ] ) {4984 selection = undefined;4985 } else {4986 options.datatypes.unshift( selection );4987 selection = inspectprefiltersortransports(4988 structure, options, originaloptions, jqxhr, selection, inspected );4989 }4990 }4991 }4992 // if we're only executing or nothing was selected4993 // we try the catchall datatype if not done already4994 if ( ( executeonly || !selection ) && !inspected[ "*" ] ) {4995 selection = inspectprefiltersortransports(4996 structure, options, originaloptions, jqxhr, "*", inspected );4997 }4998 // unnecessary when only executing (prefilters)4999 // but it'll be ignored by the caller in that case5000 return selection;5001}5002jquery.fn.extend({5003 load: function( url, params, callback ) {5004 if ( typeof url !== "string" && _load ) {5005 return _load.apply( this, arguments );5006 // don't do a request if no elements are being requested5007 } else if ( !this.length ) {5008 return this;5009 }5010 var off = url.indexof( " " );5011 if ( off >= 0 ) {5012 var selector = url.slice( off, url.length );5013 url = url.slice( 0, off );5014 }5015 // default to a get request5016 var type = "get";5017 // if the second parameter was provided5018 if ( params ) {5019 // if it's a function5020 if ( jquery.isfunction( params ) ) {5021 // we assume that it's the callback5022 callback = params;5023 params = undefined;5024 // otherwise, build a param string5025 } else if ( typeof params === "object" ) {5026 params = jquery.param( params, jquery.ajaxsettings.traditional );5027 type = "post";5028 }5029 }5030 var self = this;5031 // request the remote document5032 jquery.ajax({5033 url: url,5034 type: type,5035 datatype: "html",5036 data: params,5037 // complete callback (responsetext is used internally)5038 complete: function( jqxhr, status, responsetext ) {5039 // store the response as specified by the jqxhr object5040 responsetext = jqxhr.responsetext;5041 // if successful, inject the html into all the matched elements5042 if ( jqxhr.isresolved() ) {5043 // #4825: get the actual response in case5044 // a datafilter is present in ajaxsettings5045 jqxhr.done(function( r ) {5046 responsetext = r;5047 });5048 // see if a selector was specified5049 self.html( selector ?5050 // create a dummy div to hold the results5051 jquery("<div>")5052 // inject the contents of the document in, removing the scripts5053 // to avoid any 'permission denied' errors in ie5054 .append(responsetext.replace(rscript, ""))5055 // locate the specified elements5056 .find(selector) :5057 // if not, just inject the full result5058 responsetext );5059 }5060 if ( callback ) {5061 self.each( callback, [ responsetext, status, jqxhr ] );5062 }5063 }5064 });5065 return this;5066 },5067 serialize: function() {5068 return jquery.param( this.serializearray() );5069 },5070 serializearray: function() {5071 return this.map(function(){5072 return this.elements ? jquery.makearray( this.elements ) : this;5073 })5074 .filter(function(){5075 return this.name && !this.disabled &&5076 ( this.checked || rselecttextarea.test( this.nodename ) ||5077 rinput.test( this.type ) );5078 })5079 .map(function( i, elem ){5080 var val = jquery( this ).val();5081 return val == null ?5082 null :5083 jquery.isarray( val ) ?5084 jquery.map( val, function( val, i ){5085 return { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };5086 }) :5087 { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };5088 }).get();5089 }5090});5091// attach a bunch of functions for handling common ajax events5092jquery.each( "ajaxstart ajaxstop ajaxcomplete ajaxerror ajaxsuccess ajaxsend".split( " " ), function( i, o ){5093 jquery.fn[ o ] = function( f ){5094 return this.bind( o, f );5095 };5096} );5097jquery.each( [ "get", "post" ], function( i, method ) {5098 jquery[ method ] = function( url, data, callback, type ) {5099 // shift arguments if data argument was omitted5100 if ( jquery.isfunction( data ) ) {5101 type = type || callback;5102 callback = data;5103 data = undefined;5104 }5105 return jquery.ajax({5106 type: method,5107 url: url,5108 data: data,5109 success: callback,5110 datatype: type5111 });5112 };5113} );5114jquery.extend({5115 getscript: function( url, callback ) {5116 return jquery.get( url, undefined, callback, "script" );5117 },5118 getjson: function( url, data, callback ) {5119 return jquery.get( url, data, callback, "json" );5120 },5121 // creates a full fledged settings object into target5122 // with both ajaxsettings and settings fields.5123 // if target is omitted, writes into ajaxsettings.5124 ajaxsetup: function ( target, settings ) {5125 if ( !settings ) {5126 // only one parameter, we extend ajaxsettings5127 settings = target;5128 target = jquery.extend( true, jquery.ajaxsettings, settings );5129 } else {5130 // target was provided, we extend into it5131 jquery.extend( true, target, jquery.ajaxsettings, settings );5132 }5133 // flatten fields we don't want deep extended5134 for( var field in { context: 1, url: 1 } ) {5135 if ( field in settings ) {5136 target[ field ] = settings[ field ];5137 } else if( field in jquery.ajaxsettings ) {5138 target[ field ] = jquery.ajaxsettings[ field ];5139 }5140 }5141 return target;5142 },5143 ajaxsettings: {5144 url: ajaxlocation,5145 islocal: rlocalprotocol.test( ajaxlocparts[ 1 ] ),5146 global: true,5147 type: "get",5148 contenttype: "application/x-www-form-urlencoded",5149 processdata: true,5150 async: true,5151 /*5152 timeout: 0,5153 data: null,5154 datatype: null,5155 username: null,5156 password: null,5157 cache: null,5158 traditional: false,5159 headers: {},5160 crossdomain: null,5161 */5162 accepts: {5163 xml: "application/xml, text/xml",5164 html: "text/html",5165 text: "text/plain",5166 json: "application/json, text/javascript",5167 "*": "*/*"5168 },5169 contents: {5170 xml: /xml/,5171 html: /html/,5172 json: /json/5173 },5174 responsefields: {5175 xml: "responsexml",5176 text: "responsetext"5177 },5178 // list of data converters5179 // 1) key format is "source_type destination_type" (a single space in-between)5180 // 2) the catchall symbol "*" can be used for source_type5181 converters: {5182 // convert anything to text5183 "* text": window.string,5184 // text to html (true = no transformation)5185 "text html": true,5186 // evaluate text as a json expression5187 "text json": jquery.parsejson,5188 // parse text as xml5189 "text xml": jquery.parsexml5190 }5191 },5192 ajaxprefilter: addtoprefiltersortransports( prefilters ),5193 ajaxtransport: addtoprefiltersortransports( transports ),5194 // main method5195 ajax: function( url, options ) {5196 // if url is an object, simulate pre-1.5 signature5197 if ( typeof url === "object" ) {5198 options = url;5199 url = undefined;5200 }5201 // force options to be an object5202 options = options || {};5203 var // create the final options object5204 s = jquery.ajaxsetup( {}, options ),5205 // callbacks context5206 callbackcontext = s.context || s,5207 // context for global events5208 // it's the callbackcontext if one was provided in the options5209 // and if it's a dom node or a jquery collection5210 globaleventcontext = callbackcontext !== s &&5211 ( callbackcontext.nodetype || callbackcontext instanceof jquery ) ?5212 jquery( callbackcontext ) : jquery.event,5213 // deferreds5214 deferred = jquery.deferred(),5215 completedeferred = jquery._deferred(),5216 // status-dependent callbacks5217 statuscode = s.statuscode || {},5218 // ifmodified key5219 ifmodifiedkey,5220 // headers (they are sent all at once)5221 requestheaders = {},5222 // response headers5223 responseheadersstring,5224 responseheaders,5225 // transport5226 transport,5227 // timeout handle5228 timeouttimer,5229 // cross-domain detection vars5230 parts,5231 // the jqxhr state5232 state = 0,5233 // to know if global events are to be dispatched5234 fireglobals,5235 // loop variable5236 i,5237 // fake xhr5238 jqxhr = {5239 readystate: 0,5240 // caches the header5241 setrequestheader: function( name, value ) {5242 if ( !state ) {5243 requestheaders[ name.tolowercase().replace( rucheaders, rucheadersfunc ) ] = value;5244 }5245 return this;5246 },5247 // raw string5248 getallresponseheaders: function() {5249 return state === 2 ? responseheadersstring : null;5250 },5251 // builds headers hashtable if needed5252 getresponseheader: function( key ) {5253 var match;5254 if ( state === 2 ) {5255 if ( !responseheaders ) {5256 responseheaders = {};5257 while( ( match = rheaders.exec( responseheadersstring ) ) ) {5258 responseheaders[ match[1].tolowercase() ] = match[ 2 ];5259 }5260 }5261 match = responseheaders[ key.tolowercase() ];5262 }5263 return match === undefined ? null : match;5264 },5265 // overrides response content-type header5266 overridemimetype: function( type ) {5267 if ( !state ) {5268 s.mimetype = type;5269 }5270 return this;5271 },5272 // cancel the request5273 abort: function( statustext ) {5274 statustext = statustext || "abort";5275 if ( transport ) {5276 transport.abort( statustext );5277 }5278 done( 0, statustext );5279 return this;5280 }5281 };5282 // callback for when everything is done5283 // it is defined here because jslint complains if it is declared5284 // at the end of the function (which would be more logical and readable)5285 function done( status, statustext, responses, headers ) {5286 // called once5287 if ( state === 2 ) {5288 return;5289 }5290 // state is "done" now5291 state = 2;5292 // clear timeout if it exists5293 if ( timeouttimer ) {5294 cleartimeout( timeouttimer );5295 }5296 // dereference transport for early garbage collection5297 // (no matter how long the jqxhr object will be used)5298 transport = undefined;5299 // cache response headers5300 responseheadersstring = headers || "";5301 // set readystate5302 jqxhr.readystate = status ? 4 : 0;5303 var issuccess,5304 success,5305 error,5306 response = responses ? ajaxhandleresponses( s, jqxhr, responses ) : undefined,5307 lastmodified,5308 etag;5309 // if successful, handle type chaining5310 if ( status >= 200 && status < 300 || status === 304 ) {5311 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.5312 if ( s.ifmodified ) {5313 if ( ( lastmodified = jqxhr.getresponseheader( "last-modified" ) ) ) {5314 jquery.lastmodified[ ifmodifiedkey ] = lastmodified;5315 }5316 if ( ( etag = jqxhr.getresponseheader( "etag" ) ) ) {5317 jquery.etag[ ifmodifiedkey ] = etag;5318 }5319 }5320 // if not modified5321 if ( status === 304 ) {5322 statustext = "notmodified";5323 issuccess = true;5324 // if we have data5325 } else {5326 try {5327 success = ajaxconvert( s, response );5328 statustext = "success";5329 issuccess = true;5330 } catch(e) {5331 // we have a parsererror5332 statustext = "parsererror";5333 error = e;5334 }5335 }5336 } else {5337 // we extract error from statustext5338 // then normalize statustext and status for non-aborts5339 error = statustext;5340 if( !statustext || status ) {5341 statustext = "error";5342 if ( status < 0 ) {5343 status = 0;5344 }5345 }5346 }5347 // set data for the fake xhr object5348 jqxhr.status = status;5349 jqxhr.statustext = statustext;5350 // success/error5351 if ( issuccess ) {5352 deferred.resolvewith( callbackcontext, [ success, statustext, jqxhr ] );5353 } else {5354 deferred.rejectwith( callbackcontext, [ jqxhr, statustext, error ] );5355 }5356 // status-dependent callbacks5357 jqxhr.statuscode( statuscode );5358 statuscode = undefined;5359 if ( fireglobals ) {5360 globaleventcontext.trigger( "ajax" + ( issuccess ? "success" : "error" ),5361 [ jqxhr, s, issuccess ? success : error ] );5362 }5363 // complete5364 completedeferred.resolvewith( callbackcontext, [ jqxhr, statustext ] );5365 if ( fireglobals ) {5366 globaleventcontext.trigger( "ajaxcomplete", [ jqxhr, s] );5367 // handle the global ajax counter5368 if ( !( --jquery.active ) ) {5369 jquery.event.trigger( "ajaxstop" );5370 }5371 }5372 }5373 // attach deferreds5374 deferred.promise( jqxhr );5375 jqxhr.success = jqxhr.done;5376 jqxhr.error = jqxhr.fail;5377 jqxhr.complete = completedeferred.done;5378 // status-dependent callbacks5379 jqxhr.statuscode = function( map ) {5380 if ( map ) {5381 var tmp;5382 if ( state < 2 ) {5383 for( tmp in map ) {5384 statuscode[ tmp ] = [ statuscode[tmp], map[tmp] ];5385 }5386 } else {5387 tmp = map[ jqxhr.status ];5388 jqxhr.then( tmp, tmp );5389 }5390 }5391 return this;5392 };5393 // remove hash character (#7531: and string promotion)5394 // add protocol if not provided (#5866: ie7 issue with protocol-less urls)5395 // we also use the url parameter if available5396 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxlocparts[ 1 ] + "//" );5397 // extract datatypes list5398 s.datatypes = jquery.trim( s.datatype || "*" ).tolowercase().split( rspacesajax );5399 // determine if a cross-domain request is in order5400 if ( !s.crossdomain ) {5401 parts = rurl.exec( s.url.tolowercase() );5402 s.crossdomain = !!( parts &&5403 ( parts[ 1 ] != ajaxlocparts[ 1 ] || parts[ 2 ] != ajaxlocparts[ 2 ] ||5404 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=5405 ( ajaxlocparts[ 3 ] || ( ajaxlocparts[ 1 ] === "http:" ? 80 : 443 ) ) )5406 );5407 }5408 // convert data if not already a string5409 if ( s.data && s.processdata && typeof s.data !== "string" ) {5410 s.data = jquery.param( s.data, s.traditional );5411 }5412 // apply prefilters5413 inspectprefiltersortransports( prefilters, s, options, jqxhr );5414 // if request was aborted inside a prefiler, stop there5415 if ( state === 2 ) {5416 return false;5417 }5418 // we can fire global events as of now if asked to5419 fireglobals = s.global;5420 // uppercase the type5421 s.type = s.type.touppercase();5422 // determine if request has content5423 s.hascontent = !rnocontent.test( s.type );5424 // watch for a new set of requests5425 if ( fireglobals && jquery.active++ === 0 ) {5426 jquery.event.trigger( "ajaxstart" );5427 }5428 // more options handling for requests with no content5429 if ( !s.hascontent ) {5430 // if data is available, append data to url5431 if ( s.data ) {5432 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;5433 }5434 // get ifmodifiedkey before adding the anti-cache parameter5435 ifmodifiedkey = s.url;5436 // add anti-cache in url if needed5437 if ( s.cache === false ) {5438 var ts = jquery.now(),5439 // try replacing _= if it is there5440 ret = s.url.replace( rts, "$1_=" + ts );5441 // if nothing was replaced, add timestamp to the end5442 s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );5443 }5444 }5445 // set the correct header, if data is being sent5446 if ( s.data && s.hascontent && s.contenttype !== false || options.contenttype ) {5447 requestheaders[ "content-type" ] = s.contenttype;5448 }5449 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.5450 if ( s.ifmodified ) {5451 ifmodifiedkey = ifmodifiedkey || s.url;5452 if ( jquery.lastmodified[ ifmodifiedkey ] ) {5453 requestheaders[ "if-modified-since" ] = jquery.lastmodified[ ifmodifiedkey ];5454 }5455 if ( jquery.etag[ ifmodifiedkey ] ) {5456 requestheaders[ "if-none-match" ] = jquery.etag[ ifmodifiedkey ];5457 }5458 }5459 // set the accepts header for the server, depending on the datatype5460 requestheaders.accept = s.datatypes[ 0 ] && s.accepts[ s.datatypes[0] ] ?5461 s.accepts[ s.datatypes[0] ] + ( s.datatypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :5462 s.accepts[ "*" ];5463 // check for headers option5464 for ( i in s.headers ) {5465 jqxhr.setrequestheader( i, s.headers[ i ] );5466 }5467 // allow custom headers/mimetypes and early abort5468 if ( s.beforesend && ( s.beforesend.call( callbackcontext, jqxhr, s ) === false || state === 2 ) ) {5469 // abort if not done already5470 jqxhr.abort();5471 return false;5472 }5473 // install callbacks on deferreds5474 for ( i in { success: 1, error: 1, complete: 1 } ) {5475 jqxhr[ i ]( s[ i ] );5476 }5477 // get transport5478 transport = inspectprefiltersortransports( transports, s, options, jqxhr );5479 // if no transport, we auto-abort5480 if ( !transport ) {5481 done( -1, "no transport" );5482 } else {5483 jqxhr.readystate = 1;5484 // send global event5485 if ( fireglobals ) {5486 globaleventcontext.trigger( "ajaxsend", [ jqxhr, s ] );5487 }5488 // timeout5489 if ( s.async && s.timeout > 0 ) {5490 timeouttimer = settimeout( function(){5491 jqxhr.abort( "timeout" );5492 }, s.timeout );5493 }5494 try {5495 state = 1;5496 transport.send( requestheaders, done );5497 } catch (e) {5498 // propagate exception as error if not done5499 if ( status < 2 ) {5500 done( -1, e );5501 // simply rethrow otherwise5502 } else {5503 jquery.error( e );5504 }5505 }5506 }5507 return jqxhr;5508 },5509 // serialize an array of form elements or a set of5510 // key/values into a query string5511 param: function( a, traditional ) {5512 var s = [],5513 add = function( key, value ) {5514 // if value is a function, invoke it and return its value5515 value = jquery.isfunction( value ) ? value() : value;5516 s[ s.length ] = encodeuricomponent( key ) + "=" + encodeuricomponent( value );5517 };5518 // set traditional to true for jquery <= 1.3.2 behavior.5519 if ( traditional === undefined ) {5520 traditional = jquery.ajaxsettings.traditional;5521 }5522 // if an array was passed in, assume that it is an array of form elements.5523 if ( jquery.isarray( a ) || ( a.jquery && !jquery.isplainobject( a ) ) ) {5524 // serialize the form elements5525 jquery.each( a, function() {5526 add( this.name, this.value );5527 } );5528 } else {5529 // if traditional, encode the "old" way (the way 1.3.2 or older5530 // did it), otherwise encode params recursively.5531 for ( var prefix in a ) {5532 buildparams( prefix, a[ prefix ], traditional, add );5533 }5534 }5535 // return the resulting serialization5536 return s.join( "&" ).replace( r20, "+" );5537 }5538});5539function buildparams( prefix, obj, traditional, add ) {5540 if ( jquery.isarray( obj ) && obj.length ) {5541 // serialize array item.5542 jquery.each( obj, function( i, v ) {5543 if ( traditional || rbracket.test( prefix ) ) {5544 // treat each array item as a scalar.5545 add( prefix, v );5546 } else {5547 // if array item is non-scalar (array or object), encode its5548 // numeric index to resolve deserialization ambiguity issues.5549 // note that rack (as of 1.0.0) can't currently deserialize5550 // nested arrays properly, and attempting to do so may cause5551 // a server error. possible fixes are to modify rack's5552 // deserialization algorithm or to provide an option or flag5553 // to force array serialization to be shallow.5554 buildparams( prefix + "[" + ( typeof v === "object" || jquery.isarray(v) ? i : "" ) + "]", v, traditional, add );5555 }5556 });5557 } else if ( !traditional && obj != null && typeof obj === "object" ) {5558 // if we see an array here, it is empty and should be treated as an empty5559 // object5560 if ( jquery.isarray( obj ) || jquery.isemptyobject( obj ) ) {5561 add( prefix, "" );5562 // serialize object item.5563 } else {5564 for ( var name in obj ) {5565 buildparams( prefix + "[" + name + "]", obj[ name ], traditional, add );5566 }5567 }5568 } else {5569 // serialize scalar item.5570 add( prefix, obj );5571 }5572}5573// this is still on the jquery object... for now5574// want to move this to jquery.ajax some day5575jquery.extend({5576 // counter for holding the number of active queries5577 active: 0,5578 // last-modified header cache for next request5579 lastmodified: {},5580 etag: {}5581});5582/* handles responses to an ajax request:5583 * - sets all responsexxx fields accordingly5584 * - finds the right datatype (mediates between content-type and expected datatype)5585 * - returns the corresponding response5586 */5587function ajaxhandleresponses( s, jqxhr, responses ) {5588 var contents = s.contents,5589 datatypes = s.datatypes,5590 responsefields = s.responsefields,5591 ct,5592 type,5593 finaldatatype,5594 firstdatatype;5595 // fill responsexxx fields5596 for( type in responsefields ) {5597 if ( type in responses ) {5598 jqxhr[ responsefields[type] ] = responses[ type ];5599 }5600 }5601 // remove auto datatype and get content-type in the process5602 while( datatypes[ 0 ] === "*" ) {5603 datatypes.shift();5604 if ( ct === undefined ) {5605 ct = s.mimetype || jqxhr.getresponseheader( "content-type" );5606 }5607 }5608 // check if we're dealing with a known content-type5609 if ( ct ) {5610 for ( type in contents ) {5611 if ( contents[ type ] && contents[ type ].test( ct ) ) {5612 datatypes.unshift( type );5613 break;5614 }5615 }5616 }5617 // check to see if we have a response for the expected datatype5618 if ( datatypes[ 0 ] in responses ) {5619 finaldatatype = datatypes[ 0 ];5620 } else {5621 // try convertible datatypes5622 for ( type in responses ) {5623 if ( !datatypes[ 0 ] || s.converters[ type + " " + datatypes[0] ] ) {5624 finaldatatype = type;5625 break;5626 }5627 if ( !firstdatatype ) {5628 firstdatatype = type;5629 }5630 }5631 // or just use first one5632 finaldatatype = finaldatatype || firstdatatype;5633 }5634 // if we found a datatype5635 // we add the datatype to the list if needed5636 // and return the corresponding response5637 if ( finaldatatype ) {5638 if ( finaldatatype !== datatypes[ 0 ] ) {5639 datatypes.unshift( finaldatatype );5640 }5641 return responses[ finaldatatype ];5642 }5643}5644// chain conversions given the request and the original response5645function ajaxconvert( s, response ) {5646 // apply the datafilter if provided5647 if ( s.datafilter ) {5648 response = s.datafilter( response, s.datatype );5649 }5650 var datatypes = s.datatypes,5651 converters = {},5652 i,5653 key,5654 length = datatypes.length,5655 tmp,5656 // current and previous datatypes5657 current = datatypes[ 0 ],5658 prev,5659 // conversion expression5660 conversion,5661 // conversion function5662 conv,5663 // conversion functions (transitive conversion)5664 conv1,5665 conv2;5666 // for each datatype in the chain5667 for( i = 1; i < length; i++ ) {5668 // create converters map5669 // with lowercased keys5670 if ( i === 1 ) {5671 for( key in s.converters ) {5672 if( typeof key === "string" ) {5673 converters[ key.tolowercase() ] = s.converters[ key ];5674 }5675 }5676 }5677 // get the datatypes5678 prev = current;5679 current = datatypes[ i ];5680 // if current is auto datatype, update it to prev5681 if( current === "*" ) {5682 current = prev;5683 // if no auto and datatypes are actually different5684 } else if ( prev !== "*" && prev !== current ) {5685 // get the converter5686 conversion = prev + " " + current;5687 conv = converters[ conversion ] || converters[ "* " + current ];5688 // if there is no direct converter, search transitively5689 if ( !conv ) {5690 conv2 = undefined;5691 for( conv1 in converters ) {5692 tmp = conv1.split( " " );5693 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {5694 conv2 = converters[ tmp[1] + " " + current ];5695 if ( conv2 ) {5696 conv1 = converters[ conv1 ];5697 if ( conv1 === true ) {5698 conv = conv2;5699 } else if ( conv2 === true ) {5700 conv = conv1;5701 }5702 break;5703 }5704 }5705 }5706 }5707 // if we found no converter, dispatch an error5708 if ( !( conv || conv2 ) ) {5709 jquery.error( "no conversion from " + conversion.replace(" "," to ") );5710 }5711 // if found converter is not an equivalence5712 if ( conv !== true ) {5713 // convert with 1 or 2 converters accordingly5714 response = conv ? conv( response ) : conv2( conv1(response) );5715 }5716 }5717 }5718 return response;5719}5720var jsc = jquery.now(),5721 jsre = /(\=)\?(&|$)|()\?\?()/i;5722// default jsonp settings5723jquery.ajaxsetup({5724 jsonp: "callback",5725 jsonpcallback: function() {5726 return jquery.expando + "_" + ( jsc++ );5727 }5728});5729// detect, normalize options and install callbacks for jsonp requests5730jquery.ajaxprefilter( "json jsonp", function( s, originalsettings, jqxhr ) {5731 var dataisstring = ( typeof s.data === "string" );5732 if ( s.datatypes[ 0 ] === "jsonp" ||5733 originalsettings.jsonpcallback ||5734 originalsettings.jsonp != null ||5735 s.jsonp !== false && ( jsre.test( s.url ) ||5736 dataisstring && jsre.test( s.data ) ) ) {5737 var responsecontainer,5738 jsonpcallback = s.jsonpcallback =5739 jquery.isfunction( s.jsonpcallback ) ? s.jsonpcallback() : s.jsonpcallback,5740 previous = window[ jsonpcallback ],5741 url = s.url,5742 data = s.data,5743 replace = "$1" + jsonpcallback + "$2",5744 cleanup = function() {5745 // set callback back to previous value5746 window[ jsonpcallback ] = previous;5747 // call if it was a function and we have a response5748 if ( responsecontainer && jquery.isfunction( previous ) ) {5749 window[ jsonpcallback ]( responsecontainer[ 0 ] );5750 }5751 };5752 if ( s.jsonp !== false ) {5753 url = url.replace( jsre, replace );5754 if ( s.url === url ) {5755 if ( dataisstring ) {5756 data = data.replace( jsre, replace );5757 }5758 if ( s.data === data ) {5759 // add callback manually5760 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpcallback;5761 }5762 }5763 }5764 s.url = url;5765 s.data = data;5766 // install callback5767 window[ jsonpcallback ] = function( response ) {5768 responsecontainer = [ response ];5769 };5770 // install cleanup function5771 jqxhr.then( cleanup, cleanup );5772 // use data converter to retrieve json after script execution5773 s.converters["script json"] = function() {5774 if ( !responsecontainer ) {5775 jquery.error( jsonpcallback + " was not called" );5776 }5777 return responsecontainer[ 0 ];5778 };5779 // force json datatype5780 s.datatypes[ 0 ] = "json";5781 // delegate to script5782 return "script";5783 }5784} );5785// install script datatype5786jquery.ajaxsetup({5787 accepts: {5788 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"5789 },5790 contents: {5791 script: /javascript|ecmascript/5792 },5793 converters: {5794 "text script": function( text ) {5795 jquery.globaleval( text );5796 return text;5797 }5798 }5799});5800// handle cache's special case and global5801jquery.ajaxprefilter( "script", function( s ) {5802 if ( s.cache === undefined ) {5803 s.cache = false;5804 }5805 if ( s.crossdomain ) {5806 s.type = "get";5807 s.global = false;5808 }5809} );5810// bind script tag hack transport5811jquery.ajaxtransport( "script", function(s) {5812 // this transport only deals with cross domain requests5813 if ( s.crossdomain ) {5814 var script,5815 head = document.head || document.getelementsbytagname( "head" )[0] || document.documentelement;5816 return {5817 send: function( _, callback ) {5818 script = document.createelement( "script" );5819 script.async = "async";5820 if ( s.scriptcharset ) {5821 script.charset = s.scriptcharset;5822 }5823 script.src = s.url;5824 // attach handlers for all browsers5825 script.onload = script.onreadystatechange = function( _, isabort ) {5826 if ( !script.readystate || /loaded|complete/.test( script.readystate ) ) {5827 // handle memory leak in ie5828 script.onload = script.onreadystatechange = null;5829 // remove the script5830 if ( head && script.parentnode ) {5831 head.removechild( script );5832 }5833 // dereference the script5834 script = undefined;5835 // callback if not abort5836 if ( !isabort ) {5837 callback( 200, "success" );5838 }5839 }5840 };5841 // use insertbefore instead of appendchild to circumvent an ie6 bug.5842 // this arises when a base node is used (#2709 and #4378).5843 head.insertbefore( script, head.firstchild );5844 },5845 abort: function() {5846 if ( script ) {5847 script.onload( 0, 1 );5848 }5849 }5850 };5851 }5852} );5853var // #5280: next active xhr id and list of active xhrs' callbacks5854 xhrid = jquery.now(),5855 xhrcallbacks,5856 // xhr used to determine supports properties5857 testxhr;5858// #5280: internet explorer will keep connections alive if we don't abort on unload5859function xhronunloadabort() {5860 jquery( window ).unload(function() {5861 // abort all pending requests5862 for ( var key in xhrcallbacks ) {5863 xhrcallbacks[ key ]( 0, 1 );5864 }5865 });5866}5867// functions to create xhrs5868function createstandardxhr() {5869 try {5870 return new window.xmlhttprequest();5871 } catch( e ) {}5872}5873function createactivexhr() {5874 try {5875 return new window.activexobject( "microsoft.xmlhttp" );5876 } catch( e ) {}5877}5878// create the request object5879// (this is still attached to ajaxsettings for backward compatibility)5880jquery.ajaxsettings.xhr = window.activexobject ?5881 /* microsoft failed to properly5882 * implement the xmlhttprequest in ie7 (can't request local files),5883 * so we use the activexobject when it is available5884 * additionally xmlhttprequest can be disabled in ie7/ie8 so5885 * we need a fallback.5886 */5887 function() {5888 return !this.islocal && createstandardxhr() || createactivexhr();5889 } :5890 // for all other browsers, use the standard xmlhttprequest object5891 createstandardxhr;5892// test if we can create an xhr object5893testxhr = jquery.ajaxsettings.xhr();5894jquery.support.ajax = !!testxhr;5895// does this browser support crossdomain xhr requests5896jquery.support.cors = testxhr && ( "withcredentials" in testxhr );5897// no need for the temporary xhr anymore5898testxhr = undefined;5899// create transport if the browser can provide an xhr5900if ( jquery.support.ajax ) {5901 jquery.ajaxtransport(function( s ) {5902 // cross domain only allowed if supported through xmlhttprequest5903 if ( !s.crossdomain || jquery.support.cors ) {5904 var callback;5905 return {5906 send: function( headers, complete ) {5907 // get a new xhr5908 var xhr = s.xhr(),5909 handle,5910 i;5911 // open the socket5912 // passing null username, generates a login popup on opera (#2865)5913 if ( s.username ) {5914 xhr.open( s.type, s.url, s.async, s.username, s.password );5915 } else {5916 xhr.open( s.type, s.url, s.async );5917 }5918 // apply custom fields if provided5919 if ( s.xhrfields ) {5920 for ( i in s.xhrfields ) {5921 xhr[ i ] = s.xhrfields[ i ];5922 }5923 }5924 // override mime type if needed5925 if ( s.mimetype && xhr.overridemimetype ) {5926 xhr.overridemimetype( s.mimetype );5927 }5928 // requested-with header5929 // not set for crossdomain requests with no content5930 // (see why at http://trac.dojotoolkit.org/ticket/9486)5931 // won't change header if already provided5932 if ( !( s.crossdomain && !s.hascontent ) && !headers["x-requested-with"] ) {5933 headers[ "x-requested-with" ] = "xmlhttprequest";5934 }5935 // need an extra try/catch for cross domain requests in firefox 35936 try {5937 for ( i in headers ) {5938 xhr.setrequestheader( i, headers[ i ] );5939 }5940 } catch( _ ) {}5941 // do send the request5942 // this may raise an exception which is actually5943 // handled in jquery.ajax (so no try/catch here)5944 xhr.send( ( s.hascontent && s.data ) || null );5945 // listener5946 callback = function( _, isabort ) {5947 var status,5948 statustext,5949 responseheaders,5950 responses,5951 xml;5952 // firefox throws exceptions when accessing properties5953 // of an xhr when a network error occured5954 // http://helpful.knobs-dials.com/index.php/component_returned_failure_code:_0x80040111_(ns_error_not_available)5955 try {5956 // was never called and is aborted or complete5957 if ( callback && ( isabort || xhr.readystate === 4 ) ) {5958 // only called once5959 callback = undefined;5960 // do not keep as active anymore5961 if ( handle ) {5962 xhr.onreadystatechange = jquery.noop;5963 delete xhrcallbacks[ handle ];5964 }5965 // if it's an abort5966 if ( isabort ) {5967 // abort it manually if needed5968 if ( xhr.readystate !== 4 ) {5969 xhr.abort();5970 }5971 } else {5972 status = xhr.status;5973 responseheaders = xhr.getallresponseheaders();5974 responses = {};5975 xml = xhr.responsexml;5976 // construct response list5977 if ( xml && xml.documentelement /* #4958 */ ) {5978 responses.xml = xml;5979 }5980 responses.text = xhr.responsetext;5981 // firefox throws an exception when accessing5982 // statustext for faulty cross-domain requests5983 try {5984 statustext = xhr.statustext;5985 } catch( e ) {5986 // we normalize with webkit giving an empty statustext5987 statustext = "";5988 }5989 // filter status for non standard behaviors5990 // if the request is local and we have data: assume a success5991 // (success with no data won't get notified, that's the best we5992 // can do given current implementations)5993 if ( !status && s.islocal && !s.crossdomain ) {5994 status = responses.text ? 200 : 404;5995 // ie - #1450: sometimes returns 1223 when it should be 2045996 } else if ( status === 1223 ) {5997 status = 204;5998 }5999 }6000 }6001 } catch( firefoxaccessexception ) {6002 if ( !isabort ) {6003 complete( -1, firefoxaccessexception );6004 }6005 }6006 // call complete if needed6007 if ( responses ) {6008 complete( status, statustext, responses, responseheaders );6009 }6010 };6011 // if we're in sync mode or it's in cache6012 // and has been retrieved directly (ie6 & ie7)6013 // we need to manually fire the callback6014 if ( !s.async || xhr.readystate === 4 ) {6015 callback();6016 } else {6017 // create the active xhrs callbacks list if needed6018 // and attach the unload handler6019 if ( !xhrcallbacks ) {6020 xhrcallbacks = {};6021 xhronunloadabort();6022 }6023 // add to list of active xhrs callbacks6024 handle = xhrid++;6025 xhr.onreadystatechange = xhrcallbacks[ handle ] = callback;6026 }6027 },6028 abort: function() {6029 if ( callback ) {6030 callback(0,1);6031 }6032 }6033 };6034 }6035 });6036}6037var elemdisplay = {},6038 rfxtypes = /^(?:toggle|show|hide)$/,6039 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,6040 timerid,6041 fxattrs = [6042 // height animations6043 [ "height", "margintop", "marginbottom", "paddingtop", "paddingbottom" ],6044 // width animations6045 [ "width", "marginleft", "marginright", "paddingleft", "paddingright" ],6046 // opacity animations6047 [ "opacity" ]6048 ];6049jquery.fn.extend({6050 show: function( speed, easing, callback ) {6051 var elem, display;6052 if ( speed || speed === 0 ) {6053 return this.animate( genfx("show", 3), speed, easing, callback);6054 } else {6055 for ( var i = 0, j = this.length; i < j; i++ ) {6056 elem = this[i];6057 display = elem.style.display;6058 // reset the inline display of this element to learn if it is6059 // being hidden by cascaded rules or not6060 if ( !jquery._data(elem, "olddisplay") && display === "none" ) {6061 display = elem.style.display = "";6062 }6063 // set elements which have been overridden with display: none6064 // in a stylesheet to whatever the default browser style is6065 // for such an element6066 if ( display === "" && jquery.css( elem, "display" ) === "none" ) {6067 jquery._data(elem, "olddisplay", defaultdisplay(elem.nodename));6068 }6069 }6070 // set the display of most of the elements in a second loop6071 // to avoid the constant reflow6072 for ( i = 0; i < j; i++ ) {6073 elem = this[i];6074 display = elem.style.display;6075 if ( display === "" || display === "none" ) {6076 elem.style.display = jquery._data(elem, "olddisplay") || "";6077 }6078 }6079 return this;6080 }6081 },6082 hide: function( speed, easing, callback ) {6083 if ( speed || speed === 0 ) {6084 return this.animate( genfx("hide", 3), speed, easing, callback);6085 } else {6086 for ( var i = 0, j = this.length; i < j; i++ ) {6087 var display = jquery.css( this[i], "display" );6088 if ( display !== "none" && !jquery._data( this[i], "olddisplay" ) ) {6089 jquery._data( this[i], "olddisplay", display );6090 }6091 }6092 // set the display of the elements in a second loop6093 // to avoid the constant reflow6094 for ( i = 0; i < j; i++ ) {6095 this[i].style.display = "none";6096 }6097 return this;6098 }6099 },6100 // save the old toggle function6101 _toggle: jquery.fn.toggle,6102 toggle: function( fn, fn2, callback ) {6103 var bool = typeof fn === "boolean";6104 if ( jquery.isfunction(fn) && jquery.isfunction(fn2) ) {6105 this._toggle.apply( this, arguments );6106 } else if ( fn == null || bool ) {6107 this.each(function() {6108 var state = bool ? fn : jquery(this).is(":hidden");6109 jquery(this)[ state ? "show" : "hide" ]();6110 });6111 } else {6112 this.animate(genfx("toggle", 3), fn, fn2, callback);6113 }6114 return this;6115 },6116 fadeto: function( speed, to, easing, callback ) {6117 return this.filter(":hidden").css("opacity", 0).show().end()6118 .animate({opacity: to}, speed, easing, callback);6119 },6120 animate: function( prop, speed, easing, callback ) {6121 var optall = jquery.speed(speed, easing, callback);6122 if ( jquery.isemptyobject( prop ) ) {6123 return this.each( optall.complete );6124 }6125 return this[ optall.queue === false ? "each" : "queue" ](function() {6126 // xxx 'this' does not always have a nodename when running the6127 // test suite6128 var opt = jquery.extend({}, optall), p,6129 iselement = this.nodetype === 1,6130 hidden = iselement && jquery(this).is(":hidden"),6131 self = this;6132 for ( p in prop ) {6133 var name = jquery.camelcase( p );6134 if ( p !== name ) {6135 prop[ name ] = prop[ p ];6136 delete prop[ p ];6137 p = name;6138 }6139 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {6140 return opt.complete.call(this);6141 }6142 if ( iselement && ( p === "height" || p === "width" ) ) {6143 // make sure that nothing sneaks out6144 // record all 3 overflow attributes because ie does not6145 // change the overflow attribute when overflowx and6146 // overflowy are set to the same value6147 opt.overflow = [ this.style.overflow, this.style.overflowx, this.style.overflowy ];6148 // set display property to inline-block for height/width6149 // animations on inline elements that are having width/height6150 // animated6151 if ( jquery.css( this, "display" ) === "inline" &&6152 jquery.css( this, "float" ) === "none" ) {6153 if ( !jquery.support.inlineblockneedslayout ) {6154 this.style.display = "inline-block";6155 } else {6156 var display = defaultdisplay(this.nodename);6157 // inline-level elements accept inline-block;6158 // block-level elements need to be inline with layout6159 if ( display === "inline" ) {6160 this.style.display = "inline-block";6161 } else {6162 this.style.display = "inline";6163 this.style.zoom = 1;6164 }6165 }6166 }6167 }6168 if ( jquery.isarray( prop[p] ) ) {6169 // create (if needed) and add to specialeasing6170 (opt.specialeasing = opt.specialeasing || {})[p] = prop[p][1];6171 prop[p] = prop[p][0];6172 }6173 }6174 if ( opt.overflow != null ) {6175 this.style.overflow = "hidden";6176 }6177 opt.curanim = jquery.extend({}, prop);6178 jquery.each( prop, function( name, val ) {6179 var e = new jquery.fx( self, opt, name );6180 if ( rfxtypes.test(val) ) {6181 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );6182 } else {6183 var parts = rfxnum.exec(val),6184 start = e.cur();6185 if ( parts ) {6186 var end = parsefloat( parts[2] ),6187 unit = parts[3] || ( jquery.cssnumber[ name ] ? "" : "px" );6188 // we need to compute starting value6189 if ( unit !== "px" ) {6190 jquery.style( self, name, (end || 1) + unit);6191 start = ((end || 1) / e.cur()) * start;6192 jquery.style( self, name, start + unit);6193 }6194 // if a +=/-= token was provided, we're doing a relative animation6195 if ( parts[1] ) {6196 end = ((parts[1] === "-=" ? -1 : 1) * end) + start;6197 }6198 e.custom( start, end, unit );6199 } else {6200 e.custom( start, val, "" );6201 }6202 }6203 });6204 // for js strict compliance6205 return true;6206 });6207 },6208 stop: function( clearqueue, gotoend ) {6209 var timers = jquery.timers;6210 if ( clearqueue ) {6211 this.queue([]);6212 }6213 this.each(function() {6214 // go in reverse order so anything added to the queue during the loop is ignored6215 for ( var i = timers.length - 1; i >= 0; i-- ) {6216 if ( timers[i].elem === this ) {6217 if (gotoend) {6218 // force the next step to be the last6219 timers[i](true);6220 }6221 timers.splice(i, 1);6222 }6223 }6224 });6225 // start the next in the queue if the last step wasn't forced6226 if ( !gotoend ) {6227 this.dequeue();6228 }6229 return this;6230 }6231});6232function genfx( type, num ) {6233 var obj = {};6234 jquery.each( fxattrs.concat.apply([], fxattrs.slice(0,num)), function() {6235 obj[ this ] = type;6236 });6237 return obj;6238}6239// generate shortcuts for custom animations6240jquery.each({6241 slidedown: genfx("show", 1),6242 slideup: genfx("hide", 1),6243 slidetoggle: genfx("toggle", 1),6244 fadein: { opacity: "show" },6245 fadeout: { opacity: "hide" },6246 fadetoggle: { opacity: "toggle" }6247}, function( name, props ) {6248 jquery.fn[ name ] = function( speed, easing, callback ) {6249 return this.animate( props, speed, easing, callback );6250 };6251});6252jquery.extend({6253 speed: function( speed, easing, fn ) {6254 var opt = speed && typeof speed === "object" ? jquery.extend({}, speed) : {6255 complete: fn || !fn && easing ||6256 jquery.isfunction( speed ) && speed,6257 duration: speed,6258 easing: fn && easing || easing && !jquery.isfunction(easing) && easing6259 };6260 opt.duration = jquery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :6261 opt.duration in jquery.fx.speeds ? jquery.fx.speeds[opt.duration] : jquery.fx.speeds._default;6262 // queueing6263 opt.old = opt.complete;6264 opt.complete = function() {6265 if ( opt.queue !== false ) {6266 jquery(this).dequeue();6267 }6268 if ( jquery.isfunction( opt.old ) ) {6269 opt.old.call( this );6270 }6271 };6272 return opt;6273 },6274 easing: {6275 linear: function( p, n, firstnum, diff ) {6276 return firstnum + diff * p;6277 },6278 swing: function( p, n, firstnum, diff ) {6279 return ((-math.cos(p*math.pi)/2) + 0.5) * diff + firstnum;6280 }6281 },6282 timers: [],